TITLE: distinguishing constructors with artificial types (Newsgroup: comp.std.c++, 11 May 2000) |> > I have for long argued that more calls of ambiguity and a less |> > fine grained overload resolution would be helpful to the |> > programmer. OTOH if you are correctly using the concept of |> > overloading, why should it matter because all the overloads will |> > do the same thing, just from different starting points. Think |> > about that the next time you write an overload, if the new version |> > is not semantically the same as the old perhaps you should not be |> > writing an overload. MINIUSSI: Alain Miniussi |> That's true, except that you don't choose the name of your |> constructors so I guess the issue is still here (even if restricted |> to that situation). KANZE: kanze@gabi-soft.de In such cases, I've found dummy types to distinguist to be quite helpful. Rather than: X::X( double ) : X::X( void* ) ; (which is ambiguous for 0, I think): enum ANumber { number } ; enum APointer { pointer } ; X::X( ANumber , double ) ; X::X( APointer , void* ) ; The first parameter is in fact a dummy, and the constructor code never uses it, but X( number , 0 ) X( pointer , 0 ) are both perfectly unambiguous, and even the most naïve reader understands which function will be called. _______________________________________________ cpptips mailing list http://cpptips.hyperformix.com