How can I store variadic constructor arguments to vector?
Example with my failed tries:
class Combo
{
public:
template <class... Args>
Combo(Args... args)
{
// this->keys_.push_back(args...);
// this->keys_.push_back(args)...;
// this->keys_.push_back(std::forward<Args>(args...));
//for (uint8_t arg : args...)
// this->keys_.push_back(arg);
// ???
}
private:
std::vector<uint8_t> keys_;
};
for(auto &&i: {args...}) keys.push_back(std::move(i));
(keys.push_back(args), ...);
template<class... Args> Combo(Args... args): keys_{uint8_t(args)...} {}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With