Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_34_1/libs/spirit/test/symbols_find_null.cpp @ 33

Last change on this file since 33 was 29, checked in by landauf, 17 years ago

updated boost from 1_33_1 to 1_34_1

File size: 1.1 KB
Line 
1/*=============================================================================
2    Copyright (c) 2004 Joao Abecasis
3    http://spirit.sourceforge.net/
4
5    Use, modification and distribution is subject to the Boost Software
6    License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
7    http://www.boost.org/LICENSE_1_0.txt)
8=============================================================================*/
9
10#include <boost/spirit/core/scanner/scanner.hpp>
11#include <boost/spirit/symbols/impl/tst.ipp>
12#include <boost/utility/addressof.hpp>
13
14typedef char char_type;
15typedef char const * iterator;
16
17char_type data_[] = "whatever";
18
19iterator begin = data_;
20iterator end = data_
21    + sizeof(data_)/sizeof(char_type); // Yes, this is an intencional bug ;)
22
23int main()
24{
25    typedef boost::spirit::scanner<> scanner;
26    typedef boost::spirit::impl::tst<void *, char_type> symbols;
27
28    symbols symbols_;
29
30    symbols_.add(begin, end - 1, (void*) boost::addressof(symbols_));
31
32    // The symbol table parser should not choke on input containing the null
33    // character.
34    symbols_.find(scanner(begin, end));
35}
Note: See TracBrowser for help on using the repository browser.