[PATCH] D41666: Add a value_type to ArrayRef.
Clement Courbet via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 16 01:12:43 PST 2018
This revision was automatically updated to reflect the committed changes.
Closed by commit rL322538: Add a value_type to ArrayRef. (authored by courbet, committed by ).
Repository:
rL LLVM
https://reviews.llvm.org/D41666
Files:
llvm/trunk/include/llvm/ADT/ArrayRef.h
llvm/trunk/unittests/ADT/ArrayRefTest.cpp
Index: llvm/trunk/unittests/ADT/ArrayRefTest.cpp
===================================================================
--- llvm/trunk/unittests/ADT/ArrayRefTest.cpp
+++ llvm/trunk/unittests/ADT/ArrayRefTest.cpp
@@ -52,6 +52,14 @@
"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) {
Index: llvm/trunk/include/llvm/ADT/ArrayRef.h
===================================================================
--- llvm/trunk/include/llvm/ADT/ArrayRef.h
+++ llvm/trunk/include/llvm/ADT/ArrayRef.h
@@ -45,6 +45,7 @@
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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D41666.129924.patch
Type: text/x-patch
Size: 1049 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180116/8496b4cf/attachment.bin>
More information about the llvm-commits
mailing list