I have a class which has queue and map like below where astruct is a structure and aclass is a class. Should i initialise these in a constructor? Is so how do i do this? Thanks in advance
Your constructors should ALWAYS construct everything fully that can't be default constructed by themselves.
Your standard containers such as queue and map will construct themselves to be empty.
I'll word it a bit differently: Your construct WILL always construct any sub-objects. If you don't specify a constructor via an initializer list*, they will be default constructed.
But as salem c said, this just means m_testQueue and m_testmap will be empty containers by default.
Last edited on
Thanks, that answers my question.