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

Click here to view the latest version of this page.
PrevUpHomeNext

Algorithm Tuning

The following option applies only if BOOST_REGEX_RECURSIVE is set.

macro

description

BOOST_REGEX_HAS_MS_STACK_GUARD

Tells Boost.Regex that Microsoft style __try - __except blocks are supported, and can be used to safely trap stack overflow.

The following options apply only if BOOST_REGEX_NON_RECURSIVE is set.

macro

description

BOOST_REGEX_BLOCKSIZE

In non-recursive mode, Boost.Regex uses largish blocks of memory to act as a stack for the state machine, the larger the block size then the fewer allocations that will take place. This defaults to 4096 bytes, which is large enough to match the vast majority of regular expressions without further allocations, however, you can choose smaller or larger values depending upon your platforms characteristics.

BOOST_REGEX_MAX_BLOCKS

Tells Boost.Regex how many blocks of size BOOST_REGEX_BLOCKSIZE it is permitted to use. If this value is exceeded then Boost.Regex will stop trying to find a match and throw a std::runtime_error. Defaults to 1024, don't forget to tweek this value if you alter BOOST_REGEX_BLOCKSIZE by much.

BOOST_REGEX_MAX_CACHE_BLOCKS

Tells Boost.Regex how many memory blocks to store in it's internal cache - memory blocks are taken from this cache rather than by calling ::operator new. Generally speeking this can be an order of magnitude faster than calling ::opertator new each time a memory block is required, but has the downside that Boost.Regex can end up caching a large chunk of memory (by default up to 16 blocks each of BOOST_REGEX_BLOCKSIZE size). If memory is tight then try defining this to 0 (disables all caching), or if that is too slow, then a value of 1 or 2, may be sufficient. On the other hand, on large multi-processor, multi-threaded systems, you may find that a higher value is in order.


PrevUpHomeNext