Re: [sigc] libsigc++ & Forte: template operator()



Am 2004.03.20 14:30 schrieb(en) Martin Schulze:
Am 2004.03.20 00:25 schrieb(en) Murray Cumming:
On Fri, 2004-03-19 at 18:39, martin-ml hippogriff de wrote:
> I think it can be stripped down. The following should do:
>
> class Thing
> {
>   public:
>   Thing()
>   {}
>
>   template <class T>
>   void operator()(T a, T b)
>   {
>     T c = a + b;
>     std::cout << c << std::endl;
>   }
> };
>
> int main(int, char*[])
> {
>   Thing thing_;
>   thing_.template operator()<int>(1, 2);
> }

Thanks. That does succeed with g++ but not with my SUN Forte C++ 5.3
or
5.4. So I have made that a configure-time test. I suggest a quick
tarball release so that Damien can try it on his SUN Forte C+ 5.5.

Marray, did you check whether:

 class Thing
 {
 public:
   Thing()
     {}

   template <class T>
   void operator()(T a, T b)
   {
     T c = a + b;
     std::cout << c << std::endl;
   }
 };

 int main(int, char*[])
 {
   Thing thing_;
   thing_./*template */operator()<int>(1, 2);
 }

(with the template keyword commented out) compiles with the FORTE?
I don't remember anyone actually confirming this. (Attachment test_template_keyword1.cc)

Also we should check whether the newly added template keywords cause
any troubles with the FORTE before doing a new release. I'm attaching
test_template_keyword2.cc for this. test_template_keyword3.cc has the
template keyword commented out.

Regards,

 Martin
#include <iostream>

class Thing
{
public:
  Thing()
    {}

  template <class T>
  void operator()(T a, T b)
  {
    T c = a + b;
    std::cout << c << std::endl;
  }
};

int main(int, char*[])
{
  Thing thing_;
  thing_./*template */operator()<int>(1, 2);
}
#include <iostream>

struct foo {
  template <class T>
  struct deduce_type {
    typedef T type;
  };
};

template <class T>
struct bar {
  typedef typename foo::template deduce_type<T>::type type;
};

int main(int, char*[])
{
  bar<int>::type a = 1;
  std::cout << a << std::endl;
}
#include <iostream>

struct foo {
  template <class T>
  struct deduce_type {
    typedef T type;
  };
};

template <class T>
struct bar {
  typedef typename foo::/*template */deduce_type<T>::type type;
};

int main(int, char*[])
{
  bar<int>::type a = 1;
  std::cout << a << std::endl;
}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]