Support Class Library
A set of tools providing classes and utility
is_concept.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <type_traits>
7 #include <scl/macros.h>
8 
9 namespace scl{
10  namespace concepts{
11  namespace details{
12  template <class T, class = void>
13  struct __is_concept : std::false_type{};
14 
15  template <class T>
17  META::is_convertible<T, bool>()
18  && META::is_default_constructible<T>()
19  >> : std::true_type{};
20  }
21 
27  template <class T>
28  constexpr bool is_concept(){
30  }
31 
32  /*
33  A concept type can be defined as follows:
34  template <class T>
35  struct Integral{
36  constexpr operator bool() const{
37  static_assert(meta::is_integral<T>(), "Fails to meet the requirements of Integral concept");
38  return true;
39  }
40  }
41 
42  They are defined in such a way that you can easily compose them via the require function:
43  template <class T>
44  struct Copyable{
45  constexpr operator bool() const{
46  require(CopyConstructible<T>{});
47  require(CopyAssignable<T>{});
48  return true;
49  }
50  }
51  */
52  }
53 }
54 #undef SCL_META
Global namespace of the SCL.
Definition: alias.hpp:3
#define META
Definition: macros.h:8
constexpr bool is_concept()
Determine whether or not a given type is a concept-like type.
Definition: is_concept.h:28
typename std::enable_if< B, T >::type enable_if_t
An handy type alias for the result of std::enable_if.
Definition: enable_if.h:12