Карта сайта Kansoftware
НОВОСТИУСЛУГИРЕШЕНИЯКОНТАКТЫ
Разработка программного обеспечения

Struct template reverse_fold_tree

Boost , The Boost C++ Libraries BoostBook Documentation Subset , Reference

Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

PrevUpHomeNext

Struct template reverse_fold_tree

boost::proto::reverse_fold_tree — A PrimitiveTransform that recursively applies the proto::reverse_fold<> transform to sub-trees that all share a common tag type.

Synopsis

// In header: <boost/proto/transform/fold_tree.hpp>
template<typename Sequence, typename State0, typename Fun> 
struct reverse_fold_tree :
   proto::transform< reverse_fold_tree<Sequence, State0, Fun> >
{
  // member classes/structs/unions
  template<typename Expr, typename State, typename Data> 
  struct impl :  
    proto::reverse_fold<Sequence, State0, recurse_if_<typename Expr::proto_tag, Fun> >
      ::template impl<Expr, State, Data>
  {
  };
};

Description

<proto::reverse_fold_tree<>>полезно для сплющивания деревьев в списки; например, вы можете использовать<proto::reverse_fold_tree<>>для сплющивания дерева выражения, такого как<a | b | c>, в список слияния, такой как<cons(a, cons(b, cons(c)))>.

<proto::reverse_fold_tree<>>легко понять в терминах<recurse_if_<>>помощника, определяемого следующим образом:

 template<typename Tag, typename Fun>
struct recurse_if_ :
  proto::if_<
    // If the current node has type type "Tag" ...
    boost::is_same<proto::tag_of<proto::_>, Tag>(),
    // ... recurse, otherwise ...
    proto::reverse_fold<proto::_, proto::_state, recurse_if_<Tag, Fun> >,
    // ... apply the Fun transform.
    Fun
  >
{};

<recurse_if_<>>, как определено выше,<proto::reverse_fold_tree<Sequence, State0, Fun>()(expr, state, data)>эквивалентно:

proto::reverse_fold<
  Sequence,
  State0,
  recurse_if_<typename Expr::proto_tag, Fun>
>()(expr, state, data).

Он имеет эффект складывания дерева спереди, повторяясь в детские узлы, которые разделяют тип тега с родительским узлом.


PrevUpHomeNext

Статья Struct template reverse_fold_tree раздела The Boost C++ Libraries BoostBook Documentation Subset Reference может быть полезна для разработчиков на c++ и boost.




Материалы статей собраны из открытых источников, владелец сайта не претендует на авторство. Там где авторство установить не удалось, материал подаётся без имени автора. В случае если Вы считаете, что Ваши права нарушены, пожалуйста, свяжитесь с владельцем сайта.



:: Главная :: Reference ::


реклама


©KANSoftWare (разработка программного обеспечения, создание программ, создание интерактивных сайтов), 2007
Top.Mail.Ru

Время компиляции файла: 2024-08-30 11:47:00
2025-05-20 05:54:43/0.0057659149169922/0