Re-land rL322538 "Add a value_type to ArrayRef."

llvm-svn: 351954
This commit is contained in:
Clement Courbet 2019-01-23 14:20:59 +00:00
parent 0e08b6f017
commit c7956346da
2 changed files with 9 additions and 0 deletions

View File

@ -44,6 +44,7 @@ namespace llvm {
using const_iterator = const T *;
using size_type = size_t;
using reverse_iterator = std::reverse_iterator<iterator>;
using value_type = typename std::remove_cv<T>::type;
private:
/// The start of the array, in an external buffer.

View File

@ -51,6 +51,14 @@ static_assert(
"Assigning from an initializer list");
#endif
// Check Typedefs.
static_assert(
std::is_same<ArrayRef<int>::value_type, int>::value,
"erroneous value_type");
static_assert(
std::is_same<ArrayRef<const int>::value_type, int>::value,
"erroneous value_type");
namespace {
TEST(ArrayRefTest, AllocatorCopy) {