File: intlist.h

package info (click to toggle)
pilercr 1.06%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 804 kB
  • sloc: cpp: 14,339; makefile: 67; sh: 3
file content (50 lines) | stat: -rwxr-xr-x 1,677 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
#ifndef IntList_H
#define IntList_H

#include <list>
#include <vector>
#include <set>
#include <map>

typedef std::list<unsigned> IntList;
typedef IntList::iterator IntListIter;
typedef IntList::const_iterator CIntListIter;

typedef std::vector<unsigned> IntVec;
typedef IntVec::iterator IntVecIter;
typedef IntVec::const_iterator CIntVecIter;

typedef std::set<unsigned> IntSet;
typedef IntSet::iterator IntSetIter;
typedef IntSet::const_iterator CIntSetIter;

typedef std::map<unsigned, unsigned> IntMap;
typedef IntMap::iterator IntMapIter;
typedef IntMap::const_iterator CIntMapIter;

typedef std::vector<IntVec> IntVecVec;
typedef std::vector<IntList> IntListList;

typedef std::vector<bool> BoolVec;

// Warning: sorts A and B in place:
void IntersectIntLists2(IntList &A, IntList &B, IntList &Common);

// More expensive but safer (makes tmp copies of A and B):
void IntersectIntLists(const IntList &A, const IntList &B, IntList &Common);

void LogList(const IntList &List);

#define	for_IntList(L, p)		for (IntListIter p = L.begin(); p != L.end(); ++p)
#define	for_CIntList(L, p)		for (CIntListIter p = L.begin(); p != L.end(); ++p)

#define	for_IntVec(L, p)		for (IntVecIter p = L.begin(); p != L.end(); ++p)
#define	for_CIntVec(L, p)		for (CIntVecIter p = L.begin(); p != L.end(); ++p)

#define	for_IntSet(L, p)		for (IntSetIter p = L.begin(); p != L.end(); ++p)
#define	for_CIntSet(L, p)		for (CIntSetIter p = L.begin(); p != L.end(); ++p)

#define	for_IntMap(L, p)		for (IntMapIter p = L.begin(); p != L.end(); ++p)
#define	for_CIntMap(L, p)		for (CIntMapIter p = L.begin(); p != L.end(); ++p)

#endif	// IntList_H