epoc32/include/stdapis/boost/ptr_container/nullable.hpp
author William Roberts <williamr@symbian.org>
Wed, 31 Mar 2010 12:33:34 +0100
branchSymbian3
changeset 4 837f303aceeb
permissions -rw-r--r--
Current Symbian^3 public API header files (from PDK 3.0.h)
This is the epoc32/include tree with the "platform" subtrees removed, and
all but a selected few mbg and rsg files removed.
williamr@2
     1
//
williamr@2
     2
// Boost.Pointer Container
williamr@2
     3
//
williamr@2
     4
//  Copyright Thorsten Ottosen 2003-2005. Use, modification and
williamr@2
     5
//  distribution is subject to the Boost Software License, Version
williamr@2
     6
//  1.0. (See accompanying file LICENSE_1_0.txt or copy at
williamr@2
     7
//  http://www.boost.org/LICENSE_1_0.txt)
williamr@2
     8
//
williamr@2
     9
// For more information, see http://www.boost.org/libs/ptr_container/
williamr@2
    10
//
williamr@2
    11
williamr@2
    12
williamr@2
    13
#ifndef BOOST_INDIRECT_CONTAINER_NULLABLE_HPP
williamr@2
    14
#define BOOST_INDIRECT_CONTAINER_NULLABLE_HPP
williamr@2
    15
williamr@2
    16
#if defined(_MSC_VER) && (_MSC_VER >= 1200)
williamr@2
    17
# pragma once
williamr@2
    18
#endif
williamr@2
    19
williamr@2
    20
#include <boost/type_traits/detail/yes_no_type.hpp>
williamr@2
    21
#include <boost/mpl/eval_if.hpp>
williamr@2
    22
#include <boost/mpl/identity.hpp>
williamr@2
    23
#include <boost/config.hpp>
williamr@2
    24
williamr@2
    25
namespace boost
williamr@2
    26
{
williamr@2
    27
    
williamr@2
    28
    template< class T >
williamr@2
    29
    struct nullable
williamr@2
    30
    {
williamr@2
    31
        typedef T type;
williamr@2
    32
    };   
williamr@2
    33
williamr@2
    34
    namespace ptr_container_detail
williamr@2
    35
    {
williamr@2
    36
        template< class T >
williamr@2
    37
        type_traits::yes_type is_nullable( const nullable<T>* );
williamr@2
    38
williamr@2
    39
        type_traits::no_type is_nullable( ... );        
williamr@2
    40
    }
williamr@2
    41
williamr@2
    42
    template< class T >
williamr@2
    43
    struct is_nullable
williamr@2
    44
    {
williamr@2
    45
    private:
williamr@2
    46
            BOOST_STATIC_CONSTANT( T*, var );
williamr@2
    47
    public:
williamr@2
    48
            BOOST_STATIC_CONSTANT(bool, value = sizeof( ptr_container_detail::is_nullable( var ) ) 
williamr@2
    49
                                                == sizeof( type_traits::yes_type ) );
williamr@2
    50
    };
williamr@2
    51
    
williamr@2
    52
    template< class T >
williamr@2
    53
    struct remove_nullable
williamr@2
    54
    {
williamr@2
    55
        typedef BOOST_DEDUCED_TYPENAME mpl::eval_if< is_nullable<T>,
williamr@2
    56
                                                      T,
williamr@2
    57
                                            mpl::identity<T> >::type
williamr@2
    58
            type;
williamr@2
    59
    };
williamr@2
    60
williamr@2
    61
}
williamr@2
    62
williamr@2
    63
#endif