Код
class A
{
public:
static void Set( unsigned param )
{
GPIOA->ODR = param;
}
};
template< class ClassTemp1, uint8_t number >
class B
{
public:
enum Config
{
Fisrt,
Second,
};
static void SetConfig( Config param )
{
ClassTemp1::Set( param );
}
template< Config param >
static void SetConfig( )
{
ClassTemp1::Set( param );
}
};
template< class Port >
class C
{
public:
static void Init( )
{
Port::SetConfig< Port::Fisrt >( );
Port::SetConfig( Port::Fisrt );
}
};
typedef B< A, 14 > D;
typedef C< D > Proba;
int main( void )
{
Proba::Init( );
D::SetConfig( D::Fisrt );
D::SetConfig<D::Fisrt>( );
}
{
public:
static void Set( unsigned param )
{
GPIOA->ODR = param;
}
};
template< class ClassTemp1, uint8_t number >
class B
{
public:
enum Config
{
Fisrt,
Second,
};
static void SetConfig( Config param )
{
ClassTemp1::Set( param );
}
template< Config param >
static void SetConfig( )
{
ClassTemp1::Set( param );
}
};
template< class Port >
class C
{
public:
static void Init( )
{
Port::SetConfig< Port::Fisrt >( );
Port::SetConfig( Port::Fisrt );
}
};
typedef B< A, 14 > D;
typedef C< D > Proba;
int main( void )
{
Proba::Init( );
D::SetConfig( D::Fisrt );
D::SetConfig<D::Fisrt>( );
}
Компилятор дает ошибку на строчке с методом Port::SetConfig< Port::Fisrt >( ); в методе C::Init():
compiling main.cpp...
src\main.cpp(99): error: #29: expected an expression
Port::SetConfig< Port::Fisrt >( );
Хотя если напрямую вызывать методы из класса D ошибок нет.
В чем моя ошибка?