To be clear
explicit Accessor(const T& data) : value(data) {}
equivalently
explicit Accessor(const T& data) :value(data)
This is the definition of a member function. Here, placing a semicolon at the end of a function signature makes it a declaration of a member function, which must be defined somewhere in the program outside the class, as shown below
Accessor::Accessor(const T& data) {
In addition, as follows from another answer, the end of the function body does not require a semicolon after the closing bracket (this requires the end of the class or structure definition), but adding one to the end will not create a difference, since this is considered no-op, and that is why you can add a semicolon at the end.
Raagesh chakkadath
source share