Boost logo

Boost :

From: Valentin Bonnard (Bonnard.V_at_[hidden])
Date: 1999-11-05 11:28:42

Beman Dawes wrote:

> Issue 3: Issue 1 and 2 interact. The proposed resolution for 2
> doesn't fix 1. The proposed solution for 1 also fixes 2 for the
> example given, but silently slices if the template parameter is
> omitted:
> Base& rb = implicit_cast(rd); // slices

You can disallow all uses of implicit_cast w/o an explicit
template arg by stoping argument deduction:

  template <typename T>
  struct the_same {
    typedef T me;

  template <typename T>
  T implicit_cast (typename the_same<T>::me x)
  { return x; }

Valentin Bonnard

Boost list run by bdawes at, gregod at, cpdaniel at, john at