1 | //=======================================================================
|
---|
2 | // Copyright 2015 by Ireneusz Szcześniak
|
---|
3 | // Authors: Ireneusz Szcześniak <www.irkos.org>
|
---|
4 | //
|
---|
5 | // Distributed under the Boost Software License, Version 1.0. (See
|
---|
6 | // accompanying file LICENSE_1_0.txt or copy at
|
---|
7 | // http://www.boost.org/LICENSE_1_0.txt)
|
---|
8 | //=======================================================================
|
---|
9 |
|
---|
10 | #ifndef BOOST_GRAPH_EXCLUDE_FILTER
|
---|
11 | #define BOOST_GRAPH_EXCLUDE_FILTER
|
---|
12 |
|
---|
13 | #include <set>
|
---|
14 |
|
---|
15 | namespace boost {
|
---|
16 |
|
---|
17 | // This filter excludes the given descriptors (edges or vertexes).
|
---|
18 | template <typename Descriptor>
|
---|
19 | struct exclude_filter
|
---|
20 | {
|
---|
21 | // The data set type.
|
---|
22 | typedef typename std::set<Descriptor> ds_type;
|
---|
23 |
|
---|
24 | // The filter must be default-constructible, so it is.
|
---|
25 | exclude_filter(): m_excluded() {};
|
---|
26 |
|
---|
27 | exclude_filter(const ds_type *excluded): m_excluded(excluded) {};
|
---|
28 |
|
---|
29 | inline bool operator()(const Descriptor &e) const
|
---|
30 | {
|
---|
31 | return m_excluded->count(e) == 0;
|
---|
32 | }
|
---|
33 |
|
---|
34 | const ds_type *m_excluded;
|
---|
35 | };
|
---|
36 |
|
---|
37 | } // boost
|
---|
38 |
|
---|
39 | #endif /* BOOST_GRAPH_EXCLUDE_FILTER */
|
---|