Fix: containment check should take const args
This commit is contained in:
parent
76b6f5d374
commit
299c316ad4
1 changed files with 2 additions and 2 deletions
|
|
@ -115,7 +115,7 @@ namespace util {
|
||||||
/** shortcut for string value containment test */
|
/** shortcut for string value containment test */
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline bool
|
inline bool
|
||||||
contains (std::string& str, const T& val)
|
contains (std::string const& str, const T& val)
|
||||||
{
|
{
|
||||||
return str.find (val) != std::string::npos;
|
return str.find (val) != std::string::npos;
|
||||||
}
|
}
|
||||||
|
|
@ -124,7 +124,7 @@ namespace util {
|
||||||
* in any sequential container */
|
* in any sequential container */
|
||||||
template <typename SEQ>
|
template <typename SEQ>
|
||||||
inline bool
|
inline bool
|
||||||
contains (SEQ& cont, typename SEQ::const_reference val)
|
contains (SEQ const& cont, typename SEQ::const_reference val)
|
||||||
{
|
{
|
||||||
typename SEQ::const_iterator begin = cont.begin();
|
typename SEQ::const_iterator begin = cont.begin();
|
||||||
typename SEQ::const_iterator end = cont.end();
|
typename SEQ::const_iterator end = cont.end();
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue