| Home | Libraries | People | FAQ | More

## 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
    {
       template<>
       struct is_pod<my_pod> : public true_type{};

       template<>
       struct is_pod<my_union> : public true_type{};

       template<>
       struct is_union<my_union> : public true_type{};

       template<>
       struct is_class<my_union> : public false_type{};
    }