Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r62958 - sandbox/SOC/2010/phoenix3/boost/phoenix/core
From: joel_at_[hidden]
Date: 2010-06-14 19:47:28


Author: djowel
Date: 2010-06-14 19:47:27 EDT (Mon, 14 Jun 2010)
New Revision: 62958
URL: http://svn.boost.org/trac/boost/changeset/62958

Log:
tweaks -- conformance to standard protocol
Text files modified:
   sandbox/SOC/2010/phoenix3/boost/phoenix/core/reference.hpp | 52 +++++++++++++++++++++++----------------
   1 files changed, 31 insertions(+), 21 deletions(-)

Modified: sandbox/SOC/2010/phoenix3/boost/phoenix/core/reference.hpp
==============================================================================
--- sandbox/SOC/2010/phoenix3/boost/phoenix/core/reference.hpp (original)
+++ sandbox/SOC/2010/phoenix3/boost/phoenix/core/reference.hpp 2010-06-14 19:47:27 EDT (Mon, 14 Jun 2010)
@@ -16,44 +16,54 @@
 namespace boost { namespace phoenix
 {
     ////////////////////////////////////////////////////////////////////////////
- // References
+ //
+ // reference
+ //
+ // function for evaluating references, e.g. ref(123)
+ //
     ////////////////////////////////////////////////////////////////////////////
+
+ namespace result_of
+ {
+ template <typename Env, typename T>
+ struct reference
+ : boost::result_of<eval_grammar(T&)>
+ {};
+ }
     
- // function for evaluating references, e.g. ref( 123 )
     struct reference
     {
- template<typename T>
- struct compose : phoenix::compose<reference, T&>
- {};
-
- template<typename Sig>
+ template <typename Sig>
         struct result;
 
- template<typename This, typename Env, typename T>
- struct result<This(Env &, T &)>
- : boost::result_of<eval_grammar(T &)>
+ template <typename This, typename Env, typename T>
+ struct result<This(Env&, T&)>
+ : result_of::reference<Env, T>
         {};
 
- template<typename Env, typename T>
- typename boost::result_of<eval_grammar(T &)>::type
- operator()(Env & env, T & t) const
+ template <typename Env, typename T>
+ typename result_of::reference<Env, T>::type
+ operator()(Env& env, T& ref) const
         {
- return eval(t);
+ return eval(ref);
         }
     };
+
+ template <typename T>
+ struct make_reference : compose<reference, T&> {};
 
- template<typename T>
- typename reference::compose<T>::result_type
- ref(T & t)
+ template <typename T>
+ typename make_reference<T>::type
+ ref(T& t)
     {
- return reference::compose<T>()(t);
+ return make_reference<T>()(t);
     }
 
     template<typename T>
- typename reference::compose<T const>::result_type
- cref(T & t)
+ typename make_reference<T const>::type
+ cref(T& t)
     {
- return reference::compose<T const>()(t);
+ return make_reference<T const>()(t);
     }
 
 }}


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