CYCLUS
cyc_std.h
Go to the documentation of this file.
1 #ifndef CYCLUS_SRC_CYC_STD_H_
2 #define CYCLUS_SRC_CYC_STD_H_
3 
4 #include <functional>
5 #include <utility>
6 
7 /// @brief a collection of tools that are standard-library like
8 namespace cyclus {
9 
10 /// @brief a less-than comparison for pairs
11 template<class T> struct SecondLT : std::binary_function<T, T, bool> {
12  bool operator()(const T& x, const T& y) const {
13  return x.second < y.second;
14  }
15 };
16 
17 // taken from
18 // http://stackoverflow.com/questions/8473009/how-to-efficiently-compare-two-maps-of-strings-in-c
19 template <typename Map>
20 bool map_compare(Map const& lhs, Map const& rhs) {
21  return lhs.size() == rhs.size()
22  && std::equal(lhs.begin(), lhs.end(), rhs.begin());
23 }
24 
25 } // namespace cyclus
26 
27 #endif // CYCLUS_SRC_CYC_STD_H_
a less-than comparison for pairs
Definition: cyc_std.h:11
bool operator()(const T &x, const T &y) const
Definition: cyc_std.h:12
bool map_compare(Map const &lhs, Map const &rhs)
Definition: cyc_std.h:20
taken directly from OsiSolverInterface.cpp on 2/17/14 from https://projects.coin-or.org/Osi/browser/trunk.
Definition: agent.cc:14