Image

Listens: Infected Mushroom - Elation Station

Templated full template specialisations

Ok, I'm not sure this is possible, so please tell me if it isn't, but I want to write a full template specialisation that is itself dependent on a templated type. Can it be done?


So this is class elmnt_Metropolis:

		template<typename _Likelihood=Likelihood<double, double, double> >

		class elmnt_Metropolis : public Element<_Likelihood>
		{
			public:

			array<double>	jump_spec;

			random_num_gen	*rng_jump;
			random_num_gen	*rng_accept;

			elmnt_Metropolis() : rng_jump(NULL), rng_accept(NULL) {}
			elmnt_Metropolis( random_num_gen *one, random_num_gen *two, array<double> &_jump_spec );

			virtual ~elmnt_Metropolis(){}

			virtual	bool	jump();	//The function that makes the element think about moving (returns true if it did, false if it didn't)

		};


which has a member function called jump. I want to overide this for a class LogLikelihood which is identical to Likelihood (three template parameters, shown in the default argument to elmnt_Metropolis).

I have done this thinking it might do what I want:

		template<>
			template<typename _param_type, typename _value_type, typename _arg_type>

		bool	elmnt_Metropolis< LogLikelihood<_param_type, _value_type, _arg_type> >::jump()
		{

			//...
		}


and got this:

../../../LALpp/mcmctl/elmnt_Metropolis.hpp:101: error: no member function 'jump' declared in 'LALpp::mcmctl::elmnt_Metropolis<LALpp::mcmctl::LogLikelihood<_param_type, _value_type, _arg_type> >'
../../../LALpp/mcmctl/elmnt_Metropolis.hpp:101: error: invalid function declaration


Can I do this? What am I doing wrong if I can? And even if it can't be done, what does that error message mean (beyond the glaringly obvious)? Thanks in advance.