Skip to content

Commit 4094371

Browse files
committed
Use LAZY mode for files
1 parent d80f160 commit 4094371

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

include/tao/json/sax/parse_file.hpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
#ifndef TAOCPP_JSON_INCLUDE_SAX_PARSE_FILE_HPP
55
#define TAOCPP_JSON_INCLUDE_SAX_PARSE_FILE_HPP
66

7+
#include <utility>
8+
79
#include "../internal/action.hpp"
810
#include "../internal/control.hpp"
911
#include "../internal/grammar.hpp"
@@ -17,11 +19,11 @@ namespace tao
1719
namespace sax
1820
{
1921
// SAX producer to parse a file containing a JSON string representation
20-
template< typename Consumer >
21-
void parse_file( const std::string& filename, Consumer& consumer )
22+
template< typename T, typename Consumer >
23+
void parse_file( T&& filename, Consumer& consumer )
2224
{
23-
json_pegtl::file_input<> input( filename );
24-
json_pegtl::parse< internal::grammar, internal::action, internal::control >( input, consumer );
25+
json_pegtl::file_input< json_pegtl::tracking_mode::LAZY > in( std::forward< T >( filename ) );
26+
json_pegtl::parse< internal::grammar, internal::action, internal::control >( in, consumer );
2527
}
2628

2729
} // sax

0 commit comments

Comments
 (0)