-----Original Message----- From: Boost [mailto:boost-bounces@lists.boost.org] On Behalf Of Indiana Sent: 27 September 2014 22:22 To: boost@lists.boost.org Subject: [boost] [Range] New I/O functions for ranges
I'm currently putting together a proposal to the standards committee about a set of range I/O functions, but i think they would make a good addition to Boost as well. They would probably fit in the Range library - i don't think they warrant a library all of their own.
The stuff i wrote for the standards proposal is available at http://cpp.indi.frih.net/rangeio/ - it goes into quite a bit of detail about the interface, and links to a sample implementation. But here's the executive summary:
There is a single output function - currently called "write_all" - that takes a range and, optionally, a delimiter, like this:
<snip> Though I haven't studied it in detail it is interesting and undoubtedly useful. It is certainly absurdly difficult to output containers in C++ (and something that must put lots of people off using it). I suspect the trouble is that people can't agree on what is needed because there are so many possible options. I wonder if you have studied the examples of Steven Watanbe's type erasure library? http://www.boost.org/doc/libs/1_55_0/doc/html/boost_typeerasure.html I found this useful, but it didn't cover all the options that I wanted, so I added a prefix string and a suffix string to the existing delimiter string. I would urge you to consider this as it increases the possible use-cases covered considerably. In particular, it is seems desirable to be able to output values in the C++ syntax for the compiler to read back in? For your amusement, I attached some of hoops that I made 'printers' derived from Steven Watanbe's type erasure abstract sequence printer jump through. Good luck. Paul --- Paul A. Bristow Prizet Farmhouse Kendal UK LA8 8AB +44 (0) 1539 561830