Jpp  19.0.0
the software that should make you happy
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
JConstructor.hh
Go to the documentation of this file.
1 #ifndef __JLANG__JCONSTRUCTOR__
2 #define __JLANG__JCONSTRUCTOR__
3 
4 #include <utility>
5 
6 #include "JLang/JTest.hh"
7 
8 /**
9  * \author mdejong
10  */
11 
12 namespace JLANG {}
13 namespace JPP { using namespace JLANG; }
14 
15 namespace JLANG {
16 
17  /**
18  * Template class test for availability of a suitable constructor <tt>JType_t(const JArgument_t)</tt>.
19  */
20  template<class JType_t, class JArgument_t>
21  class JConstructor :
22  public JTest
23  {
24  using JTest::test;
25 
26  static JTrue test(const JType_t&);
27 
28  public:
29  static const bool has_constructor = JTEST(test(std::declval<JArgument_t>())); //!< true if JType_t can be constructed from JArgument_t; else false
30  };
31 }
32 
33 #endif
#define JTEST(__A__)
Test macro.
Definition: JTest.hh:45
static JFalse test(...)
default false
static const bool has_constructor
true if JType_t can be constructed from JArgument_t; else false
Definition: JConstructor.hh:29
Auxiliary base class for compile time evaluation of test.
Definition: JTest.hh:21
definition of true
Definition: JTest.hh:24
static JTrue test(const JType_t &)
Template class test for availability of a suitable constructor JType_t(const JArgument_t).
Definition: JConstructor.hh:21