Context
I oftenly use UUID implementation of Boost library to identify derived classes.
To do so I usually use the following :
In the declaration file :
#include "ClassA.h"
#include <boost/uuid/uuid.hpp>
class SubClass1 : public ClassA {
public:
static const boost::uuids::uuid classId; // 7feb24af-fc38-44de-bc38-04defc3804de
...
};
In the implementation file :
#include "SubClass1.h"
#include <boost/uuids/uuid_generator.h>
const boost::uuids::uuid SubClass1 ::classId = boost::uuids::string_generator()("{7feb24af-fc38-44de-bc38-04defc3804de}");
...
Question
I would like to know if it is possible to assign a value to the UUID in the declaration file.
Ideas
At first, I thought it was possible because Boost implementation is POD. Therefore I tried several ways to assign a value directly in the header using aggregate initializers (see boost documentation for an example of non static aggregate initializers) :
static const boost::uuids::uuid classId = { 0x7f, 0xeb, ... };
Unfortunately, it failed at compilation (the compiler can only initialize static const integral type).
Have you any suggestions to solve this issue, preferably using the Boost implementation of UUIDs ?