Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r52434 - in sandbox/synchro/boost/conversion: boost std
From: vicente.botet_at_[hidden]
Date: 2009-04-16 16:12:09


Author: viboes
Date: 2009-04-16 16:12:08 EDT (Thu, 16 Apr 2009)
New Revision: 52434
URL: http://svn.boost.org/trac/boost/changeset/52434

Log:
0.3.1 : Add test and doc to conversion

Added:
   sandbox/synchro/boost/conversion/boost/chrono_posix_time.hpp (contents, props changed)
   sandbox/synchro/boost/conversion/boost/chrono_ptime.hpp (contents, props changed)
   sandbox/synchro/boost/conversion/boost/interval.hpp (contents, props changed)
   sandbox/synchro/boost/conversion/boost/optional.hpp (contents, props changed)
   sandbox/synchro/boost/conversion/boost/rational.hpp (contents, props changed)
   sandbox/synchro/boost/conversion/boost/tuple.hpp (contents, props changed)
   sandbox/synchro/boost/conversion/std/complex.hpp (contents, props changed)
   sandbox/synchro/boost/conversion/std/pair.hpp (contents, props changed)
   sandbox/synchro/boost/conversion/std/string.hpp (contents, props changed)

Added: sandbox/synchro/boost/conversion/boost/chrono_posix_time.hpp
==============================================================================
--- (empty file)
+++ sandbox/synchro/boost/conversion/boost/chrono_posix_time.hpp 2009-04-16 16:12:08 EDT (Thu, 16 Apr 2009)
@@ -0,0 +1,18 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Vicente J. Botet Escriba 2009. Distributed under 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)
+//
+// See http://www.boost.org/libs/synchro for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_CONVERT_TO_CHRONO_POSIX_TIME__HPP
+#define BOOST_CONVERT_TO_CHRONO_POSIX_TIME__HPP
+
+#include <boost/conversion/chrono_time_point_to_posix_time_ptime.hpp>
+#include <boost/conversion/chrono_duration_to_posix_time_duration.hpp>
+
+#endif
+

Added: sandbox/synchro/boost/conversion/boost/chrono_ptime.hpp
==============================================================================
--- (empty file)
+++ sandbox/synchro/boost/conversion/boost/chrono_ptime.hpp 2009-04-16 16:12:08 EDT (Thu, 16 Apr 2009)
@@ -0,0 +1,18 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Vicente J. Botet Escriba 2009. Distributed under 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)
+//
+// See http://www.boost.org/libs/synchro for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_CONVERT_TO_CHRONO_PTIME__HPP
+#define BOOST_CONVERT_TO_CHRONO_PTIME__HPP
+
+#include <boost/conversion/chrono_time_point_to_posix_time_ptime.hpp>
+#include <boost/conversion/chrono_duration_to_posix_time_duration.hpp>
+
+#endif
+

Added: sandbox/synchro/boost/conversion/boost/interval.hpp
==============================================================================
--- (empty file)
+++ sandbox/synchro/boost/conversion/boost/interval.hpp 2009-04-16 16:12:08 EDT (Thu, 16 Apr 2009)
@@ -0,0 +1,40 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Vicente J. Botet Escriba 2009. Distributed under 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)
+//
+// See http://www.boost.org/libs/synchro for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_CONVERT_TO_PAIR__HPP
+#define BOOST_CONVERT_TO_PAIR__HPP
+
+#include <boost/numeric/interval.hpp>
+#include <boost/conversion/convert_to.hpp>
+
+namespace boost {
+
+ namespace partial_specialization_workaround {
+ template < class T, class PT, class U, class PU>
+ struct convert_to< numeric::interval<T,PT>, numeric::interval<U,PU> > {
+ inline static numeric::interval<T,PT> apply(numeric::interval<U,PU> const & from)
+ {
+ return numeric::interval<T,PT>(boost::convert_to<T>(from.lower()), boost::convert_to<U>(from.upper()));
+ }
+ };
+ template < class T, class PT, class U, class PU>
+ struct assign_to< numeric::interval<T,PT>, numeric::interval<U,PU> > {
+ inline static numeric::interval<T,PT>& apply(const numeric::interval<U,PU>& from, numeric::interval<T,PT>& to)
+ {
+ to.assign(boost::convert_to<T>(from.lower()), boost::convert_to<U>(from.upper()));
+ return to;
+ }
+ };
+
+ }
+}
+
+#endif
+

Added: sandbox/synchro/boost/conversion/boost/optional.hpp
==============================================================================
--- (empty file)
+++ sandbox/synchro/boost/conversion/boost/optional.hpp 2009-04-16 16:12:08 EDT (Thu, 16 Apr 2009)
@@ -0,0 +1,43 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Vicente J. Botet Escriba 2009. Distributed under 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)
+//
+// See http://www.boost.org/libs/synchro for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//[OPTIONAL__HPP
+#ifndef BOOST_CONVERT_TO_OPTIONAL__HPP
+#define BOOST_CONVERT_TO_OPTIONAL__HPP
+
+#include <boost/optional.hpp>
+#include <boost/none.hpp>
+#include <boost/conversion/convert_to.hpp>
+
+namespace boost {
+
+ namespace partial_specialization_workaround {
+ template < class Target, class Source>
+ struct convert_to< optional<Target>, optional<Source> > {
+ inline static optional<Target> apply(optional<Source> const & from)
+ {
+ return (from?optional<Target>(boost::convert_to<Target>(from.get())):optional<Target>());
+ }
+ };
+ template < class Target, class Source>
+ struct assign_to< optional<Target>, optional<Source> > {
+ inline static optional<Target>& apply(const optional<Source>& from, optional<Target>& to)
+ {
+ to = from?boost::convert_to<Target>(from.get()):optional<Target>();
+ return to;
+ }
+ };
+
+ }
+}
+
+#endif
+
+//]

Added: sandbox/synchro/boost/conversion/boost/rational.hpp
==============================================================================
--- (empty file)
+++ sandbox/synchro/boost/conversion/boost/rational.hpp 2009-04-16 16:12:08 EDT (Thu, 16 Apr 2009)
@@ -0,0 +1,40 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Vicente J. Botet Escriba 2009. Distributed under 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)
+//
+// See http://www.boost.org/libs/synchro for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_CONVERT_TO_PAIR__HPP
+#define BOOST_CONVERT_TO_PAIR__HPP
+
+#include <boost/rational.hpp>
+#include <boost/conversion/convert_to.hpp>
+
+namespace boost {
+
+ namespace partial_specialization_workaround {
+ template < class T, class U>
+ struct convert_to< rational<T>, rational<U> > {
+ inline static rational<T> apply(rational<U> const & from)
+ {
+ return rational<T>(boost::convert_to<T>(from.numerator()), boost::convert_to<T>(from.denominator()));
+ }
+ };
+ template < class T, class U>
+ struct assign_to< rational<T>, rational<U> > {
+ inline static rational<T>& apply(const rational<U>& from, rational<T>& to)
+ {
+ to.assign(boost::convert_to<T>(from.numerator()), boost::convert_to<T>(from.denominator()));
+ return to;
+ }
+ };
+
+ }
+}
+
+#endif
+

Added: sandbox/synchro/boost/conversion/boost/tuple.hpp
==============================================================================
--- (empty file)
+++ sandbox/synchro/boost/conversion/boost/tuple.hpp 2009-04-16 16:12:08 EDT (Thu, 16 Apr 2009)
@@ -0,0 +1,56 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Vicente J. Botet Escriba 2009. Distributed under 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)
+//
+// See http://www.boost.org/libs/synchro for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_CONVERT_TO_PAIR__HPP
+#define BOOST_CONVERT_TO_PAIR__HPP
+
+#include <boost/tr1/tuple>
+#include <boost/conversion/convert_to.hpp>
+
+namespace boost {
+
+ namespace partial_specialization_workaround {
+ template < class T1, class T2, class U1, class U2>
+ struct convert_to< std::tr1::tuple<T1,T2>, std::tr1::tuple<U1,U2> > {
+ inline static std::tr1::tuple<T1,T2> apply(std::tr1::tuple<U1,U2> const & from)
+ {
+ return std::tr1::tuple<T1,T2>(
+ convert_to<T1>(std::tr1::get<0>(from))
+ , convert_to<T2>(std::tr1::get<1>(from))
+ );
+ }
+ inline static std::tr1::tuple<T1,T2>& apply(std::tr1::tuple<U1,U2> const & from, std::tr1::tuple<T1,T2>& to)
+ {
+ to = boost::convert(from);
+ return to;
+ }
+ };
+ template < class T1, class T2, class T3, class U1, class U2, class U3>
+ struct convert_to< std::tr1::tuple<T1,T2,T3>, std::tr1::tuple<U1,U2,U3> > {
+ inline static std::tr1::tuple<T1,T2,T3> apply(std::tr1::tuple<U1,U2,U3> const & from)
+ {
+ return std::tr1::tuple<T1,T2, T3>(
+ convert_to<T1>(std::tr1::get<0>(from))
+ , convert_to<T2>(std::tr1::get<1>(from))
+ , convert_to<T3>(std::tr1::get<2>(from))
+ );
+ }
+ inline static std::tr1::tuple<T1,T2,T3> apply(std::tr1::tuple<U1,U2,U3> const & from, std::tr1::tuple<T1,T2,T3>& to)
+ {
+ to = boost::convert(from);
+ return to;
+ }
+ };
+
+ }
+}
+
+#endif
+

Added: sandbox/synchro/boost/conversion/std/complex.hpp
==============================================================================
--- (empty file)
+++ sandbox/synchro/boost/conversion/std/complex.hpp 2009-04-16 16:12:08 EDT (Thu, 16 Apr 2009)
@@ -0,0 +1,41 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Vicente J. Botet Escriba 2009. Distributed under 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)
+//
+// See http://www.boost.org/libs/synchro for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_CONVERT_TO_PAIR__HPP
+#define BOOST_CONVERT_TO_PAIR__HPP
+
+#include <complex>
+#include <boost/conversion/convert_to.hpp>
+
+namespace boost {
+
+ namespace partial_specialization_workaround {
+ template < class T, class U>
+ struct convert_to< std::complex<T>, std::complex<U> > {
+ inline static std::complex<T> apply(std::complex<U> const & from)
+ {
+ return std::complex<T>(boost::convert_to<T>(from.real()), boost::convert_to<T>(from.imag()));
+ }
+ };
+ template < class T, class U>
+ struct assign_to< std::complex<T>, std::complex<U> > {
+ inline static std::complex<T>& apply(const std::complex<U>& from, std::complex<T>& to)
+ {
+ to.real() = boost::convert_to<T>(from.real());
+ to.imag() = boost::convert_to<T>(from.imag());
+ return to;
+ }
+ };
+
+ }
+}
+
+#endif
+

Added: sandbox/synchro/boost/conversion/std/pair.hpp
==============================================================================
--- (empty file)
+++ sandbox/synchro/boost/conversion/std/pair.hpp 2009-04-16 16:12:08 EDT (Thu, 16 Apr 2009)
@@ -0,0 +1,41 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Vicente J. Botet Escriba 2009. Distributed under 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)
+//
+// See http://www.boost.org/libs/synchro for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+//[PAIR__HPP
+#ifndef BOOST_CONVERT_TO_PAIR__HPP
+#define BOOST_CONVERT_TO_PAIR__HPP
+
+#include <utility>
+#include <boost/conversion/convert_to.hpp>
+
+namespace boost {
+ namespace partial_specialization_workaround {
+ template < class T1, class T2, class U1, class U2>
+ struct convert_to< std::pair<T1,T2>, std::pair<U1,U2> > {
+ inline static std::pair<T1,T2> apply(std::pair<U1,U2> const & from)
+ {
+ return std::pair<T1,T2>(boost::convert_to<T1>(from.first), boost::convert_to<T2>(from.second));
+ }
+ };
+ template < class T1, class T2, class U1, class U2>
+ struct assign_to< std::pair<T1,T2>, std::pair<U1,U2> > {
+ inline static std::pair<T1,T2>& apply(const std::pair<U1,U2>& from, std::pair<T1,T2>& to)
+ {
+ to.first = boost::convert_to<T1>(from.first);
+ to.second = boost::convert_to<T2>(from.second);
+ return to;
+ }
+ };
+ }
+}
+
+#endif
+
+//]

Added: sandbox/synchro/boost/conversion/std/string.hpp
==============================================================================
--- (empty file)
+++ sandbox/synchro/boost/conversion/std/string.hpp 2009-04-16 16:12:08 EDT (Thu, 16 Apr 2009)
@@ -0,0 +1,57 @@
+//////////////////////////////////////////////////////////////////////////////
+//
+// (C) Copyright Vicente J. Botet Escriba 2009. Distributed under 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)
+//
+// See http://www.boost.org/libs/synchro for documentation.
+//
+//////////////////////////////////////////////////////////////////////////////
+
+#ifndef BOOST_CONVERT_TO_PAIR__HPP
+#define BOOST_CONVERT_TO_PAIR__HPP
+
+#include <string>
+#include <boost/conversion/convert_to.hpp>
+#include <boost/convert/convert.hpp>
+
+namespace boost {
+
+ namespace partial_specialization_workaround {
+
+ template<typename T, typename CharT, typename Traits, typename Alloc>
+ struct convert_to< std::basic_string<CharT,Traits,Alloc>, T > {
+ inline static std::basic_string<CharT,Traits,Alloc> apply(T const & from)
+ {
+ return convert<std::basic_string<CharT,Traits,Alloc> >::from(from);
+ }
+ }
+ template<typename T, typename CharT, typename Traits, typename Alloc>
+ struct assign_to< std::basic_string<CharT,Traits,Alloc>, T > {
+ inline static std::basic_string<CharT,Traits,Alloc>& apply(const T& from, std::basic_string<CharT,Traits,Alloc>& to)
+ {
+ to = convert<std::basic_string<CharT,Traits,Alloc> >::from(from);
+ return to;
+ }
+ };
+ template<typename T, typename CharT, typename Traits, typename Alloc>
+ struct convert_to< T, std::basic_string<CharT,Traits,Alloc>> {
+ inline static T apply(std::basic_string<CharT,Traits,Alloc> const & from)
+ {
+ return convert<T>::from(from);
+ }
+ };
+ template<typename T, typename CharT, typename Traits, typename Alloc>
+ struct assign_to< T, std::basic_string<CharT,Traits,Alloc>> {
+ inline static void apply(const std::basic_string<CharT,Traits,Alloc>& from, T& to)
+ {
+ to = convert<T>::from(from);
+ return to;
+ }
+ };
+
+ }
+}
+
+#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