Add mp_map_insert.

This commit is contained in:
Peter Dimov
2016-11-17 02:51:12 +02:00
parent f6c38bb33f
commit 4a7008562f
3 changed files with 71 additions and 0 deletions
+4
View File
@@ -9,7 +9,9 @@
// http://www.boost.org/LICENSE_1_0.txt
#include <boost/mp11/detail/mp_map_find.hpp>
#include <boost/mp11/list.hpp>
#include <boost/mp11/integral.hpp>
#include <boost/mp11/utility.hpp>
#include <type_traits>
namespace boost
@@ -19,6 +21,8 @@ namespace boost
template<class M, class K> using mp_map_contains = mp_not<std::is_same<mp_map_find<M, K>, void>>;
// mp_map_insert<M, T>
template<class M, class T> using mp_map_insert = mp_if< mp_map_contains<M, mp_first<T>>, M, mp_push_back<M, T> >;
// mp_map_replace<M, T>
// mp_map_update<M, T, F>
// mp_map_erase<M, K>