transform.hpp 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591
  1. // Copyright (C) 2016-2018 T. Zachary Laine
  2. //
  3. // Distributed under the Boost Software License, Version 1.0. (See
  4. // accompanying file LICENSE_1_0.txt or copy at
  5. // http://www.boost.org/LICENSE_1_0.txt)
  6. #ifndef BOOST_YAP_DETAIL_TRANSFORM_HPP_INCLUDED
  7. #define BOOST_YAP_DETAIL_TRANSFORM_HPP_INCLUDED
  8. #include <boost/yap/algorithm_fwd.hpp>
  9. #include <boost/hana/transform.hpp>
  10. #include <cassert>
  11. namespace boost { namespace yap { namespace detail {
  12. template<int I, typename T, typename... Ts>
  13. struct nth_element_impl
  14. {
  15. using type = typename nth_element_impl<I - 1, Ts...>::type;
  16. };
  17. template<typename T, typename... Ts>
  18. struct nth_element_impl<0, T, Ts...>
  19. {
  20. using type = T;
  21. };
  22. template<int I, typename... Ts>
  23. using nth_element = typename nth_element_impl<I, Ts...>::type;
  24. template<typename T, bool RemoveRefs = std::is_rvalue_reference<T>::value>
  25. struct rvalue_ref_to_value;
  26. template<typename T>
  27. struct rvalue_ref_to_value<T, true>
  28. {
  29. using type = typename std::remove_reference<T>::type;
  30. };
  31. template<typename T>
  32. struct rvalue_ref_to_value<T, false>
  33. {
  34. using type = T;
  35. };
  36. template<typename T>
  37. using rvalue_ref_to_value_t = typename rvalue_ref_to_value<T>::type;
  38. template<bool IsRvalueRef>
  39. struct rvalue_mover
  40. {
  41. template<typename T>
  42. constexpr decltype(auto) operator()(T && t) const
  43. {
  44. return static_cast<T &&>(t);
  45. }
  46. };
  47. template<>
  48. struct rvalue_mover<true>
  49. {
  50. template<typename T>
  51. constexpr std::remove_reference_t<T> operator()(T && t) const
  52. {
  53. return std::move(t);
  54. }
  55. };
  56. template<typename... PlaceholderArgs>
  57. struct placeholder_transform_t
  58. {
  59. using tuple_t = hana::tuple<rvalue_ref_to_value_t<PlaceholderArgs>...>;
  60. constexpr placeholder_transform_t(PlaceholderArgs &&... args) :
  61. placeholder_args_(static_cast<PlaceholderArgs &&>(args)...)
  62. {}
  63. template<long long I>
  64. constexpr decltype(auto)
  65. operator()(expr_tag<expr_kind::terminal>, boost::yap::placeholder<I>) const
  66. {
  67. static_assert(
  68. I <= decltype(hana::size(std::declval<tuple_t>()))::value,
  69. "Out of range placeholder index,");
  70. using nth_type = nth_element<I - 1, PlaceholderArgs...>;
  71. return as_expr<minimal_expr>(
  72. rvalue_mover<!std::is_lvalue_reference<nth_type>::value>{}(
  73. placeholder_args_[hana::llong<I - 1>{}]));
  74. }
  75. tuple_t placeholder_args_;
  76. };
  77. template<typename... PlaceholderArgs>
  78. struct evaluation_transform_t
  79. {
  80. using tuple_t = hana::tuple<rvalue_ref_to_value_t<PlaceholderArgs>...>;
  81. constexpr evaluation_transform_t(PlaceholderArgs &&... args) :
  82. placeholder_args_(static_cast<PlaceholderArgs &&>(args)...)
  83. {}
  84. template<long long I>
  85. constexpr decltype(auto)
  86. operator()(expr_tag<expr_kind::terminal>, boost::yap::placeholder<I>) const
  87. {
  88. static_assert(
  89. I <= decltype(hana::size(std::declval<tuple_t>()))::value,
  90. "Out of range placeholder index,");
  91. using nth_type = nth_element<I - 1, PlaceholderArgs...>;
  92. return rvalue_mover<!std::is_lvalue_reference<nth_type>::value>{}(
  93. placeholder_args_[hana::llong<I - 1>{}]);
  94. }
  95. template<typename T>
  96. constexpr decltype(auto) operator()(expr_tag<expr_kind::terminal>, T && t) const
  97. {
  98. return static_cast<T &&>(t);
  99. }
  100. #define BOOST_YAP_UNARY_OPERATOR_CASE(op, op_name) \
  101. template<typename T> \
  102. constexpr decltype(auto) operator()(expr_tag<expr_kind::op_name>, T && t) const \
  103. { \
  104. return op transform( \
  105. as_expr<minimal_expr>(static_cast<T &&>(t)), *this); \
  106. }
  107. BOOST_YAP_UNARY_OPERATOR_CASE(+, unary_plus)
  108. BOOST_YAP_UNARY_OPERATOR_CASE(-, negate)
  109. BOOST_YAP_UNARY_OPERATOR_CASE(*, dereference)
  110. BOOST_YAP_UNARY_OPERATOR_CASE(~, complement)
  111. BOOST_YAP_UNARY_OPERATOR_CASE(&, address_of)
  112. BOOST_YAP_UNARY_OPERATOR_CASE(!, logical_not)
  113. BOOST_YAP_UNARY_OPERATOR_CASE(++, pre_inc)
  114. BOOST_YAP_UNARY_OPERATOR_CASE(--, pre_dec)
  115. template<typename T>
  116. constexpr decltype(auto) operator()(expr_tag<expr_kind::post_inc>, T && t) const
  117. {
  118. return transform(
  119. as_expr<minimal_expr>(static_cast<T &&>(t)), *this)++;
  120. }
  121. template<typename T>
  122. constexpr decltype(auto) operator()(expr_tag<expr_kind::post_dec>, T && t) const
  123. {
  124. return transform(
  125. as_expr<minimal_expr>(static_cast<T &&>(t)), *this)--;
  126. }
  127. #undef BOOST_YAP_UNARY_OPERATOR_CASE
  128. #define BOOST_YAP_BINARY_OPERATOR_CASE(op, op_name) \
  129. template<typename T, typename U> \
  130. constexpr decltype(auto) operator()(expr_tag<expr_kind::op_name>, T && t, U && u) const \
  131. { \
  132. return transform(as_expr<minimal_expr>(static_cast<T &&>(t)), *this) \
  133. op transform(as_expr<minimal_expr>(static_cast<U &&>(u)), *this); \
  134. }
  135. BOOST_YAP_BINARY_OPERATOR_CASE(<<, shift_left)
  136. BOOST_YAP_BINARY_OPERATOR_CASE(>>, shift_right)
  137. BOOST_YAP_BINARY_OPERATOR_CASE(*, multiplies)
  138. BOOST_YAP_BINARY_OPERATOR_CASE(/, divides)
  139. BOOST_YAP_BINARY_OPERATOR_CASE(%, modulus)
  140. BOOST_YAP_BINARY_OPERATOR_CASE(+, plus)
  141. BOOST_YAP_BINARY_OPERATOR_CASE(-, minus)
  142. BOOST_YAP_BINARY_OPERATOR_CASE(<, less)
  143. BOOST_YAP_BINARY_OPERATOR_CASE(>, greater)
  144. BOOST_YAP_BINARY_OPERATOR_CASE(<=, less_equal)
  145. BOOST_YAP_BINARY_OPERATOR_CASE(>=, greater_equal)
  146. BOOST_YAP_BINARY_OPERATOR_CASE(==, equal_to)
  147. BOOST_YAP_BINARY_OPERATOR_CASE(!=, not_equal_to)
  148. BOOST_YAP_BINARY_OPERATOR_CASE(||, logical_or)
  149. BOOST_YAP_BINARY_OPERATOR_CASE(&&, logical_and)
  150. BOOST_YAP_BINARY_OPERATOR_CASE(&, bitwise_and)
  151. BOOST_YAP_BINARY_OPERATOR_CASE(|, bitwise_or)
  152. BOOST_YAP_BINARY_OPERATOR_CASE (^, bitwise_xor)
  153. // clang-format off
  154. //[ evaluation_transform_comma
  155. template<typename T, typename U>
  156. constexpr decltype(auto) operator()(expr_tag<expr_kind::comma>, T && t, U && u) const
  157. {
  158. return transform(
  159. as_expr<minimal_expr>(static_cast<T &&>(t)), *this),
  160. transform(
  161. as_expr<minimal_expr>(static_cast<U &&>(u)), *this);
  162. }
  163. //]
  164. // clang-format on
  165. BOOST_YAP_BINARY_OPERATOR_CASE(->*, mem_ptr)
  166. BOOST_YAP_BINARY_OPERATOR_CASE(=, assign)
  167. BOOST_YAP_BINARY_OPERATOR_CASE(<<=, shift_left_assign)
  168. BOOST_YAP_BINARY_OPERATOR_CASE(>>=, shift_right_assign)
  169. BOOST_YAP_BINARY_OPERATOR_CASE(*=, multiplies_assign)
  170. BOOST_YAP_BINARY_OPERATOR_CASE(/=, divides_assign)
  171. BOOST_YAP_BINARY_OPERATOR_CASE(%=, modulus_assign)
  172. BOOST_YAP_BINARY_OPERATOR_CASE(+=, plus_assign)
  173. BOOST_YAP_BINARY_OPERATOR_CASE(-=, minus_assign)
  174. BOOST_YAP_BINARY_OPERATOR_CASE(&=, bitwise_and_assign)
  175. BOOST_YAP_BINARY_OPERATOR_CASE(|=, bitwise_or_assign)
  176. BOOST_YAP_BINARY_OPERATOR_CASE(^=, bitwise_xor_assign)
  177. template<typename T, typename U>
  178. constexpr decltype(auto)
  179. operator()(expr_tag<expr_kind::subscript>, T && t, U && u) const
  180. {
  181. return transform(
  182. as_expr<minimal_expr>(static_cast<T &&>(t)), *this)[transform(
  183. as_expr<minimal_expr>(static_cast<U &&>(u)), *this)];
  184. }
  185. #undef BOOST_YAP_BINARY_OPERATOR_CASE
  186. template<typename T, typename U, typename V>
  187. constexpr decltype(auto)
  188. operator()(expr_tag<expr_kind::if_else>, T && t, U && u, V && v) const
  189. {
  190. return transform(as_expr<minimal_expr>(static_cast<T &&>(t)), *this)
  191. ? transform(
  192. as_expr<minimal_expr>(static_cast<U &&>(u)), *this)
  193. : transform(
  194. as_expr<minimal_expr>(static_cast<V &&>(v)),
  195. *this);
  196. }
  197. // clang-format off
  198. //[ evaluation_transform_call
  199. template<typename Callable, typename... Args>
  200. constexpr decltype(auto) operator()(
  201. expr_tag<expr_kind::call>, Callable && callable, Args &&... args) const
  202. {
  203. return transform(as_expr<minimal_expr>(static_cast<Callable &&>(callable)), *this)(
  204. transform(as_expr<minimal_expr>(static_cast<Args &&>(args)), *this)...
  205. );
  206. }
  207. //]
  208. // clang-format on
  209. tuple_t placeholder_args_;
  210. };
  211. template<bool Strict, int I, bool IsExprRef>
  212. struct transform_impl;
  213. template<
  214. bool Strict,
  215. typename Expr,
  216. typename TransformTuple,
  217. int I,
  218. expr_arity Arity,
  219. typename = void_t<>>
  220. struct transform_expression_tag;
  221. // Forward terminals/recurively transform noterminasl; attempted last.
  222. template<bool IsLvalueRef, bool IsTerminal, bool Strict>
  223. struct default_transform
  224. {
  225. template<typename Expr, typename TransformTuple>
  226. constexpr decltype(auto) operator()(Expr && expr, TransformTuple transforms) const
  227. {
  228. return static_cast<Expr &&>(expr);
  229. }
  230. };
  231. template<bool IsLvalueRef, bool IsTerminal>
  232. struct default_transform<IsLvalueRef, IsTerminal, true>
  233. {
  234. struct incomplete;
  235. // If you're getting an error because this function is uncallable,
  236. // that's by design. You called yap::transform_strict(expr, xfrom)
  237. // and one or more subexpression of 'expr' are not callable with any
  238. // overload in 'xform'.
  239. template<typename Expr, typename TransformTuple>
  240. constexpr incomplete operator()(Expr && expr, TransformTuple transforms) const;
  241. };
  242. template<
  243. expr_kind Kind,
  244. template<expr_kind, class> class ExprTemplate,
  245. typename OldTuple,
  246. typename NewTuple>
  247. constexpr auto make_expr_from_tuple(
  248. ExprTemplate<Kind, OldTuple> const & expr, NewTuple && tuple)
  249. {
  250. return ExprTemplate<Kind, NewTuple>{std::move(tuple)};
  251. }
  252. template<expr_kind Kind, typename Expr, typename NewTuple>
  253. constexpr auto make_expr_from_tuple(Expr const & expr, NewTuple && tuple)
  254. {
  255. return minimal_expr<Kind, NewTuple>{std::move(tuple)};
  256. }
  257. template<typename Expr, typename Tuple, typename TransformTuple>
  258. constexpr decltype(auto) transform_nonterminal(
  259. Expr const & expr, Tuple && tuple, TransformTuple transforms)
  260. {
  261. auto transformed_tuple =
  262. hana::transform(static_cast<Tuple &&>(tuple), [&](auto && element) {
  263. using element_t = decltype(element);
  264. auto const kind = remove_cv_ref_t<element_t>::kind;
  265. ::boost::yap::detail::
  266. transform_impl<false, 0, kind == expr_kind::expr_ref>
  267. xform;
  268. return xform(static_cast<element_t &&>(element), transforms);
  269. });
  270. auto const kind = remove_cv_ref_t<Expr>::kind;
  271. return make_expr_from_tuple<kind>(expr, std::move(transformed_tuple));
  272. }
  273. template<>
  274. struct default_transform<true, false, false>
  275. {
  276. template<typename Expr, typename TransformTuple>
  277. constexpr decltype(auto) operator()(Expr && expr, TransformTuple transforms) const
  278. {
  279. return transform_nonterminal(expr, expr.elements, transforms);
  280. }
  281. };
  282. template<>
  283. struct default_transform<false, false, false>
  284. {
  285. template<typename Expr, typename TransformTuple>
  286. constexpr decltype(auto)
  287. operator()(Expr && expr, TransformTuple transforms) const
  288. {
  289. return transform_nonterminal(
  290. expr, std::move(expr.elements), transforms);
  291. }
  292. };
  293. // Dispatch to the next transform, or to the default transform if there is
  294. // no next transform.
  295. template<
  296. bool Strict,
  297. typename Expr,
  298. typename TransformTuple,
  299. int I,
  300. bool NextTransformExists>
  301. struct next_or_default_transform
  302. {
  303. constexpr decltype(auto) operator()(Expr && expr, TransformTuple transforms) const
  304. {
  305. // Use the next transform.
  306. constexpr expr_kind kind = remove_cv_ref_t<Expr>::kind;
  307. return detail::
  308. transform_impl<Strict, I + 1, kind == expr_kind::expr_ref>{}(
  309. static_cast<Expr &&>(expr), transforms);
  310. }
  311. };
  312. template<bool Strict, typename Expr, typename TransformTuple, int I>
  313. struct next_or_default_transform<Strict, Expr, TransformTuple, I, false>
  314. {
  315. constexpr decltype(auto) operator()(Expr && expr, TransformTuple transforms) const
  316. {
  317. // No next transform exists; use the default transform.
  318. constexpr expr_kind kind = remove_cv_ref_t<Expr>::kind;
  319. return default_transform<
  320. std::is_lvalue_reference<Expr>::value,
  321. kind == expr_kind::terminal,
  322. Strict>{}(static_cast<Expr &&>(expr), transforms);
  323. }
  324. };
  325. // Expression-matching; attempted second.
  326. template<
  327. bool Strict,
  328. typename Expr,
  329. typename TransformTuple,
  330. int I,
  331. typename = detail::void_t<>>
  332. struct transform_expression_expr
  333. {
  334. constexpr decltype(auto) operator()(Expr && expr, TransformTuple transforms) const
  335. {
  336. // No expr-matching succeeded; use the next or default transform.
  337. return next_or_default_transform<
  338. Strict,
  339. Expr,
  340. TransformTuple,
  341. I,
  342. I + 1 < decltype(hana::size(
  343. std::declval<TransformTuple>()))::value>{}(
  344. static_cast<Expr &&>(expr), transforms);
  345. }
  346. };
  347. template<bool Strict, typename Expr, typename TransformTuple, int I>
  348. struct transform_expression_expr<
  349. Strict,
  350. Expr,
  351. TransformTuple,
  352. I,
  353. void_t<decltype((*std::declval<TransformTuple>()[hana::llong<I>{}])(
  354. std::declval<Expr>()))>>
  355. {
  356. constexpr decltype(auto) operator()(Expr && expr, TransformTuple transforms) const
  357. {
  358. return (*transforms[hana::llong<I>{}])(static_cast<Expr &&>(expr));
  359. }
  360. };
  361. // Tag-matching; attempted first.
  362. template<
  363. bool Strict,
  364. typename Expr,
  365. typename TransformTuple,
  366. int I,
  367. expr_arity Arity,
  368. typename>
  369. struct transform_expression_tag
  370. {
  371. constexpr decltype(auto) operator()(Expr && expr, TransformTuple transforms) const
  372. {
  373. // No tag-matching succeeded; try expr-matching.
  374. return transform_expression_expr<Strict, Expr, TransformTuple, I>{}(
  375. static_cast<Expr &&>(expr), transforms);
  376. }
  377. };
  378. template<typename T>
  379. constexpr decltype(auto) terminal_value(T && x)
  380. {
  381. return value_impl<true>(static_cast<T &&>(x));
  382. }
  383. template<bool Strict, typename Expr, typename TransformTuple, int I>
  384. struct transform_expression_tag<
  385. Strict,
  386. Expr,
  387. TransformTuple,
  388. I,
  389. expr_arity::one,
  390. void_t<decltype((*std::declval<TransformTuple>()[hana::llong<I>{}])(
  391. expr_tag<remove_cv_ref_t<Expr>::kind>{},
  392. terminal_value(::boost::yap::value(std::declval<Expr>()))))>>
  393. {
  394. constexpr decltype(auto) operator()(Expr && expr, TransformTuple transforms) const
  395. {
  396. return (*transforms[hana::llong<I>{}])(
  397. expr_tag<remove_cv_ref_t<Expr>::kind>{},
  398. terminal_value(
  399. ::boost::yap::value(static_cast<Expr &&>(expr))));
  400. }
  401. };
  402. template<bool Strict, typename Expr, typename TransformTuple, int I>
  403. struct transform_expression_tag<
  404. Strict,
  405. Expr,
  406. TransformTuple,
  407. I,
  408. expr_arity::two,
  409. void_t<decltype((*std::declval<TransformTuple>()[hana::llong<I>{}])(
  410. expr_tag<remove_cv_ref_t<Expr>::kind>{},
  411. terminal_value(::boost::yap::left(std::declval<Expr>())),
  412. terminal_value(::boost::yap::right(std::declval<Expr>()))))>>
  413. {
  414. constexpr decltype(auto) operator()(Expr && expr, TransformTuple transforms) const
  415. {
  416. return (*transforms[hana::llong<I>{}])(
  417. expr_tag<remove_cv_ref_t<Expr>::kind>{},
  418. terminal_value(::boost::yap::left(static_cast<Expr &&>(expr))),
  419. terminal_value(
  420. ::boost::yap::right(static_cast<Expr &&>(expr))));
  421. }
  422. };
  423. template<bool Strict, typename Expr, typename TransformTuple, int I>
  424. struct transform_expression_tag<
  425. Strict,
  426. Expr,
  427. TransformTuple,
  428. I,
  429. expr_arity::three,
  430. void_t<decltype((*std::declval<TransformTuple>()[hana::llong<I>{}])(
  431. expr_tag<remove_cv_ref_t<Expr>::kind>{},
  432. terminal_value(::boost::yap::cond(std::declval<Expr>())),
  433. terminal_value(::boost::yap::then(std::declval<Expr>())),
  434. terminal_value(::boost::yap::else_(std::declval<Expr>()))))>>
  435. {
  436. constexpr decltype(auto) operator()(Expr && expr, TransformTuple transforms) const
  437. {
  438. return (*transforms[hana::llong<I>{}])(
  439. expr_tag<remove_cv_ref_t<Expr>::kind>{},
  440. terminal_value(::boost::yap::cond(static_cast<Expr &&>(expr))),
  441. terminal_value(::boost::yap::then(static_cast<Expr &&>(expr))),
  442. terminal_value(
  443. ::boost::yap::else_(static_cast<Expr &&>(expr))));
  444. }
  445. };
  446. template<typename Expr, typename Transform>
  447. struct transform_call_unpacker
  448. {
  449. template<long long... I>
  450. constexpr auto operator()(
  451. Expr && expr,
  452. Transform & transform,
  453. std::integer_sequence<long long, I...>) const
  454. -> decltype(transform(
  455. expr_tag<expr_kind::call>{},
  456. terminal_value(::boost::yap::get(
  457. static_cast<Expr &&>(expr), hana::llong_c<I>))...))
  458. {
  459. return transform(
  460. expr_tag<expr_kind::call>{},
  461. terminal_value(::boost::yap::get(
  462. static_cast<Expr &&>(expr), hana::llong_c<I>))...);
  463. }
  464. };
  465. template<typename Expr>
  466. constexpr auto indices_for(Expr const & expr)
  467. {
  468. constexpr long long size = decltype(hana::size(expr.elements))::value;
  469. return std::make_integer_sequence<long long, size>();
  470. }
  471. template<bool Strict, typename Expr, typename TransformTuple, int I>
  472. struct transform_expression_tag<
  473. Strict,
  474. Expr,
  475. TransformTuple,
  476. I,
  477. expr_arity::n,
  478. void_t<decltype(
  479. transform_call_unpacker<
  480. Expr,
  481. decltype(*std::declval<TransformTuple>()[hana::llong<I>{}])>{}(
  482. std::declval<Expr>(),
  483. *std::declval<TransformTuple>()[hana::llong<I>{}],
  484. indices_for(std::declval<Expr>())))>>
  485. {
  486. constexpr decltype(auto) operator()(Expr && expr, TransformTuple transforms) const
  487. {
  488. using transform_t = decltype(*transforms[hana::llong<I>{}]);
  489. return transform_call_unpacker<Expr, transform_t>{}(
  490. static_cast<Expr &&>(expr),
  491. *transforms[hana::llong<I>{}],
  492. indices_for(expr));
  493. }
  494. };
  495. template<bool Strict, int I, bool IsExprRef>
  496. struct transform_impl
  497. {
  498. template<typename Expr, typename TransformTuple>
  499. constexpr decltype(auto) operator()(Expr && expr, TransformTuple transforms) const
  500. {
  501. constexpr expr_kind kind = detail::remove_cv_ref_t<Expr>::kind;
  502. return detail::transform_expression_tag<
  503. Strict,
  504. Expr,
  505. TransformTuple,
  506. I,
  507. detail::arity_of<kind>()>{}(
  508. static_cast<Expr &&>(expr), transforms);
  509. }
  510. };
  511. template<bool Strict, int I>
  512. struct transform_impl<Strict, I, true>
  513. {
  514. template<typename Expr, typename TransformTuple>
  515. constexpr decltype(auto) operator()(Expr && expr, TransformTuple transforms) const
  516. {
  517. return detail::transform_impl<Strict, I, false>{}(
  518. ::boost::yap::deref(static_cast<Expr &&>(expr)), transforms);
  519. }
  520. };
  521. }}}
  522. #endif