Template Syntax Errors

So after using nothing but Visual Studio for a while, it seems that I've developed some dirty syntax that's not actually valid C++, and I seem to be struggling with correcting some templates to compile under G++. There's an entire slew of errors, but the main ones I seem to be struggling with relate directly to the code (and much more similar code) below:

Relevant declarations in String_Strict:
static String_Strict<T> substring(const Jupiter::Readable_String<T> &in, size_t pos);

Relevant declarations in String_Type:
template<template<typename> class R> static R<T> substring(const Jupiter::Readable_String<T> &in, size_t pos);

Relevant implementation:
1
2
3
4
5
template<typename T> Jupiter::String_Strict<T> 
Jupiter::String_Strict<T>::substring(const Jupiter::Readable_String<T> &in, size_t pos)
{
	return Jupiter::String_Type<T>::substring<Jupiter::String_Strict>(in, pos);
}


Where String_Strict, String_Type, and Readable_String are all templates, and String_Type::substring is a template function. String_Strict inherits from String_Type, which in turn inherits from Readable_String. Full source available here: https://github.com/JAJames/Jupiter

What I really need to know is in this small example, where are my syntax errors, and why are they errors?

Thanks for any help!
Last edited on
you should provide a minimal testcase, something that we can try to compile (and fail).

clang tends to have nicer error messages, this is for that snip:
./String_Imp.h:268:34: error: use 'template' keyword to treat 'substring' as a dependent template name
        return Jupiter::String_Type<T>::substring<Jupiter::String_Strict>(in, pos);
                                        ^
                                        template
I think this is the rationale https://isocpp.org/wiki/faq/templates#nondependent-name-lookup-types

As the compiler says, the solution would be writting return Jupiter::String_Type<T>::template substring<Jupiter::String_Strict>(in, pos);
Last edited on
show me the class declaration or the header please.
Marking as solved; part of the issue was that I didn't realize I was using an older version of GCC (I also tried out clang while I was at it). Ultimately, I was just missing a few template keywords here-and-there.
Topic archived. No new replies allowed.