Besides the point, but I would hope that for the version found mid-way along the article, (compute in constructor, return value via the count function) the compiler would first optimize away the container class because the container only has one member, then optimize the call to count away.
If having a class like this makes sense, do it and leave optimizing to the compiler.
If having a class like this makes sense, do it and leave optimizing to the compiler.