The following patch against 1.4.0-rc2 changes the ValuesConstraint ctor to take its argument as const. This enables convenient usage with initializer lists such as this: const ValuesConstraint<std::string> wtConstraint({"type-a","type-c"});
diff --git a/common_headers/tclap/include/tclap/ValuesConstraint.h b/common_headers/tclap/include/tclap/ValuesConstraint.h
index cee236d1..9819199d 100644
--- a/common_headers/tclap/include/tclap/ValuesConstraint.h
+++ b/common_headers/tclap/include/tclap/ValuesConstraint.h
@@ -43,7 +43,7 @@ public:
* Constructor.
* \param allowed - vector of allowed values.
*/
- explicit ValuesConstraint(std::vector<T> &allowed);
+ explicit ValuesConstraint(const std::vector<T> &allowed);
/**
* Virtual destructor.
@@ -80,7 +80,7 @@ protected:
};
template <class T>
-ValuesConstraint<T>::ValuesConstraint(std::vector<T> &allowed)
+ValuesConstraint<T>::ValuesConstraint(const std::vector<T> &allowed)
: _allowed(allowed), _typeDesc("") {
for (unsigned int i = 0; i < _allowed.size(); i++) {
std::ostringstream os;
Thanks, comited in [9c695742a6536da4f0406176f91e8ada4644608b].
Related
Commit: [9c6957]