map.emplace(std::piecewise_construct, std::make_tuple(0), std::make_tuple())
will construct a zero-argument Z
at location 0
.
map[0]
will also do it if it is not already there.
emplace
takes the arguments to construct a std::pair<const K, V>
. std::pair
has a std::piecewise_construct_t
tagged constructor that takes two tuples, the first is used to construct the first argument, the second to construct the second argument.
so std::pair<const int, Z> test( std::piecewise_construct, std::make_tuple(0), std::make_tuple() )
constructs the test
s elements in-place, the const int
is constructed with (0)
. The Z
is constructed with ()
.
map.emplace
forwards is arguments to the std::pair
constructor.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…