Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r68103 - in sandbox/statistics/support/boost/assign/v2/ref: convert_traits range
From: erwann.rogard_at_[hidden]
Date: 2011-01-13 11:15:53


Author: e_r
Date: 2011-01-13 11:15:41 EST (Thu, 13 Jan 2011)
New Revision: 68103
URL: http://svn.boost.org/trac/boost/changeset/68103

Log:
upd boost/assign/v2
Added:
   sandbox/statistics/support/boost/assign/v2/ref/convert_traits/
   sandbox/statistics/support/boost/assign/v2/ref/convert_traits/checking.hpp (contents, props changed)
   sandbox/statistics/support/boost/assign/v2/ref/convert_traits/const.hpp (contents, props changed)
   sandbox/statistics/support/boost/assign/v2/ref/convert_traits/reference.hpp (contents, props changed)
   sandbox/statistics/support/boost/assign/v2/ref/convert_traits/value.hpp (contents, props changed)
   sandbox/statistics/support/boost/assign/v2/ref/range/

Added: sandbox/statistics/support/boost/assign/v2/ref/convert_traits/checking.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/support/boost/assign/v2/ref/convert_traits/checking.hpp 2011-01-13 11:15:41 EST (Thu, 13 Jan 2011)
@@ -0,0 +1,132 @@
+//////////////////////////////////////////////////////////////////////////////
+// Boost.Assign v2 //
+// //
+// Copyright (C) 2003-2004 Thorsten Ottosen //
+// Copyright (C) 2010 Erwann Rogard //
+// Use, modification and distribution are subject to the //
+// Boost Software License, Version 1.0. (See accompanying file //
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) //
+//////////////////////////////////////////////////////////////////////////////
+#ifndef BOOST_ASSIGN_V2_REF_CONVERT_TRAITS_CHECKING_ER_2010_HPP
+#define BOOST_ASSIGN_V2_REF_CONVERT_TRAITS_CHECKING_ER_2010_HPP
+#include <boost/mpl/assert.hpp>
+//#include <boost/utility/enable_if.hpp>
+#include <boost/type_traits/is_same.hpp>
+#include <boost/assign/v2/ref/convert_traits/reference.hpp>
+
+namespace boost{
+namespace assign{
+namespace v2{
+namespace ref{
+namespace convert_traits{
+namespace checking{
+
+ template<typename T1, typename T2, typename T3>
+ struct tester{
+
+ typedef typename convert_traits::reference<T1, T2>::type result_;
+
+ static void test()
+ {
+ BOOST_MPL_ASSERT((boost::is_same<result_,T3>));
+ }
+
+ };
+
+namespace same_value_type{
+
+ template<typename T>
+ void do_check()
+ {
+
+ tester<const T &, const T &, const T &>::test();
+ tester<const T &, T &, const T &>::test();
+ tester< T &, const T &, const T &>::test();
+ tester< T &, T &, T &>::test();
+
+ tester<const T &, const T , const T >::test();
+ tester<const T &, T , const T >::test();
+ tester< T &, const T , const T >::test();
+ tester< T &, T , T >::test();
+
+ tester<const T , const T &, const T >::test();
+ tester<const T , T &, const T >::test();
+ tester< T , const T &, const T >::test();
+ tester< T , T &, T >::test();
+
+ tester<const T , const T , const T >::test();
+ tester<const T , T , const T >::test();
+ tester< T , const T , const T >::test();
+ tester< T , T , T >::test();
+
+ }
+
+}// twin_values
+// TODO upgrade
+/*
+namespace distinct_value_type{
+
+ template<typename T1,typename T2,typename T3>
+ void do_check_impl(const T1&, const T2& ,const T3&)
+ {
+
+ tester<const T1&, const T2&, const T3 >::test();
+ tester<const T1&, T2&, const T3 >::test();
+ tester< T1&, const T2&, const T3 >::test();
+ tester< T1&, T2&, T3 >::test();
+
+ tester<const T1&, const T2 , const T3 >::test();
+ tester<const T1&, T2 , const T3 >::test();
+ tester< T1&, const T2 , const T3 >::test();
+ tester< T1&, T2 , T3 >::test();
+
+ tester<const T1 , const T2&, const T3 >::test();
+ tester<const T1 , T2&, const T3 >::test();
+ tester< T1 , const T2&, const T3 >::test();
+ tester< T1 , T2&, T3 >::test();
+
+ tester<const T1 , const T2 , const T3 >::test();
+ tester<const T1 , T2 , const T3 >::test();
+ tester< T1 , const T2 , const T3 >::test();
+ tester< T1 , T2 , T3 >::test();
+
+ }
+
+#define MACRO(T1, T2, T3) \
+ template<typename T> \
+ void do_check( \
+ typename boost::enable_if< \
+ boost::is_same<T,T1> \
+ >::type* = 0 \
+ ) \
+ { \
+ distinct_values::do_check_impl( T1(), T2(), T3() ); \
+ } \
+*/
+/**/
+/*
+// don't try to guess the supertype, it may vary by compiler.
+namespace supertype_{
+ typedef boost::numeric::conversion_traits<short, int>::supertype a_;
+ typedef boost::numeric::conversion_traits<int, long>::supertype b_;
+ typedef boost::numeric::conversion_traits<float, double>::supertype c_;
+ typedef boost::numeric::conversion_traits<
+ double,long double>::supertype d_;
+}// supertype_
+MACRO(short , int, supertype_::a_)
+MACRO(int , long, supertype_::b_)
+MACRO(float , double, supertype_::c_)
+typedef long double long_double_;
+MACRO(double , long_double_, workaround::d_)
+#undef MACRO
+}// distinct_value_type
+*/
+
+}// checking
+}// convert_traits
+}// ref
+}// v2
+}// assign
+}// boost
+
+#endif

Added: sandbox/statistics/support/boost/assign/v2/ref/convert_traits/const.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/support/boost/assign/v2/ref/convert_traits/const.hpp 2011-01-13 11:15:41 EST (Thu, 13 Jan 2011)
@@ -0,0 +1,47 @@
+//////////////////////////////////////////////////////////////////////////////
+// Boost.Assign v2 //
+// //
+// Copyright (C) 2003-2004 Thorsten Ottosen //
+// Copyright (C) 2010 Erwann Rogard //
+// Use, modification and distribution are subject to the //
+// Boost Software License, Version 1.0. (See accompanying file //
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) //
+//////////////////////////////////////////////////////////////////////////////
+#ifndef BOOST_ASSIGN_V2_REF_CONVERT_TRAITS_CONST_ER_2010_HPP
+#define BOOST_ASSIGN_V2_REF_CONVERT_TRAITS_CONST_ER_2010_HPP
+#include <boost/type_traits/is_const.hpp>
+#include <boost/type_traits/add_const.hpp>
+#include <boost/type_traits/remove_cv.hpp>
+#include <boost/assign/v2/ref/convert_traits/value.hpp>
+
+namespace boost{
+namespace assign{
+namespace v2{
+namespace ref{
+namespace convert_traits{
+
+ template<
+ typename T1, typename T2, bool is_c
+ = boost::is_const<T1>::value || boost::is_const<T2>::value
+ >
+ struct const_
+ {
+ typedef typename convert_traits::value<
+ typename boost::remove_cv<T1>::type,
+ typename boost::remove_cv<T2>::type
+ >::type type;
+
+ };
+
+ template<typename T1, typename T2>
+ struct const_<T1, T2, true> : boost::add_const<
+ typename const_<T1, T2, false>::type
+ >{};
+
+}// convert_traits
+}// ref
+}// v2
+}// assign
+}// boost
+
+#endif

Added: sandbox/statistics/support/boost/assign/v2/ref/convert_traits/reference.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/support/boost/assign/v2/ref/convert_traits/reference.hpp 2011-01-13 11:15:41 EST (Thu, 13 Jan 2011)
@@ -0,0 +1,43 @@
+//////////////////////////////////////////////////////////////////////////////
+// Boost.Assign v2 //
+// //
+// Copyright (C) 2003-2004 Thorsten Ottosen //
+// Copyright (C) 2010 Erwann Rogard //
+// Use, modification and distribution are subject to the //
+// Boost Software License, Version 1.0. (See accompanying file //
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) //
+//////////////////////////////////////////////////////////////////////////////
+#ifndef BOOST_ASSIGN_V2_REF_CONVERT_TRAITS_REFERENCE_ER_2010_HPP
+#define BOOST_ASSIGN_V2_REF_CONVERT_TRAITS_REFERENCE_ER_2010_HPP
+#include <boost/type_traits/remove_reference.hpp>
+#include <boost/assign/v2/ref/convert_traits/const.hpp>
+
+namespace boost{
+namespace assign{
+namespace v2{
+namespace ref{
+namespace convert_traits{
+
+ template<typename U1, typename U2>
+ struct reference : convert_traits::const_<
+ typename boost::remove_reference<U1>::type,
+ typename boost::remove_reference<U2>::type
+ >{};
+
+ template<typename T>
+ struct reference<T&, T&>{ typedef T& type; };
+
+ template<typename T>
+ struct reference<T const&, T&>{ typedef T const& type; };
+
+ template<typename T>
+ struct reference<T &, T const&>{ typedef T const& type; };
+
+}// convert_traits
+}// ref
+}// v2
+}// assign
+}// boost
+
+#endif
+

Added: sandbox/statistics/support/boost/assign/v2/ref/convert_traits/value.hpp
==============================================================================
--- (empty file)
+++ sandbox/statistics/support/boost/assign/v2/ref/convert_traits/value.hpp 2011-01-13 11:15:41 EST (Thu, 13 Jan 2011)
@@ -0,0 +1,48 @@
+//////////////////////////////////////////////////////////////////////////////
+// Boost.Assign v2 //
+// //
+// Copyright (C) 2003-2004 Thorsten Ottosen //
+// Copyright (C) 2010 Erwann Rogard //
+// Use, modification and distribution are subject to the //
+// Boost Software License, Version 1.0. (See accompanying file //
+// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) //
+//////////////////////////////////////////////////////////////////////////////
+#ifndef BOOST_ASSIGN_V2_REF_CONVERT_TRAITS_VALUE_ER_2010_HPP
+#define BOOST_ASSIGN_V2_REF_CONVERT_TRAITS_VALUE_ER_2010_HPP
+#include <boost/type_traits/is_convertible.hpp>
+
+namespace boost{
+namespace assign{
+namespace v2{
+namespace ref{
+namespace convert_traits{
+
+ template<
+ typename V1, typename V2,
+ bool is_c1 = boost::is_convertible<V1, V2>::value,
+ bool is_c2 = boost::is_convertible<V2, V1>::value
+ >
+ struct value{ typedef V1 type; };
+
+ template<typename V1, typename V2>
+ struct value<V1, V2, false, true>{ typedef V2 type; };
+
+ template<typename V1, typename V2> struct value<V1, V2, false, false>{};
+
+ // TODO upgrade
+ // #include <boost/type_traits/is_arithmetic.hpp>
+ // #include <boost/numeric/conversion/conversion_traits.hpp>
+ // struct value : boost::mpl::eval_if<
+ // mpl::and_<is_arithmetic<V1>, is_arithmetic<V2> >,
+ // boost::numeric::conversion_traits<V1, V2>::supertype.
+ // ... as above ...
+ // >{};
+
+
+}// convert_traits
+}// ref
+}// v2
+}// assign
+}// boost
+
+#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