-
January 18th, 2014, 12:59 PM
#1
Dependent types
In the following code where I'm experimenting with dependent types I'm getting these compiler errors:
1>c:\users\tanaka\desktop\scripta\consoleapplication3\consoleapplication3\consoleapplication3.cpp(20): error C2146: syntax error : missing ';' before identifier 'testVal'
1> c:\users\tanaka\desktop\scripta\consoleapplication3\consoleapplication3\consoleapplication3.cpp(29) : see reference to class template instantiation 'tic<testType>' being compiled
1> with
1> [
1> testType=test
1> ]
1>c:\users\tanaka\desktop\scripta\consoleapplication3\consoleapplication3\consoleapplication3.cpp(20): error C2838: 'test_Value' : illegal qualified name in member declaration
1>c:\users\tanaka\desktop\scripta\consoleapplication3\consoleapplication3\consoleapplication3.cpp(20): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int
I'm wondering why this doesn't work. Here is the code:
#include "stdafx.h"
class test
{
public:
int size_type;
int test_Value;
};
template<class testType>
class tic
{
public:
testType t;
typedef typename testType::test_Value testVal;
void function ( ) {
t.size_type;
}
};
int _tmain(int argc, _TCHAR* argv[])
{
tic<test> t;
t.function();
return 0;
}
Tags for this Thread
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
|