Boost logo

Boost-Commit :

From: eric_at_[hidden]
Date: 2007-10-02 13:58:37


Author: eric_niebler
Date: 2007-10-02 13:58:33 EDT (Tue, 02 Oct 2007)
New Revision: 39658
URL: http://svn.boost.org/trac/boost/changeset/39658

Log:
work around msvc-7.1 bugs
Text files modified:
   trunk/boost/foreach.hpp | 24 ++++++++++++++++++++++++
   1 files changed, 24 insertions(+), 0 deletions(-)

Modified: trunk/boost/foreach.hpp
==============================================================================
--- trunk/boost/foreach.hpp (original)
+++ trunk/boost/foreach.hpp 2007-10-02 13:58:33 EDT (Tue, 02 Oct 2007)
@@ -619,6 +619,18 @@
     return iterator(boost::begin(derefof(auto_any_cast<type *, boost::mpl::false_>(col))));
 }
 
+// work around msvc bugs wrt array types that have been deduced
+#if BOOST_WORKAROUND(BOOST_MSVC, == 1310)
+template<typename T, std::size_t N, typename C>
+inline auto_any<BOOST_DEDUCED_TYPENAME boost::mpl::if_<C, T const *, T*>::type>
+begin(auto_any_t col, type2type<T[N], C> *, boost::mpl::false_ *) // lvalue
+{
+ typedef BOOST_DEDUCED_TYPENAME type2type<T[N], C>::type type;
+ typedef BOOST_DEDUCED_TYPENAME boost::mpl::if_<C, T const *, T*>::type iterator;
+ return &((*(auto_any_cast<type *, boost::mpl::false_>(col)))[0]);
+}
+#endif
+
 #ifdef BOOST_FOREACH_RUN_TIME_CONST_RVALUE_DETECTION
 template<typename T>
 auto_any<BOOST_DEDUCED_TYPENAME foreach_iterator<T, const_>::type>
@@ -656,6 +668,18 @@
     return iterator(boost::end(derefof(auto_any_cast<type *, boost::mpl::false_>(col))));
 }
 
+// work around msvc bugs wrt array types that have been deduced
+#if BOOST_WORKAROUND(BOOST_MSVC, == 1310)
+template<typename T, std::size_t N, typename C>
+inline auto_any<BOOST_DEDUCED_TYPENAME boost::mpl::if_<C, T const *, T*>::type>
+end(auto_any_t col, type2type<T[N], C> *, boost::mpl::false_ *) // lvalue
+{
+ typedef BOOST_DEDUCED_TYPENAME type2type<T[N], C>::type type;
+ typedef BOOST_DEDUCED_TYPENAME boost::mpl::if_<C, T const *, T*>::type iterator;
+ return &((*(auto_any_cast<type *, boost::mpl::false_>(col)))[0]) + N;
+}
+#endif
+
 #ifdef BOOST_FOREACH_RUN_TIME_CONST_RVALUE_DETECTION
 template<typename T>
 auto_any<BOOST_DEDUCED_TYPENAME foreach_iterator<T, const_>::type>


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