In my program, I have to create an object that looks like this:
Library::Param1<Library::Param2>::Param3 (I donβt know what to call Param , perhaps types?) Similar to std::vector<std::string>::iterator .
So these Param need to be changed line by line. For instance:
if(param1 == "1_VALUE1") { if(param2 == "2_VALUE1") { MyLib::1_VALUE1<MyLib::2_VALUE1>::Param3 obj; //Obj is used } //15+ similar if-statements, where only 2_VALUE1 changes } /*15+ similar if-statements, where only 1_VALUE1 changes, but the contents remain same (again 15+ if-statements)*/
using namespace MyLib; not unclassified.
So, I need to reduce the number of these if statements, but I don't know how to do this. I think this can be done using templates, but I am not familiar with them, so I think I will need a sample code.
Sorry for poor English, if you need more information - let me know. Thanks.
--- EDIT: library type definitions (CryptoPP):
Since errors refer only to Param1, exposing one of them:
//! CBC mode with ciphertext stealing template <class CIPHER> struct CBC_CTS_Mode : public CipherModeDocumentation { typedef CipherModeFinalTemplate_CipherHolder<CPP_TYPENAME CIPHER::Encryption, CBC_CTS_Encryption> Encryption; typedef CipherModeFinalTemplate_CipherHolder<CPP_TYPENAME CIPHER::Decryption, CBC_CTS_Decryption> Decryption; };
user380041
source share