//===-- llvm/ADT/SetOperations.h - Generic Set Operations -------*- C++ -*-===// // // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. // See https://llvm.org/LICENSE.txt for license information. // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception // //===----------------------------------------------------------------------===// /// /// \file /// This file defines generic set operations that may be used on set's of /// different types, and different element types. /// //===----------------------------------------------------------------------===// #ifndef LLVM_ADT_SETOPERATIONS_H #define LLVM_ADT_SETOPERATIONS_H #include "llvm/ADT/STLExtras.h" namespace llvm { namespace detail { check_has_member_remove_if_t; HasMemberRemoveIf; check_has_member_erase_iter_t; HasMemberEraseIter; } // namespace detail /// 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) { … } /// 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) { … } template <class S1Ty, class S2Ty> S1Ty set_intersection_impl(const S1Ty &S1, const S2Ty &S2) { … } /// set_intersection(A, B) - Return A ^ B template <class S1Ty, class S2Ty> S1Ty set_intersection(const S1Ty &S1, const S2Ty &S2) { … } /// set_difference(A, B) - Return A - B /// template <class S1Ty, class S2Ty> S1Ty set_difference(const S1Ty &S1, const S2Ty &S2) { … } /// set_subtract(A, B) - Compute A := A - B /// /// Selects the set to iterate based on the relative sizes of A and B for better /// efficiency. /// template <class S1Ty, class S2Ty> void set_subtract(S1Ty &S1, const S2Ty &S2) { … } /// set_subtract(A, B, C, D) - Compute A := A - B, set C to the elements of B /// removed from A (A ^ B), and D to the elements of B not found in and removed /// from A (B - A). template <class S1Ty, class S2Ty> void set_subtract(S1Ty &S1, const S2Ty &S2, S1Ty &Removed, S1Ty &Remaining) { … } /// set_is_subset(A, B) - Return true iff A in B /// template <class S1Ty, class S2Ty> bool set_is_subset(const S1Ty &S1, const S2Ty &S2) { … } } // namespace llvm #endif