mardi 24 février 2015

Is it possible to have a branch of code conditionally be compiled in C++?

Title says it all really. Sample code which illustrates the spirit of the affaire:



if( std::is_constructible<T, unsigned long>::value )
{
unsigned long identity = collection.rbegin()->first + 1;
std::shared_ptr<T> newObject(new T(identity));

collection.insert( identity , newObject );
return true;
}
else
{
return false;
}

Aucun commentaire:

Enregistrer un commentaire