Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r81250 - trunk/boost/test/utils
From: gennadiy.rozental_at_[hidden]
Date: 2012-11-08 03:56:17


Author: rogeeff
Date: 2012-11-08 03:56:16 EST (Thu, 08 Nov 2012)
New Revision: 81250
URL: http://svn.boost.org/trac/boost/changeset/81250

Log:
temporary fix
Text files modified:
   trunk/boost/test/utils/is_forward_iterable.hpp | 40 +++++++++++++++++++++++++++++++++++++++-
   1 files changed, 39 insertions(+), 1 deletions(-)

Modified: trunk/boost/test/utils/is_forward_iterable.hpp
==============================================================================
--- trunk/boost/test/utils/is_forward_iterable.hpp (original)
+++ trunk/boost/test/utils/is_forward_iterable.hpp 2012-11-08 03:56:16 EST (Thu, 08 Nov 2012)
@@ -9,18 +9,27 @@
 //
 // Version : $Revision$
 //
-// Description : defines a special purpose type trait
+// Description : defines the is_forward_iterable collection type trait
 // ***************************************************************************
 
 #ifndef BOOST_TEST_IS_FRWARD_ITERABLE_HPP_110612GER
 #define BOOST_TEST_IS_FRWARD_ITERABLE_HPP_110612GER
 
+#if 1 // def BOOST_NO_CXX11_DECLTYPE
 // Boost
 #include <boost/mpl/bool.hpp>
+
 // STL
 #include <list>
 #include <vector>
 
+#else
+
+// STL
+#include <type_traits>
+#include <utility>
+
+#endif
 //____________________________________________________________________________//
 
 namespace boost {
@@ -30,6 +39,7 @@
 // ************** is_forward_iterable ************** //
 // ************************************************************************** //
 
+#if 1 // def BOOST_NO_CXX11_DECLTYPE
 template<typename T>
 struct is_forward_iterable : mpl::false_ {};
 
@@ -45,6 +55,34 @@
 template<typename T>
 struct is_forward_iterable<std::list<T>> : mpl::true_ {};
 
+#else
+
+namespace detail {
+
+struct is_forward_iterable_impl
+{
+ template<typename T,
+ typename = decltype(std::declval<const T&>().size()),
+ typename = decltype(std::declval<T>().begin()),
+ typename = typename T::const_iterator,
+ typename = typename T::value_type
+ >
+ static std::true_type test(int);
+ template<typename>
+ static std::false_type test(...);
+};
+
+
+} // namespace detail
+
+template<typename T>
+struct is_forward_iterable
+: decltype(detail::is_forward_iterable_impl::test<typename std::remove_reference<T>::type>(0))
+{
+};
+
+#endif
+
 } // namespace unit_test
 } // namespace boost
 


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