diff options
author | Chris Lattner <sabre@nondot.org> | 2004-10-13 15:09:21 +0000 |
---|---|---|
committer | Chris Lattner <sabre@nondot.org> | 2004-10-13 15:09:21 +0000 |
commit | c87b1db927226400e6ee4e1eeb050a6b24c34a96 (patch) | |
tree | f6a5e55496c7428ea830207c45cac618bd5313c1 /include | |
parent | a44544d6e7ae3e4d4a0e2bfa5d0e608b515f0144 (diff) | |
download | external_llvm-c87b1db927226400e6ee4e1eeb050a6b24c34a96.zip external_llvm-c87b1db927226400e6ee4e1eeb050a6b24c34a96.tar.gz external_llvm-c87b1db927226400e6ee4e1eeb050a6b24c34a96.tar.bz2 |
Get rid of template templates that were preventing VC from compiling the
set_intersect template. Thanks to Morten Ofstad and Jeff Cohen for the
patch!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16954 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include')
-rw-r--r-- | include/llvm/ADT/SetOperations.h | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/include/llvm/ADT/SetOperations.h b/include/llvm/ADT/SetOperations.h index 3be8bab..57750d1 100644 --- a/include/llvm/ADT/SetOperations.h +++ b/include/llvm/ADT/SetOperations.h @@ -17,8 +17,8 @@ namespace llvm { -// set_union(A, B) - Compute A := A u B, return whether A changed. -// +/// set_union(A, B) - Compute A := A u B, return whether A changed. +/// template <class S1Ty, class S2Ty> bool set_union(S1Ty &S1, const S2Ty &S2) { bool Changed = false; @@ -31,22 +31,22 @@ bool set_union(S1Ty &S1, const S2Ty &S2) { return Changed; } -// set_intersect(A, B) - Compute A := A ^ B -// Identical to set_intersection, except that it works on set<>'s and -// is nicer to use. Functionally, this iterates through S1, removing -// elements that are not contained in S2. -// -template <template<class S1ElTy> class S1Ty, class ETy, class S2Ty> -void set_intersect(S1Ty<ETy> &S1, const S2Ty &S2) { - for (typename S1Ty<ETy>::iterator I = S1.begin(); I != S1.end();) { - const ETy &E = *I; - ++I; - if (!S2.count(E)) S1.erase(E); // Erase element if not in S2 - } +/// set_intersect(A, B) - Compute A := A ^ B +/// Identical to set_intersection, except that it works on set<>'s and +/// is nicer to use. Functionally, this iterates through S1, removing +/// elements that are not contained in S2. +/// +template <class S1Ty, class S2Ty> +void set_intersect(S1Ty &S1, const S2Ty &S2) { + for (typename S1Ty::iterator I = S1.begin(); I != S1.end();) { + const typename S1Ty::key_type &E = *I; + ++I; + if (!S2.count(E)) S1.erase(E); // Erase element if not in S2 + } } -// set_difference(A, B) - Return A - B -// +/// set_difference(A, B) - Return A - B +/// template <class S1Ty, class S2Ty> S1Ty set_difference(const S1Ty &S1, const S2Ty &S2) { S1Ty Result; @@ -57,8 +57,8 @@ S1Ty set_difference(const S1Ty &S1, const S2Ty &S2) { return Result; } -// set_subtract(A, B) - Compute A := A - B -// +/// set_subtract(A, B) - Compute A := A - B +/// template <class S1Ty, class S2Ty> void set_subtract(S1Ty &S1, const S2Ty &S2) { for (typename S2Ty::const_iterator SI = S2.begin(), SE = S2.end(); |