diff options
Diffstat (limited to 'boost/detail')
59 files changed, 1526 insertions, 2826 deletions
diff --git a/boost/detail/allocator_utilities.hpp b/boost/detail/allocator_utilities.hpp index 5d6ef48b05..ed3de8466d 100644 --- a/boost/detail/allocator_utilities.hpp +++ b/boost/detail/allocator_utilities.hpp @@ -1,4 +1,4 @@ -/* Copyright 2003-2009 Joaquin M Lopez Munoz. +/* Copyright 2003-2013 Joaquin M Lopez Munoz. * 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) @@ -11,7 +11,6 @@ #include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */ #include <boost/detail/workaround.hpp> -#include <boost/mpl/aux_/msvc_never_true.hpp> #include <boost/mpl/eval_if.hpp> #include <boost/type_traits/is_same.hpp> #include <cstddef> @@ -116,29 +115,6 @@ struct partial_std_allocator_rebind_to /* rebind operation in all other cases */ -#if BOOST_WORKAROUND(BOOST_MSVC,<1300) -/* Workaround for a problem in MSVC with dependent template typedefs - * when doing rebinding of allocators. - * Modeled after <boost/mpl/aux_/msvc_dtw.hpp> (thanks, Aleksey!) - */ - -template<typename Allocator> -struct rebinder -{ - template<bool> struct fake_allocator:Allocator{}; - template<> struct fake_allocator<true> - { - template<typename Type> struct rebind{}; - }; - - template<typename Type> - struct result: - fake_allocator<mpl::aux::msvc_never_true<Allocator>::value>:: - template rebind<Type> - { - }; -}; -#else template<typename Allocator> struct rebinder { @@ -149,7 +125,6 @@ struct rebinder rebind<Type>::other other; }; }; -#endif template<typename Allocator,typename Type> struct compliant_allocator_rebind_to diff --git a/boost/detail/atomic_redef_macros.hpp b/boost/detail/atomic_redef_macros.hpp new file mode 100644 index 0000000000..dfd15f5c70 --- /dev/null +++ b/boost/detail/atomic_redef_macros.hpp @@ -0,0 +1,19 @@ +// Copyright (C) 2013 Vicente J. Botet Escriba +// +// 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(BOOST_INTEL) + +#pragma pop_macro("atomic_compare_exchange") +#pragma pop_macro("atomic_compare_exchange_explicit") +#pragma pop_macro("atomic_exchange") +#pragma pop_macro("atomic_exchange_explicit") +#pragma pop_macro("atomic_is_lock_free") +#pragma pop_macro("atomic_load") +#pragma pop_macro("atomic_load_explicit") +#pragma pop_macro("atomic_store") +#pragma pop_macro("atomic_store_explicit") + +#endif // #if defined(BOOST_INTEL) diff --git a/boost/detail/atomic_undef_macros.hpp b/boost/detail/atomic_undef_macros.hpp new file mode 100644 index 0000000000..18d840a7cc --- /dev/null +++ b/boost/detail/atomic_undef_macros.hpp @@ -0,0 +1,39 @@ +// Copyright (C) 2013 Vicente J. Botet Escriba +// +// 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(BOOST_INTEL) + +#pragma push_macro("atomic_compare_exchange") +#undef atomic_compare_exchange + +#pragma push_macro("atomic_compare_exchange_explicit") +#undef atomic_compare_exchange_explicit + +#pragma push_macro("atomic_exchange") +#undef atomic_exchange + +#pragma push_macro("atomic_exchange_explicit") +#undef atomic_exchange_explicit + +#pragma push_macro("atomic_is_lock_free") +#undef atomic_is_lock_free + +#pragma push_macro("atomic_load") +#undef atomic_load + +#pragma push_macro("atomic_load_explicit") +#undef atomic_load_explicit + +#pragma push_macro("atomic_store") +#undef atomic_store + +#pragma push_macro("atomic_store_explicit") +#undef atomic_store_explicit + + +#endif // #if defined(BOOST_INTEL) + + diff --git a/boost/detail/basic_pointerbuf.hpp b/boost/detail/basic_pointerbuf.hpp new file mode 100644 index 0000000000..1d8cf373b3 --- /dev/null +++ b/boost/detail/basic_pointerbuf.hpp @@ -0,0 +1,139 @@ +//----------------------------------------------------------------------------- +// boost detail/templated_streams.hpp header file +// See http://www.boost.org for updates, documentation, and revision history. +//----------------------------------------------------------------------------- +// +// Copyright (c) 2013 John Maddock, Antony Polukhin +// +// +// 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) + +#ifndef BOOST_DETAIL_BASIC_POINTERBUF_HPP +#define BOOST_DETAIL_BASIC_POINTERBUF_HPP + +// MS compatible compilers support #pragma once +#if defined(_MSC_VER) +# pragma once +#endif + +#include "boost/config.hpp" +#include <streambuf> + +namespace boost { namespace detail { + +// +// class basic_pointerbuf: +// acts as a stream buffer which wraps around a pair of pointers: +// +template <class charT, class BufferT > +class basic_pointerbuf : public BufferT { +protected: + typedef BufferT base_type; + typedef basic_pointerbuf<charT, BufferT> this_type; + typedef typename base_type::int_type int_type; + typedef typename base_type::char_type char_type; + typedef typename base_type::pos_type pos_type; + typedef ::std::streamsize streamsize; + typedef typename base_type::off_type off_type; + +public: + basic_pointerbuf() : base_type() { setbuf(0, 0); } + const charT* getnext() { return this->gptr(); } + +#ifndef BOOST_NO_USING_TEMPLATE + using base_type::pptr; + using base_type::pbase; +#else + charT* pptr() const { return base_type::pptr(); } + charT* pbase() const { return base_type::pbase(); } +#endif + +protected: + // VC mistakenly assumes that `setbuf` and other functions are not referenced. + // Marking those functions with `inline` suppresses the warnings. + // There must be no harm from marking virtual functions as inline: inline virtual + // call can be inlined ONLY when the compiler knows the "exact class". + inline base_type* setbuf(char_type* s, streamsize n); + inline typename this_type::pos_type seekpos(pos_type sp, ::std::ios_base::openmode which); + inline typename this_type::pos_type seekoff(off_type off, ::std::ios_base::seekdir way, ::std::ios_base::openmode which); + +private: + basic_pointerbuf& operator=(const basic_pointerbuf&); + basic_pointerbuf(const basic_pointerbuf&); +}; + +template<class charT, class BufferT> +BufferT* +basic_pointerbuf<charT, BufferT>::setbuf(char_type* s, streamsize n) +{ + this->setg(s, s, s + n); + return this; +} + +template<class charT, class BufferT> +typename basic_pointerbuf<charT, BufferT>::pos_type +basic_pointerbuf<charT, BufferT>::seekoff(off_type off, ::std::ios_base::seekdir way, ::std::ios_base::openmode which) +{ + typedef typename boost::int_t<sizeof(way) * CHAR_BIT>::least cast_type; + + if(which & ::std::ios_base::out) + return pos_type(off_type(-1)); + std::ptrdiff_t size = this->egptr() - this->eback(); + std::ptrdiff_t pos = this->gptr() - this->eback(); + charT* g = this->eback(); + switch(static_cast<cast_type>(way)) + { + case ::std::ios_base::beg: + if((off < 0) || (off > size)) + return pos_type(off_type(-1)); + else + this->setg(g, g + off, g + size); + break; + case ::std::ios_base::end: + if((off < 0) || (off > size)) + return pos_type(off_type(-1)); + else + this->setg(g, g + size - off, g + size); + break; + case ::std::ios_base::cur: + { + std::ptrdiff_t newpos = static_cast<std::ptrdiff_t>(pos + off); + if((newpos < 0) || (newpos > size)) + return pos_type(off_type(-1)); + else + this->setg(g, g + newpos, g + size); + break; + } + default: ; + } +#ifdef BOOST_MSVC +#pragma warning(push) +#pragma warning(disable:4244) +#endif + return static_cast<pos_type>(this->gptr() - this->eback()); +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif +} + +template<class charT, class BufferT> +typename basic_pointerbuf<charT, BufferT>::pos_type +basic_pointerbuf<charT, BufferT>::seekpos(pos_type sp, ::std::ios_base::openmode which) +{ + if(which & ::std::ios_base::out) + return pos_type(off_type(-1)); + off_type size = static_cast<off_type>(this->egptr() - this->eback()); + charT* g = this->eback(); + if(off_type(sp) <= size) + { + this->setg(g, g + off_type(sp), g + size); + } + return pos_type(off_type(-1)); +} + +}} // namespace boost::detail + +#endif // BOOST_DETAIL_BASIC_POINTERBUF_HPP + diff --git a/boost/detail/call_traits.hpp b/boost/detail/call_traits.hpp index 6ad646ec60..36dea0003a 100644 --- a/boost/detail/call_traits.hpp +++ b/boost/detail/call_traits.hpp @@ -24,6 +24,7 @@ #include <cstddef> #include <boost/type_traits/is_arithmetic.hpp> +#include <boost/type_traits/is_enum.hpp> #include <boost/type_traits/is_pointer.hpp> #include <boost/detail/workaround.hpp> @@ -43,20 +44,26 @@ struct ct_imp2<T, true> typedef const T param_type; }; -template <typename T, bool isp, bool b1> +template <typename T, bool isp, bool b1, bool b2> struct ct_imp { typedef const T& param_type; }; -template <typename T, bool isp> -struct ct_imp<T, isp, true> +template <typename T, bool isp, bool b2> +struct ct_imp<T, isp, true, b2> +{ + typedef typename ct_imp2<T, sizeof(T) <= sizeof(void*)>::param_type param_type; +}; + +template <typename T, bool isp, bool b1> +struct ct_imp<T, isp, b1, true> { typedef typename ct_imp2<T, sizeof(T) <= sizeof(void*)>::param_type param_type; }; -template <typename T, bool b1> -struct ct_imp<T, true, b1> +template <typename T, bool b1, bool b2> +struct ct_imp<T, true, b1, b2> { typedef const T param_type; }; @@ -79,7 +86,8 @@ public: typedef typename boost::detail::ct_imp< T, ::boost::is_pointer<T>::value, - ::boost::is_arithmetic<T>::value + ::boost::is_arithmetic<T>::value, + ::boost::is_enum<T>::value >::param_type param_type; }; diff --git a/boost/detail/catch_exceptions.hpp b/boost/detail/catch_exceptions.hpp index b1a3c76b2a..823ebd1e29 100644 --- a/boost/detail/catch_exceptions.hpp +++ b/boost/detail/catch_exceptions.hpp @@ -24,11 +24,7 @@ #include <exception> // for exception, bad_exception #include <stdexcept> // for std exception hierarchy #include <boost/cstdlib.hpp> // for exit codes -# if __GNUC__ != 2 || __GNUC_MINOR__ > 96 -# include <ostream> // for ostream -# else -# include <iostream> // workaround GNU missing ostream header -# endif +#include <ostream> // for ostream # if defined(__BORLANDC__) && (__BORLANDC__ <= 0x0551) # define BOOST_BUILT_IN_EXCEPTIONS_MISSING_WHAT diff --git a/boost/detail/compressed_pair.hpp b/boost/detail/compressed_pair.hpp index 3f326456ce..5dc21e23e6 100644 --- a/boost/detail/compressed_pair.hpp +++ b/boost/detail/compressed_pair.hpp @@ -6,7 +6,7 @@ // See http://www.boost.org/libs/utility for most recent version including documentation. // compressed_pair: pair that "compresses" empty members -// (see libs/utility/compressed_pair.htm) +// (see libs/utility/doc/html/compressed_pair.html) // // JM changes 25 Jan 2004: // For the case where T1 == T2 and both are empty, then first() and second() diff --git a/boost/detail/container_fwd.hpp b/boost/detail/container_fwd.hpp index ef17498063..04ce972738 100644 --- a/boost/detail/container_fwd.hpp +++ b/boost/detail/container_fwd.hpp @@ -8,7 +8,7 @@ #if !defined(BOOST_DETAIL_CONTAINER_FWD_HPP) #define BOOST_DETAIL_CONTAINER_FWD_HPP -#if defined(_MSC_VER) && (_MSC_VER >= 1020) && \ +#if defined(_MSC_VER) && \ !defined(BOOST_DETAIL_TEST_CONFIG_ONLY) # pragma once #endif @@ -119,12 +119,7 @@ namespace std template <class T> class allocator; template <class charT, class traits, class Allocator> class basic_string; -#if BOOST_WORKAROUND(__GNUC__, < 3) && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION) - - template <class charT> struct string_char_traits; -#else template <class charT> struct char_traits; -#endif #if defined(BOOST_CONTAINER_FWD_COMPLEX_STRUCT) template <class T> struct complex; diff --git a/boost/detail/dynamic_bitset.hpp b/boost/detail/dynamic_bitset.hpp index 281aa55cd6..e0f675d5ec 100644 --- a/boost/detail/dynamic_bitset.hpp +++ b/boost/detail/dynamic_bitset.hpp @@ -3,6 +3,9 @@ // Copyright (c) 2001-2002 Chuck Allison and Jeremy Siek // Copyright (c) 2003-2006, 2008 Gennaro Prota // +// Copyright (c) 2014 Glen Joseph Fernandes +// glenfe at live dot com +// // 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) @@ -12,6 +15,7 @@ #ifndef BOOST_DETAIL_DYNAMIC_BITSET_HPP #define BOOST_DETAIL_DYNAMIC_BITSET_HPP +#include <memory> #include <cstddef> #include "boost/config.hpp" #include "boost/detail/workaround.hpp" @@ -155,17 +159,25 @@ namespace boost { // meaningful info. // template <typename T> - typename T::size_type vector_max_size_workaround(const T & v) { + inline typename T::size_type vector_max_size_workaround(const T & v) + BOOST_NOEXCEPT + { + typedef typename T::allocator_type allocator_type; + + const allocator_type& alloc = v.get_allocator(); - typedef typename T::allocator_type allocator_type; +#if !defined(BOOST_NO_CXX11_ALLOCATOR) + typedef std::allocator_traits<allocator_type> allocator_traits; + + const typename allocator_traits::size_type alloc_max = + allocator_traits::max_size(alloc); +#else + const typename allocator_type::size_type alloc_max = alloc.max_size(); +#endif - const typename allocator_type::size_type alloc_max = - v.get_allocator().max_size(); - const typename T::size_type container_max = v.max_size(); + const typename T::size_type container_max = v.max_size(); - return alloc_max < container_max? - alloc_max : - container_max; + return alloc_max < container_max ? alloc_max : container_max; } // for static_asserts diff --git a/boost/detail/endian.hpp b/boost/detail/endian.hpp index 98c870ca2f..f576c26b89 100644 --- a/boost/detail/endian.hpp +++ b/boost/detail/endian.hpp @@ -1,78 +1,11 @@ -// Copyright 2005 Caleb Epstein -// Copyright 2006 John Maddock -// Copyright 2010 Rene Rivera +// Copyright 2013 Rene Rivera // Distributed under the Boost Software License, Version 1.0. (See accompany- // ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) -/* - * Copyright (c) 1997 - * Silicon Graphics Computer Systems, Inc. - * - * 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 appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/* - * Copyright notice reproduced from <boost/detail/limits.hpp>, from - * which this code was originally taken. - * - * Modified by Caleb Epstein to use <endian.h> with GNU libc and to - * defined the BOOST_ENDIAN macro. - */ - #ifndef BOOST_DETAIL_ENDIAN_HPP #define BOOST_DETAIL_ENDIAN_HPP -// GNU libc offers the helpful header <endian.h> which defines -// __BYTE_ORDER - -#if defined (__GLIBC__) -# include <endian.h> -# if (__BYTE_ORDER == __LITTLE_ENDIAN) -# define BOOST_LITTLE_ENDIAN -# elif (__BYTE_ORDER == __BIG_ENDIAN) -# define BOOST_BIG_ENDIAN -# elif (__BYTE_ORDER == __PDP_ENDIAN) -# define BOOST_PDP_ENDIAN -# else -# error Unknown machine endianness detected. -# endif -# define BOOST_BYTE_ORDER __BYTE_ORDER -#elif defined(_BIG_ENDIAN) && !defined(_LITTLE_ENDIAN) || \ - defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__) || \ - defined(_STLP_BIG_ENDIAN) && !defined(_STLP_LITTLE_ENDIAN) -# define BOOST_BIG_ENDIAN -# define BOOST_BYTE_ORDER 4321 -#elif defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN) || \ - defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__) || \ - defined(_STLP_LITTLE_ENDIAN) && !defined(_STLP_BIG_ENDIAN) -# define BOOST_LITTLE_ENDIAN -# define BOOST_BYTE_ORDER 1234 -#elif defined(__sparc) || defined(__sparc__) \ - || defined(_POWER) || defined(__powerpc__) \ - || defined(__ppc__) || defined(__hpux) || defined(__hppa) \ - || defined(_MIPSEB) || defined(_POWER) \ - || defined(__s390__) -# define BOOST_BIG_ENDIAN -# define BOOST_BYTE_ORDER 4321 -#elif defined(__i386__) || defined(__alpha__) \ - || defined(__ia64) || defined(__ia64__) \ - || defined(_M_IX86) || defined(_M_IA64) \ - || defined(_M_ALPHA) || defined(__amd64) \ - || defined(__amd64__) || defined(_M_AMD64) \ - || defined(__x86_64) || defined(__x86_64__) \ - || defined(_M_X64) || defined(__bfin__) - -# define BOOST_LITTLE_ENDIAN -# define BOOST_BYTE_ORDER 1234 -#else -# error The file boost/detail/endian.hpp needs to be set up for your CPU type. -#endif - +// Use the Predef library for the detection of endianess. +#include <boost/predef/detail/endian_compat.h> #endif diff --git a/boost/detail/fenv.hpp b/boost/detail/fenv.hpp index f048706416..b268f5c1cc 100644 --- a/boost/detail/fenv.hpp +++ b/boost/detail/fenv.hpp @@ -14,7 +14,7 @@ #if !defined(BOOST_DETAIL_FENV_HPP) #define BOOST_DETAIL_FENV_HPP -/* If we're using clang + glibc, we have to get hacky. +/* If we're using clang + glibc, we have to get hacky. * See http://llvm.org/bugs/show_bug.cgi?id=6907 */ #if defined(__clang__) && (__clang_major__ < 3) && \ defined(__GNU_LIBRARY__) && /* up to version 5 */ \ @@ -61,14 +61,41 @@ using ::feholdexcept; } } +#elif defined(__MINGW32__) && defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__) >= 408 + + // MinGW (32-bit) has a bug in mingw32/bits/c++config.h, it does not define _GLIBCXX_HAVE_FENV_H, + // which prevents the C fenv.h header contents to be included in the C++ wrapper header fenv.h. This is at least + // the case with gcc 4.8.1 packages tested so far, up to 4.8.1-4. Note that there is no issue with + // MinGW-w64. + // To work around the bug we avoid including the C++ wrapper header and include the C header directly + // and import all relevant symbols into std:: ourselves. + + #include <../include/fenv.h> + + namespace std { + using ::fenv_t; + using ::fexcept_t; + using ::fegetexceptflag; + using ::fesetexceptflag; + using ::feclearexcept; + using ::feraiseexcept; + using ::fetestexcept; + using ::fegetround; + using ::fesetround; + using ::fegetenv; + using ::fesetenv; + using ::feupdateenv; + using ::feholdexcept; + } + #else /* if we're not using GNU's C stdlib, fenv.h should work with clang */ + #if defined(__SUNPRO_CC) /* lol suncc */ #include <stdio.h> #endif - + #include <fenv.h> #endif #endif /* BOOST_DETAIL_FENV_HPP */ - diff --git a/boost/detail/identifier.hpp b/boost/detail/identifier.hpp index 688a664f7d..063d23801e 100644 --- a/boost/detail/identifier.hpp +++ b/boost/detail/identifier.hpp @@ -57,9 +57,7 @@ namespace boost identifier() {} explicit identifier( value_type v ) : m_value(v) {} - #if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 // 1300 == VC++ 7.0 bug workaround private: - #endif T m_value; }; diff --git a/boost/detail/indirect_traits.hpp b/boost/detail/indirect_traits.hpp index f9c0cd6a04..7c8f76b09d 100644 --- a/boost/detail/indirect_traits.hpp +++ b/boost/detail/indirect_traits.hpp @@ -26,15 +26,11 @@ # include <boost/mpl/not.hpp> # include <boost/mpl/aux_/lambda_support.hpp> -# ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -# include <boost/detail/is_function_ref_tester.hpp> -# endif namespace boost { namespace detail { namespace indirect_traits { -# ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION template <class T> struct is_reference_to_const : mpl::false_ { @@ -199,284 +195,6 @@ struct is_pointer_to_class BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_pointer_to_class,(T)) }; -# else - -using namespace boost::detail::is_function_ref_tester_; - -typedef char (&inner_yes_type)[3]; -typedef char (&inner_no_type)[2]; -typedef char (&outer_no_type)[1]; - -template <typename V> -struct is_const_help -{ - typedef typename mpl::if_< - is_const<V> - , inner_yes_type - , inner_no_type - >::type type; -}; - -template <typename V> -struct is_volatile_help -{ - typedef typename mpl::if_< - is_volatile<V> - , inner_yes_type - , inner_no_type - >::type type; -}; - -template <typename V> -struct is_pointer_help -{ - typedef typename mpl::if_< - is_pointer<V> - , inner_yes_type - , inner_no_type - >::type type; -}; - -template <typename V> -struct is_class_help -{ - typedef typename mpl::if_< - is_class<V> - , inner_yes_type - , inner_no_type - >::type type; -}; - -template <class T> -struct is_reference_to_function_aux -{ - static T t; - BOOST_STATIC_CONSTANT( - bool, value = sizeof(detail::is_function_ref_tester(t,0)) == sizeof(::boost::type_traits::yes_type)); - typedef mpl::bool_<value> type; - }; - -template <class T> -struct is_reference_to_function - : mpl::if_<is_reference<T>, is_reference_to_function_aux<T>, mpl::bool_<false> >::type -{ -}; - -template <class T> -struct is_pointer_to_function_aux -{ - static T t; - BOOST_STATIC_CONSTANT( - bool, value - = sizeof(::boost::type_traits::is_function_ptr_tester(t)) == sizeof(::boost::type_traits::yes_type)); - typedef mpl::bool_<value> type; -}; - -template <class T> -struct is_pointer_to_function - : mpl::if_<is_pointer<T>, is_pointer_to_function_aux<T>, mpl::bool_<false> >::type -{ - BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_pointer_to_function,(T)) -}; - -struct false_helper1 -{ - template <class T> - struct apply : mpl::false_ - { - }; -}; - -template <typename V> -typename is_const_help<V>::type reference_to_const_helper(V&); -outer_no_type -reference_to_const_helper(...); - -struct true_helper1 -{ - template <class T> - struct apply - { - static T t; - BOOST_STATIC_CONSTANT( - bool, value - = sizeof(reference_to_const_helper(t)) == sizeof(inner_yes_type)); - typedef mpl::bool_<value> type; - }; -}; - -template <bool ref = true> -struct is_reference_to_const_helper1 : true_helper1 -{ -}; - -template <> -struct is_reference_to_const_helper1<false> : false_helper1 -{ -}; - - -template <class T> -struct is_reference_to_const - : is_reference_to_const_helper1<is_reference<T>::value>::template apply<T> -{ -}; - - -template <bool ref = true> -struct is_reference_to_non_const_helper1 -{ - template <class T> - struct apply - { - static T t; - BOOST_STATIC_CONSTANT( - bool, value - = sizeof(reference_to_const_helper(t)) == sizeof(inner_no_type)); - - typedef mpl::bool_<value> type; - }; -}; - -template <> -struct is_reference_to_non_const_helper1<false> : false_helper1 -{ -}; - - -template <class T> -struct is_reference_to_non_const - : is_reference_to_non_const_helper1<is_reference<T>::value>::template apply<T> -{ - BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_non_const,(T)) -}; - - -template <typename V> -typename is_volatile_help<V>::type reference_to_volatile_helper(V&); -outer_no_type -reference_to_volatile_helper(...); - -template <bool ref = true> -struct is_reference_to_volatile_helper1 -{ - template <class T> - struct apply - { - static T t; - BOOST_STATIC_CONSTANT( - bool, value - = sizeof(reference_to_volatile_helper(t)) == sizeof(inner_yes_type)); - typedef mpl::bool_<value> type; - }; -}; - -template <> -struct is_reference_to_volatile_helper1<false> : false_helper1 -{ -}; - - -template <class T> -struct is_reference_to_volatile - : is_reference_to_volatile_helper1<is_reference<T>::value>::template apply<T> -{ -}; - -template <typename V> -typename is_pointer_help<V>::type reference_to_pointer_helper(V&); -outer_no_type reference_to_pointer_helper(...); - -template <class T> -struct reference_to_pointer_impl -{ - static T t; - BOOST_STATIC_CONSTANT( - bool, value - = (sizeof((reference_to_pointer_helper)(t)) == sizeof(inner_yes_type)) - ); - - typedef mpl::bool_<value> type; -}; - -template <class T> -struct is_reference_to_pointer - : mpl::eval_if<is_reference<T>, reference_to_pointer_impl<T>, mpl::false_>::type -{ - BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_pointer,(T)) -}; - -template <class T> -struct is_reference_to_function_pointer - : mpl::eval_if<is_reference<T>, is_pointer_to_function_aux<T>, mpl::false_>::type -{ - BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_function_pointer,(T)) -}; - - -template <class T> -struct is_member_function_pointer_help - : mpl::if_<is_member_function_pointer<T>, inner_yes_type, inner_no_type> -{}; - -template <typename V> -typename is_member_function_pointer_help<V>::type member_function_pointer_helper(V&); -outer_no_type member_function_pointer_helper(...); - -template <class T> -struct is_pointer_to_member_function_aux -{ - static T t; - BOOST_STATIC_CONSTANT( - bool, value - = sizeof((member_function_pointer_helper)(t)) == sizeof(inner_yes_type)); - typedef mpl::bool_<value> type; -}; - -template <class T> -struct is_reference_to_member_function_pointer - : mpl::if_< - is_reference<T> - , is_pointer_to_member_function_aux<T> - , mpl::bool_<false> - >::type -{ - BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_member_function_pointer,(T)) -}; - -template <typename V> -typename is_class_help<V>::type reference_to_class_helper(V const volatile&); -outer_no_type reference_to_class_helper(...); - -template <class T> -struct is_reference_to_class -{ - static T t; - BOOST_STATIC_CONSTANT( - bool, value - = (is_reference<T>::value - & (sizeof(reference_to_class_helper(t)) == sizeof(inner_yes_type))) - ); - typedef mpl::bool_<value> type; - BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_class,(T)) -}; - -template <typename V> -typename is_class_help<V>::type pointer_to_class_helper(V const volatile*); -outer_no_type pointer_to_class_helper(...); - -template <class T> -struct is_pointer_to_class -{ - static T t; - BOOST_STATIC_CONSTANT( - bool, value - = (is_pointer<T>::value - && sizeof(pointer_to_class_helper(t)) == sizeof(inner_yes_type)) - ); - typedef mpl::bool_<value> type; -}; -# endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION } diff --git a/boost/detail/interlocked.hpp b/boost/detail/interlocked.hpp index 1802e3411d..2c91ce286f 100644 --- a/boost/detail/interlocked.hpp +++ b/boost/detail/interlocked.hpp @@ -1,12 +1,6 @@ #ifndef BOOST_DETAIL_INTERLOCKED_HPP_INCLUDED #define BOOST_DETAIL_INTERLOCKED_HPP_INCLUDED -// MS compatible compilers support #pragma once - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - // // boost/detail/interlocked.hpp // @@ -19,6 +13,11 @@ #include <boost/config.hpp> +// MS compatible compilers support #pragma once +#ifdef BOOST_HAS_PRAGMA_ONCE +#pragma once +#endif + #if defined( BOOST_USE_WINDOWS_H ) # include <windows.h> @@ -31,8 +30,47 @@ # define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER InterlockedCompareExchangePointer # define BOOST_INTERLOCKED_EXCHANGE_POINTER InterlockedExchangePointer +#elif defined( BOOST_USE_INTRIN_H ) + +#include <intrin.h> + +# define BOOST_INTERLOCKED_INCREMENT _InterlockedIncrement +# define BOOST_INTERLOCKED_DECREMENT _InterlockedDecrement +# define BOOST_INTERLOCKED_COMPARE_EXCHANGE _InterlockedCompareExchange +# define BOOST_INTERLOCKED_EXCHANGE _InterlockedExchange +# define BOOST_INTERLOCKED_EXCHANGE_ADD _InterlockedExchangeAdd + +# if defined(_M_IA64) || defined(_M_AMD64) || defined(__x86_64__) || defined(__x86_64) + +# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER _InterlockedCompareExchangePointer +# define BOOST_INTERLOCKED_EXCHANGE_POINTER _InterlockedExchangePointer + +# else + +# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest,exchange,compare) \ + ((void*)BOOST_INTERLOCKED_COMPARE_EXCHANGE((long volatile*)(dest),(long)(exchange),(long)(compare))) +# define BOOST_INTERLOCKED_EXCHANGE_POINTER(dest,exchange) \ + ((void*)BOOST_INTERLOCKED_EXCHANGE((long volatile*)(dest),(long)(exchange))) + +# endif + #elif defined(_WIN32_WCE) +#if _WIN32_WCE >= 0x600 + +extern "C" long __cdecl _InterlockedIncrement( long volatile * ); +extern "C" long __cdecl _InterlockedDecrement( long volatile * ); +extern "C" long __cdecl _InterlockedCompareExchange( long volatile *, long, long ); +extern "C" long __cdecl _InterlockedExchange( long volatile *, long ); +extern "C" long __cdecl _InterlockedExchangeAdd( long volatile *, long ); + +# define BOOST_INTERLOCKED_INCREMENT _InterlockedIncrement +# define BOOST_INTERLOCKED_DECREMENT _InterlockedDecrement +# define BOOST_INTERLOCKED_COMPARE_EXCHANGE _InterlockedCompareExchange +# define BOOST_INTERLOCKED_EXCHANGE _InterlockedExchange +# define BOOST_INTERLOCKED_EXCHANGE_ADD _InterlockedExchangeAdd + +#else // under Windows CE we still have old-style Interlocked* functions extern "C" long __cdecl InterlockedIncrement( long* ); @@ -47,6 +85,8 @@ extern "C" long __cdecl InterlockedExchangeAdd( long*, long ); # define BOOST_INTERLOCKED_EXCHANGE InterlockedExchange # define BOOST_INTERLOCKED_EXCHANGE_ADD InterlockedExchangeAdd +#endif + # define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest,exchange,compare) \ ((void*)BOOST_INTERLOCKED_COMPARE_EXCHANGE((long*)(dest),(long)(exchange),(long)(compare))) # define BOOST_INTERLOCKED_EXCHANGE_POINTER(dest,exchange) \ @@ -54,42 +94,41 @@ extern "C" long __cdecl InterlockedExchangeAdd( long*, long ); #elif defined( BOOST_MSVC ) || defined( BOOST_INTEL_WIN ) -#if defined( BOOST_MSVC ) && BOOST_MSVC >= 1600 +#if defined( BOOST_MSVC ) && BOOST_MSVC >= 1400 #include <intrin.h> -#elif defined( __CLRCALL_PURE_OR_CDECL ) +#else -extern "C" long __CLRCALL_PURE_OR_CDECL _InterlockedIncrement( long volatile * ); -extern "C" long __CLRCALL_PURE_OR_CDECL _InterlockedDecrement( long volatile * ); -extern "C" long __CLRCALL_PURE_OR_CDECL _InterlockedCompareExchange( long volatile *, long, long ); -extern "C" long __CLRCALL_PURE_OR_CDECL _InterlockedExchange( long volatile *, long ); -extern "C" long __CLRCALL_PURE_OR_CDECL _InterlockedExchangeAdd( long volatile *, long ); +# if defined( __CLRCALL_PURE_OR_CDECL ) +# define BOOST_INTERLOCKED_CLRCALL_PURE_OR_CDECL __CLRCALL_PURE_OR_CDECL +# else +# define BOOST_INTERLOCKED_CLRCALL_PURE_OR_CDECL __cdecl +# endif -#else +extern "C" long BOOST_INTERLOCKED_CLRCALL_PURE_OR_CDECL _InterlockedIncrement( long volatile * ); +extern "C" long BOOST_INTERLOCKED_CLRCALL_PURE_OR_CDECL _InterlockedDecrement( long volatile * ); +extern "C" long BOOST_INTERLOCKED_CLRCALL_PURE_OR_CDECL _InterlockedCompareExchange( long volatile *, long, long ); +extern "C" long BOOST_INTERLOCKED_CLRCALL_PURE_OR_CDECL _InterlockedExchange( long volatile *, long ); +extern "C" long BOOST_INTERLOCKED_CLRCALL_PURE_OR_CDECL _InterlockedExchangeAdd( long volatile *, long ); -extern "C" long __cdecl _InterlockedIncrement( long volatile * ); -extern "C" long __cdecl _InterlockedDecrement( long volatile * ); -extern "C" long __cdecl _InterlockedCompareExchange( long volatile *, long, long ); -extern "C" long __cdecl _InterlockedExchange( long volatile *, long ); -extern "C" long __cdecl _InterlockedExchangeAdd( long volatile *, long ); +# undef BOOST_INTERLOCKED_CLRCALL_PURE_OR_CDECL -#endif +# if defined( BOOST_MSVC ) && BOOST_MSVC >= 1310 +# pragma intrinsic( _InterlockedIncrement ) +# pragma intrinsic( _InterlockedDecrement ) +# pragma intrinsic( _InterlockedCompareExchange ) +# pragma intrinsic( _InterlockedExchange ) +# pragma intrinsic( _InterlockedExchangeAdd ) +# endif -# pragma intrinsic( _InterlockedIncrement ) -# pragma intrinsic( _InterlockedDecrement ) -# pragma intrinsic( _InterlockedCompareExchange ) -# pragma intrinsic( _InterlockedExchange ) -# pragma intrinsic( _InterlockedExchangeAdd ) +#endif # if defined(_M_IA64) || defined(_M_AMD64) extern "C" void* __cdecl _InterlockedCompareExchangePointer( void* volatile *, void*, void* ); extern "C" void* __cdecl _InterlockedExchangePointer( void* volatile *, void* ); -# pragma intrinsic( _InterlockedCompareExchangePointer ) -# pragma intrinsic( _InterlockedExchangePointer ) - # define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER _InterlockedCompareExchangePointer # define BOOST_INTERLOCKED_EXCHANGE_POINTER _InterlockedExchangePointer @@ -108,14 +147,30 @@ extern "C" void* __cdecl _InterlockedExchangePointer( void* volatile *, void* ); # define BOOST_INTERLOCKED_EXCHANGE _InterlockedExchange # define BOOST_INTERLOCKED_EXCHANGE_ADD _InterlockedExchangeAdd +// Unlike __MINGW64__, __MINGW64_VERSION_MAJOR is defined by MinGW-w64 for both 32 and 64-bit targets. +#elif defined(__MINGW64_VERSION_MAJOR) + +// MinGW-w64 provides intrin.h for both 32 and 64-bit targets. +#include <intrin.h> + +# define BOOST_INTERLOCKED_INCREMENT _InterlockedIncrement +# define BOOST_INTERLOCKED_DECREMENT _InterlockedDecrement +# define BOOST_INTERLOCKED_COMPARE_EXCHANGE _InterlockedCompareExchange +# define BOOST_INTERLOCKED_EXCHANGE _InterlockedExchange +# define BOOST_INTERLOCKED_EXCHANGE_ADD _InterlockedExchangeAdd +# if defined(__x86_64__) || defined(__x86_64) +# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER _InterlockedCompareExchangePointer +# define BOOST_INTERLOCKED_EXCHANGE_POINTER _InterlockedExchangePointer +# else +# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest,exchange,compare) \ + ((void*)BOOST_INTERLOCKED_COMPARE_EXCHANGE((long volatile*)(dest),(long)(exchange),(long)(compare))) +# define BOOST_INTERLOCKED_EXCHANGE_POINTER(dest,exchange) \ + ((void*)BOOST_INTERLOCKED_EXCHANGE((long volatile*)(dest),(long)(exchange))) +# endif + #elif defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || defined( __CYGWIN__ ) -#if defined(__MINGW64__) -#define BOOST_INTERLOCKED_IMPORT -#else #define BOOST_INTERLOCKED_IMPORT __declspec(dllimport) -#endif - namespace boost { diff --git a/boost/detail/is_function_ref_tester.hpp b/boost/detail/is_function_ref_tester.hpp deleted file mode 100644 index 5f367ea818..0000000000 --- a/boost/detail/is_function_ref_tester.hpp +++ /dev/null @@ -1,135 +0,0 @@ - -// (C) Copyright Dave Abrahams, Steve Cleary, Beman Dawes, -// Aleksey Gurtovoy, Howard Hinnant & John Maddock 2000. -// 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(BOOST_PP_IS_ITERATING) - -///// header body - -#ifndef BOOST_DETAIL_IS_FUNCTION_REF_TESTER_HPP_INCLUDED -#define BOOST_DETAIL_IS_FUNCTION_REF_TESTER_HPP_INCLUDED - -#include "boost/type_traits/detail/yes_no_type.hpp" -#include "boost/type_traits/config.hpp" - -#if defined(BOOST_TT_PREPROCESSING_MODE) -# include "boost/preprocessor/iterate.hpp" -# include "boost/preprocessor/enum_params.hpp" -# include "boost/preprocessor/comma_if.hpp" -#endif - -namespace boost { -namespace detail { -namespace is_function_ref_tester_ { - -template <class T> -boost::type_traits::no_type BOOST_TT_DECL is_function_ref_tester(T& ...); - -#if !defined(BOOST_TT_PREPROCESSING_MODE) -// preprocessor-generated part, don't edit by hand! - -template <class R> -boost::type_traits::yes_type is_function_ref_tester(R (&)(), int); - -template <class R,class T0 > -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0), int); - -template <class R,class T0,class T1 > -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1), int); - -template <class R,class T0,class T1,class T2 > -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2), int); - -template <class R,class T0,class T1,class T2,class T3 > -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3), int); - -template <class R,class T0,class T1,class T2,class T3,class T4 > -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4), int); - -template <class R,class T0,class T1,class T2,class T3,class T4,class T5 > -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5), int); - -template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6 > -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6), int); - -template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7 > -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7), int); - -template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8 > -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8), int); - -template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9 > -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9), int); - -template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10 > -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10), int); - -template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11 > -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11), int); - -template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12 > -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12), int); - -template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13 > -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13), int); - -template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13,class T14 > -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14), int); - -template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13,class T14,class T15 > -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15), int); - -template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13,class T14,class T15,class T16 > -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16), int); - -template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13,class T14,class T15,class T16,class T17 > -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17), int); - -template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13,class T14,class T15,class T16,class T17,class T18 > -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18), int); - -template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13,class T14,class T15,class T16,class T17,class T18,class T19 > -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19), int); - -template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13,class T14,class T15,class T16,class T17,class T18,class T19,class T20 > -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20), int); - -template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13,class T14,class T15,class T16,class T17,class T18,class T19,class T20,class T21 > -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21), int); - -template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13,class T14,class T15,class T16,class T17,class T18,class T19,class T20,class T21,class T22 > -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22), int); - -template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13,class T14,class T15,class T16,class T17,class T18,class T19,class T20,class T21,class T22,class T23 > -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22,T23), int); - -template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13,class T14,class T15,class T16,class T17,class T18,class T19,class T20,class T21,class T22,class T23,class T24 > -boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22,T23,T24), int); - -#else - -#define BOOST_PP_ITERATION_PARAMS_1 \ - (3, (0, 25, "boost/type_traits/detail/is_function_ref_tester.hpp")) -#include BOOST_PP_ITERATE() - -#endif // BOOST_TT_PREPROCESSING_MODE - -} // namespace detail -} // namespace python -} // namespace boost - -#endif // BOOST_DETAIL_IS_FUNCTION_REF_TESTER_HPP_INCLUDED - -///// iteration - -#else -#define i BOOST_PP_FRAME_ITERATION(1) - -template <class R BOOST_PP_COMMA_IF(i) BOOST_PP_ENUM_PARAMS(i,class T) > -boost::type_traits::yes_type is_function_ref_tester(R (&)(BOOST_PP_ENUM_PARAMS(i,T)), int); - -#undef i -#endif // BOOST_PP_IS_ITERATING diff --git a/boost/detail/is_incrementable.hpp b/boost/detail/is_incrementable.hpp index e7ef9dc625..6b36378fa2 100644 --- a/boost/detail/is_incrementable.hpp +++ b/boost/detail/is_incrementable.hpp @@ -55,8 +55,7 @@ namespace is_incrementable_ # endif -# if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3202)) \ - || BOOST_WORKAROUND(BOOST_MSVC, <= 1300) +# if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3202)) # define BOOST_comma(a,b) (a) # else // In case an operator++ is found that returns void, we'll use ++x,0 diff --git a/boost/detail/is_xxx.hpp b/boost/detail/is_xxx.hpp index cb64fb32b8..3f9a1265ee 100644 --- a/boost/detail/is_xxx.hpp +++ b/boost/detail/is_xxx.hpp @@ -8,39 +8,6 @@ # include <boost/mpl/bool.hpp> # include <boost/preprocessor/enum_params.hpp> -# if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) -# include <boost/type_traits/is_reference.hpp> -# include <boost/type_traits/add_reference.hpp> - -# define BOOST_DETAIL_IS_XXX_DEF(name, qualified_name, nargs) \ -template <class X_> \ -struct is_##name \ -{ \ - typedef char yes; \ - typedef char (&no)[2]; \ - \ - static typename add_reference<X_>::type dummy; \ - \ - struct helpers \ - { \ - template < BOOST_PP_ENUM_PARAMS_Z(1, nargs, class U) > \ - static yes test( \ - qualified_name< BOOST_PP_ENUM_PARAMS_Z(1, nargs, U) >&, int \ - ); \ - \ - template <class U> \ - static no test(U&, ...); \ - }; \ - \ - BOOST_STATIC_CONSTANT( \ - bool, value \ - = !is_reference<X_>::value \ - & (sizeof(helpers::test(dummy, 0)) == sizeof(yes))); \ - \ - typedef mpl::bool_<value> type; \ -}; - -# else # define BOOST_DETAIL_IS_XXX_DEF(name, qualified_name, nargs) \ template <class T> \ @@ -56,6 +23,5 @@ struct is_##name< \ { \ }; -# endif #endif // BOOST_DETAIL_IS_XXX_DWA20051011_HPP diff --git a/boost/detail/iterator.hpp b/boost/detail/iterator.hpp index 5bb9c6269c..c2e8f1e2a5 100644 --- a/boost/detail/iterator.hpp +++ b/boost/detail/iterator.hpp @@ -3,492 +3,24 @@ // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) -// Boost versions of -// -// std::iterator_traits<>::iterator_category -// std::iterator_traits<>::difference_type -// std::distance() -// -// ...for all compilers and iterators -// -// Additionally, if X is a pointer -// std::iterator_traits<X>::pointer - -// Otherwise, if partial specialization is supported or X is not a pointer -// std::iterator_traits<X>::value_type -// std::iterator_traits<X>::pointer -// std::iterator_traits<X>::reference -// -// See http://www.boost.org for most recent version including documentation. - -// Revision History -// 04 Mar 2001 - More attempted fixes for Intel C++ (David Abrahams) -// 03 Mar 2001 - Put all implementation into namespace -// boost::detail::iterator_traits_. Some progress made on fixes -// for Intel compiler. (David Abrahams) -// 02 Mar 2001 - Changed BOOST_MSVC to BOOST_MSVC_STD_ITERATOR in a few -// places. (Jeremy Siek) -// 19 Feb 2001 - Improved workarounds for stock MSVC6; use yes_type and -// no_type from type_traits.hpp; stopped trying to remove_cv -// before detecting is_pointer, in honor of the new type_traits -// semantics. (David Abrahams) -// 13 Feb 2001 - Make it work with nearly all standard-conforming iterators -// under raw VC6. The one category remaining which will fail is -// that of iterators derived from std::iterator but not -// boost::iterator and which redefine difference_type. -// 11 Feb 2001 - Clean away code which can never be used (David Abrahams) -// 09 Feb 2001 - Always have a definition for each traits member, even if it -// can't be properly deduced. These will be incomplete types in -// some cases (undefined<void>), but it helps suppress MSVC errors -// elsewhere (David Abrahams) -// 07 Feb 2001 - Support for more of the traits members where possible, making -// this useful as a replacement for std::iterator_traits<T> when -// used as a default template parameter. -// 06 Feb 2001 - Removed useless #includes of standard library headers -// (David Abrahams) - #ifndef ITERATOR_DWA122600_HPP_ -# define ITERATOR_DWA122600_HPP_ - -# include <boost/config.hpp> -# include <iterator> - -// STLPort 4.0 and betas have a bug when debugging is enabled and there is no -// partial specialization: instead of an iterator_category typedef, the standard -// container iterators have _Iterator_category. -// -// Also, whether debugging is enabled or not, there is a broken specialization -// of std::iterator<output_iterator_tag,void,void,void,void> which has no -// typedefs but iterator_category. -# if defined(__SGI_STL_PORT) - -# if (__SGI_STL_PORT <= 0x410) && !defined(__STL_CLASS_PARTIAL_SPECIALIZATION) && defined(__STL_DEBUG) -# define BOOST_BAD_CONTAINER_ITERATOR_CATEGORY_TYPEDEF -# endif - -# define BOOST_BAD_OUTPUT_ITERATOR_SPECIALIZATION - -# endif // STLPort <= 4.1b4 && no partial specialization - -# if !defined(BOOST_NO_STD_ITERATOR_TRAITS) \ - && !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ - && !defined(BOOST_MSVC_STD_ITERATOR) - -namespace boost { namespace detail { - -// Define a new template so it can be specialized -template <class Iterator> -struct iterator_traits - : std::iterator_traits<Iterator> -{}; -using std::distance; - -}} // namespace boost::detail - -# else - -# if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \ - && !defined(BOOST_MSVC_STD_ITERATOR) - -// This is the case where everything conforms except BOOST_NO_STD_ITERATOR_TRAITS - -namespace boost { namespace detail { - -// Rogue Wave Standard Library fools itself into thinking partial -// specialization is missing on some platforms (e.g. Sun), so fails to -// supply iterator_traits! -template <class Iterator> -struct iterator_traits -{ - typedef typename Iterator::value_type value_type; - typedef typename Iterator::reference reference; - typedef typename Iterator::pointer pointer; - typedef typename Iterator::difference_type difference_type; - typedef typename Iterator::iterator_category iterator_category; -}; - -template <class T> -struct iterator_traits<T*> -{ - typedef T value_type; - typedef T& reference; - typedef T* pointer; - typedef std::ptrdiff_t difference_type; - typedef std::random_access_iterator_tag iterator_category; -}; - -template <class T> -struct iterator_traits<T const*> -{ - typedef T value_type; - typedef T const& reference; - typedef T const* pointer; - typedef std::ptrdiff_t difference_type; - typedef std::random_access_iterator_tag iterator_category; -}; - -}} // namespace boost::detail - -# else - -# include <boost/type_traits/remove_const.hpp> -# include <boost/type_traits/detail/yes_no_type.hpp> -# include <boost/type_traits/is_pointer.hpp> - -# ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -# include <boost/type_traits/is_same.hpp> -# include <boost/type_traits/remove_pointer.hpp> -# endif -# ifdef BOOST_BAD_OUTPUT_ITERATOR_SPECIALIZATION -# include <boost/type_traits/is_base_and_derived.hpp> -# endif - -# include <boost/mpl/if.hpp> -# include <boost/mpl/has_xxx.hpp> -# include <cstddef> - -// should be the last #include -# include "boost/type_traits/detail/bool_trait_def.hpp" - -namespace boost { namespace detail { - -BOOST_MPL_HAS_XXX_TRAIT_DEF(value_type) -BOOST_MPL_HAS_XXX_TRAIT_DEF(reference) -BOOST_MPL_HAS_XXX_TRAIT_DEF(pointer) -BOOST_MPL_HAS_XXX_TRAIT_DEF(difference_type) -BOOST_MPL_HAS_XXX_TRAIT_DEF(iterator_category) - -// is_mutable_iterator -- -// -// A metafunction returning true iff T is a mutable iterator type -// with a nested value_type. Will only work portably with iterators -// whose operator* returns a reference, but that seems to be OK for -// the iterators supplied by Dinkumware. Some input iterators may -// compile-time if they arrive here, and if the compiler is strict -// about not taking the address of an rvalue. - -// This one detects ordinary mutable iterators - the result of -// operator* is convertible to the value_type. -template <class T> -type_traits::yes_type is_mutable_iterator_helper(T const*, BOOST_DEDUCED_TYPENAME T::value_type*); - -// Since you can't take the address of an rvalue, the guts of -// is_mutable_iterator_impl will fail if we use &*t directly. This -// makes sure we can still work with non-lvalue iterators. -template <class T> T* mutable_iterator_lvalue_helper(T& x); -int mutable_iterator_lvalue_helper(...); - - -// This one detects output iterators such as ostream_iterator which -// return references to themselves. -template <class T> -type_traits::yes_type is_mutable_iterator_helper(T const*, T const*); - -type_traits::no_type is_mutable_iterator_helper(...); - -template <class T> -struct is_mutable_iterator_impl -{ - static T t; - - BOOST_STATIC_CONSTANT( - bool, value = sizeof( - detail::is_mutable_iterator_helper( - (T*)0 - , mutable_iterator_lvalue_helper(*t) // like &*t - )) - == sizeof(type_traits::yes_type) - ); -}; - -BOOST_TT_AUX_BOOL_TRAIT_DEF1( - is_mutable_iterator,T,::boost::detail::is_mutable_iterator_impl<T>::value) - - -// is_full_iterator_traits -- -// -// A metafunction returning true iff T has all the requisite nested -// types to satisfy the requirements for a fully-conforming -// iterator_traits implementation. -template <class T> -struct is_full_iterator_traits_impl -{ - enum { value = - has_value_type<T>::value - & has_reference<T>::value - & has_pointer<T>::value - & has_difference_type<T>::value - & has_iterator_category<T>::value - }; -}; - -BOOST_TT_AUX_BOOL_TRAIT_DEF1( - is_full_iterator_traits,T,::boost::detail::is_full_iterator_traits_impl<T>::value) +#define ITERATOR_DWA122600_HPP_ +// This header is obsolete and will be deprecated. -# ifdef BOOST_BAD_CONTAINER_ITERATOR_CATEGORY_TYPEDEF -BOOST_MPL_HAS_XXX_TRAIT_DEF(_Iterator_category) - -// is_stlport_40_debug_iterator -- -// -// A metafunction returning true iff T has all the requisite nested -// types to satisfy the requirements of an STLPort 4.0 debug iterator -// iterator_traits implementation. -template <class T> -struct is_stlport_40_debug_iterator_impl -{ - enum { value = - has_value_type<T>::value - & has_reference<T>::value - & has_pointer<T>::value - & has_difference_type<T>::value - & has__Iterator_category<T>::value - }; -}; - -BOOST_TT_AUX_BOOL_TRAIT_DEF1( - is_stlport_40_debug_iterator,T,::boost::detail::is_stlport_40_debug_iterator_impl<T>::value) - -template <class T> -struct stlport_40_debug_iterator_traits -{ - typedef typename T::value_type value_type; - typedef typename T::reference reference; - typedef typename T::pointer pointer; - typedef typename T::difference_type difference_type; - typedef typename T::_Iterator_category iterator_category; -}; -# endif // BOOST_BAD_CONTAINER_ITERATOR_CATEGORY_TYPEDEF - -template <class T> struct pointer_iterator_traits; - -# ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -template <class T> -struct pointer_iterator_traits<T*> -{ - typedef typename remove_const<T>::type value_type; - typedef T* pointer; - typedef T& reference; - typedef std::random_access_iterator_tag iterator_category; - typedef std::ptrdiff_t difference_type; -}; -# else - -// In case of no template partial specialization, and if T is a -// pointer, iterator_traits<T>::value_type can still be computed. For -// some basic types, remove_pointer is manually defined in -// type_traits/broken_compiler_spec.hpp. For others, do it yourself. - -template<class P> class please_invoke_BOOST_TT_BROKEN_COMPILER_SPEC_on_cv_unqualified_pointee; - -template<class P> -struct pointer_value_type - : mpl::if_< - is_same<P, typename remove_pointer<P>::type> - , please_invoke_BOOST_TT_BROKEN_COMPILER_SPEC_on_cv_unqualified_pointee<P> - , typename remove_const< - typename remove_pointer<P>::type - >::type - > -{ -}; - - -template<class P> -struct pointer_reference - : mpl::if_< - is_same<P, typename remove_pointer<P>::type> - , please_invoke_BOOST_TT_BROKEN_COMPILER_SPEC_on_cv_unqualified_pointee<P> - , typename remove_pointer<P>::type& - > -{ -}; - -template <class T> -struct pointer_iterator_traits -{ - typedef T pointer; - typedef std::random_access_iterator_tag iterator_category; - typedef std::ptrdiff_t difference_type; - - typedef typename pointer_value_type<T>::type value_type; - typedef typename pointer_reference<T>::type reference; -}; - -# endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - -// We'll sort iterator types into one of these classifications, from which we -// can determine the difference_type, pointer, reference, and value_type -template <class Iterator> -struct standard_iterator_traits -{ - typedef typename Iterator::difference_type difference_type; - typedef typename Iterator::value_type value_type; - typedef typename Iterator::pointer pointer; - typedef typename Iterator::reference reference; - typedef typename Iterator::iterator_category iterator_category; -}; - -template <class Iterator> -struct msvc_stdlib_mutable_traits - : std::iterator_traits<Iterator> -{ - typedef typename std::iterator_traits<Iterator>::distance_type difference_type; - typedef typename std::iterator_traits<Iterator>::value_type* pointer; - typedef typename std::iterator_traits<Iterator>::value_type& reference; -}; +#include <iterator> -template <class Iterator> -struct msvc_stdlib_const_traits - : std::iterator_traits<Iterator> +namespace boost { - typedef typename std::iterator_traits<Iterator>::distance_type difference_type; - typedef const typename std::iterator_traits<Iterator>::value_type* pointer; - typedef const typename std::iterator_traits<Iterator>::value_type& reference; -}; -# ifdef BOOST_BAD_OUTPUT_ITERATOR_SPECIALIZATION -template <class Iterator> -struct is_bad_output_iterator - : is_base_and_derived< - std::iterator<std::output_iterator_tag,void,void,void,void> - , Iterator> +namespace detail { -}; -struct bad_output_iterator_traits -{ - typedef void value_type; - typedef void difference_type; - typedef std::output_iterator_tag iterator_category; - typedef void pointer; - typedef void reference; -}; -# endif - -// If we're looking at an MSVC6 (old Dinkumware) ``standard'' -// iterator, this will generate an appropriate traits class. -template <class Iterator> -struct msvc_stdlib_iterator_traits - : mpl::if_< - is_mutable_iterator<Iterator> - , msvc_stdlib_mutable_traits<Iterator> - , msvc_stdlib_const_traits<Iterator> - >::type -{}; - -template <class Iterator> -struct non_pointer_iterator_traits - : mpl::if_< - // if the iterator contains all the right nested types... - is_full_iterator_traits<Iterator> - // Use a standard iterator_traits implementation - , standard_iterator_traits<Iterator> -# ifdef BOOST_BAD_CONTAINER_ITERATOR_CATEGORY_TYPEDEF - // Check for STLPort 4.0 broken _Iterator_category type - , mpl::if_< - is_stlport_40_debug_iterator<Iterator> - , stlport_40_debug_iterator_traits<Iterator> -# endif - // Otherwise, assume it's a Dinkum iterator - , msvc_stdlib_iterator_traits<Iterator> -# ifdef BOOST_BAD_CONTAINER_ITERATOR_CATEGORY_TYPEDEF - >::type -# endif - >::type -{ -}; - -template <class Iterator> -struct iterator_traits_aux - : mpl::if_< - is_pointer<Iterator> - , pointer_iterator_traits<Iterator> - , non_pointer_iterator_traits<Iterator> - >::type -{ -}; - -template <class Iterator> -struct iterator_traits -{ - // Explicit forwarding from base class needed to keep MSVC6 happy - // under some circumstances. - private: -# ifdef BOOST_BAD_OUTPUT_ITERATOR_SPECIALIZATION - typedef - typename mpl::if_< - is_bad_output_iterator<Iterator> - , bad_output_iterator_traits - , iterator_traits_aux<Iterator> - >::type base; -# else - typedef iterator_traits_aux<Iterator> base; -# endif - public: - typedef typename base::value_type value_type; - typedef typename base::pointer pointer; - typedef typename base::reference reference; - typedef typename base::difference_type difference_type; - typedef typename base::iterator_category iterator_category; -}; - -// This specialization cuts off ETI (Early Template Instantiation) for MSVC. -template <> struct iterator_traits<int> -{ - typedef int value_type; - typedef int pointer; - typedef int reference; - typedef int difference_type; - typedef int iterator_category; -}; - -}} // namespace boost::detail - -# endif // workarounds - -namespace boost { namespace detail { - -namespace iterator_traits_ -{ - template <class Iterator, class Difference> - struct distance_select - { - static Difference execute(Iterator i1, const Iterator i2, ...) - { - Difference result = 0; - while (i1 != i2) - { - ++i1; - ++result; - } - return result; - } - - static Difference execute(Iterator i1, const Iterator i2, std::random_access_iterator_tag*) - { - return i2 - i1; - } - }; -} // namespace boost::detail::iterator_traits_ - -template <class Iterator> -inline typename iterator_traits<Iterator>::difference_type -distance(Iterator first, Iterator last) -{ - typedef typename iterator_traits<Iterator>::difference_type diff_t; - typedef typename ::boost::detail::iterator_traits<Iterator>::iterator_category iterator_category; - - return iterator_traits_::distance_select<Iterator,diff_t>::execute( - first, last, (iterator_category*)0); -} - -}} - -# endif +using std::iterator_traits; +using std::distance; +} // namespace detail -# undef BOOST_BAD_CONTAINER_ITERATOR_CATEGORY_TYPEDEF -# undef BOOST_BAD_OUTPUT_ITERATOR_SPECIALIZATION +} // namespace boost #endif // ITERATOR_DWA122600_HPP_ diff --git a/boost/detail/lightweight_test.hpp b/boost/detail/lightweight_test.hpp index dbd99b97e9..9fece8ab7e 100644 --- a/boost/detail/lightweight_test.hpp +++ b/boost/detail/lightweight_test.hpp @@ -1,143 +1,17 @@ -#ifndef BOOST_DETAIL_LIGHTWEIGHT_TEST_HPP_INCLUDED -#define BOOST_DETAIL_LIGHTWEIGHT_TEST_HPP_INCLUDED +/* + * Copyright (c) 2014 Glen Fernandes + * + * 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) + */ -// MS compatible compilers support #pragma once +#ifndef BOOST_DETAIL_LIGHTWEIGHT_TEST_HPP +#define BOOST_DETAIL_LIGHTWEIGHT_TEST_HPP -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -// -// boost/detail/lightweight_test.hpp - lightweight test library -// -// Copyright (c) 2002, 2009 Peter Dimov -// Copyright (2) Beman Dawes 2010, 2011 -// -// 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 -// -// BOOST_TEST(expression) -// BOOST_ERROR(message) -// BOOST_TEST_EQ(expr1, expr2) -// -// int boost::report_errors() -// +// The header file at this path is deprecated; +// use boost/core/lightweight_test.hpp instead. -#include <iostream> -#include <boost/current_function.hpp> -#include <boost/assert.hpp> +#include <boost/core/lightweight_test.hpp> -// IDE's like Visual Studio perform better if output goes to std::cout or -// some other stream, so allow user to configure output stream: -#ifndef BOOST_LIGHTWEIGHT_TEST_OSTREAM -# define BOOST_LIGHTWEIGHT_TEST_OSTREAM std::cerr #endif - -namespace boost -{ - -namespace detail -{ - -struct report_errors_reminder -{ - bool called_report_errors_function; - report_errors_reminder() : called_report_errors_function(false) {} - ~report_errors_reminder() - { - BOOST_ASSERT(called_report_errors_function); // verify report_errors() was called - } -}; - -inline report_errors_reminder& report_errors_remind() -{ - static report_errors_reminder r; - return r; -} - -inline int & test_errors() -{ - static int x = 0; - report_errors_remind(); - return x; -} - -inline void test_failed_impl(char const * expr, char const * file, int line, char const * function) -{ - BOOST_LIGHTWEIGHT_TEST_OSTREAM - << file << "(" << line << "): test '" << expr << "' failed in function '" - << function << "'" << std::endl; - ++test_errors(); -} - -inline void error_impl(char const * msg, char const * file, int line, char const * function) -{ - BOOST_LIGHTWEIGHT_TEST_OSTREAM - << file << "(" << line << "): " << msg << " in function '" - << function << "'" << std::endl; - ++test_errors(); -} - -template<class T, class U> inline void test_eq_impl( char const * expr1, char const * expr2, - char const * file, int line, char const * function, T const & t, U const & u ) -{ - if( t == u ) - { - } - else - { - BOOST_LIGHTWEIGHT_TEST_OSTREAM - << file << "(" << line << "): test '" << expr1 << " == " << expr2 - << "' failed in function '" << function << "': " - << "'" << t << "' != '" << u << "'" << std::endl; - ++test_errors(); - } -} - -template<class T, class U> inline void test_ne_impl( char const * expr1, char const * expr2, - char const * file, int line, char const * function, T const & t, U const & u ) -{ - if( t != u ) - { - } - else - { - BOOST_LIGHTWEIGHT_TEST_OSTREAM - << file << "(" << line << "): test '" << expr1 << " != " << expr2 - << "' failed in function '" << function << "': " - << "'" << t << "' == '" << u << "'" << std::endl; - ++test_errors(); - } -} - -} // namespace detail - -inline int report_errors() -{ - detail::report_errors_remind().called_report_errors_function = true; - - int errors = detail::test_errors(); - - if( errors == 0 ) - { - BOOST_LIGHTWEIGHT_TEST_OSTREAM - << "No errors detected." << std::endl; - return 0; - } - else - { - BOOST_LIGHTWEIGHT_TEST_OSTREAM - << errors << " error" << (errors == 1? "": "s") << " detected." << std::endl; - return 1; - } -} - -} // namespace boost - -#define BOOST_TEST(expr) ((expr)? (void)0: ::boost::detail::test_failed_impl(#expr, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION)) -#define BOOST_ERROR(msg) ::boost::detail::error_impl(msg, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION) -#define BOOST_TEST_EQ(expr1,expr2) ( ::boost::detail::test_eq_impl(#expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) ) -#define BOOST_TEST_NE(expr1,expr2) ( ::boost::detail::test_ne_impl(#expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) ) - -#endif // #ifndef BOOST_DETAIL_LIGHTWEIGHT_TEST_HPP_INCLUDED diff --git a/boost/detail/limits.hpp b/boost/detail/limits.hpp deleted file mode 100644 index 6f018dfaca..0000000000 --- a/boost/detail/limits.hpp +++ /dev/null @@ -1,449 +0,0 @@ -// Copyright 2001 John Maddock -// Distributed under the Boost Software License, Version 1.0. (See accompany- -// ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) - -/* - * Copyright (c) 1997 - * Silicon Graphics Computer Systems, Inc. - * - * 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 appear in all copies and - * that both that copyright notice and this permission notice appear - * in supporting documentation. Silicon Graphics makes no - * representations about the suitability of this software for any - * purpose. It is provided "as is" without express or implied warranty. - */ - -/* NOTE: This is not portable code. Parts of numeric_limits<> are - * inherently machine-dependent, and this file is written for the MIPS - * architecture and the SGI MIPSpro C++ compiler. Parts of it (in - * particular, some of the characteristics of floating-point types) - * are almost certainly incorrect for any other platform. - */ - -/* The above comment is almost certainly out of date. This file works - * on systems other than SGI MIPSpro C++ now. - */ - -/* - * Revision history: - * 21 Sep 2001: - * Only include <cwchar> if BOOST_NO_CWCHAR is defined. (Darin Adler) - * 10 Aug 2001: - * Added MIPS (big endian) to the big endian family. (Jens Maurer) - * 13 Apr 2001: - * Added powerpc to the big endian family. (Jeremy Siek) - * 5 Apr 2001: - * Added sparc (big endian) processor support (John Maddock). - * Initial sub: - * Modified by Jens Maurer for gcc 2.95 on x86. - */ - -#ifndef BOOST_SGI_CPP_LIMITS -#define BOOST_SGI_CPP_LIMITS - -#include <climits> -#include <cfloat> -#include <boost/config.hpp> -#include <boost/detail/endian.hpp> - -#ifndef BOOST_NO_CWCHAR -#include <cwchar> // for WCHAR_MIN and WCHAR_MAX -#endif - -namespace std { - -enum float_round_style { - round_indeterminate = -1, - round_toward_zero = 0, - round_to_nearest = 1, - round_toward_infinity = 2, - round_toward_neg_infinity = 3 -}; - -enum float_denorm_style { - denorm_indeterminate = -1, - denorm_absent = 0, - denorm_present = 1 -}; - -// The C++ standard (section 18.2.1) requires that some of the members of -// numeric_limits be static const data members that are given constant- -// initializers within the class declaration. On compilers where the -// BOOST_NO_INCLASS_MEMBER_INITIALIZATION macro is defined, it is impossible to write -// a standard-conforming numeric_limits class. -// -// There are two possible workarounds: either initialize the data -// members outside the class, or change them from data members to -// enums. Neither workaround is satisfactory: the former makes it -// impossible to use the data members in constant-expressions, and the -// latter means they have the wrong type and that it is impossible to -// take their addresses. We choose the former workaround. - -#ifdef BOOST_NO_INCLASS_MEMBER_INITIALIZATION -# define BOOST_STL_DECLARE_LIMITS_MEMBER(__mem_type, __mem_name, __mem_value) \ - enum { __mem_name = __mem_value } -#else /* BOOST_NO_INCLASS_MEMBER_INITIALIZATION */ -# define BOOST_STL_DECLARE_LIMITS_MEMBER(__mem_type, __mem_name, __mem_value) \ - static const __mem_type __mem_name = __mem_value -#endif /* BOOST_NO_INCLASS_MEMBER_INITIALIZATION */ - -// Base class for all specializations of numeric_limits. -template <class __number> -class _Numeric_limits_base { -public: - BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_specialized, false); - - static __number min BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return __number(); } - static __number max BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return __number(); } - - BOOST_STL_DECLARE_LIMITS_MEMBER(int, digits, 0); - BOOST_STL_DECLARE_LIMITS_MEMBER(int, digits10, 0); - - BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_signed, false); - BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_integer, false); - BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_exact, false); - - BOOST_STL_DECLARE_LIMITS_MEMBER(int, radix, 0); - - static __number epsilon() throw() { return __number(); } - static __number round_error() throw() { return __number(); } - - BOOST_STL_DECLARE_LIMITS_MEMBER(int, min_exponent, 0); - BOOST_STL_DECLARE_LIMITS_MEMBER(int, min_exponent10, 0); - BOOST_STL_DECLARE_LIMITS_MEMBER(int, max_exponent, 0); - BOOST_STL_DECLARE_LIMITS_MEMBER(int, max_exponent10, 0); - - BOOST_STL_DECLARE_LIMITS_MEMBER(bool, has_infinity, false); - BOOST_STL_DECLARE_LIMITS_MEMBER(bool, has_quiet_NaN, false); - BOOST_STL_DECLARE_LIMITS_MEMBER(bool, has_signaling_NaN, false); - BOOST_STL_DECLARE_LIMITS_MEMBER(float_denorm_style, - has_denorm, - denorm_absent); - BOOST_STL_DECLARE_LIMITS_MEMBER(bool, has_denorm_loss, false); - - static __number infinity() throw() { return __number(); } - static __number quiet_NaN() throw() { return __number(); } - static __number signaling_NaN() throw() { return __number(); } - static __number denorm_min() throw() { return __number(); } - - BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_iec559, false); - BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_bounded, false); - BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_modulo, false); - - BOOST_STL_DECLARE_LIMITS_MEMBER(bool, traps, false); - BOOST_STL_DECLARE_LIMITS_MEMBER(bool, tinyness_before, false); - BOOST_STL_DECLARE_LIMITS_MEMBER(float_round_style, - round_style, - round_toward_zero); -}; - -// Base class for integers. - -template <class _Int, - _Int __imin, - _Int __imax, - int __idigits = -1> -class _Integer_limits : public _Numeric_limits_base<_Int> -{ -public: - BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_specialized, true); - - static _Int min BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return __imin; } - static _Int max BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return __imax; } - - BOOST_STL_DECLARE_LIMITS_MEMBER(int, - digits, - (__idigits < 0) ? (int)(sizeof(_Int) * CHAR_BIT) - - (__imin == 0 ? 0 : 1) - : __idigits); - BOOST_STL_DECLARE_LIMITS_MEMBER(int, digits10, (digits * 301) / 1000); - // log 2 = 0.301029995664... - - BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_signed, __imin != 0); - BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_integer, true); - BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_exact, true); - BOOST_STL_DECLARE_LIMITS_MEMBER(int, radix, 2); - - BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_bounded, true); - BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_modulo, true); -}; - -#if defined(BOOST_BIG_ENDIAN) - - template<class Number, unsigned int Word> - struct float_helper{ - static Number get_word() throw() { - // sizeof(long double) == 16 - const unsigned int _S_word[4] = { Word, 0, 0, 0 }; - return *reinterpret_cast<const Number*>(&_S_word); - } -}; - -#else - - template<class Number, unsigned int Word> - struct float_helper{ - static Number get_word() throw() { - // sizeof(long double) == 12, but only 10 bytes significant - const unsigned int _S_word[4] = { 0, 0, 0, Word }; - return *reinterpret_cast<const Number*>( - reinterpret_cast<const char *>(&_S_word)+16- - (sizeof(Number) == 12 ? 10 : sizeof(Number))); - } -}; - -#endif - -// Base class for floating-point numbers. -template <class __number, - int __Digits, int __Digits10, - int __MinExp, int __MaxExp, - int __MinExp10, int __MaxExp10, - unsigned int __InfinityWord, - unsigned int __QNaNWord, unsigned int __SNaNWord, - bool __IsIEC559, - float_round_style __RoundStyle> -class _Floating_limits : public _Numeric_limits_base<__number> -{ -public: - BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_specialized, true); - - BOOST_STL_DECLARE_LIMITS_MEMBER(int, digits, __Digits); - BOOST_STL_DECLARE_LIMITS_MEMBER(int, digits10, __Digits10); - - BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_signed, true); - - BOOST_STL_DECLARE_LIMITS_MEMBER(int, radix, 2); - - BOOST_STL_DECLARE_LIMITS_MEMBER(int, min_exponent, __MinExp); - BOOST_STL_DECLARE_LIMITS_MEMBER(int, max_exponent, __MaxExp); - BOOST_STL_DECLARE_LIMITS_MEMBER(int, min_exponent10, __MinExp10); - BOOST_STL_DECLARE_LIMITS_MEMBER(int, max_exponent10, __MaxExp10); - - BOOST_STL_DECLARE_LIMITS_MEMBER(bool, has_infinity, true); - BOOST_STL_DECLARE_LIMITS_MEMBER(bool, has_quiet_NaN, true); - BOOST_STL_DECLARE_LIMITS_MEMBER(bool, has_signaling_NaN, true); - BOOST_STL_DECLARE_LIMITS_MEMBER(float_denorm_style, - has_denorm, - denorm_indeterminate); - BOOST_STL_DECLARE_LIMITS_MEMBER(bool, has_denorm_loss, false); - - - static __number infinity() throw() { - return float_helper<__number, __InfinityWord>::get_word(); - } - static __number quiet_NaN() throw() { - return float_helper<__number,__QNaNWord>::get_word(); - } - static __number signaling_NaN() throw() { - return float_helper<__number,__SNaNWord>::get_word(); - } - - BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_iec559, __IsIEC559); - BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_bounded, true); - BOOST_STL_DECLARE_LIMITS_MEMBER(bool, traps, false /* was: true */ ); - BOOST_STL_DECLARE_LIMITS_MEMBER(bool, tinyness_before, false); - - BOOST_STL_DECLARE_LIMITS_MEMBER(float_round_style, round_style, __RoundStyle); -}; - -// Class numeric_limits - -// The unspecialized class. - -template<class T> -class numeric_limits : public _Numeric_limits_base<T> {}; - -// Specializations for all built-in integral types. - -template<> -class numeric_limits<bool> - : public _Integer_limits<bool, false, true, 0> -{}; - -template<> -class numeric_limits<char> - : public _Integer_limits<char, CHAR_MIN, CHAR_MAX> -{}; - -template<> -class numeric_limits<signed char> - : public _Integer_limits<signed char, SCHAR_MIN, SCHAR_MAX> -{}; - -template<> -class numeric_limits<unsigned char> - : public _Integer_limits<unsigned char, 0, UCHAR_MAX> -{}; - -#ifndef BOOST_NO_INTRINSIC_WCHAR_T -template<> -class numeric_limits<wchar_t> -#if !defined(WCHAR_MAX) || !defined(WCHAR_MIN) -#if defined(_WIN32) || defined(__CYGWIN__) - : public _Integer_limits<wchar_t, 0, USHRT_MAX> -#elif defined(__hppa) -// wchar_t has "unsigned int" as the underlying type - : public _Integer_limits<wchar_t, 0, UINT_MAX> -#else -// assume that wchar_t has "int" as the underlying type - : public _Integer_limits<wchar_t, INT_MIN, INT_MAX> -#endif -#else -// we have WCHAR_MIN and WCHAR_MAX defined, so use it - : public _Integer_limits<wchar_t, WCHAR_MIN, WCHAR_MAX> -#endif -{}; -#endif - -template<> -class numeric_limits<short> - : public _Integer_limits<short, SHRT_MIN, SHRT_MAX> -{}; - -template<> -class numeric_limits<unsigned short> - : public _Integer_limits<unsigned short, 0, USHRT_MAX> -{}; - -template<> -class numeric_limits<int> - : public _Integer_limits<int, INT_MIN, INT_MAX> -{}; - -template<> -class numeric_limits<unsigned int> - : public _Integer_limits<unsigned int, 0, UINT_MAX> -{}; - -template<> -class numeric_limits<long> - : public _Integer_limits<long, LONG_MIN, LONG_MAX> -{}; - -template<> -class numeric_limits<unsigned long> - : public _Integer_limits<unsigned long, 0, ULONG_MAX> -{}; - -#ifdef __GNUC__ - -// Some compilers have long long, but don't define the -// LONGLONG_MIN and LONGLONG_MAX macros in limits.h. This -// assumes that long long is 64 bits. -#if !defined(LONGLONG_MAX) && !defined(ULONGLONG_MAX) - -# define ULONGLONG_MAX 0xffffffffffffffffLLU -# define LONGLONG_MAX 0x7fffffffffffffffLL - -#endif - -#if !defined(LONGLONG_MIN) -# define LONGLONG_MIN (-LONGLONG_MAX - 1) -#endif - - -#if !defined(ULONGLONG_MIN) -# define ULONGLONG_MIN 0 -#endif - -#endif /* __GNUC__ */ - -// Specializations for all built-in floating-point type. - -template<> class numeric_limits<float> - : public _Floating_limits<float, - FLT_MANT_DIG, // Binary digits of precision - FLT_DIG, // Decimal digits of precision - FLT_MIN_EXP, // Minimum exponent - FLT_MAX_EXP, // Maximum exponent - FLT_MIN_10_EXP, // Minimum base 10 exponent - FLT_MAX_10_EXP, // Maximum base 10 exponent -#if defined(BOOST_BIG_ENDIAN) - 0x7f80 << (sizeof(int)*CHAR_BIT-16), // Last word of +infinity - 0x7f81 << (sizeof(int)*CHAR_BIT-16), // Last word of quiet NaN - 0x7fc1 << (sizeof(int)*CHAR_BIT-16), // Last word of signaling NaN -#else - 0x7f800000u, // Last word of +infinity - 0x7f810000u, // Last word of quiet NaN - 0x7fc10000u, // Last word of signaling NaN -#endif - true, // conforms to iec559 - round_to_nearest> -{ -public: - static float min BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return FLT_MIN; } - static float denorm_min() throw() { return FLT_MIN; } - static float max BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return FLT_MAX; } - static float epsilon() throw() { return FLT_EPSILON; } - static float round_error() throw() { return 0.5f; } // Units: ulps. -}; - -template<> class numeric_limits<double> - : public _Floating_limits<double, - DBL_MANT_DIG, // Binary digits of precision - DBL_DIG, // Decimal digits of precision - DBL_MIN_EXP, // Minimum exponent - DBL_MAX_EXP, // Maximum exponent - DBL_MIN_10_EXP, // Minimum base 10 exponent - DBL_MAX_10_EXP, // Maximum base 10 exponent -#if defined(BOOST_BIG_ENDIAN) - 0x7ff0 << (sizeof(int)*CHAR_BIT-16), // Last word of +infinity - 0x7ff1 << (sizeof(int)*CHAR_BIT-16), // Last word of quiet NaN - 0x7ff9 << (sizeof(int)*CHAR_BIT-16), // Last word of signaling NaN -#else - 0x7ff00000u, // Last word of +infinity - 0x7ff10000u, // Last word of quiet NaN - 0x7ff90000u, // Last word of signaling NaN -#endif - true, // conforms to iec559 - round_to_nearest> -{ -public: - static double min BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return DBL_MIN; } - static double denorm_min() throw() { return DBL_MIN; } - static double max BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return DBL_MAX; } - static double epsilon() throw() { return DBL_EPSILON; } - static double round_error() throw() { return 0.5; } // Units: ulps. -}; - -template<> class numeric_limits<long double> - : public _Floating_limits<long double, - LDBL_MANT_DIG, // Binary digits of precision - LDBL_DIG, // Decimal digits of precision - LDBL_MIN_EXP, // Minimum exponent - LDBL_MAX_EXP, // Maximum exponent - LDBL_MIN_10_EXP,// Minimum base 10 exponent - LDBL_MAX_10_EXP,// Maximum base 10 exponent -#if defined(BOOST_BIG_ENDIAN) - 0x7ff0 << (sizeof(int)*CHAR_BIT-16), // Last word of +infinity - 0x7ff1 << (sizeof(int)*CHAR_BIT-16), // Last word of quiet NaN - 0x7ff9 << (sizeof(int)*CHAR_BIT-16), // Last word of signaling NaN -#else - 0x7fff8000u, // Last word of +infinity - 0x7fffc000u, // Last word of quiet NaN - 0x7fff9000u, // Last word of signaling NaN -#endif - false, // Doesn't conform to iec559 - round_to_nearest> -{ -public: - static long double min BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return LDBL_MIN; } - static long double denorm_min() throw() { return LDBL_MIN; } - static long double max BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return LDBL_MAX; } - static long double epsilon() throw() { return LDBL_EPSILON; } - static long double round_error() throw() { return 4; } // Units: ulps. -}; - -} // namespace std - -#endif /* BOOST_SGI_CPP_LIMITS */ - -// Local Variables: -// mode:C++ -// End: - - - diff --git a/boost/detail/no_exceptions_support.hpp b/boost/detail/no_exceptions_support.hpp index d94e35834f..7d17454a73 100644 --- a/boost/detail/no_exceptions_support.hpp +++ b/boost/detail/no_exceptions_support.hpp @@ -1,87 +1,17 @@ -#ifndef BOOST_DETAIL_NO_EXCEPTIONS_SUPPORT_HPP_ -#define BOOST_DETAIL_NO_EXCEPTIONS_SUPPORT_HPP_ +/* + * Copyright (c) 2014 Glen Fernandes + * + * 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 _MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif - -//---------------------------------------------------------------------- -// (C) Copyright 2004 Pavel Vozenilek. -// Use, modification and distribution is subject to 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) -// -// -// This file contains helper macros used when exception support may be -// disabled (as indicated by macro BOOST_NO_EXCEPTIONS). -// -// Before picking up these macros you may consider using RAII techniques -// to deal with exceptions - their syntax can be always the same with -// or without exception support enabled. -// - -/* Example of use: - -void foo() { - BOOST_TRY { - ... - } BOOST_CATCH(const std::bad_alloc&) { - ... - BOOST_RETHROW - } BOOST_CATCH(const std::exception& e) { - ... - } - BOOST_CATCH_END -} - -With exception support enabled it will expand into: +#ifndef BOOST_DETAIL_NO_EXCEPTIONS_SUPPORT_HPP +#define BOOST_DETAIL_NO_EXCEPTIONS_SUPPORT_HPP -void foo() { - { try { - ... - } catch (const std::bad_alloc&) { - ... - throw; - } catch (const std::exception& e) { - ... - } - } -} +// The header file at this path is deprecated; +// use boost/core/no_exceptions_support.hpp instead. -With exception support disabled it will expand into: +#include <boost/core/no_exceptions_support.hpp> -void foo() { - { if(true) { - ... - } else if (false) { - ... - } else if (false) { - ... - } - } -} -*/ -//---------------------------------------------------------------------- - -#include <boost/config.hpp> -#include <boost/detail/workaround.hpp> - -#if !(defined BOOST_NO_EXCEPTIONS) -# define BOOST_TRY { try -# define BOOST_CATCH(x) catch(x) -# define BOOST_RETHROW throw; -# define BOOST_CATCH_END } -#else -# if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) -# define BOOST_TRY { if ("") -# define BOOST_CATCH(x) else if (!"") -# else -# define BOOST_TRY { if (true) -# define BOOST_CATCH(x) else if (false) -# endif -# define BOOST_RETHROW -# define BOOST_CATCH_END } #endif - - -#endif diff --git a/boost/detail/none_t.hpp b/boost/detail/none_t.hpp deleted file mode 100644 index 40805ec0ff..0000000000 --- a/boost/detail/none_t.hpp +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (C) 2003, Fernando Luis Cacciola Carballal. -// -// Use, modification, and distribution is subject to 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) -// -// See http://www.boost.org/libs/optional for documentation. -// -// You are welcome to contact the author at: -// fernando_cacciola@hotmail.com -// -#ifndef BOOST_DETAIL_NONE_T_17SEP2003_HPP -#define BOOST_DETAIL_NONE_T_17SEP2003_HPP - -namespace boost { - -namespace detail { - -struct none_helper{}; - -typedef int none_helper::*none_t ; - -} // namespace detail - -} // namespace boost - -#endif - diff --git a/boost/detail/numeric_traits.hpp b/boost/detail/numeric_traits.hpp index 6325d70cb0..2f97ebf9c8 100644 --- a/boost/detail/numeric_traits.hpp +++ b/boost/detail/numeric_traits.hpp @@ -74,7 +74,7 @@ namespace boost { namespace detail { template <class Number> struct is_signed { -#if defined(BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS) || defined(BOOST_MSVC) && BOOST_MSVC <= 1300 +#if defined(BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS) BOOST_STATIC_CONSTANT(bool, value = (Number(-1) < Number(0))); #else BOOST_STATIC_CONSTANT(bool, value = std::numeric_limits<Number>::is_signed); @@ -128,15 +128,6 @@ namespace boost { namespace detail { private: typedef Integer integer_type; typedef std::numeric_limits<integer_type> x; -# if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 - // for some reason, MSVC asserts when it shouldn't unless we make these - // local definitions - BOOST_STATIC_CONSTANT(bool, is_integer = x::is_integer); - BOOST_STATIC_CONSTANT(bool, is_specialized = x::is_specialized); - - BOOST_STATIC_ASSERT(is_integer); - BOOST_STATIC_ASSERT(is_specialized); -# endif public: typedef typename if_true<(int(x::is_signed) diff --git a/boost/detail/ob_call_traits.hpp b/boost/detail/ob_call_traits.hpp deleted file mode 100644 index eb4df7a30f..0000000000 --- a/boost/detail/ob_call_traits.hpp +++ /dev/null @@ -1,168 +0,0 @@ -// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000. -// Use, modification and distribution are subject to 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). -// -// See http://www.boost.org/libs/utility for most recent version including documentation. -// -// Crippled version for crippled compilers: -// see libs/utility/call_traits.htm -// - -/* Release notes: - 01st October 2000: - Fixed call_traits on VC6, using "poor man's partial specialisation", - using ideas taken from "Generative programming" by Krzysztof Czarnecki - & Ulrich Eisenecker. -*/ - -#ifndef BOOST_OB_CALL_TRAITS_HPP -#define BOOST_OB_CALL_TRAITS_HPP - -#ifndef BOOST_CONFIG_HPP -#include <boost/config.hpp> -#endif - -#ifndef BOOST_ARITHMETIC_TYPE_TRAITS_HPP -#include <boost/type_traits/arithmetic_traits.hpp> -#endif -#ifndef BOOST_COMPOSITE_TYPE_TRAITS_HPP -#include <boost/type_traits/composite_traits.hpp> -#endif - -namespace boost{ - -#ifdef BOOST_MSVC6_MEMBER_TEMPLATES -// -// use member templates to emulate -// partial specialisation: -// -namespace detail{ - -template <class T> -struct standard_call_traits -{ - typedef T value_type; - typedef T& reference; - typedef const T& const_reference; - typedef const T& param_type; -}; -template <class T> -struct simple_call_traits -{ - typedef T value_type; - typedef T& reference; - typedef const T& const_reference; - typedef const T param_type; -}; -template <class T> -struct reference_call_traits -{ - typedef T value_type; - typedef T reference; - typedef T const_reference; - typedef T param_type; -}; - -template <bool pointer, bool arithmetic, bool reference> -struct call_traits_chooser -{ - template <class T> - struct rebind - { - typedef standard_call_traits<T> type; - }; -}; - -template <> -struct call_traits_chooser<true, false, false> -{ - template <class T> - struct rebind - { - typedef simple_call_traits<T> type; - }; -}; - -template <> -struct call_traits_chooser<false, false, true> -{ - template <class T> - struct rebind - { - typedef reference_call_traits<T> type; - }; -}; - -template <bool size_is_small> -struct call_traits_sizeof_chooser2 -{ - template <class T> - struct small_rebind - { - typedef simple_call_traits<T> small_type; - }; -}; - -template<> -struct call_traits_sizeof_chooser2<false> -{ - template <class T> - struct small_rebind - { - typedef standard_call_traits<T> small_type; - }; -}; - -template <> -struct call_traits_chooser<false, true, false> -{ - template <class T> - struct rebind - { - enum { sizeof_choice = (sizeof(T) <= sizeof(void*)) }; - typedef call_traits_sizeof_chooser2<(sizeof(T) <= sizeof(void*))> chooser; - typedef typename chooser::template small_rebind<T> bound_type; - typedef typename bound_type::small_type type; - }; -}; - -} // namespace detail -template <typename T> -struct call_traits -{ -private: - typedef detail::call_traits_chooser< - ::boost::is_pointer<T>::value, - ::boost::is_arithmetic<T>::value, - ::boost::is_reference<T>::value - > chooser; - typedef typename chooser::template rebind<T> bound_type; - typedef typename bound_type::type call_traits_type; -public: - typedef typename call_traits_type::value_type value_type; - typedef typename call_traits_type::reference reference; - typedef typename call_traits_type::const_reference const_reference; - typedef typename call_traits_type::param_type param_type; -}; - -#else -// -// sorry call_traits is completely non-functional -// blame your broken compiler: -// - -template <typename T> -struct call_traits -{ - typedef T value_type; - typedef T& reference; - typedef const T& const_reference; - typedef const T& param_type; -}; - -#endif // member templates - -} - -#endif // BOOST_OB_CALL_TRAITS_HPP diff --git a/boost/detail/ob_compressed_pair.hpp b/boost/detail/ob_compressed_pair.hpp index 727acab6da..326e454980 100644 --- a/boost/detail/ob_compressed_pair.hpp +++ b/boost/detail/ob_compressed_pair.hpp @@ -167,17 +167,6 @@ public: compressed_pair_1(const ::boost::compressed_pair<T1,T2>& x) : T2(x.second()), _first(x.first()) {} -#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300 - // Total weirdness. If the assignment to _first is moved after - // the call to the inherited operator=, then this breaks graph/test/graph.cpp - // by way of iterator_adaptor. - compressed_pair_1& operator=(const compressed_pair_1& x) { - _first = x._first; - T2::operator=(x); - return *this; - } -#endif - first_reference first() { return _first; } first_const_reference first() const { return _first; } diff --git a/boost/detail/reference_content.hpp b/boost/detail/reference_content.hpp index daf56a8b19..36b80d244e 100644 --- a/boost/detail/reference_content.hpp +++ b/boost/detail/reference_content.hpp @@ -15,13 +15,8 @@ #include "boost/config.hpp" -#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) # include "boost/mpl/bool.hpp" # include "boost/type_traits/has_nothrow_copy.hpp" -#else -# include "boost/mpl/if.hpp" -# include "boost/type_traits/is_reference.hpp" -#endif #include "boost/mpl/void.hpp" @@ -78,7 +73,6 @@ public: // queries template <typename T = mpl::void_> struct make_reference_content; -#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) template <typename T> struct make_reference_content @@ -92,19 +86,6 @@ struct make_reference_content< T& > typedef reference_content<T&> type; }; -#else // defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) - -template <typename T> -struct make_reference_content - : mpl::if_< - is_reference<T> - , reference_content<T> - , T - > -{ -}; - -#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION workaround template <> struct make_reference_content< mpl::void_ > @@ -124,7 +105,6 @@ struct make_reference_content< mpl::void_ > // reference_content<T&> type traits specializations // -#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) template <typename T> struct has_nothrow_copy< @@ -134,7 +114,6 @@ struct has_nothrow_copy< { }; -#endif // !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) } // namespace boost diff --git a/boost/detail/scoped_enum_emulation.hpp b/boost/detail/scoped_enum_emulation.hpp index 80394cf433..1c7bc23c1c 100644 --- a/boost/detail/scoped_enum_emulation.hpp +++ b/boost/detail/scoped_enum_emulation.hpp @@ -1,337 +1,17 @@ -// scoped_enum_emulation.hpp ---------------------------------------------------------// - -// Copyright Beman Dawes, 2009 -// Copyright (C) 2011-2012 Vicente J. Botet Escriba -// Copyright (C) 2012 Anthony Williams - -// Distributed under the Boost Software License, Version 1.0. -// See http://www.boost.org/LICENSE_1_0.txt - /* -[section:scoped_enums Scoped Enums] - -Generates C++0x scoped enums if the feature is present, otherwise emulates C++0x -scoped enums with C++03 namespaces and enums. The Boost.Config BOOST_NO_SCOPED_ENUMS -macro is used to detect feature support. - -See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2347.pdf for a -description of the scoped enum feature. Note that the committee changed the name -from strongly typed enum to scoped enum. - -Some of the enumerations defined in the standard library are scoped enums. - - enum class future_errc - { - broken_promise, - future_already_retrieved, - promise_already_satisfied, - no_state - }; - -On compilers that don't support them, the library provides two emulations: - -[heading Strict] - -* Able to specify the underlying type. -* explicit conversion to/from underlying type. -* The wrapper is not a C++03 enum type. - -The user can declare declare these types as - - BOOST_SCOPED_ENUM_DECLARE_BEGIN(future_errc) - { - broken_promise, - future_already_retrieved, - promise_already_satisfied, - no_state - } - BOOST_SCOPED_ENUM_DECLARE_END(future_errc) - -These macros allows to use 'future_errc' in almost all the cases as an scoped enum. - - future_errc err = future_errc::no_state; - -There are however some limitations: - -* The type is not a C++ enum, so 'is_enum<future_errc>' will be false_type. -* The emulated scoped enum can not be used in switch nor in template arguments. For these cases the user needs to use some macros. - -Instead of - - switch (ev) - { - case future_errc::broken_promise: - // ... - -use - - switch (boost::native_value(ev)) - { - case future_errc::broken_promise: - -And instead of - - #ifdef BOOST_NO_SCOPED_ENUMS - template <> - struct BOOST_SYMBOL_VISIBLE is_error_code_enum<future_errc> : public true_type { }; - #endif - -use - - #ifdef BOOST_NO_SCOPED_ENUMS - template <> - struct BOOST_SYMBOL_VISIBLE is_error_code_enum<future_errc::enum_type > : public true_type { }; - #endif - - -Sample usage: - - BOOST_SCOPED_ENUM_UT_DECLARE_BEGIN(algae, char) { green, red, cyan }; BOOST_SCOPED_ENUM_DECLARE_END(algae) - ... - algae sample( algae::red ); - void foo( algae color ); - ... - sample = algae::green; - foo( algae::cyan ); - - Light - Caution: only the syntax is emulated; the semantics are not emulated and - the syntax emulation doesn't include being able to specify the underlying - representation type. - - The literal scoped emulation is via struct rather than namespace to allow use within classes. - Thanks to Andrey Semashev for pointing that out. - However the type is an real C++03 enum and so convertible implicitly to an int. - - Sample usage: - - BOOST_SCOPED_ENUM_START(algae) { green, red, cyan }; BOOST_SCOPED_ENUM_END - ... - BOOST_SCOPED_ENUM(algae) sample( algae::red ); - void foo( BOOST_SCOPED_ENUM(algae) color ); - ... - sample = algae::green; - foo( algae::cyan ); - - Helpful comments and suggestions were also made by Kjell Elster, Phil Endecott, - Joel Falcou, Mathias Gaunard, Felipe Magno de Almeida, Matt Calabrese, Vicente - Botet, and Daniel James. - -[endsect] -*/ - - -#ifndef BOOST_SCOPED_ENUM_EMULATION_HPP -#define BOOST_SCOPED_ENUM_EMULATION_HPP - -#include <boost/config.hpp> -#include <boost/detail/workaround.hpp> - -namespace boost -{ - -#ifdef BOOST_NO_SCOPED_ENUMS - /** - * Meta-function to get the underlying type of a scoped enum. - * - * Requires EnumType must be an enum type or the emulation of a scoped enum - */ - template <typename EnumType> - struct underlying_type - { - /** - * The member typedef type names the underlying type of EnumType. It is EnumType::underlying_type when the EnumType is an emulated scoped enum, - * std::underlying_type<EnumType>::type when the standard library std::underlying_type is provided. - * - * The user will need to specialize it when the compiler supports scoped enums but don't provides std::underlying_type. - */ - typedef typename EnumType::underlying_type type; - }; - - /** - * Meta-function to get the native enum type associated to an enum class or its emulation. - */ - template <typename EnumType> - struct native_type - { - /** - * The member typedef type names the native enum type associated to the scoped enum, - * which is it self if the compiler supports scoped enums or EnumType::enum_type if it is an emulated scoped enum. - */ - typedef typename EnumType::enum_type type; - }; - - /** - * Casts a scoped enum to its underlying type. - * - * This function is useful when working with scoped enum classes, which doens't implicitly convert to the underlying type. - * @param v A scoped enum. - * @returns The underlying type. - * @throws No-throws. - */ - template <typename UnderlyingType, typename EnumType> - UnderlyingType underlying_cast(EnumType v) - { - return v.get_underlying_value_(); - } - - /** - * Casts a scoped enum to its native enum type. - * - * This function is useful to make programs portable when the scoped enum emulation can not be use where native enums can. - * - * EnumType the scoped enum type - * - * @param v A scoped enum. - * @returns The native enum value. - * @throws No-throws. - */ - template <typename EnumType> - inline - typename EnumType::enum_type native_value(EnumType e) - { - return e.native_value_(); - } - -#else // BOOST_NO_SCOPED_ENUMS - - template <typename EnumType> - struct underlying_type - { - //typedef typename std::underlying_type<EnumType>::type type; - }; - - template <typename EnumType> - struct native_type - { - typedef EnumType type; - }; - - template <typename UnderlyingType, typename EnumType> - UnderlyingType underlying_cast(EnumType v) - { - return static_cast<UnderlyingType>(v); - } - - template <typename EnumType> - inline - EnumType native_value(EnumType e) - { - return e; - } - -#endif -} - - -#ifdef BOOST_NO_SCOPED_ENUMS - -#ifndef BOOST_NO_EXPLICIT_CONVERSION_OPERATORS - -#define BOOST_SCOPED_ENUM_UT_DECLARE_CONVERSION_OPERATOR \ - explicit operator underlying_type() const { return get_underlying_value_(); } - -#else - -#define BOOST_SCOPED_ENUM_UT_DECLARE_CONVERSION_OPERATOR - -#endif - -/** - * Start a declaration of a scoped enum. + * Copyright (c) 2014 Andrey Semashev * - * @param EnumType The new scoped enum. - * @param UnderlyingType The underlying type. + * 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) */ -#define BOOST_SCOPED_ENUM_UT_DECLARE_BEGIN(EnumType, UnderlyingType) \ - struct EnumType { \ - typedef UnderlyingType underlying_type; \ - EnumType() BOOST_NOEXCEPT {} \ - explicit EnumType(underlying_type v) : v_(v) {} \ - underlying_type get_underlying_value_() const { return v_; } \ - BOOST_SCOPED_ENUM_UT_DECLARE_CONVERSION_OPERATOR \ - private: \ - underlying_type v_; \ - typedef EnumType self_type; \ - public: \ - enum enum_type -#define BOOST_SCOPED_ENUM_DECLARE_END2() \ - enum_type get_native_value_() const BOOST_NOEXCEPT { return enum_type(v_); } \ - operator enum_type() const BOOST_NOEXCEPT { return get_native_value_(); } \ - friend bool operator ==(self_type lhs, self_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)==enum_type(rhs.v_); } \ - friend bool operator ==(self_type lhs, enum_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)==rhs; } \ - friend bool operator ==(enum_type lhs, self_type rhs) BOOST_NOEXCEPT { return lhs==enum_type(rhs.v_); } \ - friend bool operator !=(self_type lhs, self_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)!=enum_type(rhs.v_); } \ - friend bool operator !=(self_type lhs, enum_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)!=rhs; } \ - friend bool operator !=(enum_type lhs, self_type rhs) BOOST_NOEXCEPT { return lhs!=enum_type(rhs.v_); } \ - friend bool operator <(self_type lhs, self_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)<enum_type(rhs.v_); } \ - friend bool operator <(self_type lhs, enum_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)<rhs; } \ - friend bool operator <(enum_type lhs, self_type rhs) BOOST_NOEXCEPT { return lhs<enum_type(rhs.v_); } \ - friend bool operator <=(self_type lhs, self_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)<=enum_type(rhs.v_); } \ - friend bool operator <=(self_type lhs, enum_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)<=rhs; } \ - friend bool operator <=(enum_type lhs, self_type rhs) BOOST_NOEXCEPT { return lhs<=enum_type(rhs.v_); } \ - friend bool operator >(self_type lhs, self_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)>enum_type(rhs.v_); } \ - friend bool operator >(self_type lhs, enum_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)>rhs; } \ - friend bool operator >(enum_type lhs, self_type rhs) BOOST_NOEXCEPT { return lhs>enum_type(rhs.v_); } \ - friend bool operator >=(self_type lhs, self_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)>=enum_type(rhs.v_); } \ - friend bool operator >=(self_type lhs, enum_type rhs) BOOST_NOEXCEPT { return enum_type(lhs.v_)>=rhs; } \ - friend bool operator >=(enum_type lhs, self_type rhs) BOOST_NOEXCEPT { return lhs>=enum_type(rhs.v_); } \ - }; +#ifndef BOOST_DETAIL_SCOPED_ENUM_EMULATION_HPP +#define BOOST_DETAIL_SCOPED_ENUM_EMULATION_HPP -#define BOOST_SCOPED_ENUM_DECLARE_END(EnumType) \ - ; \ - EnumType(enum_type v) BOOST_NOEXCEPT : v_(v) {} \ - BOOST_SCOPED_ENUM_DECLARE_END2() +// The header file at this path is deprecated; +// use boost/core/scoped_enum.hpp instead. -/** - * Starts a declaration of a scoped enum with the default int underlying type. - * - * @param EnumType The new scoped enum. - */ -#define BOOST_SCOPED_ENUM_DECLARE_BEGIN(EnumType) \ - BOOST_SCOPED_ENUM_UT_DECLARE_BEGIN(EnumType,int) +#include <boost/core/scoped_enum.hpp> -/** - * Name of the native enum type. - * - * @param NT The new scoped enum. - */ -#define BOOST_SCOPED_ENUM_NATIVE(EnumType) EnumType::enum_type -/** - * Forward declares an scoped enum. - * - * @param NT The scoped enum. - */ -#define BOOST_SCOPED_ENUM_FORWARD_DECLARE(EnumType) struct EnumType - -#else // BOOST_NO_SCOPED_ENUMS - -#define BOOST_SCOPED_ENUM_UT_DECLARE_BEGIN(EnumType,UnderlyingType) enum class EnumType:UnderlyingType -#define BOOST_SCOPED_ENUM_DECLARE_BEGIN(EnumType) enum class EnumType -#define BOOST_SCOPED_ENUM_DECLARE_END2() -#define BOOST_SCOPED_ENUM_DECLARE_END(EnumType) ; - -#define BOOST_SCOPED_ENUM_NATIVE(EnumType) EnumType -#define BOOST_SCOPED_ENUM_FORWARD_DECLARE(EnumType) enum class EnumType - -#endif // BOOST_NO_SCOPED_ENUMS - -#define BOOST_SCOPED_ENUM_START(name) BOOST_SCOPED_ENUM_DECLARE_BEGIN(name) -#define BOOST_SCOPED_ENUM_END BOOST_SCOPED_ENUM_DECLARE_END2() -#define BOOST_SCOPED_ENUM(name) BOOST_SCOPED_ENUM_NATIVE(name) - -//#ifdef BOOST_NO_SCOPED_ENUMS -// -//# define BOOST_SCOPED_ENUM_START(name) struct name { enum enum_type -//# define BOOST_SCOPED_ENUM_END }; -//# define BOOST_SCOPED_ENUM(name) name::enum_type -// -//#else -// -//# define BOOST_SCOPED_ENUM_START(name) enum class name -//# define BOOST_SCOPED_ENUM_END -//# define BOOST_SCOPED_ENUM(name) name -// -//#endif -#endif // BOOST_SCOPED_ENUM_EMULATION_HPP +#endif diff --git a/boost/detail/sp_typeinfo.hpp b/boost/detail/sp_typeinfo.hpp index 43fae78ef1..4e4de55b05 100644 --- a/boost/detail/sp_typeinfo.hpp +++ b/boost/detail/sp_typeinfo.hpp @@ -9,104 +9,15 @@ // detail/sp_typeinfo.hpp // +// Deprecated, please use boost/core/typeinfo.hpp +// // Copyright 2007 Peter Dimov // -// 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) - -#include <boost/config.hpp> - -#if defined( BOOST_NO_TYPEID ) - -#include <boost/current_function.hpp> -#include <functional> - -namespace boost -{ - -namespace detail -{ - -class sp_typeinfo -{ -private: - - sp_typeinfo( sp_typeinfo const& ); - sp_typeinfo& operator=( sp_typeinfo const& ); - - char const * name_; - -public: - - explicit sp_typeinfo( char const * name ): name_( name ) - { - } - - bool operator==( sp_typeinfo const& rhs ) const - { - return this == &rhs; - } - - bool operator!=( sp_typeinfo const& rhs ) const - { - return this != &rhs; - } - - bool before( sp_typeinfo const& rhs ) const - { - return std::less< sp_typeinfo const* >()( this, &rhs ); - } - - char const* name() const - { - return name_; - } -}; - -template<class T> struct sp_typeid_ -{ - static sp_typeinfo ti_; - - static char const * name() - { - return BOOST_CURRENT_FUNCTION; - } -}; +// 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(__SUNPRO_CC) -// see #4199, the Sun Studio compiler gets confused about static initialization -// constructor arguments. But an assignment works just fine. -template<class T> sp_typeinfo sp_typeid_< T >::ti_ = sp_typeid_< T >::name(); -#else -template<class T> sp_typeinfo sp_typeid_< T >::ti_(sp_typeid_< T >::name()); -#endif - -template<class T> struct sp_typeid_< T & >: sp_typeid_< T > -{ -}; - -template<class T> struct sp_typeid_< T const >: sp_typeid_< T > -{ -}; - -template<class T> struct sp_typeid_< T volatile >: sp_typeid_< T > -{ -}; - -template<class T> struct sp_typeid_< T const volatile >: sp_typeid_< T > -{ -}; - -} // namespace detail - -} // namespace boost - -#define BOOST_SP_TYPEID(T) (boost::detail::sp_typeid_<T>::ti_) - -#else - -#include <typeinfo> +#include <boost/core/typeinfo.hpp> namespace boost { @@ -114,22 +25,12 @@ namespace boost namespace detail { -#if defined( BOOST_NO_STD_TYPEINFO ) - -typedef ::type_info sp_typeinfo; - -#else - -typedef std::type_info sp_typeinfo; - -#endif +typedef boost::core::typeinfo sp_typeinfo; } // namespace detail } // namespace boost -#define BOOST_SP_TYPEID(T) typeid(T) - -#endif +#define BOOST_SP_TYPEID(T) BOOST_CORE_TYPEID(T) #endif // #ifndef BOOST_DETAIL_SP_TYPEINFO_HPP_INCLUDED diff --git a/boost/detail/utf8_codecvt_facet.hpp b/boost/detail/utf8_codecvt_facet.hpp index b777ff934e..753b339336 100644 --- a/boost/detail/utf8_codecvt_facet.hpp +++ b/boost/detail/utf8_codecvt_facet.hpp @@ -122,9 +122,13 @@ protected: ) const; virtual std::codecvt_base::result do_out( - std::mbstate_t & state, const wchar_t * from, - const wchar_t * from_end, const wchar_t* & from_next, - char * to, char * to_end, char * & to_next + std::mbstate_t & state, + const wchar_t * from, + const wchar_t * from_end, + const wchar_t* & from_next, + char * to, + char * to_end, + char * & to_next ) const; bool invalid_continuing_octet(unsigned char octet_1) const { @@ -137,17 +141,19 @@ protected: } // continuing octets = octets except for the leading octet - static unsigned int get_cont_octet_count(unsigned char lead_octet) { + static unsigned int get_cont_octet_count(unsigned char lead_octet) { return get_octet_count(lead_octet) - 1; } - static unsigned int get_octet_count(unsigned char lead_octet); + static unsigned int get_octet_count(unsigned char lead_octet); // How many "continuing octets" will be needed for this word // == total octets - 1. int get_cont_octet_out_count(wchar_t word) const ; - virtual bool do_always_noconv() const throw() { return false; } + virtual bool do_always_noconv() const BOOST_NOEXCEPT_OR_NOTHROW { + return false; + } // UTF-8 isn't really stateful since we rewind on partial conversions virtual std::codecvt_base::result do_unshift( @@ -155,13 +161,12 @@ protected: char * from, char * /*to*/, char * & next - ) const - { + ) const { next = from; return ok; } - virtual int do_encoding() const throw() { + virtual int do_encoding() const BOOST_NOEXCEPT_OR_NOTHROW { const int variable_byte_external_encoding=0; return variable_byte_external_encoding; } @@ -173,14 +178,10 @@ protected: const char * from, const char * from_end, std::size_t max_limit -#if BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600)) - ) const throw(); -#else - ) const; -#endif + ) const; // Largest possible value do_length(state,from,from_end,1) could return. - virtual int do_max_length() const throw () { + virtual int do_max_length() const BOOST_NOEXCEPT_OR_NOTHROW { return 6; // largest UTF-8 encoding of a UCS-4 character } }; diff --git a/boost/detail/utf8_codecvt_facet.ipp b/boost/detail/utf8_codecvt_facet.ipp index 064fdaf58e..8a13124657 100644 --- a/boost/detail/utf8_codecvt_facet.ipp +++ b/boost/detail/utf8_codecvt_facet.ipp @@ -171,14 +171,13 @@ std::codecvt_base::result utf8_codecvt_facet::do_out( // How many char objects can I process to get <= max_limit // wchar_t objects? int utf8_codecvt_facet::do_length( - BOOST_CODECVT_DO_LENGTH_CONST std::mbstate_t &, + const std::mbstate_t &, const char * from, const char * from_end, std::size_t max_limit -#if BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600)) -) const throw() -#else ) const +#if BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600)) + throw() #endif { // RG - this code is confusing! I need a better way to express it. diff --git a/boost/detail/win/dll.hpp b/boost/detail/win/dll.hpp deleted file mode 100644 index 605a1bf596..0000000000 --- a/boost/detail/win/dll.hpp +++ /dev/null @@ -1,52 +0,0 @@ -// dll.hpp --------------------------------------------------------------// - -// Copyright 2010 Vicente J. Botet Escriba - -// Distributed under the Boost Software License, Version 1.0. -// See http://www.boost.org/LICENSE_1_0.txt - - -#ifndef BOOST_DETAIL_WIN_DLL_HPP -#define BOOST_DETAIL_WIN_DLL_HPP - -#include <boost/detail/win/basic_types.hpp> -#include <boost/detail/win/security.hpp> - -namespace boost -{ -namespace detail -{ -namespace win32 -{ -#if defined( BOOST_USE_WINDOWS_H ) - using ::LoadLibrary; - using ::FreeLibrary; - using ::GetProcAddress; - using ::GetModuleHandleA; -#else -extern "C" { - __declspec(dllimport) HMODULE_ __stdcall - LoadLibrary( - LPCTSTR_ lpFileName - ); - __declspec(dllimport) BOOL_ __stdcall - FreeLibrary( - HMODULE_ hModule - ); - __declspec(dllimport) FARPROC_ __stdcall - GetProcAddress( - HMODULE_ hModule, - LPCSTR_ lpProcName - ); - __declspec(dllimport) FARPROC_ __stdcall - GetModuleHandleA( - LPCSTR_ lpProcName - ); - -} -#endif -} -} -} - -#endif // BOOST_DETAIL_WIN_THREAD_HPP diff --git a/boost/detail/win/handles.hpp b/boost/detail/win/handles.hpp deleted file mode 100644 index 1441d10a2c..0000000000 --- a/boost/detail/win/handles.hpp +++ /dev/null @@ -1,37 +0,0 @@ -// memory.hpp --------------------------------------------------------------// - -// Copyright 2010 Vicente J. Botet Escriba - -// Distributed under the Boost Software License, Version 1.0. -// See http://www.boost.org/LICENSE_1_0.txt - - -#ifndef BOOST_DETAIL_WIN_HANDLES_HPP -#define BOOST_DETAIL_WIN_HANDLES_HPP - -#include <boost/detail/win/basic_types.hpp> - - -namespace boost -{ -namespace detail -{ -namespace win32 -{ -#if defined( BOOST_USE_WINDOWS_H ) - using ::CloseHandle; - using ::DuplicateHandle; -#else -extern "C" { - __declspec(dllimport) int __stdcall - CloseHandle(void*); - __declspec(dllimport) int __stdcall - DuplicateHandle(void*,void*,void*,void**,unsigned long,int,unsigned long); -} - -#endif -} -} -} - -#endif // BOOST_DETAIL_WIN_HANDLES_HPP diff --git a/boost/detail/win/synchronization.hpp b/boost/detail/win/synchronization.hpp deleted file mode 100644 index 8fe015b353..0000000000 --- a/boost/detail/win/synchronization.hpp +++ /dev/null @@ -1,125 +0,0 @@ -// synchronizaion.hpp --------------------------------------------------------------// - -// Copyright 2010 Vicente J. Botet Escriba - -// Distributed under the Boost Software License, Version 1.0. -// See http://www.boost.org/LICENSE_1_0.txt - - -#ifndef BOOST_DETAIL_WIN_SYNCHRONIZATION_HPP -#define BOOST_DETAIL_WIN_SYNCHRONIZATION_HPP - -#include <boost/detail/win/basic_types.hpp> - - -namespace boost -{ -namespace detail -{ -namespace win32 -{ -#if defined( BOOST_USE_WINDOWS_H ) - typedef ::CRITICAL_SECTION CRITICAL_SECTION_; - typedef ::PAPCFUNC PAPCFUNC_; - - using ::InitializeCriticalSection; - using ::EnterCriticalSection; - using ::TryEnterCriticalSection; - using ::LeaveCriticalSection; - using ::DeleteCriticalSection; - -# ifdef BOOST_NO_ANSI_APIS - using ::CreateMutexW; - using ::CreateEventW; - using ::OpenEventW; - using ::CreateSemaphoreW; -# else - using ::CreateMutexA; - using ::CreateEventA; - using ::OpenEventA; - using ::CreateSemaphoreA; -# endif - using ::ReleaseMutex; - using ::ReleaseSemaphore; - using ::SetEvent; - using ::ResetEvent; - using ::WaitForMultipleObjects; - using ::WaitForSingleObject; - using ::QueueUserAPC; -#else -extern "C" { - struct CRITICAL_SECTION_ - { - struct critical_section_debug * DebugInfo; - long LockCount; - long RecursionCount; - void * OwningThread; - void * LockSemaphore; - #if defined(_WIN64) - unsigned __int64 SpinCount; - #else - unsigned long SpinCount; - #endif - }; - - __declspec(dllimport) void __stdcall - InitializeCriticalSection(CRITICAL_SECTION_ *); - __declspec(dllimport) void __stdcall - EnterCriticalSection(CRITICAL_SECTION_ *); - __declspec(dllimport) bool __stdcall - TryEnterCriticalSection(CRITICAL_SECTION_ *); - __declspec(dllimport) void __stdcall - LeaveCriticalSection(CRITICAL_SECTION_ *); - __declspec(dllimport) void __stdcall - DeleteCriticalSection(CRITICAL_SECTION_ *); - - struct _SECURITY_ATTRIBUTES; -# ifdef BOOST_NO_ANSI_APIS - __declspec(dllimport) void* __stdcall - CreateMutexW(_SECURITY_ATTRIBUTES*,int,wchar_t const*); - __declspec(dllimport) void* __stdcall - CreateSemaphoreW(_SECURITY_ATTRIBUTES*,long,long,wchar_t const*); - __declspec(dllimport) void* __stdcall - CreateEventW(_SECURITY_ATTRIBUTES*,int,int,wchar_t const*); - __declspec(dllimport) void* __stdcall - OpenEventW(unsigned long,int,wchar_t const*); -# else - __declspec(dllimport) void* __stdcall - CreateMutexA(_SECURITY_ATTRIBUTES*,int,char const*); - __declspec(dllimport) void* __stdcall - CreateSemaphoreA(_SECURITY_ATTRIBUTES*,long,long,char const*); - __declspec(dllimport) void* __stdcall - CreateEventA(_SECURITY_ATTRIBUTES*,int,int,char const*); - __declspec(dllimport) void* __stdcall - OpenEventA(unsigned long,int,char const*); -# endif - __declspec(dllimport) int __stdcall - ReleaseMutex(void*); - __declspec(dllimport) unsigned long __stdcall - WaitForSingleObject(void*,unsigned long); - __declspec(dllimport) unsigned long __stdcall - WaitForMultipleObjects(unsigned long nCount, - void* const * lpHandles, - int bWaitAll, - unsigned long dwMilliseconds); - __declspec(dllimport) int __stdcall - ReleaseSemaphore(void*,long,long*); - typedef void (__stdcall *PAPCFUNC8)(ulong_ptr); - __declspec(dllimport) unsigned long __stdcall - QueueUserAPC(PAPCFUNC8,void*,ulong_ptr); -# ifndef UNDER_CE - __declspec(dllimport) int __stdcall - SetEvent(void*); - __declspec(dllimport) int __stdcall - ResetEvent(void*); -# else - using ::SetEvent; - using ::ResetEvent; -# endif -} -#endif -} -} -} - -#endif // BOOST_DETAIL_WIN_SYNCHRONIZATION_HPP diff --git a/boost/detail/win/thread.hpp b/boost/detail/win/thread.hpp deleted file mode 100644 index 4e1bf307f9..0000000000 --- a/boost/detail/win/thread.hpp +++ /dev/null @@ -1,45 +0,0 @@ -// thread.hpp --------------------------------------------------------------// - -// Copyright 2010 Vicente J. Botet Escriba - -// Distributed under the Boost Software License, Version 1.0. -// See http://www.boost.org/LICENSE_1_0.txt - - -#ifndef BOOST_DETAIL_WIN_THREAD_HPP -#define BOOST_DETAIL_WIN_THREAD_HPP - -#include <boost/detail/win/basic_types.hpp> -#include <boost/detail/win/GetCurrentThread.hpp> - -namespace boost -{ -namespace detail -{ -namespace win32 -{ -#if defined( BOOST_USE_WINDOWS_H ) - using ::GetCurrentThreadId; - using ::SleepEx; - using ::Sleep; -#else -extern "C" { -# ifndef UNDER_CE - __declspec(dllimport) unsigned long __stdcall - GetCurrentThreadId(void); - __declspec(dllimport) unsigned long __stdcall - SleepEx(unsigned long,int); - __declspec(dllimport) void __stdcall - Sleep(unsigned long); -#else - using ::GetCurrentThreadId; - using ::SleepEx; - using ::Sleep; -#endif -} -#endif -} -} -} - -#endif // BOOST_DETAIL_WIN_THREAD_HPP diff --git a/boost/detail/win/GetCurrentProcess.hpp b/boost/detail/winapi/GetCurrentProcess.hpp index a76eb06e8f..51206bb4e8 100644 --- a/boost/detail/win/GetCurrentProcess.hpp +++ b/boost/detail/winapi/GetCurrentProcess.hpp @@ -6,14 +6,18 @@ // See http://www.boost.org/LICENSE_1_0.txt -#ifndef BOOST_DETAIL_WIN_GETCURRENTPROCESS_HPP -#define BOOST_DETAIL_WIN_GETCURRENTPROCESS_HPP +#ifndef BOOST_DETAIL_WINAPI_GETCURRENTPROCESS_HPP +#define BOOST_DETAIL_WINAPI_GETCURRENTPROCESS_HPP -#include <boost/detail/win/basic_types.hpp> +#include <boost/detail/winapi/basic_types.hpp> + +#ifdef BOOST_HAS_PRAGMA_ONCE +#pragma once +#endif namespace boost { namespace detail { -namespace win32 { +namespace winapi { #if defined( BOOST_USE_WINDOWS_H ) using ::GetCurrentProcess; #else @@ -22,4 +26,4 @@ namespace win32 { } } } -#endif // BOOST_DETAIL_WIN_TIME_HPP +#endif // BOOST_DETAIL_WINAPI_GETCURRENTPROCESS_HPP diff --git a/boost/detail/win/GetCurrentThread.hpp b/boost/detail/winapi/GetCurrentThread.hpp index cdc6d36c78..595b751d13 100644 --- a/boost/detail/win/GetCurrentThread.hpp +++ b/boost/detail/winapi/GetCurrentThread.hpp @@ -6,14 +6,18 @@ // See http://www.boost.org/LICENSE_1_0.txt -#ifndef BOOST_DETAIL_WIN_GETCURRENTTHREAD_HPP -#define BOOST_DETAIL_WIN_GETCURRENTTHREAD_HPP +#ifndef BOOST_DETAIL_WINAPI_GETCURRENTTHREAD_HPP +#define BOOST_DETAIL_WINAPI_GETCURRENTTHREAD_HPP -#include <boost/detail/win/basic_types.hpp> +#include <boost/detail/winapi/basic_types.hpp> + +#ifdef BOOST_HAS_PRAGMA_ONCE +#pragma once +#endif namespace boost { namespace detail { -namespace win32 { +namespace winapi { #if defined( UNDER_CE ) // Windows CE define GetCurrentThread as an inline function in kfuncs.h inline HANDLE_ GetCurrentThread() @@ -31,4 +35,4 @@ inline HANDLE_ GetCurrentThread() } } -#endif // BOOST_DETAIL_WIN_TIME_HPP +#endif // BOOST_DETAIL_WINAPI_GETCURRENTTHREAD_HPP diff --git a/boost/detail/win/GetLastError.hpp b/boost/detail/winapi/GetLastError.hpp index d040abf50d..6e9e2d998a 100644 --- a/boost/detail/win/GetLastError.hpp +++ b/boost/detail/winapi/GetLastError.hpp @@ -6,14 +6,18 @@ // See http://www.boost.org/LICENSE_1_0.txt -#ifndef BOOST_DETAIL_WIN_GETLASTERROR_HPP -#define BOOST_DETAIL_WIN_GETLASTERROR_HPP +#ifndef BOOST_DETAIL_WINAPI_GETLASTERROR_HPP +#define BOOST_DETAIL_WINAPI_GETLASTERROR_HPP -#include <boost/detail/win/basic_types.hpp> +#include <boost/detail/winapi/basic_types.hpp> + +#ifdef BOOST_HAS_PRAGMA_ONCE +#pragma once +#endif namespace boost { namespace detail { -namespace win32 { +namespace winapi { #if defined( BOOST_USE_WINDOWS_H ) using ::GetLastError; #else @@ -24,4 +28,4 @@ namespace win32 { } } -#endif // BOOST_DETAIL_WIN_TIME_HPP +#endif // BOOST_DETAIL_WINAPI_GETLASTERROR_HPP diff --git a/boost/detail/win/GetProcessTimes.hpp b/boost/detail/winapi/GetProcessTimes.hpp index 8d76995893..f2860b06bd 100644 --- a/boost/detail/win/GetProcessTimes.hpp +++ b/boost/detail/winapi/GetProcessTimes.hpp @@ -6,14 +6,18 @@ // See http://www.boost.org/LICENSE_1_0.txt -#ifndef BOOST_DETAIL_WIN_GETPROCESSTIMES_HPP -#define BOOST_DETAIL_WIN_GETPROCESSTIMES_HPP +#ifndef BOOST_DETAIL_WINAPI_GETPROCESSTIMES_HPP +#define BOOST_DETAIL_WINAPI_GETPROCESSTIMES_HPP -#include <boost/detail/win/time.hpp> +#include <boost/detail/winapi/time.hpp> + +#ifdef BOOST_HAS_PRAGMA_ONCE +#pragma once +#endif namespace boost { namespace detail { -namespace win32 { +namespace winapi { #if !defined(UNDER_CE) // Windows CE does not define GetProcessTimes #if defined( BOOST_USE_WINDOWS_H ) using ::GetProcessTimes; @@ -32,4 +36,4 @@ namespace win32 { } } -#endif // BOOST_DETAIL_WIN_GETPROCESSTIMES_HPP +#endif // BOOST_DETAIL_WINAPI_GETPROCESSTIMES_HPP diff --git a/boost/detail/win/GetThreadTimes.hpp b/boost/detail/winapi/GetThreadTimes.hpp index cf19c462ed..3428edad22 100644 --- a/boost/detail/win/GetThreadTimes.hpp +++ b/boost/detail/winapi/GetThreadTimes.hpp @@ -6,14 +6,18 @@ // See http://www.boost.org/LICENSE_1_0.txt -#ifndef BOOST_DETAIL_WIN_GETTHREADTIMES_HPP -#define BOOST_DETAIL_WIN_GETTHREADTIMES_HPP +#ifndef BOOST_DETAIL_WINAPI_GETTHREADTIMES_HPP +#define BOOST_DETAIL_WINAPI_GETTHREADTIMES_HPP -#include <boost/detail/win/time.hpp> +#include <boost/detail/winapi/time.hpp> + +#ifdef BOOST_HAS_PRAGMA_ONCE +#pragma once +#endif namespace boost { namespace detail { -namespace win32 { +namespace winapi { #if defined( BOOST_USE_WINDOWS_H ) using ::GetThreadTimes; #else @@ -30,4 +34,4 @@ namespace win32 { } } -#endif // BOOST_DETAIL_WIN_GETTHREADTIMES_HPP +#endif // BOOST_DETAIL_WINAPI_GETTHREADTIMES_HPP diff --git a/boost/detail/win/LocalFree.hpp b/boost/detail/winapi/LocalFree.hpp index da1c77b669..697016c0c6 100644 --- a/boost/detail/win/LocalFree.hpp +++ b/boost/detail/winapi/LocalFree.hpp @@ -6,14 +6,18 @@ // See http://www.boost.org/LICENSE_1_0.txt -#ifndef BOOST_DETAIL_WIN_LOCALFREE_HPP -#define BOOST_DETAIL_WIN_LOCALFREE_HPP +#ifndef BOOST_DETAIL_WINAPI_LOCALFREE_HPP +#define BOOST_DETAIL_WINAPI_LOCALFREE_HPP -#include <boost/detail/win/basic_types.hpp> +#include <boost/detail/winapi/basic_types.hpp> + +#ifdef BOOST_HAS_PRAGMA_ONCE +#pragma once +#endif namespace boost { namespace detail { -namespace win32 { +namespace winapi { #if defined( BOOST_USE_WINDOWS_H ) typedef HANDLE_ HLOCAL_; @@ -26,4 +30,4 @@ namespace win32 { } } } -#endif // BOOST_DETAIL_WIN_LOCALFREE_HPP +#endif // BOOST_DETAIL_WINAPI_LOCALFREE_HPP diff --git a/boost/detail/win/basic_types.hpp b/boost/detail/winapi/basic_types.hpp index f4e34721cf..09d907bdc2 100644 --- a/boost/detail/win/basic_types.hpp +++ b/boost/detail/winapi/basic_types.hpp @@ -6,15 +6,17 @@ // See http://www.boost.org/LICENSE_1_0.txt -#ifndef BOOST_DETAIL_WIN_BASIC_TYPES_HPP -#define BOOST_DETAIL_WIN_BASIC_TYPES_HPP -#include <boost/config.hpp> +#ifndef BOOST_DETAIL_WINAPI_BASIC_TYPES_HPP +#define BOOST_DETAIL_WINAPI_BASIC_TYPES_HPP + #include <cstdarg> #include <boost/cstdint.hpp> +#include <boost/detail/winapi/config.hpp> + #if defined( BOOST_USE_WINDOWS_H ) # include <windows.h> #elif defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || defined(__CYGWIN__) -# include <WinError.h> +# include <winerror.h> // @FIXME Which condition must be tested # ifdef UNDER_CE # ifndef WINAPI @@ -29,20 +31,36 @@ # define WINAPI __stdcall # endif # endif +# ifndef NTAPI +# define NTAPI __stdcall +# endif #else # error "Win32 functions not available" #endif +#ifdef BOOST_HAS_PRAGMA_ONCE +#pragma once +#endif + namespace boost { namespace detail { -namespace win32 { +namespace winapi { #if defined( BOOST_USE_WINDOWS_H ) typedef ::BOOL BOOL_; + typedef ::BOOLEAN BOOLEAN_; + typedef ::PBOOLEAN PBOOLEAN_; + typedef ::BYTE BYTE_; typedef ::WORD WORD_; typedef ::DWORD DWORD_; typedef ::HANDLE HANDLE_; + typedef ::HMODULE HMODULE_; typedef ::LONG LONG_; + typedef ::ULONG ULONG_; typedef ::LONGLONG LONGLONG_; + typedef ::ULONGLONG ULONGLONG_; + typedef ::INT_PTR INT_PTR_; + typedef ::UINT_PTR UINT_PTR_; + typedef ::LONG_PTR LONG_PTR_; typedef ::ULONG_PTR ULONG_PTR_; typedef ::LARGE_INTEGER LARGE_INTEGER_; typedef ::PLARGE_INTEGER PLARGE_INTEGER_; @@ -57,32 +75,37 @@ namespace win32 { #else extern "C" { typedef int BOOL_; + typedef unsigned char BYTE_; + typedef BYTE_ BOOLEAN_; + typedef BOOLEAN_* PBOOLEAN_; typedef unsigned short WORD_; typedef unsigned long DWORD_; typedef void* HANDLE_; + typedef void* HMODULE_; typedef long LONG_; + typedef unsigned long ULONG_; -// @FIXME Which condition must be tested -//~ #if !defined(_M_IX86) -//~ #if defined(BOOST_NO_INT64_T) - //~ typedef double LONGLONG_; -//~ #else - //~ typedef __int64 LONGLONG_; -//~ #endif -//~ #else - //~ typedef double LONGLONG_; -//~ #endif typedef boost::int64_t LONGLONG_; + typedef boost::uint64_t ULONGLONG_; // @FIXME Which condition must be tested # ifdef _WIN64 #if defined(__CYGWIN__) + typedef long INT_PTR_; + typedef unsigned long UINT_PTR_; + typedef long LONG_PTR_; typedef unsigned long ULONG_PTR_; #else + typedef __int64 INT_PTR_; + typedef unsigned __int64 UINT_PTR_; + typedef __int64 LONG_PTR_; typedef unsigned __int64 ULONG_PTR_; #endif # else + typedef int INT_PTR_; + typedef unsigned int UINT_PTR_; + typedef long LONG_PTR_; typedef unsigned long ULONG_PTR_; # endif @@ -102,10 +125,10 @@ extern "C" { typedef wchar_t WCHAR_; typedef WCHAR_ *LPWSTR_; typedef const WCHAR_ *LPCWSTR_; - } #endif } } } -#endif // BOOST_DETAIL_WIN_TIME_HPP + +#endif // BOOST_DETAIL_WINAPI_BASIC_TYPES_HPP diff --git a/boost/detail/winapi/config.hpp b/boost/detail/winapi/config.hpp new file mode 100644 index 0000000000..2b0cdfbada --- /dev/null +++ b/boost/detail/winapi/config.hpp @@ -0,0 +1,53 @@ +// config.hpp --------------------------------------------------------------// + +// Copyright 2013 Andrey Semashev + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + + +#ifndef BOOST_DETAIL_WINAPI_CONFIG_HPP_INCLUDED_ +#define BOOST_DETAIL_WINAPI_CONFIG_HPP_INCLUDED_ + +#include <boost/config.hpp> + +#ifdef BOOST_HAS_PRAGMA_ONCE +#pragma once +#endif + +// These constants reflect _WIN32_WINNT_* macros from sdkddkver.h +// See also: http://msdn.microsoft.com/en-us/library/windows/desktop/aa383745%28v=vs.85%29.aspx#setting_winver_or__win32_winnt +#define BOOST_WINAPI_VERSION_NT4 0x0400 +#define BOOST_WINAPI_VERSION_WIN2K 0x0500 +#define BOOST_WINAPI_VERSION_WINXP 0x0501 +#define BOOST_WINAPI_VERSION_WS03 0x0502 +#define BOOST_WINAPI_VERSION_WIN6 0x0600 +#define BOOST_WINAPI_VERSION_VISTA 0x0600 +#define BOOST_WINAPI_VERSION_WS08 0x0600 +#define BOOST_WINAPI_VERSION_LONGHORN 0x0600 +#define BOOST_WINAPI_VERSION_WIN7 0x0601 +#define BOOST_WINAPI_VERSION_WIN8 0x0602 +#define BOOST_WINAPI_VERSION_WINBLUE 0x0603 + +#if !defined(BOOST_USE_WINAPI_VERSION) +#if defined(_WIN32_WINNT) +#define BOOST_USE_WINAPI_VERSION _WIN32_WINNT +#elif defined(WINVER) +#define BOOST_USE_WINAPI_VERSION WINVER +#else +// By default use Windows XP API +#define BOOST_USE_WINAPI_VERSION BOOST_WINAPI_VERSION_WINXP +#endif +#endif + +#if defined(BOOST_USE_WINDOWS_H) +// We have to define the version macros so that windows.h provides the necessary symbols +#if !defined(_WIN32_WINNT) +#define _WIN32_WINNT BOOST_USE_WINAPI_VERSION +#endif +#if !defined(WINVER) +#define WINVER BOOST_USE_WINAPI_VERSION +#endif +#endif + +#endif // BOOST_DETAIL_WINAPI_CONFIG_HPP_INCLUDED_ diff --git a/boost/detail/winapi/crypt.hpp b/boost/detail/winapi/crypt.hpp new file mode 100644 index 0000000000..c9108f29bf --- /dev/null +++ b/boost/detail/winapi/crypt.hpp @@ -0,0 +1,88 @@ +// crypt.hpp --------------------------------------------------------------// + +// Copyright 2014 Antony Polukhin + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + + +#ifndef BOOST_DETAIL_WINAPI_CRYPT_HPP +#define BOOST_DETAIL_WINAPI_CRYPT_HPP + +#include <boost/detail/winapi/basic_types.hpp> + +#ifdef BOOST_HAS_PRAGMA_ONCE +#pragma once +#endif + +namespace boost +{ +namespace detail +{ +namespace winapi +{ +#if defined( BOOST_USE_WINDOWS_H ) + typedef HCRYPTPROV HCRYPTPROV_; + + using ::CryptEnumProvidersA; + using ::CryptAcquireContextA; + using ::CryptGenRandom; + using ::CryptReleaseContext; + + const DWORD_ PROV_RSA_FULL_ = PROV_RSA_FULL; + + const DWORD_ CRYPT_VERIFYCONTEXT_ = CRYPT_VERIFYCONTEXT; + const DWORD_ CRYPT_NEWKEYSET_ = CRYPT_NEWKEYSET; + const DWORD_ CRYPT_DELETEKEYSET_ = CRYPT_DELETEKEYSET; + const DWORD_ CRYPT_MACHINE_KEYSET_ = CRYPT_MACHINE_KEYSET; + const DWORD_ CRYPT_SILENT_ = CRYPT_SILENT; +#else +extern "C" { + typedef ULONG_PTR_ HCRYPTPROV_; + + __declspec(dllimport) BOOL_ __stdcall + CryptEnumProvidersA( + DWORD_ dwIndex, + DWORD_ *pdwReserved, + DWORD_ dwFlags, + DWORD_ *pdwProvType, + LPSTR_ szProvName, + DWORD_ *pcbProvName + ); + + __declspec(dllimport) BOOL_ __stdcall + CryptAcquireContextA( + HCRYPTPROV_ *phProv, + LPCSTR_ pszContainer, + LPCSTR_ pszProvider, + DWORD_ dwProvType, + DWORD_ dwFlags + ); + + __declspec(dllimport) BOOL_ __stdcall + CryptGenRandom( + HCRYPTPROV_ hProv, + DWORD_ dwLen, + BYTE_ *pbBuffer + ); + + __declspec(dllimport) BOOL_ __stdcall + CryptReleaseContext( + HCRYPTPROV_ hProv, + DWORD_ dwFlags + ); + + const DWORD_ PROV_RSA_FULL_ = 1; + + const DWORD_ CRYPT_VERIFYCONTEXT_ = 0xF0000000; + const DWORD_ CRYPT_NEWKEYSET_ = 8; + const DWORD_ CRYPT_DELETEKEYSET_ = 16; + const DWORD_ CRYPT_MACHINE_KEYSET_ = 32; + const DWORD_ CRYPT_SILENT_ = 64; +} +#endif +} +} +} + +#endif // BOOST_DETAIL_WINAPI_CRYPT_HPP diff --git a/boost/detail/win/directory_management.hpp b/boost/detail/winapi/directory_management.hpp index 1ffe659766..19af1ee4ea 100644 --- a/boost/detail/win/directory_management.hpp +++ b/boost/detail/winapi/directory_management.hpp @@ -6,17 +6,21 @@ // See http://www.boost.org/LICENSE_1_0.txt -#ifndef BOOST_DETAIL_WIN_DIRECTORY_MANAGEMENT_HPP -#define BOOST_DETAIL_WIN_DIRECTORY_MANAGEMENT_HPP +#ifndef BOOST_DETAIL_WINAPI_DIRECTORY_MANAGEMENT_HPP +#define BOOST_DETAIL_WINAPI_DIRECTORY_MANAGEMENT_HPP -#include <boost/detail/win/basic_types.hpp> -#include <boost/detail/win/security.hpp> +#include <boost/detail/winapi/basic_types.hpp> +#include <boost/detail/winapi/security.hpp> + +#ifdef BOOST_HAS_PRAGMA_ONCE +#pragma once +#endif namespace boost { namespace detail { -namespace win32 +namespace winapi { #if defined( BOOST_USE_WINDOWS_H ) using ::CreateDirectory; @@ -33,11 +37,10 @@ extern "C" { GetTempPathA(unsigned long length, char *buffer); __declspec(dllimport) int __stdcall RemoveDirectoryA(LPCTSTR_); - } #endif } } } -#endif // BOOST_DETAIL_WIN_THREAD_HPP +#endif // BOOST_DETAIL_WINAPI_THREAD_HPP diff --git a/boost/detail/winapi/dll.hpp b/boost/detail/winapi/dll.hpp new file mode 100644 index 0000000000..2ec5a73bc9 --- /dev/null +++ b/boost/detail/winapi/dll.hpp @@ -0,0 +1,86 @@ +// dll.hpp --------------------------------------------------------------// + +// Copyright 2010 Vicente J. Botet Escriba + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + + +#ifndef BOOST_DETAIL_WINAPI_DLL_HPP +#define BOOST_DETAIL_WINAPI_DLL_HPP + +#include <boost/detail/winapi/basic_types.hpp> +#include <boost/detail/winapi/security.hpp> + +#ifdef BOOST_HAS_PRAGMA_ONCE +#pragma once +#endif + +namespace boost +{ +namespace detail +{ +namespace winapi +{ +#if defined( BOOST_USE_WINDOWS_H ) + typedef ::FARPROC FARPROC_; + typedef ::NEARPROC NEARPROC_; + typedef ::PROC PROC_; + +# ifdef BOOST_NO_ANSI_APIS + using ::LoadLibraryW; + using ::GetModuleHandleW; +# else + using ::LoadLibraryA; + using ::GetModuleHandleA; +# endif + using ::FreeLibrary; + using ::GetProcAddress; +#else +extern "C" { +# ifdef _WIN64 + typedef INT_PTR_ (WINAPI *FARPROC_)(); + typedef INT_PTR_ (WINAPI *NEARPROC_)(); + typedef INT_PTR_ (WINAPI *PROC_)(); +# else + typedef int (WINAPI *FARPROC_)(); + typedef int (WINAPI *NEARPROC_)(); + typedef int (WINAPI *PROC_)(); +# endif // _WIN64 + +# ifdef BOOST_NO_ANSI_APIS + __declspec(dllimport) HMODULE_ WINAPI + LoadLibraryW( + LPCWSTR_ lpFileName + ); + __declspec(dllimport) HMODULE_ WINAPI + GetModuleHandleW( + LPCWSTR_ lpFileName + ); +# else + __declspec(dllimport) HMODULE_ WINAPI + LoadLibraryA( + LPCSTR_ lpFileName + ); + __declspec(dllimport) HMODULE_ WINAPI + GetModuleHandleA( + LPCSTR_ lpFileName + ); +# endif + + __declspec(dllimport) BOOL_ WINAPI + FreeLibrary( + HMODULE_ hModule + ); + __declspec(dllimport) FARPROC_ WINAPI + GetProcAddress( + HMODULE_ hModule, + LPCSTR_ lpProcName + ); +} +#endif +} +} +} + +#endif // BOOST_DETAIL_WINAPI_DLL_HPP diff --git a/boost/detail/win/error_handling.hpp b/boost/detail/winapi/error_handling.hpp index d6fb428a76..fbe9924b25 100644 --- a/boost/detail/win/error_handling.hpp +++ b/boost/detail/winapi/error_handling.hpp @@ -6,15 +6,20 @@ // See http://www.boost.org/LICENSE_1_0.txt -#ifndef BOOST_DETAIL_WIN_ERROR_HANDLING_HPP -#define BOOST_DETAIL_WIN_ERROR_HANDLING_HPP +#ifndef BOOST_DETAIL_WINAPI_ERROR_HANDLING_HPP +#define BOOST_DETAIL_WINAPI_ERROR_HANDLING_HPP -#include <boost/detail/win/basic_types.hpp> -#include <boost/detail/win/GetCurrentThread.hpp> +#include <boost/detail/winapi/basic_types.hpp> +#include <boost/detail/winapi/GetCurrentThread.hpp> + +#ifdef BOOST_HAS_PRAGMA_ONCE +#pragma once +#endif namespace boost { namespace detail { -namespace win32 { +namespace winapi { + #if defined( BOOST_USE_WINDOWS_H ) using ::FormatMessageA; using ::FormatMessageW; @@ -85,4 +90,4 @@ extern "C" { } } } -#endif // BOOST_DETAIL_WIN_ERROR_HANDLING_HPP +#endif // BOOST_DETAIL_WINAPI_ERROR_HANDLING_HPP diff --git a/boost/detail/win/file_management.hpp b/boost/detail/winapi/file_management.hpp index 5cb0dbff29..c1d5978ba7 100644 --- a/boost/detail/win/file_management.hpp +++ b/boost/detail/winapi/file_management.hpp @@ -6,17 +6,21 @@ // See http://www.boost.org/LICENSE_1_0.txt -#ifndef BOOST_DETAIL_WIN_FILE_MANAGEMENT_HPP -#define BOOST_DETAIL_WIN_FILE_MANAGEMENT_HPP +#ifndef BOOST_DETAIL_WINAPI_FILE_MANAGEMENT_HPP +#define BOOST_DETAIL_WINAPI_FILE_MANAGEMENT_HPP -#include <boost/detail/win/basic_types.hpp> -#include <boost/detail/win/security.hpp> +#include <boost/detail/winapi/basic_types.hpp> +#include <boost/detail/winapi/security.hpp> + +#ifdef BOOST_HAS_PRAGMA_ONCE +#pragma once +#endif namespace boost { namespace detail { -namespace win32 +namespace winapi { #if defined( BOOST_USE_WINDOWS_H ) using ::CreateFileA; @@ -123,4 +127,4 @@ extern "C" { } } -#endif // BOOST_DETAIL_WIN_THREAD_HPP +#endif // BOOST_DETAIL_WINAPI_THREAD_HPP diff --git a/boost/detail/winapi/handles.hpp b/boost/detail/winapi/handles.hpp new file mode 100644 index 0000000000..7108daa10b --- /dev/null +++ b/boost/detail/winapi/handles.hpp @@ -0,0 +1,46 @@ +// memory.hpp --------------------------------------------------------------// + +// Copyright 2010 Vicente J. Botet Escriba + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + + +#ifndef BOOST_DETAIL_WINAPI_HANDLES_HPP +#define BOOST_DETAIL_WINAPI_HANDLES_HPP + +#include <boost/detail/winapi/basic_types.hpp> + +#ifdef BOOST_HAS_PRAGMA_ONCE +#pragma once +#endif + +namespace boost +{ +namespace detail +{ +namespace winapi +{ +#if defined( BOOST_USE_WINDOWS_H ) + using ::CloseHandle; + using ::DuplicateHandle; + + const DWORD_ duplicate_close_source = DUPLICATE_CLOSE_SOURCE; + const DWORD_ duplicate_same_access = DUPLICATE_SAME_ACCESS; + const HANDLE_ invalid_handle_value = INVALID_HANDLE_VALUE; +#else +extern "C" { + __declspec(dllimport) int __stdcall + CloseHandle(void*); + __declspec(dllimport) int __stdcall + DuplicateHandle(void*,void*,void*,void**,unsigned long,int,unsigned long); +} + const DWORD_ duplicate_close_source = 1; + const DWORD_ duplicate_same_access = 2; + const HANDLE_ invalid_handle_value = (HANDLE_)(-1); +#endif +} +} +} + +#endif // BOOST_DETAIL_WINAPI_HANDLES_HPP diff --git a/boost/detail/win/memory.hpp b/boost/detail/winapi/memory.hpp index 8bf59ad87e..b5316e09e0 100644 --- a/boost/detail/win/memory.hpp +++ b/boost/detail/winapi/memory.hpp @@ -6,19 +6,22 @@ // See http://www.boost.org/LICENSE_1_0.txt -#ifndef BOOST_DETAIL_WIN_MEMORY_HPP -#define BOOST_DETAIL_WIN_MEMORY_HPP +#ifndef BOOST_DETAIL_WINAPI_MEMORY_HPP +#define BOOST_DETAIL_WINAPI_MEMORY_HPP -#include <boost/detail/win/basic_types.hpp> -#include <boost/detail/win/security.hpp> -#include <boost/detail/win/LocalFree.hpp> +#include <boost/detail/winapi/basic_types.hpp> +#include <boost/detail/winapi/security.hpp> +#include <boost/detail/winapi/LocalFree.hpp> +#ifdef BOOST_HAS_PRAGMA_ONCE +#pragma once +#endif namespace boost { namespace detail { -namespace win32 +namespace winapi { #if defined( BOOST_USE_WINDOWS_H ) using ::CreateFileMappingA; @@ -30,9 +33,7 @@ namespace win32 using ::OpenFileMappingA; using ::UnmapViewOfFile; #else -# ifdef HeapAlloc -# undef HeapAlloc -# endif +#undef HeapAlloc extern "C" { __declspec(dllimport) void * __stdcall CreateFileMappingA (void *, SECURITY_ATTRIBUTES_*, unsigned long, unsigned long, unsigned long, const char *); @@ -56,4 +57,4 @@ extern "C" { } } -#endif // BOOST_DETAIL_WIN_SYNCHRONIZATION_HPP +#endif // BOOST_DETAIL_WINAPI_MEMORY_HPP diff --git a/boost/detail/win/process.hpp b/boost/detail/winapi/process.hpp index 10c3a9392c..de287b15fc 100644 --- a/boost/detail/win/process.hpp +++ b/boost/detail/winapi/process.hpp @@ -6,23 +6,26 @@ // See http://www.boost.org/LICENSE_1_0.txt -#ifndef BOOST_DETAIL_WIN_PROCESS_HPP -#define BOOST_DETAIL_WIN_PROCESS_HPP +#ifndef BOOST_DETAIL_WINAPI_PROCESS_HPP +#define BOOST_DETAIL_WINAPI_PROCESS_HPP -#include <boost/detail/win/basic_types.hpp> -#include <boost/detail/win/GetCurrentProcess.hpp> +#include <boost/detail/winapi/basic_types.hpp> +#include <boost/detail/winapi/GetCurrentProcess.hpp> + +#ifdef BOOST_HAS_PRAGMA_ONCE +#pragma once +#endif namespace boost { namespace detail { -namespace win32 { +namespace winapi { #if defined( BOOST_USE_WINDOWS_H ) using ::GetCurrentProcessId; #else # ifndef UNDER_CE -extern "C" { - __declspec(dllimport) unsigned long __stdcall - GetCurrentProcessId(void); -} +extern "C" { + __declspec(dllimport) DWORD_ WINAPI GetCurrentProcessId(void); +} # else using ::GetCurrentProcessId; # endif @@ -30,4 +33,4 @@ extern "C" { } } } -#endif // BOOST_DETAIL_WIN_PROCESS_HPP +#endif // BOOST_DETAIL_WINAPI_PROCESS_HPP diff --git a/boost/detail/win/security.hpp b/boost/detail/winapi/security.hpp index ee38985193..79925c6c67 100644 --- a/boost/detail/win/security.hpp +++ b/boost/detail/winapi/security.hpp @@ -6,17 +6,20 @@ // See http://www.boost.org/LICENSE_1_0.txt -#ifndef BOOST_DETAIL_WIN_SECURITY_HPP -#define BOOST_DETAIL_WIN_SECURITY_HPP +#ifndef BOOST_DETAIL_WINAPI_SECURITY_HPP +#define BOOST_DETAIL_WINAPI_SECURITY_HPP -#include <boost/detail/win/basic_types.hpp> +#include <boost/detail/winapi/basic_types.hpp> +#ifdef BOOST_HAS_PRAGMA_ONCE +#pragma once +#endif namespace boost { namespace detail { -namespace win32 +namespace winapi { #if defined( BOOST_USE_WINDOWS_H ) typedef ::SECURITY_ATTRIBUTES SECURITY_ATTRIBUTES_; @@ -59,4 +62,4 @@ extern "C" { } } -#endif // BOOST_DETAIL_WIN_SECURITY_HPP +#endif // BOOST_DETAIL_WINAPI_SECURITY_HPP diff --git a/boost/detail/winapi/synchronization.hpp b/boost/detail/winapi/synchronization.hpp new file mode 100644 index 0000000000..b9497cbf7c --- /dev/null +++ b/boost/detail/winapi/synchronization.hpp @@ -0,0 +1,293 @@ +// synchronizaion.hpp --------------------------------------------------------------// + +// Copyright 2010 Vicente J. Botet Escriba + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + + +#ifndef BOOST_DETAIL_WINAPI_SYNCHRONIZATION_HPP +#define BOOST_DETAIL_WINAPI_SYNCHRONIZATION_HPP + +#include <boost/detail/winapi/basic_types.hpp> + +#ifdef BOOST_HAS_PRAGMA_ONCE +#pragma once +#endif + +namespace boost +{ +namespace detail +{ +namespace winapi +{ +#if defined( BOOST_USE_WINDOWS_H ) + typedef ::CRITICAL_SECTION CRITICAL_SECTION_; + typedef ::PAPCFUNC PAPCFUNC_; + +#if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6 + typedef ::INIT_ONCE INIT_ONCE_; + typedef ::PINIT_ONCE PINIT_ONCE_; + typedef ::LPINIT_ONCE LPINIT_ONCE_; + #define BOOST_DETAIL_WINAPI_INIT_ONCE_STATIC_INIT INIT_ONCE_STATIC_INIT + typedef ::PINIT_ONCE_FN PINIT_ONCE_FN_; + + typedef ::SRWLOCK SRWLOCK_; + typedef ::PSRWLOCK PSRWLOCK_; + #define BOOST_DETAIL_WINAPI_SRWLOCK_INIT SRWLOCK_INIT + + typedef ::CONDITION_VARIABLE CONDITION_VARIABLE_; + typedef ::PCONDITION_VARIABLE PCONDITION_VARIABLE_; + #define BOOST_DETAIL_WINAPI_CONDITION_VARIABLE_INIT CONDITION_VARIABLE_INIT +#endif + + using ::InitializeCriticalSection; +#if BOOST_USE_WINAPI_VERSION >= 0x0403 + using ::InitializeCriticalSectionAndSpinCount; +#endif + using ::EnterCriticalSection; + using ::TryEnterCriticalSection; + using ::LeaveCriticalSection; + using ::DeleteCriticalSection; + +# ifdef BOOST_NO_ANSI_APIS + using ::CreateMutexW; + using ::OpenMutexW; + using ::CreateEventW; + using ::OpenEventW; + using ::CreateSemaphoreW; + using ::OpenSemaphoreW; +# else + using ::CreateMutexA; + using ::OpenMutexA; + using ::CreateEventA; + using ::OpenEventA; + using ::CreateSemaphoreA; + using ::OpenSemaphoreA; +# endif + using ::ReleaseMutex; + using ::ReleaseSemaphore; + using ::SetEvent; + using ::ResetEvent; + using ::WaitForMultipleObjects; + using ::WaitForSingleObject; + using ::QueueUserAPC; + +#if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6 + using ::InitOnceInitialize; + using ::InitOnceExecuteOnce; + using ::InitOnceBeginInitialize; + using ::InitOnceComplete; + + using ::InitializeSRWLock; + using ::AcquireSRWLockExclusive; + using ::TryAcquireSRWLockExclusive; + using ::ReleaseSRWLockExclusive; + using ::AcquireSRWLockShared; + using ::TryAcquireSRWLockShared; + using ::ReleaseSRWLockShared; + + using ::InitializeConditionVariable; + using ::WakeConditionVariable; + using ::WakeAllConditionVariable; + using ::SleepConditionVariableCS; + using ::SleepConditionVariableSRW; +#endif + + const DWORD_ infinite = INFINITE; + const DWORD_ wait_abandoned = WAIT_ABANDONED; + const DWORD_ wait_object_0 = WAIT_OBJECT_0; + const DWORD_ wait_timeout = WAIT_TIMEOUT; + const DWORD_ wait_failed = WAIT_FAILED; + +#if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6 + const DWORD_ init_once_async = INIT_ONCE_ASYNC; + const DWORD_ init_once_check_only = INIT_ONCE_CHECK_ONLY; + const DWORD_ init_once_init_failed = INIT_ONCE_INIT_FAILED; + const DWORD_ init_once_ctx_reserved_bits = INIT_ONCE_CTX_RESERVED_BITS; + + const ULONG_ condition_variable_lockmode_shared = CONDITION_VARIABLE_LOCKMODE_SHARED; +#endif + +#else // defined( BOOST_USE_WINDOWS_H ) + +extern "C" { + + typedef struct CRITICAL_SECTION_ + { + struct critical_section_debug * DebugInfo; + long LockCount; + long RecursionCount; + void * OwningThread; + void * LockSemaphore; + #if defined(_WIN64) + unsigned __int64 SpinCount; + #else + unsigned long SpinCount; + #endif + } + *PCRITICAL_SECTION_; + +#if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6 + typedef union INIT_ONCE_ + { + PVOID_ Ptr; + } + *PINIT_ONCE_, *LPINIT_ONCE_; + #define BOOST_DETAIL_WINAPI_INIT_ONCE_STATIC_INIT {0} + typedef BOOL_ (WINAPI *PINIT_ONCE_FN_)(PINIT_ONCE_ InitOnce, PVOID_ Parameter, PVOID_ *Context); + + typedef struct SRWLOCK_ + { + PVOID_ Ptr; + } + * PSRWLOCK_; + #define BOOST_DETAIL_WINAPI_SRWLOCK_INIT {0} + + typedef struct CONDITION_VARIABLE_ + { + PVOID_ Ptr; + } + * PCONDITION_VARIABLE_; + #define BOOST_DETAIL_WINAPI_CONDITION_VARIABLE_INIT {0} + +#endif + + __declspec(dllimport) void WINAPI + InitializeCriticalSection(PCRITICAL_SECTION_); +#if BOOST_USE_WINAPI_VERSION >= 0x0403 + __declspec(dllimport) BOOL_ WINAPI + InitializeCriticalSectionAndSpinCount(CRITICAL_SECTION_* lpCS, DWORD_ dwSpinCount); +#endif + __declspec(dllimport) void WINAPI + EnterCriticalSection(PCRITICAL_SECTION_); + __declspec(dllimport) BOOL_ WINAPI + TryEnterCriticalSection(PCRITICAL_SECTION_); + __declspec(dllimport) void WINAPI + LeaveCriticalSection(PCRITICAL_SECTION_); + __declspec(dllimport) void WINAPI + DeleteCriticalSection(PCRITICAL_SECTION_); + + struct _SECURITY_ATTRIBUTES; +# ifdef BOOST_NO_ANSI_APIS + __declspec(dllimport) HANDLE_ WINAPI + CreateMutexW(_SECURITY_ATTRIBUTES*, BOOL_, LPCWSTR_); + __declspec(dllimport) HANDLE_ WINAPI + OpenMutexW(DWORD_ dwDesiredAccess, BOOL_ bInheritHandle, LPCWSTR_ lpName); + __declspec(dllimport) HANDLE_ WINAPI + CreateSemaphoreW(_SECURITY_ATTRIBUTES*, LONG_, LONG_, LPCWSTR_); + __declspec(dllimport) HANDLE_ WINAPI + OpenSemaphoreW(DWORD_ dwDesiredAccess, BOOL_ bInheritHandle, LPCWSTR_ lpName); + __declspec(dllimport) HANDLE_ WINAPI + CreateEventW(_SECURITY_ATTRIBUTES*, BOOL_, BOOL_, LPCWSTR_); + __declspec(dllimport) HANDLE_ WINAPI + OpenEventW(DWORD_, BOOL_, LPCWSTR_); +# else + __declspec(dllimport) HANDLE_ WINAPI + CreateMutexA(_SECURITY_ATTRIBUTES*, BOOL_, LPCSTR_); + __declspec(dllimport) HANDLE_ WINAPI + OpenMutexA(DWORD_ dwDesiredAccess, BOOL_ bInheritHandle, LPCSTR_ lpName); + __declspec(dllimport) HANDLE_ WINAPI + CreateSemaphoreA(_SECURITY_ATTRIBUTES*, LONG_, LONG_, LPCSTR_); + __declspec(dllimport) HANDLE_ WINAPI + OpenSemaphoreA(DWORD_ dwDesiredAccess, BOOL_ bInheritHandle, LPCSTR_ lpName); + __declspec(dllimport) HANDLE_ WINAPI + CreateEventA(_SECURITY_ATTRIBUTES*, BOOL_, BOOL_, LPCSTR_); + __declspec(dllimport) HANDLE_ WINAPI + OpenEventA(DWORD_, BOOL_, LPCSTR_); +# endif + __declspec(dllimport) BOOL_ WINAPI + ReleaseMutex(HANDLE_); + __declspec(dllimport) DWORD_ WINAPI + WaitForSingleObject(HANDLE_, DWORD_); + __declspec(dllimport) DWORD_ WINAPI + WaitForMultipleObjects(DWORD_ nCount, + HANDLE_ const * lpHandles, + BOOL_ bWaitAll, + DWORD_ dwMilliseconds); + __declspec(dllimport) BOOL_ WINAPI + ReleaseSemaphore(HANDLE_, LONG_, LONG_*); + __declspec(dllimport) BOOL_ WINAPI + SetEvent(HANDLE_); + __declspec(dllimport) BOOL_ WINAPI + ResetEvent(HANDLE_); + + typedef void (__stdcall *PAPCFUNC_)(ULONG_PTR_); + __declspec(dllimport) DWORD_ WINAPI + QueueUserAPC(PAPCFUNC_, HANDLE_, ULONG_PTR_); + +#if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6 + __declspec(dllimport) void WINAPI InitOnceInitialize(PINIT_ONCE_); + __declspec(dllimport) BOOL_ WINAPI InitOnceExecuteOnce(PINIT_ONCE_ InitOnce, PINIT_ONCE_FN_ InitFn, PVOID_ Parameter, LPVOID_* Context); + __declspec(dllimport) BOOL_ WINAPI InitOnceBeginInitialize(LPINIT_ONCE_ lpInitOnce, DWORD_ dwFlags, BOOL_* fPending, LPVOID_* lpContext); + __declspec(dllimport) BOOL_ WINAPI InitOnceComplete(LPINIT_ONCE_ lpInitOnce, DWORD_ dwFlags, LPVOID_* lpContext); + + + __declspec(dllimport) void WINAPI InitializeSRWLock(PSRWLOCK_ SRWLock); + __declspec(dllimport) void WINAPI AcquireSRWLockExclusive(PSRWLOCK_ SRWLock); + __declspec(dllimport) BOOLEAN_ WINAPI TryAcquireSRWLockExclusive(PSRWLOCK_ SRWLock); + __declspec(dllimport) void WINAPI ReleaseSRWLockExclusive(PSRWLOCK_ SRWLock); + __declspec(dllimport) void WINAPI AcquireSRWLockShared(PSRWLOCK_ SRWLock); + __declspec(dllimport) BOOLEAN_ WINAPI TryAcquireSRWLockShared(PSRWLOCK_ SRWLock); + __declspec(dllimport) void WINAPI ReleaseSRWLockShared(PSRWLOCK_ SRWLock); + + __declspec(dllimport) void WINAPI InitializeConditionVariable(PCONDITION_VARIABLE_ ConditionVariable); + __declspec(dllimport) void WINAPI WakeConditionVariable(PCONDITION_VARIABLE_ ConditionVariable); + __declspec(dllimport) void WINAPI WakeAllConditionVariable(PCONDITION_VARIABLE_ ConditionVariable); + __declspec(dllimport) BOOL_ WINAPI SleepConditionVariableCS(PCONDITION_VARIABLE_ ConditionVariable, PCRITICAL_SECTION_ CriticalSection, DWORD_ dwMilliseconds); + __declspec(dllimport) BOOL_ WINAPI SleepConditionVariableSRW(PCONDITION_VARIABLE_ ConditionVariable, PSRWLOCK_ SRWLock, DWORD_ dwMilliseconds, ULONG_ Flags); +#endif + +} // extern "C" + +const DWORD_ infinite = (DWORD_)0xFFFFFFFF; +const DWORD_ wait_abandoned = 0x00000080L; +const DWORD_ wait_object_0 = 0x00000000L; +const DWORD_ wait_timeout = 0x00000102L; +const DWORD_ wait_failed = (DWORD_)0xFFFFFFFF; + +#if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6 +const DWORD_ init_once_async = 0x00000002UL; +const DWORD_ init_once_check_only = 0x00000001UL; +const DWORD_ init_once_init_failed = 0x00000004UL; +const DWORD_ init_once_ctx_reserved_bits = 2; + +const ULONG_ condition_variable_lockmode_shared = 0x00000001; +#endif + +#endif // defined( BOOST_USE_WINDOWS_H ) + +const DWORD_ max_non_infinite_wait = (DWORD_)0xFFFFFFFE; + +BOOST_FORCEINLINE HANDLE_ create_anonymous_mutex(_SECURITY_ATTRIBUTES* lpAttributes, BOOL_ bInitialOwner) +{ +#ifdef BOOST_NO_ANSI_APIS + return CreateMutexW(lpAttributes, bInitialOwner, 0); +#else + return CreateMutexA(lpAttributes, bInitialOwner, 0); +#endif +} + +BOOST_FORCEINLINE HANDLE_ create_anonymous_semaphore(_SECURITY_ATTRIBUTES* lpAttributes, LONG_ lInitialCount, LONG_ lMaximumCount) +{ +#ifdef BOOST_NO_ANSI_APIS + return CreateSemaphoreW(lpAttributes, lInitialCount, lMaximumCount, 0); +#else + return CreateSemaphoreA(lpAttributes, lInitialCount, lMaximumCount, 0); +#endif +} + +BOOST_FORCEINLINE HANDLE_ create_anonymous_event(_SECURITY_ATTRIBUTES* lpAttributes, BOOL_ bManualReset, BOOL_ bInitialState) +{ +#ifdef BOOST_NO_ANSI_APIS + return CreateEventW(lpAttributes, bManualReset, bInitialState, 0); +#else + return CreateEventA(lpAttributes, bManualReset, bInitialState, 0); +#endif +} + +} +} +} + +#endif // BOOST_DETAIL_WINAPI_SYNCHRONIZATION_HPP diff --git a/boost/detail/win/system.hpp b/boost/detail/winapi/system.hpp index 3bcffcec8e..2c2d82a8a9 100644 --- a/boost/detail/win/system.hpp +++ b/boost/detail/winapi/system.hpp @@ -1,24 +1,31 @@ // system.hpp --------------------------------------------------------------// // Copyright 2010 Vicente J. Botet Escriba +// Copyright (c) Microsoft Corporation 2014 // Distributed under the Boost Software License, Version 1.0. // See http://www.boost.org/LICENSE_1_0.txt -#ifndef BOOST_DETAIL_WIN_SYSTEM_HPP -#define BOOST_DETAIL_WIN_SYSTEM_HPP -#include <boost/config.hpp> -#include <cstdarg> +#ifndef BOOST_DETAIL_WINAPI_SYSTEM_HPP +#define BOOST_DETAIL_WINAPI_SYSTEM_HPP -#include <boost/detail/win/basic_types.hpp> -extern "C" __declspec(dllimport) void __stdcall GetSystemInfo (struct system_info *); +#include <boost/detail/winapi/basic_types.hpp> + +#ifdef BOOST_HAS_PRAGMA_ONCE +#pragma once +#endif namespace boost { namespace detail { -namespace win32 { +namespace winapi { #if defined( BOOST_USE_WINDOWS_H ) typedef ::SYSTEM_INFO SYSTEM_INFO_; +# if BOOST_USE_WINAPI_VERSION < BOOST_WINAPI_VERSION_WINXP +extern "C" __declspec(dllimport) void __stdcall GetSystemInfo (struct system_info *); +# else +extern "C" __declspec(dllimport) void __stdcall GetNativeSystemInfo (struct system_info *); +# endif #else extern "C" { typedef struct _SYSTEM_INFO { @@ -40,11 +47,16 @@ extern "C" { WORD_ wProcessorRevision; } SYSTEM_INFO_; +# if BOOST_USE_WINAPI_VERSION < BOOST_WINAPI_VERSION_WINXP __declspec(dllimport) void __stdcall GetSystemInfo (struct system_info *); +# else + __declspec(dllimport) void __stdcall + GetNativeSystemInfo (struct system_info *); +# endif } #endif } } } -#endif // BOOST_DETAIL_WIN_TIME_HPP +#endif // BOOST_DETAIL_WINAPI_SYSTEM_HPP diff --git a/boost/detail/winapi/thread.hpp b/boost/detail/winapi/thread.hpp new file mode 100644 index 0000000000..ee0dac6242 --- /dev/null +++ b/boost/detail/winapi/thread.hpp @@ -0,0 +1,49 @@ +// thread.hpp --------------------------------------------------------------// + +// Copyright 2010 Vicente J. Botet Escriba + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + + +#ifndef BOOST_DETAIL_WINAPI_THREAD_HPP +#define BOOST_DETAIL_WINAPI_THREAD_HPP + +#include <boost/detail/winapi/basic_types.hpp> +#include <boost/detail/winapi/GetCurrentThread.hpp> + +#ifdef BOOST_HAS_PRAGMA_ONCE +#pragma once +#endif + +namespace boost +{ +namespace detail +{ +namespace winapi +{ +#if defined( BOOST_USE_WINDOWS_H ) + using ::GetCurrentThreadId; + using ::SleepEx; + using ::Sleep; + using ::SwitchToThread; +#else +extern "C" { +# ifndef UNDER_CE + __declspec(dllimport) DWORD_ WINAPI GetCurrentThreadId(void); + __declspec(dllimport) DWORD_ WINAPI SleepEx(DWORD_, BOOL_); + __declspec(dllimport) void WINAPI Sleep(DWORD_); + __declspec(dllimport) BOOL_ WINAPI SwitchToThread(void); +#else + using ::GetCurrentThreadId; + using ::SleepEx; + using ::Sleep; + using ::SwitchToThread; +#endif +} +#endif +} +} +} + +#endif // BOOST_DETAIL_WINAPI_THREAD_HPP diff --git a/boost/detail/winapi/thread_pool.hpp b/boost/detail/winapi/thread_pool.hpp new file mode 100644 index 0000000000..57059dc1b2 --- /dev/null +++ b/boost/detail/winapi/thread_pool.hpp @@ -0,0 +1,96 @@ +// thread_pool.hpp --------------------------------------------------------------// + +// Copyright 2013 Andrey Semashev + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + + +#ifndef BOOST_DETAIL_WINAPI_THREAD_POOL_HPP +#define BOOST_DETAIL_WINAPI_THREAD_POOL_HPP + +#include <boost/detail/winapi/basic_types.hpp> + +#ifdef BOOST_HAS_PRAGMA_ONCE +#pragma once +#endif + +#if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN2K + +namespace boost +{ +namespace detail +{ +namespace winapi +{ +#if defined( BOOST_USE_WINDOWS_H ) + +typedef ::WAITORTIMERCALLBACKFUNC WAITORTIMERCALLBACKFUNC_; +typedef ::WAITORTIMERCALLBACK WAITORTIMERCALLBACK_; + +using ::RegisterWaitForSingleObject; +using ::UnregisterWait; +using ::UnregisterWaitEx; + +const ULONG_ wt_execute_default = WT_EXECUTEDEFAULT; +const ULONG_ wt_execute_in_io_thread = WT_EXECUTEINIOTHREAD; +const ULONG_ wt_execute_in_ui_thread = WT_EXECUTEINUITHREAD; +const ULONG_ wt_execute_in_wait_thread = WT_EXECUTEINWAITTHREAD; +const ULONG_ wt_execute_only_once = WT_EXECUTEONLYONCE; +const ULONG_ wt_execute_in_timer_thread = WT_EXECUTEINTIMERTHREAD; +const ULONG_ wt_execute_long_function = WT_EXECUTELONGFUNCTION; +const ULONG_ wt_execute_in_persistent_io_thread = WT_EXECUTEINPERSISTENTIOTHREAD; +const ULONG_ wt_execute_in_persistent_thread = WT_EXECUTEINPERSISTENTTHREAD; +const ULONG_ wt_transfer_impersonation = WT_TRANSFER_IMPERSONATION; + +inline ULONG_ wt_set_max_threadpool_threads(ULONG_ flags, ULONG_ limit) +{ + return WT_SET_MAX_THREADPOOL_THREADS(flags, limit); +} + +#else + +extern "C" { + +typedef void (NTAPI* WAITORTIMERCALLBACKFUNC_) (PVOID_, BOOLEAN_); +typedef WAITORTIMERCALLBACKFUNC_ WAITORTIMERCALLBACK_; + +__declspec(dllimport) BOOL_ WINAPI RegisterWaitForSingleObject +( + HANDLE_* phNewWaitObject, + HANDLE_ hObject, + WAITORTIMERCALLBACK_ Callback, + PVOID_ Context, + ULONG_ dwMilliseconds, + ULONG_ dwFlags +); + +__declspec(dllimport) BOOL_ WINAPI UnregisterWait(HANDLE_ WaitHandle); +__declspec(dllimport) BOOL_ WINAPI UnregisterWaitEx(HANDLE_ WaitHandle, HANDLE_ CompletionEvent); + +} // extern "C" + +const ULONG_ wt_execute_default = 0x00000000; +const ULONG_ wt_execute_in_io_thread = 0x00000001; +const ULONG_ wt_execute_in_ui_thread = 0x00000002; +const ULONG_ wt_execute_in_wait_thread = 0x00000004; +const ULONG_ wt_execute_only_once = 0x00000008; +const ULONG_ wt_execute_in_timer_thread = 0x00000020; +const ULONG_ wt_execute_long_function = 0x00000010; +const ULONG_ wt_execute_in_persistent_io_thread = 0x00000040; +const ULONG_ wt_execute_in_persistent_thread = 0x00000080; +const ULONG_ wt_transfer_impersonation = 0x00000100; + +inline ULONG_ wt_set_max_threadpool_threads(ULONG_ flags, ULONG_ limit) +{ + return flags | (limit << 16); +} + +#endif +} +} +} + +#endif // BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN2K + +#endif // BOOST_DETAIL_WINAPI_THREAD_POOL_HPP diff --git a/boost/detail/win/time.hpp b/boost/detail/winapi/time.hpp index 7f636edbae..6a6b447117 100644 --- a/boost/detail/win/time.hpp +++ b/boost/detail/winapi/time.hpp @@ -1,21 +1,28 @@ // time.hpp --------------------------------------------------------------// // Copyright 2010 Vicente J. Botet Escriba +// Copyright (c) Microsoft Corporation 2014 // Distributed under the Boost Software License, Version 1.0. // See http://www.boost.org/LICENSE_1_0.txt -#ifndef BOOST_DETAIL_WIN_TIME_HPP -#define BOOST_DETAIL_WIN_TIME_HPP +#ifndef BOOST_DETAIL_WINAPI_TIME_HPP +#define BOOST_DETAIL_WINAPI_TIME_HPP -#include <boost/detail/win/basic_types.hpp> +#include <boost/detail/winapi/basic_types.hpp> +#include <boost/predef.h> +#ifdef BOOST_HAS_PRAGMA_ONCE +#pragma once +#endif namespace boost { namespace detail { -namespace win32 { +namespace winapi { + #if defined( BOOST_USE_WINDOWS_H ) + typedef FILETIME FILETIME_; typedef PFILETIME PFILETIME_; typedef LPFILETIME LPFILETIME_; @@ -23,15 +30,24 @@ namespace win32 { typedef SYSTEMTIME SYSTEMTIME_; typedef SYSTEMTIME* PSYSTEMTIME_; - #ifndef UNDER_CE // Windows CE does not define GetSystemTimeAsFileTime + #ifdef BOOST_HAS_GETSYSTEMTIMEASFILETIME // Windows CE does not define GetSystemTimeAsFileTime using ::GetSystemTimeAsFileTime; #endif + #if BOOST_PLAT_WINDOWS_DESKTOP using ::FileTimeToLocalFileTime; + #endif using ::GetSystemTime; using ::SystemTimeToFileTime; + + #if BOOST_PLAT_WINDOWS_DESKTOP using ::GetTickCount; + #endif + #if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6 + using ::GetTickCount64; + #endif #else + extern "C" { typedef struct _FILETIME { DWORD_ dwLowDateTime; @@ -49,24 +65,41 @@ extern "C" { WORD_ wMilliseconds; } SYSTEMTIME_, *PSYSTEMTIME_; - #ifndef UNDER_CE // Windows CE does not define GetSystemTimeAsFileTime + #ifdef BOOST_HAS_GETSYSTEMTIMEASFILETIME // Windows CE does not define GetSystemTimeAsFileTime __declspec(dllimport) void WINAPI GetSystemTimeAsFileTime(FILETIME_* lpFileTime); #endif __declspec(dllimport) int WINAPI - FileTimeToLocalFileTime(const FILETIME_* lpFileTime, + FileTimeToLocalFileTime(const FILETIME_* lpFileTime, FILETIME_* lpLocalFileTime); __declspec(dllimport) void WINAPI GetSystemTime(SYSTEMTIME_* lpSystemTime); __declspec(dllimport) int WINAPI - SystemTimeToFileTime(const SYSTEMTIME_* lpSystemTime, + SystemTimeToFileTime(const SYSTEMTIME_* lpSystemTime, FILETIME_* lpFileTime); - __declspec(dllimport) unsigned long __stdcall + #if BOOST_PLAT_WINDOWS_DESKTOP + __declspec(dllimport) DWORD_ WINAPI GetTickCount(); + #endif + #if BOOST_USE_WINAPI_VERSION >= BOOST_WINAPI_VERSION_WIN6 + __declspec(dllimport) ULONGLONG_ WINAPI + GetTickCount64(); + #endif } + #endif + +#ifndef BOOST_HAS_GETSYSTEMTIMEASFILETIME +inline void WINAPI GetSystemTimeAsFileTime(FILETIME_* lpFileTime) +{ + SYSTEMTIME_ st; + GetSystemTime(&st); + SystemTimeToFileTime(&st, lpFileTime); +} +#endif + } } } -#endif // BOOST_DETAIL_WIN_TIME_HPP +#endif // BOOST_DETAIL_WINAPI_TIME_HPP diff --git a/boost/detail/win/timers.hpp b/boost/detail/winapi/timers.hpp index 753c91f83e..04c6dfbc41 100644 --- a/boost/detail/win/timers.hpp +++ b/boost/detail/winapi/timers.hpp @@ -6,17 +6,20 @@ // See http://www.boost.org/LICENSE_1_0.txt -#ifndef BOOST_DETAIL_WIN_TIMERS_HPP -#define BOOST_DETAIL_WIN_TIMERS_HPP +#ifndef BOOST_DETAIL_WINAPI_TIMERS_HPP +#define BOOST_DETAIL_WINAPI_TIMERS_HPP -#include <boost/detail/win/basic_types.hpp> +#include <boost/detail/winapi/basic_types.hpp> +#ifdef BOOST_HAS_PRAGMA_ONCE +#pragma once +#endif namespace boost { namespace detail { -namespace win32 +namespace winapi { #if defined( BOOST_USE_WINDOWS_H ) using ::QueryPerformanceCounter; @@ -38,4 +41,4 @@ extern "C" { } } -#endif // BOOST_DETAIL_WIN_TIMERS_HPP +#endif // BOOST_DETAIL_WINAPI_TIMERS_HPP diff --git a/boost/detail/winapi/tls.hpp b/boost/detail/winapi/tls.hpp new file mode 100644 index 0000000000..d948693cc9 --- /dev/null +++ b/boost/detail/winapi/tls.hpp @@ -0,0 +1,49 @@ +// tls.hpp --------------------------------------------------------------// + +// Copyright 2013 Andrey Semashev + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + + +#ifndef BOOST_DETAIL_WINAPI_TLS_HPP +#define BOOST_DETAIL_WINAPI_TLS_HPP + +#include <boost/detail/winapi/basic_types.hpp> + +#ifdef BOOST_HAS_PRAGMA_ONCE +#pragma once +#endif + +namespace boost +{ +namespace detail +{ +namespace winapi +{ +#if defined( BOOST_USE_WINDOWS_H ) + +using ::TlsAlloc; +using ::TlsGetValue; +using ::TlsSetValue; +using ::TlsFree; + +const DWORD_ tls_out_of_indexes = TLS_OUT_OF_INDEXES; + +#else + +extern "C" { +__declspec(dllimport) DWORD_ WINAPI TlsAlloc(void); +__declspec(dllimport) LPVOID_ WINAPI TlsGetValue(DWORD_ dwTlsIndex); +__declspec(dllimport) BOOL_ WINAPI TlsSetValue(DWORD_ dwTlsIndex, LPVOID_ lpTlsValue); +__declspec(dllimport) BOOL_ WINAPI TlsFree(DWORD_ dwTlsIndex); +} + +const DWORD_ tls_out_of_indexes = 0xFFFFFFFF; + +#endif +} +} +} + +#endif // BOOST_DETAIL_WINAPI_TLS_HPP diff --git a/boost/detail/winapi/waitable_timer.hpp b/boost/detail/winapi/waitable_timer.hpp new file mode 100644 index 0000000000..52a7338a20 --- /dev/null +++ b/boost/detail/winapi/waitable_timer.hpp @@ -0,0 +1,110 @@ +// waitable_timer.hpp --------------------------------------------------------------// + +// Copyright 2013 Andrey Semashev + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + + +#ifndef BOOST_DETAIL_WINAPI_WAITABLE_TIMER_HPP +#define BOOST_DETAIL_WINAPI_WAITABLE_TIMER_HPP + +#include <boost/detail/winapi/basic_types.hpp> + +#ifdef BOOST_HAS_PRAGMA_ONCE +#pragma once +#endif + +namespace boost +{ +namespace detail +{ +namespace winapi +{ +#if defined( BOOST_USE_WINDOWS_H ) + +typedef ::PTIMERAPCROUTINE PTIMERAPCROUTINE_; + +# ifdef BOOST_NO_ANSI_APIS +using ::CreateWaitableTimerW; +using ::OpenWaitableTimerW; +# else +using ::CreateWaitableTimerA; +using ::OpenWaitableTimerA; +# endif +using ::SetWaitableTimer; +using ::CancelWaitableTimer; + +#else + +extern "C" { + +struct _SECURITY_ATTRIBUTES; + +typedef void (WINAPI* PTIMERAPCROUTINE_) +( + LPVOID_ lpArgToCompletionRoutine, + DWORD_ dwTimerLowValue, + DWORD_ dwTimerHighValue +); + +# ifdef BOOST_NO_ANSI_APIS +__declspec(dllimport) HANDLE_ WINAPI CreateWaitableTimerW +( + _SECURITY_ATTRIBUTES* lpTimerAttributes, + BOOL_ bManualReset, + LPCWSTR_ lpTimerName +); + +__declspec(dllimport) HANDLE_ WINAPI OpenWaitableTimerW +( + DWORD_ dwDesiredAccess, + BOOL_ bInheritHandle, + LPCWSTR_ lpTimerName +); +# else +__declspec(dllimport) HANDLE_ WINAPI CreateWaitableTimerA +( + _SECURITY_ATTRIBUTES* lpTimerAttributes, + BOOL_ bManualReset, + LPCSTR_ lpTimerName +); + +__declspec(dllimport) HANDLE_ WINAPI OpenWaitableTimerA +( + DWORD_ dwDesiredAccess, + BOOL_ bInheritHandle, + LPCSTR_ lpTimerName +); +# endif + +__declspec(dllimport) BOOL_ WINAPI SetWaitableTimer +( + HANDLE_ hTimer, + const LARGE_INTEGER_ *lpDueTime, + LONG_ lPeriod, + PTIMERAPCROUTINE_ pfnCompletionRoutine, + LPVOID_ lpArgToCompletionRoutine, + BOOL_ fResume +); + +__declspec(dllimport) BOOL_ WINAPI CancelWaitableTimer(HANDLE_ hTimer); + +} + +#endif + +BOOST_FORCEINLINE HANDLE_ create_anonymous_waitable_timer(_SECURITY_ATTRIBUTES* lpTimerAttributes, BOOL_ bManualReset) +{ +#ifdef BOOST_NO_ANSI_APIS + return CreateWaitableTimerW(lpTimerAttributes, bManualReset, 0); +#else + return CreateWaitableTimerA(lpTimerAttributes, bManualReset, 0); +#endif +} + +} +} +} + +#endif // BOOST_DETAIL_WINAPI_WAITABLE_TIMER_HPP |