Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r65216 - sandbox/itl/boost/itl/type_traits
From: afojgo_at_[hidden]
Date: 2010-09-03 06:56:54


Author: jofaber
Date: 2010-09-03 06:56:53 EDT (Fri, 03 Sep 2010)
New Revision: 65216
URL: http://svn.boost.org/trac/boost/changeset/65216

Log:
Refactoring. Unifying interval_sets: Extraction of major functions complete. Stable{msvc-9.0, gcc-3.4.4}
Added:
   sandbox/itl/boost/itl/type_traits/domain_type_of.hpp (contents, props changed)
   sandbox/itl/boost/itl/type_traits/no_type.hpp (contents, props changed)
   sandbox/itl/boost/itl/type_traits/segment_type_of.hpp (contents, props changed)

Added: sandbox/itl/boost/itl/type_traits/domain_type_of.hpp
==============================================================================
--- (empty file)
+++ sandbox/itl/boost/itl/type_traits/domain_type_of.hpp 2010-09-03 06:56:53 EDT (Fri, 03 Sep 2010)
@@ -0,0 +1,53 @@
+/*-----------------------------------------------------------------------------+
+Copyright (c) 2008-2009: Joachim Faulhaber
++------------------------------------------------------------------------------+
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENCE.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
++-----------------------------------------------------------------------------*/
+#ifndef BOOST_ITL_TYPE_TRAITS_DOMAIN_TYPE_OF_HPP_JOFA_100902
+#define BOOST_ITL_TYPE_TRAITS_DOMAIN_TYPE_OF_HPP_JOFA_100902
+
+#include <boost/mpl/has_xxx.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/itl/type_traits/no_type.hpp>
+
+namespace boost{ namespace itl
+{
+ namespace detail
+ {
+ BOOST_MPL_HAS_XXX_TRAIT_DEF(domain_type)
+ }
+
+ template <class Type>
+ struct has_domain_type
+ : mpl::bool_<detail::has_domain_type<Type>::value>
+ {};
+
+ template <class Type, bool has_domain_type>
+ struct get_domain_type;
+
+ template <class Type>
+ struct get_domain_type<Type, false>
+ {
+ typedef no_type type;
+ };
+
+ template <class Type>
+ struct get_domain_type<Type, true>
+ {
+ typedef typename Type::domain_type type;
+ };
+
+ template <class Type>
+ struct domain_type_of
+ {
+ typedef typename
+ get_domain_type<Type, has_domain_type<Type>::value>::type type;
+ };
+
+}} // namespace boost itl
+
+#endif
+
+

Added: sandbox/itl/boost/itl/type_traits/no_type.hpp
==============================================================================
--- (empty file)
+++ sandbox/itl/boost/itl/type_traits/no_type.hpp 2010-09-03 06:56:53 EDT (Fri, 03 Sep 2010)
@@ -0,0 +1,19 @@
+/*-----------------------------------------------------------------------------+
+Copyright (c) 2008-2009: Joachim Faulhaber
++------------------------------------------------------------------------------+
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENCE.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
++-----------------------------------------------------------------------------*/
+#ifndef BOOST_ITL_TYPE_TRAITS_NO_TYPE_HPP_JOFA_100902
+#define BOOST_ITL_TYPE_TRAITS_NO_TYPE_HPP_JOFA_100902
+
+namespace boost{ namespace itl
+{
+ struct no_type{};
+
+}} // namespace boost itl
+
+#endif
+
+

Added: sandbox/itl/boost/itl/type_traits/segment_type_of.hpp
==============================================================================
--- (empty file)
+++ sandbox/itl/boost/itl/type_traits/segment_type_of.hpp 2010-09-03 06:56:53 EDT (Fri, 03 Sep 2010)
@@ -0,0 +1,53 @@
+/*-----------------------------------------------------------------------------+
+Copyright (c) 2008-2009: Joachim Faulhaber
++------------------------------------------------------------------------------+
+ Distributed under the Boost Software License, Version 1.0.
+ (See accompanying file LICENCE.txt or copy at
+ http://www.boost.org/LICENSE_1_0.txt)
++-----------------------------------------------------------------------------*/
+#ifndef BOOST_ITL_TYPE_TRAITS_SEGMENT_TYPE_OF_HPP_JOFA_100902
+#define BOOST_ITL_TYPE_TRAITS_SEGMENT_TYPE_OF_HPP_JOFA_100902
+
+#include <boost/mpl/has_xxx.hpp>
+#include <boost/mpl/bool.hpp>
+#include <boost/itl/type_traits/no_type.hpp>
+
+namespace boost{ namespace itl
+{
+ namespace detail
+ {
+ BOOST_MPL_HAS_XXX_TRAIT_DEF(segment_type)
+ }
+
+ template <class Type>
+ struct has_segment_type
+ : mpl::bool_<detail::has_segment_type<Type>::value>
+ {};
+
+ template <class Type, bool has_segment_type>
+ struct get_segment_type;
+
+ template <class Type>
+ struct get_segment_type<Type, false>
+ {
+ typedef no_type type;
+ };
+
+ template <class Type>
+ struct get_segment_type<Type, true>
+ {
+ typedef typename Type::segment_type type;
+ };
+
+ template <class Type>
+ struct segment_type_of
+ {
+ typedef typename
+ get_segment_type<Type, has_segment_type<Type>::value>::type type;
+ };
+
+}} // namespace boost itl
+
+#endif
+
+


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk