Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r54488 - in sandbox/monotonic: boost libs/monotonic/test/clones
From: christian.schladetsch_at_[hidden]
Date: 2009-06-28 19:25:03


Author: cschladetsch
Date: 2009-06-28 19:25:03 EDT (Sun, 28 Jun 2009)
New Revision: 54488
URL: http://svn.boost.org/trac/boost/changeset/54488

Log:
fixed any<alloc> for GCC
Text files modified:
   sandbox/monotonic/boost/any.hpp | 9 ++++++---
   sandbox/monotonic/libs/monotonic/test/clones/tests.cpp | 4 +---
   2 files changed, 7 insertions(+), 6 deletions(-)

Modified: sandbox/monotonic/boost/any.hpp
==============================================================================
--- sandbox/monotonic/boost/any.hpp (original)
+++ sandbox/monotonic/boost/any.hpp 2009-06-28 19:25:03 EDT (Sun, 28 Jun 2009)
@@ -21,7 +21,7 @@
 
 namespace boost
 {
- template <class Alloc = std::allocator<char> >
+ template <class Alloc = std::allocator<char> >
     class any
     {
                 typedef Alloc allocator_type;
@@ -235,8 +235,11 @@
     template<typename ValueType, class Al2>
     ValueType * any_cast(any<Al2> * operand)
     {
+ typedef any<Al2> any_type;
+ typedef typename any_type::template holder<ValueType> holder_type;
         return operand && operand->type() == typeid(ValueType)
- ? &static_cast<any<Al2>::holder<ValueType> *>(operand->content)->held
+ ? &static_cast<holder_type *>
+ (operand->content)->held
                     : 0;
     }
 
@@ -289,7 +292,7 @@
     template<typename ValueType, class Al6>
     inline ValueType * unsafe_any_cast(any<Al6> * operand)
     {
- return &static_cast<any<Al6>::holder<ValueType> *>(operand->content)->held;
+ return &static_cast<typename any<Al6>::template holder<ValueType> *>(operand->content)->held;
     }
 
     template<typename ValueType, class Al7>

Modified: sandbox/monotonic/libs/monotonic/test/clones/tests.cpp
==============================================================================
--- sandbox/monotonic/libs/monotonic/test/clones/tests.cpp (original)
+++ sandbox/monotonic/libs/monotonic/test/clones/tests.cpp 2009-06-28 19:25:03 EDT (Sun, 28 Jun 2009)
@@ -10,7 +10,7 @@
 #include <iostream>
 #include <boost/heterogenous/vector.hpp>
 #include <boost/bind.hpp>
-//#include <boost/any.hpp>
+#include <boost/any.hpp>
 
 using namespace std;
 using namespace boost;
@@ -123,7 +123,6 @@
 
 void test_any()
 {
-/*
         typedef std::vector<any<monotonic::allocator<char> >, monotonic::allocator<any<monotonic::allocator<char> > > > vec;
         vec v;
         v.push_back(derived(42));
@@ -135,7 +134,6 @@
         cout << "storage.used: " << monotonic::static_storage<>::used() << endl;
 
         BOOST_ASSERT(any_cast<derived2 &>(v2[1]).str == "foo");
-*/
 }
 
 //EOF


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