Explicit.h
Go to the documentation of this file.
1 // this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*-
2 
3 // -- BEGIN LICENSE BLOCK ----------------------------------------------
4 // This file is part of FZIs ic_workspace.
5 //
6 // This program is free software licensed under the LGPL
7 // (GNU LESSER GENERAL PUBLIC LICENSE Version 3).
8 // You can find a copy of this license in LICENSE folder in the top
9 // directory of the source code.
10 //
11 // © Copyright 2016 FZI Forschungszentrum Informatik, Karlsruhe, Germany
12 //
13 // -- END LICENSE BLOCK ------------------------------------------------
14 
15 //----------------------------------------------------------------------
22 //----------------------------------------------------------------------
23 #ifndef ICL_CORE_EXPLICIT_H_INCLUDED
24 #define ICL_CORE_EXPLICIT_H_INCLUDED
25 
26 #include <boost/type_traits.hpp>
27 
28 namespace icl_core {
29 
30 namespace internal {
31 
33 template <bool cond> struct ExplicitEnforceMeaning
34 { };
35 template <> struct ExplicitEnforceMeaning<true>
36 {
37  enum { EXPLICIT_TYPE_MEANING_MUST_BE_AN_EMPTY_CLASS_TYPE = 0 };
38 };
39 
40 }
41 
66 template <typename T, typename Meaning>
67 struct Explicit
68 {
71  {
72  (void) internal::ExplicitEnforceMeaning<boost::is_stateless<Meaning>::value>::EXPLICIT_TYPE_MEANING_MUST_BE_AN_EMPTY_CLASS_TYPE;
73  }
74 
76  Explicit(T value)
77  : value(value)
78  { }
79 
81  inline operator T () const { return value; }
82 
84  T value;
85 };
86 
87 }
88 
89 #endif
Explicit()
Default constructor does not initialize the value.
Definition: Explicit.h:70
Internal helper class for icl_core::Explicit, do not use directly.
Definition: Explicit.h:33
T value
The actual fundamental value.
Definition: Explicit.h:84
Explicit(T value)
Construction from a fundamental value.
Definition: Explicit.h:76


fzi_icl_core
Author(s):
autogenerated on Mon Jun 10 2019 13:17:58