nullary_function.hpp
Go to the documentation of this file.
1 
8 /*****************************************************************************
9 ** Ifdefs
10 *****************************************************************************/
11 
12 #ifndef ECL_CONCEPTS_NULLARY_FUNCTION_HPP_
13 #define ECL_CONCEPTS_NULLARY_FUNCTION_HPP_
14 
15 /*****************************************************************************
16 ** Includes
17 *****************************************************************************/
18 
19 #include "macros.hpp"
20 
21 /*****************************************************************************
22 ** Namespaces
23 *****************************************************************************/
24 
25 namespace ecl {
26 
27 /*****************************************************************************
28 ** Concept [Container]
29 *****************************************************************************/
30 
34 template <typename Implementation>
35 class NullaryFunctionConcept {
36  public:
37 
46  ecl_compile_time_concept_test(NullaryFunctionConcept)
47  {
48  typedef typename Implementation::result_type return_type;
49  function();
50  // Unfortunately we can't test for the result type to match a certain value here
51  // as this would then have 2 template arguments with a separating comma. That throws
52  // the compile_time_concept_check macro into thinking it has two macro arguments.
53  }
54 
55  private:
56  // Putting instantiations here actually saves instantiation (which can cause a
57  // problem if there is no default constructor).
58  Implementation function;
59 };
60 
61 }; // namespace ecl
62 
63 #endif /* ECL_CONCEPTS_NULLARY_FUNCTION_HPP_ */
macros.hpp
Mechanisms enabling compile time checking of metaprogramming concepts.
ecl::NullaryFunctionConcept::ecl_compile_time_concept_test
ecl_compile_time_concept_test(NullaryFunctionConcept)
Implements a concept test for nullary functions.
Definition: nullary_function.hpp:60
ecl
Embedded control libraries.


ecl_concepts
Author(s): Daniel Stonier
autogenerated on Sun Aug 2 2020 03:12:08