This is a fragment of a class template that causes compilation errors:
template<class TKey, class TVal, class key_traits, class val_traits>
template<class TSecKey, class sktraits>
class CBtreeDb<TKey, TVal, key_traits, val_traits>::CDbSecondaryIndex: protected CBtreeDb<TKey, TVal>, public IDeallocateKey
{
public:
typedef TSecKey skey_type;
typedef typename sktraits skey_traits;
typedef CNewDbt<TSecKey, sktraits> CDbSKey;
typedef typename iterator_t<TSecKey, skey_traits> iterator;
typedef typename iter_lower_bound_t<skey_type> iter_lower_bound;
typedef typename iter_upper_bound_t<skey_type> iter_upper_bound;
CDbSecondaryIndex(CDbEnv* pEnv, u_int32_t flags, bool bAllowDuplicates=false):
CBtreeDb(pEnv, flags, bAllowDuplicates)
{
}
};
The compiler error message I get:
expected nested-name-specifier before 'sktraits'.
Actually, this error occurs in every ad typedef, followed bytypename
I have successfully compiled this code in the past using VS2005 and VS2008 on XP.
I am currently building Ubuntu 9.10 using gcc 4.4.1
I looked at this error on Google and it seems that the line (where the error occurs) is typenamenot required, since the standard assumption is that the identifier at this position is a type. g ++ seems to be complaining because it expects any declaration typenameto be qualified (i.e. A :: B).
- , " " typename?
, ?