Skip to content

Commit

Permalink
Make isSortedUntill function acting on values uniformly callable.
Browse files Browse the repository at this point in the history
  • Loading branch information
HaxyM authored Aug 27, 2024
1 parent d6d2e8f commit c92dfdc
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions include/crap/algorithm.d/issorteduntilvalue.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
#define CRAP_ALGORITHM_ISSORTEDUNTILVALUE

#include "../utility.d/valuelist.h"
#include "../version.d/libintegralconstantcallable.h"

namespace crap
{
Expand All @@ -13,6 +14,9 @@ namespace crap
constexpr const static std :: size_t npos = 0u;
using value_type = decltype(value);
constexpr operator value_type () const noexcept;
#if (crap_lib_integral_constant_callable >= 201304L)
constexpr value_type operator () () const noexcept;
#endif
};

template <class Type, template <Type, Type> class Operator, Type Value1> struct isSortedUntilValue<Type, Operator, Value1>
Expand All @@ -21,6 +25,9 @@ namespace crap
constexpr const static std :: size_t npos = 1u;
using value_type = decltype(value);
constexpr operator value_type () const noexcept;
#if (crap_lib_integral_constant_callable >= 201304L)
constexpr value_type operator () () const noexcept;
#endif
};

template <class Type, template <Type, Type> class Operator, Type Value1, Type Value2> struct isSortedUntilValue<Type, Operator, Value1, Value2>
Expand All @@ -29,6 +36,9 @@ namespace crap
constexpr const static std :: size_t npos = 2u;
using value_type = decltype(value);
constexpr operator value_type () const noexcept;
#if (crap_lib_integral_constant_callable >= 201304L)
constexpr value_type operator () () const noexcept;
#endif
};

template <class Type, template <Type, Type> class Operator, Type ... Values> struct isSortedUntilValue
Expand All @@ -49,6 +59,9 @@ namespace crap
constexpr const static std :: size_t npos = (values :: size);
using value_type = decltype(value);
constexpr operator value_type () const noexcept;
#if (crap_lib_integral_constant_callable >= 201304L)
constexpr value_type operator () () const noexcept;
#endif
};
}

Expand All @@ -58,26 +71,62 @@ template <class Type, template <Type, Type> class Operator>
{
return crap :: isSortedUntilValue <Type, Operator> :: value;
}
#if (crap_lib_integral_constant_callable >= 201304L)

template <class Type, template <Type, Type> class Operator>
inline constexpr typename crap :: isSortedUntilValue <Type, Operator> :: value_type
crap :: isSortedUntilValue <Type, Operator> :: operator () () const noexcept
{
return crap :: isSortedUntilValue <Type, Operator> :: value;
}
#endif

template <class Type, template <Type, Type> class Operator, Type Value1>
inline constexpr crap :: isSortedUntilValue <Type, Operator, Value1> :: operator
typename crap :: isSortedUntilValue <Type, Operator, Value1> :: value_type () const noexcept
{
return crap :: isSortedUntilValue <Type, Operator, Value1> :: value;
}
#if (crap_lib_integral_constant_callable >= 201304L)

template <class Type, template <Type, Type> class Operator, Type Value1>
inline constexpr typename crap :: isSortedUntilValue <Type, Operator, Value1> :: value_type
crap :: isSortedUntilValue <Type, Operator, Value1> :: operator () () const noexcept
{
return crap :: isSortedUntilValue <Type, Operator, Value1> :: value;
}
#endif

template <class Type, template <Type, Type> class Operator, Type Value1, Type Value2>
inline constexpr crap :: isSortedUntilValue <Type, Operator, Value1, Value2> :: operator
typename crap :: isSortedUntilValue <Type, Operator, Value1, Value2> :: value_type () const noexcept
{
return crap :: isSortedUntilValue <Type, Operator, Value1, Value2> :: value;
}
#if (crap_lib_integral_constant_callable >= 201304L)

template <class Type, template <Type, Type> class Operator, Type Value1, Type Value2>
inline constexpr typename crap :: isSortedUntilValue <Type, Operator, Value1, Value2> :: value_type
crap :: isSortedUntilValue <Type, Operator, Value1, Value2> :: operator () () const noexcept
{
return crap :: isSortedUntilValue <Type, Operator, Value1, Value2> :: value;
}
#endif

template <class Type, template <Type, Type> class Operator, Type ... Values>
inline constexpr crap :: isSortedUntilValue <Type, Operator, Values...> :: operator
typename crap :: isSortedUntilValue <Type, Operator, Values...> :: value_type () const noexcept
{
return crap :: isSortedUntilValue <Type, Operator, Values...> :: value;
}
#if (crap_lib_integral_constant_callable >= 201304L)

template <class Type, template <Type, Type> class Operator, Type ... Values>
inline constexpr typename crap :: isSortedUntilValue <Type, Operator, Values...> :: value_type
crap :: isSortedUntilValue <Type, Operator, Values...> :: operator () () const noexcept
{
return crap :: isSortedUntilValue <Type, Operator, Values...> :: value;
}
#endif
#endif

0 comments on commit c92dfdc

Please sign in to comment.