Boost Regex use of &*string.begin()
Hi The boost regex library makes liberal use of &*string.begin() For example ---------------------------------------------------------------------------------------- std::string result(++bytes, '\0'); bytes = ::LCMapStringW( id, // locale identifier LCMAP_SORTKEY, // mapping transformation type p1, // source string static_cast<int>(p2 - p1), // number of characters in source string reinterpret_cast<wchar_t*>(&*result.begin()), // destination buffer *of bytes* bytes // size of destination buffer ); -------------------------------------------------------------------------------------------------------------------- Is this construct safe? Are its semantics specified by the standard? regards Sudarshan -- Sudarshan Gaikaiwari www.sudarshan.org sudarshan@acm.org
Sudarshan Gaikaiwari wrote:
Hi
The boost regex library makes liberal use of &*string.begin()
Is this construct safe? Are its semantics specified by the standard?
It isn't specified by the current std: but all current implementations I'm aware of do support it. The next (currently draft) std requires that basic_string's buffer be contiguous, so it will be std-mandated shortly. HTH, John.
participants (2)
-
John Maddock
-
Sudarshan Gaikaiwari