clang-format
This commit is contained in:
+19
-17
@@ -26,33 +26,35 @@
|
||||
namespace utils
|
||||
{
|
||||
|
||||
template<typename T>
|
||||
concept has_const_iterator = requires {
|
||||
std::declval<typename T::const_iterator>();
|
||||
};
|
||||
template <typename T>
|
||||
concept has_const_iterator = requires {
|
||||
std::declval<typename T::const_iterator>();
|
||||
};
|
||||
|
||||
template<typename T, bool> struct get_const_iterator_aux;
|
||||
template <typename T, bool>
|
||||
struct get_const_iterator_aux;
|
||||
|
||||
template<typename T> struct get_const_iterator_aux<T, true>
|
||||
{
|
||||
using const_iterator = T::const_iterator;
|
||||
};
|
||||
template <typename T>
|
||||
struct get_const_iterator_aux<T, true>
|
||||
{
|
||||
using const_iterator = T::const_iterator;
|
||||
};
|
||||
|
||||
template<typename T> struct get_const_iterator_aux<T, false>
|
||||
{
|
||||
using const_iterator = T::iterator;
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
using get_const_iterator = get_const_iterator_aux<T, has_const_iterator<T>>::const_iterator;
|
||||
template <typename T>
|
||||
struct get_const_iterator_aux<T, false>
|
||||
{
|
||||
using const_iterator = T::iterator;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
using get_const_iterator = get_const_iterator_aux<T, has_const_iterator<T>>::const_iterator;
|
||||
|
||||
template <typename T>
|
||||
struct enumerate_range
|
||||
{
|
||||
struct iterator
|
||||
{
|
||||
using underlying_iterator = std::conditional_t<std::is_const_v<T>, get_const_iterator<T>, typename T::iterator>;
|
||||
using underlying_iterator = std::conditional_t<std::is_const_v<T>, get_const_iterator<T>, typename T::iterator>;
|
||||
using underlying_value_type = std::conditional_t<std::is_const_v<T>, const typename T::value_type, typename T::value_type>;
|
||||
|
||||
size_t index;
|
||||
|
||||
Reference in New Issue
Block a user