[optional] boost/bind/apply.hpp bad interaction

#include <boost/bind/apply.hpp> #include <boost/optional.hpp> Results in: dev/boost/boost/optional/optional.hpp: In member function 'void boost::optional_detail::optional_bas e<T>::construct(const Expr&, const boost::in_place_factory_base*)': dev/boost/boost/optional/optional.hpp:309: error: invalid use of 'struct boost::apply<T>' On GCC4.0.2. The offending line is: factory.BOOST_NESTED_TEMPLATE apply<value_type>(m_storage.address()) ; A simple fix is to move the apply() call out of the boost namespace. The attached patch fixes the problem. OK to commit? -- Daniel Wallin Index: optional.hpp =================================================================== RCS file: /cvsroot/boost/boost/boost/optional/optional.hpp,v retrieving revision 1.9 diff -u -r1.9 optional.hpp --- optional.hpp 10 Feb 2006 20:52:25 -0000 1.9 +++ optional.hpp 18 Mar 2006 11:40:32 -0000 @@ -76,6 +76,16 @@ #define BOOST_OPTIONAL_WEAK_OVERLOAD_RESOLUTION #endif +namespace boost_optional_construct +{ + + template <class T, class Factory> + void construct(Factory const& factory, void* address) + { + factory.BOOST_NESTED_TEMPLATE apply<T>(address); + } + +} // namespace boost_optional_construct namespace boost { @@ -295,7 +305,9 @@ void construct ( Expr const& factory, in_place_factory_base const* ) { BOOST_STATIC_ASSERT ( ::boost::mpl::not_<is_reference_predicate>::value ) ; - factory.BOOST_NESTED_TEMPLATE apply<value_type>(m_storage.address()) ; + boost_optional_construct::construct<value_type>( + factory, m_storage.address() + ); m_initialized = true ; }

Daniel Wallin wrote:
#include <boost/bind/apply.hpp> #include <boost/optional.hpp>
A simple fix is to move the apply() call out of the boost namespace. The attached patch fixes the problem. OK to commit?
Hi Daniel, thank you for the report and fix! I just added, tested and commited it (to HEAD for now, I'll merge it to RC_1_34_0 when I finish all the fixes) Best -- Fernando Cacciola SciSoft http://fcacciola.50webs.com/
participants (2)
-
Daniel Wallin
-
Fernando Cacciola