Boost logo

Boost Users :

Subject: [Boost-users] C++ gurus - really dumb question regarding partial speciallization.
From: Robert Ramey (ramey_at_[hidden])
Date: 2012-12-19 14:30:48


I've got the following code which fails to compile. I'm really stumped by
this.
I've consulted the standard document on the subject and for the life of me
I can't see anything wrong with it. It fails with the same message on vc
9.0
as well as gcc 4.5.3. It's so simple it can't be a compiler issue.

I appoligize in advance for spaming the list here - but I'm really, really
stuck.

Robert Ramey

// primary template
template<
  class T,
  int MIN,
  int MAX
>
struct safe_range1{};

// instantiate primary as a test
safe_range1<int, 0, 1> t1;

// partial specialization # 1
template<
  int MIN,
  int MAX
>
struct safe_range1<int, MIN, MAX>{};

// instantiate partial specialization - what the ???
// fails with "too few template parameters" !!!
safe_range1<0, 1> t2;

// partial specialization # 2
template<class T>
struct safe_range1<T, 0, 1> {};

// also fails with "too few template parameters" !!!
safe_range1<int> t3;


Boost-users list run by williamkempf at hotmail.com, kalb at libertysoft.com, bjorn.karlsson at readsoft.com, gregod at cs.rpi.edu, wekempf at cox.net