CYCLUS
Loading...
Searching...
No Matches
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
8namespace cyclus {
9
10/// @brief a less-than comparison for pairs
11template <class T>
12struct SecondLT {
13 bool operator()(const T& x, const T& y) const {
14 return x.second < y.second;
15 }
16};
17
18// taken from
19// http://stackoverflow.com/questions/8473009/how-to-efficiently-compare-two-maps-of-strings-in-c
20template <typename Map>
21bool map_compare(Map const& lhs, Map const& rhs) {
22 return lhs.size() == rhs.size()
23 && std::equal(lhs.begin(), lhs.end(), rhs.begin());
24}
25
26} // namespace cyclus
27
28#endif // CYCLUS_SRC_CYC_STD_H_
taken directly from OsiSolverInterface.cpp on 2/17/14 from https://projects.coin-or....
Definition agent.cc:14
bool map_compare(Map const &lhs, Map const &rhs)
Definition cyc_std.h:21
T OptionalQuery(InfileTree *tree, std::string query, T default_val)
a query method for optional parameters
a less-than comparison for pairs
Definition cyc_std.h:12
bool operator()(const T &x, const T &y) const
Definition cyc_std.h:13