[bimap][PR RFC] Add std::initializer_list constructor
C++11 allows list initialization for classes. STL map has been added a constructor with the signature map(initializer_list<value_type> il, const allocator_type& alloc = allocator_type()); Added a similar constructor to bimap, allowing for initialization in the form of initializer list, such as boost::bimap<double, long> tdn { {114.514, 1919}, {891.931, 810} }; --- Seems that the pull request is not being seen for a while... Could someone please take a quick look at it and possibly give some directions? :) https://github.com/boostorg/bimap/pull/31 include/boost/bimap/bimap.hpp | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/include/boost/bimap/bimap.hpp b/include/boost/bimap/bimap.hpp index 5fe7a3f..a3603e5 100644 --- a/include/boost/bimap/bimap.hpp +++ b/include/boost/bimap/bimap.hpp @@ -265,6 +265,29 @@ class bimap {} + #ifndef BOOST_NO_CXX11_HDR_INITIALIZER_LIST + bimap(std::initializer_list<BOOST_DEDUCED_TYPENAME base_::core_type::value_type> init, + const allocator_type& al = allocator_type()) : + + base_::relation_set( + ::boost::multi_index::get< + BOOST_DEDUCED_TYPENAME base_::logic_relation_set_tag>(core) + ), + + core(init,ctor_args_list(),al), + + left ( + ::boost::multi_index::get< + BOOST_DEDUCED_TYPENAME base_::logic_left_tag>(core) + ), + right ( + ::boost::multi_index::get< + BOOST_DEDUCED_TYPENAME base_::logic_right_tag>(core) + ) + + {} + #endif + bimap(const bimap& x) : base_::relation_set(
participants (1)
-
Hu Jialun