> then I say: ok, the idea is that we say "From is convertible To" if > and only if the expression From() [5.2.3/2 of the standard] is > convertible to To.
No there is no requirement that From be default constructible, (not even in the implementation). > except for the couples (From, To) described below, > is_convertible<From, To>::value is true if and only if > the declaration struct X { static From f; }; is well-formed > and the expression X::f can be implicitly converted (standard 4/3) > to the type To. Which exposes the implementation, which in general IMO is a bad idea: in fact as I was alluding to, we can improve the implementation so that there are no restrictions on what type From may be. We need only make reference to 4.0 para 3, and state that type To must be either an object type or a reference. > Of course a long list should follow, including e.g. all pairs with > >From = function type. Note also that in the above I have used the > declaration struct X { static From f; }; instead of a simple From f; > because I wanted to include reference types. Alternatively I could > have said: > > > except for the couples (From, To) described below, > is_convertible<From, To>::value is true if and only if > the declaration ** From f ** is well-formed and the expression > f can be implicitly converted to the type To. Not necessary, with some minor improvements there are limitations on From either in practice or in reference to the standard. > then of course I should have added the cases involving references to > the notorious list of "exceptions". > > All in all, I don't know whether we can come up with a simple > description. But maybe that's just because I haven't followed the > original discussions about is_convertible where the fundamental idea > could have already been expressed. Another idea that may be worth > trying is to put the special cases into a table, with the regression > tests accurately reproducing the table cases: > > > From: void T > --------------------------------- > To: | | > | | > void | false | false > | | > T& | | true > > > etc.. etc... Incidentally I've noticed that currently > is_convertible<void, void> gives true. Is it the intent? Heaven only knows, that one wasn't me, IMO it probably does make sense in that anything is convertible to void as a special case. John Maddock http://ourworld.compuserve.com/homepages/john_maddock/index.htm _______________________________________________ Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost