Boost logo

Boost :

From: Douglas Gregor (gregod_at_[hidden])
Date: 2002-07-03 08:06:44


On Tuesday 02 July 2002 11:46 pm, Eric Friedman wrote:
> Anyone have an idea as to how to make the following code work (or at
> least exhibit similar behavior) under MSVC 7 or GCC 2.9.5?
[snip errors]
> struct test_base
> {
> static void f() { }
> };
>
> template <typename T, typename base>
> struct test_using
>
> : base
>
> {
> using base::f;
>
> static int f(const T& t)
> {
> return t;
> }
> };

One potential solution is to factor the new definition of 'f' into another
base class, e.g.,

template<typename T>
struct test_current_case {
  static int f(const T& t)
  {
    return t;
  }
};

template<typename T, typename base>
struct test_using : public test_current_case<T>, public base
{
  using base::f;
  using test_current_cast<T>::f;
};

I remember trying this, and I think it might have worked with GCC 2.95.3, but
I'm not entirely sure :)

        Doug


Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk