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

This is the documentation for an old version of Boost. Click here to view this page for the latest version.

Struct once_block_flag

boost::log::once_block_flag — A flag to detect if a code block has already been executed.


// In header: <boost/log/utility/once_block.hpp>

struct once_block_flag {


This structure should be used in conjunction with the BOOST_LOG_ONCE_BLOCK_FLAG macro. Usage example:

once_block_flag flag = BOOST_LOG_ONCE_BLOCK_INIT;

void foo() { BOOST_LOG_ONCE_BLOCK_FLAG(flag) { puts("Hello, world once!"); } }