/*============================================================================= Copyright (c) 2004 Hartmut Kaiser 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 is a compile only test for verifying, whether the multi_pass<> // iterator works ok with an input iterator, which returns a value_type and not // a reference from its dereferencing operator. #include #include #include #include #include using namespace BOOST_SPIRIT_CLASSIC_NS; using namespace std; int main () { // create a sample file { ofstream out("./input_file.txt"); out << 1.0 << "," << 2.0; } int result = 0; // read in the values from the sample file { ifstream in("./input_file.txt"); // we get our input from this file typedef char char_t; typedef multi_pass > iterator_t; typedef skip_parser_iteration_policy it_policy_t; typedef scanner_policies scan_policies_t; typedef scanner scanner_t; typedef rule rule_t; it_policy_t iter_policy(space_p); scan_policies_t policies(iter_policy); iterator_t first(make_multi_pass(std::istreambuf_iterator(in))); scanner_t scan(first, make_multi_pass(std::istreambuf_iterator()), policies); rule_t n_list = real_p >> *(',' >> real_p); match<> m = n_list.parse(scan); result = !m ? 1 : 0; } std::remove("./input_file.txt"); return result; }