Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r72249 - sandbox/conversion/boost/conversion
From: vicente.botet_at_[hidden]
Date: 2011-05-28 15:41:03


Author: viboes
Date: 2011-05-28 15:41:01 EDT (Sat, 28 May 2011)
New Revision: 72249
URL: http://svn.boost.org/trac/boost/changeset/72249

Log:
Conversion: make ussage of impl and impl2 namespace unifor in the library
Text files modified:
   sandbox/conversion/boost/conversion/assign_to.hpp | 61 ++++++++---------
   sandbox/conversion/boost/conversion/convert_to_or_fallback.hpp | 63 +++++++++--------
   sandbox/conversion/boost/conversion/convert_to_via.hpp | 7 +
   sandbox/conversion/boost/conversion/pack.hpp | 138 ++++++++++++++++++++--------------------
   sandbox/conversion/boost/conversion/try_assign_to.hpp | 64 +++++++++--------
   sandbox/conversion/boost/conversion/try_convert_to.hpp | 13 +--
   6 files changed, 175 insertions(+), 171 deletions(-)

Modified: sandbox/conversion/boost/conversion/assign_to.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/assign_to.hpp (original)
+++ sandbox/conversion/boost/conversion/assign_to.hpp 2011-05-28 15:41:01 EDT (Sat, 28 May 2011)
@@ -64,45 +64,42 @@
         }
       };
     }
- }
 
- namespace conversion_2 {
+#if !defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
+ namespace impl_2 {
 
- //! @brief Default @c assign_to overload, used when ADL fails.
- //!
- //! @Effects Converts the @c from parameter to the @c to parameter, using by default the assigment operator.
- //! @Throws Whatever the underlying the assignment operator of the @c To class throws..
- //! Forwards the call to the overload workarround, which can yet be specialized by the user for standard C++ types.
- template < typename To, typename From >
- To& assign_to(To& to, const From& from, dummy::type_tag<To> const&)
- {
- return conversion::overload_workaround::assign_to<To,From>::apply(to, from);
+ //! @brief Default @c assign_to overload, used when ADL fails.
+ //!
+ //! @Effects Converts the @c from parameter to the @c to parameter, using by default the assigment operator.
+ //! @Throws Whatever the underlying the assignment operator of the @c To class throws..
+ //! Forwards the call to the overload workarround, which can yet be specialized by the user for standard C++ types.
+ template < typename To, typename From >
+ To& assign_to(To& to, const From& from, dummy::type_tag<To> const&)
+ {
+ return conversion::overload_workaround::assign_to<To,From>::apply(to, from);
+ }
     }
- }
 
-#if !defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
- namespace conversion_impl {
- template <typename Target, typename Source>
- Target& assign_to_impl(Target& to, const Source& from)
- {
- using namespace boost::conversion_2;
- //use boost::conversion::assign_to if ADL fails
- return assign_to(to, from, boost::dummy::type_tag<Target>());
+ namespace impl {
+ template <typename Target, typename Source>
+ Target& assign_to_impl(Target& to, const Source& from)
+ {
+ using namespace boost::conversion::impl_2;
+ //use boost::conversion::assign_to if ADL fails
+ return assign_to(to, from, boost::dummy::type_tag<Target>());
+ }
     }
- }
 #endif
 
- namespace conversion {
-
- //! @Effects Converts the @c from parameter to the @c to parameter, using by default the assigment operator.
- //! @Throws Whatever the underlying the assignment operator of the @c To class throws..
- //! This function can be partially specialized on compilers supporting it.
- template <typename Target, typename Source>
- Target& assign_to(Target& to, const Source& from, boost::dummy::base_tag<Target> const& p =boost::dummy::base_tag<Target>())
- {
- (void)p;
- return boost::conversion_impl::assign_to_impl<Target, Source>(to, from);
- }
+ //! @Effects Converts the @c from parameter to the @c to parameter, using by default the assigment operator.
+ //! @Throws Whatever the underlying the assignment operator of the @c To class throws..
+ //! This function can be partially specialized on compilers supporting it.
+ template <typename Target, typename Source>
+ Target& assign_to(Target& to, const Source& from, boost::dummy::base_tag<Target> const& p =boost::dummy::base_tag<Target>())
+ {
+ (void)p;
+ return boost::conversion::impl::assign_to_impl<Target, Source>(to, from);
+ }
   }
 }
 

Modified: sandbox/conversion/boost/conversion/convert_to_or_fallback.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/convert_to_or_fallback.hpp (original)
+++ sandbox/conversion/boost/conversion/convert_to_or_fallback.hpp 2011-05-28 15:41:01 EDT (Sat, 28 May 2011)
@@ -31,8 +31,8 @@
 Thus the user can specialize partially this class.
  */
 
-#ifndef BOOST_CONVERSION_CONVERT_TO_HPP
-#define BOOST_CONVERSION_CONVERT_TO_HPP
+#ifndef BOOST_CONVERSION_CONVERT_TO_OR_FALLBACK_HPP
+#define BOOST_CONVERSION_CONVERT_TO_OR_FALLBACK_HPP
 
 #include <boost/conversion/convert_to.hpp>
 
@@ -61,41 +61,44 @@
       };
     }
 
- //! @brief Default @c convert_to_or_fallback overload, used when ADL fails.
+ #if !defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
+ namespace impl_2 {
+
+ //! @brief Default @c convert_to_or_fallback overload, used when ADL fails.
+ //!
+ //! @Effects Converts the @c from parameter to an instance of the @c To type, using by default the conversion operator or copy constructor.
+ //! @Returns the converted value if the conversion suceeds or the fallback.
+ //! @NoThows
+ //! Forwards the call to the overload workarround, which can yet be specialized by the user for standard C++ types.
+ template < typename To, typename From, typename Fallback >
+ To convert_to_or_fallback(const From& val, Fallback const& fallback, dummy::type_tag<To> const&) {
+ return conversion::overload_workaround::convert_to_or_fallback<To,From,Fallback>::apply(val, fallback);
+ }
+ }
+
+ namespace impl {
+ template <typename Target, typename Source, typename Fallback>
+ Target convert_to_or_fallback_impl(Source const& from, Fallback const& fallback) {
+ using namespace boost::conversion::impl_2;
+ //use boost::conversion::convert_to_or_fallback if ADL fails
+ return convert_to_or_fallback(from, fallback, boost::dummy::type_tag<Target>());
+ }
+ }
+ #endif
+
     //!
     //! @Effects Converts the @c from parameter to an instance of the @c To type, using by default the conversion operator or copy constructor.
     //! @Returns the converted value if the conversion suceeds or the fallback.
     //! @NoThows
- //! Forwards the call to the overload workarround, which can yet be specialized by the user for standard C++ types.
- template < typename To, typename From, typename Fallback >
- To convert_to_or_fallback(const From& val, Fallback const& fallback, dummy::type_tag<To> const&) {
- return conversion::overload_workaround::convert_to_or_fallback<To,From>::apply(val, fallback);
- }
- }
-#if !defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
- namespace conversion_impl {
+ //!
+ //! This function can be partially specialized on compilers supporting it.
+ //! A trick is used to partially specialize on the return type by adding a dummy parameter.
     template <typename Target, typename Source, typename Fallback>
- Target convert_to_or_fallback_impl(Source const& from, Fallback const& fallback) {
- using namespace boost::conversion;
- //use boost::conversion::convert_to_or_fallback if ADL fails
- return convert_to_or_fallback(from, fallback, boost::dummy::type_tag<Target>());
+ Target convert_to_or_fallback(Source const& from, Fallback const& fallback, boost::dummy::base_tag<Target> const& p=boost::dummy::base_tag<Target>()) {
+ (void)p;
+ return conversion::impl::convert_to_or_fallback_impl<Target>(from, fallback);
     }
   }
-#endif
-
- //!
- //! @Effects Converts the @c from parameter to an instance of the @c To type, using by default the conversion operator or copy constructor.
- //! @Returns the converted value if the conversion suceeds or the fallback.
- //! @NoThows
- //!
- //! This function can be partially specialized on compilers supporting it.
- //! A trick is used to partially specialize on the return type by adding a dummy parameter.
- template <typename Target, typename Source, typename Fallback>
- Target convert_to_or_fallback(Source const& from, Fallback const& fallback, boost::dummy::base_tag<Target> const& p=boost::dummy::base_tag<Target>()) {
- (void)p;
- return conversion_impl::convert_to_or_fallback_impl<Target>(from, fallback);
- }
-
 }
 
 #endif

Modified: sandbox/conversion/boost/conversion/convert_to_via.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/convert_to_via.hpp (original)
+++ sandbox/conversion/boost/conversion/convert_to_via.hpp 2011-05-28 15:41:01 EDT (Sat, 28 May 2011)
@@ -13,13 +13,16 @@
 
 #include <boost/conversion/convert_to.hpp>
 
-namespace boost { namespace conversion {
+namespace boost {
+ namespace conversion {
 
     template < typename To, typename Via, typename From >
     To convert_to_via(const From& val) {
         boost::conversion::convert_to<To>(boost::conversion::convert_to<Via>(val));
     }
-}}
+
+ }
+}
 
 #endif
 

Modified: sandbox/conversion/boost/conversion/pack.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/pack.hpp (original)
+++ sandbox/conversion/boost/conversion/pack.hpp 2011-05-28 15:41:01 EDT (Sat, 28 May 2011)
@@ -28,84 +28,84 @@
 
 */
 
-namespace boost { namespace conversion {
-
-
- namespace result_of {
+namespace boost {
+ namespace conversion {
+ namespace result_of {
+
+ //! metafunction getting a @c std::pair of @c boost::reference_warpper's.
+ //!
+ template <typename T1, typename T2> struct pack2 {
+ typedef
+ std::pair<
+ //~ fusion::tuple<
+ boost::reference_wrapper<T1>
+ , boost::reference_wrapper<T2>
+ > type;
+ };
+ //! metafunction getting a fusion sequence of @c boost::reference_warpper's.
+ //!
+ template <typename T1, typename T2, typename T3=fusion::void_> struct pack3 {
+ typedef fusion::tuple<
+ boost::reference_wrapper<T1>
+ , boost::reference_wrapper<T2>
+ , boost::reference_wrapper<T3>
+ > type;
+ };
+ }
 
- //! metafunction getting a @c std::pair of @c boost::reference_warpper's.
+ //! packs together references.
     //!
- template <typename T1, typename T2> struct pack2 {
- typedef
- std::pair<
- //~ fusion::tuple<
- boost::reference_wrapper<T1>
- , boost::reference_wrapper<T2>
- > type;
- };
- //! metafunction getting a fusion sequence of @c boost::reference_warpper's.
- //!
- template <typename T1, typename T2, typename T3=fusion::void_> struct pack3 {
- typedef fusion::tuple<
- boost::reference_wrapper<T1>
- , boost::reference_wrapper<T2>
- , boost::reference_wrapper<T3>
- > type;
- };
-}
+ template <typename T1, typename T2>
+ typename boost::conversion::result_of::pack2<T1 const, T2 const>::type pack(
+ T1 const& t1, T2 const& t2) {
+ return std::make_pair
+ //~ return boost::fusion::make_tuple
+ (boost::cref(t1), boost::cref(t2));
+ }
 
-//! packs together references.
-//!
-template <typename T1, typename T2>
-typename boost::conversion::result_of::pack2<T1 const, T2 const>::type pack(
- T1 const& t1, T2 const& t2) {
- return std::make_pair
- //~ return boost::fusion::make_tuple
- (boost::cref(t1), boost::cref(t2));
-}
+ //! packs together references.
+ //!
+ template <typename T1, typename T2>
+ typename boost::conversion::result_of::pack2<T1 const, T2>::type pack(T1 const& t1, T2 & t2) {
+ return std::make_pair
+ //~ return boost::fusion::make_tuple
+ (boost::cref(t1), boost::ref(t2));
+ }
 
-//! packs together references.
-//!
-template <typename T1, typename T2>
-typename boost::conversion::result_of::pack2<T1 const, T2>::type pack(T1 const& t1, T2 & t2) {
- return std::make_pair
- //~ return boost::fusion::make_tuple
- (boost::cref(t1), boost::ref(t2));
-}
+ //! packs together references.
+ //!
+ template <typename T1, typename T2, typename T3>
+ typename boost::conversion::result_of::pack3<T1 const, T2 const, T3 const>::type pack(
+ T1 const& t1, T2 const& t2, T3 const& t3) {
+ return fusion::make_tuple(boost::cref(t1), boost::cref(t2), boost::cref(t3));
+ }
 
-//! packs together references.
-//!
-template <typename T1, typename T2, typename T3>
-typename boost::conversion::result_of::pack3<T1 const, T2 const, T3 const>::type pack(
- T1 const& t1, T2 const& t2, T3 const& t3) {
- return fusion::make_tuple(boost::cref(t1), boost::cref(t2), boost::cref(t3));
-}
+ //! packs together references.
+ //!
+ template <typename T1, typename T2, typename T3>
+ typename boost::conversion::result_of::pack3<T1 const, T2 const, T3>::type pack(
+ T1 const& t1, T2 const& t2, T3 & t3) {
+ return fusion::make_tuple(boost::cref(t1), boost::cref(t2), boost::ref(t3));
+ }
 
-//! packs together references.
-//!
-template <typename T1, typename T2, typename T3>
-typename boost::conversion::result_of::pack3<T1 const, T2 const, T3>::type pack(
- T1 const& t1, T2 const& t2, T3 & t3) {
- return fusion::make_tuple(boost::cref(t1), boost::cref(t2), boost::ref(t3));
-}
+ //! packs together references.
+ //!
+ template <typename T1, typename T2, typename T3>
+ typename boost::conversion::result_of::pack3<T1 const, T2, T3 const>::type pack(
+ T1 const& t1, T2 & t2, T3 const& t3) {
+ return fusion::make_tuple(boost::cref(t1), boost::ref(t2), boost::cref(t3));
+ }
 
-//! packs together references.
-//!
-template <typename T1, typename T2, typename T3>
-typename boost::conversion::result_of::pack3<T1 const, T2, T3 const>::type pack(
- T1 const& t1, T2 & t2, T3 const& t3) {
- return fusion::make_tuple(boost::cref(t1), boost::ref(t2), boost::cref(t3));
-}
+ //! packs together references.
+ //!
+ template <typename T1, typename T2, typename T3>
+ typename boost::conversion::result_of::pack3<T1 const, T2, T3>::type pack(
+ T1 const& t1, T2 & t2, T3 & t3) {
+ return fusion::make_tuple(boost::cref(t1), boost::ref(t2), boost::ref(t3));
+ }
 
-//! packs together references.
-//!
-template <typename T1, typename T2, typename T3>
-typename boost::conversion::result_of::pack3<T1 const, T2, T3>::type pack(
- T1 const& t1, T2 & t2, T3 & t3) {
- return fusion::make_tuple(boost::cref(t1), boost::ref(t2), boost::ref(t3));
+ }
 }
 
-}}
-
 #endif
 

Modified: sandbox/conversion/boost/conversion/try_assign_to.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/try_assign_to.hpp (original)
+++ sandbox/conversion/boost/conversion/try_assign_to.hpp 2011-05-28 15:41:01 EDT (Sat, 28 May 2011)
@@ -89,42 +89,44 @@
     }
 
 
- //! @brief Default @c try_assign_to overload, used when ADL fails.
- //!
- //! @Effects Converts the @c from parameter to the @c to parameter, using by default the assigment operator.
- //! @NoThrows
- //! @Return the converted value if sucess or the fallback when conversion fails.
- //! Forwards the call to the overload workarround, which can yet be specialized by the user for standard C++ types.
- template < typename To, typename From >
- bool try_assign_to(To& to, const From& from, dummy::type_tag<To> const&)
- {
- return conversion::overload_workaround::try_assign_to<To,From>::apply(to, from);
+#if !defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
+ namespace impl_2 {
+ //! @brief Default @c try_assign_to overload, used when ADL fails.
+ //!
+ //! @Effects Converts the @c from parameter to the @c to parameter, using by default the assigment operator.
+ //! @NoThrows
+ //! @Return the converted value if sucess or the fallback when conversion fails.
+ //! Forwards the call to the overload workarround, which can yet be specialized by the user for standard C++ types.
+ template < typename To, typename From >
+ bool try_assign_to(To& to, const From& from, dummy::type_tag<To> const&)
+ {
+ return conversion::overload_workaround::try_assign_to<To,From>::apply(to, from);
+ }
     }
- }
 
-#if !defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
- namespace conversion_impl {
- template <typename Target, typename Source>
- bool try_assign_to_impl(Target& to, const Source& from)
- {
- using namespace boost::conversion;
- //use boost::conversion::try_assign_to if ADL fails
- return try_assign_to(to, from, boost::dummy::type_tag<Target>());
+ namespace impl {
+ template <typename Target, typename Source>
+ bool try_assign_to_impl(Target& to, const Source& from)
+ {
+ using namespace boost::conversion::impl_2;
+ //use boost::conversion::try_assign_to if ADL fails
+ return try_assign_to(to, from, boost::dummy::type_tag<Target>());
+ }
     }
- }
 #endif
 
- //! @Effects Converts the @c from parameter to the @c to parameter, using by default the assigment operator.
- //! @NoThrows
- //! @Return the converted value if sucess or the fallback when conversion fails.
- //!
- //! This function can be partially specialized on compilers supporting it.
- template <typename Target, typename Source>
- bool try_assign_to(Target& to, const Source& from, boost::dummy::base_tag<Target> const& p=boost::dummy::base_tag<Target>()
- )
- {
- (void)p;
- return conversion_impl::try_assign_to_impl<Target, Source>(to, from);
+ //! @Effects Converts the @c from parameter to the @c to parameter, using by default the assigment operator.
+ //! @NoThrows
+ //! @Return the converted value if sucess or the fallback when conversion fails.
+ //!
+ //! This function can be partially specialized on compilers supporting it.
+ template <typename Target, typename Source>
+ bool try_assign_to(Target& to, const Source& from, boost::dummy::base_tag<Target> const& p=boost::dummy::base_tag<Target>()
+ )
+ {
+ (void)p;
+ return conversion::impl::try_assign_to_impl<Target, Source>(to, from);
+ }
   }
 }
 

Modified: sandbox/conversion/boost/conversion/try_convert_to.hpp
==============================================================================
--- sandbox/conversion/boost/conversion/try_convert_to.hpp (original)
+++ sandbox/conversion/boost/conversion/try_convert_to.hpp 2011-05-28 15:41:01 EDT (Sat, 28 May 2011)
@@ -60,8 +60,9 @@
         }
       };
     }
- }
- namespace conversion_2 {
+
+#if !defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
+ namespace impl_2 {
 
     //! @brief Default @c try_convert_to overload, used when ADL fails.
     //!
@@ -74,18 +75,16 @@
       return conversion::overload_workaround::try_convert_to<To,From>::apply(val);
     }
   }
-#if !defined(BOOST_CONVERSION_DOXYGEN_INVOKED)
- namespace conversion_impl {
+ namespace impl {
     template <typename Target, typename Source>
     optional<Target> try_convert_to_impl(Source const& from) {
- using namespace boost::conversion_2;
+ using namespace boost::conversion::impl_2;
       //use boost::conversion::try_convert_to if ADL fails
       return try_convert_to(from, boost::dummy::type_tag<Target>());
     }
   }
 #endif
 
- namespace conversion {
 
   //!
   //! @Effects Converts the @c from parameter to an instance of the @c To type, using by default the conversion operator or copy constructor.
@@ -97,7 +96,7 @@
   template <typename Target, typename Source>
   optional<Target> try_convert_to(Source const& from, boost::dummy::base_tag<Target> const& p=boost::dummy::base_tag<Target>()) {
     (void)p;
- return boost::conversion_impl::try_convert_to_impl<Target>(from);
+ return boost::conversion::impl::try_convert_to_impl<Target>(from);
   }
   }
 


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