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

libs/spirit/classic/example/fundamental/no_actions.cpp

Boost , ,

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

libs/spirit/classic/example/fundamental/no_actions.cpp

/*=============================================================================
    Copyright (c) 2003 Vaclav Vesely
    http://spirit.sourceforge.net/
    Use, modification and distribution is subject to the Boost Software
    License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
    http://www.boost.org/LICENSE_1_0.txt)
=============================================================================*/
//
//  This example demonstrates no_actions_d directive.
//
//  The no_actions_d directive ensures, that semantic actions of the inner
//  parser would NOT be invoked. See the no_actions_scanner in the Scanner
//  and Parsing chapter in the User's Guide.
//
//-----------------------------------------------------------------------------
#include <boost/assert.hpp>
#include <iostream>
#include <boost/cstdlib.hpp>
#include <boost/spirit/include/classic_core.hpp>
using namespace std;
using namespace boost;
using namespace BOOST_SPIRIT_CLASSIC_NS;
//-----------------------------------------------------------------------------
int main()
{
    // To use the rule in the no_action_d directive we must declare it with
    // the no_actions_scanner scanner
    rule<no_actions_scanner<>::type> r;
    int i(0);
    // r is the rule with the semantic action
    r = int_p[assign_a(i)];
    parse_info<> info = parse(
        "1",
        no_actions_d
        [
            r
        ]
    );
    BOOST_ASSERT(info.full);
    // Check, that the action hasn't been invoked
    BOOST_ASSERT(i == 0);
    return exit_success;
}
//-----------------------------------------------------------------------------

Статья libs/spirit/classic/example/fundamental/no_actions.cpp раздела может быть полезна для разработчиков на c++ и boost.




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



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


реклама


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

Время компиляции файла: 2024-08-30 11:47:00
2025-05-20 06:44:20/0.0073800086975098/1