Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r54731 - in sandbox/monotonic: boost/monotonic libs/monotonic/test/Tests
From: christian.schladetsch_at_[hidden]
Date: 2009-07-06 17:33:26


Author: cschladetsch
Date: 2009-07-06 17:33:25 EDT (Mon, 06 Jul 2009)
New Revision: 54731
URL: http://svn.boost.org/trac/boost/changeset/54731

Log:
added stack::push_array

Text files modified:
   sandbox/monotonic/boost/monotonic/stack.hpp | 25 ++++++++++++++++++-------
   sandbox/monotonic/libs/monotonic/test/Tests/Tests.vcproj | 2 +-
   sandbox/monotonic/libs/monotonic/test/Tests/tests.cpp | 2 +-
   3 files changed, 20 insertions(+), 9 deletions(-)

Modified: sandbox/monotonic/boost/monotonic/stack.hpp
==============================================================================
--- sandbox/monotonic/boost/monotonic/stack.hpp (original)
+++ sandbox/monotonic/boost/monotonic/stack.hpp 2009-07-06 17:33:25 EDT (Mon, 06 Jul 2009)
@@ -44,18 +44,23 @@
                                 element_base(bool ip = false)
                                         : is_pod(ip) { }
                                 template <class T>
- T &cast()
+ bool is_type() const
+ {
+ return get_type() == typeid(T);
+ }
+ template <class T>
+ T &get()
                                 {
                                         if (get_type() != typeid(T))
- throw std::bad_cast();
- return *static_cast<element<T> &>(*this).get_pointer();
+ throw std::bad_get();
+ return *static_get<element<T> &>(*this).get_pointer();
                                 }
                                 template <class T>
- const T &cast() const
+ const T &get() const
                                 {
                                         if (get_type() != typeid(T))
- throw std::bad_cast();
- return *static_cast<const element<T> &>(*this).get_pointer();
+ throw std::bad_get();
+ return *static_get<const element<T> &>(*this).get_pointer();
                                 }
                                 virtual void destroy() {}
                                 virtual const std::type_info &get_type() const = 0;
@@ -260,13 +265,19 @@
                         }
 
                         template <class T, class A0, class A1>
- T &push(A0 a0)
+ T &push(A0 a0, A1 a1)
                         {
                                 element<T> &elem = push_element<T>();
                                 new (elem.get_pointer()) T(a0, a1);
                                 return *elem.get_pointer();
                         }
 
+ template <class T, size_t N>
+ array<T, N> &push_array()
+ {
+ return push<array<T, N> >();
+ }
+
                         void pop()
                         {
                                 BOOST_ASSERT(previous);

Modified: sandbox/monotonic/libs/monotonic/test/Tests/Tests.vcproj
==============================================================================
--- sandbox/monotonic/libs/monotonic/test/Tests/Tests.vcproj (original)
+++ sandbox/monotonic/libs/monotonic/test/Tests/Tests.vcproj 2009-07-06 17:33:25 EDT (Mon, 06 Jul 2009)
@@ -89,7 +89,7 @@
                                 Name="VCPostBuildEventTool"
                                 Description="Running tests"
                                 CommandLine="$(OutDir)\$(ProjectName).exe"
- ExcludedFromBuild="true"
+ ExcludedFromBuild="false"
                         />
                 </Configuration>
                 <Configuration

Modified: sandbox/monotonic/libs/monotonic/test/Tests/tests.cpp
==============================================================================
--- sandbox/monotonic/libs/monotonic/test/Tests/tests.cpp (original)
+++ sandbox/monotonic/libs/monotonic/test/Tests/tests.cpp 2009-07-06 17:33:25 EDT (Mon, 06 Jul 2009)
@@ -96,7 +96,7 @@
                 float &f0 = stack.push<float>();
                 char &n3 = stack.push<char>();
                 Tracked &tracked = stack.push<Tracked>();
- boost::array<int, 42> &a = stack.push<boost::array<int, 42> >();
+ boost::array<int, 42> &a = stack.push_array<int, 42>();
 
                 BOOST_ASSERT(stack.size() == 5);
 


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