Understanding the weird syntax with curly braces in a constructor initializer list

后端 未结 3 1020
情书的邮戳
情书的邮戳 2020-12-16 09:45

So I was just browsing the source code of a library when I encountered this.

Font::Font(const sf::Font& font) :
        m_font{std::make_shared

        
3条回答
  •  北荒
    北荒 (楼主)
    2020-12-16 10:09

    The class Font has a member called m_font of type std::shared_ptr, so in the constructor of the class Font that member is being initialized with a shared pointer to font.

提交回复
热议问题