
Fernando Cacciola wrote:
A deep-const wrapper with preserving-const will be such that: [snip] value_initialized<> is a shallow-preserving-const wrapper: [snip] Is this the behaviour you want?
Either one looks fine to me. I am concerned about the present hole, however, where const value_initialized<T> a has a user-defined conversion operator to T &. [snip stuff I agree with]
but can have the member functions, including conversion, without any worries about older compilers screaming ambiguity.
So, I was wrong. Compilers with EDG say: -------------------------------------------------------------- struct A; //typedef int A; struct B { operator const A & (); }; void g(const A &); void g(A &); int main() { g(B()); } ---------------------------------------------------------------- Fails with a claim of ambiguity, but succeeds when line 1 is commented out and line 2 is commented in. So I have to think about that some more. There's also the though of whether to provide template conversion functions - it allows any allowed conversions, but creates ambiguity in ---------------------------------------------------------------------- struct A; struct bar { bar(A); }; can_init<A> z; bar x(z); --------------------------------------------------------------------- Jim