On 10/11/2013 10:36 AM, Jakub Jelinek wrote:
>Since the coding standards say "Conversion operators should be
>avoided" (because they can't be explicit), I think this is the way
>to go.
We then violate the coding standard in vec.h:
/* Type to provide NULL values for vec<T, A, L>. This is used to
provide nil initializers for vec instances. Since vec must be
a POD, we cannot have proper ctor/dtor for it. To initialize
a vec instance, you can assign it the value vNULL. */
struct vnull
{
template <typename T, typename A, typename L>
operator vec<T, A, L> () { return vec<T, A, L>(); }
};
extern vnull vNULL;
but perhaps we can keep that as an exception and don't allow further
exceptions...
I think we just need to have good reasons for exceptions. This seems
like a fine one; the entire purpose of this struct is to have a
conversion operator.
Jason