Responses inline.
On 24 January 2017 at 10:45, Christof Donat
Hi,
Sorry for the unfinished mail. I just was unable to handle my mail client correctly :-(
Am 24.01.2017 10:07, schrieb Richard Hodges:
It seems to me that since c++17 is going to have string_view, and boost already does, then there should be a to_string_view free function to return the view of a temporary.
But where will the temporary live then? Someone will have to free the memory.
Imagine a function: void foo(std::string_view s); which we then call with: foo(join("the answer to life, the universe and everything is: ", hex(42))); The generator returned by join would stay alive until the end of the function foo, so there would be no need to construct a string, only to take a string_view of it. We could use the string_view implicit in the joiner object. This saves us an allocation and a copy.
basic ADL interface something like this:
I didn't get that part. What exactly does ADL stand for?
ADL stands for Argument Dependent Lookup. It means that when you call a free function, the namespaces of its arguments are searched for that function. This means that you can write operator<<, to_string, hash_code etc in the namespace of your custom object and the compiler will select the correct one. It's used a great deal in boost for customisation of structures like boost::hash
Furthermore, since the entire web is now (thankfully) UTF8, I strongly feel
that there should be a utf8 version, which accepts wide and narrow strings and emits them correctly.
UTF-8 is 8 bits only. Just some characters take more than a single byte. See https://en.wikipedia.org/wiki/UTF-8
Anyway, I agree, that we should have a wide char version as well for UTF-16 support.
I have no problem with a u16 version (UTF-16) for the windows crowd and a u8 version (UTF-8) for everyone else. The standard supports this idea in its unicode specialisations of std::string - std::u16string and std::u32string. A utf-8 string is just a std::basic_string<char> with utf-aware traits type.
Christof
_______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman /listinfo.cgi/boost