2 // Copyright (c) 2020 Fraunhofer Institute for Applied Information Technology (FIT)
3 // Network Research Group (NET)
4 // Schloss Birlinghoven, 53754 Sankt Augustin, GERMANY
5 // Contact: support@wiback.org
7 // This file is part of the SENF code tree.
8 // It is licensed under the 3-clause BSD License (aka New BSD License).
9 // See LICENSE.txt in the top level directory for details or visit
10 // https://opensource.org/licenses/BSD-3-Clause
15 \brief Algorithm inline template implementation */
19 #define prefix_ inline
20 //-/////////////////////////////////////////////////////////////////////////////////////////////////
22 template <class InputIterator, class ValueType>
23 prefix_ bool senf::contains(InputIterator first, InputIterator last, ValueType const & value)
25 return std::find(first, last, value) != last;
28 template <class Container, class ValueType>
29 prefix_ bool senf::contains(Container const & container, ValueType const & value)
31 return senf::contains( boost::begin(container), boost::end(container), value);
34 template <class ValueType>
35 prefix_ bool senf::contains(std::set<ValueType> const & container, ValueType const & value)
37 return container.find(value) != container.end();
40 template <typename KeyType, typename ValueType>
41 prefix_ bool senf::contains(std::map<KeyType, ValueType> const & container, KeyType const & key)
43 return container.find(key) != container.end();
46 template <typename KeyType, typename ValueType>
47 prefix_ bool senf::contains(boost::ptr_map<KeyType, ValueType> const & container, KeyType const & key)
49 return container.find(key) != container.end();
52 template <typename KeyType, typename ValueType>
53 prefix_ bool senf::contains(boost::ptr_unordered_map<KeyType, ValueType> const & container, KeyType const & key)
55 return container.find(key) != container.end();
58 //-/////////////////////////////////////////////////////////////////////////////////////////////////
66 // c-file-style: "senf"
67 // indent-tabs-mode: nil
68 // ispell-local-dictionary: "american"
69 // compile-command: "scons -u test"