From a05470bdfc2c43e49eae41bbf045cd8856d9433d Mon Sep 17 00:00:00 2001 From: Bernard Normier Date: Mon, 18 Jul 2016 20:55:31 +0000 Subject: New C++11 optional mapping --- cpp/test/Ice/optional/StringView.h | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) (limited to 'cpp/test/Ice/optional/StringView.h') diff --git a/cpp/test/Ice/optional/StringView.h b/cpp/test/Ice/optional/StringView.h index 8dd1d7d6f73..43e5bf74bb7 100644 --- a/cpp/test/Ice/optional/StringView.h +++ b/cpp/test/Ice/optional/StringView.h @@ -153,11 +153,13 @@ struct StreamHelper template static inline void write(S* stream, const Util::string_view& v) { - -#ifdef STRING_VIEW_IGNORE_STRING_CONVERTER - stream->write(v.data(), v.size(), false); +#ifdef ICE_CPP11_MAPPING + stream->write(v.data(), v.size()); #else - stream->write(v.data(), v.size(), true); + // + // In C++98, for consistency with the read, we don't string-convert + // + stream->write(v.data(), v.size(), false); #endif } @@ -167,19 +169,10 @@ struct StreamHelper const char* vdata = 0; size_t vsize = 0; -#ifdef STRING_VIEW_IGNORE_STRING_CONVERTER + // + // In C++98, we ignore the string converter + // stream->read(vdata, vsize); -#else - std::string holder; - stream->read(vdata, vsize, holder); - - // If holder is not empty, a string conversion occured, and we can't return a - // string_view since it does not hold the memory - if(!holder.empty()) - { - throw Ice::MarshalException(__FILE__, __LINE__, "string conversion not supported"); - } -#endif if(vsize > 0) { -- cgit v1.2.3