ProteoWizard
Container.hpp
Go to the documentation of this file.
1 //
2 // $Id$
3 //
4 //
5 // Original author: Matt Chambers <matt.chambers .@. vanderbilt.edu>
6 //
7 // Copyright 2008 Spielberg Family Center for Applied Proteomics
8 // Cedars Sinai Medical Center, Los Angeles, California 90048
9 // Copyright 2008 Vanderbilt University - Nashville, TN 37232
10 //
11 // Licensed under the Apache License, Version 2.0 (the "License");
12 // you may not use this file except in compliance with the License.
13 // You may obtain a copy of the License at
14 //
15 // http://www.apache.org/licenses/LICENSE-2.0
16 //
17 // Unless required by applicable law or agreed to in writing, software
18 // distributed under the License is distributed on an "AS IS" BASIS,
19 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
20 // See the License for the specific language governing permissions and
21 // limitations under the License.
22 //
23 
24 #ifndef _CONTAINER_HPP_
25 #define _CONTAINER_HPP_
26 
27 #include <vector>
28 #include <list>
29 #include <map>
30 #include <set>
31 #include <deque>
32 #include <stack>
33 #include <algorithm>
34 #include <numeric>
35 #include <utility>
36 #include <boost/foreach.hpp>
37 
38 using std::vector;
39 using std::list;
40 using std::map;
41 using std::multimap;
42 using std::set;
43 using std::multiset;
44 using std::deque;
45 using std::stack;
46 using std::pair;
47 using std::make_pair;
48 
49 using std::find;
50 using std::find_end;
51 using std::find_first_of;
52 using std::find_if;
53 
54 using std::remove;
55 using std::remove_copy;
56 using std::remove_copy_if;
57 using std::remove_if;
58 
59 using std::replace;
60 using std::replace_copy;
61 using std::replace_copy_if;
62 using std::replace_if;
63 
64 using std::for_each;
65 using std::transform;
66 using std::accumulate;
67 using std::sort;
68 using std::stable_sort;
69 
70 using std::binary_search;
71 using std::adjacent_find;
72 
73 using std::equal_range;
74 using std::lower_bound;
75 using std::upper_bound;
76 
77 
78 #ifndef PWIZ_CONFIG_NO_CONTAINER_OUTPUT_OPERATORS
79 
80 // output operators for standard containers
81 namespace std
82 {
83  template<typename T1, typename T2>
84  ostream& operator<< (ostream& o, const pair<T1, T2>& p)
85  {
86  return (o << "( " << p.first << ", " << p.second << " )");
87  }
88 
89  template<typename T>
90  ostream& operator<< (ostream& o, const vector<T>& v)
91  {
92  o << "(";
93  for(const auto& i : v)
94  o << " " << i;
95  o << " )";
96 
97  return o;
98  }
99 
100  template<typename T, typename P>
101  ostream& operator<< (ostream& o, const set< T, P >& s)
102  {
103  o << "(";
104  for (const auto& i : s)
105  o << " " << i;
106  o << " )";
107 
108  return o;
109  }
110 
111  inline ostream& operator<< (ostream& o, const map< string, string >& m)
112  {
113  o << "(";
114  for (const auto& p : m)
115  o << " \"" << p.first << "\"->\"" << p.second << "\"";
116  o << " )";
117 
118  return o;
119  }
120 
121  template<typename KeyT>
122  ostream& operator<< (ostream& o, const map< KeyT, string >& m)
123  {
124  o << "(";
125  for (const auto& p : m)
126  o << " " << p.first << "->\"" << p.second << "\"";
127  o << " )";
128 
129  return o;
130  }
131 
132  template<typename ValueT>
133  ostream& operator<< (ostream& o, const map< string, ValueT >& m)
134  {
135  o << "(";
136  for (const auto& p : m)
137  o << " \"" << p.first << "\"->" << p.second << "";
138  o << " )";
139 
140  return o;
141  }
142 
143  template<typename KeyT, typename ValueT>
144  ostream& operator<< (ostream& o, const map< KeyT, ValueT >& m)
145  {
146  o << "(";
147  for (const auto& p : m)
148  o << " " << p.first << "->" << p.second << "";
149  o << " )";
150 
151  return o;
152  }
153 }
154 
155 #endif // PWIZ_CONFIG_NO_CONTAINER_OUTPUT_OPERATORS
156 
157 #endif // _CONTAINER_HPP_