1 /*============================================================================= 2 Copyright (c) 2003 Martin Wille 3 http://spirit.sourceforge.net/ 4 5 Use, modification and distribution is subject to the Boost Software 6 License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at 7 http://www.boost.org/LICENSE_1_0.txt) 8 =============================================================================*/ 9 #ifndef BOOST_SPIRIT_TEST_IMPL_VAR_HPP 10 #define BOOST_SPIRIT_TEST_IMPL_VAR_HPP 11 12 #include <boost/ref.hpp> 13 14 namespace test 15 { 16 template <typename T> 17 struct var_wrapper 18 : public ::boost::reference_wrapper<T> 19 { 20 typedef ::boost::reference_wrapper<T> parent; 21 var_wrappertest::var_wrapper22 explicit inline var_wrapper(T& t) : parent(t) {} 23 operator ()test::var_wrapper24 inline T& operator()() const { return parent::get(); } 25 }; 26 27 template <typename T> 28 inline var_wrapper<T> var(T & t)29 var(T& t) 30 { 31 return var_wrapper<T>(t); 32 } 33 } 34 #endif // BOOST_SPIRIT_TEST_IMPL_VAR_HPP 35