2
我有一個可移動的(但不可拷貝)與可變參數模板的構造安放對象,具有可變參數的構造成圖
struct foo
{
std::string a,b,c;
foo(foo const&)=delete;
foo(foo&&)=default;
template<typename...T>
for(T&&...);
};
型,我想將它添加到地圖:
template<typename...T>
void add_foo(std::map<std::string,foo>&map, const char*name, T&&...args)
{
map.emplace(std::piecewise_construct, // how? perhaps like this?
std::forward_as_tuple(name), // no:
std::forward_as_tuple(args)); // error here
}
它是如此簡單... – Walter