Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r50829 - trunk/boost/flyweight
From: joaquin_at_[hidden]
Date: 2009-01-27 17:34:02


Author: joaquin
Date: 2009-01-27 17:34:02 EST (Tue, 27 Jan 2009)
New Revision: 50829
URL: http://svn.boost.org/trac/boost/changeset/50829

Log:
completed changes that should have gone in rev. 50709
Text files modified:
   trunk/boost/flyweight/assoc_container_factory.hpp | 16 +++++++++++++---
   1 files changed, 13 insertions(+), 3 deletions(-)

Modified: trunk/boost/flyweight/assoc_container_factory.hpp
==============================================================================
--- trunk/boost/flyweight/assoc_container_factory.hpp (original)
+++ trunk/boost/flyweight/assoc_container_factory.hpp 2009-01-27 17:34:02 EST (Tue, 27 Jan 2009)
@@ -15,10 +15,12 @@
 
 #include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
 #include <boost/flyweight/assoc_container_factory_fwd.hpp>
+#include <boost/flyweight/detail/is_placeholder_expr.hpp>
 #include <boost/flyweight/detail/nested_xxx_if_not_ph.hpp>
 #include <boost/flyweight/factory_tag.hpp>
 #include <boost/mpl/apply.hpp>
 #include <boost/mpl/aux_/lambda_support.hpp>
+#include <boost/mpl/if.hpp>
 
 namespace boost{namespace flyweights{namespace detail{
 BOOST_FLYWEIGHT_NESTED_XXX_IF_NOT_PLACEHOLDER_EXPRESSION_DEF(iterator);
@@ -36,7 +38,6 @@
 class assoc_container_factory_class:public factory_marker
 {
 public:
-
   /* When assoc_container_factory_class<Container> is an MPL placeholder
    * expression, referring to Container::iterator and Container::value_type
    * force the MPL placeholder expression Container to be instantiated, which
@@ -63,8 +64,17 @@
 
   static const entry_type& entry(handle_type h){return *h;}
 
-private:
- Container cont;
+private:
+ /* As above, avoid instantiating Container if it is an
+ * MPL placeholder expression.
+ */
+
+ typedef typename mpl::if_<
+ detail::is_placeholder_expression<Container>,
+ int,
+ Container
+ >::type container_type;
+ container_type cont;
 
 public:
   typedef assoc_container_factory_class type;


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