|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r54439 - sandbox/monotonic/libs/monotonic/test/clones
From: christian.schladetsch_at_[hidden]
Date: 2009-06-28 02:47:56
Author: cschladetsch
Date: 2009-06-28 02:47:55 EDT (Sun, 28 Jun 2009)
New Revision: 54439
URL: http://svn.boost.org/trac/boost/changeset/54439
Log:
added heterogenous namespace
Text files modified:
sandbox/monotonic/libs/monotonic/test/clones/main.cpp | 14 +++++++++++++-
1 files changed, 13 insertions(+), 1 deletions(-)
Modified: sandbox/monotonic/libs/monotonic/test/clones/main.cpp
==============================================================================
--- sandbox/monotonic/libs/monotonic/test/clones/main.cpp (original)
+++ sandbox/monotonic/libs/monotonic/test/clones/main.cpp 2009-06-28 02:47:55 EDT (Sun, 28 Jun 2009)
@@ -45,13 +45,22 @@
explicit derived3(float f, int n, std::string const &s) : real(f), num(n), str(s) { }
};
+namespace heterogenous
+{
+ template <class Alloc = std::allocator<char> >
+ struct vector : boost::ptr_vector<cloneable::common_base, cloneable::allocator, Alloc>
+ {
+ };
+
+}
+
int main()
{
// there is a problem with static_move_ptr<>
//typedef cloneable::make_cloneable_allocator<std::allocator<int> >::type alloc_type;
typedef cloneable::make_cloneable_allocator<monotonic::allocator<int> >::type alloc_type;
- typedef ptr_vector<cloneable::common_base, cloneable::allocator, alloc_type > vec;
+ typedef heterogenous::vector<alloc_type> vec;
{
vec bases;
@@ -62,12 +71,15 @@
BOOST_ASSERT(bases.size() == 3);
vec copy = bases;
BOOST_ASSERT(copy.size() == 3);
+
derived *p1 = dynamic_cast<derived *>(©[0]);
derived2 *p2 = dynamic_cast<derived2 *>(©[1]);
derived3 *p3 = dynamic_cast<derived3 *>(©[2]);
+
BOOST_ASSERT(p1);
BOOST_ASSERT(p2);
BOOST_ASSERT(p3);
+
BOOST_ASSERT(p1->num == 42);
BOOST_ASSERT(p2->str == "foo");
BOOST_ASSERT(p3->real == 3.14f);
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