summaryrefslogtreecommitdiff
path: root/common/list.h
diff options
context:
space:
mode:
Diffstat (limited to 'common/list.h')
m---------common0
-rw-r--r--common/list.h51
2 files changed, 0 insertions, 51 deletions
diff --git a/common b/common
new file mode 160000
+Subproject dd64a35c949738c2c321989d065e0754556823d
diff --git a/common/list.h b/common/list.h
deleted file mode 100644
index 513f79c..0000000
--- a/common/list.h
+++ /dev/null
@@ -1,51 +0,0 @@
-#ifndef LIST_H
-#define LIST_H
-
-#include <vector>
-#include <algorithm>
-#include <boost/serialization/base_object.hpp>
-
-//! List class with extended functionality over std::vector.
-template<class T, class B = std::vector<T> >
-class List : public B {
- public:
- //! Default constructor.
- List() : B() {}
-
- //! Iterator constructor.
- template <class InputIterator>
- List(InputIterator first, InputIterator last) : B(first, last) {}
-
- //! Sort the list.
- void sort() {
- std::sort(B::begin(), B::end());
- }
-
- //! Check if specified item is present in list.
- bool contains(const T& item) {
- return std::find(B::begin(), B::end(), item) != B::end();
- }
-
- //! Count number of instances of specified item in list.
- std::size_t count(const T& item) {
- return std::count(B::begin(), B::end(), item);
- }
-
- //! Delete item by index.
- void del(std::size_t index) {
- erase(B::begin() + index);
- }
-
- //! Check whether list is empty or not.
- operator bool() const {
- return !B::empty();
- }
-
- //! Allow serialization through Boost.Serialize.
- template<class Archive>
- void serialize(Archive & ar, const unsigned int version) {
- ar & boost::serialization::base_object<B>(*this);
- }
-};
-
-#endif