From 4ad98338dd448bc1a5ae0867e0053e779ea15734 Mon Sep 17 00:00:00 2001 From: Aleksey Gurtovoy Date: Mon, 9 Dec 2002 05:10:33 +0000 Subject: [PATCH] add BOOST_MPL_AUX_NTTP_DECL macro [SVN r16554] --- include/boost/mpl/aux_/config/msvc.hpp | 23 +++++++ .../mpl/aux_/config/{ntp.hpp => nttp.hpp} | 64 +++++++++---------- .../boost/mpl/aux_/config/static_constant.hpp | 25 ++++++++ 3 files changed, 79 insertions(+), 33 deletions(-) create mode 100644 include/boost/mpl/aux_/config/msvc.hpp rename include/boost/mpl/aux_/config/{ntp.hpp => nttp.hpp} (50%) create mode 100644 include/boost/mpl/aux_/config/static_constant.hpp diff --git a/include/boost/mpl/aux_/config/msvc.hpp b/include/boost/mpl/aux_/config/msvc.hpp new file mode 100644 index 0000000..aa559ca --- /dev/null +++ b/include/boost/mpl/aux_/config/msvc.hpp @@ -0,0 +1,23 @@ +//----------------------------------------------------------------------------- +// boost mpl/aux_/config/msvc.hpp header file +// See http://www.boost.org for updates, documentation, and revision history. +//----------------------------------------------------------------------------- +// +// Copyright (c) 2000-02 +// Aleksey Gurtovoy +// +// Permission to use, copy, modify, distribute and sell this software +// and its documentation for any purpose is hereby granted without fee, +// provided that the above copyright notice appears in all copies and +// that both the copyright notice and this permission notice appear in +// supporting documentation. No representations are made about the +// suitability of this software for any purpose. It is provided "as is" +// without express or implied warranty. + +#ifndef BOOST_MPL_AUX_CONFIG_MSVC_HPP_INCLUDED +#define BOOST_MPL_AUX_CONFIG_MSVC_HPP_INCLUDED + +// BOOST_MSVC is defined here: +#include "boost/config.hpp" + +#endif // BOOST_MPL_AUX_CONFIG_MSVC_HPP_INCLUDED diff --git a/include/boost/mpl/aux_/config/ntp.hpp b/include/boost/mpl/aux_/config/nttp.hpp similarity index 50% rename from include/boost/mpl/aux_/config/ntp.hpp rename to include/boost/mpl/aux_/config/nttp.hpp index 039d028..9b27c5b 100644 --- a/include/boost/mpl/aux_/config/ntp.hpp +++ b/include/boost/mpl/aux_/config/nttp.hpp @@ -1,5 +1,5 @@ //----------------------------------------------------------------------------- -// boost mpl/aux_/config/ntp.hpp header file +// boost mpl/aux_/config/nttp.hpp header file // See http://www.boost.org for updates, documentation, and revision history. //----------------------------------------------------------------------------- // @@ -14,43 +14,41 @@ // suitability of this software for any purpose. It is provided "as is" // without express or implied warranty. -#ifndef BOOST_MPL_AUX_CONFIG_NTP_HPP_INCLUDED -#define BOOST_MPL_AUX_CONFIG_NTP_HPP_INCLUDED +#ifndef BOOST_MPL_AUX_CONFIG_NTTP_HPP_INCLUDED +#define BOOST_MPL_AUX_CONFIG_NTTP_HPP_INCLUDED -#include "boost/config.hpp" +#include "boost/mpl/aux_/config/msvc.hpp" // MSVC 6.5 ICE-s on the code as simple as this: -/* - namespace std { - template< typename Char > struct string; - } - - void foo(std::string); - - namespace boost { - namespace mpl { - - template< int > struct arg; - - }} -*/ -// the only way to get around the bug is to replace the normal non-type -// template parameter ('int', 'long', etc.) by an 'enum' type +// +// namespace std { +// template< typename Char > struct string; +// } +// +// void foo(std::string); +// +// namespace boost { namespace mpl { +// template< int > struct arg; +// }} +// +// fortunately, a workaround is simple as well: +// +// typedef int nttp_int; +// template< nttp_int > struct arg; #if defined(BOOST_MSVC) && BOOST_MSVC < 1300 -namespace boost { namespace mpl { namespace aux { -enum ntp { max_value = 0xffffffff }; -}}} - -# define BOOST_MPL_AUX_NTP_DECL(T, x) aux::ntp x /**/ -# define BOOST_MPL_AUX_NTP_VALUE(n) aux::ntp(n) /**/ - -#else - -# define BOOST_MPL_AUX_NTP_DECL(T, x) T x /**/ -# define BOOST_MPL_AUX_NTP_VALUE(n) n /**/ - +#if !defined(BOOST_MPL_PREPROCESSING_MODE) +namespace boost { namespace mpl { +typedef int nttp_int; +typedef long nttp_long; +}} #endif -#endif // BOOST_MPL_AUX_CONFIG_NTP_HPP_INCLUDED +# define BOOST_MPL_AUX_NTTP_DECL(T, x) nttp_##T x /**/ + +#else +# define BOOST_MPL_AUX_NTTP_DECL(T, x) T x /**/ +#endif + +#endif // BOOST_MPL_AUX_CONFIG_NTTP_HPP_INCLUDED diff --git a/include/boost/mpl/aux_/config/static_constant.hpp b/include/boost/mpl/aux_/config/static_constant.hpp new file mode 100644 index 0000000..ae94fc6 --- /dev/null +++ b/include/boost/mpl/aux_/config/static_constant.hpp @@ -0,0 +1,25 @@ +//----------------------------------------------------------------------------- +// boost mpl/aux_/config/static_constant.hpp header file +// See http://www.boost.org for updates, documentation, and revision history. +//----------------------------------------------------------------------------- +// +// Copyright (c) 2000-02 +// Aleksey Gurtovoy +// +// Permission to use, copy, modify, distribute and sell this software +// and its documentation for any purpose is hereby granted without fee, +// provided that the above copyright notice appears in all copies and +// that both the copyright notice and this permission notice appear in +// supporting documentation. No representations are made about the +// suitability of this software for any purpose. It is provided "as is" +// without express or implied warranty. + +#ifndef BOOST_MPL_AUX_CONFIG_STATIC_CONSTANT_HPP_INCLUDED +#define BOOST_MPL_AUX_CONFIG_STATIC_CONSTANT_HPP_INCLUDED + +#if !defined(BOOST_MPL_PREPROCESSING_MODE) +// BOOST_STATIC_CONSTANT is defined here: +# include "boost/config.hpp" +#endif + +#endif // BOOST_MPL_AUX_CONFIG_STATIC_CONSTANT_HPP_INCLUDED