1 /*-----------------------------------------------------------------------------+
2 Copyright (c) 2008-2010: Joachim Faulhaber
3 +------------------------------------------------------------------------------+
4 Distributed under the Boost Software License, Version 1.0.
5 (See accompanying file LICENCE.txt or copy at
6 http://www.boost.org/LICENSE_1_0.txt)
7 +-----------------------------------------------------------------------------*/
8 #ifndef BOOST_ICL_TYPE_TRAITS_UNIT_ELEMENT_HPP_JOFA_080912
9 #define BOOST_ICL_TYPE_TRAITS_UNIT_ELEMENT_HPP_JOFA_080912
12 #include <boost/icl/type_traits/identity_element.hpp>
13 #include <boost/icl/type_traits/succ_pred.hpp>
15 namespace boost{ namespace icl
17 template <class Type> struct unit_element{ static Type value(); };
19 template<> inline bool unit_element<bool>::value() { return true;}
20 template<> inline float unit_element<float>::value() { return 1.0; }
21 template<> inline double unit_element<double>::value() { return 1.0; }
22 template<> inline long double unit_element<long double>::value()
25 // Smallest 'visible' string that is greater than the empty string.
27 inline std::string unit_element<std::string>::value()
28 { return std::string(" "); }
31 inline Type unit_element<Type>::value()
32 { return icl::succ(identity_element<Type>::value()); }
34 }} // namespace boost icl