Boost C++ Libraries of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of boost. Click here for the latest Boost documentation.

User Defined Specializations

Occationally the end user may need to provide their own specialization for one of the type traits - typically where intrinsic compiler support is required to implement a specific trait fully. These specializations should derive from boost::true_type or boost::false_type as appropriate:

#include <boost/type_traits/is_pod.hpp>
#include <boost/type_traits/is_class.hpp>
#include <boost/type_traits/is_union.hpp>

struct my_pod{};
struct my_union
   char c;
   int i;

namespace boost
   structis_pod<my_pod> : publictrue_type{};
   structis_pod<my_union> : publictrue_type{};
   structis_union<my_union> : publictrue_type{};
   structis_class<my_union> : publicfalse_type{};
Copyright 2000, 2005 Adobe Systems Inc, David Abrahams, Steve Cleary, Beman Dawes, Aleksey Gurtovoy, Howard Hinnant, Jesse Jones, Mat Marcus, Itay Maman, John Maddock, Thorsten Ottosen, Robert Ramey and Jeremy Siek