Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r49476 - in sandbox/guigl: boost/parameter/aux_ libs/guigl/test
From: stipe_at_[hidden]
Date: 2008-10-28 15:19:46


Author: srajko
Date: 2008-10-28 15:19:45 EDT (Tue, 28 Oct 2008)
New Revision: 49476
URL: http://svn.boost.org/trac/boost/changeset/49476

Log:
fixed delayed construction
Text files modified:
   sandbox/guigl/boost/parameter/aux_/delayed_constructor.hpp | 11 ++++++-----
   sandbox/guigl/boost/parameter/aux_/typed_arg_list.hpp | 2 +-
   sandbox/guigl/boost/parameter/aux_/typed_tagged_argument.hpp | 5 +++--
   sandbox/guigl/libs/guigl/test/test_delayed_constructor.cpp | 5 ++++-
   4 files changed, 14 insertions(+), 9 deletions(-)

Modified: sandbox/guigl/boost/parameter/aux_/delayed_constructor.hpp
==============================================================================
--- sandbox/guigl/boost/parameter/aux_/delayed_constructor.hpp (original)
+++ sandbox/guigl/boost/parameter/aux_/delayed_constructor.hpp 2008-10-28 15:19:45 EDT (Tue, 28 Oct 2008)
@@ -37,14 +37,15 @@
         : public mpl::true_
     {};
 
+ template< typename T, BOOST_PP_ENUM_PARAMS(BOOST_PARAMETER_MAX_DELAYED_CONSTRUCTOR_ARITY, typename T)>
+ struct is_delayed_constructor<const delayed_constructor<T, BOOST_PP_ENUM_PARAMS(BOOST_PARAMETER_MAX_DELAYED_CONSTRUCTOR_ARITY, T)> >
+ : public mpl::true_
+ {};
+
     template< typename T >
     struct value_type_of
- {};
-
- template< typename T, BOOST_PP_ENUM_PARAMS(BOOST_PARAMETER_MAX_DELAYED_CONSTRUCTOR_ARITY, typename T)>
- struct value_type_of<delayed_constructor<T, BOOST_PP_ENUM_PARAMS(BOOST_PARAMETER_MAX_DELAYED_CONSTRUCTOR_ARITY, T)> >
     {
- typedef typename delayed_constructor<T, BOOST_PP_ENUM_PARAMS(BOOST_PARAMETER_MAX_DELAYED_CONSTRUCTOR_ARITY, T)>::value_type type;
+ typedef typename T::value_type type;
     };
 
 # define BOOST_PP_FILENAME_1 <boost/parameter/aux_/delayed_constructor.hpp>

Modified: sandbox/guigl/boost/parameter/aux_/typed_arg_list.hpp
==============================================================================
--- sandbox/guigl/boost/parameter/aux_/typed_arg_list.hpp (original)
+++ sandbox/guigl/boost/parameter/aux_/typed_arg_list.hpp 2008-10-28 15:19:45 EDT (Tue, 28 Oct 2008)
@@ -272,7 +272,7 @@
         return arg.value ? arg.value.get() : arg.value.construct(d.value);
     }
 
- reference operator[](keyword_base<key_type> const&) const
+ index_result_type operator[](keyword_base<key_type> const&) const
     {
         BOOST_MPL_ASSERT_NOT((holds_maybe));
         return arg.value;

Modified: sandbox/guigl/boost/parameter/aux_/typed_tagged_argument.hpp
==============================================================================
--- sandbox/guigl/boost/parameter/aux_/typed_tagged_argument.hpp (original)
+++ sandbox/guigl/boost/parameter/aux_/typed_tagged_argument.hpp 2008-10-28 15:19:45 EDT (Tue, 28 Oct 2008)
@@ -46,8 +46,9 @@
     
     typedef typename mpl::if_<is_delayed_constructor<Arg>, value_type, reference>::type index_result_type;
     typedef typename mpl::if_<is_delayed_constructor<Arg>, Arg, reference>::type storage_type;
-
- typed_tagged_argument(reference x) : value(x) {}
+ typedef typename mpl::if_<is_delayed_constructor<Arg>, Arg &, reference>::type init_type;
+
+ typed_tagged_argument(init_type x) : value(x) {}
 
     // A metafunction class that, given a keyword and a default
     // type, returns the appropriate result type for a keyword

Modified: sandbox/guigl/libs/guigl/test/test_delayed_constructor.cpp
==============================================================================
--- sandbox/guigl/libs/guigl/test/test_delayed_constructor.cpp (original)
+++ sandbox/guigl/libs/guigl/test/test_delayed_constructor.cpp 2008-10-28 15:19:45 EDT (Tue, 28 Oct 2008)
@@ -17,7 +17,8 @@
 {
     using namespace boost::parameter::aux;
 
- delayed_constructor<int, int> delayed_int(2);
+ typedef delayed_constructor<int, int> delayed_int_constructor_type;
+ delayed_int_constructor_type delayed_int(2);
     int i = delayed_int;
     
     BOOST_CHECK_EQUAL(i, 2);
@@ -29,4 +30,6 @@
     
     BOOST_CHECK_EQUAL(p.first, 1);
     BOOST_CHECK_EQUAL(p.second, 3.5);
+
+ BOOST_CHECK(is_delayed_constructor<delayed_int_constructor_type>::value);
 }
\ No newline at end of file


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