1
0
mirror of https://github.com/RPCS3/llvm-mirror.git synced 2024-10-19 19:12:56 +02:00

Add conversion constructor to convert ArrayRef<T*> to ArrayRef<const T*>. Reviewed with Chandler and David Blaikie.

llvm-svn: 216709
This commit is contained in:
Craig Topper 2014-08-29 06:01:43 +00:00
parent bffae55891
commit d1050f2c28

View File

@ -104,6 +104,14 @@ namespace llvm {
Length(Vec.size()) {}
#endif
/// Construct an ArrayRef<const T*> from ArrayRef<T*>. This uses SFINAE to
/// ensure that only ArrayRefs of pointers can be converted.
template <typename U>
ArrayRef(const ArrayRef<U *> &A,
typename std::enable_if<
std::is_convertible<U *const *, T const *>::value>::type* = 0)
: Data(A.data()), Length(A.size()) {}
/// @}
/// @name Simple Operations
/// @{