Initialize ValueConstraint from const reference.

This allows the following in post the c++11 world:
```
    tclap::ValueConstraint<std::string> constraints({"foo", "bar"});
```
instead of
```
    std::vector<std::string> constraint_choices({"foo", "bar"});
    tclap::ValueConstraint<std::string> constraints(constraint_choices);
```
This commit is contained in:
Stefan Büttner 2019-09-11 11:05:12 +02:00
parent c51fb519d6
commit df5303b06c

View File

@ -50,7 +50,7 @@ class ValuesConstraint : public Constraint<T>
* Constructor.
* \param allowed - vector of allowed values.
*/
ValuesConstraint(std::vector<T>& allowed);
ValuesConstraint(std::vector<T>const& allowed);
/**
* Virtual destructor.
@ -89,7 +89,7 @@ class ValuesConstraint : public Constraint<T>
};
template<class T>
ValuesConstraint<T>::ValuesConstraint(std::vector<T>& allowed)
ValuesConstraint<T>::ValuesConstraint(std::vector<T> const& allowed)
: _allowed(allowed),
_typeDesc("")
{