-
July 20th, 2013, 10:19 AM
#1
Problem with template class ?
I'm assuming this problem is happening because the classes are template classes. Here's a cut-down version of the code that's giving me the problem:-
Code:
template<typename Time> class Note;
template<typename Time>
class Sequence : virtual public ControlSet {
public:
// c'tors etc
public:
struct EarlierNoteComparator {
inline bool operator()(const boost::shared_ptr< const Note<Time> > a,
const boost::shared_ptr< const Note<Time> > b) const {
return musical_time_less_than (a->time(), b->time());
}
};
typedef typename boost::shared_ptr<Evoral::Note<Time> > NotePtr;
typedef std::multiset<NotePtr, EarlierNoteComparator> Notes;
void set_notes (const Sequence<Time>::Notes& n);
};
Basically, the above code compiles with gcc but when I try to compile it with MSVC (version 8) I get this error at the red line:-
error C2061: syntax error : identifier 'Notes'
Can anyone tell me what the problem is?
"A problem well stated is a problem half solved.” - Charles F. Kettering
-
July 20th, 2013, 11:08 AM
#2
Re: Problem with template class ?
Looks like a case where you need to disambiguate with typename, e.g.,
Code:
void set_notes (const typename Sequence<Time>::Notes& n);
-
July 20th, 2013, 11:19 AM
#3
Re: Problem with template class ?
Thanks Laserlight, you just beat me to it (I just found the same result purely by trial and error!)
"A problem well stated is a problem half solved.” - Charles F. Kettering
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|