c++11 - c++ custom container pass {} list -


i remaking set container , wondering how pass brace-enclosed initializer list container.

myset<int> myset = {"test", "test 2"}; 

i tried overload operator= take list parameter.

despite presence of = here, constructing set, need constructor (that takes std::initializer_list parameter).

template<class t> class myset {  public: // ...     myset(std::initializer_list<t> init) {         (t const &t : init)             insert(t);     } }; 

Comments

Popular posts from this blog

Delphi XE2 Indy10 udp client-server interchange using SendBuffer-ReceiveBuffer -

Qt ActiveX WMI QAxBase::dynamicCallHelper: ItemIndex(int): No such property in -

Enable autocomplete or intellisense in Atom editor for PHP -