Help with templates

I'm supposed to edit already built functions to make them into templates. This particular function that I'm having problems with is a constant member function of class "sequence". All other functions work fine, it's just this one that giving me all sorts of weird errors when I try to compile. I'm not sure where I'm going wrong. My code is below

1
2
3
4
5
6
template <typename T>
sequence<T>::value_type sequence<T>::current() const
{
	assert(is_item());
	return data[current_index];
}
Last edited on
We cannot see your errors.
At the very least, sequence<T>::value_type is a dependent name. You need to specifiy that this particular name refers to a type; the compiler doesn't know for sure:
 
typename sequence<T>::value_type

All sorts of weird errors

When asking questions here, you need to post any and all error messages you recieve, verbatim. They very well may appear like gibberish to you, but they aren't.
Last edited on
Topic archived. No new replies allowed.