string: add stub 'contains' query

This commit is contained in:
Danny Robson 2019-02-20 14:44:33 +11:00
parent 5025f832ca
commit 2ce92cb2c8
2 changed files with 20 additions and 0 deletions

View File

@ -127,6 +127,11 @@ namespace cruft {
) + 1u; ) + 1u;
} }
bool contains (std::string_view key) const noexcept
{
return std::find (begin (), end (), key) != end ();
}
private: private:
const range_type m_range; const range_type m_range;
const value_type m_separator; const value_type m_separator;

View File

@ -69,6 +69,20 @@ test_tokeniser (cruft::TAP::logger &tap)
} }
///////////////////////////////////////////////////////////////////////////////
void
test_contains (cruft::TAP::logger &tap)
{
struct {
char const *haystack;
char const *needle;
bool expected;
char const *message;
} const TESTS[] = {
};
}
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
int int
main (int, char**) main (int, char**)
@ -77,6 +91,7 @@ main (int, char**)
test_tokeniser (tap); test_tokeniser (tap);
test_position (tap); test_position (tap);
test_contains (tap);
return tap.status (); return tap.status ();
} }