Boost logo

Boost :

From: Jeremy Siek (jsiek_at_[hidden])
Date: 2000-12-01 10:22:08


No, Sun 6.0 really does suppose partial spec. and member templates,
at least my version does ;)

CC: Sun WorkShop 6 2000/04/07 C++ 5.1

Or was there some corner case with member templates that
didn't work for you?

The Sun people put a lot of work into version 6. It's
not perfect yet, but it is a BIG improvement over v5.

The following program compiled and executed correctly:

#include <iostream>
#include <string>
#include <vector>

class foo {
public:
  template <class T>
  void bar(T x) { std::cout << x << std::endl; }

  template <class T>
  struct yow {
    void bar(T x) { std::cout << x << std::endl; }
  };

};

template <class T>
class zoo {
public:
  void ooz() { std::cout << "I'm not special!" << std::endl; }
};

template <class T>
class zoo< std::vector<T> >
{
public:
  void ooz() { std::cout << "I'm special!" << std::endl; }
};

int main()
{
  // check member function templates
  foo f;
  std::string x = "Hello world";
  f.bar(x);

  // check member class templates
  foo::yow<std::string> y;
  x = "Hello again";
  y.bar(x);

  // check partial specializations
  zoo< std::vector<int> > z;
  z.ooz();

  return 0;
}

On Fri, 1 Dec 2000, Gregory Seidman wrote:

> Jeremy Siek sez:
> } I think Sun 6.0 does support partial spec and member template. However,
> } its headers still #if-out iterator_traits, so that may cause some
> } problems in places where the wrong boost macro was used.
>
> I'm not entirely sure about partial specialization (I think I used it once,
> but I have been using g++ a lot recently so I may be confused), but it
> definitely does not support member templates.
>
> [...]
> } Jeremy Siek www: http://www.lsc.nd.edu/~jsiek/
> --Greg
>
>
>
>
>

----------------------------------------------------------------------
 Jeremy Siek www: http://www.lsc.nd.edu/~jsiek/
 Ph.D. Candidate email: jsiek_at_[hidden]
 Univ. of Notre Dame work phone: (219) 631-3906
----------------------------------------------------------------------


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