lmi-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[lmi-commits] [lmi] master bca23be 2/4: Reposition 'static' to cache a s


From: Greg Chicares
Subject: [lmi-commits] [lmi] master bca23be 2/4: Reposition 'static' to cache a stream object more efficiently
Date: Thu, 17 Jan 2019 20:21:20 -0500 (EST)

branch: master
commit bca23bec0145c7aa53ee58dbf8323806b822a957
Author: Gregory W. Chicares <address@hidden>
Commit: Gregory W. Chicares <address@hidden>

    Reposition 'static' to cache a stream object more efficiently
    
    See:
      https://lists.nongnu.org/archive/html/lmi/2019-01/msg00010.html
    et seq.
---
 stream_cast_test.cpp | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/stream_cast_test.cpp b/stream_cast_test.cpp
index a97bb58..ac75576 100644
--- a/stream_cast_test.cpp
+++ b/stream_cast_test.cpp
@@ -68,9 +68,9 @@ To cast_2(From from, To = To())
     return result;
 }
 
-std::stringstream& imbued()
+std::stringstream imbued()
 {
-    static std::stringstream interpreter;
+    std::stringstream interpreter;
     interpreter.imbue(blank_is_not_whitespace_locale());
     return interpreter;
 }
@@ -80,7 +80,7 @@ std::stringstream& imbued()
 template<typename To, typename From>
 To cast_3(From from, To = To())
 {
-    std::stringstream& interpreter {imbued()};
+    static std::stringstream interpreter {imbued()};
     interpreter.str(std::string{});
     interpreter.clear();
     To result = To();
@@ -100,7 +100,7 @@ To cast_3(From from, To = To())
 template<typename To, typename From>
 To cast_4(From from, To = To())
 {
-    std::stringstream& interpreter {imbued()};
+    static std::stringstream interpreter {imbued()};
     interpreter.clear();
     To result = To();
     if



reply via email to

[Prev in Thread] Current Thread [Next in Thread]