Boost logo

Boost-Commit :

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


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

Log:
added create_holder<T>

Text files modified:
   sandbox/monotonic/boost/any.hpp | 16 +++++++++++-----
   sandbox/monotonic/libs/monotonic/test/clones/clones.vcproj | 4 ++++
   2 files changed, 15 insertions(+), 5 deletions(-)

Modified: sandbox/monotonic/boost/any.hpp
==============================================================================
--- sandbox/monotonic/boost/any.hpp (original)
+++ sandbox/monotonic/boost/any.hpp 2009-06-28 19:04:41 EDT (Sun, 28 Jun 2009)
@@ -24,7 +24,6 @@
         template <class Alloc = std::allocator<char> >
     class any
     {
- template <class> friend class any;
                 typedef Alloc allocator_type;
                 typedef any<allocator_type> any_type;
 
@@ -52,7 +51,7 @@
                         return ptr;
                 }
                 template <class U, class A0, class A1>
- U *construct_type(A0 a0, A1& a1)
+ U *construct_type(A0 a0, A1 a1)
                 {
                         typename allocator_type::template rebind<U>::other alloc(get_allocator());
                         U *ptr = alloc.allocate(1);
@@ -71,7 +70,6 @@
                         typename allocator_type::template rebind<U>::other alloc(get_allocator());
                         alloc.deallocate(ptr, 1);
                 }
-
     public: // structors
 
         any()
@@ -82,14 +80,14 @@
                 template<typename ValueType>
                 any(const ValueType & value)
                 {
- content = construct_type<holder<ValueType> >(value, *this);
+ content = construct_holder<ValueType>(value);
                 }
                 
                 template<typename ValueType, class Al>
         any(const ValueType & value, Al al)
           : alloc(al)
         {
- content = construct_type<holder<ValueType> >(value, *this);
+ content = construct_holder<ValueType>(value);
                 }
 
         any(const any & other)
@@ -198,6 +196,14 @@
 #ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS
 
     private: // representation
+ template <class U>
+ holder<U> *construct_holder(U const &init)
+ {
+ typename allocator_type::template rebind<holder<U> >::other alloc(get_allocator());
+ holder<U> *ptr = alloc.allocate(1);
+ new (ptr) holder<U>(init, *this);
+ return ptr;
+ }
 
         template<typename ValueType, class Al9>
         friend ValueType * any_cast(any<Al9> *);

Modified: sandbox/monotonic/libs/monotonic/test/clones/clones.vcproj
==============================================================================
--- sandbox/monotonic/libs/monotonic/test/clones/clones.vcproj (original)
+++ sandbox/monotonic/libs/monotonic/test/clones/clones.vcproj 2009-06-28 19:04:41 EDT (Sun, 28 Jun 2009)
@@ -171,6 +171,10 @@
                         Filter="h;hpp;hxx;hm;inl;inc;xsd"
                         UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
>
+ <File
+ RelativePath="..\..\..\..\boost\any.hpp"
+ >
+ </File>
                         <Filter
                                 Name="ptr_container"
>


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