nullary_function.hpp
Go to the documentation of this file.
00001 
00008 /*****************************************************************************
00009 ** Ifdefs
00010 *****************************************************************************/
00011 
00012 #ifndef ECL_CONCEPTS_NULLARY_FUNCTION_HPP_
00013 #define ECL_CONCEPTS_NULLARY_FUNCTION_HPP_
00014 
00015 /*****************************************************************************
00016 ** Includes
00017 *****************************************************************************/
00018 
00019 #include "macros.hpp"
00020 
00021 /*****************************************************************************
00022 ** Namespaces
00023 *****************************************************************************/
00024 
00025 namespace ecl {
00026 
00027 /*****************************************************************************
00028 ** Concept [Container]
00029 *****************************************************************************/
00030 
00034 template <typename Implementation>
00035 class NullaryFunctionConcept {
00036     public:
00037 
00046                 ecl_compile_time_concept_test(NullaryFunctionConcept)
00047         {
00048                 typedef typename Implementation::result_type return_type;
00049                 function();
00050                 // Unfortunately we can't test for the result type to match a certain value here
00051                 // as this would then have 2 template arguments with a separating comma. That throws
00052                 // the compile_time_concept_check macro into thinking it has two macro arguments.
00053         }
00054 
00055     private:
00056         // Putting instantiations here actually saves instantiation (which can cause a
00057         // problem if there is no default constructor).
00058         Implementation function;
00059 };
00060 
00061 }; // namespace ecl
00062 
00063 #endif /* ECL_CONCEPTS_NULLARY_FUNCTION_HPP_ */


ecl_concepts
Author(s): Daniel Stonier
autogenerated on Sun Oct 5 2014 23:35:23