From 0357fe1ddac621f57bbf5a92b679e8ebf0df60b4 Mon Sep 17 00:00:00 2001 From: mat007 Date: Sun, 22 Jul 2012 07:02:21 +0000 Subject: [PATCH] Refactoring to pass boost::optional by value instead of const ref git-svn-id: https://svn.code.sf.net/p/turtle/code/trunk@485 860be788-9bd5-4423-9f1e-828f051e677b --- turtle/detail/child.hpp | 2 +- turtle/detail/context.hpp | 2 +- turtle/detail/function_template.hpp | 2 +- turtle/detail/object_impl.hpp | 2 +- turtle/detail/parent.hpp | 2 +- turtle/detail/root.hpp | 4 ++-- turtle/object.hpp | 7 +++---- 7 files changed, 10 insertions(+), 11 deletions(-) diff --git a/turtle/detail/child.hpp b/turtle/detail/child.hpp index 91ffac4..16268d9 100644 --- a/turtle/detail/child.hpp +++ b/turtle/detail/child.hpp @@ -27,7 +27,7 @@ namespace detail {} void update( parent& p, boost::unit_test::const_string instance, - const boost::optional< type_name >& type, + boost::optional< type_name > type, boost::unit_test::const_string name ) { if( instance != "?." || name_.empty() ) diff --git a/turtle/detail/context.hpp b/turtle/detail/context.hpp index 0fd6511..e054a63 100644 --- a/turtle/detail/context.hpp +++ b/turtle/detail/context.hpp @@ -29,7 +29,7 @@ namespace detail virtual void add( const void* p, verifiable& v, boost::unit_test::const_string instance, - const boost::optional< type_name >& type, + boost::optional< type_name > type, boost::unit_test::const_string name ) = 0; virtual void add( verifiable& v ) = 0; virtual void remove( verifiable& v ) = 0; diff --git a/turtle/detail/function_template.hpp b/turtle/detail/function_template.hpp index 87749e0..beecd68 100644 --- a/turtle/detail/function_template.hpp +++ b/turtle/detail/function_template.hpp @@ -92,7 +92,7 @@ namespace mock void configure( detail::context& c, const void* p, boost::unit_test::const_string instance, - const boost::optional< detail::type_name >& type, + boost::optional< detail::type_name > type, boost::unit_test::const_string name ) const { if( ! impl_->context_ ) diff --git a/turtle/detail/object_impl.hpp b/turtle/detail/object_impl.hpp index 4047154..b28ee65 100644 --- a/turtle/detail/object_impl.hpp +++ b/turtle/detail/object_impl.hpp @@ -29,7 +29,7 @@ namespace detail public: virtual void add( const void* /*p*/, detail::verifiable& v, boost::unit_test::const_string instance, - const boost::optional< detail::type_name >& type, + boost::optional< detail::type_name > type, boost::unit_test::const_string name ) { if( children_.empty() ) diff --git a/turtle/detail/parent.hpp b/turtle/detail/parent.hpp index 96a6c8f..f5637f0 100644 --- a/turtle/detail/parent.hpp +++ b/turtle/detail/parent.hpp @@ -24,7 +24,7 @@ namespace detail parent() {} parent( boost::unit_test::const_string instance, - const boost::optional< type_name >& type ) + boost::optional< type_name > type ) : instance_( instance ) , type_( type ) {} diff --git a/turtle/detail/root.hpp b/turtle/detail/root.hpp index 1aa8c2e..519e437 100644 --- a/turtle/detail/root.hpp +++ b/turtle/detail/root.hpp @@ -27,7 +27,7 @@ namespace detail public: virtual void add( const void* p, verifiable& v, boost::unit_test::const_string instance, - const boost::optional< type_name >& type, + boost::optional< type_name > type, boost::unit_test::const_string name ) { children_it it = children_.lower_bound( &v ); @@ -94,7 +94,7 @@ namespace detail parents_->erase( it_ ); } void update( boost::unit_test::const_string instance, - const boost::optional< type_name >& type, + boost::optional< type_name > type, boost::unit_test::const_string name ) { child_.update( it_->second.first, instance, type, name ); diff --git a/turtle/object.hpp b/turtle/object.hpp index 769137a..bd01b34 100644 --- a/turtle/object.hpp +++ b/turtle/object.hpp @@ -38,17 +38,17 @@ namespace detail template< typename E > E& configure( const object& o, E& e, boost::unit_test::const_string instance, - const boost::optional< type_name >& type, + boost::optional< detail::type_name > type, boost::unit_test::const_string name ) { e.configure( *o.impl_, o.impl_.get(), instance, type, name ); return e; } - template< typename E, typename T > + template< typename T, typename E > E& configure( const T& t, E& e, boost::unit_test::const_string instance, - const boost::optional< type_name >& type, + boost::optional< detail::type_name > type, boost::unit_test::const_string name, BOOST_DEDUCED_TYPENAME boost::disable_if< BOOST_DEDUCED_TYPENAME boost::is_base_of< object, T > @@ -58,7 +58,6 @@ namespace detail return e; } } - inline bool verify( const object& o ) { return o.impl_->verify();