// Custom includes
#include <sstream>
+#include <boost/static_assert.hpp>
#include "Packets.hh"
#include "../Utils/auto_unit_test.hh"
struct ComplexEmptyAnnotation : senf::ComplexAnnotation
{};
+ struct InvalidAnnotation
+ {
+ std::string value;
+ };
+
}
BOOST_AUTO_UNIT_TEST(packet)
BOOST_CHECK( ! senf::detail::AnnotationIndexer<ComplexEmptyAnnotation>::Small );
}
+#ifdef COMPILE_CHECK
+
+COMPILE_FAIL(invalidAnnotation)
+{
+# ifdef BOOST_HAS_TYPE_TRAITS_INTRINSICS
+
+ senf::Packet packet (FooPacket::create());
+ (void) packet.annotation<InvalidAnnotation>();
+
+# else
+
+ BOOST_STATIC_ASSERT(( false ));
+
+# endif
+}
+
+#endif
+
///////////////////////////////cc.e////////////////////////////////////////
#undef prefix_
#include <vector>
#include <boost/utility.hpp>
#include <boost/type_traits/is_base_of.hpp>
+#include <boost/static_assert.hpp>
#include "../Utils/pool_alloc_mixin.hh"
#include "PacketTypes.hh"
#include "../Utils/singleton.hh"
AnnotationIndexer();
unsigned index_;
static unsigned index();
- static bool const Small = (sizeof(Annotation) <= sizeof(AnnotationEntry)
- && ! boost::is_base_of<ComplexAnnotation, Annotation>::value);
+ static bool const Complex = boost::is_base_of<ComplexAnnotation, Annotation>::value;
+ static bool const Small = (sizeof(Annotation) <= sizeof(AnnotationEntry) && ! Complex);
+
+# ifdef BOOST_HAS_TYPE_TRAITS_INTRINSICS
+
+ BOOST_STATIC_ASSERT(( boost::is_pod<Annotation>::value || Complex ));
+
+# endif
};
template <class Annotation, bool Small = AnnotationIndexer<Annotation>::Small>