|
11 | 11 | #include <boost/assert.hpp> |
12 | 12 |
|
13 | 13 | #include <array> |
| 14 | +#include <concepts> |
14 | 15 | #include <functional> |
15 | 16 | #include <iterator> |
16 | 17 | #include <limits> |
@@ -359,24 +360,20 @@ template <typename GroupBlockPolicy, storage::Ownership Ownership> struct Indexe |
359 | 360 | const IndexedDataImpl &index_data); |
360 | 361 |
|
361 | 362 | private: |
362 | | - template <typename Iter, typename T> |
363 | | - using IsValueIterator = std::enable_if_t< |
364 | | - std::is_same<T, |
365 | | - std::remove_const_t<typename std::iterator_traits<Iter>::value_type>>::value>; |
366 | | - |
367 | | - template <typename T = ResultType, typename Iter, typename = IsValueIterator<Iter, ValueType>> |
368 | | - std::enable_if<!std::is_same<T, std::string_view>::value, T>::type adapt(const Iter first, |
369 | | - const Iter last) const |
| 363 | + template <typename T = ResultType, typename Iter> |
| 364 | + requires std::same_as<std::remove_const_t<typename std::iterator_traits<Iter>::value_type>, |
| 365 | + ValueType> |
| 366 | + T adapt(const Iter first, const Iter last) const |
370 | 367 | { |
371 | | - return ResultType(first, last); |
372 | | - } |
373 | | - |
374 | | - template <typename T = ResultType, typename Iter, typename = IsValueIterator<Iter, ValueType>> |
375 | | - std::enable_if<std::is_same<T, std::string_view>::value, T>::type adapt(const Iter first, |
376 | | - const Iter last) const |
377 | | - { |
378 | | - auto diff = std::distance(first, last); |
379 | | - return diff == 0 ? ResultType() : ResultType(&*first, diff); |
| 368 | + if constexpr (std::is_same_v<T, std::string_view>) |
| 369 | + { |
| 370 | + auto diff = std::distance(first, last); |
| 371 | + return diff == 0 ? ResultType() : ResultType(&*first, diff); |
| 372 | + } |
| 373 | + else |
| 374 | + { |
| 375 | + return ResultType(first, last); |
| 376 | + } |
380 | 377 | } |
381 | 378 |
|
382 | 379 | template <typename T> using Vector = util::ViewOrVector<T, Ownership>; |
|
0 commit comments