Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r54516 - in sandbox/monotonic: boost/heterogenous libs/monotonic/test/clones
From: christian.schladetsch_at_[hidden]
Date: 2009-06-29 23:50:24


Author: cschladetsch
Date: 2009-06-29 23:50:24 EDT (Mon, 29 Jun 2009)
New Revision: 54516
URL: http://svn.boost.org/trac/boost/changeset/54516

Log:
renamed
Added:
   sandbox/monotonic/boost/heterogenous/abstract_base.hpp
      - copied unchanged from r54515, /sandbox/monotonic/boost/heterogenous/common_base.hpp
Removed:
   sandbox/monotonic/boost/heterogenous/common_base.hpp
Text files modified:
   sandbox/monotonic/libs/monotonic/test/clones/clones.vcproj | 6 +++---
   sandbox/monotonic/libs/monotonic/test/clones/tests.cpp | 29 +++++++++++++++++++++++++++++
   2 files changed, 32 insertions(+), 3 deletions(-)

Deleted: sandbox/monotonic/boost/heterogenous/common_base.hpp
==============================================================================
--- sandbox/monotonic/boost/heterogenous/common_base.hpp 2009-06-29 23:50:24 EDT (Mon, 29 Jun 2009)
+++ (empty file)
@@ -1,48 +0,0 @@
-// Copyright (C) 2009 Christian Schladetsch
-//
-// Distributed under the Boost Software License, Version 1.0. (See accompanying
-// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
-
-#ifndef BOOST_HETEROGENOUS_COMMON_BASE_HPP
-#define BOOST_HETEROGENOUS_COMMON_BASE_HPP
-
-#include <boost/heterogenous/detail/prefix.hpp>
-#include <boost/heterogenous/abstract_allocator.hpp>
-
-namespace boost
-{
- namespace heterogenous
- {
- struct default_base_type
- {
- virtual ~default_base_type() { }
- };
-
- /// common base for all base types for hierachies
- template <class Base = default_base_type>
- struct abstract_base : Base
- {
- typedef Base base_type;
- typedef abstract_base<Base> this_type;
-
- //virtual base_type *allocate(abstract_allocator &alloc) const /*= 0;*/ { return 0; }
- //virtual void deallocate(base_type *, abstract_allocator &alloc) const /*= 0;*/ { }
- //virtual base_type *create(abstract_allocator &alloc) const /*= 0;*/ { return 0; }
- //virtual base_type *copy_construct(const base_type &original, abstract_allocator &alloc) const /*= 0;*/ { return 0; }
-
- virtual this_type *allocate(abstract_allocator &alloc) const = 0;
- virtual void deallocate(base_type &, abstract_allocator &alloc) const = 0;
-
- virtual this_type *create_new(abstract_allocator &alloc) const = 0;
- virtual this_type *copy_construct(const base_type &original, abstract_allocator &alloc) const = 0;
- };
-
- } // namespace heterogenous
-
-} // namespace boost
-
-#include <boost/heterogenous/detail/suffix.hpp>
-
-#endif // BOOST_HETEROGENOUS_COMMON_BASE_HPP
-
-//EOF

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-29 23:50:24 EDT (Mon, 29 Jun 2009)
@@ -361,15 +361,15 @@
>
                                 </File>
                                 <File
- RelativePath="..\..\..\..\boost\heterogenous\allocator.hpp"
+ RelativePath="..\..\..\..\boost\heterogenous\abstract_base.hpp"
>
                                 </File>
                                 <File
- RelativePath="..\..\..\..\boost\heterogenous\base.hpp"
+ RelativePath="..\..\..\..\boost\heterogenous\allocator.hpp"
>
                                 </File>
                                 <File
- RelativePath="..\..\..\..\boost\heterogenous\common_base.hpp"
+ RelativePath="..\..\..\..\boost\heterogenous\base.hpp"
>
                                 </File>
                                 <File

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-29 23:50:24 EDT (Mon, 29 Jun 2009)
@@ -71,12 +71,41 @@
 
 void test_map();
 
+
+ namespace test
+ {
+ using namespace heterogenous;
+ struct my_base
+ {
+ virtual ~my_base() { }
+ };
+
+ struct T0 : base<T0, my_base> { };
+ struct T1 : base<T1, my_base> { };
+
+ void run()
+ {
+ typedef heterogenous::vector<my_base> vec;
+ vec v0;
+ v0.emplace_back<T0>();
+ v0.emplace_back<T1>();
+ vec v1 = v0;
+ my_base &whatever = v1[0];
+ assert(v1.ptr_at<T1>(1));
+ }
+ }
+
 int main()
 {
+ test::run();
+
         test_any();
         test_variant();
         test_map();
 
+
+
+
         // a 'heterogenous' container of objects of any type that derives from common_base
         typedef heterogenous::vector<my_base> vec;
 


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