From 7287f2bf11f417584c002b875c376a60b7a7a1bd Mon Sep 17 00:00:00 2001 From: Fernando Cacciola Date: Wed, 7 Mar 2007 20:17:23 +0000 Subject: [PATCH] in_palce_factory.apply problem fixed [SVN r37157] --- include/boost/optional/optional.hpp | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/include/boost/optional/optional.hpp b/include/boost/optional/optional.hpp index 48de64e..42277ba 100644 --- a/include/boost/optional/optional.hpp +++ b/include/boost/optional/optional.hpp @@ -76,6 +76,19 @@ #define BOOST_OPTIONAL_WEAK_OVERLOAD_RESOLUTION #endif +// Daniel Wallin discovered that bind/apply.hpp badly interacts with the apply<> +// member template of a factory as used in the optional<> implementation. +// He proposed this simple fix which is to move the call to apply<> outside +// namespace boost. +namespace boost_optional_detail +{ + template + void construct(Factory const& factory, void* address) + { + factory.BOOST_NESTED_TEMPLATE apply(address); + } +} + namespace boost { @@ -309,7 +322,7 @@ class optional_base : public optional_tag void construct ( Expr const& factory, in_place_factory_base const* ) { BOOST_STATIC_ASSERT ( ::boost::mpl::not_::value ) ; - factory.BOOST_NESTED_TEMPLATE apply(m_storage.address()) ; + boost_optional_detail::construct(factory, m_storage.address()); m_initialized = true ; }