Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r72064 - in branches/release: . libs libs/wave libs/wave/samples/cpp_tokens
From: hartmut.kaiser_at_[hidden]
Date: 2011-05-21 16:29:01


Author: hkaiser
Date: 2011-05-21 16:29:00 EDT (Sat, 21 May 2011)
New Revision: 72064
URL: http://svn.boost.org/trac/boost/changeset/72064

Log:
Wave: merging from trunk
Properties modified:
   branches/release/ (props changed)
   branches/release/libs/ (props changed)
   branches/release/libs/wave/ (props changed)
Text files modified:
   branches/release/libs/wave/ChangeLog | 1 +
   branches/release/libs/wave/samples/cpp_tokens/cpp_tokens.cpp | 16 ++++++++++------
   2 files changed, 11 insertions(+), 6 deletions(-)

Modified: branches/release/libs/wave/ChangeLog
==============================================================================
--- branches/release/libs/wave/ChangeLog (original)
+++ branches/release/libs/wave/ChangeLog 2011-05-21 16:29:00 EDT (Sat, 21 May 2011)
@@ -35,6 +35,7 @@
   but also removes this macro from consideration for Wave itself. This can
   cause unexpected results if the suppressed macro would influence #ifdef's
   later on.
+- Fixed problem #5554: wave slex parser eof without eol skips the last line.
 
 Boost V1.46.0
 - V2.2.0

Modified: branches/release/libs/wave/samples/cpp_tokens/cpp_tokens.cpp
==============================================================================
--- branches/release/libs/wave/samples/cpp_tokens/cpp_tokens.cpp (original)
+++ branches/release/libs/wave/samples/cpp_tokens/cpp_tokens.cpp 2011-05-21 16:29:00 EDT (Sat, 21 May 2011)
@@ -52,16 +52,20 @@
         return 1;
     }
 
-// read the file to analyse into a std::string
+// read the file to analyse into a std::string
     ifstream infile(argv[1]);
     string teststr;
     if (infile.is_open()) {
         infile.unsetf(std::ios::skipws);
- string line;
- for (getline(infile, line); infile.good(); getline(infile, line)) {
- teststr += line;
- teststr += '\n';
- }
+#if defined(BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS)
+ // this is known to be very slow for large files on some systems
+ copy (std::istream_iterator<char>(infile),
+ std::istream_iterator<char>(),
+ std::inserter(teststr, teststr.end()));
+#else
+ teststr = std::string(std::istreambuf_iterator<char>(infile.rdbuf()),
+ std::istreambuf_iterator<char>());
+#endif
     }
     else {
         teststr = argv[1];


Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk