SFML community forums

Help => General => Topic started by: Abragon on October 23, 2017, 12:22:06 am

Title: Structure syntax
Post by: Abragon on October 23, 2017, 12:22:06 am
I am going through the SFML game development by example book and in this chapter they have an advance structure that I would like some help on.
struct Binding {
   Binding(const std::string& l_name)
      : m_name(l_name), m_details(l_name), c(0) {}
   void BindEvent(EventType l_type,
      EventInfo l_info = EventInfo())
   {
      m_events.emplace_back(l_type, l_info);
   }
   Events m_events;
   std::string m_name;
   int c; // Count of events that are "happening".
   EventDetails m_details;
};


particularly of interest is the 2nd and 3rd line after the header. I am not sure exactly what is being declared.
Title: Re: Structure syntax
Post by: eXpl0it3r on October 23, 2017, 07:38:05 am
It's called initialization list. If you're not familiar with that, then you should probably put down the SFML book for a bit and read a basic C++ book. ;)
Title: Re: Structure syntax
Post by: Abragon on October 23, 2017, 11:39:28 pm
Thanks for the heads-up  ;D!!!