Skip to content

Commit

Permalink
Make find function acting on types uniformly callable.
Browse files Browse the repository at this point in the history
  • Loading branch information
HaxyM authored Sep 3, 2024
1 parent aeeebe0 commit 55b484c
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions include/crap/algorithm.d/findtype.h
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#ifndef CRAP_ALGORITHM_FINDTYPE
#define CRAP_ALGORITHM_FINDTYPE

#include "findiftype.h"

#include <cstddef>

#include "findiftype.h"
#include "../version.d/libintegralconstantcallable.h"

namespace crap
{
template <class Type, template <class, class> class Operator, class ... Types>
Expand All @@ -17,6 +18,9 @@ namespace crap
constexpr const static std :: size_t npos = findIfType <condition, Types...> :: npos;
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 @@ -26,5 +30,14 @@ template <class Type, template <class, class> class Operator, class ... Types>
{
return crap :: findType <Type, Operator, Types...> :: value;
}
#if (crap_lib_integral_constant_callable >= 201304L)

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

0 comments on commit 55b484c

Please sign in to comment.