
Ivan Vecerina wrote:
"Thorsten Ottosen" <thorsten.ottosen@dezide.com> wrote in message
: But it is also true that it is over encapsulated: there is no invariant
: Here are some other examples of classes that has been designed : as over-encapsulated:
: - standard containers In what way?
Lack of inplace-construction or construction with uninitialized dataor or acceptance of a buffer to give to the vector. This hurts performance in libraries such as serialization or asio.
: > Do you think that std::string is an example that ptree wants to follow? : : No.
: If the free-standing functions are not generic, there is little point : in not making them members. Having free-standing functions like : get/set is a bad bad idea with the current rules for ADL.
I didn't explicitly indicate that the functions were templates, but they obviously would be.
They are templates, yes, but still mention basic_ptree.
If we really want to provide member functions for ease-of-use purposes, then I believe that we should make this a separate class from the ptree "container". It would be pretty straightforward to do so.
In the same manner operator[]() could have been left out of std::map<T>, yet is is one of the most convenient functions. -Thorsten