Explicit.h
Go to the documentation of this file.
00001 // this is for emacs file handling -*- mode: c++; indent-tabs-mode: nil -*-
00002 
00003 // -- BEGIN LICENSE BLOCK ----------------------------------------------
00004 // This file is part of FZIs ic_workspace.
00005 //
00006 // This program is free software licensed under the LGPL
00007 // (GNU LESSER GENERAL PUBLIC LICENSE Version 3).
00008 // You can find a copy of this license in LICENSE folder in the top
00009 // directory of the source code.
00010 //
00011 // © Copyright 2016 FZI Forschungszentrum Informatik, Karlsruhe, Germany
00012 //
00013 // -- END LICENSE BLOCK ------------------------------------------------
00014 
00015 //----------------------------------------------------------------------
00022 //----------------------------------------------------------------------
00023 #ifndef ICL_CORE_EXPLICIT_H_INCLUDED
00024 #define ICL_CORE_EXPLICIT_H_INCLUDED
00025 
00026 #include <boost/type_traits.hpp>
00027 
00028 namespace icl_core {
00029 
00030 namespace internal {
00031 
00033 template <bool cond> struct ExplicitEnforceMeaning
00034 { };
00035 template <> struct ExplicitEnforceMeaning<true>
00036 {
00037   enum { EXPLICIT_TYPE_MEANING_MUST_BE_AN_EMPTY_CLASS_TYPE = 0 };
00038 };
00039 
00040 }
00041 
00066 template <typename T, typename Meaning>
00067 struct Explicit
00068 {
00070   Explicit()
00071   {
00072     (void) internal::ExplicitEnforceMeaning<boost::is_stateless<Meaning>::value>::EXPLICIT_TYPE_MEANING_MUST_BE_AN_EMPTY_CLASS_TYPE;
00073   }
00074 
00076   Explicit(T value)
00077     : value(value)
00078   { }
00079 
00081   inline operator T () const { return value; }
00082 
00084   T value;
00085 };
00086 
00087 }
00088 
00089 #endif


fzi_icl_core
Author(s):
autogenerated on Tue Aug 8 2017 02:28:03