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
38using std::vector;
39using std::list;
40using std::map;
41using std::multimap;
42using std::set;
43using std::multiset;
44using std::deque;
45using std::stack;
46using std::pair;
47using std::make_pair;
48
49using std::find;
50using std::find_end;
51using std::find_first_of;
52using std::find_if;
53
54using std::remove;
55using std::remove_copy;
56using std::remove_copy_if;
57using std::remove_if;
58
59using std::replace;
60using std::replace_copy;
61using std::replace_copy_if;
62using std::replace_if;
63
64using std::for_each;
65using std::transform;
66using std::accumulate;
67using std::sort;
68using std::stable_sort;
69
70using std::binary_search;
71using std::adjacent_find;
72
73using std::equal_range;
74using std::lower_bound;
75using std::upper_bound;
76
77
78#ifndef PWIZ_CONFIG_NO_CONTAINER_OUTPUT_OPERATORS
79
80// output operators for standard containers
81namespace 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_
STL namespace.
ostream & operator<<(ostream &os, SpectrumListCache::CacheType &cache)