|
Boost : |
From: Jens Maurer (Jens.Maurer_at_[hidden])
Date: 2001-07-09 14:47:38
Eric Ford wrote:
> Presently, I'm having a problem specializing a constructor...
>
> I have the classes
> template<int Dimension, class TraitsType =
> coordinate_system_traits<Dimension> > class CartesianCoordinates;
> template<int Dimension, class TraitsType =
> coordinate_system_traits<Dimension> > class SphericalCoordinates;
>
> Included is a constructor using a template for the argument...
>
> template<template<> class OtherSystemType>
> explicit CartesianCoordinates(OtherSystemType<Dimension,TraitsType>
> const& x) throw();
>
> Now I want to specialize that. Using pseduo-code, I'd like to do
> something like:
>
> template<class TraitsT>
> CartesianCoordinates<3,TraitsT >(SphericalCoordinate<3,TraitsT>
> const& x)
> { ... }
This appears not to be a specialization. The unspecialized constructor
appears to re-use the Dimension and TraitsType from the surrounding
class template. Your "specialization" tries to have the traits
type as a template parameter in the function template.
You may want to factor common code in a base class and then have
(partially) specialized derived class templates.
Jens Maurer
Boost list run by bdawes at acm.org, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk