File indexing completed on 2025-04-19 09:09:54
0001 #ifndef ATOOLS_Org_STL_Tools_H
0002 #define ATOOLS_Org_STL_Tools_H
0003
0004 #include "ATOOLS/Org/CXXFLAGS.H"
0005 #include <cstddef>
0006
0007 #include <iostream>
0008 #include <vector>
0009
0010 namespace std {
0011
0012 template <typename __Tp>
0013 std::ostream &operator<<(std::ostream &str,const std::vector<__Tp> &v);
0014
0015 }
0016
0017 namespace ATOOLS {
0018
0019 class String_Sort {
0020 private:
0021
0022 std::less<std::string> m_less;
0023
0024 public:
0025
0026 bool operator()(const std::string &a,const std::string &b) const;
0027
0028 };
0029
0030 std::vector<int> ID(size_t id);
0031 size_t ID(const std::vector<int> &id);
0032
0033 size_t IdCount(size_t id);
0034
0035 template <class __Tp>
0036 class AutoDelete_Vector: public std::vector<__Tp*> {
0037 public:
0038
0039 AutoDelete_Vector()
0040 {
0041 }
0042
0043 virtual ~AutoDelete_Vector()
0044 {
0045 while (!this->empty()) {
0046 delete this->back();
0047 this->pop_back();
0048 }
0049 }
0050
0051 };
0052
0053 template <class Iterator>
0054 Iterator AllUnique(Iterator first, Iterator last)
0055 {
0056 while (first != last)
0057 {
0058 Iterator next(first);
0059 last = remove(++next, last, *first);
0060 first = next;
0061 }
0062 return last;
0063 }
0064
0065 }
0066
0067 #endif
0068