This documentation is automatically generated by online-judge-tools/verification-helper
#include "tools/contains.hpp"#pragma once
#include "./has-find.hpp"
#include <algorithm>
#include <iterator>
namespace matumoto {
template <typename Container, typename T>
bool contains(const Container &container, const T &x) {
if constexpr (has_find_v<Container, T>) {
return container.find(x) != end(container);
} else {
return find(begin(container), end(container), x) != end(container);
}
}
} // namespace matumoto#line 2 "tools/contains.hpp"
#line 2 "tools/has-find.hpp"
#line 2 "tools/has-iterator.hpp"
#line 2 "tools/base.hpp"
namespace matumoto {
using namespace std;
}
#line 4 "tools/has-iterator.hpp"
#include <type_traits>
namespace matumoto {
template <typename T>
class HasIterator {
template <typename Container>
static true_type check(typename Container::iterator *);
template <typename Container>
static false_type check(...);
public:
static const bool value = decltype(check<T>(0))::value;
};
template <typename T>
using has_iterator_t = enable_if_t<HasIterator<T>::value, typename T::iterator>;
} // namespace matumoto
#line 4 "tools/has-find.hpp"
#include <cstddef>
namespace matumoto {
template <typename Container, typename T>
class HasFind {
static false_type check(...);
template <typename C, enable_if_t<(static_cast<has_iterator_t<C> (C::*)(const T &)>(&C::find), true), nullptr_t> = nullptr>
static true_type check(C *);
static Container *container;
public:
static constexpr bool value = decltype(check(container))::value;
};
template <typename Container, typename T>
static constexpr bool has_find_v = HasFind<Container, T>::value;
} // namespace matumoto
#line 4 "tools/contains.hpp"
#include <algorithm>
#include <iterator>
namespace matumoto {
template <typename Container, typename T>
bool contains(const Container &container, const T &x) {
if constexpr (has_find_v<Container, T>) {
return container.find(x) != end(container);
} else {
return find(begin(container), end(container), x) != end(container);
}
}
} // namespace matumoto