Re: [Cppcms-users] Migration Guide
Brought to you by:
artyom-beilis
|
From: Artyom B. <art...@ya...> - 2012-03-04 15:18:34
|
> From: Markus Raab <us...@ma...>
>
> First of all, congratulation for cppcms 1.0.
> It is a really great piece of software!
Thanks... :-)
>
> Ok, I understand. I am rather a fan of Scott Meyers: Use const whenever
> possible.
>
The biggest problem is that const does not
really works well with pimpl-design. Because with pipml
almost everything can be const however semantically it may
be non-const:
For example the following construction is 100% correct from C++
point of view (d is not changed) but semantically it is by no
means const.
class foo {
public:
...
void bar() const
{
d->x++;
}
...
private:
...
struct impl { int x; };
impl *d;
};
So you can easily make wrong assumptions based on const or
non-const interface.
Const works very well for real data structures but it is not the
best for complex systems with complex relations.
For example classes like `cppcms::json::value` or `cppcms::http::cookie`
have dual const/non-const interface because they are data structures.
But many classes do not have such clear and easy separation.
Best,
Artyom
|