Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r77896 - trunk/boost/container/detail
From: igaztanaga_at_[hidden]
Date: 2012-04-10 16:16:14


Author: igaztanaga
Date: 2012-04-10 16:16:14 EDT (Tue, 10 Apr 2012)
New Revision: 77896
URL: http://svn.boost.org/trac/boost/changeset/77896

Log:
Added SFINAE to constructors
Text files modified:
   trunk/boost/container/detail/pair.hpp | 14 ++++++++++++--
   1 files changed, 12 insertions(+), 2 deletions(-)

Modified: trunk/boost/container/detail/pair.hpp
==============================================================================
--- trunk/boost/container/detail/pair.hpp (original)
+++ trunk/boost/container/detail/pair.hpp 2012-04-10 16:16:14 EDT (Tue, 10 Apr 2012)
@@ -22,6 +22,8 @@
 
 #include <boost/container/detail/mpl.hpp>
 #include <boost/container/detail/type_traits.hpp>
+#include <boost/container/detail/mpl.hpp>
+#include <boost/container/detail/type_traits.hpp>
 
 #include <utility> //std::pair
 
@@ -211,7 +213,11 @@
    }
 
    template <class D, class S>
- pair& operator=(const pair<D, S>&p)
+ typename ::boost::container::container_detail::enable_if_c
+ < !(::boost::container::container_detail::is_same<T1, D>::value &&
+ ::boost::container::container_detail::is_same<T2, S>::value)
+ , pair &>::type
+ operator=(const pair<D, S>&p)
    {
       first = p.first;
       second = p.second;
@@ -219,7 +225,11 @@
    }
 
    template <class D, class S>
- pair& operator=(BOOST_RV_REF_BEG pair<D, S> BOOST_RV_REF_END p)
+ typename ::boost::container::container_detail::enable_if_c
+ < !(::boost::container::container_detail::is_same<T1, D>::value &&
+ ::boost::container::container_detail::is_same<T2, S>::value)
+ , pair &>::type
+ operator=(BOOST_RV_REF_BEG pair<D, S> BOOST_RV_REF_END p)
    {
       first = ::boost::move(p.first);
       second = ::boost::move(p.second);


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