iterator: add index_type trait
This commit is contained in:
parent
279af4c796
commit
4094a96160
18
iterator.hpp
18
iterator.hpp
@ -229,6 +229,24 @@ namespace util {
|
||||
}
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
/// a trait that stores a type suitable for indexing a container
|
||||
template <typename, typename = std::void_t<>>
|
||||
struct index_type { using type = std::size_t; };
|
||||
|
||||
|
||||
//-------------------------------------------------------------------------
|
||||
template <typename ContainerT>
|
||||
struct index_type<
|
||||
ContainerT,
|
||||
std::void_t<
|
||||
typename ContainerT::index_t
|
||||
>
|
||||
> {
|
||||
using type = typename ContainerT::index_t;
|
||||
};
|
||||
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template <typename ContainerT>
|
||||
class indices {
|
||||
|
Loading…
Reference in New Issue
Block a user