From c852ca8d41967aad5a6751a229fe25c6939230ea Mon Sep 17 00:00:00 2001 From: Aleksey Gurtovoy Date: Sat, 3 May 2003 02:07:24 +0000 Subject: [PATCH] set stub implementation [SVN r18340] --- include/boost/mpl/aux_/has_key_impl.hpp | 38 ++++++++++++++++ include/boost/mpl/aux_/ice_cast.hpp | 2 +- include/boost/mpl/aux_/integral_wrapper.hpp | 14 +++--- include/boost/mpl/aux_/static_cast.hpp | 31 +++++++++++++ include/boost/mpl/has_key.hpp | 45 +++++++++++++++++++ include/boost/mpl/has_key_fwd.hpp | 29 ++++++++++++ include/boost/mpl/if.hpp | 8 ++-- include/boost/mpl/set/aux_/has_key_impl.hpp | 49 +++++++++++++++++++++ include/boost/mpl/set/aux_/set0.hpp | 34 ++++++++++++++ include/boost/mpl/set/aux_/tag.hpp | 27 ++++++++++++ include/boost/mpl/set/set0.hpp | 37 ++++++++++++++++ 11 files changed, 302 insertions(+), 12 deletions(-) create mode 100644 include/boost/mpl/aux_/has_key_impl.hpp create mode 100644 include/boost/mpl/aux_/static_cast.hpp create mode 100644 include/boost/mpl/has_key.hpp create mode 100644 include/boost/mpl/has_key_fwd.hpp create mode 100644 include/boost/mpl/set/aux_/has_key_impl.hpp create mode 100644 include/boost/mpl/set/aux_/set0.hpp create mode 100644 include/boost/mpl/set/aux_/tag.hpp create mode 100644 include/boost/mpl/set/set0.hpp diff --git a/include/boost/mpl/aux_/has_key_impl.hpp b/include/boost/mpl/aux_/has_key_impl.hpp new file mode 100644 index 0000000..b57c82f --- /dev/null +++ b/include/boost/mpl/aux_/has_key_impl.hpp @@ -0,0 +1,38 @@ + +#ifndef BOOST_MPL_AUX_HAS_KEY_IMPL_HPP_INCLUDED +#define BOOST_MPL_AUX_HAS_KEY_IMPL_HPP_INCLUDED + +// + file: boost/mpl/aux_/has_key_impl.hpp +// + last modified: 02/may/03 + +// Copyright (c) 2002-03 +// David Abrahams, 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. +// +// See http://www.boost.org/libs/mpl for documentation. + +#include "boost/mpl/has_key_fwd.hpp" +#include "boost/mpl/aux_/traits_lambda_spec.hpp" + +namespace boost { +namespace mpl { + +// no default implementation; the definition is needed to make MSVC happy + +template< typename Tag > struct has_key_impl +{ + template< typename AssociativeSequence, typename Key > struct apply; +}; + +BOOST_MPL_ALGORITM_TRAITS_LAMBDA_SPEC(2,has_key_impl) + +}} + +#endif // BOOST_MPL_AUX_HAS_KEY_IMPL_HPP_INCLUDED diff --git a/include/boost/mpl/aux_/ice_cast.hpp b/include/boost/mpl/aux_/ice_cast.hpp index ffa6226..e5faa25 100644 --- a/include/boost/mpl/aux_/ice_cast.hpp +++ b/include/boost/mpl/aux_/ice_cast.hpp @@ -21,7 +21,7 @@ #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x561)) \ || BOOST_WORKAROUND(__GNUC__, < 3) -# define BOOST_MPL_AUX_ICE_CAST(T, expr) T(expr) +# define BOOST_MPL_AUX_ICE_CAST(T, expr) (T)(expr) #elif BOOST_WORKAROUND(__MWERKS__, <= 0x3001) # define BOOST_MPL_AUX_ICE_CAST(T, expr) (T)(expr) #else diff --git a/include/boost/mpl/aux_/integral_wrapper.hpp b/include/boost/mpl/aux_/integral_wrapper.hpp index da37219..cf80022 100644 --- a/include/boost/mpl/aux_/integral_wrapper.hpp +++ b/include/boost/mpl/aux_/integral_wrapper.hpp @@ -17,7 +17,7 @@ // no include guards, the header is intended for multiple inclusion! -#include "boost/mpl/aux_/ice_cast.hpp" +#include "boost/mpl/aux_/static_cast.hpp" #include "boost/mpl/aux_/config/nttp.hpp" #include "boost/mpl/aux_/config/static_constant.hpp" #include "boost/mpl/aux_/config/workaround.hpp" @@ -60,19 +60,19 @@ struct AUX_WRAPPER_NAME // either #if BOOST_WORKAROUND(__EDG_VERSION__, <= 243) private: - BOOST_STATIC_CONSTANT(AUX_WRAPPER_VALUE_TYPE, next_value = BOOST_MPL_AUX_ICE_CAST(AUX_WRAPPER_VALUE_TYPE, (N + 1))); - BOOST_STATIC_CONSTANT(AUX_WRAPPER_VALUE_TYPE, prior_value = BOOST_MPL_AUX_ICE_CAST(AUX_WRAPPER_VALUE_TYPE, (N - 1))); + BOOST_STATIC_CONSTANT(AUX_WRAPPER_VALUE_TYPE, next_value = BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (N + 1))); + BOOST_STATIC_CONSTANT(AUX_WRAPPER_VALUE_TYPE, prior_value = BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (N - 1))); public: typedef AUX_WRAPPER_INST(next_value) next; typedef AUX_WRAPPER_INST(prior_value) prior; #elif BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x561)) \ || BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(502)) \ || BOOST_WORKAROUND(__HP_aCC, BOOST_TESTED_AT(53800)) - typedef AUX_WRAPPER_INST( BOOST_MPL_AUX_ICE_CAST(AUX_WRAPPER_VALUE_TYPE, (N + 1)) ) next; - typedef AUX_WRAPPER_INST( BOOST_MPL_AUX_ICE_CAST(AUX_WRAPPER_VALUE_TYPE, (N - 1)) ) prior; + typedef AUX_WRAPPER_INST( BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (N + 1)) ) next; + typedef AUX_WRAPPER_INST( BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (N - 1)) ) prior; #else - typedef AUX_WRAPPER_INST( BOOST_MPL_AUX_ICE_CAST(AUX_WRAPPER_VALUE_TYPE, (value + 1)) ) next; - typedef AUX_WRAPPER_INST( BOOST_MPL_AUX_ICE_CAST(AUX_WRAPPER_VALUE_TYPE, (value - 1)) ) prior; + typedef AUX_WRAPPER_INST( BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (value + 1)) ) next; + typedef AUX_WRAPPER_INST( BOOST_MPL_AUX_STATIC_CAST(AUX_WRAPPER_VALUE_TYPE, (value - 1)) ) prior; #endif // enables uniform function call syntax for families of overloaded diff --git a/include/boost/mpl/aux_/static_cast.hpp b/include/boost/mpl/aux_/static_cast.hpp new file mode 100644 index 0000000..dcb5be8 --- /dev/null +++ b/include/boost/mpl/aux_/static_cast.hpp @@ -0,0 +1,31 @@ + +#ifndef BOOST_MPL_AUX_STATIC_CAST_HPP_INCLUDED +#define BOOST_MPL_AUX_STATIC_CAST_HPP_INCLUDED + +// + file: boost/mpl/aux_/static_cast.hpp +// + last modified: 02/may/03 + +// Copyright (c) 2001-03 +// 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. +// +// See http://www.boost.org/libs/mpl for documentation. + +#include "boost/mpl/aux_/config/workaround.hpp" + +#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x561)) \ + || BOOST_WORKAROUND(__GNUC__, < 3) \ + || BOOST_WORKAROUND(__MWERKS__, <= 0x3001) +# define BOOST_MPL_AUX_STATIC_CAST(T, expr) (T)(expr) +#else +# define BOOST_MPL_AUX_STATIC_CAST(T, expr) static_cast(expr) +#endif + +#endif // BOOST_MPL_AUX_STATIC_CAST_HPP_INCLUDED diff --git a/include/boost/mpl/has_key.hpp b/include/boost/mpl/has_key.hpp new file mode 100644 index 0000000..59aad4b --- /dev/null +++ b/include/boost/mpl/has_key.hpp @@ -0,0 +1,45 @@ + +#ifndef BOOST_MPL_HAS_KEY_HPP_INCLUDED +#define BOOST_MPL_HAS_KEY_HPP_INCLUDED + +// + file: boost/mpl/has_key.hpp +// + last modified: 02/may/03 + +// Copyright (c) 2002-03 +// David Abrahams, 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. +// +// See http://www.boost.org/libs/mpl for documentation. + +#include "boost/mpl/has_key_fwd.hpp" +#include "boost/mpl/aux_/has_key_impl.hpp" +#include "boost/mpl/aux_/sequence_tag.hpp" +#include "boost/mpl/aux_/void_spec.hpp" +#include "boost/mpl/aux_/lambda_support.hpp" + +namespace boost { +namespace mpl { + +template< + typename BOOST_MPL_AUX_VOID_SPEC_PARAM(AssociativeSequence) + , typename BOOST_MPL_AUX_VOID_SPEC_PARAM(Key) + > +struct has_key + : has_key_impl< typename BOOST_MPL_AUX_SEQUENCE_TAG(AssociativeSequence) > + ::template apply +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT(2,has_key,(AssociativeSequence,Key)) +}; + +BOOST_MPL_AUX_VOID_SPEC(2, has_key) + +}} + +#endif // BOOST_MPL_HAS_KEY_HPP_INCLUDED diff --git a/include/boost/mpl/has_key_fwd.hpp b/include/boost/mpl/has_key_fwd.hpp new file mode 100644 index 0000000..3b6c5fb --- /dev/null +++ b/include/boost/mpl/has_key_fwd.hpp @@ -0,0 +1,29 @@ + +#ifndef BOOST_MPL_HAS_KEY_FWD_HPP_INCLUDED +#define BOOST_MPL_HAS_KEY_FWD_HPP_INCLUDED + +// + file: boost/mpl/has_key_fwd.hpp +// + last modified: 02/may/03 + +// Copyright (c) 2002-03 +// David Abrahams, 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. +// +// See http://www.boost.org/libs/mpl for documentation. + +namespace boost { +namespace mpl { + +template< typename Tag > struct has_key_impl; +template< typename AssociativeSequence, typename Key > struct has_key; + +}} + +#endif // BOOST_MPL_HAS_KEY_FWD_HPP_INCLUDED diff --git a/include/boost/mpl/if.hpp b/include/boost/mpl/if.hpp index 0348d85..559f16e 100644 --- a/include/boost/mpl/if.hpp +++ b/include/boost/mpl/if.hpp @@ -18,7 +18,7 @@ // See http://www.boost.org/libs/mpl for documentation. #include "boost/mpl/aux_/value_wknd.hpp" -#include "boost/mpl/aux_/ice_cast.hpp" +#include "boost/mpl/aux_/static_cast.hpp" #include "boost/mpl/aux_/void_spec.hpp" #include "boost/mpl/aux_/lambda_support.hpp" #include "boost/mpl/aux_/config/workaround.hpp" @@ -65,7 +65,7 @@ struct if_ #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x561)) BOOST_MPL_AUX_VALUE_WKND(C)::value #else - BOOST_MPL_AUX_ICE_CAST(bool, BOOST_MPL_AUX_VALUE_WKND(C)::value) + BOOST_MPL_AUX_STATIC_CAST(bool, BOOST_MPL_AUX_VALUE_WKND(C)::value) #endif , T1 , T2 @@ -205,7 +205,7 @@ struct if_ enum { c_ = C_::value }; public: - typedef typename answer< BOOST_MPL_AUX_ICE_CAST(bool, c_) >::type type; + typedef typename answer< BOOST_MPL_AUX_STATIC_CAST(bool, c_) >::type type; BOOST_MPL_AUX_LAMBDA_SUPPORT(3,if_,(C_,T1,T2)) }; @@ -256,7 +256,7 @@ template< > struct if_ { - typedef typename aux::if_impl< BOOST_MPL_AUX_ICE_CAST(bool, C::value) > + typedef typename aux::if_impl< BOOST_MPL_AUX_STATIC_CAST(bool, C::value) > ::template result_::type type; BOOST_MPL_AUX_LAMBDA_SUPPORT(3,if_,(C,T1,T2)) diff --git a/include/boost/mpl/set/aux_/has_key_impl.hpp b/include/boost/mpl/set/aux_/has_key_impl.hpp new file mode 100644 index 0000000..7c781f2 --- /dev/null +++ b/include/boost/mpl/set/aux_/has_key_impl.hpp @@ -0,0 +1,49 @@ + +#ifndef BOOST_MPL_SET_AUX_HAS_KEY_IMPL_HPP_INCLUDED +#define BOOST_MPL_SET_AUX_HAS_KEY_IMPL_HPP_INCLUDED + +// + file: boost/mpl/aux_/has_key_impl.hpp +// + last modified: 02/may/03 + +// Copyright (c) 2002-03 +// David Abrahams, 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. +// +// See http://www.boost.org/libs/mpl for documentation. + +#include "boost/mpl/set/aux_/tag.hpp" +#include "boost/mpl/has_key_fwd.hpp" +#include "boost/mpl/bool.hpp" +#include "boost/mpl/aux_/static_cast.hpp" +#include "boost/mpl/aux_/yes_no.hpp" +#include "boost/mpl/aux_/type_wrapper.hpp" + +namespace boost { +namespace mpl { + +aux::no_tag has_key_test(...); + +template<> +struct has_key_impl< aux::set_tag > +{ + template< typename Set, typename T > struct apply + : bool_< + ( sizeof( has_key_test( + BOOST_MPL_AUX_STATIC_CAST(Set*, 0) + , BOOST_MPL_AUX_STATIC_CAST(aux::type_wrapper*, 0) + ) ) == sizeof(aux::yes_tag) ) + > + { + }; +}; + +}} + +#endif // BOOST_MPL_SET_AUX_HAS_KEY_IMPL_HPP_INCLUDED diff --git a/include/boost/mpl/set/aux_/set0.hpp b/include/boost/mpl/set/aux_/set0.hpp new file mode 100644 index 0000000..207b41d --- /dev/null +++ b/include/boost/mpl/set/aux_/set0.hpp @@ -0,0 +1,34 @@ + +#ifndef BOOST_MPL_SET_AUX_SET0_HPP_INCLUDED +#define BOOST_MPL_SET_AUX_SET0_HPP_INCLUDED + +// + file: boost/mpl/aux_/set0.hpp +// + last modified: 02/may/03 + +// Copyright (c) 2002-03 +// David Abrahams, 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. +// +// See http://www.boost.org/libs/mpl for documentation. + +#include "boost/mpl/void.hpp" +#include "boost/mpl/set/aux_/tag.hpp" + +namespace boost { +namespace mpl { + +template< typename D_ = void_ > struct set0 +{ + typedef aux::set_tag tag; +}; + +}} + +#endif // BOOST_MPL_SET_AUX_SET0_HPP_INCLUDED diff --git a/include/boost/mpl/set/aux_/tag.hpp b/include/boost/mpl/set/aux_/tag.hpp new file mode 100644 index 0000000..499a632 --- /dev/null +++ b/include/boost/mpl/set/aux_/tag.hpp @@ -0,0 +1,27 @@ + +#ifndef BOOST_MPL_SET_AUX_TAG_HPP_INCLUDED +#define BOOST_MPL_SET_AUX_TAG_HPP_INCLUDED + +// + file: boost/mpl/aux_/tag.hpp +// + last modified: 02/may/03 + +// Copyright (c) 2002-03 +// David Abrahams, 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. +// +// See http://www.boost.org/libs/mpl for documentation. + +namespace boost { namespace mpl { namespace aux { + +struct set_tag; + +}}} + +#endif // BOOST_MPL_SET_AUX_TAG_HPP_INCLUDED diff --git a/include/boost/mpl/set/set0.hpp b/include/boost/mpl/set/set0.hpp new file mode 100644 index 0000000..f6f88ba --- /dev/null +++ b/include/boost/mpl/set/set0.hpp @@ -0,0 +1,37 @@ + +#ifndef BOOST_MPL_SET_SET0_HPP_INCLUDED +#define BOOST_MPL_SET_SET0_HPP_INCLUDED + +// + file: boost/mpl/set0.hpp +// + last modified: 02/may/03 + +// Copyright (c) 2002-03 +// David Abrahams, 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. +// +// See http://www.boost.org/libs/mpl for documentation. + +//#include "boost/mpl/set/aux_/at.hpp" +//#include "boost/mpl/set/aux_/front.hpp" +//#include "boost/mpl/set/aux_/push_front.hpp" +//#include "boost/mpl/set/aux_/pop_front.hpp" +//#include "boost/mpl/set/aux_/back.hpp" +//#include "boost/mpl/set/aux_/clear.hpp" +//#include "boost/mpl/set/aux_/O1_size.hpp" +//#include "boost/mpl/set/aux_/size.hpp" +//#include "boost/mpl/set/aux_/empty.hpp" +//#include "boost/mpl/set/aux_/item.hpp" +//#include "boost/mpl/set/aux_/iterator.hpp" +#include "boost/mpl/set/aux_/has_key_impl.hpp" +#include "boost/mpl/set/aux_/set0.hpp" +//#include "boost/mpl/set/aux_/begin_end.hpp" +//#include "boost/mpl/set/aux_/tag.hpp" + +#endif // BOOST_MPL_SET_SET0_HPP_INCLUDED