|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r65515 - trunk/boost
From: eric_at_[hidden]
Date: 2010-09-21 10:37:35
Author: eric_niebler
Date: 2010-09-21 10:37:31 EDT (Tue, 21 Sep 2010)
New Revision: 65515
URL: http://svn.boost.org/trac/boost/changeset/65515
Log:
make auto_any ctor explicit
Text files modified:
trunk/boost/foreach.hpp | 65 ++++++++++++++++++++++++----------------
1 files changed, 39 insertions(+), 26 deletions(-)
Modified: trunk/boost/foreach.hpp
==============================================================================
--- trunk/boost/foreach.hpp (original)
+++ trunk/boost/foreach.hpp 2010-09-21 10:37:31 EDT (Tue, 21 Sep 2010)
@@ -246,7 +246,7 @@
template<typename T>
struct auto_any : auto_any_base
{
- auto_any(T const &t)
+ explicit auto_any(T const &t)
: item(t)
{
}
@@ -606,7 +606,7 @@
template<typename T>
inline auto_any<T> contain(T const &t, boost::mpl::true_ *) // rvalue
{
- return t;
+ return auto_any<T>(t);
}
template<typename T>
@@ -614,18 +614,18 @@
{
// Cannot seem to get sunpro to handle addressof() with array types.
#if BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x570))
- return &t;
+ return auto_any<T *>(&t);
#else
- return boost::addressof(t);
+ return auto_any<T *>(boost::addressof(t));
#endif
}
#ifdef BOOST_FOREACH_RUN_TIME_CONST_RVALUE_DETECTION
template<typename T>
-auto_any<simple_variant<T> >
+inline auto_any<simple_variant<T> >
contain(T const &t, bool *rvalue)
{
- return *rvalue ? simple_variant<T>(t) : simple_variant<T>(&t);
+ return auto_any<simple_variant<T> >(*rvalue ? simple_variant<T>(t) : simple_variant<T>(&t));
}
#endif
@@ -636,7 +636,8 @@
inline auto_any<BOOST_DEDUCED_TYPENAME foreach_iterator<T, C>::type>
begin(auto_any_t col, type2type<T, C> *, boost::mpl::true_ *) // rvalue
{
- return boost::begin(auto_any_cast<T, C>(col));
+ return auto_any<BOOST_DEDUCED_TYPENAME foreach_iterator<T, C>::type>(
+ boost::begin(auto_any_cast<T, C>(col)));
}
template<typename T, typename C>
@@ -645,15 +646,17 @@
{
typedef BOOST_DEDUCED_TYPENAME type2type<T, C>::type type;
typedef BOOST_DEDUCED_TYPENAME foreach_iterator<T, C>::type iterator;
- return iterator(boost::begin(derefof(auto_any_cast<type *, boost::mpl::false_>(col))));
+ return auto_any<BOOST_DEDUCED_TYPENAME foreach_iterator<T, C>::type>(
+ iterator(boost::begin(derefof(auto_any_cast<type *, boost::mpl::false_>(col)))));
}
#ifdef BOOST_FOREACH_RUN_TIME_CONST_RVALUE_DETECTION
template<typename T>
-auto_any<BOOST_DEDUCED_TYPENAME foreach_iterator<T, const_>::type>
+inline auto_any<BOOST_DEDUCED_TYPENAME foreach_iterator<T, const_>::type>
begin(auto_any_t col, type2type<T, const_> *, bool *)
{
- return boost::begin(*auto_any_cast<simple_variant<T>, boost::mpl::false_>(col).get());
+ return auto_any<BOOST_DEDUCED_TYPENAME foreach_iterator<T, const_>::type>(
+ boost::begin(*auto_any_cast<simple_variant<T>, boost::mpl::false_>(col).get()));
}
#endif
@@ -662,7 +665,7 @@
inline auto_any<T *>
begin(auto_any_t col, type2type<T *, C> *, boost::mpl::true_ *) // null-terminated C-style strings
{
- return auto_any_cast<T *, boost::mpl::false_>(col);
+ return auto_any<T *>(auto_any_cast<T *, boost::mpl::false_>(col));
}
#endif
@@ -673,7 +676,8 @@
inline auto_any<BOOST_DEDUCED_TYPENAME foreach_iterator<T, C>::type>
end(auto_any_t col, type2type<T, C> *, boost::mpl::true_ *) // rvalue
{
- return boost::end(auto_any_cast<T, C>(col));
+ return auto_any<BOOST_DEDUCED_TYPENAME foreach_iterator<T, C>::type>(
+ boost::end(auto_any_cast<T, C>(col)));
}
template<typename T, typename C>
@@ -682,15 +686,17 @@
{
typedef BOOST_DEDUCED_TYPENAME type2type<T, C>::type type;
typedef BOOST_DEDUCED_TYPENAME foreach_iterator<T, C>::type iterator;
- return iterator(boost::end(derefof(auto_any_cast<type *, boost::mpl::false_>(col))));
+ return auto_any<BOOST_DEDUCED_TYPENAME foreach_iterator<T, C>::type>(
+ iterator(boost::end(derefof(auto_any_cast<type *, boost::mpl::false_>(col)))));
}
#ifdef BOOST_FOREACH_RUN_TIME_CONST_RVALUE_DETECTION
template<typename T>
-auto_any<BOOST_DEDUCED_TYPENAME foreach_iterator<T, const_>::type>
+inline auto_any<BOOST_DEDUCED_TYPENAME foreach_iterator<T, const_>::type>
end(auto_any_t col, type2type<T, const_> *, bool *)
{
- return boost::end(*auto_any_cast<simple_variant<T>, boost::mpl::false_>(col).get());
+ return auto_any<BOOST_DEDUCED_TYPENAME foreach_iterator<T, const_>::type>(
+ boost::end(*auto_any_cast<simple_variant<T>, boost::mpl::false_>(col).get()));
}
#endif
@@ -699,7 +705,7 @@
inline auto_any<int>
end(auto_any_t, type2type<T *, C> *, boost::mpl::true_ *) // null-terminated C-style strings
{
- return 0; // not used
+ return auto_any<int>(0); // not used
}
#endif
@@ -749,7 +755,8 @@
inline auto_any<BOOST_DEDUCED_TYPENAME foreach_reverse_iterator<T, C>::type>
rbegin(auto_any_t col, type2type<T, C> *, boost::mpl::true_ *) // rvalue
{
- return boost::rbegin(auto_any_cast<T, C>(col));
+ return auto_any<BOOST_DEDUCED_TYPENAME foreach_reverse_iterator<T, C>::type>(
+ boost::rbegin(auto_any_cast<T, C>(col)));
}
template<typename T, typename C>
@@ -758,15 +765,17 @@
{
typedef BOOST_DEDUCED_TYPENAME type2type<T, C>::type type;
typedef BOOST_DEDUCED_TYPENAME foreach_reverse_iterator<T, C>::type iterator;
- return iterator(boost::rbegin(derefof(auto_any_cast<type *, boost::mpl::false_>(col))));
+ return auto_any<BOOST_DEDUCED_TYPENAME foreach_reverse_iterator<T, C>::type>(
+ iterator(boost::rbegin(derefof(auto_any_cast<type *, boost::mpl::false_>(col)))));
}
#ifdef BOOST_FOREACH_RUN_TIME_CONST_RVALUE_DETECTION
template<typename T>
-auto_any<BOOST_DEDUCED_TYPENAME foreach_reverse_iterator<T, const_>::type>
+inline auto_any<BOOST_DEDUCED_TYPENAME foreach_reverse_iterator<T, const_>::type>
rbegin(auto_any_t col, type2type<T, const_> *, bool *)
{
- return boost::rbegin(*auto_any_cast<simple_variant<T>, boost::mpl::false_>(col).get());
+ return auto_any<BOOST_DEDUCED_TYPENAME foreach_reverse_iterator<T, const_>::type>(
+ boost::rbegin(*auto_any_cast<simple_variant<T>, boost::mpl::false_>(col).get()));
}
#endif
@@ -778,7 +787,7 @@
T *p = auto_any_cast<T *, boost::mpl::false_>(col);
while(0 != *p)
++p;
- return reverse_iterator<T *>(p);
+ return auto_any<reverse_iterator<T *> >(reverse_iterator<T *>(p));
}
#endif
@@ -789,7 +798,8 @@
inline auto_any<BOOST_DEDUCED_TYPENAME foreach_reverse_iterator<T, C>::type>
rend(auto_any_t col, type2type<T, C> *, boost::mpl::true_ *) // rvalue
{
- return boost::rend(auto_any_cast<T, C>(col));
+ return auto_any<BOOST_DEDUCED_TYPENAME foreach_reverse_iterator<T, C>::type>(
+ boost::rend(auto_any_cast<T, C>(col)));
}
template<typename T, typename C>
@@ -798,15 +808,17 @@
{
typedef BOOST_DEDUCED_TYPENAME type2type<T, C>::type type;
typedef BOOST_DEDUCED_TYPENAME foreach_reverse_iterator<T, C>::type iterator;
- return iterator(boost::rend(derefof(auto_any_cast<type *, boost::mpl::false_>(col))));
+ return auto_any<BOOST_DEDUCED_TYPENAME foreach_reverse_iterator<T, C>::type>(
+ iterator(boost::rend(derefof(auto_any_cast<type *, boost::mpl::false_>(col)))));
}
#ifdef BOOST_FOREACH_RUN_TIME_CONST_RVALUE_DETECTION
template<typename T>
-auto_any<BOOST_DEDUCED_TYPENAME foreach_reverse_iterator<T, const_>::type>
+inline auto_any<BOOST_DEDUCED_TYPENAME foreach_reverse_iterator<T, const_>::type>
rend(auto_any_t col, type2type<T, const_> *, bool *)
{
- return boost::rend(*auto_any_cast<simple_variant<T>, boost::mpl::false_>(col).get());
+ return auto_any<BOOST_DEDUCED_TYPENAME foreach_reverse_iterator<T, const_>::type>(
+ boost::rend(*auto_any_cast<simple_variant<T>, boost::mpl::false_>(col).get()));
}
#endif
@@ -815,7 +827,8 @@
inline auto_any<reverse_iterator<T *> >
rend(auto_any_t col, type2type<T *, C> *, boost::mpl::true_ *) // null-terminated C-style strings
{
- return reverse_iterator<T *>(auto_any_cast<T *, boost::mpl::false_>(col));
+ return auto_any<reverse_iterator<T *> >(
+ reverse_iterator<T *>(auto_any_cast<T *, boost::mpl::false_>(col)));
}
#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