This is the mail archive of the
cygwin-apps
mailing list for the Cygwin project.
[PATCH setup 3/9] Access StringOption's value by reference
- From: Jon Turney <jon dot turney at dronecode dot org dot uk>
- To: cygwin-apps at cygwin dot com
- Cc: Jon Turney <jon dot turney at dronecode dot org dot uk>
- Date: Tue, 6 Jun 2017 12:54:26 +0100
- Subject: [PATCH setup 3/9] Access StringOption's value by reference
- Authentication-results: sourceware.org; auth=none
- References: <20170606115432.105020-1-jon.turney@dronecode.org.uk>
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