/usr/include/boost/phoenix/core/reference.hpp is in libboost1.55-dev 1.55.0+dfsg-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 | /*==============================================================================
Copyright (c) 2001-2010 Joel de Guzman
Copyright (c) 2010 Thomas Heller
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
==============================================================================*/
#ifndef BOOST_PHOENIX_CORE_REFERENCE_HPP
#define BOOST_PHOENIX_CORE_REFERENCE_HPP
#include <boost/phoenix/core/limits.hpp>
#include <boost/ref.hpp>
#include <boost/phoenix/core/actor.hpp>
#include <boost/phoenix/core/terminal.hpp>
#include <boost/utility/result_of.hpp>
namespace boost { namespace phoenix
{
/////////////////////////////////////////////////////////////////////////////
//
// reference
//
// function for evaluating references, e.g. ref(123)
//
/////////////////////////////////////////////////////////////////////////////
namespace expression
{
template <typename T>
struct reference
: expression::terminal<reference_wrapper<T> >
{
typedef
typename expression::terminal<reference_wrapper<T> >::type
type;
static const type make(T & t)
{
typename reference<T>::type const e = {{boost::ref(t)}};
return e;
}
};
template <typename T>
struct reference<T const>
: expression::terminal<reference_wrapper<T const> >
{
typedef
typename expression::terminal<reference_wrapper<T const> >::type
type;
static const type make(T const & t)
{
typename reference<T const>::type const e = {{boost::cref(t)}};
return e;
}
};
}
namespace rule
{
struct reference
: expression::reference<proto::_>
{};
}
template <typename T>
typename expression::reference<T>::type const
inline ref(T & t)
{
return expression::reference<T>::make(t);
}
template <typename T>
typename expression::reference<T const>::type const
inline cref(T const & t)
{
return expression::reference<T const>::make(t);
}
// Call out boost::reference_wrapper for special handling
template<typename T>
struct is_custom_terminal<boost::reference_wrapper<T> >
: mpl::true_
{};
// Special handling for boost::reference_wrapper
template<typename T>
struct custom_terminal<boost::reference_wrapper<T> >
{
typedef T &result_type;
template <typename Context>
T &operator()(boost::reference_wrapper<T> r, Context &) const
{
return r;
}
};
template<typename Expr>
struct custom_terminal<boost::reference_wrapper<actor<Expr> > >
{
template <typename Sig>
struct result;
template <typename This, typename Context>
struct result<This(boost::reference_wrapper<actor<Expr> > const &, Context)>
: boost::result_of<evaluator(actor<Expr> &, Context)>
{};
template <typename This, typename Context>
struct result<This(boost::reference_wrapper<actor<Expr> > &, Context)>
: boost::result_of<evaluator(actor<Expr> &, Context)>
{};
template <typename Context>
typename boost::result_of<evaluator(actor<Expr> &, Context const &)>::type
operator()(boost::reference_wrapper<actor<Expr> > & r, Context const & ctx) const
{
return boost::phoenix::eval(r, ctx);
}
};
template<typename Expr>
struct custom_terminal<boost::reference_wrapper<actor<Expr> const> >
{
template <typename Sig>
struct result;
template <typename This, typename Context>
struct result<This(boost::reference_wrapper<actor<Expr> const> const &, Context)>
: boost::result_of<evaluator(actor<Expr> const&, Context)>
{};
template <typename This, typename Context>
struct result<This(boost::reference_wrapper<actor<Expr> const> &, Context)>
: boost::result_of<evaluator(actor<Expr> const&, Context)>
{};
template <typename Context>
typename boost::result_of<evaluator(actor<Expr> const&, Context const &)>::type
operator()(boost::reference_wrapper<actor<Expr> const> const & r, Context & ctx) const
{
return boost::phoenix::eval(unwrap_ref(r), ctx);
}
};
}}
#endif
|