* Create a range from two iterators, with type deduction.
*/
template <class Iter>
-Range<Iter> range(Iter first, Iter last) {
+constexpr Range<Iter> range(Iter first, Iter last) {
return Range<Iter>(first, last);
}
* Creates a range to reference the contents of a contiguous-storage container.
*/
// Use pointers for types with '.data()' member
-template <class Collection,
- class T = typename std::remove_pointer<
- decltype(std::declval<Collection>().data())>::type>
-Range<T*> range(Collection&& v) {
+template <
+ class Collection,
+ class T = typename std::remove_pointer<
+ decltype(std::declval<Collection>().data())>::type>
+constexpr Range<T*> range(Collection&& v) {
return Range<T*>(v.data(), v.data() + v.size());
}
template <class T, size_t n>
-Range<T*> range(T (&array)[n]) {
+constexpr Range<T*> range(T (&array)[n]) {
return Range<T*>(array, array + n);
}