1#ifndef FPMAS_FUNCTIONAL_H
2#define FPMAS_FUNCTIONAL_H
11#include <unordered_map>
15namespace fpmas {
namespace utils {
21 template<
typename Container>
28 template<
typename T,
typename Alloc>
29 struct Concat<std::vector<T, Alloc>> {
34 std::vector<T, Alloc>&
init,
const std::vector<T, Alloc>& c) {
35 init.insert(
init.end(), c.begin(), c.end());
36 return std::move(
init);
43 template<
typename T,
typename Comp,
typename Alloc>
44 struct Concat<std::set<T, Comp, Alloc>> {
48 static std::set<T, Comp, Alloc>
concat(
49 std::set<T, Comp, Alloc>&
init,
50 const std::set<T, Comp, Alloc>& c) {
51 init.insert(c.begin(), c.end());
52 return std::move(
init);
59 template<
typename K,
typename T,
typename Comp,
typename Alloc>
60 struct Concat<std::map<K, T, Comp, Alloc>> {
64 static std::map<K, T, Comp, Alloc>
concat(
65 std::map<K, T, Comp, Alloc>&
init,
66 const std::map<K, T, Comp, Alloc>& c
68 init.insert(c.begin(), c.end());
69 return std::move(
init);
76 template<
typename K,
typename T,
typename Hash,
typename KeyEq,
typename Alloc>
77 struct Concat<std::unordered_map<K, T, Hash, KeyEq, Alloc>> {
81 static std::unordered_map<K, T, Hash, KeyEq, Alloc>
concat(
82 std::unordered_map<K, T, Hash, KeyEq, Alloc>&
init,
83 const std::unordered_map<K, T, Hash, KeyEq, Alloc>& c
85 init.insert(c.begin(), c.end());
86 return std::move(
init);
110 template<
typename Container>
120 template<
typename T,
typename Compare = std::less<T>>
127 return std::max(a, b, Compare());
134 template<
typename T,
typename Compare = std::less<T>>
141 return std::min(a, b, Compare());
void init(int argc, char **argv)
Definition: fpmas.cpp:6
Definition: functional.h:94
Container operator()(Container &init, const Container &c) const
Definition: functional.h:111
Definition: functional.h:121
T operator()(const T &a, const T &b)
Definition: functional.h:126
Definition: functional.h:135
T operator()(const T &a, const T &b)
Definition: functional.h:140
static std::map< K, T, Comp, Alloc > concat(std::map< K, T, Comp, Alloc > &init, const std::map< K, T, Comp, Alloc > &c)
Definition: functional.h:64
static std::set< T, Comp, Alloc > concat(std::set< T, Comp, Alloc > &init, const std::set< T, Comp, Alloc > &c)
Definition: functional.h:48
static std::unordered_map< K, T, Hash, KeyEq, Alloc > concat(std::unordered_map< K, T, Hash, KeyEq, Alloc > &init, const std::unordered_map< K, T, Hash, KeyEq, Alloc > &c)
Definition: functional.h:81
static std::vector< T, Alloc > concat(std::vector< T, Alloc > &init, const std::vector< T, Alloc > &c)
Definition: functional.h:33
Definition: functional.h:22