Implement SFINAE friendly iterator_traits and use that instead.
This commit is contained in:
parent
e3c28afb61
commit
f665a92330
5 changed files with 120 additions and 20 deletions
|
@ -331,7 +331,7 @@ class input_adapter
|
|||
/// input adapter for iterator range with contiguous storage
|
||||
template<class IteratorType,
|
||||
typename std::enable_if<
|
||||
std::is_same<typename std::iterator_traits<IteratorType>::iterator_category, std::random_access_iterator_tag>::value,
|
||||
std::is_same<typename iterator_traits<IteratorType>::iterator_category, std::random_access_iterator_tag>::value,
|
||||
int>::type = 0>
|
||||
input_adapter(IteratorType first, IteratorType last)
|
||||
{
|
||||
|
@ -350,7 +350,7 @@ class input_adapter
|
|||
|
||||
// assertion to check that each element is 1 byte long
|
||||
static_assert(
|
||||
sizeof(typename std::iterator_traits<IteratorType>::value_type) == 1,
|
||||
sizeof(typename iterator_traits<IteratorType>::value_type) == 1,
|
||||
"each element in the iterator range must have the size of 1 byte");
|
||||
|
||||
const auto len = static_cast<size_t>(std::distance(first, last));
|
||||
|
@ -374,7 +374,7 @@ class input_adapter
|
|||
/// input adapter for contiguous container
|
||||
template<class ContiguousContainer, typename
|
||||
std::enable_if<not std::is_pointer<ContiguousContainer>::value and
|
||||
std::is_base_of<std::random_access_iterator_tag, typename std::iterator_traits<decltype(std::begin(std::declval<ContiguousContainer const>()))>::iterator_category>::value,
|
||||
std::is_base_of<std::random_access_iterator_tag, typename iterator_traits<decltype(std::begin(std::declval<ContiguousContainer const>()))>::iterator_category>::value,
|
||||
int>::type = 0>
|
||||
input_adapter(const ContiguousContainer& c)
|
||||
: input_adapter(std::begin(c), std::end(c)) {}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue