This is the mail archive of the cygwin-apps mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH setup 3/9] Access StringOption's value by reference


Access StringOption's value by reference, to avoid unnecessary temporaries.
---
 libgetopt++/include/getopt++/StringOption.h | 2 +-
 libgetopt++/src/StringOption.cc             | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/libgetopt++/include/getopt++/StringOption.h b/libgetopt++/include/getopt++/StringOption.h
index f13bc22..f13be8c 100644
--- a/libgetopt++/include/getopt++/StringOption.h
+++ b/libgetopt++/include/getopt++/StringOption.h
@@ -32,7 +32,7 @@ public:
   virtual std::string const shortHelp () const;
   virtual Result Process (char const *);
   virtual Argument argument () const;
-  operator std::string () const;
+  operator const std::string& () const;
 
 private:
   Argument _optional;
diff --git a/libgetopt++/src/StringOption.cc b/libgetopt++/src/StringOption.cc
index 462cf0d..210b00a 100644
--- a/libgetopt++/src/StringOption.cc
+++ b/libgetopt++/src/StringOption.cc
@@ -60,7 +60,7 @@ StringOption::Process (char const *optarg)
   return Failed;
 }
 
-StringOption::operator string () const
+StringOption::operator const string& () const
 {
   return _value;
 }
-- 
2.12.3


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]