explicit specialization

error C2912: explicit specialization; 'void bdi<box>(box &,box &)' is not a specialization of a function template.

  template <typename T> T bdi(T a, T b);
  template <> void bdi<box>(box & a, box & b);

box is a struct type. And where wrong?
Functions have overloading.
void bdi( box & a, box & b );
i found it. the return type and argument problem.
Last edited on
I would've thought it's because you're passing a reference in your attempt at a specialisation.
it's because the T should be box&, and in <> i give "box", so it's not consistent.
another problem is that the return type, explicit and original template should be consistent, in my opinion.

template <typename T> T bdi(T, T);
template <> box& bdi<box&>(box& a, box& b);

template <typename T> T bdi(T&, T&);
template <> box bdi<box>(box&, box&);
Last edited on
Overload, don't specialize:

template <typename T> T bdi(T a, T b);
void bdi(box & a, box & b);

ok, i'll check it later, dinner time :)
Topic archived. No new replies allowed.