1
0
mirror of https://github.com/CLIUtils/CLI11.git synced 2025-04-30 04:33:53 +00:00

Fix for non-cleared static stream in some cases

This commit is contained in:
Henry Fredrick Schreiner 2018-04-03 09:32:31 +02:00 committed by Henry Schreiner
parent db202b831e
commit ae3b5a69c7

View File

@ -140,11 +140,12 @@ template <typename T,
bool lexical_cast(std::string input, T &output) { bool lexical_cast(std::string input, T &output) {
// On GCC 4.7, thread_local is not available, so this optimization // On GCC 4.7, thread_local is not available, so this optimization
// is turned off (avoiding multiple initialisations on multiple usages // is turned off (avoiding multiple initialisations on multiple usages)
#if defined(__GNUC__) && !defined(__clang__) && !defined(__INTEL_COMPILER) && __GNUC__ == 4 && (__GNUC_MINOR__ < 8) #if defined(__GNUC__) && !defined(__clang__) && !defined(__INTEL_COMPILER) && __GNUC__ == 4 && (__GNUC_MINOR__ < 8)
std::istringstream is; std::istringstream is;
#else #else
static thread_local std::istringstream is; static thread_local std::istringstream is;
is.clear();
#endif #endif
is.str(input); is.str(input);