From 551ccae044b0ff658fe629dd67edd5ffe75d10e8 Mon Sep 17 00:00:00 2001 From: Reid Spencer Date: Wed, 1 Sep 2004 22:55:40 +0000 Subject: Changes For Bug 352 Move include/Config and include/Support into include/llvm/Config, include/llvm/ADT and include/llvm/Support. From here on out, all LLVM public header files must be under include/llvm/. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@16137 91177308-0d34-0410-b5e6-96231b3b80d8 --- include/Support/SetOperations.h | 71 ----------------------------------------- 1 file changed, 71 deletions(-) delete mode 100644 include/Support/SetOperations.h (limited to 'include/Support/SetOperations.h') diff --git a/include/Support/SetOperations.h b/include/Support/SetOperations.h deleted file mode 100644 index bb1e68e6b2..0000000000 --- a/include/Support/SetOperations.h +++ /dev/null @@ -1,71 +0,0 @@ -//===-- Support/SetOperations.h - Generic Set Operations --------*- C++ -*-===// -// -// The LLVM Compiler Infrastructure -// -// This file was developed by the LLVM research group and is distributed under -// the University of Illinois Open Source License. See LICENSE.TXT for details. -// -//===----------------------------------------------------------------------===// -// -// This file defines generic set operations that may be used on set's of -// different types, and different element types. -// -//===----------------------------------------------------------------------===// - -#ifndef SUPPORT_SETOPERATIONS_H -#define SUPPORT_SETOPERATIONS_H - -namespace llvm { - -// set_union(A, B) - Compute A := A u B, return whether A changed. -// -template -bool set_union(S1Ty &S1, const S2Ty &S2) { - bool Changed = false; - - for (typename S2Ty::const_iterator SI = S2.begin(), SE = S2.end(); - SI != SE; ++SI) - if (S1.insert(*SI).second) - Changed = true; - - 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 class S1Ty, class ETy, class S2Ty> -void set_intersect(S1Ty &S1, const S2Ty &S2) { - for (typename S1Ty::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_difference(A, B) - Return A - B -// -template -S1Ty set_difference(const S1Ty &S1, const S2Ty &S2) { - S1Ty Result; - for (typename S1Ty::const_iterator SI = S1.begin(), SE = S1.end(); - SI != SE; ++SI) - if (!S2.count(*SI)) // if the element is not in set2 - Result.insert(*SI); - return Result; -} - -// set_subtract(A, B) - Compute A := A - B -// -template -void set_subtract(S1Ty &S1, const S2Ty &S2) { - for (typename S2Ty::const_iterator SI = S2.begin(), SE = S2.end(); - SI != SE; ++SI) - S1.erase(*SI); -} - -} // End llvm namespace - -#endif -- cgit v1.2.3