lmi-commits
[Top][All Lists]
Advanced

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

[lmi-commits] [lmi] master 685be7c 2/5: Default-construct empty strings:


From: Greg Chicares
Subject: [lmi-commits] [lmi] master 685be7c 2/5: Default-construct empty strings: no '""' argument is wanted
Date: Thu, 26 Jan 2017 18:03:16 +0000 (UTC)

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

    Default-construct empty strings: no '""' argument is wanted
    
    No such change has been made to 'value_cast_test.cpp', where '""'
    actually represents the semantic intention, e.g.:
        BOOST_TEST_EQUAL(" ", lexical_cast<std::string>(std::string(" ")));
        BOOST_TEST_EQUAL("", lexical_cast<std::string>(std::string("")));
---
 antediluvian_stubs.cpp |    2 +-
 input_sequence.cpp     |    4 ++--
 name_value_pairs.cpp   |    2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/antediluvian_stubs.cpp b/antediluvian_stubs.cpp
index 2d14604..6736f70 100644
--- a/antediluvian_stubs.cpp
+++ b/antediluvian_stubs.cpp
@@ -31,7 +31,7 @@
 
 namespace
 {
-    std::string const empty_string("");
+    std::string const empty_string = std::string();
 } // Unnamed namespace.
 
 void authenticate_system()
diff --git a/input_sequence.cpp b/input_sequence.cpp
index 4bd3593..2870d04 100644
--- a/input_sequence.cpp
+++ b/input_sequence.cpp
@@ -162,7 +162,7 @@ InputSequence::InputSequence(std::vector<std::string> 
const& v)
     std::string prior_value =
         (0 != v.size())
         ? v.front()
-        : std::string("")
+        : std::string()
         ;
     std::string current_value = prior_value;
 
@@ -215,7 +215,7 @@ InputSequence::InputSequence
     std::string s_prior_value =
         (0 != s_v.size())
         ? s_v.front()
-        : std::string("")
+        : std::string()
         ;
     std::string s_current_value = s_prior_value;
 
diff --git a/name_value_pairs.cpp b/name_value_pairs.cpp
index f6f588d..671717d 100644
--- a/name_value_pairs.cpp
+++ b/name_value_pairs.cpp
@@ -56,7 +56,7 @@ std::string const& name_value_pairs::string_value(std::string 
const& key) const
     string_map::const_iterator i = map_.find(key);
     if(i == map_.end())
         {
-        static std::string const empty_string("");
+        static std::string const empty_string = std::string();
         return empty_string;
         }
     else



reply via email to

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