I'm a move
semantics beginner. Is this code:
template <typename... Args>
void foo(const Args & ... args){
map<tuple<Args...>, int> cache;
auto result = cache.emplace(move(make_tuple(args ...)),1);
//...
}
More efficient than:
template <typename... Args>
void foo(const Args & ... args){
map<tuple<Args...>, int> cache;
tuple<Args...> t(args...);
auto result = cache.insert(make_pair(t,1));
//...
}
Especially if args
contains some big object?
Same question but with std::vector
(so no need for make_pair
or make_tuple
)
Aucun commentaire:
Enregistrer un commentaire