Revision 437fd680 custompackages/graph-parser/src/utility.tpp

View differences:

custompackages/graph-parser/src/utility.tpp
1 1
namespace outops
2 2
{
3 3
    template <typename T>
4
    std::ostream& operator<<(std::ostream& os, const std::set<T>& s)
5
    {
4
    std::ostream& operator<<(std::ostream& os, const std::set<T>& data) {
6 5
        using namespace boost::spirit::karma;
7
        os << format("(" << (auto_ % "\n  ") << ")", s);
6
        os << format("(" << (auto_ % "\n  ") << ")", data);
7
        os << endl;
8
    }
9

  
10
    template <typename T> std::ostream& operator<<(std::ostream& os, const std::vector<T>& data) {
11
        os << "cout << std::vector<T>\n";
12

  
13
        using namespace boost::spirit::karma;
14
        os << format("(" << (auto_ % "\n  ") << ")", data);
15
        os << endl;
16
    }
17

  
18
    template <typename T>
19
    std::ostream& operator<<(std::ostream& os, const std::map<string, T>& data) {
20
        os << "cout << std::map<string, T>\n";
21
        typename std::map<string, T>::const_iterator iter;
22
        for (iter = data.begin(); iter != data.end(); ++iter) {
23
            os << (*iter).first << ": " << (*iter).second << endl;
24
        }
8 25
        os << endl;
9 26
    }
10 27
}
......
22 39
}
23 40
namespace graphext {
24 41
    template <typename Container>
25
    void id_of_some_vertices(const Graph& g, const Container& container, std::set<std::string>& r)
26
    {
42
    void id_of_some_vertices(const Graph& g, const Container& container, std::set<std::string>& r) {
27 43
        /*
28 44
        ** Find id for a vec
29 45
        */
......
35 51

  
36 52
namespace setops {
37 53
    // From http://stackoverflow.com/questions/8175933/to-compare-two-boost-graph-having-same-vertices
38
    template <typename T> std::set<T> operator-(const std::set<T>& a, const std::set<T>& b)
39
    {
54
    template <typename T> std::set<T> operator-(const std::set<T>& a, const std::set<T>& b) {
40 55
        std::set<T> r;
41 56
        std::set_difference(
42 57
                a.begin(), a.end(),
......
46 61
        return r;
47 62
    }
48 63

  
49
    template <typename T> std::set<T> operator/(const std::set<T>& a, const std::set<T>& b)
50
    {
64
    template <typename T> std::set<T> operator/(const std::set<T>& a, const std::set<T>& b) {
51 65
        std::set<T> r;
52 66
        std::set_intersection(
53 67
                a.begin(), a.end(),

Also available in: Unified diff