
on Tue May 20 2008, "Robert Ramey" <ramey-AT-rrsd.com> wrote:
Hartmut Kaiser wrote:
Hi all,
while trying to add serialization support for fusion sequences I came across the need to figure out whether a given type actually is an archive. Is there a boost::serialization::is_archive<> metafunction available? And if not, what's the best way to implement this?
Hmmm - I chuckled when I read this. It seems that I would be asking you this question rather than the other way around.
Giving it a tiny bit of thought leads me to wonder:
First thought is one could use something like is_base_derived to verify that it derived from from one of the common base classes. This solution would probably be sufficient for most practical purposes.
But, it seems to me that the real thing would be:
models_archive_concept<T>
Which is really piques my interest and curiousity. It would be a general thing like
models_concept<T, C> where C is some sort of "conept type"
Food for thought for those with time on thier hands.
You can only implement the above for a very limited number of _syntactic_ concepts in C++03 and unintentional syntactic conformance can easily be catastrophically mistaken for actual semantic conformance (e.g. there are input iterators that have the syntactic properties of forward iterators, which causes crashes and worse in real STL code). In C++0x of course we have real concepts, but for reasons noted above explicitly-declared conformance plays an important role so I'm afraid that doesn't get you off the hook, Robert ;-) -- Dave Abrahams BoostPro Computing http://www.boostpro.com