C++ Insights - Episode 20: What's behind a std::initializer_list

Поділитися
Вставка
  • Опубліковано 18 гру 2024

КОМЕНТАРІ • 6

  • @reflec8525
    @reflec8525 10 місяців тому +1

    thanks interesting insights. It seems initializer lists are not designed to pass by reference. Two other cases that are maybe more optimal if you avoid lvalues...
    Use move (if you have a move ctor):
    UInit c{std::move(a), std::move(b)};
    Use temporaries to make the init list. maybe more the original thinking behind the concept:
    Uinit d{Unit(), Unit()}; //default, default, init list

    • @andreas_fertig
      @andreas_fertig  9 місяців тому

      I agree, initializer lists are not designed to pass by reference. They are a view and not a container.

  • @MightyMoveSemantics
    @MightyMoveSemantics Рік тому +1

    Great content! Thanks for sharing. I wish the font was larger.

    • @andreas_fertig
      @andreas_fertig  Рік тому

      Thank you! I may have increased the font in more recent episodes. I can see whether there is enough space to increase the font a bit more.

  • @sallaklamhayyen9876
    @sallaklamhayyen9876 2 роки тому +1

    very small font we can't see nothing , please next time make font much bigger

  • @rinket7779
    @rinket7779 3 роки тому

    that's crazy! wow, initializer_list is so broken