12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574 |
- #ifndef BOOST_XPRESSIVE_ACTIONS_HPP_EAN_03_22_2007
- #define BOOST_XPRESSIVE_ACTIONS_HPP_EAN_03_22_2007
- #if defined(_MSC_VER)
- # pragma once
- #endif
- #include <boost/config.hpp>
- #include <boost/preprocessor/punctuation/comma_if.hpp>
- #include <boost/ref.hpp>
- #include <boost/mpl/if.hpp>
- #include <boost/mpl/or.hpp>
- #include <boost/mpl/int.hpp>
- #include <boost/mpl/assert.hpp>
- #include <boost/noncopyable.hpp>
- #include <boost/lexical_cast.hpp>
- #include <boost/throw_exception.hpp>
- #include <boost/utility/enable_if.hpp>
- #include <boost/type_traits/is_same.hpp>
- #include <boost/type_traits/is_const.hpp>
- #include <boost/type_traits/is_integral.hpp>
- #include <boost/type_traits/decay.hpp>
- #include <boost/type_traits/remove_cv.hpp>
- #include <boost/type_traits/remove_reference.hpp>
- #include <boost/range/iterator_range.hpp>
- #include <boost/xpressive/detail/detail_fwd.hpp>
- #include <boost/xpressive/detail/core/state.hpp>
- #include <boost/xpressive/detail/core/matcher/attr_matcher.hpp>
- #include <boost/xpressive/detail/core/matcher/attr_end_matcher.hpp>
- #include <boost/xpressive/detail/core/matcher/attr_begin_matcher.hpp>
- #include <boost/xpressive/detail/core/matcher/predicate_matcher.hpp>
- #include <boost/xpressive/detail/utility/ignore_unused.hpp>
- #include <boost/xpressive/detail/static/type_traits.hpp>
- #include <boost/typeof/std/map.hpp>
- #include <boost/typeof/std/string.hpp>
- #ifndef BOOST_XPRESSIVE_DOXYGEN_INVOKED
- # include <boost/proto/core.hpp>
- # include <boost/proto/transform.hpp>
- # include <boost/xpressive/detail/core/matcher/action_matcher.hpp>
- #endif
- #if BOOST_MSVC
- #pragma warning(push)
- #pragma warning(disable : 4510)
- #pragma warning(disable : 4512)
- #pragma warning(disable : 4610)
- #endif
- namespace boost { namespace xpressive
- {
- namespace detail
- {
- template<typename T, typename U>
- struct action_arg
- {
- typedef T type;
- typedef typename add_reference<T>::type reference;
- reference cast(void *pv) const
- {
- return *static_cast<typename remove_reference<T>::type *>(pv);
- }
- };
- template<typename T>
- struct value_wrapper
- : private noncopyable
- {
- value_wrapper()
- : value()
- {}
- value_wrapper(T const &t)
- : value(t)
- {}
- T value;
- };
- struct check_tag
- {};
- struct BindArg
- {
- BOOST_PROTO_CALLABLE()
- template<typename Sig>
- struct result {};
- template<typename This, typename MatchResults, typename Expr>
- struct result<This(MatchResults, Expr)>
- {
- typedef Expr type;
- };
- template<typename MatchResults, typename Expr>
- Expr const & operator ()(MatchResults &what, Expr const &expr) const
- {
- what.let(expr);
- return expr;
- }
- };
- struct let_tag
- {};
-
- struct BindArgs
- : proto::function<
- proto::terminal<let_tag>
- , proto::vararg<
- proto::when<
- proto::assign<proto::_, proto::_>
- , proto::call<BindArg(proto::_data, proto::_)>
- >
- >
- >
- {};
- struct let_domain
- : boost::proto::domain<boost::proto::pod_generator<let_> >
- {};
- template<typename Expr>
- struct let_
- {
- BOOST_PROTO_BASIC_EXTENDS(Expr, let_<Expr>, let_domain)
- BOOST_PROTO_EXTENDS_FUNCTION()
- };
- template<typename Args, typename BidiIter>
- void bind_args(let_<Args> const &args, match_results<BidiIter> &what)
- {
- BindArgs()(args, 0, what);
- }
- typedef boost::proto::functional::make_expr<proto::tag::function, proto::default_domain> make_function;
- }
- namespace op
- {
-
- struct at
- {
- BOOST_PROTO_CALLABLE()
- template<typename Sig>
- struct result {};
- template<typename This, typename Cont, typename Idx>
- struct result<This(Cont &, Idx)>
- {
- typedef typename Cont::reference type;
- };
- template<typename This, typename Cont, typename Idx>
- struct result<This(Cont const &, Idx)>
- {
- typedef typename Cont::const_reference type;
- };
- template<typename This, typename Cont, typename Idx>
- struct result<This(Cont, Idx)>
- {
- typedef typename Cont::const_reference type;
- };
-
-
-
-
- template<typename Cont, typename Idx>
- typename Cont::reference operator()(Cont &c, Idx idx BOOST_PROTO_DISABLE_IF_IS_CONST(Cont)) const
- {
- return c[idx];
- }
-
-
- template<typename Cont, typename Idx>
- typename Cont::const_reference operator()(Cont const &c, Idx idx) const
- {
- return c[idx];
- }
- };
-
- struct push
- {
- BOOST_PROTO_CALLABLE()
- typedef void result_type;
-
-
-
-
- template<typename Sequence, typename Value>
- void operator()(Sequence &seq, Value const &val) const
- {
- seq.push(val);
- }
- };
-
- struct push_back
- {
- BOOST_PROTO_CALLABLE()
- typedef void result_type;
-
-
-
-
- template<typename Sequence, typename Value>
- void operator()(Sequence &seq, Value const &val) const
- {
- seq.push_back(val);
- }
- };
-
- struct push_front
- {
- BOOST_PROTO_CALLABLE()
- typedef void result_type;
-
-
-
-
- template<typename Sequence, typename Value>
- void operator()(Sequence &seq, Value const &val) const
- {
- seq.push_front(val);
- }
- };
-
- struct pop
- {
- BOOST_PROTO_CALLABLE()
- typedef void result_type;
-
-
-
- template<typename Sequence>
- void operator()(Sequence &seq) const
- {
- seq.pop();
- }
- };
-
- struct pop_back
- {
- BOOST_PROTO_CALLABLE()
- typedef void result_type;
-
-
-
- template<typename Sequence>
- void operator()(Sequence &seq) const
- {
- seq.pop_back();
- }
- };
-
- struct pop_front
- {
- BOOST_PROTO_CALLABLE()
- typedef void result_type;
-
-
-
- template<typename Sequence>
- void operator()(Sequence &seq) const
- {
- seq.pop_front();
- }
- };
-
- struct front
- {
- BOOST_PROTO_CALLABLE()
- template<typename Sig>
- struct result {};
- template<typename This, typename Sequence>
- struct result<This(Sequence)>
- {
- typedef typename remove_reference<Sequence>::type sequence_type;
- typedef
- typename mpl::if_c<
- is_const<sequence_type>::value
- , typename sequence_type::const_reference
- , typename sequence_type::reference
- >::type
- type;
- };
-
-
- template<typename Sequence>
- typename result<front(Sequence &)>::type operator()(Sequence &seq) const
- {
- return seq.front();
- }
- };
-
- struct back
- {
- BOOST_PROTO_CALLABLE()
- template<typename Sig>
- struct result {};
- template<typename This, typename Sequence>
- struct result<This(Sequence)>
- {
- typedef typename remove_reference<Sequence>::type sequence_type;
- typedef
- typename mpl::if_c<
- is_const<sequence_type>::value
- , typename sequence_type::const_reference
- , typename sequence_type::reference
- >::type
- type;
- };
-
-
- template<typename Sequence>
- typename result<back(Sequence &)>::type operator()(Sequence &seq) const
- {
- return seq.back();
- }
- };
-
- struct top
- {
- BOOST_PROTO_CALLABLE()
- template<typename Sig>
- struct result {};
- template<typename This, typename Sequence>
- struct result<This(Sequence)>
- {
- typedef typename remove_reference<Sequence>::type sequence_type;
- typedef
- typename mpl::if_c<
- is_const<sequence_type>::value
- , typename sequence_type::value_type const &
- , typename sequence_type::value_type &
- >::type
- type;
- };
-
-
- template<typename Sequence>
- typename result<top(Sequence &)>::type operator()(Sequence &seq) const
- {
- return seq.top();
- }
- };
-
- struct first
- {
- BOOST_PROTO_CALLABLE()
- template<typename Sig>
- struct result {};
- template<typename This, typename Pair>
- struct result<This(Pair)>
- {
- typedef typename remove_reference<Pair>::type::first_type type;
- };
-
-
- template<typename Pair>
- typename Pair::first_type operator()(Pair const &p) const
- {
- return p.first;
- }
- };
-
- struct second
- {
- BOOST_PROTO_CALLABLE()
- template<typename Sig>
- struct result {};
- template<typename This, typename Pair>
- struct result<This(Pair)>
- {
- typedef typename remove_reference<Pair>::type::second_type type;
- };
-
-
- template<typename Pair>
- typename Pair::second_type operator()(Pair const &p) const
- {
- return p.second;
- }
- };
-
-
- struct matched
- {
- BOOST_PROTO_CALLABLE()
- typedef bool result_type;
-
-
- template<typename Sub>
- bool operator()(Sub const &sub) const
- {
- return sub.matched;
- }
- };
-
- struct length
- {
- BOOST_PROTO_CALLABLE()
- template<typename Sig>
- struct result {};
- template<typename This, typename Sub>
- struct result<This(Sub)>
- {
- typedef typename remove_reference<Sub>::type::difference_type type;
- };
-
-
- template<typename Sub>
- typename Sub::difference_type operator()(Sub const &sub) const
- {
- return sub.length();
- }
- };
-
-
- struct str
- {
- BOOST_PROTO_CALLABLE()
- template<typename Sig>
- struct result {};
- template<typename This, typename Sub>
- struct result<This(Sub)>
- {
- typedef typename remove_reference<Sub>::type::string_type type;
- };
-
-
- template<typename Sub>
- typename Sub::string_type operator()(Sub const &sub) const
- {
- return sub.str();
- }
- };
-
-
-
-
-
-
-
- struct insert
- {
- BOOST_PROTO_CALLABLE()
-
-
- struct detail
- {
- template<typename Sig, typename EnableIf = void>
- struct result_detail
- {};
-
- template<typename This, typename Cont, typename Value>
- struct result_detail<This(Cont, Value), void>
- {
- typedef typename remove_reference<Cont>::type cont_type;
- typedef typename remove_reference<Value>::type value_type;
- static cont_type &scont_;
- static value_type &svalue_;
- typedef char yes_type;
- typedef char (&no_type)[2];
- static yes_type check_insert_return(typename cont_type::iterator);
- static no_type check_insert_return(std::pair<typename cont_type::iterator, bool>);
- BOOST_STATIC_CONSTANT(bool, is_iterator = (sizeof(yes_type) == sizeof(check_insert_return(scont_.insert(svalue_)))));
- typedef
- typename mpl::if_c<
- is_iterator
- , typename cont_type::iterator
- , std::pair<typename cont_type::iterator, bool>
- >::type
- type;
- };
-
- template<typename This, typename Cont, typename It, typename Value>
- struct result_detail<This(Cont, It, Value),
- typename disable_if<
- mpl::or_<
- is_integral<typename remove_cv<typename remove_reference<It>::type>::type>
- , is_same<
- typename remove_cv<typename remove_reference<It>::type>::type
- , typename remove_cv<typename remove_reference<Value>::type>::type
- >
- >
- >::type
- >
- {
- typedef typename remove_reference<Cont>::type::iterator type;
- };
-
- template<typename This, typename Cont, typename Size, typename T>
- struct result_detail<This(Cont, Size, T),
- typename enable_if<
- is_integral<typename remove_cv<typename remove_reference<Size>::type>::type>
- >::type
- >
- {
- typedef typename remove_reference<Cont>::type &type;
- };
-
- template<typename This, typename Cont, typename It>
- struct result_detail<This(Cont, It, It), void>
- {
- typedef void type;
- };
-
- template<typename This, typename Cont, typename It, typename Size, typename Value>
- struct result_detail<This(Cont, It, Size, Value),
- typename disable_if<
- is_integral<typename remove_cv<typename remove_reference<It>::type>::type>
- >::type
- >
- {
- typedef void type;
- };
-
- template<typename This, typename Cont, typename Size, typename A0, typename A1>
- struct result_detail<This(Cont, Size, A0, A1),
- typename enable_if<
- is_integral<typename remove_cv<typename remove_reference<Size>::type>::type>
- >::type
- >
- {
- typedef typename remove_reference<Cont>::type &type;
- };
-
- template<typename This, typename Cont, typename Pos0, typename String, typename Pos1, typename Length>
- struct result_detail<This(Cont, Pos0, String, Pos1, Length)>
- {
- typedef typename remove_reference<Cont>::type &type;
- };
- };
- template<typename Sig>
- struct result
- {
- typedef typename detail::result_detail<Sig>::type type;
- };
-
-
- template<typename Cont, typename A0>
- typename result<insert(Cont &, A0 const &)>::type
- operator()(Cont &cont, A0 const &a0) const
- {
- return cont.insert(a0);
- }
-
-
- template<typename Cont, typename A0, typename A1>
- typename result<insert(Cont &, A0 const &, A1 const &)>::type
- operator()(Cont &cont, A0 const &a0, A1 const &a1) const
- {
- return cont.insert(a0, a1);
- }
-
-
- template<typename Cont, typename A0, typename A1, typename A2>
- typename result<insert(Cont &, A0 const &, A1 const &, A2 const &)>::type
- operator()(Cont &cont, A0 const &a0, A1 const &a1, A2 const &a2) const
- {
- return cont.insert(a0, a1, a2);
- }
-
-
-
-
-
-
-
-
-
- template<typename Cont, typename A0, typename A1, typename A2, typename A3>
- typename result<insert(Cont &, A0 const &, A1 const &, A2 const &, A3 const &)>::type
- operator()(Cont &cont, A0 const &a0, A1 const &a1, A2 const &a2, A3 const &a3) const
- {
- return cont.insert(a0, a1, a2, a3);
- }
- };
-
- struct make_pair
- {
- BOOST_PROTO_CALLABLE()
- template<typename Sig>
- struct result {};
- template<typename This, typename First, typename Second>
- struct result<This(First, Second)>
- {
-
- typedef typename decay<First>::type first_type;
-
- typedef typename decay<Second>::type second_type;
- typedef std::pair<first_type, second_type> type;
- };
-
-
-
- template<typename First, typename Second>
- std::pair<First, Second> operator()(First const &first, Second const &second) const
- {
- return std::make_pair(first, second);
- }
- };
-
-
- template<typename T>
- struct as
- {
- BOOST_PROTO_CALLABLE()
- typedef T result_type;
-
-
- template<typename Value>
- T operator()(Value const &val) const
- {
- return boost::lexical_cast<T>(val);
- }
-
-
- T operator()(csub_match const &val) const
- {
- return val.matched
- ? boost::lexical_cast<T>(boost::make_iterator_range(val.first, val.second))
- : boost::lexical_cast<T>("");
- }
- #ifndef BOOST_XPRESSIVE_NO_WREGEX
-
- T operator()(wcsub_match const &val) const
- {
- return val.matched
- ? boost::lexical_cast<T>(boost::make_iterator_range(val.first, val.second))
- : boost::lexical_cast<T>("");
- }
- #endif
-
- template<typename BidiIter>
- T operator()(sub_match<BidiIter> const &val) const
- {
-
-
- typedef typename iterator_value<BidiIter>::type char_type;
- BOOST_MPL_ASSERT_MSG(
- (xpressive::detail::is_char<char_type>::value)
- , CAN_ONLY_CONVERT_FROM_CHARACTER_SEQUENCES
- , (char_type)
- );
- return this->impl(val, xpressive::detail::is_string_iterator<BidiIter>());
- }
- private:
-
- template<typename RandIter>
- T impl(sub_match<RandIter> const &val, mpl::true_) const
- {
- return val.matched
- ? boost::lexical_cast<T>(boost::make_iterator_range(&*val.first, &*val.first + (val.second - val.first)))
- : boost::lexical_cast<T>("");
- }
-
- template<typename BidiIter>
- T impl(sub_match<BidiIter> const &val, mpl::false_) const
- {
- return boost::lexical_cast<T>(val.str());
- }
- };
-
-
- template<typename T>
- struct static_cast_
- {
- BOOST_PROTO_CALLABLE()
- typedef T result_type;
-
-
- template<typename Value>
- T operator()(Value const &val) const
- {
- return static_cast<T>(val);
- }
- };
-
-
- template<typename T>
- struct dynamic_cast_
- {
- BOOST_PROTO_CALLABLE()
- typedef T result_type;
-
-
- template<typename Value>
- T operator()(Value const &val) const
- {
- return dynamic_cast<T>(val);
- }
- };
-
-
- template<typename T>
- struct const_cast_
- {
- BOOST_PROTO_CALLABLE()
- typedef T result_type;
-
-
-
- template<typename Value>
- T operator()(Value const &val) const
- {
- return const_cast<T>(val);
- }
- };
-
-
- template<typename T>
- struct construct
- {
- BOOST_PROTO_CALLABLE()
- typedef T result_type;
-
- T operator()() const
- {
- return T();
- }
-
- template<typename A0>
- T operator()(A0 const &a0) const
- {
- return T(a0);
- }
-
- template<typename A0, typename A1>
- T operator()(A0 const &a0, A1 const &a1) const
- {
- return T(a0, a1);
- }
-
-
-
-
- template<typename A0, typename A1, typename A2>
- T operator()(A0 const &a0, A1 const &a1, A2 const &a2) const
- {
- return T(a0, a1, a2);
- }
- };
-
-
- template<typename Except>
- struct throw_
- {
- BOOST_PROTO_CALLABLE()
- typedef void result_type;
-
- void operator()() const
- {
- BOOST_THROW_EXCEPTION(Except());
- }
-
- template<typename A0>
- void operator()(A0 const &a0) const
- {
- BOOST_THROW_EXCEPTION(Except(a0));
- }
-
- template<typename A0, typename A1>
- void operator()(A0 const &a0, A1 const &a1) const
- {
- BOOST_THROW_EXCEPTION(Except(a0, a1));
- }
-
-
-
-
-
-
-
- template<typename A0, typename A1, typename A2>
- void operator()(A0 const &a0, A1 const &a1, A2 const &a2) const
- {
- BOOST_THROW_EXCEPTION(Except(a0, a1, a2));
- }
- };
-
- struct unwrap_reference
- {
- BOOST_PROTO_CALLABLE()
- template<typename Sig>
- struct result {};
- template<typename This, typename Ref>
- struct result<This(Ref)>
- {
- typedef typename boost::unwrap_reference<Ref>::type &type;
- };
- template<typename This, typename Ref>
- struct result<This(Ref &)>
- {
- typedef typename boost::unwrap_reference<Ref>::type &type;
- };
-
-
- template<typename T>
- T &operator()(boost::reference_wrapper<T> r) const
- {
- return static_cast<T &>(r);
- }
- };
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- template<typename PolymorphicFunctionObject>
- struct function
- {
- typedef typename proto::terminal<PolymorphicFunctionObject>::type type;
- };
-
-
- function<op::at>::type const at = {{}};
-
-
- function<op::push>::type const push = {{}};
-
-
- function<op::push_back>::type const push_back = {{}};
-
-
- function<op::push_front>::type const push_front = {{}};
-
-
- function<op::pop>::type const pop = {{}};
-
-
- function<op::pop_back>::type const pop_back = {{}};
-
-
- function<op::pop_front>::type const pop_front = {{}};
-
-
- function<op::top>::type const top = {{}};
-
-
- function<op::back>::type const back = {{}};
-
-
- function<op::front>::type const front = {{}};
-
-
- function<op::first>::type const first = {{}};
-
-
- function<op::second>::type const second = {{}};
-
-
- function<op::matched>::type const matched = {{}};
-
-
- function<op::length>::type const length = {{}};
-
-
- function<op::str>::type const str = {{}};
-
-
- function<op::insert>::type const insert = {{}};
-
-
- function<op::make_pair>::type const make_pair = {{}};
-
-
- function<op::unwrap_reference>::type const unwrap_reference = {{}};
-
-
-
-
-
-
-
-
-
-
- template<typename T>
- struct value
- : proto::extends<typename proto::terminal<T>::type, value<T> >
- {
-
- typedef proto::extends<typename proto::terminal<T>::type, value<T> > base_type;
-
- value()
- : base_type()
- {}
-
-
- explicit value(T const &t)
- : base_type(base_type::proto_base_expr::make(t))
- {}
- using base_type::operator=;
-
- T &get()
- {
- return proto::value(*this);
- }
-
- T const &get() const
- {
- return proto::value(*this);
- }
- };
-
-
-
-
-
-
-
-
-
- template<typename T>
- struct reference
- : proto::extends<typename proto::terminal<reference_wrapper<T> >::type, reference<T> >
- {
-
- typedef proto::extends<typename proto::terminal<reference_wrapper<T> >::type, reference<T> > base_type;
-
-
- explicit reference(T &t)
- : base_type(base_type::proto_base_expr::make(boost::ref(t)))
- {}
- using base_type::operator=;
-
- T &get() const
- {
- return proto::value(*this).get();
- }
- };
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- template<typename T>
- struct local
- : detail::value_wrapper<T>
- , proto::terminal<reference_wrapper<T> >::type
- {
-
- typedef typename proto::terminal<reference_wrapper<T> >::type base_type;
-
- local()
- : detail::value_wrapper<T>()
- , base_type(base_type::make(boost::ref(detail::value_wrapper<T>::value)))
- {}
-
-
- explicit local(T const &t)
- : detail::value_wrapper<T>(t)
- , base_type(base_type::make(boost::ref(detail::value_wrapper<T>::value)))
- {}
- using base_type::operator=;
-
- T &get()
- {
- return proto::value(*this);
- }
-
- T const &get() const
- {
- return proto::value(*this);
- }
- };
-
-
-
-
- template<typename T, typename A>
- typename detail::make_function::impl<op::as<T> const, A const &>::result_type const
- as(A const &a)
- {
- return detail::make_function::impl<op::as<T> const, A const &>()((op::as<T>()), a);
- }
-
-
-
-
- template<typename T, typename A>
- typename detail::make_function::impl<op::static_cast_<T> const, A const &>::result_type const
- static_cast_(A const &a)
- {
- return detail::make_function::impl<op::static_cast_<T> const, A const &>()((op::static_cast_<T>()), a);
- }
-
-
-
-
- template<typename T, typename A>
- typename detail::make_function::impl<op::dynamic_cast_<T> const, A const &>::result_type const
- dynamic_cast_(A const &a)
- {
- return detail::make_function::impl<op::dynamic_cast_<T> const, A const &>()((op::dynamic_cast_<T>()), a);
- }
-
-
-
-
- template<typename T, typename A>
- typename detail::make_function::impl<op::const_cast_<T> const, A const &>::result_type const
- const_cast_(A const &a)
- {
- return detail::make_function::impl<op::const_cast_<T> const, A const &>()((op::const_cast_<T>()), a);
- }
-
-
- template<typename T>
- value<T> const val(T const &t)
- {
- return value<T>(t);
- }
-
-
- template<typename T>
- reference<T> const ref(T &t)
- {
- return reference<T>(t);
- }
-
-
-
- template<typename T>
- reference<T const> const cref(T const &t)
- {
- return reference<T const>(t);
- }
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- #ifdef BOOST_XPRESSIVE_DOXYGEN_INVOKED
- template<typename T>
- detail::unspecified check(T const &t);
- #else
- proto::terminal<detail::check_tag>::type const check = {{}};
- #endif
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- #ifdef BOOST_XPRESSIVE_DOXYGEN_INVOKED
- template<typename...ArgBindings>
- detail::unspecified let(ArgBindings const &...args);
- #else
- detail::let_<proto::terminal<detail::let_tag>::type> const let = {{{}}};
- #endif
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- #ifdef BOOST_XPRESSIVE_DOXYGEN_INVOKED
- template<typename T, int I = 0>
- struct placeholder
- {
-
-
-
- detail::unspecified operator=(T &t) const;
-
- detail::unspecified operator=(T const &t) const;
- };
- #else
- template<typename T, int I, typename Dummy>
- struct placeholder
- {
- typedef placeholder<T, I, Dummy> this_type;
- typedef
- typename proto::terminal<detail::action_arg<T, mpl::int_<I> > >::type
- action_arg_type;
- BOOST_PROTO_EXTENDS(action_arg_type, this_type, proto::default_domain)
- };
- #endif
-
-
-
-
-
-
- #ifdef BOOST_XPRESSIVE_DOXYGEN_INVOKED
- template<typename T, typename ...Args>
- detail::unspecified construct(Args const &...args);
- #else
- #define BOOST_PROTO_LOCAL_MACRO(N, typename_A, A_const_ref, A_const_ref_a, a) \
- template<typename X2_0 BOOST_PP_COMMA_IF(N) typename_A(N)> \
- typename detail::make_function::impl< \
- op::construct<X2_0> const \
- BOOST_PP_COMMA_IF(N) A_const_ref(N) \
- >::result_type const \
- construct(A_const_ref_a(N)) \
- { \
- return detail::make_function::impl< \
- op::construct<X2_0> const \
- BOOST_PP_COMMA_IF(N) A_const_ref(N) \
- >()((op::construct<X2_0>()) BOOST_PP_COMMA_IF(N) a(N)); \
- } \
- \
- template<typename X2_0 BOOST_PP_COMMA_IF(N) typename_A(N)> \
- typename detail::make_function::impl< \
- op::throw_<X2_0> const \
- BOOST_PP_COMMA_IF(N) A_const_ref(N) \
- >::result_type const \
- throw_(A_const_ref_a(N)) \
- { \
- return detail::make_function::impl< \
- op::throw_<X2_0> const \
- BOOST_PP_COMMA_IF(N) A_const_ref(N) \
- >()((op::throw_<X2_0>()) BOOST_PP_COMMA_IF(N) a(N)); \
- } \
-
- #define BOOST_PROTO_LOCAL_a BOOST_PROTO_a
- #define BOOST_PROTO_LOCAL_LIMITS (0, BOOST_PP_DEC(BOOST_PROTO_MAX_ARITY))
- #include BOOST_PROTO_LOCAL_ITERATE()
- #endif
- namespace detail
- {
- inline void ignore_unused_regex_actions()
- {
- detail::ignore_unused(xpressive::at);
- detail::ignore_unused(xpressive::push);
- detail::ignore_unused(xpressive::push_back);
- detail::ignore_unused(xpressive::push_front);
- detail::ignore_unused(xpressive::pop);
- detail::ignore_unused(xpressive::pop_back);
- detail::ignore_unused(xpressive::pop_front);
- detail::ignore_unused(xpressive::top);
- detail::ignore_unused(xpressive::back);
- detail::ignore_unused(xpressive::front);
- detail::ignore_unused(xpressive::first);
- detail::ignore_unused(xpressive::second);
- detail::ignore_unused(xpressive::matched);
- detail::ignore_unused(xpressive::length);
- detail::ignore_unused(xpressive::str);
- detail::ignore_unused(xpressive::insert);
- detail::ignore_unused(xpressive::make_pair);
- detail::ignore_unused(xpressive::unwrap_reference);
- detail::ignore_unused(xpressive::check);
- detail::ignore_unused(xpressive::let);
- }
- struct mark_nbr
- {
- BOOST_PROTO_CALLABLE()
- typedef int result_type;
- int operator()(mark_placeholder m) const
- {
- return m.mark_number_;
- }
- };
- struct ReplaceAlgo
- : proto::or_<
- proto::when<
- proto::terminal<mark_placeholder>
- , op::at(proto::_data, proto::call<mark_nbr(proto::_value)>)
- >
- , proto::when<
- proto::terminal<any_matcher>
- , op::at(proto::_data, proto::size_t<0>)
- >
- , proto::when<
- proto::terminal<reference_wrapper<proto::_> >
- , op::unwrap_reference(proto::_value)
- >
- , proto::_default<ReplaceAlgo>
- >
- {};
- }
- }}
- #if BOOST_MSVC
- #pragma warning(pop)
- #endif
- #endif
|