annotate DEPENDENCIES/generic/include/boost/spirit/home/phoenix/detail/local_reference.hpp @ 56:08f5d78e4b5f

Subrepo update
author Chris Cannam
date Mon, 11 Aug 2014 11:33:41 +0100
parents 2665513ce2d3
children
rev   line source
Chris@16 1 /*=============================================================================
Chris@16 2 Copyright (c) 2005-2007 Joel de Guzman
Chris@16 3
Chris@16 4 Distributed under the Boost Software License, Version 1.0. (See accompanying
Chris@16 5 file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
Chris@16 6 ==============================================================================*/
Chris@16 7 #ifndef PHOENIX_DETAIL_LOCAL_REFERENCE_HPP
Chris@16 8 #define PHOENIX_DETAIL_LOCAL_REFERENCE_HPP
Chris@16 9
Chris@16 10 #include <boost/utility/addressof.hpp>
Chris@16 11
Chris@16 12 namespace boost { namespace phoenix { namespace detail
Chris@16 13 {
Chris@16 14 template <typename T>
Chris@16 15 struct local_reference
Chris@16 16 {
Chris@16 17 typedef T type;
Chris@16 18
Chris@16 19 explicit local_reference(T& t): t_(boost::addressof(t)) {}
Chris@16 20 operator T& () const { return *t_; }
Chris@16 21 local_reference& operator=(T const& x) { *t_ = x; return *this; }
Chris@16 22 local_reference const& operator=(T const& x) const { *t_ = x; return *this; }
Chris@16 23 T& get() const { return *t_; }
Chris@16 24 T* get_pointer() const { return t_; }
Chris@16 25
Chris@16 26 private:
Chris@16 27
Chris@16 28 T* t_;
Chris@16 29 };
Chris@16 30
Chris@16 31 template <typename T>
Chris@16 32 struct unwrap_local_reference
Chris@16 33 {
Chris@16 34 typedef T type; // T should be a reference
Chris@16 35 };
Chris@16 36
Chris@16 37 template <typename T>
Chris@16 38 struct unwrap_local_reference<local_reference<T> >
Chris@16 39 {
Chris@16 40 typedef T type; // unwrap the reference; T is a value
Chris@16 41 };
Chris@16 42 }}}
Chris@16 43
Chris@16 44 #endif