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

sequences.html

Boost , ,

Sequences

A sequence (abbreviated to seq) is a group of adjacent parenthesized elements. For example,
(a)(b)(c)
...is a seq of 3 elements--a, b, and c.
Sequences are data structures that merge the properties of both lists and tuples with the exception that a seq, like a tuple, cannot be empty.  Therefore, an "empty" seq is considered a special case scenario that must be handled separately in C++.
#define SEQ (x)(y)(z)
#define REVERSE(s, state, elem) (elem) state
   // append to head                  ^
BOOST_PP_SEQ_FOLD_LEFT(REVERSE, BOOST_PP_EMPTY, SEQ)()
   //                           #1                  #2
   // 1) placeholder for "empty" seq
   // 2) remove placeholder
#define SEQ_B (1)(2)(3)
#define INC(s, state, elem) state (BOOST_PP_INC(elem))
   // append to tail             ^
BOOST_PP_SEQ_FOLD_RIGHT(INC, BOOST_PP_SEQ_NIL, SEQ)
   //                        ^
   // special placeholder that will be "eaten"
   // by appending to the tail
Sequences are extremely efficient.  Element access speed approaches random access--even with seqs of up to 256 elements.  This is because element access (among other things) is implemented iteratively rather than recursively.  Therefore, elements can be accessed at extremely high indices even on preprocessors with low maximum expansion depths.
Elements of a seq can be extracted with BOOST_PP_SEQ_ELEM.

Primitives


© Copyright Housemarque Oy 2002
© Copyright Paul Mensonides 2002

Распространяется в соответствии с Лицензией на программное обеспечение Boost, версия 1.0. (См. сопроводительный файл)LICENSE_1_0.txtили копия наwww.boost.org/LICENSE_1_0.txt

Статья sequences.html раздела может быть полезна для разработчиков на c++ и boost.




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



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


реклама


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

Время компиляции файла: 2024-08-30 11:47:00
2025-07-05 14:32:55/0.011229038238525/0