
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On 4/2/2011 8:23 AM, JĂșlio Hoffimann wrote: <snip>
As far as i know, Boost.Xpressive treats only std::string and C-like strings.
Not so. Both Boost.Xpressive and Boost.Regex work on bidirectional iterator.
What i need to do for work with text files? Put them inside a std::string?
That's one way. A more efficient way would be to memory-map the file, which I think you can do portably using Boost.Interprocess. That should give you a random-access iterator to the source file.
About the performance, the files has approximately 10^3 lines, the search and replace will be an issue?
You should use the version of regex_replace that takes an output iterator, and either write into a string or vector. They both grow their capacity exponentially (or should if your STL implementation is worth anything), so this is quite efficient. Or, with an ofstream iterator, you can write directly to a temporary output file. I think the latest version of Boost.Filesystem has a portable way to create temporary files. Then you can do whatever you want with the temp file. HTH, - -- Eric Niebler BoostPro Computing http://www.boostpro.com -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.9 (MingW32) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/ iQEcBAEBAgAGBQJNlsyRAAoJEAeJsEDfjLbXQKEH/R/UFdXez0Nxp11nRqDuItUc OjlI0cbWJhS+vvKDmGhFbRAGLLUdaQ+8rrmEtuPhbyKv3khjlVklgtbQlMoC9bu+ RZrNgzVm2Ro1QcHG23NWsYky1NVuiaNXXHLB9kf05ibInzyVTvq3yewnBoXzMQ5o ynGFsSmbp+STAuESl/hUM+6yirqQHLXfuidBpXVFyTh/9TsL8FVYnsbrzxNrxwQB uhUYXCgPCxXC9MquxdH1MKNUcL1k9DQr7YGcZpHn6j+tsKHijEsfzn0Yy1KyMEIH Ljnx8dCszZrWobXUqjBVxMuK2m9ptbZeJfLfi/I6g9a5seoaPAdjIBl5zXo8qko= =t0HL -----END PGP SIGNATURE-----