4 // Fraunhofer Institute for Open Communication Systems (FOKUS)
5 // Competence Center NETwork research (NET), St. Augustin, GERMANY
6 // Stefan Bund <g0dil@berlios.de>
8 // This program is free software; you can redistribute it and/or modify
9 // it under the terms of the GNU General Public License as published by
10 // the Free Software Foundation; either version 2 of the License, or
11 // (at your option) any later version.
13 // This program is distributed in the hope that it will be useful,
14 // but WITHOUT ANY WARRANTY; without even the implied warranty of
15 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 // GNU General Public License for more details.
18 // You should have received a copy of the GNU General Public License
19 // along with this program; if not, write to the
20 // Free Software Foundation, Inc.,
21 // 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
24 \brief type_traits Boost.Preprocesser external iteration include */
26 #if !BOOST_PP_IS_ITERATING && !defined(MPP_type_traits_)
27 #define MPP_type_traits_ 1
30 #include <boost/preprocessor/iteration/iterate.hpp>
31 #include <boost/preprocessor/repetition/enum.hpp>
32 #include <boost/preprocessor/cat.hpp>
33 #include <boost/preprocessor/arithmetic/inc.hpp>
34 #include <boost/preprocessor/repetition/repeat_from_to.hpp>
35 #include <boost/preprocessor/punctuation/comma_if.hpp>
36 #include <boost/preprocessor/arithmetic/dec.hpp>
37 #include <boost/preprocessor/repetition/enum_trailing_params.hpp>
38 #include <boost/preprocessor/repetition/enum_params.hpp>
40 // ///////////////////////////mpp.p////////////////////////////////////////
41 #elif BOOST_PP_IS_ITERATING // ////////////////////////////////////////////
42 // ////////////////////////////////////////////////////////////////////////
45 #define mpp_Arg(n) BOOST_PP_CAT(BOOST_PP_CAT(arg, BOOST_PP_INC(n)), _type)
47 #define mpp_OtherArgs_(z,n,d) BOOST_PP_COMMA_IF( BOOST_PP_DEC(n) ) typename traits::mpp_Arg(n)
48 #define mpp_OtherArgs() BOOST_PP_REPEAT_FROM_TO( 1, BOOST_PP_ITERATION(), mpp_OtherArgs_, _ )
50 #define mpp_ArgN() BOOST_PP_ITERATION()
51 #define mpp_CurArg() mpp_Arg(BOOST_PP_ITERATION())
53 #define mpp_TrailTplArgs() BOOST_PP_ENUM_TRAILING_PARAMS( BOOST_PP_ITERATION(), class A )
54 #define mpp_Args() BOOST_PP_ENUM_PARAMS( BOOST_PP_ITERATION(), A )
56 // ////////////////////////////////////////////////////////////////////////
57 #if BOOST_PP_ITERATION_FLAGS()==1 // //////////////////////////////////////
58 // ////////////////////////////////////////////////////////////////////////
60 template <class Traits>
61 struct function_traits_remove_arg<Traits, mpp_ArgN()>
63 typedef Traits traits;
64 typedef boost::function_traits<typename traits::result_type( mpp_OtherArgs() )> type;
67 template < class C, class RV mpp_TrailTplArgs()>
68 struct remove_member_pointer<RV (C::*)(mpp_Args())>
70 typedef RV type (mpp_Args());
73 template < class C, class RV mpp_TrailTplArgs() >
74 struct member_class<RV (C::*)(mpp_Args())>
79 template <class Traits>
80 struct function_traits_arg_type<Traits, mpp_ArgN(), true>
82 typedef typename Traits::mpp_CurArg() type;
85 template <class C, class T mpp_TrailTplArgs() >
86 struct remove_member_pointer <T (C::*)( mpp_Args() ) const>
88 typedef T type (mpp_Args());
91 template <class C, class T mpp_TrailTplArgs() >
92 struct remove_member_pointer <T (C::* const)( mpp_Args() ) const>
94 typedef T type (mpp_Args());
97 // ////////////////////////////////////////////////////////////////////////
98 #endif // /////////////////////////////////////////////////////////////////
99 // ////////////////////////////////////////////////////////////////////////
100 // Undefine local Macros
103 #undef mpp_TrailTplArgs
107 #undef mpp_OtherArgs_
110 // ////////////////////////////////////////////////////////////////////////
112 (save-excursion (re-search-backward "^// Undefine local Macros")
113 (forward-line 1) (delete-region (point) (progn (search-forward
114 "// ////") (forward-line -1) (point))) (insert "\n") (let ((b (point))
115 (e (progn (insert (save-excursion (re-search-backward
116 "^// Local Macros") (search-forward "#define") (beginning-of-line)
117 (buffer-substring (point) (progn (search-forward "// ////")
118 (search-backward "#define") (forward-line 1) (point))))) (point))))
119 (reverse-region b e) (shell-command-on-region b e "grep -F '#define'" nil
120 t) (goto-char b) (while (looking-at "#define") (delete-char 7) (insert
121 "#undef") (skip-chars-forward " ") (re-search-forward "[^a-zA-Z0-9_]")
122 (delete-region (1- (point)) (progn (end-of-line) (point))) (forward-line
125 #endif // /////////////////////////////////////////////////////////////////
126 // ///////////////////////////mpp.e////////////////////////////////////////
132 // comment-column: 40
133 // c-file-style: "senf"
134 // indent-tabs-mode: nil
135 // ispell-local-dictionary: "american"
136 // compile-command: "scons -u test"