How to mimic this std::vector behavior [duplicate]












0
















This question already has an answer here:




  • Initializer list syntax in member initializer list using C++11

    3 answers



  • C++ Supply initializer-list constructor for class template

    1 answer




How can I make a class I define have a constructor that works like this:



vector<int> vec = {1,2,3,4};









share|improve this question















marked as duplicate by jww, Raymond Chen, sideshowbarker, eyllanesc, Makyen Nov 18 '18 at 6:55


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
















  • Look up std::initializer_list as a constructor argument.

    – erip
    Nov 18 '18 at 2:43








  • 3





    Possible duplicate of C++ Supply initializer-list constructor for class template and Initializer list syntax in member initializer list using C++11. Maybe related, Why is list initialization (using curly braces) better than the alternatives?

    – jww
    Nov 18 '18 at 2:47













  • @erip Ah! I was dumb, I didn't realize I would have to use an ititializer_list AND overload operator= to get this behavior.

    – Shane Murphy
    Nov 18 '18 at 3:12











  • The specific line you show does not require operator=, it only uses a constructor. Something like vector<int> vec; vec = {1,2,3,4}; would indeed require an assignment operator.

    – Igor Tandetnik
    Nov 18 '18 at 4:47


















0
















This question already has an answer here:




  • Initializer list syntax in member initializer list using C++11

    3 answers



  • C++ Supply initializer-list constructor for class template

    1 answer




How can I make a class I define have a constructor that works like this:



vector<int> vec = {1,2,3,4};









share|improve this question















marked as duplicate by jww, Raymond Chen, sideshowbarker, eyllanesc, Makyen Nov 18 '18 at 6:55


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.
















  • Look up std::initializer_list as a constructor argument.

    – erip
    Nov 18 '18 at 2:43








  • 3





    Possible duplicate of C++ Supply initializer-list constructor for class template and Initializer list syntax in member initializer list using C++11. Maybe related, Why is list initialization (using curly braces) better than the alternatives?

    – jww
    Nov 18 '18 at 2:47













  • @erip Ah! I was dumb, I didn't realize I would have to use an ititializer_list AND overload operator= to get this behavior.

    – Shane Murphy
    Nov 18 '18 at 3:12











  • The specific line you show does not require operator=, it only uses a constructor. Something like vector<int> vec; vec = {1,2,3,4}; would indeed require an assignment operator.

    – Igor Tandetnik
    Nov 18 '18 at 4:47
















0












0








0









This question already has an answer here:




  • Initializer list syntax in member initializer list using C++11

    3 answers



  • C++ Supply initializer-list constructor for class template

    1 answer




How can I make a class I define have a constructor that works like this:



vector<int> vec = {1,2,3,4};









share|improve this question

















This question already has an answer here:




  • Initializer list syntax in member initializer list using C++11

    3 answers



  • C++ Supply initializer-list constructor for class template

    1 answer




How can I make a class I define have a constructor that works like this:



vector<int> vec = {1,2,3,4};




This question already has an answer here:




  • Initializer list syntax in member initializer list using C++11

    3 answers



  • C++ Supply initializer-list constructor for class template

    1 answer








c++11 constructor initializer-list






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 18 '18 at 3:00









jww

52.9k39225493




52.9k39225493










asked Nov 18 '18 at 2:42









Shane MurphyShane Murphy

142




142




marked as duplicate by jww, Raymond Chen, sideshowbarker, eyllanesc, Makyen Nov 18 '18 at 6:55


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.






marked as duplicate by jww, Raymond Chen, sideshowbarker, eyllanesc, Makyen Nov 18 '18 at 6:55


This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.















  • Look up std::initializer_list as a constructor argument.

    – erip
    Nov 18 '18 at 2:43








  • 3





    Possible duplicate of C++ Supply initializer-list constructor for class template and Initializer list syntax in member initializer list using C++11. Maybe related, Why is list initialization (using curly braces) better than the alternatives?

    – jww
    Nov 18 '18 at 2:47













  • @erip Ah! I was dumb, I didn't realize I would have to use an ititializer_list AND overload operator= to get this behavior.

    – Shane Murphy
    Nov 18 '18 at 3:12











  • The specific line you show does not require operator=, it only uses a constructor. Something like vector<int> vec; vec = {1,2,3,4}; would indeed require an assignment operator.

    – Igor Tandetnik
    Nov 18 '18 at 4:47





















  • Look up std::initializer_list as a constructor argument.

    – erip
    Nov 18 '18 at 2:43








  • 3





    Possible duplicate of C++ Supply initializer-list constructor for class template and Initializer list syntax in member initializer list using C++11. Maybe related, Why is list initialization (using curly braces) better than the alternatives?

    – jww
    Nov 18 '18 at 2:47













  • @erip Ah! I was dumb, I didn't realize I would have to use an ititializer_list AND overload operator= to get this behavior.

    – Shane Murphy
    Nov 18 '18 at 3:12











  • The specific line you show does not require operator=, it only uses a constructor. Something like vector<int> vec; vec = {1,2,3,4}; would indeed require an assignment operator.

    – Igor Tandetnik
    Nov 18 '18 at 4:47



















Look up std::initializer_list as a constructor argument.

– erip
Nov 18 '18 at 2:43







Look up std::initializer_list as a constructor argument.

– erip
Nov 18 '18 at 2:43






3




3





Possible duplicate of C++ Supply initializer-list constructor for class template and Initializer list syntax in member initializer list using C++11. Maybe related, Why is list initialization (using curly braces) better than the alternatives?

– jww
Nov 18 '18 at 2:47







Possible duplicate of C++ Supply initializer-list constructor for class template and Initializer list syntax in member initializer list using C++11. Maybe related, Why is list initialization (using curly braces) better than the alternatives?

– jww
Nov 18 '18 at 2:47















@erip Ah! I was dumb, I didn't realize I would have to use an ititializer_list AND overload operator= to get this behavior.

– Shane Murphy
Nov 18 '18 at 3:12





@erip Ah! I was dumb, I didn't realize I would have to use an ititializer_list AND overload operator= to get this behavior.

– Shane Murphy
Nov 18 '18 at 3:12













The specific line you show does not require operator=, it only uses a constructor. Something like vector<int> vec; vec = {1,2,3,4}; would indeed require an assignment operator.

– Igor Tandetnik
Nov 18 '18 at 4:47







The specific line you show does not require operator=, it only uses a constructor. Something like vector<int> vec; vec = {1,2,3,4}; would indeed require an assignment operator.

– Igor Tandetnik
Nov 18 '18 at 4:47














0






active

oldest

votes

















0






active

oldest

votes








0






active

oldest

votes









active

oldest

votes






active

oldest

votes

Popular posts from this blog

鏡平學校

ꓛꓣだゔៀៅຸ໢ທຮ໕໒ ,ໂ'໥໓າ໼ឨឲ៵៭ៈゎゔit''䖳𥁄卿' ☨₤₨こゎもょの;ꜹꟚꞖꞵꟅꞛေၦေɯ,ɨɡ𛃵𛁹ޝ޳ޠ޾,ޤޒޯ޾𫝒𫠁သ𛅤チョ'サノބޘދ𛁐ᶿᶇᶀᶋᶠ㨑㽹⻮ꧬ꧹؍۩وَؠ㇕㇃㇪ ㇦㇋㇋ṜẰᵡᴠ 軌ᵕ搜۳ٰޗޮ޷ސޯ𫖾𫅀ल, ꙭ꙰ꚅꙁꚊꞻꝔ꟠Ꝭㄤﺟޱސꧨꧼ꧴ꧯꧽ꧲ꧯ'⽹⽭⾁⿞⼳⽋២៩ញណើꩯꩤ꩸ꩮᶻᶺᶧᶂ𫳲𫪭𬸄𫵰𬖩𬫣𬊉ၲ𛅬㕦䬺𫝌𫝼,,𫟖𫞽ហៅ஫㆔ాఆఅꙒꚞꙍ,Ꙟ꙱エ ,ポテ,フࢰࢯ𫟠𫞶 𫝤𫟠ﺕﹱﻜﻣ𪵕𪭸𪻆𪾩𫔷ġ,ŧآꞪ꟥,ꞔꝻ♚☹⛵𛀌ꬷꭞȄƁƪƬșƦǙǗdžƝǯǧⱦⱰꓕꓢႋ神 ဴ၀க௭எ௫ឫោ ' េㇷㇴㇼ神ㇸㇲㇽㇴㇼㇻㇸ'ㇸㇿㇸㇹㇰㆣꓚꓤ₡₧ ㄨㄟ㄂ㄖㄎ໗ツڒذ₶।ऩछएोञयूटक़कयँृी,冬'𛅢𛅥ㇱㇵㇶ𥄥𦒽𠣧𠊓𧢖𥞘𩔋цѰㄠſtʯʭɿʆʗʍʩɷɛ,əʏダヵㄐㄘR{gỚṖḺờṠṫảḙḭᴮᵏᴘᵀᵷᵕᴜᴏᵾq﮲ﲿﴽﭙ軌ﰬﶚﶧ﫲Ҝжюїкӈㇴffצּ﬘﭅﬈軌'ffistfflſtffतभफɳɰʊɲʎ𛁱𛁖𛁮𛀉 𛂯𛀞నఋŀŲ 𫟲𫠖𫞺ຆຆ ໹້໕໗ๆทԊꧢꧠ꧰ꓱ⿝⼑ŎḬẃẖỐẅ ,ờỰỈỗﮊDžȩꭏꭎꬻ꭮ꬿꭖꭥꭅ㇭神 ⾈ꓵꓑ⺄㄄ㄪㄙㄅㄇstA۵䞽ॶ𫞑𫝄㇉㇇゜軌𩜛𩳠Jﻺ‚Üမ႕ႌႊၐၸဓၞၞၡ៸wyvtᶎᶪᶹစဎ꣡꣰꣢꣤ٗ؋لㇳㇾㇻㇱ㆐㆔,,㆟Ⱶヤマފ޼ޝަݿݞݠݷݐ',ݘ,ݪݙݵ𬝉𬜁𫝨𫞘くせぉて¼óû×ó£…𛅑הㄙくԗԀ5606神45,神796'𪤻𫞧ꓐ㄁ㄘɥɺꓵꓲ3''7034׉ⱦⱠˆ“𫝋ȍ,ꩲ軌꩷ꩶꩧꩫఞ۔فڱێظペサ神ナᴦᵑ47 9238їﻂ䐊䔉㠸﬎ffiﬣ,לּᴷᴦᵛᵽ,ᴨᵤ ᵸᵥᴗᵈꚏꚉꚟ⻆rtǟƴ𬎎

Why https connections are so slow when debugging (stepping over) in Java?