|
Boost-Commit : |
From: nielsdekker_at_[hidden]
Date: 2008-05-12 09:29:52
Author: niels_dekker
Date: 2008-05-12 09:29:52 EDT (Mon, 12 May 2008)
New Revision: 45295
URL: http://svn.boost.org/trac/boost/changeset/45295
Log:
Fixed syntax of optional_swap_should_use_default_constructor and swap template specializations that I added 2 days ago (changeset [45265]). Was accepted by MSVC, but rejected by other compilers.
Text files modified:
trunk/libs/optional/test/optional_test.cpp | 41 +++++++++++++++++++++++++++------------
1 files changed, 28 insertions(+), 13 deletions(-)
Modified: trunk/libs/optional/test/optional_test.cpp
==============================================================================
--- trunk/libs/optional/test/optional_test.cpp (original)
+++ trunk/libs/optional/test/optional_test.cpp 2008-05-12 09:29:52 EDT (Mon, 12 May 2008)
@@ -10,7 +10,7 @@
// fernando_cacciola_at_[hidden]
//
// Revisions:
-// 10 May 2008 (added more swap tests)
+// 12 May 2008 (added more swap tests)
//
#include<iostream>
#include<stdexcept>
@@ -1099,51 +1099,66 @@
} // End of namespace optional_swap_test.
+namespace boost {
+
//
// Compile time tweaking on whether or not swap should use the default constructor:
//
-template <> struct boost::optional_swap_should_use_default_constructor<
- optional_swap_test::class_whose_default_ctor_should_be_used> : boost::mpl::true_ {} ;
-template <> struct boost::optional_swap_should_use_default_constructor<
- optional_swap_test::class_whose_default_ctor_should_not_be_used> : boost::mpl::false_ {} ;
+template <> struct optional_swap_should_use_default_constructor<
+ optional_swap_test::class_whose_default_ctor_should_be_used> : mpl::true_ {} ;
+
+template <> struct optional_swap_should_use_default_constructor<
+ optional_swap_test::class_whose_default_ctor_should_not_be_used> : mpl::false_ {} ;
+
+template <class T> struct optional_swap_should_use_default_constructor<
+ optional_swap_test::template_whose_default_ctor_should_be_used<T> > : mpl::true_ {} ;
-template <class T> struct boost::optional_swap_should_use_default_constructor<
- optional_swap_test::template_whose_default_ctor_should_be_used<T> > : boost::mpl::true_ {} ;
//
-// Swap specializations:
+// Specialization of boost::swap:
//
template <>
-void boost::swap(boost::optional<optional_swap_test::class_whose_explicit_ctor_should_be_used> & x, boost::optional<optional_swap_test::class_whose_explicit_ctor_should_be_used> & y)
+void swap(optional<optional_swap_test::class_whose_explicit_ctor_should_be_used> & x, optional<optional_swap_test::class_whose_explicit_ctor_should_be_used> & y)
{
optional_swap_test::swap(x, y);
}
+} // namespace boost
+
+
+namespace std {
+
+//
+// Specializations of std::swap:
+//
+
template <>
-void std::swap(optional_swap_test::class_whose_default_ctor_should_be_used & x, optional_swap_test::class_whose_default_ctor_should_be_used & y)
+void swap(optional_swap_test::class_whose_default_ctor_should_be_used & x, optional_swap_test::class_whose_default_ctor_should_be_used & y)
{
optional_swap_test::swap(x, y);
}
template <>
-void std::swap(optional_swap_test::class_whose_default_ctor_should_not_be_used & x, optional_swap_test::class_whose_default_ctor_should_not_be_used & y)
+void swap(optional_swap_test::class_whose_default_ctor_should_not_be_used & x, optional_swap_test::class_whose_default_ctor_should_not_be_used & y)
{
optional_swap_test::swap(x, y);
}
template <>
-void std::swap(optional_swap_test::class_without_default_ctor & x, optional_swap_test::class_without_default_ctor & y)
+void swap(optional_swap_test::class_without_default_ctor & x, optional_swap_test::class_without_default_ctor & y)
{
optional_swap_test::swap(x, y);
}
template <>
-void std::swap(optional_swap_test::class_whose_explicit_ctor_should_be_used & x, optional_swap_test::class_whose_explicit_ctor_should_be_used & y)
+void swap(optional_swap_test::class_whose_explicit_ctor_should_be_used & x, optional_swap_test::class_whose_explicit_ctor_should_be_used & y)
{
optional_swap_test::swap(x, y);
}
+} // namespace std
+
//
// Tests whether the swap function works properly for optional<T>.
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