I'm new in C++ world and I don't understand what's going on when using this structure :
template <typename T>
class NameClass{
.........
};
typedef NameClass<CryptoPP::AES> CryptAES;
//!Typedef for the AES Encryption\Decryption
typedef NameClass<CryptoPP::Blowfish> CryptBlowFish;
//!Typedef for BlowFish Encryption\Decryption
Is there an explanation?
There is very likely also
template< classT >
or template <typename T>
above class NameClass
and this means NameClass is a template, parametrised by the type of encryption it uses, by T
.
read about templates here.
typedef is a keyword in C++. It's purpose is to abbreviate complexed names. In your example
NameClass<CryptoPP::Blowfish>
can be used by a shorthand of CryptBlowFish
because it was typedefed as
typedef NameClass<CryptoPP::Blowfish> CryptBlowFish;
before. So
CryptBlowFish cbf;
is same as
NameClass<CryptoPP::Blowfish> cbf;