@Bass: You can sort of fake attributes in C++ with template specializations, e.g. a hypothetical C++ equivalent of SerializableAttribute would be something like this:
template<typename T>
struct is_serializable
{
static const bool value = false;
};
// Indicate Foo is serializable
template<>
struct is_serializable<Foo>
{
static const bool value = true;
};For this particular situation I'd probably use some of the C++ library to turn it into a one liner:
template<typename T> struct is_serializable : public std::false_type { };
template<> struct is_serializable<Foo> : public std::true_type { };Which then allows you to do something like:
if( is_serializable<SomeType>::value )
// Do serialization
else
throw std::runtime_error("Not serializable");Of course, actually doing the serialization requires you to write code for each serializable type due to the lack of reflection. 
Thread Closed
This thread is kinda stale and has been closed but if you'd like to continue the conversation, please create a new thread in our Forums,
or Contact Us and let us know.