X-Git-Url: http://git.tdb.fi/?p=libs%2Fcore.git;a=blobdiff_plain;f=source%2Fstrings%2Flexicalcast.h;h=13eab45f0b81c9311381f43f880caf2abb5fcf5b;hp=2ed0621291858c0d0f4d40fb37036fd5decc5700;hb=e83bcaa01b98b600171886ff6b06d884385dd0ed;hpb=0802c808fd55a508ca6f32a77bca3dae5424611b diff --git a/source/strings/lexicalcast.h b/source/strings/lexicalcast.h index 2ed0621..13eab45 100644 --- a/source/strings/lexicalcast.h +++ b/source/strings/lexicalcast.h @@ -93,36 +93,25 @@ void operator>>(const LexicalConverter &, std::string &); // Generic operators using stringstream -template -struct HasFormattedOutput: Sfinae +struct CheckFormattedOutput: Sfinae { static std::ostream &s; - static T &v; - - /* The expression must depend on the template parameter, or the compiler - will give an error. */ - template - static Yes f(int (*)[sizeof(s<::v)]); - template - static No f(...); - - enum { value = Evaluate(0))>::value }; + template + static Yes f(int (*)[sizeof(s< -struct HasFormattedInput: Sfinae +struct CheckFormattedInput: Sfinae { static std::istream &s; - static T &v; - - template - static Yes f(int (*)[sizeof(s>>HasFormattedOutput::v)]); - template - static No f(...); - - enum { value = Evaluate(0))>::value }; + template + static Yes f(int (*)[sizeof(s>>reinterpret_cast(s))]); + using Sfinae::f; }; +template struct HasFormattedOutput: Sfinae::Evaluate { }; +template struct HasFormattedInput: Sfinae::Evaluate { }; + template typename EnableIf::value, void>::Yes