containers.h
28 lines
| 701 B
| text/x-c
|
CLexer
r0 | #ifndef CONTAINERS_H | |||
#define CONTAINERS_H | ||||
r53 | #include "cpp_utils.h" | |||
r0 | ||||
r53 | #include <algorithm> | |||
#include <map> | ||||
#include <vector> | ||||
r0 | ||||
r53 | namespace SciQLop::containers | |||
r0 | { | |||
r53 | template<class T1, class T2> | |||
auto contains(const T1& container, const T2& value) | ||||
-> decltype(container.front(), std::end(container), true) | ||||
{ | ||||
return std::find(std::cbegin(container), std::cend(container), value) != | ||||
std::cend(container); | ||||
} | ||||
r0 | ||||
r53 | template<class T1, class T2> | |||
auto contains(const T1& container, const T2& value) | ||||
-> decltype(container.find(value), std::cend(container), true) | ||||
{ | ||||
return container.find(value) != std::cend(container); | ||||
} | ||||
r0 | ||||
r53 | } // namespace SciQLop::containers | |||
r0 | ||||
#endif // CONTAINERS_H | ||||