extension.hpp

来自「Boost provides free peer-reviewed portab」· HPP 代码 · 共 69 行

HPP
69
字号
/*=============================================================================    Copyright (c) 2001-2007 Joel de Guzman    Copyright (c) 2005-2006 Dan Marsden    Distributed under the Boost Software License, Version 1.0. (See accompanying    file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)==============================================================================*/#if !defined(FUSION_STRUCT_EXTENSION_APRIL_2_2007_1008AM)#define FUSION_STRUCT_EXTENSION_APRIL_2_2007_1008AM#include <boost/type_traits/add_const.hpp>namespace boost { namespace fusion { namespace extension{    template <typename Struct, int N>    struct struct_member;    template <typename Struct>    struct struct_size;    template <typename Struct, int N>    struct struct_member<Struct const, N>    {        typedef typename            add_const<typename struct_member<Struct, N>::type>::type        type;        static type&        call(Struct const& struct_)        {            return struct_member<Struct, N>::call(                const_cast<Struct&>(struct_));        }    };    template <typename Struct>    struct struct_size<Struct const>        : struct_size<Struct>    {};    struct no_such_member;    template<typename Struct, typename Key>    struct struct_assoc_member    {        typedef no_such_member type;    };    template<typename Struct, typename Key>    struct struct_assoc_member<Struct const, Key>    {        typedef typename            add_const<typename struct_assoc_member<Struct, Key>::type>::type        type;        static type&        call(Struct const& struct_)        {            return struct_assoc_member<Struct, Key>::call(                const_cast<Struct&>(struct_));        }    };}}}#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?