From 491ddd570a752cf9bda85933bed0c6942e39b1f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Remko=20Tron=C3=A7on?= <git@el-tramo.be> Date: Sun, 23 Dec 2012 14:16:26 +0100 Subject: Update Boost to 1.52.0. Change-Id: I1e56bea2600bf2ed9c5b3aba8c4f9d2a0f350e77 diff --git a/3rdParty/Boost/01_fix_return_type_warning.diff b/3rdParty/Boost/01_fix_return_type_warning.diff new file mode 100644 index 0000000..3f1fe83 --- /dev/null +++ b/3rdParty/Boost/01_fix_return_type_warning.diff @@ -0,0 +1,13 @@ +diff --git a/3rdParty/Boost/src/libs/thread/src/pthread/thread.cpp b/3rdParty/Boost/src/libs/thread/src/pthread/thread.cpp +index 4321a26..c83eac1 100644 +--- a/3rdParty/Boost/src/libs/thread/src/pthread/thread.cpp ++++ b/3rdParty/Boost/src/libs/thread/src/pthread/thread.cpp +@@ -27,6 +27,8 @@ + + #include "./timeconv.inl" + ++#pragma GCC diagnostic ignored "-Wreturn-type" ++ + namespace boost + { + namespace detail diff --git a/3rdParty/Boost/SConscript b/3rdParty/Boost/SConscript index f0d438b..6578736 100644 --- a/3rdParty/Boost/SConscript +++ b/3rdParty/Boost/SConscript @@ -65,17 +65,14 @@ elif env.get("BOOST_BUNDLED", False) : "src/libs/signals/src/signal_base.cpp", "src/libs/signals/src/slot.cpp", "src/libs/signals/src/trackable.cpp", - "src/libs/filesystem/v3/src/codecvt_error_category.cpp", - "src/libs/filesystem/v3/src/operations.cpp", - "src/libs/filesystem/v3/src/path.cpp", - "src/libs/filesystem/v3/src/path_traits.cpp", - "src/libs/filesystem/v3/src/portability.cpp", - "src/libs/filesystem/v3/src/unique_path.cpp", - "src/libs/filesystem/v3/src/windows_file_codecvt.cpp", -# "src/libs/filesystem/v2/src/v2_operations.cpp", -# "src/libs/filesystem/v2/src/v2_path.cpp", -# "src/libs/filesystem/v2/src/v2_portability.cpp", - "src/libs/filesystem/v3/src/filesystem_utf8_codecvt_facet.cpp", + "src/libs/filesystem/src/codecvt_error_category.cpp", + "src/libs/filesystem/src/operations.cpp", + "src/libs/filesystem/src/path.cpp", + "src/libs/filesystem/src/path_traits.cpp", + "src/libs/filesystem/src/portability.cpp", + "src/libs/filesystem/src/unique_path.cpp", + "src/libs/filesystem/src/windows_file_codecvt.cpp", + "src/libs/filesystem/src/filesystem_utf8_codecvt_facet.cpp", "src/libs/regex/src/c_regex_traits.cpp", "src/libs/regex/src/cpp_regex_traits.cpp", "src/libs/regex/src/cregex.cpp", diff --git a/3rdParty/Boost/src/boost/algorithm/string/detail/case_conv.hpp b/3rdParty/Boost/src/boost/algorithm/string/detail/case_conv.hpp index 5b0064f..42621c7 100644 --- a/3rdParty/Boost/src/boost/algorithm/string/detail/case_conv.hpp +++ b/3rdParty/Boost/src/boost/algorithm/string/detail/case_conv.hpp @@ -15,6 +15,8 @@ #include <locale> #include <functional> +#include <boost/type_traits/make_unsigned.hpp> + namespace boost { namespace algorithm { namespace detail { @@ -37,7 +39,7 @@ namespace boost { CharT operator ()( CharT Ch ) const { #if defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (__BORLANDC__ <= 0x564) && !defined(_USE_OLD_RW_STL) - return std::tolower( Ch); + return std::tolower( static_cast<typename boost::make_unsigned <CharT>::type> ( Ch )); #else return std::tolower<CharT>( Ch, *m_Loc ); #endif @@ -57,7 +59,7 @@ namespace boost { CharT operator ()( CharT Ch ) const { #if defined(__BORLANDC__) && (__BORLANDC__ >= 0x560) && (__BORLANDC__ <= 0x564) && !defined(_USE_OLD_RW_STL) - return std::toupper( Ch); + return std::toupper( static_cast<typename boost::make_unsigned <CharT>::type> ( Ch )); #else return std::toupper<CharT>( Ch, *m_Loc ); #endif diff --git a/3rdParty/Boost/src/boost/algorithm/string/detail/classification.hpp b/3rdParty/Boost/src/boost/algorithm/string/detail/classification.hpp index fb43955..704d9d2 100644 --- a/3rdParty/Boost/src/boost/algorithm/string/detail/classification.hpp +++ b/3rdParty/Boost/src/boost/algorithm/string/detail/classification.hpp @@ -126,7 +126,7 @@ namespace boost { } // Use fixed storage - ::memcpy(DestStorage, SrcStorage, sizeof(set_value_type)*m_Size); + ::std::memcpy(DestStorage, SrcStorage, sizeof(set_value_type)*m_Size); } // Destructor @@ -206,7 +206,7 @@ namespace boost { } // Copy the data - ::memcpy(DestStorage, SrcStorage, sizeof(set_value_type)*m_Size); + ::std::memcpy(DestStorage, SrcStorage, sizeof(set_value_type)*m_Size); return *this; } diff --git a/3rdParty/Boost/src/boost/algorithm/string/detail/formatter.hpp b/3rdParty/Boost/src/boost/algorithm/string/detail/formatter.hpp index bd6a780..8e7b727 100644 --- a/3rdParty/Boost/src/boost/algorithm/string/detail/formatter.hpp +++ b/3rdParty/Boost/src/boost/algorithm/string/detail/formatter.hpp @@ -87,6 +87,31 @@ namespace boost { } }; +// dissect format functor ----------------------------------------------------// + + // dissect format functor + template<typename FinderT> + struct dissect_formatF + { + public: + // Construction + dissect_formatF(FinderT Finder) : + m_Finder(Finder) {} + + // Operation + template<typename RangeT> + inline iterator_range< + BOOST_STRING_TYPENAME range_const_iterator<RangeT>::type> + operator()(const RangeT& Replace) const + { + return m_Finder(::boost::begin(Replace), ::boost::end(Replace)); + } + + private: + FinderT m_Finder; + }; + + } // namespace detail } // namespace algorithm } // namespace boost diff --git a/3rdParty/Boost/src/boost/algorithm/string/find.hpp b/3rdParty/Boost/src/boost/algorithm/string/find.hpp index 304646d..cc99ca1 100644 --- a/3rdParty/Boost/src/boost/algorithm/string/find.hpp +++ b/3rdParty/Boost/src/boost/algorithm/string/find.hpp @@ -228,13 +228,13 @@ namespace boost { //! Find head algorithm /*! Get the head of the input. Head is a prefix of the string of the - given size. If the input is shorter then required, whole input if considered + given size. If the input is shorter then required, whole input is considered to be the head. \param Input An input string \param N Length of the head For N>=0, at most N characters are extracted. - For N<0, size(Input)-|N| characters are extracted. + For N<0, at most size(Input)-|N| characters are extracted. \return An \c iterator_range delimiting the match. Returned iterator is either \c Range1T::iterator or @@ -258,13 +258,13 @@ namespace boost { //! Find tail algorithm /*! Get the tail of the input. Tail is a suffix of the string of the - given size. If the input is shorter then required, whole input if considered + given size. If the input is shorter then required, whole input is considered to be the tail. \param Input An input string \param N Length of the tail. For N>=0, at most N characters are extracted. - For N<0, size(Input)-|N| characters are extracted. + For N<0, at most size(Input)-|N| characters are extracted. \return An \c iterator_range delimiting the match. Returned iterator is either \c RangeT::iterator or diff --git a/3rdParty/Boost/src/boost/algorithm/string/formatter.hpp b/3rdParty/Boost/src/boost/algorithm/string/formatter.hpp index 50006df..ab5921e 100644 --- a/3rdParty/Boost/src/boost/algorithm/string/formatter.hpp +++ b/3rdParty/Boost/src/boost/algorithm/string/formatter.hpp @@ -36,7 +36,7 @@ namespace boost { //! Constant formatter /*! - Construct the \c const_formatter. Const formatter always returns + Constructs a \c const_formatter. Const formatter always returns the same value, regardless of the parameter. \param Format A predefined value used as a result for formating @@ -55,7 +55,7 @@ namespace boost { //! Identity formatter /*! - Construct the \c identity_formatter. Identity formatter always returns + Constructs an \c identity_formatter. Identity formatter always returns the parameter. \return An instance of the \c identity_formatter object. @@ -73,7 +73,7 @@ namespace boost { //! Empty formatter /*! - Construct the \c empty_formatter. Empty formatter always returns an empty + Constructs an \c empty_formatter. Empty formatter always returns an empty sequence. \param Input container used to select a correct value_type for the @@ -89,6 +89,22 @@ namespace boost { BOOST_STRING_TYPENAME range_value<RangeT>::type>(); } + //! Empty formatter + /*! + Constructs a \c dissect_formatter. Dissect formatter uses a specified finder + to extract a portion of the formatted sequence. The first finder's match is returned + as a result + + \param Finder a finder used to select a portion of the formated sequence + \return An instance of the \c dissect_formatter object. + */ + template<typename FinderT> + inline detail::dissect_formatF< FinderT > + dissect_formatter(const FinderT& Finder) + { + return detail::dissect_formatF<FinderT>(Finder); + } + } // namespace algorithm @@ -96,6 +112,7 @@ namespace boost { using algorithm::const_formatter; using algorithm::identity_formatter; using algorithm::empty_formatter; + using algorithm::dissect_formatter; } // namespace boost diff --git a/3rdParty/Boost/src/boost/algorithm/string/iter_find.hpp b/3rdParty/Boost/src/boost/algorithm/string/iter_find.hpp index 9e0245f..e106528 100644 --- a/3rdParty/Boost/src/boost/algorithm/string/iter_find.hpp +++ b/3rdParty/Boost/src/boost/algorithm/string/iter_find.hpp @@ -60,7 +60,7 @@ namespace boost { a match). \param Input A container which will be searched. \param Finder A Finder object used for searching - \return A reference the result + \return A reference to the result \note Prior content of the result will be overwritten. */ @@ -122,7 +122,7 @@ namespace boost { Each match is used as a separator of segments. These segments are then returned in the result. - \param Result A 'container container' to container the result of search. + \param Result A 'container container' to contain the result of search. Both outer and inner container must have constructor taking a pair of iterators as an argument. Typical type of the result is @@ -131,7 +131,7 @@ namespace boost { a match). \param Input A container which will be searched. \param Finder A finder object used for searching - \return A reference the result + \return A reference to the result \note Prior content of the result will be overwritten. */ diff --git a/3rdParty/Boost/src/boost/array.hpp b/3rdParty/Boost/src/boost/array.hpp index 85b63a2..fa06fa9 100644 --- a/3rdParty/Boost/src/boost/array.hpp +++ b/3rdParty/Boost/src/boost/array.hpp @@ -13,6 +13,7 @@ * accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) * + * 14 Apr 2012 - (mtc) Added support for boost::hash * 28 Dec 2010 - (mtc) Added cbegin and cend (and crbegin and crend) for C++Ox compatibility. * 10 Mar 2010 - (mtc) fill method added, matching resolution of the standard library working group. * See <http://www.open-std.org/jtc1/sc22/wg21/docs/lwg-defects.html#776> or Trac issue #3168 @@ -46,6 +47,7 @@ // Handles broken standard libraries better than <iterator> #include <boost/detail/iterator.hpp> #include <boost/throw_exception.hpp> +#include <boost/functional/hash_fwd.hpp> #include <algorithm> // FIXES for broken compilers @@ -118,13 +120,13 @@ namespace boost { // operator[] reference operator[](size_type i) { - BOOST_ASSERT( i < N && "out of range" ); + BOOST_ASSERT_MSG( i < N, "out of range" ); return elems[i]; } const_reference operator[](size_type i) const { - BOOST_ASSERT( i < N && "out of range" ); + BOOST_ASSERT_MSG( i < N, "out of range" ); return elems[i]; } @@ -322,7 +324,7 @@ namespace boost { static reference failed_rangecheck () { std::out_of_range e("attempt to access element of an empty array"); boost::throw_exception(e); -#if defined(BOOST_NO_EXCEPTIONS) || !defined(BOOST_MSVC) +#if defined(BOOST_NO_EXCEPTIONS) || (!defined(BOOST_MSVC) && !defined(__PATHSCALE__)) // // We need to return something here to keep // some compilers happy: however we will never @@ -427,6 +429,13 @@ namespace boost { } #endif + + template<class T, std::size_t N> + std::size_t hash_value(const array<T,N>& arr) + { + return boost::hash_range(arr.begin(), arr.end()); + } + } /* namespace boost */ diff --git a/3rdParty/Boost/src/boost/asio.hpp b/3rdParty/Boost/src/boost/asio.hpp index 2681806..8205c55 100644 --- a/3rdParty/Boost/src/boost/asio.hpp +++ b/3rdParty/Boost/src/boost/asio.hpp @@ -2,7 +2,7 @@ // asio.hpp // ~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -21,12 +21,15 @@ #include <boost/asio/basic_deadline_timer.hpp> #include <boost/asio/basic_io_object.hpp> #include <boost/asio/basic_raw_socket.hpp> +#include <boost/asio/basic_seq_packet_socket.hpp> #include <boost/asio/basic_serial_port.hpp> +#include <boost/asio/basic_signal_set.hpp> #include <boost/asio/basic_socket_acceptor.hpp> #include <boost/asio/basic_socket_iostream.hpp> #include <boost/asio/basic_socket_streambuf.hpp> #include <boost/asio/basic_stream_socket.hpp> #include <boost/asio/basic_streambuf.hpp> +#include <boost/asio/basic_waitable_timer.hpp> #include <boost/asio/buffer.hpp> #include <boost/asio/buffered_read_stream_fwd.hpp> #include <boost/asio/buffered_read_stream.hpp> @@ -36,6 +39,7 @@ #include <boost/asio/buffered_write_stream.hpp> #include <boost/asio/buffers_iterator.hpp> #include <boost/asio/completion_condition.hpp> +#include <boost/asio/connect.hpp> #include <boost/asio/datagram_socket_service.hpp> #include <boost/asio/deadline_timer_service.hpp> #include <boost/asio/deadline_timer.hpp> @@ -76,9 +80,12 @@ #include <boost/asio/read.hpp> #include <boost/asio/read_at.hpp> #include <boost/asio/read_until.hpp> +#include <boost/asio/seq_packet_socket_service.hpp> #include <boost/asio/serial_port.hpp> #include <boost/asio/serial_port_base.hpp> #include <boost/asio/serial_port_service.hpp> +#include <boost/asio/signal_set.hpp> +#include <boost/asio/signal_set_service.hpp> #include <boost/asio/socket_acceptor_service.hpp> #include <boost/asio/socket_base.hpp> #include <boost/asio/strand.hpp> @@ -86,9 +93,14 @@ #include <boost/asio/streambuf.hpp> #include <boost/asio/time_traits.hpp> #include <boost/asio/version.hpp> +#include <boost/asio/wait_traits.hpp> +#include <boost/asio/waitable_timer_service.hpp> #include <boost/asio/windows/basic_handle.hpp> +#include <boost/asio/windows/basic_object_handle.hpp> #include <boost/asio/windows/basic_random_access_handle.hpp> #include <boost/asio/windows/basic_stream_handle.hpp> +#include <boost/asio/windows/object_handle.hpp> +#include <boost/asio/windows/object_handle_service.hpp> #include <boost/asio/windows/overlapped_ptr.hpp> #include <boost/asio/windows/random_access_handle.hpp> #include <boost/asio/windows/random_access_handle_service.hpp> diff --git a/3rdParty/Boost/src/boost/asio/basic_datagram_socket.hpp b/3rdParty/Boost/src/boost/asio/basic_datagram_socket.hpp index a79967f..a773315 100644 --- a/3rdParty/Boost/src/boost/asio/basic_datagram_socket.hpp +++ b/3rdParty/Boost/src/boost/asio/basic_datagram_socket.hpp @@ -2,7 +2,7 @@ // basic_datagram_socket.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -19,6 +19,7 @@ #include <cstddef> #include <boost/asio/basic_socket.hpp> #include <boost/asio/datagram_socket_service.hpp> +#include <boost/asio/detail/handler_type_requirements.hpp> #include <boost/asio/detail/throw_error.hpp> #include <boost/asio/error.hpp> @@ -42,8 +43,12 @@ class basic_datagram_socket : public basic_socket<Protocol, DatagramSocketService> { public: + /// (Deprecated: Use native_handle_type.) The native representation of a + /// socket. + typedef typename DatagramSocketService::native_handle_type native_type; + /// The native representation of a socket. - typedef typename DatagramSocketService::native_type native_type; + typedef typename DatagramSocketService::native_handle_type native_handle_type; /// The protocol type. typedef Protocol protocol_type; @@ -121,12 +126,48 @@ public: * @throws boost::system::system_error Thrown on failure. */ basic_datagram_socket(boost::asio::io_service& io_service, - const protocol_type& protocol, const native_type& native_socket) + const protocol_type& protocol, const native_handle_type& native_socket) : basic_socket<Protocol, DatagramSocketService>( io_service, protocol, native_socket) { } +#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Move-construct a basic_datagram_socket from another. + /** + * This constructor moves a datagram socket from one object to another. + * + * @param other The other basic_datagram_socket object from which the move + * will occur. + * + * @note Following the move, the moved-from object is in the same state as if + * constructed using the @c basic_datagram_socket(io_service&) constructor. + */ + basic_datagram_socket(basic_datagram_socket&& other) + : basic_socket<Protocol, DatagramSocketService>( + BOOST_ASIO_MOVE_CAST(basic_datagram_socket)(other)) + { + } + + /// Move-assign a basic_datagram_socket from another. + /** + * This assignment operator moves a datagram socket from one object to + * another. + * + * @param other The other basic_datagram_socket object from which the move + * will occur. + * + * @note Following the move, the moved-from object is in the same state as if + * constructed using the @c basic_datagram_socket(io_service&) constructor. + */ + basic_datagram_socket& operator=(basic_datagram_socket&& other) + { + basic_socket<Protocol, DatagramSocketService>::operator=( + BOOST_ASIO_MOVE_CAST(basic_datagram_socket)(other)); + return *this; + } +#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Send some data on a connected socket. /** * This function is used to send data on the datagram socket. The function @@ -153,8 +194,9 @@ public: std::size_t send(const ConstBufferSequence& buffers) { boost::system::error_code ec; - std::size_t s = this->service.send(this->implementation, buffers, 0, ec); - boost::asio::detail::throw_error(ec); + std::size_t s = this->get_service().send( + this->get_implementation(), buffers, 0, ec); + boost::asio::detail::throw_error(ec, "send"); return s; } @@ -180,9 +222,9 @@ public: socket_base::message_flags flags) { boost::system::error_code ec; - std::size_t s = this->service.send( - this->implementation, buffers, flags, ec); - boost::asio::detail::throw_error(ec); + std::size_t s = this->get_service().send( + this->get_implementation(), buffers, flags, ec); + boost::asio::detail::throw_error(ec, "send"); return s; } @@ -207,7 +249,8 @@ public: std::size_t send(const ConstBufferSequence& buffers, socket_base::message_flags flags, boost::system::error_code& ec) { - return this->service.send(this->implementation, buffers, flags, ec); + return this->get_service().send( + this->get_implementation(), buffers, flags, ec); } /// Start an asynchronous send on a connected socket. @@ -247,9 +290,15 @@ public: * std::vector. */ template <typename ConstBufferSequence, typename WriteHandler> - void async_send(const ConstBufferSequence& buffers, WriteHandler handler) + void async_send(const ConstBufferSequence& buffers, + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { - this->service.async_send(this->implementation, buffers, 0, handler); + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a WriteHandler. + BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; + + this->get_service().async_send(this->get_implementation(), + buffers, 0, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); } /// Start an asynchronous send on a connected socket. @@ -283,9 +332,15 @@ public: */ template <typename ConstBufferSequence, typename WriteHandler> void async_send(const ConstBufferSequence& buffers, - socket_base::message_flags flags, WriteHandler handler) + socket_base::message_flags flags, + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { - this->service.async_send(this->implementation, buffers, flags, handler); + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a WriteHandler. + BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; + + this->get_service().async_send(this->get_implementation(), + buffers, flags, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); } /// Send a datagram to the specified endpoint. @@ -318,9 +373,9 @@ public: const endpoint_type& destination) { boost::system::error_code ec; - std::size_t s = this->service.send_to( - this->implementation, buffers, destination, 0, ec); - boost::asio::detail::throw_error(ec); + std::size_t s = this->get_service().send_to( + this->get_implementation(), buffers, destination, 0, ec); + boost::asio::detail::throw_error(ec, "send_to"); return s; } @@ -345,9 +400,9 @@ public: const endpoint_type& destination, socket_base::message_flags flags) { boost::system::error_code ec; - std::size_t s = this->service.send_to( - this->implementation, buffers, destination, flags, ec); - boost::asio::detail::throw_error(ec); + std::size_t s = this->get_service().send_to( + this->get_implementation(), buffers, destination, flags, ec); + boost::asio::detail::throw_error(ec, "send_to"); return s; } @@ -372,7 +427,7 @@ public: const endpoint_type& destination, socket_base::message_flags flags, boost::system::error_code& ec) { - return this->service.send_to(this->implementation, + return this->get_service().send_to(this->get_implementation(), buffers, destination, flags, ec); } @@ -415,10 +470,15 @@ public: */ template <typename ConstBufferSequence, typename WriteHandler> void async_send_to(const ConstBufferSequence& buffers, - const endpoint_type& destination, WriteHandler handler) + const endpoint_type& destination, + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { - this->service.async_send_to(this->implementation, buffers, destination, 0, - handler); + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a WriteHandler. + BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; + + this->get_service().async_send_to(this->get_implementation(), buffers, + destination, 0, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); } /// Start an asynchronous send. @@ -451,10 +511,14 @@ public: template <typename ConstBufferSequence, typename WriteHandler> void async_send_to(const ConstBufferSequence& buffers, const endpoint_type& destination, socket_base::message_flags flags, - WriteHandler handler) + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { - this->service.async_send_to(this->implementation, buffers, destination, - flags, handler); + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a WriteHandler. + BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; + + this->get_service().async_send_to(this->get_implementation(), buffers, + destination, flags, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); } /// Receive some data on a connected socket. @@ -485,9 +549,9 @@ public: std::size_t receive(const MutableBufferSequence& buffers) { boost::system::error_code ec; - std::size_t s = this->service.receive( - this->implementation, buffers, 0, ec); - boost::asio::detail::throw_error(ec); + std::size_t s = this->get_service().receive( + this->get_implementation(), buffers, 0, ec); + boost::asio::detail::throw_error(ec, "receive"); return s; } @@ -514,9 +578,9 @@ public: socket_base::message_flags flags) { boost::system::error_code ec; - std::size_t s = this->service.receive( - this->implementation, buffers, flags, ec); - boost::asio::detail::throw_error(ec); + std::size_t s = this->get_service().receive( + this->get_implementation(), buffers, flags, ec); + boost::asio::detail::throw_error(ec, "receive"); return s; } @@ -542,7 +606,8 @@ public: std::size_t receive(const MutableBufferSequence& buffers, socket_base::message_flags flags, boost::system::error_code& ec) { - return this->service.receive(this->implementation, buffers, flags, ec); + return this->get_service().receive( + this->get_implementation(), buffers, flags, ec); } /// Start an asynchronous receive on a connected socket. @@ -582,9 +647,15 @@ public: * std::vector. */ template <typename MutableBufferSequence, typename ReadHandler> - void async_receive(const MutableBufferSequence& buffers, ReadHandler handler) + void async_receive(const MutableBufferSequence& buffers, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { - this->service.async_receive(this->implementation, buffers, 0, handler); + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a ReadHandler. + BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; + + this->get_service().async_receive(this->get_implementation(), + buffers, 0, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); } /// Start an asynchronous receive on a connected socket. @@ -617,9 +688,15 @@ public: */ template <typename MutableBufferSequence, typename ReadHandler> void async_receive(const MutableBufferSequence& buffers, - socket_base::message_flags flags, ReadHandler handler) + socket_base::message_flags flags, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { - this->service.async_receive(this->implementation, buffers, flags, handler); + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a ReadHandler. + BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; + + this->get_service().async_receive(this->get_implementation(), + buffers, flags, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); } /// Receive a datagram with the endpoint of the sender. @@ -653,9 +730,9 @@ public: endpoint_type& sender_endpoint) { boost::system::error_code ec; - std::size_t s = this->service.receive_from( - this->implementation, buffers, sender_endpoint, 0, ec); - boost::asio::detail::throw_error(ec); + std::size_t s = this->get_service().receive_from( + this->get_implementation(), buffers, sender_endpoint, 0, ec); + boost::asio::detail::throw_error(ec, "receive_from"); return s; } @@ -680,9 +757,9 @@ public: endpoint_type& sender_endpoint, socket_base::message_flags flags) { boost::system::error_code ec; - std::size_t s = this->service.receive_from( - this->implementation, buffers, sender_endpoint, flags, ec); - boost::asio::detail::throw_error(ec); + std::size_t s = this->get_service().receive_from( + this->get_implementation(), buffers, sender_endpoint, flags, ec); + boost::asio::detail::throw_error(ec, "receive_from"); return s; } @@ -707,8 +784,8 @@ public: endpoint_type& sender_endpoint, socket_base::message_flags flags, boost::system::error_code& ec) { - return this->service.receive_from(this->implementation, buffers, - sender_endpoint, flags, ec); + return this->get_service().receive_from(this->get_implementation(), + buffers, sender_endpoint, flags, ec); } /// Start an asynchronous receive. @@ -749,10 +826,15 @@ public: */ template <typename MutableBufferSequence, typename ReadHandler> void async_receive_from(const MutableBufferSequence& buffers, - endpoint_type& sender_endpoint, ReadHandler handler) + endpoint_type& sender_endpoint, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { - this->service.async_receive_from(this->implementation, buffers, - sender_endpoint, 0, handler); + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a ReadHandler. + BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; + + this->get_service().async_receive_from(this->get_implementation(), buffers, + sender_endpoint, 0, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); } /// Start an asynchronous receive. @@ -787,10 +869,14 @@ public: template <typename MutableBufferSequence, typename ReadHandler> void async_receive_from(const MutableBufferSequence& buffers, endpoint_type& sender_endpoint, socket_base::message_flags flags, - ReadHandler handler) + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { - this->service.async_receive_from(this->implementation, buffers, - sender_endpoint, flags, handler); + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a ReadHandler. + BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; + + this->get_service().async_receive_from(this->get_implementation(), buffers, + sender_endpoint, flags, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); } }; diff --git a/3rdParty/Boost/src/boost/asio/basic_deadline_timer.hpp b/3rdParty/Boost/src/boost/asio/basic_deadline_timer.hpp index 452999d..6baeb7a 100644 --- a/3rdParty/Boost/src/boost/asio/basic_deadline_timer.hpp +++ b/3rdParty/Boost/src/boost/asio/basic_deadline_timer.hpp @@ -2,7 +2,7 @@ // basic_deadline_timer.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -19,6 +19,7 @@ #include <cstddef> #include <boost/asio/basic_io_object.hpp> #include <boost/asio/deadline_timer_service.hpp> +#include <boost/asio/detail/handler_type_requirements.hpp> #include <boost/asio/detail/throw_error.hpp> #include <boost/asio/error.hpp> @@ -161,7 +162,7 @@ public: { boost::system::error_code ec; this->service.expires_at(this->implementation, expiry_time, ec); - boost::asio::detail::throw_error(ec); + boost::asio::detail::throw_error(ec, "expires_at"); } /// Constructor to set a particular expiry time relative to now. @@ -180,7 +181,7 @@ public: { boost::system::error_code ec; this->service.expires_from_now(this->implementation, expiry_time, ec); - boost::asio::detail::throw_error(ec); + boost::asio::detail::throw_error(ec, "expires_from_now"); } /// Cancel any asynchronous operations that are waiting on the timer. @@ -209,7 +210,7 @@ public: { boost::system::error_code ec; std::size_t s = this->service.cancel(this->implementation, ec); - boost::asio::detail::throw_error(ec); + boost::asio::detail::throw_error(ec, "cancel"); return s; } @@ -240,6 +241,67 @@ public: return this->service.cancel(this->implementation, ec); } + /// Cancels one asynchronous operation that is waiting on the timer. + /** + * This function forces the completion of one pending asynchronous wait + * operation against the timer. Handlers are cancelled in FIFO order. The + * handler for the cancelled operation will be invoked with the + * boost::asio::error::operation_aborted error code. + * + * Cancelling the timer does not change the expiry time. + * + * @return The number of asynchronous operations that were cancelled. That is, + * either 0 or 1. + * + * @throws boost::system::system_error Thrown on failure. + * + * @note If the timer has already expired when cancel_one() is called, then + * the handlers for asynchronous wait operations will: + * + * @li have already been invoked; or + * + * @li have been queued for invocation in the near future. + * + * These handlers can no longer be cancelled, and therefore are passed an + * error code that indicates the successful completion of the wait operation. + */ + std::size_t cancel_one() + { + boost::system::error_code ec; + std::size_t s = this->service.cancel_one(this->implementation, ec); + boost::asio::detail::throw_error(ec, "cancel_one"); + return s; + } + + /// Cancels one asynchronous operation that is waiting on the timer. + /** + * This function forces the completion of one pending asynchronous wait + * operation against the timer. Handlers are cancelled in FIFO order. The + * handler for the cancelled operation will be invoked with the + * boost::asio::error::operation_aborted error code. + * + * Cancelling the timer does not change the expiry time. + * + * @param ec Set to indicate what error occurred, if any. + * + * @return The number of asynchronous operations that were cancelled. That is, + * either 0 or 1. + * + * @note If the timer has already expired when cancel_one() is called, then + * the handlers for asynchronous wait operations will: + * + * @li have already been invoked; or + * + * @li have been queued for invocation in the near future. + * + * These handlers can no longer be cancelled, and therefore are passed an + * error code that indicates the successful completion of the wait operation. + */ + std::size_t cancel_one(boost::system::error_code& ec) + { + return this->service.cancel_one(this->implementation, ec); + } + /// Get the timer's expiry time as an absolute time. /** * This function may be used to obtain the timer's current expiry time. @@ -277,7 +339,7 @@ public: boost::system::error_code ec; std::size_t s = this->service.expires_at( this->implementation, expiry_time, ec); - boost::asio::detail::throw_error(ec); + boost::asio::detail::throw_error(ec, "expires_at"); return s; } @@ -346,7 +408,7 @@ public: boost::system::error_code ec; std::size_t s = this->service.expires_from_now( this->implementation, expiry_time, ec); - boost::asio::detail::throw_error(ec); + boost::asio::detail::throw_error(ec, "expires_from_now"); return s; } @@ -390,7 +452,7 @@ public: { boost::system::error_code ec; this->service.wait(this->implementation, ec); - boost::asio::detail::throw_error(ec); + boost::asio::detail::throw_error(ec, "wait"); } /// Perform a blocking wait on the timer. @@ -430,9 +492,14 @@ public: * boost::asio::io_service::post(). */ template <typename WaitHandler> - void async_wait(WaitHandler handler) + void async_wait(BOOST_ASIO_MOVE_ARG(WaitHandler) handler) { - this->service.async_wait(this->implementation, handler); + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a WaitHandler. + BOOST_ASIO_WAIT_HANDLER_CHECK(WaitHandler, handler) type_check; + + this->service.async_wait(this->implementation, + BOOST_ASIO_MOVE_CAST(WaitHandler)(handler)); } }; diff --git a/3rdParty/Boost/src/boost/asio/basic_io_object.hpp b/3rdParty/Boost/src/boost/asio/basic_io_object.hpp index 8e137e7..0464335 100644 --- a/3rdParty/Boost/src/boost/asio/basic_io_object.hpp +++ b/3rdParty/Boost/src/boost/asio/basic_io_object.hpp @@ -2,7 +2,7 @@ // basic_io_object.hpp // ~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -16,7 +16,6 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> -#include <boost/asio/detail/noncopyable.hpp> #include <boost/asio/io_service.hpp> #include <boost/asio/detail/push_options.hpp> @@ -24,10 +23,42 @@ namespace boost { namespace asio { +#if defined(BOOST_ASIO_HAS_MOVE) +namespace detail +{ + // Type trait used to determine whether a service supports move. + template <typename IoObjectService> + class service_has_move + { + private: + typedef IoObjectService service_type; + typedef typename service_type::implementation_type implementation_type; + + template <typename T, typename U> + static auto eval(T* t, U* u) -> decltype(t->move_construct(*u, *u), char()); + static char (&eval(...))[2]; + + public: + static const bool value = + sizeof(service_has_move::eval( + static_cast<service_type*>(0), + static_cast<implementation_type*>(0))) == 1; + }; +} +#endif // defined(BOOST_ASIO_HAS_MOVE) + /// Base class for all I/O objects. +/** + * @note All I/O objects are non-copyable. However, when using C++0x, certain + * I/O objects do support move construction and move assignment. + */ +#if !defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) template <typename IoObjectService> +#else +template <typename IoObjectService, + bool Movable = detail::service_has_move<IoObjectService>::value> +#endif class basic_io_object - : private noncopyable { public: /// The type of the service that will be used to provide I/O operations. @@ -36,20 +67,6 @@ public: /// The underlying implementation type of I/O object. typedef typename service_type::implementation_type implementation_type; - /// (Deprecated: use get_io_service().) Get the io_service associated with - /// the object. - /** - * This function may be used to obtain the io_service object that the I/O - * object uses to dispatch handlers for asynchronous operations. - * - * @return A reference to the io_service object that the I/O object will use - * to dispatch handlers. Ownership is not transferred to the caller. - */ - boost::asio::io_service& io_service() - { - return service.get_io_service(); - } - /// Get the io_service associated with the object. /** * This function may be used to obtain the io_service object that the I/O @@ -67,7 +84,7 @@ protected: /// Construct a basic_io_object. /** * Performs: - * @code service.construct(implementation); @endcode + * @code get_service().construct(get_implementation()); @endcode */ explicit basic_io_object(boost::asio::io_service& io_service) : service(boost::asio::use_service<IoObjectService>(io_service)) @@ -75,22 +92,147 @@ protected: service.construct(implementation); } +#if defined(GENERATING_DOCUMENTATION) + /// Move-construct a basic_io_object. + /** + * Performs: + * @code get_service().move_construct( + * get_implementation(), other.get_implementation()); @endcode + * + * @note Available only for services that support movability, + */ + basic_io_object(basic_io_object&& other); + + /// Move-assign a basic_io_object. + /** + * Performs: + * @code get_service().move_assign(get_implementation(), + * other.get_service(), other.get_implementation()); @endcode + * + * @note Available only for services that support movability, + */ + basic_io_object& operator=(basic_io_object&& other); +#endif // defined(GENERATING_DOCUMENTATION) + /// Protected destructor to prevent deletion through this type. /** * Performs: - * @code service.destroy(implementation); @endcode + * @code get_service().destroy(get_implementation()); @endcode */ ~basic_io_object() { service.destroy(implementation); } - /// The service associated with the I/O object. + /// Get the service associated with the I/O object. + service_type& get_service() + { + return service; + } + + /// Get the service associated with the I/O object. + const service_type& get_service() const + { + return service; + } + + /// (Deprecated: Use get_service().) The service associated with the I/O + /// object. + /** + * @note Available only for services that do not support movability. + */ service_type& service; - /// The underlying implementation of the I/O object. + /// Get the underlying implementation of the I/O object. + implementation_type& get_implementation() + { + return implementation; + } + + /// Get the underlying implementation of the I/O object. + const implementation_type& get_implementation() const + { + return implementation; + } + + /// (Deprecated: Use get_implementation().) The underlying implementation of + /// the I/O object. implementation_type implementation; + +private: + basic_io_object(const basic_io_object&); + basic_io_object& operator=(const basic_io_object&); +}; + +#if defined(BOOST_ASIO_HAS_MOVE) +// Specialisation for movable objects. +template <typename IoObjectService> +class basic_io_object<IoObjectService, true> +{ +public: + typedef IoObjectService service_type; + typedef typename service_type::implementation_type implementation_type; + + boost::asio::io_service& get_io_service() + { + return service_->get_io_service(); + } + +protected: + explicit basic_io_object(boost::asio::io_service& io_service) + : service_(&boost::asio::use_service<IoObjectService>(io_service)) + { + service_->construct(implementation); + } + + basic_io_object(basic_io_object&& other) + : service_(&other.get_service()) + { + service_->move_construct(implementation, other.implementation); + } + + ~basic_io_object() + { + service_->destroy(implementation); + } + + basic_io_object& operator=(basic_io_object&& other) + { + service_->move_assign(implementation, + *other.service_, other.implementation); + service_ = other.service_; + return *this; + } + + service_type& get_service() + { + return *service_; + } + + const service_type& get_service() const + { + return *service_; + } + + implementation_type& get_implementation() + { + return implementation; + } + + const implementation_type& get_implementation() const + { + return implementation; + } + + implementation_type implementation; + +private: + basic_io_object(const basic_io_object&); + void operator=(const basic_io_object&); + + IoObjectService* service_; }; +#endif // defined(BOOST_ASIO_HAS_MOVE) } // namespace asio } // namespace boost diff --git a/3rdParty/Boost/src/boost/asio/basic_raw_socket.hpp b/3rdParty/Boost/src/boost/asio/basic_raw_socket.hpp index 0e58e7f..90f66c0 100644 --- a/3rdParty/Boost/src/boost/asio/basic_raw_socket.hpp +++ b/3rdParty/Boost/src/boost/asio/basic_raw_socket.hpp @@ -2,7 +2,7 @@ // basic_raw_socket.hpp // ~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -18,6 +18,7 @@ #include <boost/asio/detail/config.hpp> #include <cstddef> #include <boost/asio/basic_socket.hpp> +#include <boost/asio/detail/handler_type_requirements.hpp> #include <boost/asio/detail/throw_error.hpp> #include <boost/asio/error.hpp> #include <boost/asio/raw_socket_service.hpp> @@ -42,8 +43,12 @@ class basic_raw_socket : public basic_socket<Protocol, RawSocketService> { public: + /// (Deprecated: Use native_handle_type.) The native representation of a + /// socket. + typedef typename RawSocketService::native_handle_type native_type; + /// The native representation of a socket. - typedef typename RawSocketService::native_type native_type; + typedef typename RawSocketService::native_handle_type native_handle_type; /// The protocol type. typedef Protocol protocol_type; @@ -121,12 +126,47 @@ public: * @throws boost::system::system_error Thrown on failure. */ basic_raw_socket(boost::asio::io_service& io_service, - const protocol_type& protocol, const native_type& native_socket) + const protocol_type& protocol, const native_handle_type& native_socket) : basic_socket<Protocol, RawSocketService>( io_service, protocol, native_socket) { } +#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Move-construct a basic_raw_socket from another. + /** + * This constructor moves a raw socket from one object to another. + * + * @param other The other basic_raw_socket object from which the move + * will occur. + * + * @note Following the move, the moved-from object is in the same state as if + * constructed using the @c basic_raw_socket(io_service&) constructor. + */ + basic_raw_socket(basic_raw_socket&& other) + : basic_socket<Protocol, RawSocketService>( + BOOST_ASIO_MOVE_CAST(basic_raw_socket)(other)) + { + } + + /// Move-assign a basic_raw_socket from another. + /** + * This assignment operator moves a raw socket from one object to another. + * + * @param other The other basic_raw_socket object from which the move + * will occur. + * + * @note Following the move, the moved-from object is in the same state as if + * constructed using the @c basic_raw_socket(io_service&) constructor. + */ + basic_raw_socket& operator=(basic_raw_socket&& other) + { + basic_socket<Protocol, RawSocketService>::operator=( + BOOST_ASIO_MOVE_CAST(basic_raw_socket)(other)); + return *this; + } +#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Send some data on a connected socket. /** * This function is used to send data on the raw socket. The function call @@ -152,8 +192,9 @@ public: std::size_t send(const ConstBufferSequence& buffers) { boost::system::error_code ec; - std::size_t s = this->service.send(this->implementation, buffers, 0, ec); - boost::asio::detail::throw_error(ec); + std::size_t s = this->get_service().send( + this->get_implementation(), buffers, 0, ec); + boost::asio::detail::throw_error(ec, "send"); return s; } @@ -178,9 +219,9 @@ public: socket_base::message_flags flags) { boost::system::error_code ec; - std::size_t s = this->service.send( - this->implementation, buffers, flags, ec); - boost::asio::detail::throw_error(ec); + std::size_t s = this->get_service().send( + this->get_implementation(), buffers, flags, ec); + boost::asio::detail::throw_error(ec, "send"); return s; } @@ -204,7 +245,8 @@ public: std::size_t send(const ConstBufferSequence& buffers, socket_base::message_flags flags, boost::system::error_code& ec) { - return this->service.send(this->implementation, buffers, flags, ec); + return this->get_service().send( + this->get_implementation(), buffers, flags, ec); } /// Start an asynchronous send on a connected socket. @@ -243,9 +285,15 @@ public: * std::vector. */ template <typename ConstBufferSequence, typename WriteHandler> - void async_send(const ConstBufferSequence& buffers, WriteHandler handler) + void async_send(const ConstBufferSequence& buffers, + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { - this->service.async_send(this->implementation, buffers, 0, handler); + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a WriteHandler. + BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; + + this->get_service().async_send(this->get_implementation(), + buffers, 0, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); } /// Start an asynchronous send on a connected socket. @@ -278,9 +326,15 @@ public: */ template <typename ConstBufferSequence, typename WriteHandler> void async_send(const ConstBufferSequence& buffers, - socket_base::message_flags flags, WriteHandler handler) + socket_base::message_flags flags, + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { - this->service.async_send(this->implementation, buffers, flags, handler); + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a WriteHandler. + BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; + + this->get_service().async_send(this->get_implementation(), + buffers, flags, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); } /// Send raw data to the specified endpoint. @@ -313,9 +367,9 @@ public: const endpoint_type& destination) { boost::system::error_code ec; - std::size_t s = this->service.send_to( - this->implementation, buffers, destination, 0, ec); - boost::asio::detail::throw_error(ec); + std::size_t s = this->get_service().send_to( + this->get_implementation(), buffers, destination, 0, ec); + boost::asio::detail::throw_error(ec, "send_to"); return s; } @@ -340,9 +394,9 @@ public: const endpoint_type& destination, socket_base::message_flags flags) { boost::system::error_code ec; - std::size_t s = this->service.send_to( - this->implementation, buffers, destination, flags, ec); - boost::asio::detail::throw_error(ec); + std::size_t s = this->get_service().send_to( + this->get_implementation(), buffers, destination, flags, ec); + boost::asio::detail::throw_error(ec, "send_to"); return s; } @@ -367,7 +421,7 @@ public: const endpoint_type& destination, socket_base::message_flags flags, boost::system::error_code& ec) { - return this->service.send_to(this->implementation, + return this->get_service().send_to(this->get_implementation(), buffers, destination, flags, ec); } @@ -410,10 +464,15 @@ public: */ template <typename ConstBufferSequence, typename WriteHandler> void async_send_to(const ConstBufferSequence& buffers, - const endpoint_type& destination, WriteHandler handler) + const endpoint_type& destination, + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { - this->service.async_send_to(this->implementation, buffers, destination, 0, - handler); + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a WriteHandler. + BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; + + this->get_service().async_send_to(this->get_implementation(), buffers, + destination, 0, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); } /// Start an asynchronous send. @@ -446,10 +505,14 @@ public: template <typename ConstBufferSequence, typename WriteHandler> void async_send_to(const ConstBufferSequence& buffers, const endpoint_type& destination, socket_base::message_flags flags, - WriteHandler handler) + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { - this->service.async_send_to(this->implementation, buffers, destination, - flags, handler); + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a WriteHandler. + BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; + + this->get_service().async_send_to(this->get_implementation(), buffers, + destination, flags, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); } /// Receive some data on a connected socket. @@ -480,9 +543,9 @@ public: std::size_t receive(const MutableBufferSequence& buffers) { boost::system::error_code ec; - std::size_t s = this->service.receive( - this->implementation, buffers, 0, ec); - boost::asio::detail::throw_error(ec); + std::size_t s = this->get_service().receive( + this->get_implementation(), buffers, 0, ec); + boost::asio::detail::throw_error(ec, "receive"); return s; } @@ -509,9 +572,9 @@ public: socket_base::message_flags flags) { boost::system::error_code ec; - std::size_t s = this->service.receive( - this->implementation, buffers, flags, ec); - boost::asio::detail::throw_error(ec); + std::size_t s = this->get_service().receive( + this->get_implementation(), buffers, flags, ec); + boost::asio::detail::throw_error(ec, "receive"); return s; } @@ -537,7 +600,8 @@ public: std::size_t receive(const MutableBufferSequence& buffers, socket_base::message_flags flags, boost::system::error_code& ec) { - return this->service.receive(this->implementation, buffers, flags, ec); + return this->get_service().receive( + this->get_implementation(), buffers, flags, ec); } /// Start an asynchronous receive on a connected socket. @@ -577,9 +641,15 @@ public: * std::vector. */ template <typename MutableBufferSequence, typename ReadHandler> - void async_receive(const MutableBufferSequence& buffers, ReadHandler handler) + void async_receive(const MutableBufferSequence& buffers, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { - this->service.async_receive(this->implementation, buffers, 0, handler); + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a ReadHandler. + BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; + + this->get_service().async_receive(this->get_implementation(), + buffers, 0, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); } /// Start an asynchronous receive on a connected socket. @@ -612,9 +682,15 @@ public: */ template <typename MutableBufferSequence, typename ReadHandler> void async_receive(const MutableBufferSequence& buffers, - socket_base::message_flags flags, ReadHandler handler) + socket_base::message_flags flags, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { - this->service.async_receive(this->implementation, buffers, flags, handler); + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a ReadHandler. + BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; + + this->get_service().async_receive(this->get_implementation(), + buffers, flags, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); } /// Receive raw data with the endpoint of the sender. @@ -648,9 +724,9 @@ public: endpoint_type& sender_endpoint) { boost::system::error_code ec; - std::size_t s = this->service.receive_from( - this->implementation, buffers, sender_endpoint, 0, ec); - boost::asio::detail::throw_error(ec); + std::size_t s = this->get_service().receive_from( + this->get_implementation(), buffers, sender_endpoint, 0, ec); + boost::asio::detail::throw_error(ec, "receive_from"); return s; } @@ -675,9 +751,9 @@ public: endpoint_type& sender_endpoint, socket_base::message_flags flags) { boost::system::error_code ec; - std::size_t s = this->service.receive_from( - this->implementation, buffers, sender_endpoint, flags, ec); - boost::asio::detail::throw_error(ec); + std::size_t s = this->get_service().receive_from( + this->get_implementation(), buffers, sender_endpoint, flags, ec); + boost::asio::detail::throw_error(ec, "receive_from"); return s; } @@ -702,8 +778,8 @@ public: endpoint_type& sender_endpoint, socket_base::message_flags flags, boost::system::error_code& ec) { - return this->service.receive_from(this->implementation, buffers, - sender_endpoint, flags, ec); + return this->get_service().receive_from(this->get_implementation(), + buffers, sender_endpoint, flags, ec); } /// Start an asynchronous receive. @@ -744,10 +820,15 @@ public: */ template <typename MutableBufferSequence, typename ReadHandler> void async_receive_from(const MutableBufferSequence& buffers, - endpoint_type& sender_endpoint, ReadHandler handler) + endpoint_type& sender_endpoint, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { - this->service.async_receive_from(this->implementation, buffers, - sender_endpoint, 0, handler); + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a ReadHandler. + BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; + + this->get_service().async_receive_from(this->get_implementation(), buffers, + sender_endpoint, 0, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); } /// Start an asynchronous receive. @@ -782,10 +863,14 @@ public: template <typename MutableBufferSequence, typename ReadHandler> void async_receive_from(const MutableBufferSequence& buffers, endpoint_type& sender_endpoint, socket_base::message_flags flags, - ReadHandler handler) + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { - this->service.async_receive_from(this->implementation, buffers, - sender_endpoint, flags, handler); + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a ReadHandler. + BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; + + this->get_service().async_receive_from(this->get_implementation(), buffers, + sender_endpoint, flags, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); } }; diff --git a/3rdParty/Boost/src/boost/asio/basic_seq_packet_socket.hpp b/3rdParty/Boost/src/boost/asio/basic_seq_packet_socket.hpp new file mode 100644 index 0000000..a638c71 --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/basic_seq_packet_socket.hpp @@ -0,0 +1,514 @@ +// +// basic_seq_packet_socket.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) +// + +#ifndef BOOST_ASIO_BASIC_SEQ_PACKET_SOCKET_HPP +#define BOOST_ASIO_BASIC_SEQ_PACKET_SOCKET_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> +#include <cstddef> +#include <boost/asio/basic_socket.hpp> +#include <boost/asio/detail/handler_type_requirements.hpp> +#include <boost/asio/detail/throw_error.hpp> +#include <boost/asio/error.hpp> +#include <boost/asio/seq_packet_socket_service.hpp> + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { + +/// Provides sequenced packet socket functionality. +/** + * The basic_seq_packet_socket class template provides asynchronous and blocking + * sequenced packet socket functionality. + * + * @par Thread Safety + * @e Distinct @e objects: Safe.@n + * @e Shared @e objects: Unsafe. + */ +template <typename Protocol, + typename SeqPacketSocketService = seq_packet_socket_service<Protocol> > +class basic_seq_packet_socket + : public basic_socket<Protocol, SeqPacketSocketService> +{ +public: + /// (Deprecated: Use native_handle_type.) The native representation of a + /// socket. + typedef typename SeqPacketSocketService::native_handle_type native_type; + + /// The native representation of a socket. + typedef typename SeqPacketSocketService::native_handle_type + native_handle_type; + + /// The protocol type. + typedef Protocol protocol_type; + + /// The endpoint type. + typedef typename Protocol::endpoint endpoint_type; + + /// Construct a basic_seq_packet_socket without opening it. + /** + * This constructor creates a sequenced packet socket without opening it. The + * socket needs to be opened and then connected or accepted before data can + * be sent or received on it. + * + * @param io_service The io_service object that the sequenced packet socket + * will use to dispatch handlers for any asynchronous operations performed on + * the socket. + */ + explicit basic_seq_packet_socket(boost::asio::io_service& io_service) + : basic_socket<Protocol, SeqPacketSocketService>(io_service) + { + } + + /// Construct and open a basic_seq_packet_socket. + /** + * This constructor creates and opens a sequenced_packet socket. The socket + * needs to be connected or accepted before data can be sent or received on + * it. + * + * @param io_service The io_service object that the sequenced packet socket + * will use to dispatch handlers for any asynchronous operations performed on + * the socket. + * + * @param protocol An object specifying protocol parameters to be used. + * + * @throws boost::system::system_error Thrown on failure. + */ + basic_seq_packet_socket(boost::asio::io_service& io_service, + const protocol_type& protocol) + : basic_socket<Protocol, SeqPacketSocketService>(io_service, protocol) + { + } + + /// Construct a basic_seq_packet_socket, opening it and binding it to the + /// given local endpoint. + /** + * This constructor creates a sequenced packet socket and automatically opens + * it bound to the specified endpoint on the local machine. The protocol used + * is the protocol associated with the given endpoint. + * + * @param io_service The io_service object that the sequenced packet socket + * will use to dispatch handlers for any asynchronous operations performed on + * the socket. + * + * @param endpoint An endpoint on the local machine to which the sequenced + * packet socket will be bound. + * + * @throws boost::system::system_error Thrown on failure. + */ + basic_seq_packet_socket(boost::asio::io_service& io_service, + const endpoint_type& endpoint) + : basic_socket<Protocol, SeqPacketSocketService>(io_service, endpoint) + { + } + + /// Construct a basic_seq_packet_socket on an existing native socket. + /** + * This constructor creates a sequenced packet socket object to hold an + * existing native socket. + * + * @param io_service The io_service object that the sequenced packet socket + * will use to dispatch handlers for any asynchronous operations performed on + * the socket. + * + * @param protocol An object specifying protocol parameters to be used. + * + * @param native_socket The new underlying socket implementation. + * + * @throws boost::system::system_error Thrown on failure. + */ + basic_seq_packet_socket(boost::asio::io_service& io_service, + const protocol_type& protocol, const native_handle_type& native_socket) + : basic_socket<Protocol, SeqPacketSocketService>( + io_service, protocol, native_socket) + { + } + +#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Move-construct a basic_seq_packet_socket from another. + /** + * This constructor moves a sequenced packet socket from one object to + * another. + * + * @param other The other basic_seq_packet_socket object from which the move + * will occur. + * + * @note Following the move, the moved-from object is in the same state as if + * constructed using the @c basic_seq_packet_socket(io_service&) constructor. + */ + basic_seq_packet_socket(basic_seq_packet_socket&& other) + : basic_socket<Protocol, SeqPacketSocketService>( + BOOST_ASIO_MOVE_CAST(basic_seq_packet_socket)(other)) + { + } + + /// Move-assign a basic_seq_packet_socket from another. + /** + * This assignment operator moves a sequenced packet socket from one object to + * another. + * + * @param other The other basic_seq_packet_socket object from which the move + * will occur. + * + * @note Following the move, the moved-from object is in the same state as if + * constructed using the @c basic_seq_packet_socket(io_service&) constructor. + */ + basic_seq_packet_socket& operator=(basic_seq_packet_socket&& other) + { + basic_socket<Protocol, SeqPacketSocketService>::operator=( + BOOST_ASIO_MOVE_CAST(basic_seq_packet_socket)(other)); + return *this; + } +#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + + /// Send some data on the socket. + /** + * This function is used to send data on the sequenced packet socket. The + * function call will block until the data has been sent successfully, or an + * until error occurs. + * + * @param buffers One or more data buffers to be sent on the socket. + * + * @param flags Flags specifying how the send call is to be made. + * + * @returns The number of bytes sent. + * + * @throws boost::system::system_error Thrown on failure. + * + * @par Example + * To send a single data buffer use the @ref buffer function as follows: + * @code + * socket.send(boost::asio::buffer(data, size), 0); + * @endcode + * See the @ref buffer documentation for information on sending multiple + * buffers in one go, and how to use it with arrays, boost::array or + * std::vector. + */ + template <typename ConstBufferSequence> + std::size_t send(const ConstBufferSequence& buffers, + socket_base::message_flags flags) + { + boost::system::error_code ec; + std::size_t s = this->get_service().send( + this->get_implementation(), buffers, flags, ec); + boost::asio::detail::throw_error(ec, "send"); + return s; + } + + /// Send some data on the socket. + /** + * This function is used to send data on the sequenced packet socket. The + * function call will block the data has been sent successfully, or an until + * error occurs. + * + * @param buffers One or more data buffers to be sent on the socket. + * + * @param flags Flags specifying how the send call is to be made. + * + * @param ec Set to indicate what error occurred, if any. + * + * @returns The number of bytes sent. Returns 0 if an error occurred. + * + * @note The send operation may not transmit all of the data to the peer. + * Consider using the @ref write function if you need to ensure that all data + * is written before the blocking operation completes. + */ + template <typename ConstBufferSequence> + std::size_t send(const ConstBufferSequence& buffers, + socket_base::message_flags flags, boost::system::error_code& ec) + { + return this->get_service().send( + this->get_implementation(), buffers, flags, ec); + } + + /// Start an asynchronous send. + /** + * This function is used to asynchronously send data on the sequenced packet + * socket. The function call always returns immediately. + * + * @param buffers One or more data buffers to be sent on the socket. Although + * the buffers object may be copied as necessary, ownership of the underlying + * memory blocks is retained by the caller, which must guarantee that they + * remain valid until the handler is called. + * + * @param flags Flags specifying how the send call is to be made. + * + * @param handler The handler to be called when the send operation completes. + * Copies will be made of the handler as required. The function signature of + * the handler must be: + * @code void handler( + * const boost::system::error_code& error, // Result of operation. + * std::size_t bytes_transferred // Number of bytes sent. + * ); @endcode + * Regardless of whether the asynchronous operation completes immediately or + * not, the handler will not be invoked from within this function. Invocation + * of the handler will be performed in a manner equivalent to using + * boost::asio::io_service::post(). + * + * @par Example + * To send a single data buffer use the @ref buffer function as follows: + * @code + * socket.async_send(boost::asio::buffer(data, size), 0, handler); + * @endcode + * See the @ref buffer documentation for information on sending multiple + * buffers in one go, and how to use it with arrays, boost::array or + * std::vector. + */ + template <typename ConstBufferSequence, typename WriteHandler> + void async_send(const ConstBufferSequence& buffers, + socket_base::message_flags flags, + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) + { + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a WriteHandler. + BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; + + this->get_service().async_send(this->get_implementation(), + buffers, flags, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); + } + + /// Receive some data on the socket. + /** + * This function is used to receive data on the sequenced packet socket. The + * function call will block until data has been received successfully, or + * until an error occurs. + * + * @param buffers One or more buffers into which the data will be received. + * + * @param out_flags After the receive call completes, contains flags + * associated with the received data. For example, if the + * socket_base::message_end_of_record bit is set then the received data marks + * the end of a record. + * + * @returns The number of bytes received. + * + * @throws boost::system::system_error Thrown on failure. An error code of + * boost::asio::error::eof indicates that the connection was closed by the + * peer. + * + * @par Example + * To receive into a single data buffer use the @ref buffer function as + * follows: + * @code + * socket.receive(boost::asio::buffer(data, size), out_flags); + * @endcode + * See the @ref buffer documentation for information on receiving into + * multiple buffers in one go, and how to use it with arrays, boost::array or + * std::vector. + */ + template <typename MutableBufferSequence> + std::size_t receive(const MutableBufferSequence& buffers, + socket_base::message_flags& out_flags) + { + boost::system::error_code ec; + std::size_t s = this->get_service().receive( + this->get_implementation(), buffers, 0, out_flags, ec); + boost::asio::detail::throw_error(ec, "receive"); + return s; + } + + /// Receive some data on the socket. + /** + * This function is used to receive data on the sequenced packet socket. The + * function call will block until data has been received successfully, or + * until an error occurs. + * + * @param buffers One or more buffers into which the data will be received. + * + * @param in_flags Flags specifying how the receive call is to be made. + * + * @param out_flags After the receive call completes, contains flags + * associated with the received data. For example, if the + * socket_base::message_end_of_record bit is set then the received data marks + * the end of a record. + * + * @returns The number of bytes received. + * + * @throws boost::system::system_error Thrown on failure. An error code of + * boost::asio::error::eof indicates that the connection was closed by the + * peer. + * + * @note The receive operation may not receive all of the requested number of + * bytes. Consider using the @ref read function if you need to ensure that the + * requested amount of data is read before the blocking operation completes. + * + * @par Example + * To receive into a single data buffer use the @ref buffer function as + * follows: + * @code + * socket.receive(boost::asio::buffer(data, size), 0, out_flags); + * @endcode + * See the @ref buffer documentation for information on receiving into + * multiple buffers in one go, and how to use it with arrays, boost::array or + * std::vector. + */ + template <typename MutableBufferSequence> + std::size_t receive(const MutableBufferSequence& buffers, + socket_base::message_flags in_flags, + socket_base::message_flags& out_flags) + { + boost::system::error_code ec; + std::size_t s = this->get_service().receive( + this->get_implementation(), buffers, in_flags, out_flags, ec); + boost::asio::detail::throw_error(ec, "receive"); + return s; + } + + /// Receive some data on a connected socket. + /** + * This function is used to receive data on the sequenced packet socket. The + * function call will block until data has been received successfully, or + * until an error occurs. + * + * @param buffers One or more buffers into which the data will be received. + * + * @param in_flags Flags specifying how the receive call is to be made. + * + * @param out_flags After the receive call completes, contains flags + * associated with the received data. For example, if the + * socket_base::message_end_of_record bit is set then the received data marks + * the end of a record. + * + * @param ec Set to indicate what error occurred, if any. + * + * @returns The number of bytes received. Returns 0 if an error occurred. + * + * @note The receive operation may not receive all of the requested number of + * bytes. Consider using the @ref read function if you need to ensure that the + * requested amount of data is read before the blocking operation completes. + */ + template <typename MutableBufferSequence> + std::size_t receive(const MutableBufferSequence& buffers, + socket_base::message_flags in_flags, + socket_base::message_flags& out_flags, boost::system::error_code& ec) + { + return this->get_service().receive(this->get_implementation(), + buffers, in_flags, out_flags, ec); + } + + /// Start an asynchronous receive. + /** + * This function is used to asynchronously receive data from the sequenced + * packet socket. The function call always returns immediately. + * + * @param buffers One or more buffers into which the data will be received. + * Although the buffers object may be copied as necessary, ownership of the + * underlying memory blocks is retained by the caller, which must guarantee + * that they remain valid until the handler is called. + * + * @param out_flags Once the asynchronous operation completes, contains flags + * associated with the received data. For example, if the + * socket_base::message_end_of_record bit is set then the received data marks + * the end of a record. The caller must guarantee that the referenced + * variable remains valid until the handler is called. + * + * @param handler The handler to be called when the receive operation + * completes. Copies will be made of the handler as required. The function + * signature of the handler must be: + * @code void handler( + * const boost::system::error_code& error, // Result of operation. + * std::size_t bytes_transferred // Number of bytes received. + * ); @endcode + * Regardless of whether the asynchronous operation completes immediately or + * not, the handler will not be invoked from within this function. Invocation + * of the handler will be performed in a manner equivalent to using + * boost::asio::io_service::post(). + * + * @par Example + * To receive into a single data buffer use the @ref buffer function as + * follows: + * @code + * socket.async_receive(boost::asio::buffer(data, size), out_flags, handler); + * @endcode + * See the @ref buffer documentation for information on receiving into + * multiple buffers in one go, and how to use it with arrays, boost::array or + * std::vector. + */ + template <typename MutableBufferSequence, typename ReadHandler> + void async_receive(const MutableBufferSequence& buffers, + socket_base::message_flags& out_flags, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) + { + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a ReadHandler. + BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; + + this->get_service().async_receive(this->get_implementation(), buffers, + 0, out_flags, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); + } + + /// Start an asynchronous receive. + /** + * This function is used to asynchronously receive data from the sequenced + * data socket. The function call always returns immediately. + * + * @param buffers One or more buffers into which the data will be received. + * Although the buffers object may be copied as necessary, ownership of the + * underlying memory blocks is retained by the caller, which must guarantee + * that they remain valid until the handler is called. + * + * @param in_flags Flags specifying how the receive call is to be made. + * + * @param out_flags Once the asynchronous operation completes, contains flags + * associated with the received data. For example, if the + * socket_base::message_end_of_record bit is set then the received data marks + * the end of a record. The caller must guarantee that the referenced + * variable remains valid until the handler is called. + * + * @param handler The handler to be called when the receive operation + * completes. Copies will be made of the handler as required. The function + * signature of the handler must be: + * @code void handler( + * const boost::system::error_code& error, // Result of operation. + * std::size_t bytes_transferred // Number of bytes received. + * ); @endcode + * Regardless of whether the asynchronous operation completes immediately or + * not, the handler will not be invoked from within this function. Invocation + * of the handler will be performed in a manner equivalent to using + * boost::asio::io_service::post(). + * + * @par Example + * To receive into a single data buffer use the @ref buffer function as + * follows: + * @code + * socket.async_receive( + * boost::asio::buffer(data, size), + * 0, out_flags, handler); + * @endcode + * See the @ref buffer documentation for information on receiving into + * multiple buffers in one go, and how to use it with arrays, boost::array or + * std::vector. + */ + template <typename MutableBufferSequence, typename ReadHandler> + void async_receive(const MutableBufferSequence& buffers, + socket_base::message_flags in_flags, + socket_base::message_flags& out_flags, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) + { + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a ReadHandler. + BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; + + this->get_service().async_receive(this->get_implementation(), buffers, + in_flags, out_flags, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); + } +}; + +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#endif // BOOST_ASIO_BASIC_SEQ_PACKET_SOCKET_HPP diff --git a/3rdParty/Boost/src/boost/asio/basic_serial_port.hpp b/3rdParty/Boost/src/boost/asio/basic_serial_port.hpp index 744fd3b..31ee955 100644 --- a/3rdParty/Boost/src/boost/asio/basic_serial_port.hpp +++ b/3rdParty/Boost/src/boost/asio/basic_serial_port.hpp @@ -2,7 +2,7 @@ // basic_serial_port.hpp // ~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) // Copyright (c) 2008 Rep Invariant Systems, Inc. (info@repinvariant.com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -23,6 +23,7 @@ #include <string> #include <boost/asio/basic_io_object.hpp> +#include <boost/asio/detail/handler_type_requirements.hpp> #include <boost/asio/detail/throw_error.hpp> #include <boost/asio/error.hpp> #include <boost/asio/serial_port_base.hpp> @@ -48,8 +49,12 @@ class basic_serial_port public serial_port_base { public: + /// (Deprecated: Use native_handle_type.) The native representation of a + /// serial port. + typedef typename SerialPortService::native_handle_type native_type; + /// The native representation of a serial port. - typedef typename SerialPortService::native_type native_type; + typedef typename SerialPortService::native_handle_type native_handle_type; /// A basic_serial_port is always the lowest layer. typedef basic_serial_port<SerialPortService> lowest_layer_type; @@ -82,8 +87,8 @@ public: : basic_io_object<SerialPortService>(io_service) { boost::system::error_code ec; - this->service.open(this->implementation, device, ec); - boost::asio::detail::throw_error(ec); + this->get_service().open(this->get_implementation(), device, ec); + boost::asio::detail::throw_error(ec, "open"); } /// Construct and open a basic_serial_port. @@ -102,8 +107,8 @@ public: : basic_io_object<SerialPortService>(io_service) { boost::system::error_code ec; - this->service.open(this->implementation, device, ec); - boost::asio::detail::throw_error(ec); + this->get_service().open(this->get_implementation(), device, ec); + boost::asio::detail::throw_error(ec, "open"); } /// Construct a basic_serial_port on an existing native serial port. @@ -119,13 +124,49 @@ public: * @throws boost::system::system_error Thrown on failure. */ basic_serial_port(boost::asio::io_service& io_service, - const native_type& native_serial_port) + const native_handle_type& native_serial_port) : basic_io_object<SerialPortService>(io_service) { boost::system::error_code ec; - this->service.assign(this->implementation, native_serial_port, ec); - boost::asio::detail::throw_error(ec); + this->get_service().assign(this->get_implementation(), + native_serial_port, ec); + boost::asio::detail::throw_error(ec, "assign"); + } + +#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Move-construct a basic_serial_port from another. + /** + * This constructor moves a serial port from one object to another. + * + * @param other The other basic_serial_port object from which the move will + * occur. + * + * @note Following the move, the moved-from object is in the same state as if + * constructed using the @c basic_serial_port(io_service&) constructor. + */ + basic_serial_port(basic_serial_port&& other) + : basic_io_object<SerialPortService>( + BOOST_ASIO_MOVE_CAST(basic_serial_port)(other)) + { + } + + /// Move-assign a basic_serial_port from another. + /** + * This assignment operator moves a serial port from one object to another. + * + * @param other The other basic_serial_port object from which the move will + * occur. + * + * @note Following the move, the moved-from object is in the same state as if + * constructed using the @c basic_serial_port(io_service&) constructor. + */ + basic_serial_port& operator=(basic_serial_port&& other) + { + basic_io_object<SerialPortService>::operator=( + BOOST_ASIO_MOVE_CAST(basic_serial_port)(other)); + return *this; } +#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) /// Get a reference to the lowest layer. /** @@ -166,8 +207,8 @@ public: void open(const std::string& device) { boost::system::error_code ec; - this->service.open(this->implementation, device, ec); - boost::asio::detail::throw_error(ec); + this->get_service().open(this->get_implementation(), device, ec); + boost::asio::detail::throw_error(ec, "open"); } /// Open the serial port using the specified device name. @@ -182,7 +223,7 @@ public: boost::system::error_code open(const std::string& device, boost::system::error_code& ec) { - return this->service.open(this->implementation, device, ec); + return this->get_service().open(this->get_implementation(), device, ec); } /// Assign an existing native serial port to the serial port. @@ -193,11 +234,12 @@ public: * * @throws boost::system::system_error Thrown on failure. */ - void assign(const native_type& native_serial_port) + void assign(const native_handle_type& native_serial_port) { boost::system::error_code ec; - this->service.assign(this->implementation, native_serial_port, ec); - boost::asio::detail::throw_error(ec); + this->get_service().assign(this->get_implementation(), + native_serial_port, ec); + boost::asio::detail::throw_error(ec, "assign"); } /// Assign an existing native serial port to the serial port. @@ -208,16 +250,17 @@ public: * * @param ec Set to indicate what error occurred, if any. */ - boost::system::error_code assign(const native_type& native_serial_port, + boost::system::error_code assign(const native_handle_type& native_serial_port, boost::system::error_code& ec) { - return this->service.assign(this->implementation, native_serial_port, ec); + return this->get_service().assign(this->get_implementation(), + native_serial_port, ec); } /// Determine whether the serial port is open. bool is_open() const { - return this->service.is_open(this->implementation); + return this->get_service().is_open(this->get_implementation()); } /// Close the serial port. @@ -231,8 +274,8 @@ public: void close() { boost::system::error_code ec; - this->service.close(this->implementation, ec); - boost::asio::detail::throw_error(ec); + this->get_service().close(this->get_implementation(), ec); + boost::asio::detail::throw_error(ec, "close"); } /// Close the serial port. @@ -245,10 +288,11 @@ public: */ boost::system::error_code close(boost::system::error_code& ec) { - return this->service.close(this->implementation, ec); + return this->get_service().close(this->get_implementation(), ec); } - /// Get the native serial port representation. + /// (Deprecated: Use native_handle().) Get the native serial port + /// representation. /** * This function may be used to obtain the underlying representation of the * serial port. This is intended to allow access to native serial port @@ -256,7 +300,18 @@ public: */ native_type native() { - return this->service.native(this->implementation); + return this->get_service().native_handle(this->get_implementation()); + } + + /// Get the native serial port representation. + /** + * This function may be used to obtain the underlying representation of the + * serial port. This is intended to allow access to native serial port + * functionality that is not otherwise provided. + */ + native_handle_type native_handle() + { + return this->get_service().native_handle(this->get_implementation()); } /// Cancel all asynchronous operations associated with the serial port. @@ -270,8 +325,8 @@ public: void cancel() { boost::system::error_code ec; - this->service.cancel(this->implementation, ec); - boost::asio::detail::throw_error(ec); + this->get_service().cancel(this->get_implementation(), ec); + boost::asio::detail::throw_error(ec, "cancel"); } /// Cancel all asynchronous operations associated with the serial port. @@ -284,7 +339,7 @@ public: */ boost::system::error_code cancel(boost::system::error_code& ec) { - return this->service.cancel(this->implementation, ec); + return this->get_service().cancel(this->get_implementation(), ec); } /// Send a break sequence to the serial port. @@ -297,8 +352,8 @@ public: void send_break() { boost::system::error_code ec; - this->service.send_break(this->implementation, ec); - boost::asio::detail::throw_error(ec); + this->get_service().send_break(this->get_implementation(), ec); + boost::asio::detail::throw_error(ec, "send_break"); } /// Send a break sequence to the serial port. @@ -310,7 +365,7 @@ public: */ boost::system::error_code send_break(boost::system::error_code& ec) { - return this->service.send_break(this->implementation, ec); + return this->get_service().send_break(this->get_implementation(), ec); } /// Set an option on the serial port. @@ -332,8 +387,8 @@ public: void set_option(const SettableSerialPortOption& option) { boost::system::error_code ec; - this->service.set_option(this->implementation, option, ec); - boost::asio::detail::throw_error(ec); + this->get_service().set_option(this->get_implementation(), option, ec); + boost::asio::detail::throw_error(ec, "set_option"); } /// Set an option on the serial port. @@ -355,7 +410,8 @@ public: boost::system::error_code set_option(const SettableSerialPortOption& option, boost::system::error_code& ec) { - return this->service.set_option(this->implementation, option, ec); + return this->get_service().set_option( + this->get_implementation(), option, ec); } /// Get an option from the serial port. @@ -378,8 +434,8 @@ public: void get_option(GettableSerialPortOption& option) { boost::system::error_code ec; - this->service.get_option(this->implementation, option, ec); - boost::asio::detail::throw_error(ec); + this->get_service().get_option(this->get_implementation(), option, ec); + boost::asio::detail::throw_error(ec, "get_option"); } /// Get an option from the serial port. @@ -402,7 +458,8 @@ public: boost::system::error_code get_option(GettableSerialPortOption& option, boost::system::error_code& ec) { - return this->service.get_option(this->implementation, option, ec); + return this->get_service().get_option( + this->get_implementation(), option, ec); } /// Write some data to the serial port. @@ -436,8 +493,9 @@ public: std::size_t write_some(const ConstBufferSequence& buffers) { boost::system::error_code ec; - std::size_t s = this->service.write_some(this->implementation, buffers, ec); - boost::asio::detail::throw_error(ec); + std::size_t s = this->get_service().write_some( + this->get_implementation(), buffers, ec); + boost::asio::detail::throw_error(ec, "write_some"); return s; } @@ -461,7 +519,8 @@ public: std::size_t write_some(const ConstBufferSequence& buffers, boost::system::error_code& ec) { - return this->service.write_some(this->implementation, buffers, ec); + return this->get_service().write_some( + this->get_implementation(), buffers, ec); } /// Start an asynchronous write. @@ -501,9 +560,14 @@ public: */ template <typename ConstBufferSequence, typename WriteHandler> void async_write_some(const ConstBufferSequence& buffers, - WriteHandler handler) + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { - this->service.async_write_some(this->implementation, buffers, handler); + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a WriteHandler. + BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; + + this->get_service().async_write_some(this->get_implementation(), + buffers, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); } /// Read some data from the serial port. @@ -538,8 +602,9 @@ public: std::size_t read_some(const MutableBufferSequence& buffers) { boost::system::error_code ec; - std::size_t s = this->service.read_some(this->implementation, buffers, ec); - boost::asio::detail::throw_error(ec); + std::size_t s = this->get_service().read_some( + this->get_implementation(), buffers, ec); + boost::asio::detail::throw_error(ec, "read_some"); return s; } @@ -564,7 +629,8 @@ public: std::size_t read_some(const MutableBufferSequence& buffers, boost::system::error_code& ec) { - return this->service.read_some(this->implementation, buffers, ec); + return this->get_service().read_some( + this->get_implementation(), buffers, ec); } /// Start an asynchronous read. @@ -605,9 +671,14 @@ public: */ template <typename MutableBufferSequence, typename ReadHandler> void async_read_some(const MutableBufferSequence& buffers, - ReadHandler handler) + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { - this->service.async_read_some(this->implementation, buffers, handler); + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a ReadHandler. + BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; + + this->get_service().async_read_some(this->get_implementation(), + buffers, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); } }; diff --git a/3rdParty/Boost/src/boost/asio/basic_signal_set.hpp b/3rdParty/Boost/src/boost/asio/basic_signal_set.hpp new file mode 100644 index 0000000..ddbef87 --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/basic_signal_set.hpp @@ -0,0 +1,384 @@ +// +// basic_signal_set.hpp +// ~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) +// + +#ifndef BOOST_ASIO_BASIC_SIGNAL_SET_HPP +#define BOOST_ASIO_BASIC_SIGNAL_SET_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> + +#include <boost/asio/basic_io_object.hpp> +#include <boost/asio/detail/handler_type_requirements.hpp> +#include <boost/asio/detail/throw_error.hpp> +#include <boost/asio/error.hpp> +#include <boost/asio/signal_set_service.hpp> + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { + +/// Provides signal functionality. +/** + * The basic_signal_set class template provides the ability to perform an + * asynchronous wait for one or more signals to occur. + * + * Most applications will use the boost::asio::signal_set typedef. + * + * @par Thread Safety + * @e Distinct @e objects: Safe.@n + * @e Shared @e objects: Unsafe. + * + * @par Example + * Performing an asynchronous wait: + * @code + * void handler( + * const boost::system::error_code& error, + * int signal_number) + * { + * if (!error) + * { + * // A signal occurred. + * } + * } + * + * ... + * + * // Construct a signal set registered for process termination. + * boost::asio::signal_set signals(io_service, SIGINT, SIGTERM); + * + * // Start an asynchronous wait for one of the signals to occur. + * signals.async_wait(handler); + * @endcode + * + * @par Queueing of signal notifications + * + * If a signal is registered with a signal_set, and the signal occurs when + * there are no waiting handlers, then the signal notification is queued. The + * next async_wait operation on that signal_set will dequeue the notification. + * If multiple notifications are queued, subsequent async_wait operations + * dequeue them one at a time. Signal notifications are dequeued in order of + * ascending signal number. + * + * If a signal number is removed from a signal_set (using the @c remove or @c + * erase member functions) then any queued notifications for that signal are + * discarded. + * + * @par Multiple registration of signals + * + * The same signal number may be registered with different signal_set objects. + * When the signal occurs, one handler is called for each signal_set object. + * + * Note that multiple registration only works for signals that are registered + * using Asio. The application must not also register a signal handler using + * functions such as @c signal() or @c sigaction(). + * + * @par Signal masking on POSIX platforms + * + * POSIX allows signals to be blocked using functions such as @c sigprocmask() + * and @c pthread_sigmask(). For signals to be delivered, programs must ensure + * that any signals registered using signal_set objects are unblocked in at + * least one thread. + */ +template <typename SignalSetService = signal_set_service> +class basic_signal_set + : public basic_io_object<SignalSetService> +{ +public: + /// Construct a signal set without adding any signals. + /** + * This constructor creates a signal set without registering for any signals. + * + * @param io_service The io_service object that the signal set will use to + * dispatch handlers for any asynchronous operations performed on the set. + */ + explicit basic_signal_set(boost::asio::io_service& io_service) + : basic_io_object<SignalSetService>(io_service) + { + } + + /// Construct a signal set and add one signal. + /** + * This constructor creates a signal set and registers for one signal. + * + * @param io_service The io_service object that the signal set will use to + * dispatch handlers for any asynchronous operations performed on the set. + * + * @param signal_number_1 The signal number to be added. + * + * @note This constructor is equivalent to performing: + * @code boost::asio::signal_set signals(io_service); + * signals.add(signal_number_1); @endcode + */ + basic_signal_set(boost::asio::io_service& io_service, int signal_number_1) + : basic_io_object<SignalSetService>(io_service) + { + boost::system::error_code ec; + this->service.add(this->implementation, signal_number_1, ec); + boost::asio::detail::throw_error(ec, "add"); + } + + /// Construct a signal set and add two signals. + /** + * This constructor creates a signal set and registers for two signals. + * + * @param io_service The io_service object that the signal set will use to + * dispatch handlers for any asynchronous operations performed on the set. + * + * @param signal_number_1 The first signal number to be added. + * + * @param signal_number_2 The second signal number to be added. + * + * @note This constructor is equivalent to performing: + * @code boost::asio::signal_set signals(io_service); + * signals.add(signal_number_1); + * signals.add(signal_number_2); @endcode + */ + basic_signal_set(boost::asio::io_service& io_service, int signal_number_1, + int signal_number_2) + : basic_io_object<SignalSetService>(io_service) + { + boost::system::error_code ec; + this->service.add(this->implementation, signal_number_1, ec); + boost::asio::detail::throw_error(ec, "add"); + this->service.add(this->implementation, signal_number_2, ec); + boost::asio::detail::throw_error(ec, "add"); + } + + /// Construct a signal set and add three signals. + /** + * This constructor creates a signal set and registers for three signals. + * + * @param io_service The io_service object that the signal set will use to + * dispatch handlers for any asynchronous operations performed on the set. + * + * @param signal_number_1 The first signal number to be added. + * + * @param signal_number_2 The second signal number to be added. + * + * @param signal_number_3 The third signal number to be added. + * + * @note This constructor is equivalent to performing: + * @code boost::asio::signal_set signals(io_service); + * signals.add(signal_number_1); + * signals.add(signal_number_2); + * signals.add(signal_number_3); @endcode + */ + basic_signal_set(boost::asio::io_service& io_service, int signal_number_1, + int signal_number_2, int signal_number_3) + : basic_io_object<SignalSetService>(io_service) + { + boost::system::error_code ec; + this->service.add(this->implementation, signal_number_1, ec); + boost::asio::detail::throw_error(ec, "add"); + this->service.add(this->implementation, signal_number_2, ec); + boost::asio::detail::throw_error(ec, "add"); + this->service.add(this->implementation, signal_number_3, ec); + boost::asio::detail::throw_error(ec, "add"); + } + + /// Add a signal to a signal_set. + /** + * This function adds the specified signal to the set. It has no effect if the + * signal is already in the set. + * + * @param signal_number The signal to be added to the set. + * + * @throws boost::system::system_error Thrown on failure. + */ + void add(int signal_number) + { + boost::system::error_code ec; + this->service.add(this->implementation, signal_number, ec); + boost::asio::detail::throw_error(ec, "add"); + } + + /// Add a signal to a signal_set. + /** + * This function adds the specified signal to the set. It has no effect if the + * signal is already in the set. + * + * @param signal_number The signal to be added to the set. + * + * @param ec Set to indicate what error occurred, if any. + */ + boost::system::error_code add(int signal_number, + boost::system::error_code& ec) + { + return this->service.add(this->implementation, signal_number, ec); + } + + /// Remove a signal from a signal_set. + /** + * This function removes the specified signal from the set. It has no effect + * if the signal is not in the set. + * + * @param signal_number The signal to be removed from the set. + * + * @throws boost::system::system_error Thrown on failure. + * + * @note Removes any notifications that have been queued for the specified + * signal number. + */ + void remove(int signal_number) + { + boost::system::error_code ec; + this->service.remove(this->implementation, signal_number, ec); + boost::asio::detail::throw_error(ec, "remove"); + } + + /// Remove a signal from a signal_set. + /** + * This function removes the specified signal from the set. It has no effect + * if the signal is not in the set. + * + * @param signal_number The signal to be removed from the set. + * + * @param ec Set to indicate what error occurred, if any. + * + * @note Removes any notifications that have been queued for the specified + * signal number. + */ + boost::system::error_code remove(int signal_number, + boost::system::error_code& ec) + { + return this->service.remove(this->implementation, signal_number, ec); + } + + /// Remove all signals from a signal_set. + /** + * This function removes all signals from the set. It has no effect if the set + * is already empty. + * + * @throws boost::system::system_error Thrown on failure. + * + * @note Removes all queued notifications. + */ + void clear() + { + boost::system::error_code ec; + this->service.clear(this->implementation, ec); + boost::asio::detail::throw_error(ec, "clear"); + } + + /// Remove all signals from a signal_set. + /** + * This function removes all signals from the set. It has no effect if the set + * is already empty. + * + * @param ec Set to indicate what error occurred, if any. + * + * @note Removes all queued notifications. + */ + boost::system::error_code clear(boost::system::error_code& ec) + { + return this->service.clear(this->implementation, ec); + } + + /// Cancel all operations associated with the signal set. + /** + * This function forces the completion of any pending asynchronous wait + * operations against the signal set. The handler for each cancelled + * operation will be invoked with the boost::asio::error::operation_aborted + * error code. + * + * Cancellation does not alter the set of registered signals. + * + * @throws boost::system::system_error Thrown on failure. + * + * @note If a registered signal occurred before cancel() is called, then the + * handlers for asynchronous wait operations will: + * + * @li have already been invoked; or + * + * @li have been queued for invocation in the near future. + * + * These handlers can no longer be cancelled, and therefore are passed an + * error code that indicates the successful completion of the wait operation. + */ + void cancel() + { + boost::system::error_code ec; + this->service.cancel(this->implementation, ec); + boost::asio::detail::throw_error(ec, "cancel"); + } + + /// Cancel all operations associated with the signal set. + /** + * This function forces the completion of any pending asynchronous wait + * operations against the signal set. The handler for each cancelled + * operation will be invoked with the boost::asio::error::operation_aborted + * error code. + * + * Cancellation does not alter the set of registered signals. + * + * @param ec Set to indicate what error occurred, if any. + * + * @note If a registered signal occurred before cancel() is called, then the + * handlers for asynchronous wait operations will: + * + * @li have already been invoked; or + * + * @li have been queued for invocation in the near future. + * + * These handlers can no longer be cancelled, and therefore are passed an + * error code that indicates the successful completion of the wait operation. + */ + boost::system::error_code cancel(boost::system::error_code& ec) + { + return this->service.cancel(this->implementation, ec); + } + + /// Start an asynchronous operation to wait for a signal to be delivered. + /** + * This function may be used to initiate an asynchronous wait against the + * signal set. It always returns immediately. + * + * For each call to async_wait(), the supplied handler will be called exactly + * once. The handler will be called when: + * + * @li One of the registered signals in the signal set occurs; or + * + * @li The signal set was cancelled, in which case the handler is passed the + * error code boost::asio::error::operation_aborted. + * + * @param handler The handler to be called when the signal occurs. Copies + * will be made of the handler as required. The function signature of the + * handler must be: + * @code void handler( + * const boost::system::error_code& error, // Result of operation. + * int signal_number // Indicates which signal occurred. + * ); @endcode + * Regardless of whether the asynchronous operation completes immediately or + * not, the handler will not be invoked from within this function. Invocation + * of the handler will be performed in a manner equivalent to using + * boost::asio::io_service::post(). + */ + template <typename SignalHandler> + void async_wait(BOOST_ASIO_MOVE_ARG(SignalHandler) handler) + { + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a SignalHandler. + BOOST_ASIO_SIGNAL_HANDLER_CHECK(SignalHandler, handler) type_check; + + this->service.async_wait(this->implementation, + BOOST_ASIO_MOVE_CAST(SignalHandler)(handler)); + } +}; + +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#endif // BOOST_ASIO_BASIC_SIGNAL_SET_HPP diff --git a/3rdParty/Boost/src/boost/asio/basic_socket.hpp b/3rdParty/Boost/src/boost/asio/basic_socket.hpp index 11ce5c9..c9e2045 100644 --- a/3rdParty/Boost/src/boost/asio/basic_socket.hpp +++ b/3rdParty/Boost/src/boost/asio/basic_socket.hpp @@ -2,7 +2,7 @@ // basic_socket.hpp // ~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -17,6 +17,7 @@ #include <boost/asio/detail/config.hpp> #include <boost/asio/basic_io_object.hpp> +#include <boost/asio/detail/handler_type_requirements.hpp> #include <boost/asio/detail/throw_error.hpp> #include <boost/asio/error.hpp> #include <boost/asio/socket_base.hpp> @@ -41,8 +42,12 @@ class basic_socket public socket_base { public: + /// (Deprecated: Use native_handle_type.) The native representation of a + /// socket. + typedef typename SocketService::native_handle_type native_type; + /// The native representation of a socket. - typedef typename SocketService::native_type native_type; + typedef typename SocketService::native_handle_type native_handle_type; /// The protocol type. typedef Protocol protocol_type; @@ -81,8 +86,8 @@ public: : basic_io_object<SocketService>(io_service) { boost::system::error_code ec; - this->service.open(this->implementation, protocol, ec); - boost::asio::detail::throw_error(ec); + this->get_service().open(this->get_implementation(), protocol, ec); + boost::asio::detail::throw_error(ec, "open"); } /// Construct a basic_socket, opening it and binding it to the given local @@ -105,10 +110,11 @@ public: : basic_io_object<SocketService>(io_service) { boost::system::error_code ec; - this->service.open(this->implementation, endpoint.protocol(), ec); - boost::asio::detail::throw_error(ec); - this->service.bind(this->implementation, endpoint, ec); - boost::asio::detail::throw_error(ec); + const protocol_type protocol = endpoint.protocol(); + this->get_service().open(this->get_implementation(), protocol, ec); + boost::asio::detail::throw_error(ec, "open"); + this->get_service().bind(this->get_implementation(), endpoint, ec); + boost::asio::detail::throw_error(ec, "bind"); } /// Construct a basic_socket on an existing native socket. @@ -125,14 +131,50 @@ public: * @throws boost::system::system_error Thrown on failure. */ basic_socket(boost::asio::io_service& io_service, - const protocol_type& protocol, const native_type& native_socket) + const protocol_type& protocol, const native_handle_type& native_socket) : basic_io_object<SocketService>(io_service) { boost::system::error_code ec; - this->service.assign(this->implementation, protocol, native_socket, ec); - boost::asio::detail::throw_error(ec); + this->get_service().assign(this->get_implementation(), + protocol, native_socket, ec); + boost::asio::detail::throw_error(ec, "assign"); } +#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Move-construct a basic_socket from another. + /** + * This constructor moves a socket from one object to another. + * + * @param other The other basic_socket object from which the move will + * occur. + * + * @note Following the move, the moved-from object is in the same state as if + * constructed using the @c basic_socket(io_service&) constructor. + */ + basic_socket(basic_socket&& other) + : basic_io_object<SocketService>( + BOOST_ASIO_MOVE_CAST(basic_socket)(other)) + { + } + + /// Move-assign a basic_socket from another. + /** + * This assignment operator moves a socket from one object to another. + * + * @param other The other basic_socket object from which the move will + * occur. + * + * @note Following the move, the moved-from object is in the same state as if + * constructed using the @c basic_socket(io_service&) constructor. + */ + basic_socket& operator=(basic_socket&& other) + { + basic_io_object<SocketService>::operator=( + BOOST_ASIO_MOVE_CAST(basic_socket)(other)); + return *this; + } +#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Get a reference to the lowest layer. /** * This function returns a reference to the lowest layer in a stack of @@ -178,8 +220,8 @@ public: void open(const protocol_type& protocol = protocol_type()) { boost::system::error_code ec; - this->service.open(this->implementation, protocol, ec); - boost::asio::detail::throw_error(ec); + this->get_service().open(this->get_implementation(), protocol, ec); + boost::asio::detail::throw_error(ec, "open"); } /// Open the socket using the specified protocol. @@ -204,7 +246,7 @@ public: boost::system::error_code open(const protocol_type& protocol, boost::system::error_code& ec) { - return this->service.open(this->implementation, protocol, ec); + return this->get_service().open(this->get_implementation(), protocol, ec); } /// Assign an existing native socket to the socket. @@ -217,11 +259,13 @@ public: * * @throws boost::system::system_error Thrown on failure. */ - void assign(const protocol_type& protocol, const native_type& native_socket) + void assign(const protocol_type& protocol, + const native_handle_type& native_socket) { boost::system::error_code ec; - this->service.assign(this->implementation, protocol, native_socket, ec); - boost::asio::detail::throw_error(ec); + this->get_service().assign(this->get_implementation(), + protocol, native_socket, ec); + boost::asio::detail::throw_error(ec, "assign"); } /// Assign an existing native socket to the socket. @@ -235,16 +279,16 @@ public: * @param ec Set to indicate what error occurred, if any. */ boost::system::error_code assign(const protocol_type& protocol, - const native_type& native_socket, boost::system::error_code& ec) + const native_handle_type& native_socket, boost::system::error_code& ec) { - return this->service.assign(this->implementation, + return this->get_service().assign(this->get_implementation(), protocol, native_socket, ec); } /// Determine whether the socket is open. bool is_open() const { - return this->service.is_open(this->implementation); + return this->get_service().is_open(this->get_implementation()); } /// Close the socket. @@ -253,7 +297,8 @@ public: * or connect operations will be cancelled immediately, and will complete * with the boost::asio::error::operation_aborted error. * - * @throws boost::system::system_error Thrown on failure. + * @throws boost::system::system_error Thrown on failure. Note that, even if + * the function indicates an error, the underlying descriptor is closed. * * @note For portable behaviour with respect to graceful closure of a * connected socket, call shutdown() before closing the socket. @@ -261,8 +306,8 @@ public: void close() { boost::system::error_code ec; - this->service.close(this->implementation, ec); - boost::asio::detail::throw_error(ec); + this->get_service().close(this->get_implementation(), ec); + boost::asio::detail::throw_error(ec, "close"); } /// Close the socket. @@ -271,7 +316,8 @@ public: * or connect operations will be cancelled immediately, and will complete * with the boost::asio::error::operation_aborted error. * - * @param ec Set to indicate what error occurred, if any. + * @param ec Set to indicate what error occurred, if any. Note that, even if + * the function indicates an error, the underlying descriptor is closed. * * @par Example * @code @@ -290,10 +336,10 @@ public: */ boost::system::error_code close(boost::system::error_code& ec) { - return this->service.close(this->implementation, ec); + return this->get_service().close(this->get_implementation(), ec); } - /// Get the native socket representation. + /// (Deprecated: Use native_handle().) Get the native socket representation. /** * This function may be used to obtain the underlying representation of the * socket. This is intended to allow access to native socket functionality @@ -301,7 +347,18 @@ public: */ native_type native() { - return this->service.native(this->implementation); + return this->get_service().native_handle(this->get_implementation()); + } + + /// Get the native socket representation. + /** + * This function may be used to obtain the underlying representation of the + * socket. This is intended to allow access to native socket functionality + * that is not otherwise provided. + */ + native_handle_type native_handle() + { + return this->get_service().native_handle(this->get_implementation()); } /// Cancel all asynchronous operations associated with the socket. @@ -348,8 +405,8 @@ public: void cancel() { boost::system::error_code ec; - this->service.cancel(this->implementation, ec); - boost::asio::detail::throw_error(ec); + this->get_service().cancel(this->get_implementation(), ec); + boost::asio::detail::throw_error(ec, "cancel"); } /// Cancel all asynchronous operations associated with the socket. @@ -395,7 +452,7 @@ public: #endif boost::system::error_code cancel(boost::system::error_code& ec) { - return this->service.cancel(this->implementation, ec); + return this->get_service().cancel(this->get_implementation(), ec); } /// Determine whether the socket is at the out-of-band data mark. @@ -411,8 +468,8 @@ public: bool at_mark() const { boost::system::error_code ec; - bool b = this->service.at_mark(this->implementation, ec); - boost::asio::detail::throw_error(ec); + bool b = this->get_service().at_mark(this->get_implementation(), ec); + boost::asio::detail::throw_error(ec, "at_mark"); return b; } @@ -428,7 +485,7 @@ public: */ bool at_mark(boost::system::error_code& ec) const { - return this->service.at_mark(this->implementation, ec); + return this->get_service().at_mark(this->get_implementation(), ec); } /// Determine the number of bytes available for reading. @@ -444,8 +501,9 @@ public: std::size_t available() const { boost::system::error_code ec; - std::size_t s = this->service.available(this->implementation, ec); - boost::asio::detail::throw_error(ec); + std::size_t s = this->get_service().available( + this->get_implementation(), ec); + boost::asio::detail::throw_error(ec, "available"); return s; } @@ -461,7 +519,7 @@ public: */ std::size_t available(boost::system::error_code& ec) const { - return this->service.available(this->implementation, ec); + return this->get_service().available(this->get_implementation(), ec); } /// Bind the socket to the given local endpoint. @@ -485,8 +543,8 @@ public: void bind(const endpoint_type& endpoint) { boost::system::error_code ec; - this->service.bind(this->implementation, endpoint, ec); - boost::asio::detail::throw_error(ec); + this->get_service().bind(this->get_implementation(), endpoint, ec); + boost::asio::detail::throw_error(ec, "bind"); } /// Bind the socket to the given local endpoint. @@ -515,7 +573,7 @@ public: boost::system::error_code bind(const endpoint_type& endpoint, boost::system::error_code& ec) { - return this->service.bind(this->implementation, endpoint, ec); + return this->get_service().bind(this->get_implementation(), endpoint, ec); } /// Connect the socket to the specified endpoint. @@ -546,11 +604,12 @@ public: boost::system::error_code ec; if (!is_open()) { - this->service.open(this->implementation, peer_endpoint.protocol(), ec); - boost::asio::detail::throw_error(ec); + this->get_service().open(this->get_implementation(), + peer_endpoint.protocol(), ec); + boost::asio::detail::throw_error(ec, "connect"); } - this->service.connect(this->implementation, peer_endpoint, ec); - boost::asio::detail::throw_error(ec); + this->get_service().connect(this->get_implementation(), peer_endpoint, ec); + boost::asio::detail::throw_error(ec, "connect"); } /// Connect the socket to the specified endpoint. @@ -586,14 +645,15 @@ public: { if (!is_open()) { - if (this->service.open(this->implementation, + if (this->get_service().open(this->get_implementation(), peer_endpoint.protocol(), ec)) { return ec; } } - return this->service.connect(this->implementation, peer_endpoint, ec); + return this->get_service().connect( + this->get_implementation(), peer_endpoint, ec); } /// Start an asynchronous connect. @@ -638,21 +698,28 @@ public: * @endcode */ template <typename ConnectHandler> - void async_connect(const endpoint_type& peer_endpoint, ConnectHandler handler) + void async_connect(const endpoint_type& peer_endpoint, + BOOST_ASIO_MOVE_ARG(ConnectHandler) handler) { + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a ConnectHandler. + BOOST_ASIO_CONNECT_HANDLER_CHECK(ConnectHandler, handler) type_check; + if (!is_open()) { boost::system::error_code ec; - if (this->service.open(this->implementation, - peer_endpoint.protocol(), ec)) + const protocol_type protocol = peer_endpoint.protocol(); + if (this->get_service().open(this->get_implementation(), protocol, ec)) { this->get_io_service().post( - boost::asio::detail::bind_handler(handler, ec)); + boost::asio::detail::bind_handler( + BOOST_ASIO_MOVE_CAST(ConnectHandler)(handler), ec)); return; } } - this->service.async_connect(this->implementation, peer_endpoint, handler); + this->get_service().async_connect(this->get_implementation(), + peer_endpoint, BOOST_ASIO_MOVE_CAST(ConnectHandler)(handler)); } /// Set an option on the socket. @@ -693,8 +760,8 @@ public: void set_option(const SettableSocketOption& option) { boost::system::error_code ec; - this->service.set_option(this->implementation, option, ec); - boost::asio::detail::throw_error(ec); + this->get_service().set_option(this->get_implementation(), option, ec); + boost::asio::detail::throw_error(ec, "set_option"); } /// Set an option on the socket. @@ -740,7 +807,8 @@ public: boost::system::error_code set_option(const SettableSocketOption& option, boost::system::error_code& ec) { - return this->service.set_option(this->implementation, option, ec); + return this->get_service().set_option( + this->get_implementation(), option, ec); } /// Get an option from the socket. @@ -782,8 +850,8 @@ public: void get_option(GettableSocketOption& option) const { boost::system::error_code ec; - this->service.get_option(this->implementation, option, ec); - boost::asio::detail::throw_error(ec); + this->get_service().get_option(this->get_implementation(), option, ec); + boost::asio::detail::throw_error(ec, "get_option"); } /// Get an option from the socket. @@ -830,7 +898,8 @@ public: boost::system::error_code get_option(GettableSocketOption& option, boost::system::error_code& ec) const { - return this->service.get_option(this->implementation, option, ec); + return this->get_service().get_option( + this->get_implementation(), option, ec); } /// Perform an IO control command on the socket. @@ -859,8 +928,8 @@ public: void io_control(IoControlCommand& command) { boost::system::error_code ec; - this->service.io_control(this->implementation, command, ec); - boost::asio::detail::throw_error(ec); + this->get_service().io_control(this->get_implementation(), command, ec); + boost::asio::detail::throw_error(ec, "io_control"); } /// Perform an IO control command on the socket. @@ -894,7 +963,338 @@ public: boost::system::error_code io_control(IoControlCommand& command, boost::system::error_code& ec) { - return this->service.io_control(this->implementation, command, ec); + return this->get_service().io_control( + this->get_implementation(), command, ec); + } + + /// Gets the non-blocking mode of the socket. + /** + * @returns @c true if the socket's synchronous operations will fail with + * boost::asio::error::would_block if they are unable to perform the requested + * operation immediately. If @c false, synchronous operations will block + * until complete. + * + * @note The non-blocking mode has no effect on the behaviour of asynchronous + * operations. Asynchronous operations will never fail with the error + * boost::asio::error::would_block. + */ + bool non_blocking() const + { + return this->get_service().non_blocking(this->get_implementation()); + } + + /// Sets the non-blocking mode of the socket. + /** + * @param mode If @c true, the socket's synchronous operations will fail with + * boost::asio::error::would_block if they are unable to perform the requested + * operation immediately. If @c false, synchronous operations will block + * until complete. + * + * @throws boost::system::system_error Thrown on failure. + * + * @note The non-blocking mode has no effect on the behaviour of asynchronous + * operations. Asynchronous operations will never fail with the error + * boost::asio::error::would_block. + */ + void non_blocking(bool mode) + { + boost::system::error_code ec; + this->get_service().non_blocking(this->get_implementation(), mode, ec); + boost::asio::detail::throw_error(ec, "non_blocking"); + } + + /// Sets the non-blocking mode of the socket. + /** + * @param mode If @c true, the socket's synchronous operations will fail with + * boost::asio::error::would_block if they are unable to perform the requested + * operation immediately. If @c false, synchronous operations will block + * until complete. + * + * @param ec Set to indicate what error occurred, if any. + * + * @note The non-blocking mode has no effect on the behaviour of asynchronous + * operations. Asynchronous operations will never fail with the error + * boost::asio::error::would_block. + */ + boost::system::error_code non_blocking( + bool mode, boost::system::error_code& ec) + { + return this->get_service().non_blocking( + this->get_implementation(), mode, ec); + } + + /// Gets the non-blocking mode of the native socket implementation. + /** + * This function is used to retrieve the non-blocking mode of the underlying + * native socket. This mode has no effect on the behaviour of the socket + * object's synchronous operations. + * + * @returns @c true if the underlying socket is in non-blocking mode and + * direct system calls may fail with boost::asio::error::would_block (or the + * equivalent system error). + * + * @note The current non-blocking mode is cached by the socket object. + * Consequently, the return value may be incorrect if the non-blocking mode + * was set directly on the native socket. + * + * @par Example + * This function is intended to allow the encapsulation of arbitrary + * non-blocking system calls as asynchronous operations, in a way that is + * transparent to the user of the socket object. The following example + * illustrates how Linux's @c sendfile system call might be encapsulated: + * @code template <typename Handler> + * struct sendfile_op + * { + * tcp::socket& sock_; + * int fd_; + * Handler handler_; + * off_t offset_; + * std::size_t total_bytes_transferred_; + * + * // Function call operator meeting WriteHandler requirements. + * // Used as the handler for the async_write_some operation. + * void operator()(boost::system::error_code ec, std::size_t) + * { + * // Put the underlying socket into non-blocking mode. + * if (!ec) + * if (!sock_.native_non_blocking()) + * sock_.native_non_blocking(true, ec); + * + * if (!ec) + * { + * for (;;) + * { + * // Try the system call. + * errno = 0; + * int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536); + * ec = boost::system::error_code(n < 0 ? errno : 0, + * boost::asio::error::get_system_category()); + * total_bytes_transferred_ += ec ? 0 : n; + * + * // Retry operation immediately if interrupted by signal. + * if (ec == boost::asio::error::interrupted) + * continue; + * + * // Check if we need to run the operation again. + * if (ec == boost::asio::error::would_block + * || ec == boost::asio::error::try_again) + * { + * // We have to wait for the socket to become ready again. + * sock_.async_write_some(boost::asio::null_buffers(), *this); + * return; + * } + * + * if (ec || n == 0) + * { + * // An error occurred, or we have reached the end of the file. + * // Either way we must exit the loop so we can call the handler. + * break; + * } + * + * // Loop around to try calling sendfile again. + * } + * } + * + * // Pass result back to user's handler. + * handler_(ec, total_bytes_transferred_); + * } + * }; + * + * template <typename Handler> + * void async_sendfile(tcp::socket& sock, int fd, Handler h) + * { + * sendfile_op<Handler> op = { sock, fd, h, 0, 0 }; + * sock.async_write_some(boost::asio::null_buffers(), op); + * } @endcode + */ + bool native_non_blocking() const + { + return this->get_service().native_non_blocking(this->get_implementation()); + } + + /// Sets the non-blocking mode of the native socket implementation. + /** + * This function is used to modify the non-blocking mode of the underlying + * native socket. It has no effect on the behaviour of the socket object's + * synchronous operations. + * + * @param mode If @c true, the underlying socket is put into non-blocking + * mode and direct system calls may fail with boost::asio::error::would_block + * (or the equivalent system error). + * + * @throws boost::system::system_error Thrown on failure. If the @c mode is + * @c false, but the current value of @c non_blocking() is @c true, this + * function fails with boost::asio::error::invalid_argument, as the + * combination does not make sense. + * + * @par Example + * This function is intended to allow the encapsulation of arbitrary + * non-blocking system calls as asynchronous operations, in a way that is + * transparent to the user of the socket object. The following example + * illustrates how Linux's @c sendfile system call might be encapsulated: + * @code template <typename Handler> + * struct sendfile_op + * { + * tcp::socket& sock_; + * int fd_; + * Handler handler_; + * off_t offset_; + * std::size_t total_bytes_transferred_; + * + * // Function call operator meeting WriteHandler requirements. + * // Used as the handler for the async_write_some operation. + * void operator()(boost::system::error_code ec, std::size_t) + * { + * // Put the underlying socket into non-blocking mode. + * if (!ec) + * if (!sock_.native_non_blocking()) + * sock_.native_non_blocking(true, ec); + * + * if (!ec) + * { + * for (;;) + * { + * // Try the system call. + * errno = 0; + * int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536); + * ec = boost::system::error_code(n < 0 ? errno : 0, + * boost::asio::error::get_system_category()); + * total_bytes_transferred_ += ec ? 0 : n; + * + * // Retry operation immediately if interrupted by signal. + * if (ec == boost::asio::error::interrupted) + * continue; + * + * // Check if we need to run the operation again. + * if (ec == boost::asio::error::would_block + * || ec == boost::asio::error::try_again) + * { + * // We have to wait for the socket to become ready again. + * sock_.async_write_some(boost::asio::null_buffers(), *this); + * return; + * } + * + * if (ec || n == 0) + * { + * // An error occurred, or we have reached the end of the file. + * // Either way we must exit the loop so we can call the handler. + * break; + * } + * + * // Loop around to try calling sendfile again. + * } + * } + * + * // Pass result back to user's handler. + * handler_(ec, total_bytes_transferred_); + * } + * }; + * + * template <typename Handler> + * void async_sendfile(tcp::socket& sock, int fd, Handler h) + * { + * sendfile_op<Handler> op = { sock, fd, h, 0, 0 }; + * sock.async_write_some(boost::asio::null_buffers(), op); + * } @endcode + */ + void native_non_blocking(bool mode) + { + boost::system::error_code ec; + this->get_service().native_non_blocking( + this->get_implementation(), mode, ec); + boost::asio::detail::throw_error(ec, "native_non_blocking"); + } + + /// Sets the non-blocking mode of the native socket implementation. + /** + * This function is used to modify the non-blocking mode of the underlying + * native socket. It has no effect on the behaviour of the socket object's + * synchronous operations. + * + * @param mode If @c true, the underlying socket is put into non-blocking + * mode and direct system calls may fail with boost::asio::error::would_block + * (or the equivalent system error). + * + * @param ec Set to indicate what error occurred, if any. If the @c mode is + * @c false, but the current value of @c non_blocking() is @c true, this + * function fails with boost::asio::error::invalid_argument, as the + * combination does not make sense. + * + * @par Example + * This function is intended to allow the encapsulation of arbitrary + * non-blocking system calls as asynchronous operations, in a way that is + * transparent to the user of the socket object. The following example + * illustrates how Linux's @c sendfile system call might be encapsulated: + * @code template <typename Handler> + * struct sendfile_op + * { + * tcp::socket& sock_; + * int fd_; + * Handler handler_; + * off_t offset_; + * std::size_t total_bytes_transferred_; + * + * // Function call operator meeting WriteHandler requirements. + * // Used as the handler for the async_write_some operation. + * void operator()(boost::system::error_code ec, std::size_t) + * { + * // Put the underlying socket into non-blocking mode. + * if (!ec) + * if (!sock_.native_non_blocking()) + * sock_.native_non_blocking(true, ec); + * + * if (!ec) + * { + * for (;;) + * { + * // Try the system call. + * errno = 0; + * int n = ::sendfile(sock_.native_handle(), fd_, &offset_, 65536); + * ec = boost::system::error_code(n < 0 ? errno : 0, + * boost::asio::error::get_system_category()); + * total_bytes_transferred_ += ec ? 0 : n; + * + * // Retry operation immediately if interrupted by signal. + * if (ec == boost::asio::error::interrupted) + * continue; + * + * // Check if we need to run the operation again. + * if (ec == boost::asio::error::would_block + * || ec == boost::asio::error::try_again) + * { + * // We have to wait for the socket to become ready again. + * sock_.async_write_some(boost::asio::null_buffers(), *this); + * return; + * } + * + * if (ec || n == 0) + * { + * // An error occurred, or we have reached the end of the file. + * // Either way we must exit the loop so we can call the handler. + * break; + * } + * + * // Loop around to try calling sendfile again. + * } + * } + * + * // Pass result back to user's handler. + * handler_(ec, total_bytes_transferred_); + * } + * }; + * + * template <typename Handler> + * void async_sendfile(tcp::socket& sock, int fd, Handler h) + * { + * sendfile_op<Handler> op = { sock, fd, h, 0, 0 }; + * sock.async_write_some(boost::asio::null_buffers(), op); + * } @endcode + */ + boost::system::error_code native_non_blocking( + bool mode, boost::system::error_code& ec) + { + return this->get_service().native_non_blocking( + this->get_implementation(), mode, ec); } /// Get the local endpoint of the socket. @@ -915,8 +1315,9 @@ public: endpoint_type local_endpoint() const { boost::system::error_code ec; - endpoint_type ep = this->service.local_endpoint(this->implementation, ec); - boost::asio::detail::throw_error(ec); + endpoint_type ep = this->get_service().local_endpoint( + this->get_implementation(), ec); + boost::asio::detail::throw_error(ec, "local_endpoint"); return ep; } @@ -943,7 +1344,7 @@ public: */ endpoint_type local_endpoint(boost::system::error_code& ec) const { - return this->service.local_endpoint(this->implementation, ec); + return this->get_service().local_endpoint(this->get_implementation(), ec); } /// Get the remote endpoint of the socket. @@ -964,8 +1365,9 @@ public: endpoint_type remote_endpoint() const { boost::system::error_code ec; - endpoint_type ep = this->service.remote_endpoint(this->implementation, ec); - boost::asio::detail::throw_error(ec); + endpoint_type ep = this->get_service().remote_endpoint( + this->get_implementation(), ec); + boost::asio::detail::throw_error(ec, "remote_endpoint"); return ep; } @@ -992,7 +1394,7 @@ public: */ endpoint_type remote_endpoint(boost::system::error_code& ec) const { - return this->service.remote_endpoint(this->implementation, ec); + return this->get_service().remote_endpoint(this->get_implementation(), ec); } /// Disable sends or receives on the socket. @@ -1015,8 +1417,8 @@ public: void shutdown(shutdown_type what) { boost::system::error_code ec; - this->service.shutdown(this->implementation, what, ec); - boost::asio::detail::throw_error(ec); + this->get_service().shutdown(this->get_implementation(), what, ec); + boost::asio::detail::throw_error(ec, "shutdown"); } /// Disable sends or receives on the socket. @@ -1044,7 +1446,7 @@ public: boost::system::error_code shutdown(shutdown_type what, boost::system::error_code& ec) { - return this->service.shutdown(this->implementation, what, ec); + return this->get_service().shutdown(this->get_implementation(), what, ec); } protected: diff --git a/3rdParty/Boost/src/boost/asio/basic_socket_acceptor.hpp b/3rdParty/Boost/src/boost/asio/basic_socket_acceptor.hpp index a877bc3..5a3b0f7 100644 --- a/3rdParty/Boost/src/boost/asio/basic_socket_acceptor.hpp +++ b/3rdParty/Boost/src/boost/asio/basic_socket_acceptor.hpp @@ -2,7 +2,7 @@ // basic_socket_acceptor.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -18,6 +18,7 @@ #include <boost/asio/detail/config.hpp> #include <boost/asio/basic_io_object.hpp> #include <boost/asio/basic_socket.hpp> +#include <boost/asio/detail/handler_type_requirements.hpp> #include <boost/asio/detail/throw_error.hpp> #include <boost/asio/error.hpp> #include <boost/asio/socket_acceptor_service.hpp> @@ -55,8 +56,12 @@ class basic_socket_acceptor public socket_base { public: + /// (Deprecated: Use native_handle_type.) The native representation of an + /// acceptor. + typedef typename SocketAcceptorService::native_handle_type native_type; + /// The native representation of an acceptor. - typedef typename SocketAcceptorService::native_type native_type; + typedef typename SocketAcceptorService::native_handle_type native_handle_type; /// The protocol type. typedef Protocol protocol_type; @@ -96,8 +101,8 @@ public: : basic_io_object<SocketAcceptorService>(io_service) { boost::system::error_code ec; - this->service.open(this->implementation, protocol, ec); - boost::asio::detail::throw_error(ec); + this->get_service().open(this->get_implementation(), protocol, ec); + boost::asio::detail::throw_error(ec, "open"); } /// Construct an acceptor opened on the given endpoint. @@ -132,19 +137,20 @@ public: : basic_io_object<SocketAcceptorService>(io_service) { boost::system::error_code ec; - this->service.open(this->implementation, endpoint.protocol(), ec); - boost::asio::detail::throw_error(ec); + const protocol_type protocol = endpoint.protocol(); + this->get_service().open(this->get_implementation(), protocol, ec); + boost::asio::detail::throw_error(ec, "open"); if (reuse_addr) { - this->service.set_option(this->implementation, + this->get_service().set_option(this->get_implementation(), socket_base::reuse_address(true), ec); - boost::asio::detail::throw_error(ec); + boost::asio::detail::throw_error(ec, "set_option"); } - this->service.bind(this->implementation, endpoint, ec); - boost::asio::detail::throw_error(ec); - this->service.listen(this->implementation, + this->get_service().bind(this->get_implementation(), endpoint, ec); + boost::asio::detail::throw_error(ec, "bind"); + this->get_service().listen(this->get_implementation(), socket_base::max_connections, ec); - boost::asio::detail::throw_error(ec); + boost::asio::detail::throw_error(ec, "listen"); } /// Construct a basic_socket_acceptor on an existing native acceptor. @@ -163,14 +169,50 @@ public: * @throws boost::system::system_error Thrown on failure. */ basic_socket_acceptor(boost::asio::io_service& io_service, - const protocol_type& protocol, const native_type& native_acceptor) + const protocol_type& protocol, const native_handle_type& native_acceptor) : basic_io_object<SocketAcceptorService>(io_service) { boost::system::error_code ec; - this->service.assign(this->implementation, protocol, native_acceptor, ec); - boost::asio::detail::throw_error(ec); + this->get_service().assign(this->get_implementation(), + protocol, native_acceptor, ec); + boost::asio::detail::throw_error(ec, "assign"); + } + +#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Move-construct a basic_socket_acceptor from another. + /** + * This constructor moves an acceptor from one object to another. + * + * @param other The other basic_socket_acceptor object from which the move + * will occur. + * + * @note Following the move, the moved-from object is in the same state as if + * constructed using the @c basic_socket_acceptor(io_service&) constructor. + */ + basic_socket_acceptor(basic_socket_acceptor&& other) + : basic_io_object<SocketAcceptorService>( + BOOST_ASIO_MOVE_CAST(basic_socket_acceptor)(other)) + { } + /// Move-assign a basic_socket_acceptor from another. + /** + * This assignment operator moves an acceptor from one object to another. + * + * @param other The other basic_socket_acceptor object from which the move + * will occur. + * + * @note Following the move, the moved-from object is in the same state as if + * constructed using the @c basic_socket_acceptor(io_service&) constructor. + */ + basic_socket_acceptor& operator=(basic_socket_acceptor&& other) + { + basic_io_object<SocketAcceptorService>::operator=( + BOOST_ASIO_MOVE_CAST(basic_socket_acceptor)(other)); + return *this; + } +#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Open the acceptor using the specified protocol. /** * This function opens the socket acceptor so that it will use the specified @@ -189,8 +231,8 @@ public: void open(const protocol_type& protocol = protocol_type()) { boost::system::error_code ec; - this->service.open(this->implementation, protocol, ec); - boost::asio::detail::throw_error(ec); + this->get_service().open(this->get_implementation(), protocol, ec); + boost::asio::detail::throw_error(ec, "open"); } /// Open the acceptor using the specified protocol. @@ -216,7 +258,7 @@ public: boost::system::error_code open(const protocol_type& protocol, boost::system::error_code& ec) { - return this->service.open(this->implementation, protocol, ec); + return this->get_service().open(this->get_implementation(), protocol, ec); } /// Assigns an existing native acceptor to the acceptor. @@ -229,11 +271,13 @@ public: * * @throws boost::system::system_error Thrown on failure. */ - void assign(const protocol_type& protocol, const native_type& native_acceptor) + void assign(const protocol_type& protocol, + const native_handle_type& native_acceptor) { boost::system::error_code ec; - this->service.assign(this->implementation, protocol, native_acceptor, ec); - boost::asio::detail::throw_error(ec); + this->get_service().assign(this->get_implementation(), + protocol, native_acceptor, ec); + boost::asio::detail::throw_error(ec, "assign"); } /// Assigns an existing native acceptor to the acceptor. @@ -247,16 +291,16 @@ public: * @param ec Set to indicate what error occurred, if any. */ boost::system::error_code assign(const protocol_type& protocol, - const native_type& native_acceptor, boost::system::error_code& ec) + const native_handle_type& native_acceptor, boost::system::error_code& ec) { - return this->service.assign(this->implementation, + return this->get_service().assign(this->get_implementation(), protocol, native_acceptor, ec); } /// Determine whether the acceptor is open. bool is_open() const { - return this->service.is_open(this->implementation); + return this->get_service().is_open(this->get_implementation()); } /// Bind the acceptor to the given local endpoint. @@ -279,8 +323,8 @@ public: void bind(const endpoint_type& endpoint) { boost::system::error_code ec; - this->service.bind(this->implementation, endpoint, ec); - boost::asio::detail::throw_error(ec); + this->get_service().bind(this->get_implementation(), endpoint, ec); + boost::asio::detail::throw_error(ec, "bind"); } /// Bind the acceptor to the given local endpoint. @@ -308,7 +352,7 @@ public: boost::system::error_code bind(const endpoint_type& endpoint, boost::system::error_code& ec) { - return this->service.bind(this->implementation, endpoint, ec); + return this->get_service().bind(this->get_implementation(), endpoint, ec); } /// Place the acceptor into the state where it will listen for new @@ -324,8 +368,8 @@ public: void listen(int backlog = socket_base::max_connections) { boost::system::error_code ec; - this->service.listen(this->implementation, backlog, ec); - boost::asio::detail::throw_error(ec); + this->get_service().listen(this->get_implementation(), backlog, ec); + boost::asio::detail::throw_error(ec, "listen"); } /// Place the acceptor into the state where it will listen for new @@ -352,7 +396,7 @@ public: */ boost::system::error_code listen(int backlog, boost::system::error_code& ec) { - return this->service.listen(this->implementation, backlog, ec); + return this->get_service().listen(this->get_implementation(), backlog, ec); } /// Close the acceptor. @@ -368,8 +412,8 @@ public: void close() { boost::system::error_code ec; - this->service.close(this->implementation, ec); - boost::asio::detail::throw_error(ec); + this->get_service().close(this->get_implementation(), ec); + boost::asio::detail::throw_error(ec, "close"); } /// Close the acceptor. @@ -396,10 +440,10 @@ public: */ boost::system::error_code close(boost::system::error_code& ec) { - return this->service.close(this->implementation, ec); + return this->get_service().close(this->get_implementation(), ec); } - /// Get the native acceptor representation. + /// (Deprecated: Use native_handle().) Get the native acceptor representation. /** * This function may be used to obtain the underlying representation of the * acceptor. This is intended to allow access to native acceptor functionality @@ -407,7 +451,18 @@ public: */ native_type native() { - return this->service.native(this->implementation); + return this->get_service().native_handle(this->get_implementation()); + } + + /// Get the native acceptor representation. + /** + * This function may be used to obtain the underlying representation of the + * acceptor. This is intended to allow access to native acceptor functionality + * that is not otherwise provided. + */ + native_handle_type native_handle() + { + return this->get_service().native_handle(this->get_implementation()); } /// Cancel all asynchronous operations associated with the acceptor. @@ -421,8 +476,8 @@ public: void cancel() { boost::system::error_code ec; - this->service.cancel(this->implementation, ec); - boost::asio::detail::throw_error(ec); + this->get_service().cancel(this->get_implementation(), ec); + boost::asio::detail::throw_error(ec, "cancel"); } /// Cancel all asynchronous operations associated with the acceptor. @@ -435,7 +490,7 @@ public: */ boost::system::error_code cancel(boost::system::error_code& ec) { - return this->service.cancel(this->implementation, ec); + return this->get_service().cancel(this->get_implementation(), ec); } /// Set an option on the acceptor. @@ -463,8 +518,8 @@ public: void set_option(const SettableSocketOption& option) { boost::system::error_code ec; - this->service.set_option(this->implementation, option, ec); - boost::asio::detail::throw_error(ec); + this->get_service().set_option(this->get_implementation(), option, ec); + boost::asio::detail::throw_error(ec, "set_option"); } /// Set an option on the acceptor. @@ -497,7 +552,8 @@ public: boost::system::error_code set_option(const SettableSocketOption& option, boost::system::error_code& ec) { - return this->service.set_option(this->implementation, option, ec); + return this->get_service().set_option( + this->get_implementation(), option, ec); } /// Get an option from the acceptor. @@ -526,8 +582,8 @@ public: void get_option(GettableSocketOption& option) { boost::system::error_code ec; - this->service.get_option(this->implementation, option, ec); - boost::asio::detail::throw_error(ec); + this->get_service().get_option(this->get_implementation(), option, ec); + boost::asio::detail::throw_error(ec, "get_option"); } /// Get an option from the acceptor. @@ -561,7 +617,189 @@ public: boost::system::error_code get_option(GettableSocketOption& option, boost::system::error_code& ec) { - return this->service.get_option(this->implementation, option, ec); + return this->get_service().get_option( + this->get_implementation(), option, ec); + } + + /// Perform an IO control command on the acceptor. + /** + * This function is used to execute an IO control command on the acceptor. + * + * @param command The IO control command to be performed on the acceptor. + * + * @throws boost::system::system_error Thrown on failure. + * + * @sa IoControlCommand @n + * boost::asio::socket_base::non_blocking_io + * + * @par Example + * Getting the number of bytes ready to read: + * @code + * boost::asio::ip::tcp::acceptor acceptor(io_service); + * ... + * boost::asio::ip::tcp::acceptor::non_blocking_io command(true); + * socket.io_control(command); + * @endcode + */ + template <typename IoControlCommand> + void io_control(IoControlCommand& command) + { + boost::system::error_code ec; + this->get_service().io_control(this->get_implementation(), command, ec); + boost::asio::detail::throw_error(ec, "io_control"); + } + + /// Perform an IO control command on the acceptor. + /** + * This function is used to execute an IO control command on the acceptor. + * + * @param command The IO control command to be performed on the acceptor. + * + * @param ec Set to indicate what error occurred, if any. + * + * @sa IoControlCommand @n + * boost::asio::socket_base::non_blocking_io + * + * @par Example + * Getting the number of bytes ready to read: + * @code + * boost::asio::ip::tcp::acceptor acceptor(io_service); + * ... + * boost::asio::ip::tcp::acceptor::non_blocking_io command(true); + * boost::system::error_code ec; + * socket.io_control(command, ec); + * if (ec) + * { + * // An error occurred. + * } + * @endcode + */ + template <typename IoControlCommand> + boost::system::error_code io_control(IoControlCommand& command, + boost::system::error_code& ec) + { + return this->get_service().io_control( + this->get_implementation(), command, ec); + } + + /// Gets the non-blocking mode of the acceptor. + /** + * @returns @c true if the acceptor's synchronous operations will fail with + * boost::asio::error::would_block if they are unable to perform the requested + * operation immediately. If @c false, synchronous operations will block + * until complete. + * + * @note The non-blocking mode has no effect on the behaviour of asynchronous + * operations. Asynchronous operations will never fail with the error + * boost::asio::error::would_block. + */ + bool non_blocking() const + { + return this->get_service().non_blocking(this->get_implementation()); + } + + /// Sets the non-blocking mode of the acceptor. + /** + * @param mode If @c true, the acceptor's synchronous operations will fail + * with boost::asio::error::would_block if they are unable to perform the + * requested operation immediately. If @c false, synchronous operations will + * block until complete. + * + * @throws boost::system::system_error Thrown on failure. + * + * @note The non-blocking mode has no effect on the behaviour of asynchronous + * operations. Asynchronous operations will never fail with the error + * boost::asio::error::would_block. + */ + void non_blocking(bool mode) + { + boost::system::error_code ec; + this->get_service().non_blocking(this->get_implementation(), mode, ec); + boost::asio::detail::throw_error(ec, "non_blocking"); + } + + /// Sets the non-blocking mode of the acceptor. + /** + * @param mode If @c true, the acceptor's synchronous operations will fail + * with boost::asio::error::would_block if they are unable to perform the + * requested operation immediately. If @c false, synchronous operations will + * block until complete. + * + * @param ec Set to indicate what error occurred, if any. + * + * @note The non-blocking mode has no effect on the behaviour of asynchronous + * operations. Asynchronous operations will never fail with the error + * boost::asio::error::would_block. + */ + boost::system::error_code non_blocking( + bool mode, boost::system::error_code& ec) + { + return this->get_service().non_blocking( + this->get_implementation(), mode, ec); + } + + /// Gets the non-blocking mode of the native acceptor implementation. + /** + * This function is used to retrieve the non-blocking mode of the underlying + * native acceptor. This mode has no effect on the behaviour of the acceptor + * object's synchronous operations. + * + * @returns @c true if the underlying acceptor is in non-blocking mode and + * direct system calls may fail with boost::asio::error::would_block (or the + * equivalent system error). + * + * @note The current non-blocking mode is cached by the acceptor object. + * Consequently, the return value may be incorrect if the non-blocking mode + * was set directly on the native acceptor. + */ + bool native_non_blocking() const + { + return this->get_service().native_non_blocking(this->get_implementation()); + } + + /// Sets the non-blocking mode of the native acceptor implementation. + /** + * This function is used to modify the non-blocking mode of the underlying + * native acceptor. It has no effect on the behaviour of the acceptor object's + * synchronous operations. + * + * @param mode If @c true, the underlying acceptor is put into non-blocking + * mode and direct system calls may fail with boost::asio::error::would_block + * (or the equivalent system error). + * + * @throws boost::system::system_error Thrown on failure. If the @c mode is + * @c false, but the current value of @c non_blocking() is @c true, this + * function fails with boost::asio::error::invalid_argument, as the + * combination does not make sense. + */ + void native_non_blocking(bool mode) + { + boost::system::error_code ec; + this->get_service().native_non_blocking( + this->get_implementation(), mode, ec); + boost::asio::detail::throw_error(ec, "native_non_blocking"); + } + + /// Sets the non-blocking mode of the native acceptor implementation. + /** + * This function is used to modify the non-blocking mode of the underlying + * native acceptor. It has no effect on the behaviour of the acceptor object's + * synchronous operations. + * + * @param mode If @c true, the underlying acceptor is put into non-blocking + * mode and direct system calls may fail with boost::asio::error::would_block + * (or the equivalent system error). + * + * @param ec Set to indicate what error occurred, if any. If the @c mode is + * @c false, but the current value of @c non_blocking() is @c true, this + * function fails with boost::asio::error::invalid_argument, as the + * combination does not make sense. + */ + boost::system::error_code native_non_blocking( + bool mode, boost::system::error_code& ec) + { + return this->get_service().native_non_blocking( + this->get_implementation(), mode, ec); } /// Get the local endpoint of the acceptor. @@ -582,8 +820,9 @@ public: endpoint_type local_endpoint() const { boost::system::error_code ec; - endpoint_type ep = this->service.local_endpoint(this->implementation, ec); - boost::asio::detail::throw_error(ec); + endpoint_type ep = this->get_service().local_endpoint( + this->get_implementation(), ec); + boost::asio::detail::throw_error(ec, "local_endpoint"); return ep; } @@ -611,7 +850,7 @@ public: */ endpoint_type local_endpoint(boost::system::error_code& ec) const { - return this->service.local_endpoint(this->implementation, ec); + return this->get_service().local_endpoint(this->get_implementation(), ec); } /// Accept a new connection. @@ -636,8 +875,8 @@ public: void accept(basic_socket<protocol_type, SocketService>& peer) { boost::system::error_code ec; - this->service.accept(this->implementation, peer, 0, ec); - boost::asio::detail::throw_error(ec); + this->get_service().accept(this->get_implementation(), peer, 0, ec); + boost::asio::detail::throw_error(ec, "accept"); } /// Accept a new connection. @@ -668,7 +907,7 @@ public: basic_socket<protocol_type, SocketService>& peer, boost::system::error_code& ec) { - return this->service.accept(this->implementation, peer, 0, ec); + return this->get_service().accept(this->get_implementation(), peer, 0, ec); } /// Start an asynchronous accept. @@ -711,9 +950,14 @@ public: */ template <typename SocketService, typename AcceptHandler> void async_accept(basic_socket<protocol_type, SocketService>& peer, - AcceptHandler handler) + BOOST_ASIO_MOVE_ARG(AcceptHandler) handler) { - this->service.async_accept(this->implementation, peer, 0, handler); + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a AcceptHandler. + BOOST_ASIO_ACCEPT_HANDLER_CHECK(AcceptHandler, handler) type_check; + + this->get_service().async_accept(this->get_implementation(), + peer, 0, BOOST_ASIO_MOVE_CAST(AcceptHandler)(handler)); } /// Accept a new connection and obtain the endpoint of the peer @@ -744,8 +988,9 @@ public: endpoint_type& peer_endpoint) { boost::system::error_code ec; - this->service.accept(this->implementation, peer, &peer_endpoint, ec); - boost::asio::detail::throw_error(ec); + this->get_service().accept(this->get_implementation(), + peer, &peer_endpoint, ec); + boost::asio::detail::throw_error(ec, "accept"); } /// Accept a new connection and obtain the endpoint of the peer @@ -781,7 +1026,8 @@ public: basic_socket<protocol_type, SocketService>& peer, endpoint_type& peer_endpoint, boost::system::error_code& ec) { - return this->service.accept(this->implementation, peer, &peer_endpoint, ec); + return this->get_service().accept( + this->get_implementation(), peer, &peer_endpoint, ec); } /// Start an asynchronous accept. @@ -812,10 +1058,14 @@ public: */ template <typename SocketService, typename AcceptHandler> void async_accept(basic_socket<protocol_type, SocketService>& peer, - endpoint_type& peer_endpoint, AcceptHandler handler) + endpoint_type& peer_endpoint, BOOST_ASIO_MOVE_ARG(AcceptHandler) handler) { - this->service.async_accept(this->implementation, - peer, &peer_endpoint, handler); + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a AcceptHandler. + BOOST_ASIO_ACCEPT_HANDLER_CHECK(AcceptHandler, handler) type_check; + + this->get_service().async_accept(this->get_implementation(), peer, + &peer_endpoint, BOOST_ASIO_MOVE_CAST(AcceptHandler)(handler)); } }; diff --git a/3rdParty/Boost/src/boost/asio/basic_socket_iostream.hpp b/3rdParty/Boost/src/boost/asio/basic_socket_iostream.hpp index 142f404..6fae085 100644 --- a/3rdParty/Boost/src/boost/asio/basic_socket_iostream.hpp +++ b/3rdParty/Boost/src/boost/asio/basic_socket_iostream.hpp @@ -2,7 +2,7 @@ // basic_socket_iostream.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -19,36 +19,41 @@ #if !defined(BOOST_NO_IOSTREAM) -#include <boost/preprocessor/arithmetic/inc.hpp> -#include <boost/preprocessor/repetition/enum_binary_params.hpp> -#include <boost/preprocessor/repetition/enum_params.hpp> -#include <boost/preprocessor/repetition/repeat_from_to.hpp> #include <boost/utility/base_from_member.hpp> #include <boost/asio/basic_socket_streambuf.hpp> #include <boost/asio/stream_socket_service.hpp> -#if !defined(BOOST_ASIO_SOCKET_IOSTREAM_MAX_ARITY) -#define BOOST_ASIO_SOCKET_IOSTREAM_MAX_ARITY 5 -#endif // !defined(BOOST_ASIO_SOCKET_IOSTREAM_MAX_ARITY) +#if !defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) + +# include <boost/preprocessor/arithmetic/inc.hpp> +# include <boost/preprocessor/repetition/enum_binary_params.hpp> +# include <boost/preprocessor/repetition/enum_params.hpp> +# include <boost/preprocessor/repetition/repeat_from_to.hpp> + +# if !defined(BOOST_ASIO_SOCKET_IOSTREAM_MAX_ARITY) +# define BOOST_ASIO_SOCKET_IOSTREAM_MAX_ARITY 5 +# endif // !defined(BOOST_ASIO_SOCKET_IOSTREAM_MAX_ARITY) // A macro that should expand to: // template <typename T1, ..., typename Tn> // explicit basic_socket_iostream(T1 x1, ..., Tn xn) // : basic_iostream<char>(&this->boost::base_from_member< -// basic_socket_streambuf<Protocol, StreamSocketService> >::member) +// basic_socket_streambuf<Protocol, StreamSocketService, +// Time, TimeTraits, TimerService> >::member) // { // if (rdbuf()->connect(x1, ..., xn) == 0) // this->setstate(std::ios_base::failbit); // } // This macro should only persist within this file. -#define BOOST_ASIO_PRIVATE_CTR_DEF(z, n, data) \ +# define BOOST_ASIO_PRIVATE_CTR_DEF(z, n, data) \ template <BOOST_PP_ENUM_PARAMS(n, typename T)> \ explicit basic_socket_iostream(BOOST_PP_ENUM_BINARY_PARAMS(n, T, x)) \ : std::basic_iostream<char>(&this->boost::base_from_member< \ - basic_socket_streambuf<Protocol, StreamSocketService> >::member) \ + basic_socket_streambuf<Protocol, StreamSocketService, \ + Time, TimeTraits, TimerService> >::member) \ { \ - tie(this); \ + this->setf(std::ios_base::unitbuf); \ if (rdbuf()->connect(BOOST_PP_ENUM_PARAMS(n, x)) == 0) \ this->setstate(std::ios_base::failbit); \ } \ @@ -63,7 +68,7 @@ // } // This macro should only persist within this file. -#define BOOST_ASIO_PRIVATE_CONNECT_DEF(z, n, data) \ +# define BOOST_ASIO_PRIVATE_CONNECT_DEF(z, n, data) \ template <BOOST_PP_ENUM_PARAMS(n, typename T)> \ void connect(BOOST_PP_ENUM_BINARY_PARAMS(n, T, x)) \ { \ @@ -72,6 +77,8 @@ } \ /**/ +#endif // !defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) + #include <boost/asio/detail/push_options.hpp> namespace boost { @@ -79,19 +86,33 @@ namespace asio { /// Iostream interface for a socket. template <typename Protocol, - typename StreamSocketService = stream_socket_service<Protocol> > + typename StreamSocketService = stream_socket_service<Protocol>, + typename Time = boost::posix_time::ptime, + typename TimeTraits = boost::asio::time_traits<Time>, + typename TimerService = deadline_timer_service<Time, TimeTraits> > class basic_socket_iostream : public boost::base_from_member< - basic_socket_streambuf<Protocol, StreamSocketService> >, + basic_socket_streambuf<Protocol, StreamSocketService, + Time, TimeTraits, TimerService> >, public std::basic_iostream<char> { public: + /// The endpoint type. + typedef typename Protocol::endpoint endpoint_type; + + /// The time type. + typedef typename TimeTraits::time_type time_type; + + /// The duration type. + typedef typename TimeTraits::duration_type duration_type; + /// Construct a basic_socket_iostream without establishing a connection. basic_socket_iostream() : std::basic_iostream<char>(&this->boost::base_from_member< - basic_socket_streambuf<Protocol, StreamSocketService> >::member) + basic_socket_streambuf<Protocol, StreamSocketService, + Time, TimeTraits, TimerService> >::member) { - tie(this); + this->setf(std::ios_base::unitbuf); } #if defined(GENERATING_DOCUMENTATION) @@ -103,6 +124,17 @@ public: */ template <typename T1, ..., typename TN> explicit basic_socket_iostream(T1 t1, ..., TN tn); +#elif defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) + template <typename... T> + explicit basic_socket_iostream(T... x) + : std::basic_iostream<char>(&this->boost::base_from_member< + basic_socket_streambuf<Protocol, StreamSocketService, + Time, TimeTraits, TimerService> >::member) + { + this->setf(std::ios_base::unitbuf); + if (rdbuf()->connect(x...) == 0) + this->setstate(std::ios_base::failbit); + } #else BOOST_PP_REPEAT_FROM_TO( 1, BOOST_PP_INC(BOOST_ASIO_SOCKET_IOSTREAM_MAX_ARITY), @@ -118,6 +150,13 @@ public: */ template <typename T1, ..., typename TN> void connect(T1 t1, ..., TN tn); +#elif defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) + template <typename... T> + void connect(T... x) + { + if (rdbuf()->connect(x...) == 0) + this->setstate(std::ios_base::failbit); + } #else BOOST_PP_REPEAT_FROM_TO( 1, BOOST_PP_INC(BOOST_ASIO_SOCKET_IOSTREAM_MAX_ARITY), @@ -132,11 +171,77 @@ public: } /// Return a pointer to the underlying streambuf. - basic_socket_streambuf<Protocol, StreamSocketService>* rdbuf() const + basic_socket_streambuf<Protocol, StreamSocketService, + Time, TimeTraits, TimerService>* rdbuf() const { - return const_cast<basic_socket_streambuf<Protocol, StreamSocketService>*>( + return const_cast<basic_socket_streambuf<Protocol, StreamSocketService, + Time, TimeTraits, TimerService>*>( &this->boost::base_from_member< - basic_socket_streambuf<Protocol, StreamSocketService> >::member); + basic_socket_streambuf<Protocol, StreamSocketService, + Time, TimeTraits, TimerService> >::member); + } + + /// Get the last error associated with the stream. + /** + * @return An \c error_code corresponding to the last error from the stream. + * + * @par Example + * To print the error associated with a failure to establish a connection: + * @code tcp::iostream s("www.boost.org", "http"); + * if (!s) + * { + * std::cout << "Error: " << s.error().message() << std::endl; + * } @endcode + */ + const boost::system::error_code& error() const + { + return rdbuf()->puberror(); + } + + /// Get the stream's expiry time as an absolute time. + /** + * @return An absolute time value representing the stream's expiry time. + */ + time_type expires_at() const + { + return rdbuf()->expires_at(); + } + + /// Set the stream's expiry time as an absolute time. + /** + * This function sets the expiry time associated with the stream. Stream + * operations performed after this time (where the operations cannot be + * completed using the internal buffers) will fail with the error + * boost::asio::error::operation_aborted. + * + * @param expiry_time The expiry time to be used for the stream. + */ + void expires_at(const time_type& expiry_time) + { + rdbuf()->expires_at(expiry_time); + } + + /// Get the timer's expiry time relative to now. + /** + * @return A relative time value representing the stream's expiry time. + */ + duration_type expires_from_now() const + { + return rdbuf()->expires_from_now(); + } + + /// Set the stream's expiry time relative to now. + /** + * This function sets the expiry time associated with the stream. Stream + * operations performed after this time (where the operations cannot be + * completed using the internal buffers) will fail with the error + * boost::asio::error::operation_aborted. + * + * @param expiry_time The expiry time to be used for the timer. + */ + void expires_from_now(const duration_type& expiry_time) + { + rdbuf()->expires_from_now(expiry_time); } }; @@ -145,8 +250,10 @@ public: #include <boost/asio/detail/pop_options.hpp> -#undef BOOST_ASIO_PRIVATE_CTR_DEF -#undef BOOST_ASIO_PRIVATE_CONNECT_DEF +#if !defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) +# undef BOOST_ASIO_PRIVATE_CTR_DEF +# undef BOOST_ASIO_PRIVATE_CONNECT_DEF +#endif // !defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) #endif // defined(BOOST_NO_IOSTREAM) diff --git a/3rdParty/Boost/src/boost/asio/basic_socket_streambuf.hpp b/3rdParty/Boost/src/boost/asio/basic_socket_streambuf.hpp index c2a9a99..fb047c6 100644 --- a/3rdParty/Boost/src/boost/asio/basic_socket_streambuf.hpp +++ b/3rdParty/Boost/src/boost/asio/basic_socket_streambuf.hpp @@ -2,7 +2,7 @@ // basic_socket_streambuf.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -20,53 +20,64 @@ #if !defined(BOOST_NO_IOSTREAM) #include <streambuf> -#include <boost/array.hpp> -#include <boost/preprocessor/arithmetic/inc.hpp> -#include <boost/preprocessor/repetition/enum_binary_params.hpp> -#include <boost/preprocessor/repetition/enum_params.hpp> -#include <boost/preprocessor/repetition/repeat_from_to.hpp> #include <boost/utility/base_from_member.hpp> #include <boost/asio/basic_socket.hpp> +#include <boost/asio/deadline_timer_service.hpp> +#include <boost/asio/detail/array.hpp> #include <boost/asio/detail/throw_error.hpp> #include <boost/asio/io_service.hpp> #include <boost/asio/stream_socket_service.hpp> +#include <boost/asio/time_traits.hpp> -#if !defined(BOOST_ASIO_SOCKET_STREAMBUF_MAX_ARITY) -#define BOOST_ASIO_SOCKET_STREAMBUF_MAX_ARITY 5 -#endif // !defined(BOOST_ASIO_SOCKET_STREAMBUF_MAX_ARITY) +#include <boost/asio/detail/push_options.hpp> +#include <boost/date_time/posix_time/posix_time_types.hpp> +#include <boost/asio/detail/pop_options.hpp> + +#if !defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) + +# include <boost/preprocessor/arithmetic/inc.hpp> +# include <boost/preprocessor/repetition/enum_binary_params.hpp> +# include <boost/preprocessor/repetition/enum_params.hpp> +# include <boost/preprocessor/repetition/repeat_from_to.hpp> + +# if !defined(BOOST_ASIO_SOCKET_STREAMBUF_MAX_ARITY) +# define BOOST_ASIO_SOCKET_STREAMBUF_MAX_ARITY 5 +# endif // !defined(BOOST_ASIO_SOCKET_STREAMBUF_MAX_ARITY) // A macro that should expand to: // template <typename T1, ..., typename Tn> -// basic_socket_streambuf<Protocol, StreamSocketService>* connect( +// basic_socket_streambuf<Protocol, StreamSocketService, +// Time, TimeTraits, TimerService>* connect( // T1 x1, ..., Tn xn) // { // init_buffers(); -// boost::system::error_code ec; -// this->basic_socket<Protocol, StreamSocketService>::close(ec); +// this->basic_socket<Protocol, StreamSocketService>::close(ec_); // typedef typename Protocol::resolver resolver_type; // typedef typename resolver_type::query resolver_query; // resolver_query query(x1, ..., xn); -// resolve_and_connect(query, ec); -// return !ec ? this : 0; +// resolve_and_connect(query); +// return !ec_ ? this : 0; // } // This macro should only persist within this file. -#define BOOST_ASIO_PRIVATE_CONNECT_DEF( z, n, data ) \ +# define BOOST_ASIO_PRIVATE_CONNECT_DEF( z, n, data ) \ template <BOOST_PP_ENUM_PARAMS(n, typename T)> \ - basic_socket_streambuf<Protocol, StreamSocketService>* connect( \ + basic_socket_streambuf<Protocol, StreamSocketService, \ + Time, TimeTraits, TimerService>* connect( \ BOOST_PP_ENUM_BINARY_PARAMS(n, T, x)) \ { \ init_buffers(); \ - boost::system::error_code ec; \ - this->basic_socket<Protocol, StreamSocketService>::close(ec); \ + this->basic_socket<Protocol, StreamSocketService>::close(ec_); \ typedef typename Protocol::resolver resolver_type; \ typedef typename resolver_type::query resolver_query; \ resolver_query query(BOOST_PP_ENUM_PARAMS(n, x)); \ - resolve_and_connect(query, ec); \ - return !ec ? this : 0; \ + resolve_and_connect(query); \ + return !ec_ ? this : 0; \ } \ /**/ +#endif // !defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) + #include <boost/asio/detail/push_options.hpp> namespace boost { @@ -74,7 +85,10 @@ namespace asio { /// Iostream streambuf for a socket. template <typename Protocol, - typename StreamSocketService = stream_socket_service<Protocol> > + typename StreamSocketService = stream_socket_service<Protocol>, + typename Time = boost::posix_time::ptime, + typename TimeTraits = boost::asio::time_traits<Time>, + typename TimerService = deadline_timer_service<Time, TimeTraits> > class basic_socket_streambuf : public std::streambuf, private boost::base_from_member<io_service>, @@ -84,11 +98,19 @@ public: /// The endpoint type. typedef typename Protocol::endpoint endpoint_type; + /// The time type. + typedef typename TimeTraits::time_type time_type; + + /// The duration type. + typedef typename TimeTraits::duration_type duration_type; + /// Construct a basic_socket_streambuf without establishing a connection. basic_socket_streambuf() : basic_socket<Protocol, StreamSocketService>( boost::base_from_member<boost::asio::io_service>::member), - unbuffered_(false) + unbuffered_(false), + timer_service_(0), + timer_state_(no_timer) { init_buffers(); } @@ -98,6 +120,8 @@ public: { if (pptr() != pbase()) overflow(traits_type::eof()); + + destroy_timer(); } /// Establish a connection. @@ -107,14 +131,30 @@ public: * @return \c this if a connection was successfully established, a null * pointer otherwise. */ - basic_socket_streambuf<Protocol, StreamSocketService>* connect( + basic_socket_streambuf<Protocol, StreamSocketService, + Time, TimeTraits, TimerService>* connect( const endpoint_type& endpoint) { init_buffers(); - boost::system::error_code ec; - this->basic_socket<Protocol, StreamSocketService>::close(ec); - this->basic_socket<Protocol, StreamSocketService>::connect(endpoint, ec); - return !ec ? this : 0; + + this->basic_socket<Protocol, StreamSocketService>::close(ec_); + + if (timer_state_ == timer_has_expired) + { + ec_ = boost::asio::error::operation_aborted; + return 0; + } + + io_handler handler = { this }; + this->basic_socket<Protocol, StreamSocketService>::async_connect( + endpoint, handler); + + ec_ = boost::asio::error::would_block; + this->get_service().get_io_service().reset(); + do this->get_service().get_io_service().run_one(); + while (ec_ == boost::asio::error::would_block); + + return !ec_ ? this : 0; } #if defined(GENERATING_DOCUMENTATION) @@ -130,6 +170,19 @@ public: template <typename T1, ..., typename TN> basic_socket_streambuf<Protocol, StreamSocketService>* connect( T1 t1, ..., TN tn); +#elif defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) + template <typename... T> + basic_socket_streambuf<Protocol, StreamSocketService, + Time, TimeTraits, TimerService>* connect(T... x) + { + init_buffers(); + this->basic_socket<Protocol, StreamSocketService>::close(ec_); + typedef typename Protocol::resolver resolver_type; + typedef typename resolver_type::query resolver_query; + resolver_query query(x...); + resolve_and_connect(query); + return !ec_ ? this : 0; + } #else BOOST_PP_REPEAT_FROM_TO( 1, BOOST_PP_INC(BOOST_ASIO_SOCKET_STREAMBUF_MAX_ARITY), @@ -141,14 +194,85 @@ public: * @return \c this if a connection was successfully established, a null * pointer otherwise. */ - basic_socket_streambuf<Protocol, StreamSocketService>* close() + basic_socket_streambuf<Protocol, StreamSocketService, + Time, TimeTraits, TimerService>* close() { - boost::system::error_code ec; sync(); - this->basic_socket<Protocol, StreamSocketService>::close(ec); - if (!ec) + this->basic_socket<Protocol, StreamSocketService>::close(ec_); + if (!ec_) init_buffers(); - return !ec ? this : 0; + return !ec_ ? this : 0; + } + + /// Get the last error associated with the stream buffer. + /** + * @return An \c error_code corresponding to the last error from the stream + * buffer. + */ + const boost::system::error_code& puberror() const + { + return error(); + } + + /// Get the stream buffer's expiry time as an absolute time. + /** + * @return An absolute time value representing the stream buffer's expiry + * time. + */ + time_type expires_at() const + { + return timer_service_ + ? timer_service_->expires_at(timer_implementation_) + : time_type(); + } + + /// Set the stream buffer's expiry time as an absolute time. + /** + * This function sets the expiry time associated with the stream. Stream + * operations performed after this time (where the operations cannot be + * completed using the internal buffers) will fail with the error + * boost::asio::error::operation_aborted. + * + * @param expiry_time The expiry time to be used for the stream. + */ + void expires_at(const time_type& expiry_time) + { + construct_timer(); + + boost::system::error_code ec; + timer_service_->expires_at(timer_implementation_, expiry_time, ec); + boost::asio::detail::throw_error(ec, "expires_at"); + + start_timer(); + } + + /// Get the stream buffer's expiry time relative to now. + /** + * @return A relative time value representing the stream buffer's expiry time. + */ + duration_type expires_from_now() const + { + return TimeTraits::subtract(expires_at(), TimeTraits::now()); + } + + /// Set the stream buffer's expiry time relative to now. + /** + * This function sets the expiry time associated with the stream. Stream + * operations performed after this time (where the operations cannot be + * completed using the internal buffers) will fail with the error + * boost::asio::error::operation_aborted. + * + * @param expiry_time The expiry time to be used for the timer. + */ + void expires_from_now(const duration_type& expiry_time) + { + construct_timer(); + + boost::system::error_code ec; + timer_service_->expires_from_now(timer_implementation_, expiry_time, ec); + boost::asio::detail::throw_error(ec, "expires_from_now"); + + start_timer(); } protected: @@ -156,15 +280,26 @@ protected: { if (gptr() == egptr()) { - boost::system::error_code ec; - std::size_t bytes_transferred = this->service.receive( - this->implementation, + if (timer_state_ == timer_has_expired) + { + ec_ = boost::asio::error::operation_aborted; + return traits_type::eof(); + } + + io_handler handler = { this }; + this->get_service().async_receive(this->get_implementation(), boost::asio::buffer(boost::asio::buffer(get_buffer_) + putback_max), - 0, ec); - if (ec) + 0, handler); + + ec_ = boost::asio::error::would_block; + this->get_service().get_io_service().reset(); + do this->get_service().get_io_service().run_one(); + while (ec_ == boost::asio::error::would_block); + if (ec_) return traits_type::eof(); - setg(get_buffer_.begin(), get_buffer_.begin() + putback_max, - get_buffer_.begin() + putback_max + bytes_transferred); + + setg(&get_buffer_[0], &get_buffer_[0] + putback_max, + &get_buffer_[0] + putback_max + bytes_transferred_); return traits_type::to_int_type(*gptr()); } else @@ -184,13 +319,25 @@ protected: } else { + if (timer_state_ == timer_has_expired) + { + ec_ = boost::asio::error::operation_aborted; + return traits_type::eof(); + } + // Send the single character immediately. - boost::system::error_code ec; char_type ch = traits_type::to_char_type(c); - this->service.send(this->implementation, - boost::asio::buffer(&ch, sizeof(char_type)), 0, ec); - if (ec) + io_handler handler = { this }; + this->get_service().async_send(this->get_implementation(), + boost::asio::buffer(&ch, sizeof(char_type)), 0, handler); + + ec_ = boost::asio::error::would_block; + this->get_service().get_io_service().reset(); + do this->get_service().get_io_service().run_one(); + while (ec_ == boost::asio::error::would_block); + if (ec_) return traits_type::eof(); + return c; } } @@ -201,15 +348,26 @@ protected: boost::asio::buffer(pbase(), pptr() - pbase()); while (boost::asio::buffer_size(buffer) > 0) { - boost::system::error_code ec; - std::size_t bytes_transferred = this->service.send( - this->implementation, boost::asio::buffer(buffer), - 0, ec); - if (ec) + if (timer_state_ == timer_has_expired) + { + ec_ = boost::asio::error::operation_aborted; + return traits_type::eof(); + } + + io_handler handler = { this }; + this->get_service().async_send(this->get_implementation(), + boost::asio::buffer(buffer), 0, handler); + + ec_ = boost::asio::error::would_block; + this->get_service().get_io_service().reset(); + do this->get_service().get_io_service().run_one(); + while (ec_ == boost::asio::error::would_block); + if (ec_) return traits_type::eof(); - buffer = buffer + bytes_transferred; + + buffer = buffer + bytes_transferred_; } - setp(put_buffer_.begin(), put_buffer_.end()); + setp(&put_buffer_[0], &put_buffer_[0] + put_buffer_.size()); // If the new character is eof then our work here is done. if (traits_type::eq_int_type(c, traits_type::eof())) @@ -239,45 +397,141 @@ protected: return 0; } + /// Get the last error associated with the stream buffer. + /** + * @return An \c error_code corresponding to the last error from the stream + * buffer. + */ + virtual const boost::system::error_code& error() const + { + return ec_; + } + private: void init_buffers() { - setg(get_buffer_.begin(), - get_buffer_.begin() + putback_max, - get_buffer_.begin() + putback_max); + setg(&get_buffer_[0], + &get_buffer_[0] + putback_max, + &get_buffer_[0] + putback_max); if (unbuffered_) setp(0, 0); else - setp(put_buffer_.begin(), put_buffer_.end()); + setp(&put_buffer_[0], &put_buffer_[0] + put_buffer_.size()); } template <typename ResolverQuery> - void resolve_and_connect(const ResolverQuery& query, - boost::system::error_code& ec) + void resolve_and_connect(const ResolverQuery& query) { typedef typename Protocol::resolver resolver_type; typedef typename resolver_type::iterator iterator_type; resolver_type resolver( boost::base_from_member<boost::asio::io_service>::member); - iterator_type i = resolver.resolve(query, ec); - if (!ec) + iterator_type i = resolver.resolve(query, ec_); + if (!ec_) { iterator_type end; - ec = boost::asio::error::host_not_found; - while (ec && i != end) + ec_ = boost::asio::error::host_not_found; + while (ec_ && i != end) { - this->basic_socket<Protocol, StreamSocketService>::close(); - this->basic_socket<Protocol, StreamSocketService>::connect(*i, ec); + this->basic_socket<Protocol, StreamSocketService>::close(ec_); + + if (timer_state_ == timer_has_expired) + { + ec_ = boost::asio::error::operation_aborted; + return; + } + + io_handler handler = { this }; + this->basic_socket<Protocol, StreamSocketService>::async_connect( + *i, handler); + + ec_ = boost::asio::error::would_block; + this->get_service().get_io_service().reset(); + do this->get_service().get_io_service().run_one(); + while (ec_ == boost::asio::error::would_block); + ++i; } } } + struct io_handler; + friend struct io_handler; + struct io_handler + { + basic_socket_streambuf* this_; + + void operator()(const boost::system::error_code& ec, + std::size_t bytes_transferred = 0) + { + this_->ec_ = ec; + this_->bytes_transferred_ = bytes_transferred; + } + }; + + struct timer_handler; + friend struct timer_handler; + struct timer_handler + { + basic_socket_streambuf* this_; + + void operator()(const boost::system::error_code&) + { + time_type now = TimeTraits::now(); + + time_type expiry_time = this_->timer_service_->expires_at( + this_->timer_implementation_); + + if (TimeTraits::less_than(now, expiry_time)) + { + this_->timer_state_ = timer_is_pending; + this_->timer_service_->async_wait(this_->timer_implementation_, *this); + } + else + { + this_->timer_state_ = timer_has_expired; + boost::system::error_code ec; + this_->basic_socket<Protocol, StreamSocketService>::close(ec); + } + } + }; + + void construct_timer() + { + if (timer_service_ == 0) + { + TimerService& timer_service = use_service<TimerService>( + boost::base_from_member<boost::asio::io_service>::member); + timer_service.construct(timer_implementation_); + timer_service_ = &timer_service; + } + } + + void destroy_timer() + { + if (timer_service_) + timer_service_->destroy(timer_implementation_); + } + + void start_timer() + { + if (timer_state_ != timer_is_pending) + { + timer_handler handler = { this }; + handler(boost::system::error_code()); + } + } + enum { putback_max = 8 }; enum { buffer_size = 512 }; - boost::array<char, buffer_size> get_buffer_; - boost::array<char, buffer_size> put_buffer_; + boost::asio::detail::array<char, buffer_size> get_buffer_; + boost::asio::detail::array<char, buffer_size> put_buffer_; bool unbuffered_; + boost::system::error_code ec_; + std::size_t bytes_transferred_; + TimerService* timer_service_; + typename TimerService::implementation_type timer_implementation_; + enum state { no_timer, timer_is_pending, timer_has_expired } timer_state_; }; } // namespace asio @@ -285,7 +539,9 @@ private: #include <boost/asio/detail/pop_options.hpp> -#undef BOOST_ASIO_PRIVATE_CONNECT_DEF +#if !defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) +# undef BOOST_ASIO_PRIVATE_CONNECT_DEF +#endif // !defined(BOOST_ASIO_HAS_VARIADIC_TEMPLATES) #endif // !defined(BOOST_NO_IOSTREAM) diff --git a/3rdParty/Boost/src/boost/asio/basic_stream_socket.hpp b/3rdParty/Boost/src/boost/asio/basic_stream_socket.hpp index 87bd035..010f0aa 100644 --- a/3rdParty/Boost/src/boost/asio/basic_stream_socket.hpp +++ b/3rdParty/Boost/src/boost/asio/basic_stream_socket.hpp @@ -2,7 +2,7 @@ // basic_stream_socket.hpp // ~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -18,6 +18,7 @@ #include <boost/asio/detail/config.hpp> #include <cstddef> #include <boost/asio/basic_socket.hpp> +#include <boost/asio/detail/handler_type_requirements.hpp> #include <boost/asio/detail/throw_error.hpp> #include <boost/asio/error.hpp> #include <boost/asio/stream_socket_service.hpp> @@ -45,8 +46,12 @@ class basic_stream_socket : public basic_socket<Protocol, StreamSocketService> { public: + /// (Deprecated: Use native_handle_type.) The native representation of a + /// socket. + typedef typename StreamSocketService::native_handle_type native_type; + /// The native representation of a socket. - typedef typename StreamSocketService::native_type native_type; + typedef typename StreamSocketService::native_handle_type native_handle_type; /// The protocol type. typedef Protocol protocol_type; @@ -122,12 +127,47 @@ public: * @throws boost::system::system_error Thrown on failure. */ basic_stream_socket(boost::asio::io_service& io_service, - const protocol_type& protocol, const native_type& native_socket) + const protocol_type& protocol, const native_handle_type& native_socket) : basic_socket<Protocol, StreamSocketService>( io_service, protocol, native_socket) { } +#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Move-construct a basic_stream_socket from another. + /** + * This constructor moves a stream socket from one object to another. + * + * @param other The other basic_stream_socket object from which the move + * will occur. + * + * @note Following the move, the moved-from object is in the same state as if + * constructed using the @c basic_stream_socket(io_service&) constructor. + */ + basic_stream_socket(basic_stream_socket&& other) + : basic_socket<Protocol, StreamSocketService>( + BOOST_ASIO_MOVE_CAST(basic_stream_socket)(other)) + { + } + + /// Move-assign a basic_stream_socket from another. + /** + * This assignment operator moves a stream socket from one object to another. + * + * @param other The other basic_stream_socket object from which the move + * will occur. + * + * @note Following the move, the moved-from object is in the same state as if + * constructed using the @c basic_stream_socket(io_service&) constructor. + */ + basic_stream_socket& operator=(basic_stream_socket&& other) + { + basic_socket<Protocol, StreamSocketService>::operator=( + BOOST_ASIO_MOVE_CAST(basic_stream_socket)(other)); + return *this; + } +#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Send some data on the socket. /** * This function is used to send data on the stream socket. The function @@ -157,9 +197,9 @@ public: std::size_t send(const ConstBufferSequence& buffers) { boost::system::error_code ec; - std::size_t s = this->service.send( - this->implementation, buffers, 0, ec); - boost::asio::detail::throw_error(ec); + std::size_t s = this->get_service().send( + this->get_implementation(), buffers, 0, ec); + boost::asio::detail::throw_error(ec, "send"); return s; } @@ -195,9 +235,9 @@ public: socket_base::message_flags flags) { boost::system::error_code ec; - std::size_t s = this->service.send( - this->implementation, buffers, flags, ec); - boost::asio::detail::throw_error(ec); + std::size_t s = this->get_service().send( + this->get_implementation(), buffers, flags, ec); + boost::asio::detail::throw_error(ec, "send"); return s; } @@ -223,7 +263,8 @@ public: std::size_t send(const ConstBufferSequence& buffers, socket_base::message_flags flags, boost::system::error_code& ec) { - return this->service.send(this->implementation, buffers, flags, ec); + return this->get_service().send( + this->get_implementation(), buffers, flags, ec); } /// Start an asynchronous send. @@ -262,9 +303,15 @@ public: * std::vector. */ template <typename ConstBufferSequence, typename WriteHandler> - void async_send(const ConstBufferSequence& buffers, WriteHandler handler) + void async_send(const ConstBufferSequence& buffers, + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { - this->service.async_send(this->implementation, buffers, 0, handler); + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a WriteHandler. + BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; + + this->get_service().async_send(this->get_implementation(), buffers, 0, + BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); } /// Start an asynchronous send. @@ -306,9 +353,15 @@ public: */ template <typename ConstBufferSequence, typename WriteHandler> void async_send(const ConstBufferSequence& buffers, - socket_base::message_flags flags, WriteHandler handler) + socket_base::message_flags flags, + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { - this->service.async_send(this->implementation, buffers, flags, handler); + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a WriteHandler. + BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; + + this->get_service().async_send(this->get_implementation(), buffers, flags, + BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); } /// Receive some data on the socket. @@ -343,8 +396,9 @@ public: std::size_t receive(const MutableBufferSequence& buffers) { boost::system::error_code ec; - std::size_t s = this->service.receive(this->implementation, buffers, 0, ec); - boost::asio::detail::throw_error(ec); + std::size_t s = this->get_service().receive( + this->get_implementation(), buffers, 0, ec); + boost::asio::detail::throw_error(ec, "receive"); return s; } @@ -383,9 +437,9 @@ public: socket_base::message_flags flags) { boost::system::error_code ec; - std::size_t s = this->service.receive( - this->implementation, buffers, flags, ec); - boost::asio::detail::throw_error(ec); + std::size_t s = this->get_service().receive( + this->get_implementation(), buffers, flags, ec); + boost::asio::detail::throw_error(ec, "receive"); return s; } @@ -411,7 +465,8 @@ public: std::size_t receive(const MutableBufferSequence& buffers, socket_base::message_flags flags, boost::system::error_code& ec) { - return this->service.receive(this->implementation, buffers, flags, ec); + return this->get_service().receive( + this->get_implementation(), buffers, flags, ec); } /// Start an asynchronous receive. @@ -452,9 +507,15 @@ public: * std::vector. */ template <typename MutableBufferSequence, typename ReadHandler> - void async_receive(const MutableBufferSequence& buffers, ReadHandler handler) + void async_receive(const MutableBufferSequence& buffers, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { - this->service.async_receive(this->implementation, buffers, 0, handler); + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a ReadHandler. + BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; + + this->get_service().async_receive(this->get_implementation(), + buffers, 0, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); } /// Start an asynchronous receive. @@ -498,9 +559,15 @@ public: */ template <typename MutableBufferSequence, typename ReadHandler> void async_receive(const MutableBufferSequence& buffers, - socket_base::message_flags flags, ReadHandler handler) + socket_base::message_flags flags, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { - this->service.async_receive(this->implementation, buffers, flags, handler); + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a ReadHandler. + BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; + + this->get_service().async_receive(this->get_implementation(), + buffers, flags, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); } /// Write some data to the socket. @@ -534,8 +601,9 @@ public: std::size_t write_some(const ConstBufferSequence& buffers) { boost::system::error_code ec; - std::size_t s = this->service.send(this->implementation, buffers, 0, ec); - boost::asio::detail::throw_error(ec); + std::size_t s = this->get_service().send( + this->get_implementation(), buffers, 0, ec); + boost::asio::detail::throw_error(ec, "write_some"); return s; } @@ -559,7 +627,7 @@ public: std::size_t write_some(const ConstBufferSequence& buffers, boost::system::error_code& ec) { - return this->service.send(this->implementation, buffers, 0, ec); + return this->get_service().send(this->get_implementation(), buffers, 0, ec); } /// Start an asynchronous write. @@ -599,9 +667,14 @@ public: */ template <typename ConstBufferSequence, typename WriteHandler> void async_write_some(const ConstBufferSequence& buffers, - WriteHandler handler) + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { - this->service.async_send(this->implementation, buffers, 0, handler); + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a WriteHandler. + BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; + + this->get_service().async_send(this->get_implementation(), + buffers, 0, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); } /// Read some data from the socket. @@ -636,8 +709,9 @@ public: std::size_t read_some(const MutableBufferSequence& buffers) { boost::system::error_code ec; - std::size_t s = this->service.receive(this->implementation, buffers, 0, ec); - boost::asio::detail::throw_error(ec); + std::size_t s = this->get_service().receive( + this->get_implementation(), buffers, 0, ec); + boost::asio::detail::throw_error(ec, "read_some"); return s; } @@ -662,7 +736,8 @@ public: std::size_t read_some(const MutableBufferSequence& buffers, boost::system::error_code& ec) { - return this->service.receive(this->implementation, buffers, 0, ec); + return this->get_service().receive( + this->get_implementation(), buffers, 0, ec); } /// Start an asynchronous read. @@ -703,9 +778,14 @@ public: */ template <typename MutableBufferSequence, typename ReadHandler> void async_read_some(const MutableBufferSequence& buffers, - ReadHandler handler) + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { - this->service.async_receive(this->implementation, buffers, 0, handler); + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a ReadHandler. + BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; + + this->get_service().async_receive(this->get_implementation(), + buffers, 0, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); } }; diff --git a/3rdParty/Boost/src/boost/asio/basic_streambuf.hpp b/3rdParty/Boost/src/boost/asio/basic_streambuf.hpp index 7a04c69..e77624b 100644 --- a/3rdParty/Boost/src/boost/asio/basic_streambuf.hpp +++ b/3rdParty/Boost/src/boost/asio/basic_streambuf.hpp @@ -2,7 +2,7 @@ // basic_streambuf.hpp // ~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -130,9 +130,9 @@ public: * of the streambuf's input sequence is 0. */ explicit basic_streambuf( - std::size_t max_size = (std::numeric_limits<std::size_t>::max)(), + std::size_t maximum_size = (std::numeric_limits<std::size_t>::max)(), const Allocator& allocator = Allocator()) - : max_size_(max_size), + : max_size_(maximum_size), buffer_(allocator) { std::size_t pend = (std::min<std::size_t>)(max_size_, buffer_delta); diff --git a/3rdParty/Boost/src/boost/asio/basic_streambuf_fwd.hpp b/3rdParty/Boost/src/boost/asio/basic_streambuf_fwd.hpp index a7d82d3..ca806ea 100644 --- a/3rdParty/Boost/src/boost/asio/basic_streambuf_fwd.hpp +++ b/3rdParty/Boost/src/boost/asio/basic_streambuf_fwd.hpp @@ -2,7 +2,7 @@ // basic_streambuf_fwd.hpp // ~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/basic_waitable_timer.hpp b/3rdParty/Boost/src/boost/asio/basic_waitable_timer.hpp new file mode 100644 index 0000000..d957bde --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/basic_waitable_timer.hpp @@ -0,0 +1,518 @@ +// +// basic_waitable_timer.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) +// + +#ifndef BOOST_ASIO_BASIC_WAITABLE_TIMER_HPP +#define BOOST_ASIO_BASIC_WAITABLE_TIMER_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> +#include <cstddef> +#include <boost/asio/basic_io_object.hpp> +#include <boost/asio/detail/handler_type_requirements.hpp> +#include <boost/asio/detail/throw_error.hpp> +#include <boost/asio/error.hpp> +#include <boost/asio/wait_traits.hpp> +#include <boost/asio/waitable_timer_service.hpp> + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { + +/// Provides waitable timer functionality. +/** + * The basic_waitable_timer class template provides the ability to perform a + * blocking or asynchronous wait for a timer to expire. + * + * A waitable timer is always in one of two states: "expired" or "not expired". + * If the wait() or async_wait() function is called on an expired timer, the + * wait operation will complete immediately. + * + * Most applications will use the boost::asio::waitable_timer typedef. + * + * @note This waitable timer functionality is for use with the C++11 standard + * library's @c <chrono> facility, or with the Boost.Chrono library. + * + * @par Thread Safety + * @e Distinct @e objects: Safe.@n + * @e Shared @e objects: Unsafe. + * + * @par Examples + * Performing a blocking wait: + * @code + * // Construct a timer without setting an expiry time. + * boost::asio::waitable_timer timer(io_service); + * + * // Set an expiry time relative to now. + * timer.expires_from_now(boost::posix_time::seconds(5)); + * + * // Wait for the timer to expire. + * timer.wait(); + * @endcode + * + * @par + * Performing an asynchronous wait: + * @code + * void handler(const boost::system::error_code& error) + * { + * if (!error) + * { + * // Timer expired. + * } + * } + * + * ... + * + * // Construct a timer with an absolute expiry time. + * boost::asio::waitable_timer timer(io_service, + * boost::posix_time::time_from_string("2005-12-07 23:59:59.000")); + * + * // Start an asynchronous wait. + * timer.async_wait(handler); + * @endcode + * + * @par Changing an active waitable_timer's expiry time + * + * Changing the expiry time of a timer while there are pending asynchronous + * waits causes those wait operations to be cancelled. To ensure that the action + * associated with the timer is performed only once, use something like this: + * used: + * + * @code + * void on_some_event() + * { + * if (my_timer.expires_from_now(seconds(5)) > 0) + * { + * // We managed to cancel the timer. Start new asynchronous wait. + * my_timer.async_wait(on_timeout); + * } + * else + * { + * // Too late, timer has already expired! + * } + * } + * + * void on_timeout(const boost::system::error_code& e) + * { + * if (e != boost::asio::error::operation_aborted) + * { + * // Timer was not cancelled, take necessary action. + * } + * } + * @endcode + * + * @li The boost::asio::basic_waitable_timer::expires_from_now() function + * cancels any pending asynchronous waits, and returns the number of + * asynchronous waits that were cancelled. If it returns 0 then you were too + * late and the wait handler has already been executed, or will soon be + * executed. If it returns 1 then the wait handler was successfully cancelled. + * + * @li If a wait handler is cancelled, the boost::system::error_code passed to + * it contains the value boost::asio::error::operation_aborted. + */ +template <typename Clock, + typename WaitTraits = boost::asio::wait_traits<Clock>, + typename WaitableTimerService = waitable_timer_service<Clock, WaitTraits> > +class basic_waitable_timer + : public basic_io_object<WaitableTimerService> +{ +public: + /// The clock type. + typedef Clock clock_type; + + /// The duration type of the clock. + typedef typename clock_type::duration duration; + + /// The time point type of the clock. + typedef typename clock_type::time_point time_point; + + /// The wait traits type. + typedef WaitTraits traits_type; + + /// Constructor. + /** + * This constructor creates a timer without setting an expiry time. The + * expires_at() or expires_from_now() functions must be called to set an + * expiry time before the timer can be waited on. + * + * @param io_service The io_service object that the timer will use to dispatch + * handlers for any asynchronous operations performed on the timer. + */ + explicit basic_waitable_timer(boost::asio::io_service& io_service) + : basic_io_object<WaitableTimerService>(io_service) + { + } + + /// Constructor to set a particular expiry time as an absolute time. + /** + * This constructor creates a timer and sets the expiry time. + * + * @param io_service The io_service object that the timer will use to dispatch + * handlers for any asynchronous operations performed on the timer. + * + * @param expiry_time The expiry time to be used for the timer, expressed + * as an absolute time. + */ + basic_waitable_timer(boost::asio::io_service& io_service, + const time_point& expiry_time) + : basic_io_object<WaitableTimerService>(io_service) + { + boost::system::error_code ec; + this->service.expires_at(this->implementation, expiry_time, ec); + boost::asio::detail::throw_error(ec, "expires_at"); + } + + /// Constructor to set a particular expiry time relative to now. + /** + * This constructor creates a timer and sets the expiry time. + * + * @param io_service The io_service object that the timer will use to dispatch + * handlers for any asynchronous operations performed on the timer. + * + * @param expiry_time The expiry time to be used for the timer, relative to + * now. + */ + basic_waitable_timer(boost::asio::io_service& io_service, + const duration& expiry_time) + : basic_io_object<WaitableTimerService>(io_service) + { + boost::system::error_code ec; + this->service.expires_from_now(this->implementation, expiry_time, ec); + boost::asio::detail::throw_error(ec, "expires_from_now"); + } + + /// Cancel any asynchronous operations that are waiting on the timer. + /** + * This function forces the completion of any pending asynchronous wait + * operations against the timer. The handler for each cancelled operation will + * be invoked with the boost::asio::error::operation_aborted error code. + * + * Cancelling the timer does not change the expiry time. + * + * @return The number of asynchronous operations that were cancelled. + * + * @throws boost::system::system_error Thrown on failure. + * + * @note If the timer has already expired when cancel() is called, then the + * handlers for asynchronous wait operations will: + * + * @li have already been invoked; or + * + * @li have been queued for invocation in the near future. + * + * These handlers can no longer be cancelled, and therefore are passed an + * error code that indicates the successful completion of the wait operation. + */ + std::size_t cancel() + { + boost::system::error_code ec; + std::size_t s = this->service.cancel(this->implementation, ec); + boost::asio::detail::throw_error(ec, "cancel"); + return s; + } + + /// Cancel any asynchronous operations that are waiting on the timer. + /** + * This function forces the completion of any pending asynchronous wait + * operations against the timer. The handler for each cancelled operation will + * be invoked with the boost::asio::error::operation_aborted error code. + * + * Cancelling the timer does not change the expiry time. + * + * @param ec Set to indicate what error occurred, if any. + * + * @return The number of asynchronous operations that were cancelled. + * + * @note If the timer has already expired when cancel() is called, then the + * handlers for asynchronous wait operations will: + * + * @li have already been invoked; or + * + * @li have been queued for invocation in the near future. + * + * These handlers can no longer be cancelled, and therefore are passed an + * error code that indicates the successful completion of the wait operation. + */ + std::size_t cancel(boost::system::error_code& ec) + { + return this->service.cancel(this->implementation, ec); + } + + /// Cancels one asynchronous operation that is waiting on the timer. + /** + * This function forces the completion of one pending asynchronous wait + * operation against the timer. Handlers are cancelled in FIFO order. The + * handler for the cancelled operation will be invoked with the + * boost::asio::error::operation_aborted error code. + * + * Cancelling the timer does not change the expiry time. + * + * @return The number of asynchronous operations that were cancelled. That is, + * either 0 or 1. + * + * @throws boost::system::system_error Thrown on failure. + * + * @note If the timer has already expired when cancel_one() is called, then + * the handlers for asynchronous wait operations will: + * + * @li have already been invoked; or + * + * @li have been queued for invocation in the near future. + * + * These handlers can no longer be cancelled, and therefore are passed an + * error code that indicates the successful completion of the wait operation. + */ + std::size_t cancel_one() + { + boost::system::error_code ec; + std::size_t s = this->service.cancel_one(this->implementation, ec); + boost::asio::detail::throw_error(ec, "cancel_one"); + return s; + } + + /// Cancels one asynchronous operation that is waiting on the timer. + /** + * This function forces the completion of one pending asynchronous wait + * operation against the timer. Handlers are cancelled in FIFO order. The + * handler for the cancelled operation will be invoked with the + * boost::asio::error::operation_aborted error code. + * + * Cancelling the timer does not change the expiry time. + * + * @param ec Set to indicate what error occurred, if any. + * + * @return The number of asynchronous operations that were cancelled. That is, + * either 0 or 1. + * + * @note If the timer has already expired when cancel_one() is called, then + * the handlers for asynchronous wait operations will: + * + * @li have already been invoked; or + * + * @li have been queued for invocation in the near future. + * + * These handlers can no longer be cancelled, and therefore are passed an + * error code that indicates the successful completion of the wait operation. + */ + std::size_t cancel_one(boost::system::error_code& ec) + { + return this->service.cancel_one(this->implementation, ec); + } + + /// Get the timer's expiry time as an absolute time. + /** + * This function may be used to obtain the timer's current expiry time. + * Whether the timer has expired or not does not affect this value. + */ + time_point expires_at() const + { + return this->service.expires_at(this->implementation); + } + + /// Set the timer's expiry time as an absolute time. + /** + * This function sets the expiry time. Any pending asynchronous wait + * operations will be cancelled. The handler for each cancelled operation will + * be invoked with the boost::asio::error::operation_aborted error code. + * + * @param expiry_time The expiry time to be used for the timer. + * + * @return The number of asynchronous operations that were cancelled. + * + * @throws boost::system::system_error Thrown on failure. + * + * @note If the timer has already expired when expires_at() is called, then + * the handlers for asynchronous wait operations will: + * + * @li have already been invoked; or + * + * @li have been queued for invocation in the near future. + * + * These handlers can no longer be cancelled, and therefore are passed an + * error code that indicates the successful completion of the wait operation. + */ + std::size_t expires_at(const time_point& expiry_time) + { + boost::system::error_code ec; + std::size_t s = this->service.expires_at( + this->implementation, expiry_time, ec); + boost::asio::detail::throw_error(ec, "expires_at"); + return s; + } + + /// Set the timer's expiry time as an absolute time. + /** + * This function sets the expiry time. Any pending asynchronous wait + * operations will be cancelled. The handler for each cancelled operation will + * be invoked with the boost::asio::error::operation_aborted error code. + * + * @param expiry_time The expiry time to be used for the timer. + * + * @param ec Set to indicate what error occurred, if any. + * + * @return The number of asynchronous operations that were cancelled. + * + * @note If the timer has already expired when expires_at() is called, then + * the handlers for asynchronous wait operations will: + * + * @li have already been invoked; or + * + * @li have been queued for invocation in the near future. + * + * These handlers can no longer be cancelled, and therefore are passed an + * error code that indicates the successful completion of the wait operation. + */ + std::size_t expires_at(const time_point& expiry_time, + boost::system::error_code& ec) + { + return this->service.expires_at(this->implementation, expiry_time, ec); + } + + /// Get the timer's expiry time relative to now. + /** + * This function may be used to obtain the timer's current expiry time. + * Whether the timer has expired or not does not affect this value. + */ + duration expires_from_now() const + { + return this->service.expires_from_now(this->implementation); + } + + /// Set the timer's expiry time relative to now. + /** + * This function sets the expiry time. Any pending asynchronous wait + * operations will be cancelled. The handler for each cancelled operation will + * be invoked with the boost::asio::error::operation_aborted error code. + * + * @param expiry_time The expiry time to be used for the timer. + * + * @return The number of asynchronous operations that were cancelled. + * + * @throws boost::system::system_error Thrown on failure. + * + * @note If the timer has already expired when expires_from_now() is called, + * then the handlers for asynchronous wait operations will: + * + * @li have already been invoked; or + * + * @li have been queued for invocation in the near future. + * + * These handlers can no longer be cancelled, and therefore are passed an + * error code that indicates the successful completion of the wait operation. + */ + std::size_t expires_from_now(const duration& expiry_time) + { + boost::system::error_code ec; + std::size_t s = this->service.expires_from_now( + this->implementation, expiry_time, ec); + boost::asio::detail::throw_error(ec, "expires_from_now"); + return s; + } + + /// Set the timer's expiry time relative to now. + /** + * This function sets the expiry time. Any pending asynchronous wait + * operations will be cancelled. The handler for each cancelled operation will + * be invoked with the boost::asio::error::operation_aborted error code. + * + * @param expiry_time The expiry time to be used for the timer. + * + * @param ec Set to indicate what error occurred, if any. + * + * @return The number of asynchronous operations that were cancelled. + * + * @note If the timer has already expired when expires_from_now() is called, + * then the handlers for asynchronous wait operations will: + * + * @li have already been invoked; or + * + * @li have been queued for invocation in the near future. + * + * These handlers can no longer be cancelled, and therefore are passed an + * error code that indicates the successful completion of the wait operation. + */ + std::size_t expires_from_now(const duration& expiry_time, + boost::system::error_code& ec) + { + return this->service.expires_from_now( + this->implementation, expiry_time, ec); + } + + /// Perform a blocking wait on the timer. + /** + * This function is used to wait for the timer to expire. This function + * blocks and does not return until the timer has expired. + * + * @throws boost::system::system_error Thrown on failure. + */ + void wait() + { + boost::system::error_code ec; + this->service.wait(this->implementation, ec); + boost::asio::detail::throw_error(ec, "wait"); + } + + /// Perform a blocking wait on the timer. + /** + * This function is used to wait for the timer to expire. This function + * blocks and does not return until the timer has expired. + * + * @param ec Set to indicate what error occurred, if any. + */ + void wait(boost::system::error_code& ec) + { + this->service.wait(this->implementation, ec); + } + + /// Start an asynchronous wait on the timer. + /** + * This function may be used to initiate an asynchronous wait against the + * timer. It always returns immediately. + * + * For each call to async_wait(), the supplied handler will be called exactly + * once. The handler will be called when: + * + * @li The timer has expired. + * + * @li The timer was cancelled, in which case the handler is passed the error + * code boost::asio::error::operation_aborted. + * + * @param handler The handler to be called when the timer expires. Copies + * will be made of the handler as required. The function signature of the + * handler must be: + * @code void handler( + * const boost::system::error_code& error // Result of operation. + * ); @endcode + * Regardless of whether the asynchronous operation completes immediately or + * not, the handler will not be invoked from within this function. Invocation + * of the handler will be performed in a manner equivalent to using + * boost::asio::io_service::post(). + */ + template <typename WaitHandler> + void async_wait(BOOST_ASIO_MOVE_ARG(WaitHandler) handler) + { + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a WaitHandler. + BOOST_ASIO_WAIT_HANDLER_CHECK(WaitHandler, handler) type_check; + + this->service.async_wait(this->implementation, + BOOST_ASIO_MOVE_CAST(WaitHandler)(handler)); + } +}; + +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#endif // BOOST_ASIO_BASIC_WAITABLE_TIMER_HPP diff --git a/3rdParty/Boost/src/boost/asio/buffer.hpp b/3rdParty/Boost/src/boost/asio/buffer.hpp index 15eaad4..532cfd1 100644 --- a/3rdParty/Boost/src/boost/asio/buffer.hpp +++ b/3rdParty/Boost/src/boost/asio/buffer.hpp @@ -2,7 +2,7 @@ // buffer.hpp // ~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -17,6 +17,7 @@ #include <boost/asio/detail/config.hpp> #include <cstddef> +#include <cstring> #include <string> #include <vector> #include <boost/detail/workaround.hpp> @@ -68,6 +69,19 @@ std::size_t buffer_size_helper(const const_buffer&); * The mutable_buffer class provides a safe representation of a buffer that can * be modified. It does not own the underlying data, and so is cheap to copy or * assign. + * + * @par Accessing Buffer Contents + * + * The contents of a buffer may be accessed using the @ref buffer_size + * and @ref buffer_cast functions: + * + * @code boost::asio::mutable_buffer b1 = ...; + * std::size_t s1 = boost::asio::buffer_size(b1); + * unsigned char* p1 = boost::asio::buffer_cast<unsigned char*>(b1); + * @endcode + * + * The boost::asio::buffer_cast function permits violations of type safety, so + * uses of it in application code should be carefully considered. */ class mutable_buffer { @@ -133,59 +147,6 @@ inline std::size_t buffer_size_helper(const mutable_buffer& b) } // namespace detail -/// Cast a non-modifiable buffer to a specified pointer to POD type. -/** - * @relates mutable_buffer - */ -template <typename PointerToPodType> -inline PointerToPodType buffer_cast(const mutable_buffer& b) -{ - return static_cast<PointerToPodType>(detail::buffer_cast_helper(b)); -} - -/// Get the number of bytes in a non-modifiable buffer. -/** - * @relates mutable_buffer - */ -inline std::size_t buffer_size(const mutable_buffer& b) -{ - return detail::buffer_size_helper(b); -} - -/// Create a new modifiable buffer that is offset from the start of another. -/** - * @relates mutable_buffer - */ -inline mutable_buffer operator+(const mutable_buffer& b, std::size_t start) -{ - if (start > buffer_size(b)) - return mutable_buffer(); - char* new_data = buffer_cast<char*>(b) + start; - std::size_t new_size = buffer_size(b) - start; - return mutable_buffer(new_data, new_size -#if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING) - , b.get_debug_check() -#endif // BOOST_ASIO_ENABLE_BUFFER_DEBUGGING - ); -} - -/// Create a new modifiable buffer that is offset from the start of another. -/** - * @relates mutable_buffer - */ -inline mutable_buffer operator+(std::size_t start, const mutable_buffer& b) -{ - if (start > buffer_size(b)) - return mutable_buffer(); - char* new_data = buffer_cast<char*>(b) + start; - std::size_t new_size = buffer_size(b) - start; - return mutable_buffer(new_data, new_size -#if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING) - , b.get_debug_check() -#endif // BOOST_ASIO_ENABLE_BUFFER_DEBUGGING - ); -} - /// Adapts a single modifiable buffer so that it meets the requirements of the /// MutableBufferSequence concept. class mutable_buffers_1 @@ -228,6 +189,19 @@ public: * The const_buffer class provides a safe representation of a buffer that cannot * be modified. It does not own the underlying data, and so is cheap to copy or * assign. + * + * @par Accessing Buffer Contents + * + * The contents of a buffer may be accessed using the @ref buffer_size + * and @ref buffer_cast functions: + * + * @code boost::asio::const_buffer b1 = ...; + * std::size_t s1 = boost::asio::buffer_size(b1); + * const unsigned char* p1 = boost::asio::buffer_cast<const unsigned char*>(b1); + * @endcode + * + * The boost::asio::buffer_cast function permits violations of type safety, so + * uses of it in application code should be carefully considered. */ class const_buffer { @@ -303,59 +277,6 @@ inline std::size_t buffer_size_helper(const const_buffer& b) } // namespace detail -/// Cast a non-modifiable buffer to a specified pointer to POD type. -/** - * @relates const_buffer - */ -template <typename PointerToPodType> -inline PointerToPodType buffer_cast(const const_buffer& b) -{ - return static_cast<PointerToPodType>(detail::buffer_cast_helper(b)); -} - -/// Get the number of bytes in a non-modifiable buffer. -/** - * @relates const_buffer - */ -inline std::size_t buffer_size(const const_buffer& b) -{ - return detail::buffer_size_helper(b); -} - -/// Create a new non-modifiable buffer that is offset from the start of another. -/** - * @relates const_buffer - */ -inline const_buffer operator+(const const_buffer& b, std::size_t start) -{ - if (start > buffer_size(b)) - return const_buffer(); - const char* new_data = buffer_cast<const char*>(b) + start; - std::size_t new_size = buffer_size(b) - start; - return const_buffer(new_data, new_size -#if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING) - , b.get_debug_check() -#endif // BOOST_ASIO_ENABLE_BUFFER_DEBUGGING - ); -} - -/// Create a new non-modifiable buffer that is offset from the start of another. -/** - * @relates const_buffer - */ -inline const_buffer operator+(std::size_t start, const const_buffer& b) -{ - if (start > buffer_size(b)) - return const_buffer(); - const char* new_data = buffer_cast<const char*>(b) + start; - std::size_t new_size = buffer_size(b) - start; - return const_buffer(new_data, new_size -#if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING) - , b.get_debug_check() -#endif // BOOST_ASIO_ENABLE_BUFFER_DEBUGGING - ); -} - /// Adapts a single non-modifiable buffer so that it meets the requirements of /// the ConstBufferSequence concept. class const_buffers_1 @@ -420,6 +341,163 @@ private: mutable_buffer buf_; }; +/** @defgroup buffer_size boost::asio::buffer_size + * + * @brief The boost::asio::buffer_size function determines the total number of + * bytes in a buffer or buffer sequence. + */ +/*@{*/ + +/// Get the number of bytes in a modifiable buffer. +inline std::size_t buffer_size(const mutable_buffer& b) +{ + return detail::buffer_size_helper(b); +} + +/// Get the number of bytes in a modifiable buffer. +inline std::size_t buffer_size(const mutable_buffers_1& b) +{ + return detail::buffer_size_helper(b); +} + +/// Get the number of bytes in a non-modifiable buffer. +inline std::size_t buffer_size(const const_buffer& b) +{ + return detail::buffer_size_helper(b); +} + +/// Get the number of bytes in a non-modifiable buffer. +inline std::size_t buffer_size(const const_buffers_1& b) +{ + return detail::buffer_size_helper(b); +} + +/// Get the total number of bytes in a buffer sequence. +/** + * The @c BufferSequence template parameter may meet either of the @c + * ConstBufferSequence or @c MutableBufferSequence type requirements. + */ +template <typename BufferSequence> +inline std::size_t buffer_size(const BufferSequence& b) +{ + std::size_t total_buffer_size = 0; + + typename BufferSequence::const_iterator iter = b.begin(); + typename BufferSequence::const_iterator end = b.end(); + for (; iter != end; ++iter) + total_buffer_size += detail::buffer_size_helper(*iter); + + return total_buffer_size; +} + +/*@}*/ + +/** @defgroup buffer_cast boost::asio::buffer_cast + * + * @brief The boost::asio::buffer_cast function is used to obtain a pointer to + * the underlying memory region associated with a buffer. + * + * @par Examples: + * + * To access the memory of a non-modifiable buffer, use: + * @code boost::asio::const_buffer b1 = ...; + * const unsigned char* p1 = boost::asio::buffer_cast<const unsigned char*>(b1); + * @endcode + * + * To access the memory of a modifiable buffer, use: + * @code boost::asio::mutable_buffer b2 = ...; + * unsigned char* p2 = boost::asio::buffer_cast<unsigned char*>(b2); + * @endcode + * + * The boost::asio::buffer_cast function permits violations of type safety, so + * uses of it in application code should be carefully considered. + */ +/*@{*/ + +/// Cast a non-modifiable buffer to a specified pointer to POD type. +template <typename PointerToPodType> +inline PointerToPodType buffer_cast(const mutable_buffer& b) +{ + return static_cast<PointerToPodType>(detail::buffer_cast_helper(b)); +} + +/// Cast a non-modifiable buffer to a specified pointer to POD type. +template <typename PointerToPodType> +inline PointerToPodType buffer_cast(const const_buffer& b) +{ + return static_cast<PointerToPodType>(detail::buffer_cast_helper(b)); +} + +/*@}*/ + +/// Create a new modifiable buffer that is offset from the start of another. +/** + * @relates mutable_buffer + */ +inline mutable_buffer operator+(const mutable_buffer& b, std::size_t start) +{ + if (start > buffer_size(b)) + return mutable_buffer(); + char* new_data = buffer_cast<char*>(b) + start; + std::size_t new_size = buffer_size(b) - start; + return mutable_buffer(new_data, new_size +#if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING) + , b.get_debug_check() +#endif // BOOST_ASIO_ENABLE_BUFFER_DEBUGGING + ); +} + +/// Create a new modifiable buffer that is offset from the start of another. +/** + * @relates mutable_buffer + */ +inline mutable_buffer operator+(std::size_t start, const mutable_buffer& b) +{ + if (start > buffer_size(b)) + return mutable_buffer(); + char* new_data = buffer_cast<char*>(b) + start; + std::size_t new_size = buffer_size(b) - start; + return mutable_buffer(new_data, new_size +#if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING) + , b.get_debug_check() +#endif // BOOST_ASIO_ENABLE_BUFFER_DEBUGGING + ); +} + +/// Create a new non-modifiable buffer that is offset from the start of another. +/** + * @relates const_buffer + */ +inline const_buffer operator+(const const_buffer& b, std::size_t start) +{ + if (start > buffer_size(b)) + return const_buffer(); + const char* new_data = buffer_cast<const char*>(b) + start; + std::size_t new_size = buffer_size(b) - start; + return const_buffer(new_data, new_size +#if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING) + , b.get_debug_check() +#endif // BOOST_ASIO_ENABLE_BUFFER_DEBUGGING + ); +} + +/// Create a new non-modifiable buffer that is offset from the start of another. +/** + * @relates const_buffer + */ +inline const_buffer operator+(std::size_t start, const const_buffer& b) +{ + if (start > buffer_size(b)) + return const_buffer(); + const char* new_data = buffer_cast<const char*>(b) + start; + std::size_t new_size = buffer_size(b) - start; + return const_buffer(new_data, new_size +#if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING) + , b.get_debug_check() +#endif // BOOST_ASIO_ENABLE_BUFFER_DEBUGGING + ); +} + #if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING) namespace detail { @@ -479,9 +557,9 @@ private: * passed to the socket's write function. A buffer created for modifiable * memory also meets the requirements of the MutableBufferSequence concept. * - * An individual buffer may be created from a builtin array, std::vector or - * boost::array of POD elements. This helps prevent buffer overruns by - * automatically determining the size of the buffer: + * An individual buffer may be created from a builtin array, std::vector, + * std::array or boost::array of POD elements. This helps prevent buffer + * overruns by automatically determining the size of the buffer: * * @code char d1[128]; * size_t bytes_transferred = sock.receive(boost::asio::buffer(d1)); @@ -489,8 +567,11 @@ private: * std::vector<char> d2(128); * bytes_transferred = sock.receive(boost::asio::buffer(d2)); * - * boost::array<char, 128> d3; - * bytes_transferred = sock.receive(boost::asio::buffer(d3)); @endcode + * std::array<char, 128> d3; + * bytes_transferred = sock.receive(boost::asio::buffer(d3)); + * + * boost::array<char, 128> d4; + * bytes_transferred = sock.receive(boost::asio::buffer(d4)); @endcode * * In all three cases above, the buffers created are exactly 128 bytes long. * Note that a vector is @e never automatically resized when creating or using @@ -499,8 +580,8 @@ private: * * @par Accessing Buffer Contents * - * The contents of a buffer may be accessed using the boost::asio::buffer_size - * and boost::asio::buffer_cast functions: + * The contents of a buffer may be accessed using the @ref buffer_size and + * @ref buffer_cast functions: * * @code boost::asio::mutable_buffer b1 = ...; * std::size_t s1 = boost::asio::buffer_size(b1); @@ -513,11 +594,29 @@ private: * The boost::asio::buffer_cast function permits violations of type safety, so * uses of it in application code should be carefully considered. * - * @par Buffer Invalidation + * For convenience, the @ref buffer_size function also works on buffer + * sequences (that is, types meeting the ConstBufferSequence or + * MutableBufferSequence type requirements). In this case, the function returns + * the total size of all buffers in the sequence. * - * A buffer object does not have any ownership of the memory it refers to. It - * is the responsibility of the application to ensure the memory region remains - * valid until it is no longer required for an I/O operation. When the memory + * @par Buffer Copying + * + * The @ref buffer_copy function may be used to copy raw bytes between + * individual buffers and buffer sequences. + * + * In particular, when used with the @ref buffer_size, the @ref buffer_copy + * function can be used to linearise a sequence of buffers. For example: + * + * @code vector<const_buffer> buffers = ...; + * + * vector<unsigned char> data(boost::asio::buffer_size(buffers)); + * boost::asio::buffer_copy(boost::asio::buffer(data), buffers); @endcode + * + * @par Buffer Invalidation + * + * A buffer object does not have any ownership of the memory it refers to. It + * is the responsibility of the application to ensure the memory region remains + * valid until it is no longer required for an I/O operation. When the memory * is no longer available, the buffer is said to have been invalidated. * * For the boost::asio::buffer overloads that accept an argument of type @@ -526,8 +625,8 @@ private: * referring to the elements in the sequence (C++ Std, 23.2.4) * * For the boost::asio::buffer overloads that accept an argument of type - * std::string, the buffer objects returned are invalidated according to the - * rules defined for invalidation of references, pointers and iterators + * std::basic_string, the buffer objects returned are invalidated according to + * the rules defined for invalidation of references, pointers and iterators * referring to elements of the sequence (C++ Std, 21.3). * * @par Buffer Arithmetic @@ -896,6 +995,103 @@ inline const_buffers_1 buffer(const boost::array<PodType, N>& data, ? data.size() * sizeof(PodType) : max_size_in_bytes)); } +#if defined(BOOST_ASIO_HAS_STD_ARRAY) || defined(GENERATING_DOCUMENTATION) + +/// Create a new modifiable buffer that represents the given POD array. +/** + * @returns A mutable_buffers_1 value equivalent to: + * @code mutable_buffers_1( + * data.data(), + * data.size() * sizeof(PodType)); @endcode + */ +template <typename PodType, std::size_t N> +inline mutable_buffers_1 buffer(std::array<PodType, N>& data) +{ + return mutable_buffers_1( + mutable_buffer(data.data(), data.size() * sizeof(PodType))); +} + +/// Create a new modifiable buffer that represents the given POD array. +/** + * @returns A mutable_buffers_1 value equivalent to: + * @code mutable_buffers_1( + * data.data(), + * min(data.size() * sizeof(PodType), max_size_in_bytes)); @endcode + */ +template <typename PodType, std::size_t N> +inline mutable_buffers_1 buffer(std::array<PodType, N>& data, + std::size_t max_size_in_bytes) +{ + return mutable_buffers_1( + mutable_buffer(data.data(), + data.size() * sizeof(PodType) < max_size_in_bytes + ? data.size() * sizeof(PodType) : max_size_in_bytes)); +} + +/// Create a new non-modifiable buffer that represents the given POD array. +/** + * @returns A const_buffers_1 value equivalent to: + * @code const_buffers_1( + * data.data(), + * data.size() * sizeof(PodType)); @endcode + */ +template <typename PodType, std::size_t N> +inline const_buffers_1 buffer(std::array<const PodType, N>& data) +{ + return const_buffers_1( + const_buffer(data.data(), data.size() * sizeof(PodType))); +} + +/// Create a new non-modifiable buffer that represents the given POD array. +/** + * @returns A const_buffers_1 value equivalent to: + * @code const_buffers_1( + * data.data(), + * min(data.size() * sizeof(PodType), max_size_in_bytes)); @endcode + */ +template <typename PodType, std::size_t N> +inline const_buffers_1 buffer(std::array<const PodType, N>& data, + std::size_t max_size_in_bytes) +{ + return const_buffers_1( + const_buffer(data.data(), + data.size() * sizeof(PodType) < max_size_in_bytes + ? data.size() * sizeof(PodType) : max_size_in_bytes)); +} + +/// Create a new non-modifiable buffer that represents the given POD array. +/** + * @returns A const_buffers_1 value equivalent to: + * @code const_buffers_1( + * data.data(), + * data.size() * sizeof(PodType)); @endcode + */ +template <typename PodType, std::size_t N> +inline const_buffers_1 buffer(const std::array<PodType, N>& data) +{ + return const_buffers_1( + const_buffer(data.data(), data.size() * sizeof(PodType))); +} + +/// Create a new non-modifiable buffer that represents the given POD array. +/** + * @returns A const_buffers_1 value equivalent to: + * @code const_buffers_1( + * data.data(), + * min(data.size() * sizeof(PodType), max_size_in_bytes)); @endcode + */ +template <typename PodType, std::size_t N> +inline const_buffers_1 buffer(const std::array<PodType, N>& data, + std::size_t max_size_in_bytes) +{ + return const_buffers_1( + const_buffer(data.data(), + data.size() * sizeof(PodType) < max_size_in_bytes + ? data.size() * sizeof(PodType) : max_size_in_bytes)); +} + +#endif // defined(BOOST_ASIO_HAS_STD_ARRAY) || defined(GENERATING_DOCUMENTATION) + /// Create a new modifiable buffer that represents the given POD vector. /** * @returns A mutable_buffers_1 value equivalent to: @@ -997,16 +1193,20 @@ inline const_buffers_1 buffer( /// Create a new non-modifiable buffer that represents the given string. /** - * @returns <tt>const_buffers_1(data.data(), data.size())</tt>. + * @returns <tt>const_buffers_1(data.data(), data.size() * sizeof(Elem))</tt>. * * @note The buffer is invalidated by any non-const operation called on the * given string object. */ -inline const_buffers_1 buffer(const std::string& data) +template <typename Elem, typename Traits, typename Allocator> +inline const_buffers_1 buffer( + const std::basic_string<Elem, Traits, Allocator>& data) { - return const_buffers_1(const_buffer(data.data(), data.size() + return const_buffers_1(const_buffer(data.data(), data.size() * sizeof(Elem) #if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING) - , detail::buffer_debug_check<std::string::const_iterator>(data.begin()) + , detail::buffer_debug_check< + typename std::basic_string<Elem, Traits, Allocator>::const_iterator + >(data.begin()) #endif // BOOST_ASIO_ENABLE_BUFFER_DEBUGGING )); } @@ -1016,26 +1216,924 @@ inline const_buffers_1 buffer(const std::string& data) * @returns A const_buffers_1 value equivalent to: * @code const_buffers_1( * data.data(), - * min(data.size(), max_size_in_bytes)); @endcode + * min(data.size() * sizeof(Elem), max_size_in_bytes)); @endcode * * @note The buffer is invalidated by any non-const operation called on the * given string object. */ -inline const_buffers_1 buffer(const std::string& data, +template <typename Elem, typename Traits, typename Allocator> +inline const_buffers_1 buffer( + const std::basic_string<Elem, Traits, Allocator>& data, std::size_t max_size_in_bytes) { return const_buffers_1( const_buffer(data.data(), - data.size() < max_size_in_bytes - ? data.size() : max_size_in_bytes + data.size() * sizeof(Elem) < max_size_in_bytes + ? data.size() * sizeof(Elem) : max_size_in_bytes #if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING) - , detail::buffer_debug_check<std::string::const_iterator>(data.begin()) + , detail::buffer_debug_check< + typename std::basic_string<Elem, Traits, Allocator>::const_iterator + >(data.begin()) #endif // BOOST_ASIO_ENABLE_BUFFER_DEBUGGING )); } /*@}*/ +/** @defgroup buffer_copy boost::asio::buffer_copy + * + * @brief The boost::asio::buffer_copy function is used to copy bytes from a + * source buffer (or buffer sequence) to a target buffer (or buffer sequence). + * + * The @c buffer_copy function is available in two forms: + * + * @li A 2-argument form: @c buffer_copy(target, source) + * + * @li A 3-argument form: @c buffer_copy(target, source, max_bytes_to_copy) + + * Both forms return the number of bytes actually copied. The number of bytes + * copied is the lesser of: + * + * @li @c buffer_size(target) + * + * @li @c buffer_size(source) + * + * @li @c If specified, @c max_bytes_to_copy. + * + * This prevents buffer overflow, regardless of the buffer sizes used in the + * copy operation. + */ +/*@{*/ + +/// Copies bytes from a source buffer to a target buffer. +/** + * @param target A modifiable buffer representing the memory region to which + * the bytes will be copied. + * + * @param source A non-modifiable buffer representing the memory region from + * which the bytes will be copied. + * + * @returns The number of bytes copied. + * + * @note The number of bytes copied is the lesser of: + * + * @li @c buffer_size(target) + * + * @li @c buffer_size(source) + */ +inline std::size_t buffer_copy(const mutable_buffer& target, + const const_buffer& source) +{ + using namespace std; // For memcpy. + std::size_t target_size = buffer_size(target); + std::size_t source_size = buffer_size(source); + std::size_t n = target_size < source_size ? target_size : source_size; + memcpy(buffer_cast<void*>(target), buffer_cast<const void*>(source), n); + return n; +} + +/// Copies bytes from a source buffer to a target buffer. +/** + * @param target A modifiable buffer representing the memory region to which + * the bytes will be copied. + * + * @param source A non-modifiable buffer representing the memory region from + * which the bytes will be copied. + * + * @returns The number of bytes copied. + * + * @note The number of bytes copied is the lesser of: + * + * @li @c buffer_size(target) + * + * @li @c buffer_size(source) + */ +inline std::size_t buffer_copy(const mutable_buffer& target, + const const_buffers_1& source) +{ + return buffer_copy(target, static_cast<const const_buffer&>(source)); +} + +/// Copies bytes from a source buffer to a target buffer. +/** + * @param target A modifiable buffer representing the memory region to which + * the bytes will be copied. + * + * @param source A modifiable buffer representing the memory region from which + * the bytes will be copied. The contents of the source buffer will not be + * modified. + * + * @returns The number of bytes copied. + * + * @note The number of bytes copied is the lesser of: + * + * @li @c buffer_size(target) + * + * @li @c buffer_size(source) + */ +inline std::size_t buffer_copy(const mutable_buffer& target, + const mutable_buffer& source) +{ + return buffer_copy(target, const_buffer(source)); +} + +/// Copies bytes from a source buffer to a target buffer. +/** + * @param target A modifiable buffer representing the memory region to which + * the bytes will be copied. + * + * @param source A modifiable buffer representing the memory region from which + * the bytes will be copied. The contents of the source buffer will not be + * modified. + * + * @returns The number of bytes copied. + * + * @note The number of bytes copied is the lesser of: + * + * @li @c buffer_size(target) + * + * @li @c buffer_size(source) + */ +inline std::size_t buffer_copy(const mutable_buffer& target, + const mutable_buffers_1& source) +{ + return buffer_copy(target, const_buffer(source)); +} + +/// Copies bytes from a source buffer sequence to a target buffer. +/** + * @param target A modifiable buffer representing the memory region to which + * the bytes will be copied. + * + * @param source A non-modifiable buffer sequence representing the memory + * regions from which the bytes will be copied. + * + * @returns The number of bytes copied. + * + * @note The number of bytes copied is the lesser of: + * + * @li @c buffer_size(target) + * + * @li @c buffer_size(source) + */ +template <typename ConstBufferSequence> +std::size_t buffer_copy(const mutable_buffer& target, + const ConstBufferSequence& source) +{ + std::size_t total_bytes_copied = 0; + + typename ConstBufferSequence::const_iterator source_iter = source.begin(); + typename ConstBufferSequence::const_iterator source_end = source.end(); + + for (mutable_buffer target_buffer(target); + buffer_size(target_buffer) && source_iter != source_end; ++source_iter) + { + const_buffer source_buffer(*source_iter); + std::size_t bytes_copied = buffer_copy(target_buffer, source_buffer); + total_bytes_copied += bytes_copied; + target_buffer = target_buffer + bytes_copied; + } + + return total_bytes_copied; +} + +/// Copies bytes from a source buffer to a target buffer. +/** + * @param target A modifiable buffer representing the memory region to which + * the bytes will be copied. + * + * @param source A non-modifiable buffer representing the memory region from + * which the bytes will be copied. + * + * @returns The number of bytes copied. + * + * @note The number of bytes copied is the lesser of: + * + * @li @c buffer_size(target) + * + * @li @c buffer_size(source) + */ +inline std::size_t buffer_copy(const mutable_buffers_1& target, + const const_buffer& source) +{ + return buffer_copy(static_cast<const mutable_buffer&>(target), source); +} + +/// Copies bytes from a source buffer to a target buffer. +/** + * @param target A modifiable buffer representing the memory region to which + * the bytes will be copied. + * + * @param source A non-modifiable buffer representing the memory region from + * which the bytes will be copied. + * + * @returns The number of bytes copied. + * + * @note The number of bytes copied is the lesser of: + * + * @li @c buffer_size(target) + * + * @li @c buffer_size(source) + */ +inline std::size_t buffer_copy(const mutable_buffers_1& target, + const const_buffers_1& source) +{ + return buffer_copy(static_cast<const mutable_buffer&>(target), + static_cast<const const_buffer&>(source)); +} + +/// Copies bytes from a source buffer to a target buffer. +/** + * @param target A modifiable buffer representing the memory region to which + * the bytes will be copied. + * + * @param source A modifiable buffer representing the memory region from which + * the bytes will be copied. The contents of the source buffer will not be + * modified. + * + * @returns The number of bytes copied. + * + * @note The number of bytes copied is the lesser of: + * + * @li @c buffer_size(target) + * + * @li @c buffer_size(source) + */ +inline std::size_t buffer_copy(const mutable_buffers_1& target, + const mutable_buffer& source) +{ + return buffer_copy(static_cast<const mutable_buffer&>(target), + const_buffer(source)); +} + +/// Copies bytes from a source buffer to a target buffer. +/** + * @param target A modifiable buffer representing the memory region to which + * the bytes will be copied. + * + * @param source A modifiable buffer representing the memory region from which + * the bytes will be copied. The contents of the source buffer will not be + * modified. + * + * @returns The number of bytes copied. + * + * @note The number of bytes copied is the lesser of: + * + * @li @c buffer_size(target) + * + * @li @c buffer_size(source) + */ +inline std::size_t buffer_copy(const mutable_buffers_1& target, + const mutable_buffers_1& source) +{ + return buffer_copy(static_cast<const mutable_buffer&>(target), + const_buffer(source)); +} + +/// Copies bytes from a source buffer sequence to a target buffer. +/** + * @param target A modifiable buffer representing the memory region to which + * the bytes will be copied. + * + * @param source A non-modifiable buffer sequence representing the memory + * regions from which the bytes will be copied. + * + * @returns The number of bytes copied. + * + * @note The number of bytes copied is the lesser of: + * + * @li @c buffer_size(target) + * + * @li @c buffer_size(source) + */ +template <typename ConstBufferSequence> +inline std::size_t buffer_copy(const mutable_buffers_1& target, + const ConstBufferSequence& source) +{ + return buffer_copy(static_cast<const mutable_buffer&>(target), source); +} + +/// Copies bytes from a source buffer to a target buffer sequence. +/** + * @param target A modifiable buffer sequence representing the memory regions to + * which the bytes will be copied. + * + * @param source A non-modifiable buffer representing the memory region from + * which the bytes will be copied. + * + * @returns The number of bytes copied. + * + * @note The number of bytes copied is the lesser of: + * + * @li @c buffer_size(target) + * + * @li @c buffer_size(source) + */ +template <typename MutableBufferSequence> +std::size_t buffer_copy(const MutableBufferSequence& target, + const const_buffer& source) +{ + std::size_t total_bytes_copied = 0; + + typename MutableBufferSequence::const_iterator target_iter = target.begin(); + typename MutableBufferSequence::const_iterator target_end = target.end(); + + for (const_buffer source_buffer(source); + buffer_size(source_buffer) && target_iter != target_end; ++target_iter) + { + mutable_buffer target_buffer(*target_iter); + std::size_t bytes_copied = buffer_copy(target_buffer, source_buffer); + total_bytes_copied += bytes_copied; + source_buffer = source_buffer + bytes_copied; + } + + return total_bytes_copied; +} + +/// Copies bytes from a source buffer to a target buffer sequence. +/** + * @param target A modifiable buffer sequence representing the memory regions to + * which the bytes will be copied. + * + * @param source A non-modifiable buffer representing the memory region from + * which the bytes will be copied. + * + * @returns The number of bytes copied. + * + * @note The number of bytes copied is the lesser of: + * + * @li @c buffer_size(target) + * + * @li @c buffer_size(source) + */ +template <typename MutableBufferSequence> +inline std::size_t buffer_copy(const MutableBufferSequence& target, + const const_buffers_1& source) +{ + return buffer_copy(target, static_cast<const const_buffer&>(source)); +} + +/// Copies bytes from a source buffer to a target buffer sequence. +/** + * @param target A modifiable buffer sequence representing the memory regions to + * which the bytes will be copied. + * + * @param source A modifiable buffer representing the memory region from which + * the bytes will be copied. The contents of the source buffer will not be + * modified. + * + * @returns The number of bytes copied. + * + * @note The number of bytes copied is the lesser of: + * + * @li @c buffer_size(target) + * + * @li @c buffer_size(source) + */ +template <typename MutableBufferSequence> +inline std::size_t buffer_copy(const MutableBufferSequence& target, + const mutable_buffer& source) +{ + return buffer_copy(target, const_buffer(source)); +} + +/// Copies bytes from a source buffer to a target buffer sequence. +/** + * @param target A modifiable buffer sequence representing the memory regions to + * which the bytes will be copied. + * + * @param source A modifiable buffer representing the memory region from which + * the bytes will be copied. The contents of the source buffer will not be + * modified. + * + * @returns The number of bytes copied. + * + * @note The number of bytes copied is the lesser of: + * + * @li @c buffer_size(target) + * + * @li @c buffer_size(source) + */ +template <typename MutableBufferSequence> +inline std::size_t buffer_copy(const MutableBufferSequence& target, + const mutable_buffers_1& source) +{ + return buffer_copy(target, const_buffer(source)); +} + +/// Copies bytes from a source buffer sequence to a target buffer sequence. +/** + * @param target A modifiable buffer sequence representing the memory regions to + * which the bytes will be copied. + * + * @param source A non-modifiable buffer sequence representing the memory + * regions from which the bytes will be copied. + * + * @returns The number of bytes copied. + * + * @note The number of bytes copied is the lesser of: + * + * @li @c buffer_size(target) + * + * @li @c buffer_size(source) + */ +template <typename MutableBufferSequence, typename ConstBufferSequence> +std::size_t buffer_copy(const MutableBufferSequence& target, + const ConstBufferSequence& source) +{ + std::size_t total_bytes_copied = 0; + + typename MutableBufferSequence::const_iterator target_iter = target.begin(); + typename MutableBufferSequence::const_iterator target_end = target.end(); + std::size_t target_buffer_offset = 0; + + typename ConstBufferSequence::const_iterator source_iter = source.begin(); + typename ConstBufferSequence::const_iterator source_end = source.end(); + std::size_t source_buffer_offset = 0; + + while (target_iter != target_end && source_iter != source_end) + { + mutable_buffer target_buffer = + mutable_buffer(*target_iter) + target_buffer_offset; + + const_buffer source_buffer = + const_buffer(*source_iter) + source_buffer_offset; + + std::size_t bytes_copied = buffer_copy(target_buffer, source_buffer); + total_bytes_copied += bytes_copied; + + if (bytes_copied == buffer_size(target_buffer)) + { + ++target_iter; + target_buffer_offset = 0; + } + else + target_buffer_offset += bytes_copied; + + if (bytes_copied == buffer_size(source_buffer)) + { + ++source_iter; + source_buffer_offset = 0; + } + else + source_buffer_offset += bytes_copied; + } + + return total_bytes_copied; +} + +/// Copies a limited number of bytes from a source buffer to a target buffer. +/** + * @param target A modifiable buffer representing the memory region to which + * the bytes will be copied. + * + * @param source A non-modifiable buffer representing the memory region from + * which the bytes will be copied. + * + * @param max_bytes_to_copy The maximum number of bytes to be copied. + * + * @returns The number of bytes copied. + * + * @note The number of bytes copied is the lesser of: + * + * @li @c buffer_size(target) + * + * @li @c buffer_size(source) + * + * @li @c max_bytes_to_copy + */ +inline std::size_t buffer_copy(const mutable_buffer& target, + const const_buffer& source, std::size_t max_bytes_to_copy) +{ + return buffer_copy(buffer(target, max_bytes_to_copy), source); +} + +/// Copies a limited number of bytes from a source buffer to a target buffer. +/** + * @param target A modifiable buffer representing the memory region to which + * the bytes will be copied. + * + * @param source A non-modifiable buffer representing the memory region from + * which the bytes will be copied. + * + * @param max_bytes_to_copy The maximum number of bytes to be copied. + * + * @returns The number of bytes copied. + * + * @note The number of bytes copied is the lesser of: + * + * @li @c buffer_size(target) + * + * @li @c buffer_size(source) + * + * @li @c max_bytes_to_copy + */ +inline std::size_t buffer_copy(const mutable_buffer& target, + const const_buffers_1& source, std::size_t max_bytes_to_copy) +{ + return buffer_copy(buffer(target, max_bytes_to_copy), source); +} + +/// Copies a limited number of bytes from a source buffer to a target buffer. +/** + * @param target A modifiable buffer representing the memory region to which + * the bytes will be copied. + * + * @param source A modifiable buffer representing the memory region from which + * the bytes will be copied. The contents of the source buffer will not be + * modified. + * + * @param max_bytes_to_copy The maximum number of bytes to be copied. + * + * @returns The number of bytes copied. + * + * @note The number of bytes copied is the lesser of: + * + * @li @c buffer_size(target) + * + * @li @c buffer_size(source) + * + * @li @c max_bytes_to_copy + */ +inline std::size_t buffer_copy(const mutable_buffer& target, + const mutable_buffer& source, std::size_t max_bytes_to_copy) +{ + return buffer_copy(buffer(target, max_bytes_to_copy), source); +} + +/// Copies a limited number of bytes from a source buffer to a target buffer. +/** + * @param target A modifiable buffer representing the memory region to which + * the bytes will be copied. + * + * @param source A modifiable buffer representing the memory region from which + * the bytes will be copied. The contents of the source buffer will not be + * modified. + * + * @param max_bytes_to_copy The maximum number of bytes to be copied. + * + * @returns The number of bytes copied. + * + * @note The number of bytes copied is the lesser of: + * + * @li @c buffer_size(target) + * + * @li @c buffer_size(source) + * + * @li @c max_bytes_to_copy + */ +inline std::size_t buffer_copy(const mutable_buffer& target, + const mutable_buffers_1& source, std::size_t max_bytes_to_copy) +{ + return buffer_copy(buffer(target, max_bytes_to_copy), source); +} + +/// Copies a limited number of bytes from a source buffer sequence to a target +/// buffer. +/** + * @param target A modifiable buffer representing the memory region to which + * the bytes will be copied. + * + * @param source A non-modifiable buffer sequence representing the memory + * regions from which the bytes will be copied. + * + * @param max_bytes_to_copy The maximum number of bytes to be copied. + * + * @returns The number of bytes copied. + * + * @note The number of bytes copied is the lesser of: + * + * @li @c buffer_size(target) + * + * @li @c buffer_size(source) + * + * @li @c max_bytes_to_copy + */ +template <typename ConstBufferSequence> +inline std::size_t buffer_copy(const mutable_buffer& target, + const ConstBufferSequence& source, std::size_t max_bytes_to_copy) +{ + return buffer_copy(buffer(target, max_bytes_to_copy), source); +} + +/// Copies a limited number of bytes from a source buffer to a target buffer. +/** + * @param target A modifiable buffer representing the memory region to which + * the bytes will be copied. + * + * @param source A non-modifiable buffer representing the memory region from + * which the bytes will be copied. + * + * @param max_bytes_to_copy The maximum number of bytes to be copied. + * + * @returns The number of bytes copied. + * + * @note The number of bytes copied is the lesser of: + * + * @li @c buffer_size(target) + * + * @li @c buffer_size(source) + * + * @li @c max_bytes_to_copy + */ +inline std::size_t buffer_copy(const mutable_buffers_1& target, + const const_buffer& source, std::size_t max_bytes_to_copy) +{ + return buffer_copy(buffer(target, max_bytes_to_copy), source); +} + +/// Copies a limited number of bytes from a source buffer to a target buffer. +/** + * @param target A modifiable buffer representing the memory region to which + * the bytes will be copied. + * + * @param source A non-modifiable buffer representing the memory region from + * which the bytes will be copied. + * + * @param max_bytes_to_copy The maximum number of bytes to be copied. + * + * @returns The number of bytes copied. + * + * @note The number of bytes copied is the lesser of: + * + * @li @c buffer_size(target) + * + * @li @c buffer_size(source) + * + * @li @c max_bytes_to_copy + */ +inline std::size_t buffer_copy(const mutable_buffers_1& target, + const const_buffers_1& source, std::size_t max_bytes_to_copy) +{ + return buffer_copy(buffer(target, max_bytes_to_copy), source); +} + +/// Copies a limited number of bytes from a source buffer to a target buffer. +/** + * @param target A modifiable buffer representing the memory region to which + * the bytes will be copied. + * + * @param source A modifiable buffer representing the memory region from which + * the bytes will be copied. The contents of the source buffer will not be + * modified. + * + * @param max_bytes_to_copy The maximum number of bytes to be copied. + * + * @returns The number of bytes copied. + * + * @note The number of bytes copied is the lesser of: + * + * @li @c buffer_size(target) + * + * @li @c buffer_size(source) + * + * @li @c max_bytes_to_copy + */ +inline std::size_t buffer_copy(const mutable_buffers_1& target, + const mutable_buffer& source, std::size_t max_bytes_to_copy) +{ + return buffer_copy(buffer(target, max_bytes_to_copy), source); +} + +/// Copies a limited number of bytes from a source buffer to a target buffer. +/** + * @param target A modifiable buffer representing the memory region to which + * the bytes will be copied. + * + * @param source A modifiable buffer representing the memory region from which + * the bytes will be copied. The contents of the source buffer will not be + * modified. + * + * @param max_bytes_to_copy The maximum number of bytes to be copied. + * + * @returns The number of bytes copied. + * + * @note The number of bytes copied is the lesser of: + * + * @li @c buffer_size(target) + * + * @li @c buffer_size(source) + * + * @li @c max_bytes_to_copy + */ +inline std::size_t buffer_copy(const mutable_buffers_1& target, + const mutable_buffers_1& source, std::size_t max_bytes_to_copy) +{ + return buffer_copy(buffer(target, max_bytes_to_copy), source); +} + +/// Copies a limited number of bytes from a source buffer sequence to a target +/// buffer. +/** + * @param target A modifiable buffer representing the memory region to which + * the bytes will be copied. + * + * @param source A non-modifiable buffer sequence representing the memory + * regions from which the bytes will be copied. + * + * @param max_bytes_to_copy The maximum number of bytes to be copied. + * + * @returns The number of bytes copied. + * + * @note The number of bytes copied is the lesser of: + * + * @li @c buffer_size(target) + * + * @li @c buffer_size(source) + * + * @li @c max_bytes_to_copy + */ +template <typename ConstBufferSequence> +inline std::size_t buffer_copy(const mutable_buffers_1& target, + const ConstBufferSequence& source, std::size_t max_bytes_to_copy) +{ + return buffer_copy(buffer(target, max_bytes_to_copy), source); +} + +/// Copies a limited number of bytes from a source buffer to a target buffer +/// sequence. +/** + * @param target A modifiable buffer sequence representing the memory regions to + * which the bytes will be copied. + * + * @param source A non-modifiable buffer representing the memory region from + * which the bytes will be copied. + * + * @param max_bytes_to_copy The maximum number of bytes to be copied. + * + * @returns The number of bytes copied. + * + * @note The number of bytes copied is the lesser of: + * + * @li @c buffer_size(target) + * + * @li @c buffer_size(source) + * + * @li @c max_bytes_to_copy + */ +template <typename MutableBufferSequence> +inline std::size_t buffer_copy(const MutableBufferSequence& target, + const const_buffer& source, std::size_t max_bytes_to_copy) +{ + return buffer_copy(target, buffer(source, max_bytes_to_copy)); +} + +/// Copies a limited number of bytes from a source buffer to a target buffer +/// sequence. +/** + * @param target A modifiable buffer sequence representing the memory regions to + * which the bytes will be copied. + * + * @param source A non-modifiable buffer representing the memory region from + * which the bytes will be copied. + * + * @param max_bytes_to_copy The maximum number of bytes to be copied. + * + * @returns The number of bytes copied. + * + * @note The number of bytes copied is the lesser of: + * + * @li @c buffer_size(target) + * + * @li @c buffer_size(source) + * + * @li @c max_bytes_to_copy + */ +template <typename MutableBufferSequence> +inline std::size_t buffer_copy(const MutableBufferSequence& target, + const const_buffers_1& source, std::size_t max_bytes_to_copy) +{ + return buffer_copy(target, buffer(source, max_bytes_to_copy)); +} + +/// Copies a limited number of bytes from a source buffer to a target buffer +/// sequence. +/** + * @param target A modifiable buffer sequence representing the memory regions to + * which the bytes will be copied. + * + * @param source A modifiable buffer representing the memory region from which + * the bytes will be copied. The contents of the source buffer will not be + * modified. + * + * @param max_bytes_to_copy The maximum number of bytes to be copied. + * + * @returns The number of bytes copied. + * + * @note The number of bytes copied is the lesser of: + * + * @li @c buffer_size(target) + * + * @li @c buffer_size(source) + * + * @li @c max_bytes_to_copy + */ +template <typename MutableBufferSequence> +inline std::size_t buffer_copy(const MutableBufferSequence& target, + const mutable_buffer& source, std::size_t max_bytes_to_copy) +{ + return buffer_copy(target, buffer(source, max_bytes_to_copy)); +} + +/// Copies a limited number of bytes from a source buffer to a target buffer +/// sequence. +/** + * @param target A modifiable buffer sequence representing the memory regions to + * which the bytes will be copied. + * + * @param source A modifiable buffer representing the memory region from which + * the bytes will be copied. The contents of the source buffer will not be + * modified. + * + * @param max_bytes_to_copy The maximum number of bytes to be copied. + * + * @returns The number of bytes copied. + * + * @note The number of bytes copied is the lesser of: + * + * @li @c buffer_size(target) + * + * @li @c buffer_size(source) + * + * @li @c max_bytes_to_copy + */ +template <typename MutableBufferSequence> +inline std::size_t buffer_copy(const MutableBufferSequence& target, + const mutable_buffers_1& source, std::size_t max_bytes_to_copy) +{ + return buffer_copy(target, buffer(source, max_bytes_to_copy)); +} + +/// Copies a limited number of bytes from a source buffer sequence to a target +/// buffer sequence. +/** + * @param target A modifiable buffer sequence representing the memory regions to + * which the bytes will be copied. + * + * @param source A non-modifiable buffer sequence representing the memory + * regions from which the bytes will be copied. + * + * @param max_bytes_to_copy The maximum number of bytes to be copied. + * + * @returns The number of bytes copied. + * + * @note The number of bytes copied is the lesser of: + * + * @li @c buffer_size(target) + * + * @li @c buffer_size(source) + * + * @li @c max_bytes_to_copy + */ +template <typename MutableBufferSequence, typename ConstBufferSequence> +std::size_t buffer_copy(const MutableBufferSequence& target, + const ConstBufferSequence& source, std::size_t max_bytes_to_copy) +{ + std::size_t total_bytes_copied = 0; + + typename MutableBufferSequence::const_iterator target_iter = target.begin(); + typename MutableBufferSequence::const_iterator target_end = target.end(); + std::size_t target_buffer_offset = 0; + + typename ConstBufferSequence::const_iterator source_iter = source.begin(); + typename ConstBufferSequence::const_iterator source_end = source.end(); + std::size_t source_buffer_offset = 0; + + while (total_bytes_copied != max_bytes_to_copy + && target_iter != target_end && source_iter != source_end) + { + mutable_buffer target_buffer = + mutable_buffer(*target_iter) + target_buffer_offset; + + const_buffer source_buffer = + const_buffer(*source_iter) + source_buffer_offset; + + std::size_t bytes_copied = buffer_copy(target_buffer, + source_buffer, max_bytes_to_copy - total_bytes_copied); + total_bytes_copied += bytes_copied; + + if (bytes_copied == buffer_size(target_buffer)) + { + ++target_iter; + target_buffer_offset = 0; + } + else + target_buffer_offset += bytes_copied; + + if (bytes_copied == buffer_size(source_buffer)) + { + ++source_iter; + source_buffer_offset = 0; + } + else + source_buffer_offset += bytes_copied; + } + + return total_bytes_copied; +} + +/*@}*/ + } // namespace asio } // namespace boost diff --git a/3rdParty/Boost/src/boost/asio/buffered_read_stream.hpp b/3rdParty/Boost/src/boost/asio/buffered_read_stream.hpp index af24dd6..3072580 100644 --- a/3rdParty/Boost/src/boost/asio/buffered_read_stream.hpp +++ b/3rdParty/Boost/src/boost/asio/buffered_read_stream.hpp @@ -2,7 +2,7 @@ // buffered_read_stream.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -17,7 +17,6 @@ #include <boost/asio/detail/config.hpp> #include <cstddef> -#include <cstring> #include <boost/type_traits/remove_reference.hpp> #include <boost/asio/buffered_read_stream_fwd.hpp> #include <boost/asio/buffer.hpp> @@ -97,13 +96,6 @@ public: return next_layer_.lowest_layer(); } - /// (Deprecated: use get_io_service().) Get the io_service associated with - /// the object. - boost::asio::io_service& io_service() - { - return next_layer_.get_io_service(); - } - /// Get the io_service associated with the object. boost::asio::io_service& get_io_service() { @@ -227,16 +219,7 @@ public: template <typename MutableBufferSequence> std::size_t read_some(const MutableBufferSequence& buffers) { - typename MutableBufferSequence::const_iterator iter = buffers.begin(); - typename MutableBufferSequence::const_iterator end = buffers.end(); - size_t total_buffer_size = 0; - for (; iter != end; ++iter) - { - boost::asio::mutable_buffer buffer(*iter); - total_buffer_size += boost::asio::buffer_size(buffer); - } - - if (total_buffer_size == 0) + if (boost::asio::buffer_size(buffers) == 0) return 0; if (storage_.empty()) @@ -253,16 +236,7 @@ public: { ec = boost::system::error_code(); - typename MutableBufferSequence::const_iterator iter = buffers.begin(); - typename MutableBufferSequence::const_iterator end = buffers.end(); - size_t total_buffer_size = 0; - for (; iter != end; ++iter) - { - boost::asio::mutable_buffer buffer(*iter); - total_buffer_size += boost::asio::buffer_size(buffer); - } - - if (total_buffer_size == 0) + if (boost::asio::buffer_size(buffers) == 0) return 0; if (storage_.empty() && !fill(ec)) @@ -294,24 +268,8 @@ public: } else { - using namespace std; // For memcpy. - - std::size_t bytes_avail = storage_.size(); - std::size_t bytes_copied = 0; - - typename MutableBufferSequence::const_iterator iter = buffers_.begin(); - typename MutableBufferSequence::const_iterator end = buffers_.end(); - for (; iter != end && bytes_avail > 0; ++iter) - { - std::size_t max_length = buffer_size(*iter); - std::size_t length = (max_length < bytes_avail) - ? max_length : bytes_avail; - memcpy(buffer_cast<void*>(*iter), - storage_.data() + bytes_copied, length); - bytes_copied += length; - bytes_avail -= length; - } - + std::size_t bytes_copied = boost::asio::buffer_copy( + buffers_, storage_.data(), storage_.size()); storage_.consume(bytes_copied); io_service_.dispatch(detail::bind_handler(handler_, ec, bytes_copied)); } @@ -330,16 +288,7 @@ public: void async_read_some(const MutableBufferSequence& buffers, ReadHandler handler) { - typename MutableBufferSequence::const_iterator iter = buffers.begin(); - typename MutableBufferSequence::const_iterator end = buffers.end(); - size_t total_buffer_size = 0; - for (; iter != end; ++iter) - { - boost::asio::mutable_buffer buffer(*iter); - total_buffer_size += boost::asio::buffer_size(buffer); - } - - if (total_buffer_size == 0) + if (boost::asio::buffer_size(buffers) == 0) { get_io_service().post(detail::bind_handler( handler, boost::system::error_code(), 0)); @@ -398,23 +347,8 @@ private: template <typename MutableBufferSequence> std::size_t copy(const MutableBufferSequence& buffers) { - using namespace std; // For memcpy. - - std::size_t bytes_avail = storage_.size(); - std::size_t bytes_copied = 0; - - typename MutableBufferSequence::const_iterator iter = buffers.begin(); - typename MutableBufferSequence::const_iterator end = buffers.end(); - for (; iter != end && bytes_avail > 0; ++iter) - { - std::size_t max_length = buffer_size(*iter); - std::size_t length = (max_length < bytes_avail) - ? max_length : bytes_avail; - memcpy(buffer_cast<void*>(*iter), storage_.data() + bytes_copied, length); - bytes_copied += length; - bytes_avail -= length; - } - + std::size_t bytes_copied = boost::asio::buffer_copy( + buffers, storage_.data(), storage_.size()); storage_.consume(bytes_copied); return bytes_copied; } @@ -425,24 +359,7 @@ private: template <typename MutableBufferSequence> std::size_t peek_copy(const MutableBufferSequence& buffers) { - using namespace std; // For memcpy. - - std::size_t bytes_avail = storage_.size(); - std::size_t bytes_copied = 0; - - typename MutableBufferSequence::const_iterator iter = buffers.begin(); - typename MutableBufferSequence::const_iterator end = buffers.end(); - for (; iter != end && bytes_avail > 0; ++iter) - { - std::size_t max_length = buffer_size(*iter); - std::size_t length = (max_length < bytes_avail) - ? max_length : bytes_avail; - memcpy(buffer_cast<void*>(*iter), storage_.data() + bytes_copied, length); - bytes_copied += length; - bytes_avail -= length; - } - - return bytes_copied; + return boost::asio::buffer_copy(buffers, storage_.data(), storage_.size()); } /// The next layer. diff --git a/3rdParty/Boost/src/boost/asio/buffered_read_stream_fwd.hpp b/3rdParty/Boost/src/boost/asio/buffered_read_stream_fwd.hpp index 9c8a1af..5c8c295 100644 --- a/3rdParty/Boost/src/boost/asio/buffered_read_stream_fwd.hpp +++ b/3rdParty/Boost/src/boost/asio/buffered_read_stream_fwd.hpp @@ -2,7 +2,7 @@ // buffered_read_stream_fwd.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/buffered_stream.hpp b/3rdParty/Boost/src/boost/asio/buffered_stream.hpp index 43d21de..632e5ce 100644 --- a/3rdParty/Boost/src/boost/asio/buffered_stream.hpp +++ b/3rdParty/Boost/src/boost/asio/buffered_stream.hpp @@ -2,7 +2,7 @@ // buffered_stream.hpp // ~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -87,13 +87,6 @@ public: return stream_impl_.lowest_layer(); } - /// (Deprecated: use get_io_service().) Get the io_service associated with - /// the object. - boost::asio::io_service& io_service() - { - return stream_impl_.get_io_service(); - } - /// Get the io_service associated with the object. boost::asio::io_service& get_io_service() { diff --git a/3rdParty/Boost/src/boost/asio/buffered_stream_fwd.hpp b/3rdParty/Boost/src/boost/asio/buffered_stream_fwd.hpp index 042b990..5241879 100644 --- a/3rdParty/Boost/src/boost/asio/buffered_stream_fwd.hpp +++ b/3rdParty/Boost/src/boost/asio/buffered_stream_fwd.hpp @@ -2,7 +2,7 @@ // buffered_stream_fwd.hpp // ~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/buffered_write_stream.hpp b/3rdParty/Boost/src/boost/asio/buffered_write_stream.hpp index a163b13..11cb872 100644 --- a/3rdParty/Boost/src/boost/asio/buffered_write_stream.hpp +++ b/3rdParty/Boost/src/boost/asio/buffered_write_stream.hpp @@ -2,7 +2,7 @@ // buffered_write_stream.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -17,7 +17,6 @@ #include <boost/asio/detail/config.hpp> #include <cstddef> -#include <cstring> #include <boost/type_traits/remove_reference.hpp> #include <boost/asio/buffered_write_stream_fwd.hpp> #include <boost/asio/buffer.hpp> @@ -98,13 +97,6 @@ public: return next_layer_.lowest_layer(); } - /// (Deprecated: use get_io_service().) Get the io_service associated with - /// the object. - boost::asio::io_service& io_service() - { - return next_layer_.get_io_service(); - } - /// Get the io_service associated with the object. boost::asio::io_service& get_io_service() { @@ -184,16 +176,7 @@ public: template <typename ConstBufferSequence> std::size_t write_some(const ConstBufferSequence& buffers) { - typename ConstBufferSequence::const_iterator iter = buffers.begin(); - typename ConstBufferSequence::const_iterator end = buffers.end(); - size_t total_buffer_size = 0; - for (; iter != end; ++iter) - { - boost::asio::const_buffer buffer(*iter); - total_buffer_size += boost::asio::buffer_size(buffer); - } - - if (total_buffer_size == 0) + if (boost::asio::buffer_size(buffers) == 0) return 0; if (storage_.size() == storage_.capacity()) @@ -210,16 +193,7 @@ public: { ec = boost::system::error_code(); - typename ConstBufferSequence::const_iterator iter = buffers.begin(); - typename ConstBufferSequence::const_iterator end = buffers.end(); - size_t total_buffer_size = 0; - for (; iter != end; ++iter) - { - boost::asio::const_buffer buffer(*iter); - total_buffer_size += boost::asio::buffer_size(buffer); - } - - if (total_buffer_size == 0) + if (boost::asio::buffer_size(buffers) == 0) return 0; if (storage_.size() == storage_.capacity() && !flush(ec)) @@ -251,25 +225,14 @@ public: } else { - using namespace std; // For memcpy. - std::size_t orig_size = storage_.size(); std::size_t space_avail = storage_.capacity() - orig_size; - std::size_t bytes_copied = 0; - - typename ConstBufferSequence::const_iterator iter = buffers_.begin(); - typename ConstBufferSequence::const_iterator end = buffers_.end(); - for (; iter != end && space_avail > 0; ++iter) - { - std::size_t bytes_avail = buffer_size(*iter); - std::size_t length = (bytes_avail < space_avail) - ? bytes_avail : space_avail; - storage_.resize(orig_size + bytes_copied + length); - memcpy(storage_.data() + orig_size + bytes_copied, - buffer_cast<const void*>(*iter), length); - bytes_copied += length; - space_avail -= length; - } + std::size_t bytes_avail = boost::asio::buffer_size(buffers_); + std::size_t length = bytes_avail < space_avail + ? bytes_avail : space_avail; + storage_.resize(orig_size + length); + std::size_t bytes_copied = boost::asio::buffer_copy( + storage_.data() + orig_size, buffers_, length); io_service_.dispatch(detail::bind_handler(handler_, ec, bytes_copied)); } @@ -288,16 +251,7 @@ public: void async_write_some(const ConstBufferSequence& buffers, WriteHandler handler) { - typename ConstBufferSequence::const_iterator iter = buffers.begin(); - typename ConstBufferSequence::const_iterator end = buffers.end(); - size_t total_buffer_size = 0; - for (; iter != end; ++iter) - { - boost::asio::const_buffer buffer(*iter); - total_buffer_size += boost::asio::buffer_size(buffer); - } - - if (total_buffer_size == 0) + if (boost::asio::buffer_size(buffers) == 0) { get_io_service().post(detail::bind_handler( handler, boost::system::error_code(), 0)); @@ -376,27 +330,13 @@ private: template <typename ConstBufferSequence> std::size_t copy(const ConstBufferSequence& buffers) { - using namespace std; // For memcpy. - std::size_t orig_size = storage_.size(); std::size_t space_avail = storage_.capacity() - orig_size; - std::size_t bytes_copied = 0; - - typename ConstBufferSequence::const_iterator iter = buffers.begin(); - typename ConstBufferSequence::const_iterator end = buffers.end(); - for (; iter != end && space_avail > 0; ++iter) - { - std::size_t bytes_avail = buffer_size(*iter); - std::size_t length = (bytes_avail < space_avail) - ? bytes_avail : space_avail; - storage_.resize(orig_size + bytes_copied + length); - memcpy(storage_.data() + orig_size + bytes_copied, - buffer_cast<const void*>(*iter), length); - bytes_copied += length; - space_avail -= length; - } - - return bytes_copied; + std::size_t bytes_avail = boost::asio::buffer_size(buffers); + std::size_t length = bytes_avail < space_avail ? bytes_avail : space_avail; + storage_.resize(orig_size + length); + return boost::asio::buffer_copy( + storage_.data() + orig_size, buffers, length); } /// The next layer. diff --git a/3rdParty/Boost/src/boost/asio/buffered_write_stream_fwd.hpp b/3rdParty/Boost/src/boost/asio/buffered_write_stream_fwd.hpp index 0590a96..2da283f 100644 --- a/3rdParty/Boost/src/boost/asio/buffered_write_stream_fwd.hpp +++ b/3rdParty/Boost/src/boost/asio/buffered_write_stream_fwd.hpp @@ -2,7 +2,7 @@ // buffered_write_stream_fwd.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/buffers_iterator.hpp b/3rdParty/Boost/src/boost/asio/buffers_iterator.hpp index 3375361..c11e146 100644 --- a/3rdParty/Boost/src/boost/asio/buffers_iterator.hpp +++ b/3rdParty/Boost/src/boost/asio/buffers_iterator.hpp @@ -2,7 +2,7 @@ // buffers_iterator.hpp // ~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -17,9 +17,9 @@ #include <boost/asio/detail/config.hpp> #include <cstddef> +#include <iterator> #include <boost/assert.hpp> #include <boost/detail/workaround.hpp> -#include <boost/iterator.hpp> #include <boost/type_traits/is_convertible.hpp> #include <boost/type_traits/add_const.hpp> #include <boost/asio/buffer.hpp> @@ -73,18 +73,47 @@ namespace detail /// A random access iterator over the bytes in a buffer sequence. template <typename BufferSequence, typename ByteType = char> class buffers_iterator - : public boost::iterator< - std::random_access_iterator_tag, - typename detail::buffers_iterator_types< - BufferSequence, ByteType>::byte_type> { private: typedef typename detail::buffers_iterator_types< BufferSequence, ByteType>::buffer_type buffer_type; - typedef typename detail::buffers_iterator_types< - BufferSequence, ByteType>::byte_type byte_type; public: + /// The type used for the distance between two iterators. + typedef std::ptrdiff_t difference_type; + + /// The type of the value pointed to by the iterator. + typedef ByteType value_type; + +#if defined(GENERATING_DOCUMENTATION) + /// The type of the result of applying operator->() to the iterator. + /** + * If the buffer sequence stores buffer objects that are convertible to + * mutable_buffer, this is a pointer to a non-const ByteType. Otherwise, a + * pointer to a const ByteType. + */ + typedef const_or_non_const_ByteType* pointer; +#else // defined(GENERATING_DOCUMENTATION) + typedef typename detail::buffers_iterator_types< + BufferSequence, ByteType>::byte_type* pointer; +#endif // defined(GENERATING_DOCUMENTATION) + +#if defined(GENERATING_DOCUMENTATION) + /// The type of the result of applying operator*() to the iterator. + /** + * If the buffer sequence stores buffer objects that are convertible to + * mutable_buffer, this is a reference to a non-const ByteType. Otherwise, a + * reference to a const ByteType. + */ + typedef const_or_non_const_ByteType& reference; +#else // defined(GENERATING_DOCUMENTATION) + typedef typename detail::buffers_iterator_types< + BufferSequence, ByteType>::byte_type& reference; +#endif // defined(GENERATING_DOCUMENTATION) + + /// The iterator category. + typedef std::random_access_iterator_tag iterator_category; + /// Default constructor. Creates an iterator in an undefined state. buffers_iterator() : current_buffer_(), @@ -99,7 +128,7 @@ public: /// Construct an iterator representing the beginning of the buffers' data. static buffers_iterator begin(const BufferSequence& buffers) #if BOOST_WORKAROUND(__GNUC__, == 4) && BOOST_WORKAROUND(__GNUC_MINOR__, == 3) - __attribute__ ((noinline)) + __attribute__ ((__noinline__)) #endif { buffers_iterator new_iter; @@ -119,7 +148,7 @@ public: /// Construct an iterator representing the end of the buffers' data. static buffers_iterator end(const BufferSequence& buffers) #if BOOST_WORKAROUND(__GNUC__, == 4) && BOOST_WORKAROUND(__GNUC_MINOR__, == 3) - __attribute__ ((noinline)) + __attribute__ ((__noinline__)) #endif { buffers_iterator new_iter; @@ -136,19 +165,19 @@ public: } /// Dereference an iterator. - byte_type& operator*() const + reference operator*() const { return dereference(); } /// Dereference an iterator. - byte_type* operator->() const + pointer operator->() const { return &dereference(); } /// Access an individual element. - byte_type& operator[](std::ptrdiff_t difference) const + reference operator[](std::ptrdiff_t difference) const { buffers_iterator tmp(*this); tmp.advance(difference); @@ -271,9 +300,9 @@ public: private: // Dereference the iterator. - byte_type& dereference() const + reference dereference() const { - return buffer_cast<byte_type*>(current_buffer_)[current_buffer_position_]; + return buffer_cast<pointer>(current_buffer_)[current_buffer_position_]; } // Compare two iterators for equality. diff --git a/3rdParty/Boost/src/boost/asio/completion_condition.hpp b/3rdParty/Boost/src/boost/asio/completion_condition.hpp index 7f5fc09..3d32c65 100644 --- a/3rdParty/Boost/src/boost/asio/completion_condition.hpp +++ b/3rdParty/Boost/src/boost/asio/completion_condition.hpp @@ -2,7 +2,7 @@ // completion_condition.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -76,6 +76,28 @@ private: std::size_t minimum_; }; +class transfer_exactly_t +{ +public: + typedef std::size_t result_type; + + explicit transfer_exactly_t(std::size_t size) + : size_(size) + { + } + + template <typename Error> + std::size_t operator()(const Error& err, std::size_t bytes_transferred) + { + return (!!err || bytes_transferred >= size_) ? 0 : + (size_ - bytes_transferred < default_max_transfer_size + ? size_ - bytes_transferred : std::size_t(default_max_transfer_size)); + } + +private: + std::size_t size_; +}; + } // namespace detail /** @@ -154,6 +176,40 @@ inline detail::transfer_at_least_t transfer_at_least(std::size_t minimum) } #endif +/// Return a completion condition function object that indicates that a read or +/// write operation should continue until an exact number of bytes has been +/// transferred, or until an error occurs. +/** + * This function is used to create an object, of unspecified type, that meets + * CompletionCondition requirements. + * + * @par Example + * Reading until a buffer is full or contains exactly 64 bytes: + * @code + * boost::array<char, 128> buf; + * boost::system::error_code ec; + * std::size_t n = boost::asio::read( + * sock, boost::asio::buffer(buf), + * boost::asio::transfer_exactly(64), ec); + * if (ec) + * { + * // An error occurred. + * } + * else + * { + * // n == 64 + * } + * @endcode + */ +#if defined(GENERATING_DOCUMENTATION) +unspecified transfer_exactly(std::size_t size); +#else +inline detail::transfer_exactly_t transfer_exactly(std::size_t size) +{ + return detail::transfer_exactly_t(size); +} +#endif + /*@}*/ } // namespace asio diff --git a/3rdParty/Boost/src/boost/asio/connect.hpp b/3rdParty/Boost/src/boost/asio/connect.hpp new file mode 100644 index 0000000..e54ea08 --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/connect.hpp @@ -0,0 +1,816 @@ +// +// connect.hpp +// ~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) +// + +#ifndef BOOST_ASIO_CONNECT_HPP +#define BOOST_ASIO_CONNECT_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> +#include <boost/asio/basic_socket.hpp> +#include <boost/asio/error.hpp> + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { + +/** + * @defgroup connect boost::asio::connect + * + * @brief Establishes a socket connection by trying each endpoint in a sequence. + */ +/*@{*/ + +/// Establishes a socket connection by trying each endpoint in a sequence. +/** + * This function attempts to connect a socket to one of a sequence of + * endpoints. It does this by repeated calls to the socket's @c connect member + * function, once for each endpoint in the sequence, until a connection is + * successfully established. + * + * @param s The socket to be connected. If the socket is already open, it will + * be closed. + * + * @param begin An iterator pointing to the start of a sequence of endpoints. + * + * @returns On success, an iterator denoting the successfully connected + * endpoint. Otherwise, the end iterator. + * + * @throws boost::system::system_error Thrown on failure. If the sequence is + * empty, the associated @c error_code is boost::asio::error::not_found. + * Otherwise, contains the error from the last connection attempt. + * + * @note This overload assumes that a default constructed object of type @c + * Iterator represents the end of the sequence. This is a valid assumption for + * iterator types such as @c boost::asio::ip::tcp::resolver::iterator. + * + * @par Example + * @code tcp::resolver r(io_service); + * tcp::resolver::query q("host", "service"); + * tcp::socket s(io_service); + * boost::asio::connect(s, r.resolve(q)); @endcode + */ +template <typename Protocol, typename SocketService, typename Iterator> +Iterator connect(basic_socket<Protocol, SocketService>& s, Iterator begin); + +/// Establishes a socket connection by trying each endpoint in a sequence. +/** + * This function attempts to connect a socket to one of a sequence of + * endpoints. It does this by repeated calls to the socket's @c connect member + * function, once for each endpoint in the sequence, until a connection is + * successfully established. + * + * @param s The socket to be connected. If the socket is already open, it will + * be closed. + * + * @param begin An iterator pointing to the start of a sequence of endpoints. + * + * @param ec Set to indicate what error occurred, if any. If the sequence is + * empty, set to boost::asio::error::not_found. Otherwise, contains the error + * from the last connection attempt. + * + * @returns On success, an iterator denoting the successfully connected + * endpoint. Otherwise, the end iterator. + * + * @note This overload assumes that a default constructed object of type @c + * Iterator represents the end of the sequence. This is a valid assumption for + * iterator types such as @c boost::asio::ip::tcp::resolver::iterator. + * + * @par Example + * @code tcp::resolver r(io_service); + * tcp::resolver::query q("host", "service"); + * tcp::socket s(io_service); + * boost::system::error_code ec; + * boost::asio::connect(s, r.resolve(q), ec); + * if (ec) + * { + * // An error occurred. + * } @endcode + */ +template <typename Protocol, typename SocketService, typename Iterator> +Iterator connect(basic_socket<Protocol, SocketService>& s, + Iterator begin, boost::system::error_code& ec); + +/// Establishes a socket connection by trying each endpoint in a sequence. +/** + * This function attempts to connect a socket to one of a sequence of + * endpoints. It does this by repeated calls to the socket's @c connect member + * function, once for each endpoint in the sequence, until a connection is + * successfully established. + * + * @param s The socket to be connected. If the socket is already open, it will + * be closed. + * + * @param begin An iterator pointing to the start of a sequence of endpoints. + * + * @param end An iterator pointing to the end of a sequence of endpoints. + * + * @returns On success, an iterator denoting the successfully connected + * endpoint. Otherwise, the end iterator. + * + * @throws boost::system::system_error Thrown on failure. If the sequence is + * empty, the associated @c error_code is boost::asio::error::not_found. + * Otherwise, contains the error from the last connection attempt. + * + * @par Example + * @code tcp::resolver r(io_service); + * tcp::resolver::query q("host", "service"); + * tcp::resolver::iterator i = r.resolve(q), end; + * tcp::socket s(io_service); + * boost::asio::connect(s, i, end); @endcode + */ +template <typename Protocol, typename SocketService, typename Iterator> +Iterator connect(basic_socket<Protocol, SocketService>& s, + Iterator begin, Iterator end); + +/// Establishes a socket connection by trying each endpoint in a sequence. +/** + * This function attempts to connect a socket to one of a sequence of + * endpoints. It does this by repeated calls to the socket's @c connect member + * function, once for each endpoint in the sequence, until a connection is + * successfully established. + * + * @param s The socket to be connected. If the socket is already open, it will + * be closed. + * + * @param begin An iterator pointing to the start of a sequence of endpoints. + * + * @param end An iterator pointing to the end of a sequence of endpoints. + * + * @param ec Set to indicate what error occurred, if any. If the sequence is + * empty, set to boost::asio::error::not_found. Otherwise, contains the error + * from the last connection attempt. + * + * @returns On success, an iterator denoting the successfully connected + * endpoint. Otherwise, the end iterator. + * + * @par Example + * @code tcp::resolver r(io_service); + * tcp::resolver::query q("host", "service"); + * tcp::resolver::iterator i = r.resolve(q), end; + * tcp::socket s(io_service); + * boost::system::error_code ec; + * boost::asio::connect(s, i, end, ec); + * if (ec) + * { + * // An error occurred. + * } @endcode + */ +template <typename Protocol, typename SocketService, typename Iterator> +Iterator connect(basic_socket<Protocol, SocketService>& s, + Iterator begin, Iterator end, boost::system::error_code& ec); + +/// Establishes a socket connection by trying each endpoint in a sequence. +/** + * This function attempts to connect a socket to one of a sequence of + * endpoints. It does this by repeated calls to the socket's @c connect member + * function, once for each endpoint in the sequence, until a connection is + * successfully established. + * + * @param s The socket to be connected. If the socket is already open, it will + * be closed. + * + * @param begin An iterator pointing to the start of a sequence of endpoints. + * + * @param connect_condition A function object that is called prior to each + * connection attempt. The signature of the function object must be: + * @code Iterator connect_condition( + * const boost::system::error_code& ec, + * Iterator next); @endcode + * The @c ec parameter contains the result from the most recent connect + * operation. Before the first connection attempt, @c ec is always set to + * indicate success. The @c next parameter is an iterator pointing to the next + * endpoint to be tried. The function object should return the next iterator, + * but is permitted to return a different iterator so that endpoints may be + * skipped. The implementation guarantees that the function object will never + * be called with the end iterator. + * + * @returns On success, an iterator denoting the successfully connected + * endpoint. Otherwise, the end iterator. + * + * @throws boost::system::system_error Thrown on failure. If the sequence is + * empty, the associated @c error_code is boost::asio::error::not_found. + * Otherwise, contains the error from the last connection attempt. + * + * @note This overload assumes that a default constructed object of type @c + * Iterator represents the end of the sequence. This is a valid assumption for + * iterator types such as @c boost::asio::ip::tcp::resolver::iterator. + * + * @par Example + * The following connect condition function object can be used to output + * information about the individual connection attempts: + * @code struct my_connect_condition + * { + * template <typename Iterator> + * Iterator operator()( + * const boost::system::error_code& ec, + * Iterator next) + * { + * if (ec) std::cout << "Error: " << ec.message() << std::endl; + * std::cout << "Trying: " << next->endpoint() << std::endl; + * return next; + * } + * }; @endcode + * It would be used with the boost::asio::connect function as follows: + * @code tcp::resolver r(io_service); + * tcp::resolver::query q("host", "service"); + * tcp::socket s(io_service); + * tcp::resolver::iterator i = boost::asio::connect( + * s, r.resolve(q), my_connect_condition()); + * std::cout << "Connected to: " << i->endpoint() << std::endl; @endcode + */ +template <typename Protocol, typename SocketService, + typename Iterator, typename ConnectCondition> +Iterator connect(basic_socket<Protocol, SocketService>& s, + Iterator begin, ConnectCondition connect_condition); + +/// Establishes a socket connection by trying each endpoint in a sequence. +/** + * This function attempts to connect a socket to one of a sequence of + * endpoints. It does this by repeated calls to the socket's @c connect member + * function, once for each endpoint in the sequence, until a connection is + * successfully established. + * + * @param s The socket to be connected. If the socket is already open, it will + * be closed. + * + * @param begin An iterator pointing to the start of a sequence of endpoints. + * + * @param connect_condition A function object that is called prior to each + * connection attempt. The signature of the function object must be: + * @code Iterator connect_condition( + * const boost::system::error_code& ec, + * Iterator next); @endcode + * The @c ec parameter contains the result from the most recent connect + * operation. Before the first connection attempt, @c ec is always set to + * indicate success. The @c next parameter is an iterator pointing to the next + * endpoint to be tried. The function object should return the next iterator, + * but is permitted to return a different iterator so that endpoints may be + * skipped. The implementation guarantees that the function object will never + * be called with the end iterator. + * + * @param ec Set to indicate what error occurred, if any. If the sequence is + * empty, set to boost::asio::error::not_found. Otherwise, contains the error + * from the last connection attempt. + * + * @returns On success, an iterator denoting the successfully connected + * endpoint. Otherwise, the end iterator. + * + * @note This overload assumes that a default constructed object of type @c + * Iterator represents the end of the sequence. This is a valid assumption for + * iterator types such as @c boost::asio::ip::tcp::resolver::iterator. + * + * @par Example + * The following connect condition function object can be used to output + * information about the individual connection attempts: + * @code struct my_connect_condition + * { + * template <typename Iterator> + * Iterator operator()( + * const boost::system::error_code& ec, + * Iterator next) + * { + * if (ec) std::cout << "Error: " << ec.message() << std::endl; + * std::cout << "Trying: " << next->endpoint() << std::endl; + * return next; + * } + * }; @endcode + * It would be used with the boost::asio::connect function as follows: + * @code tcp::resolver r(io_service); + * tcp::resolver::query q("host", "service"); + * tcp::socket s(io_service); + * boost::system::error_code ec; + * tcp::resolver::iterator i = boost::asio::connect( + * s, r.resolve(q), my_connect_condition(), ec); + * if (ec) + * { + * // An error occurred. + * } + * else + * { + * std::cout << "Connected to: " << i->endpoint() << std::endl; + * } @endcode + */ +template <typename Protocol, typename SocketService, + typename Iterator, typename ConnectCondition> +Iterator connect(basic_socket<Protocol, SocketService>& s, Iterator begin, + ConnectCondition connect_condition, boost::system::error_code& ec); + +/// Establishes a socket connection by trying each endpoint in a sequence. +/** + * This function attempts to connect a socket to one of a sequence of + * endpoints. It does this by repeated calls to the socket's @c connect member + * function, once for each endpoint in the sequence, until a connection is + * successfully established. + * + * @param s The socket to be connected. If the socket is already open, it will + * be closed. + * + * @param begin An iterator pointing to the start of a sequence of endpoints. + * + * @param end An iterator pointing to the end of a sequence of endpoints. + * + * @param connect_condition A function object that is called prior to each + * connection attempt. The signature of the function object must be: + * @code Iterator connect_condition( + * const boost::system::error_code& ec, + * Iterator next); @endcode + * The @c ec parameter contains the result from the most recent connect + * operation. Before the first connection attempt, @c ec is always set to + * indicate success. The @c next parameter is an iterator pointing to the next + * endpoint to be tried. The function object should return the next iterator, + * but is permitted to return a different iterator so that endpoints may be + * skipped. The implementation guarantees that the function object will never + * be called with the end iterator. + * + * @returns On success, an iterator denoting the successfully connected + * endpoint. Otherwise, the end iterator. + * + * @throws boost::system::system_error Thrown on failure. If the sequence is + * empty, the associated @c error_code is boost::asio::error::not_found. + * Otherwise, contains the error from the last connection attempt. + * + * @par Example + * The following connect condition function object can be used to output + * information about the individual connection attempts: + * @code struct my_connect_condition + * { + * template <typename Iterator> + * Iterator operator()( + * const boost::system::error_code& ec, + * Iterator next) + * { + * if (ec) std::cout << "Error: " << ec.message() << std::endl; + * std::cout << "Trying: " << next->endpoint() << std::endl; + * return next; + * } + * }; @endcode + * It would be used with the boost::asio::connect function as follows: + * @code tcp::resolver r(io_service); + * tcp::resolver::query q("host", "service"); + * tcp::resolver::iterator i = r.resolve(q), end; + * tcp::socket s(io_service); + * i = boost::asio::connect(s, i, end, my_connect_condition()); + * std::cout << "Connected to: " << i->endpoint() << std::endl; @endcode + */ +template <typename Protocol, typename SocketService, + typename Iterator, typename ConnectCondition> +Iterator connect(basic_socket<Protocol, SocketService>& s, Iterator begin, + Iterator end, ConnectCondition connect_condition); + +/// Establishes a socket connection by trying each endpoint in a sequence. +/** + * This function attempts to connect a socket to one of a sequence of + * endpoints. It does this by repeated calls to the socket's @c connect member + * function, once for each endpoint in the sequence, until a connection is + * successfully established. + * + * @param s The socket to be connected. If the socket is already open, it will + * be closed. + * + * @param begin An iterator pointing to the start of a sequence of endpoints. + * + * @param end An iterator pointing to the end of a sequence of endpoints. + * + * @param connect_condition A function object that is called prior to each + * connection attempt. The signature of the function object must be: + * @code Iterator connect_condition( + * const boost::system::error_code& ec, + * Iterator next); @endcode + * The @c ec parameter contains the result from the most recent connect + * operation. Before the first connection attempt, @c ec is always set to + * indicate success. The @c next parameter is an iterator pointing to the next + * endpoint to be tried. The function object should return the next iterator, + * but is permitted to return a different iterator so that endpoints may be + * skipped. The implementation guarantees that the function object will never + * be called with the end iterator. + * + * @param ec Set to indicate what error occurred, if any. If the sequence is + * empty, set to boost::asio::error::not_found. Otherwise, contains the error + * from the last connection attempt. + * + * @returns On success, an iterator denoting the successfully connected + * endpoint. Otherwise, the end iterator. + * + * @par Example + * The following connect condition function object can be used to output + * information about the individual connection attempts: + * @code struct my_connect_condition + * { + * template <typename Iterator> + * Iterator operator()( + * const boost::system::error_code& ec, + * Iterator next) + * { + * if (ec) std::cout << "Error: " << ec.message() << std::endl; + * std::cout << "Trying: " << next->endpoint() << std::endl; + * return next; + * } + * }; @endcode + * It would be used with the boost::asio::connect function as follows: + * @code tcp::resolver r(io_service); + * tcp::resolver::query q("host", "service"); + * tcp::resolver::iterator i = r.resolve(q), end; + * tcp::socket s(io_service); + * boost::system::error_code ec; + * i = boost::asio::connect(s, i, end, my_connect_condition(), ec); + * if (ec) + * { + * // An error occurred. + * } + * else + * { + * std::cout << "Connected to: " << i->endpoint() << std::endl; + * } @endcode + */ +template <typename Protocol, typename SocketService, + typename Iterator, typename ConnectCondition> +Iterator connect(basic_socket<Protocol, SocketService>& s, + Iterator begin, Iterator end, ConnectCondition connect_condition, + boost::system::error_code& ec); + +/*@}*/ + +/** + * @defgroup async_connect boost::asio::async_connect + * + * @brief Asynchronously establishes a socket connection by trying each + * endpoint in a sequence. + */ +/*@{*/ + +/// Asynchronously establishes a socket connection by trying each endpoint in a +/// sequence. +/** + * This function attempts to connect a socket to one of a sequence of + * endpoints. It does this by repeated calls to the socket's @c async_connect + * member function, once for each endpoint in the sequence, until a connection + * is successfully established. + * + * @param s The socket to be connected. If the socket is already open, it will + * be closed. + * + * @param begin An iterator pointing to the start of a sequence of endpoints. + * + * @param handler The handler to be called when the connect operation + * completes. Copies will be made of the handler as required. The function + * signature of the handler must be: + * @code void handler( + * // Result of operation. if the sequence is empty, set to + * // boost::asio::error::not_found. Otherwise, contains the + * // error from the last connection attempt. + * const boost::system::error_code& error, + * + * // On success, an iterator denoting the successfully + * // connected endpoint. Otherwise, the end iterator. + * Iterator iterator + * ); @endcode + * Regardless of whether the asynchronous operation completes immediately or + * not, the handler will not be invoked from within this function. Invocation + * of the handler will be performed in a manner equivalent to using + * boost::asio::io_service::post(). + * + * @note This overload assumes that a default constructed object of type @c + * Iterator represents the end of the sequence. This is a valid assumption for + * iterator types such as @c boost::asio::ip::tcp::resolver::iterator. + * + * @par Example + * @code tcp::resolver r(io_service); + * tcp::resolver::query q("host", "service"); + * tcp::socket s(io_service); + * + * // ... + * + * r.async_resolve(q, resolve_handler); + * + * // ... + * + * void resolve_handler( + * const boost::system::error_code& ec, + * tcp::resolver::iterator i) + * { + * if (!ec) + * { + * boost::asio::async_connect(s, i, connect_handler); + * } + * } + * + * // ... + * + * void connect_handler( + * const boost::system::error_code& ec, + * tcp::resolver::iterator i) + * { + * // ... + * } @endcode + */ +template <typename Protocol, typename SocketService, + typename Iterator, typename ComposedConnectHandler> +void async_connect(basic_socket<Protocol, SocketService>& s, + Iterator begin, BOOST_ASIO_MOVE_ARG(ComposedConnectHandler) handler); + +/// Asynchronously establishes a socket connection by trying each endpoint in a +/// sequence. +/** + * This function attempts to connect a socket to one of a sequence of + * endpoints. It does this by repeated calls to the socket's @c async_connect + * member function, once for each endpoint in the sequence, until a connection + * is successfully established. + * + * @param s The socket to be connected. If the socket is already open, it will + * be closed. + * + * @param begin An iterator pointing to the start of a sequence of endpoints. + * + * @param end An iterator pointing to the end of a sequence of endpoints. + * + * @param handler The handler to be called when the connect operation + * completes. Copies will be made of the handler as required. The function + * signature of the handler must be: + * @code void handler( + * // Result of operation. if the sequence is empty, set to + * // boost::asio::error::not_found. Otherwise, contains the + * // error from the last connection attempt. + * const boost::system::error_code& error, + * + * // On success, an iterator denoting the successfully + * // connected endpoint. Otherwise, the end iterator. + * Iterator iterator + * ); @endcode + * Regardless of whether the asynchronous operation completes immediately or + * not, the handler will not be invoked from within this function. Invocation + * of the handler will be performed in a manner equivalent to using + * boost::asio::io_service::post(). + * + * @par Example + * @code tcp::resolver r(io_service); + * tcp::resolver::query q("host", "service"); + * tcp::socket s(io_service); + * + * // ... + * + * r.async_resolve(q, resolve_handler); + * + * // ... + * + * void resolve_handler( + * const boost::system::error_code& ec, + * tcp::resolver::iterator i) + * { + * if (!ec) + * { + * tcp::resolver::iterator end; + * boost::asio::async_connect(s, i, end, connect_handler); + * } + * } + * + * // ... + * + * void connect_handler( + * const boost::system::error_code& ec, + * tcp::resolver::iterator i) + * { + * // ... + * } @endcode + */ +template <typename Protocol, typename SocketService, + typename Iterator, typename ComposedConnectHandler> +void async_connect(basic_socket<Protocol, SocketService>& s, + Iterator begin, Iterator end, + BOOST_ASIO_MOVE_ARG(ComposedConnectHandler) handler); + +/// Asynchronously establishes a socket connection by trying each endpoint in a +/// sequence. +/** + * This function attempts to connect a socket to one of a sequence of + * endpoints. It does this by repeated calls to the socket's @c async_connect + * member function, once for each endpoint in the sequence, until a connection + * is successfully established. + * + * @param s The socket to be connected. If the socket is already open, it will + * be closed. + * + * @param begin An iterator pointing to the start of a sequence of endpoints. + * + * @param connect_condition A function object that is called prior to each + * connection attempt. The signature of the function object must be: + * @code Iterator connect_condition( + * const boost::system::error_code& ec, + * Iterator next); @endcode + * The @c ec parameter contains the result from the most recent connect + * operation. Before the first connection attempt, @c ec is always set to + * indicate success. The @c next parameter is an iterator pointing to the next + * endpoint to be tried. The function object should return the next iterator, + * but is permitted to return a different iterator so that endpoints may be + * skipped. The implementation guarantees that the function object will never + * be called with the end iterator. + * + * @param handler The handler to be called when the connect operation + * completes. Copies will be made of the handler as required. The function + * signature of the handler must be: + * @code void handler( + * // Result of operation. if the sequence is empty, set to + * // boost::asio::error::not_found. Otherwise, contains the + * // error from the last connection attempt. + * const boost::system::error_code& error, + * + * // On success, an iterator denoting the successfully + * // connected endpoint. Otherwise, the end iterator. + * Iterator iterator + * ); @endcode + * Regardless of whether the asynchronous operation completes immediately or + * not, the handler will not be invoked from within this function. Invocation + * of the handler will be performed in a manner equivalent to using + * boost::asio::io_service::post(). + * + * @note This overload assumes that a default constructed object of type @c + * Iterator represents the end of the sequence. This is a valid assumption for + * iterator types such as @c boost::asio::ip::tcp::resolver::iterator. + * + * @par Example + * The following connect condition function object can be used to output + * information about the individual connection attempts: + * @code struct my_connect_condition + * { + * template <typename Iterator> + * Iterator operator()( + * const boost::system::error_code& ec, + * Iterator next) + * { + * if (ec) std::cout << "Error: " << ec.message() << std::endl; + * std::cout << "Trying: " << next->endpoint() << std::endl; + * return next; + * } + * }; @endcode + * It would be used with the boost::asio::connect function as follows: + * @code tcp::resolver r(io_service); + * tcp::resolver::query q("host", "service"); + * tcp::socket s(io_service); + * + * // ... + * + * r.async_resolve(q, resolve_handler); + * + * // ... + * + * void resolve_handler( + * const boost::system::error_code& ec, + * tcp::resolver::iterator i) + * { + * if (!ec) + * { + * boost::asio::async_connect(s, i, + * my_connect_condition(), + * connect_handler); + * } + * } + * + * // ... + * + * void connect_handler( + * const boost::system::error_code& ec, + * tcp::resolver::iterator i) + * { + * if (ec) + * { + * // An error occurred. + * } + * else + * { + * std::cout << "Connected to: " << i->endpoint() << std::endl; + * } + * } @endcode + */ +template <typename Protocol, typename SocketService, typename Iterator, + typename ConnectCondition, typename ComposedConnectHandler> +void async_connect(basic_socket<Protocol, SocketService>& s, Iterator begin, + ConnectCondition connect_condition, + BOOST_ASIO_MOVE_ARG(ComposedConnectHandler) handler); + +/// Asynchronously establishes a socket connection by trying each endpoint in a +/// sequence. +/** + * This function attempts to connect a socket to one of a sequence of + * endpoints. It does this by repeated calls to the socket's @c async_connect + * member function, once for each endpoint in the sequence, until a connection + * is successfully established. + * + * @param s The socket to be connected. If the socket is already open, it will + * be closed. + * + * @param begin An iterator pointing to the start of a sequence of endpoints. + * + * @param end An iterator pointing to the end of a sequence of endpoints. + * + * @param connect_condition A function object that is called prior to each + * connection attempt. The signature of the function object must be: + * @code Iterator connect_condition( + * const boost::system::error_code& ec, + * Iterator next); @endcode + * The @c ec parameter contains the result from the most recent connect + * operation. Before the first connection attempt, @c ec is always set to + * indicate success. The @c next parameter is an iterator pointing to the next + * endpoint to be tried. The function object should return the next iterator, + * but is permitted to return a different iterator so that endpoints may be + * skipped. The implementation guarantees that the function object will never + * be called with the end iterator. + * + * @param handler The handler to be called when the connect operation + * completes. Copies will be made of the handler as required. The function + * signature of the handler must be: + * @code void handler( + * // Result of operation. if the sequence is empty, set to + * // boost::asio::error::not_found. Otherwise, contains the + * // error from the last connection attempt. + * const boost::system::error_code& error, + * + * // On success, an iterator denoting the successfully + * // connected endpoint. Otherwise, the end iterator. + * Iterator iterator + * ); @endcode + * Regardless of whether the asynchronous operation completes immediately or + * not, the handler will not be invoked from within this function. Invocation + * of the handler will be performed in a manner equivalent to using + * boost::asio::io_service::post(). + * + * @par Example + * The following connect condition function object can be used to output + * information about the individual connection attempts: + * @code struct my_connect_condition + * { + * template <typename Iterator> + * Iterator operator()( + * const boost::system::error_code& ec, + * Iterator next) + * { + * if (ec) std::cout << "Error: " << ec.message() << std::endl; + * std::cout << "Trying: " << next->endpoint() << std::endl; + * return next; + * } + * }; @endcode + * It would be used with the boost::asio::connect function as follows: + * @code tcp::resolver r(io_service); + * tcp::resolver::query q("host", "service"); + * tcp::socket s(io_service); + * + * // ... + * + * r.async_resolve(q, resolve_handler); + * + * // ... + * + * void resolve_handler( + * const boost::system::error_code& ec, + * tcp::resolver::iterator i) + * { + * if (!ec) + * { + * tcp::resolver::iterator end; + * boost::asio::async_connect(s, i, end, + * my_connect_condition(), + * connect_handler); + * } + * } + * + * // ... + * + * void connect_handler( + * const boost::system::error_code& ec, + * tcp::resolver::iterator i) + * { + * if (ec) + * { + * // An error occurred. + * } + * else + * { + * std::cout << "Connected to: " << i->endpoint() << std::endl; + * } + * } @endcode + */ +template <typename Protocol, typename SocketService, typename Iterator, + typename ConnectCondition, typename ComposedConnectHandler> +void async_connect(basic_socket<Protocol, SocketService>& s, + Iterator begin, Iterator end, ConnectCondition connect_condition, + BOOST_ASIO_MOVE_ARG(ComposedConnectHandler) handler); + +/*@}*/ + +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#include <boost/asio/impl/connect.hpp> + +#endif diff --git a/3rdParty/Boost/src/boost/asio/datagram_socket_service.hpp b/3rdParty/Boost/src/boost/asio/datagram_socket_service.hpp index 0db1f34..6e60a4f 100644 --- a/3rdParty/Boost/src/boost/asio/datagram_socket_service.hpp +++ b/3rdParty/Boost/src/boost/asio/datagram_socket_service.hpp @@ -2,7 +2,7 @@ // datagram_socket_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -68,11 +68,18 @@ public: typedef typename service_impl_type::implementation_type implementation_type; #endif - /// The native socket type. + /// (Deprecated: Use native_handle_type.) The native socket type. #if defined(GENERATING_DOCUMENTATION) typedef implementation_defined native_type; #else - typedef typename service_impl_type::native_type native_type; + typedef typename service_impl_type::native_handle_type native_type; +#endif + + /// The native socket type. +#if defined(GENERATING_DOCUMENTATION) + typedef implementation_defined native_handle_type; +#else + typedef typename service_impl_type::native_handle_type native_handle_type; #endif /// Construct a new datagram socket service for the specified io_service. @@ -83,18 +90,29 @@ public: { } - /// Destroy all user-defined handler objects owned by the service. - void shutdown_service() - { - service_impl_.shutdown_service(); - } - /// Construct a new datagram socket implementation. void construct(implementation_type& impl) { service_impl_.construct(impl); } +#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Move-construct a new datagram socket implementation. + void move_construct(implementation_type& impl, + implementation_type& other_impl) + { + service_impl_.move_construct(impl, other_impl); + } + + /// Move-assign from another datagram socket implementation. + void move_assign(implementation_type& impl, + datagram_socket_service& other_service, + implementation_type& other_impl) + { + service_impl_.move_assign(impl, other_service.service_impl_, other_impl); + } +#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Destroy a datagram socket implementation. void destroy(implementation_type& impl) { @@ -114,7 +132,7 @@ public: /// Assign an existing native socket to a datagram socket. boost::system::error_code assign(implementation_type& impl, - const protocol_type& protocol, const native_type& native_socket, + const protocol_type& protocol, const native_handle_type& native_socket, boost::system::error_code& ec) { return service_impl_.assign(impl, protocol, native_socket, ec); @@ -133,10 +151,16 @@ public: return service_impl_.close(impl, ec); } - /// Get the native socket implementation. + /// (Deprecated: Use native_handle().) Get the native socket implementation. native_type native(implementation_type& impl) { - return service_impl_.native(impl); + return service_impl_.native_handle(impl); + } + + /// Get the native socket implementation. + native_handle_type native_handle(implementation_type& impl) + { + return service_impl_.native_handle(impl); } /// Cancel all asynchronous operations associated with the socket. @@ -177,9 +201,11 @@ public: /// Start an asynchronous connect. template <typename ConnectHandler> void async_connect(implementation_type& impl, - const endpoint_type& peer_endpoint, ConnectHandler handler) + const endpoint_type& peer_endpoint, + BOOST_ASIO_MOVE_ARG(ConnectHandler) handler) { - service_impl_.async_connect(impl, peer_endpoint, handler); + service_impl_.async_connect(impl, peer_endpoint, + BOOST_ASIO_MOVE_CAST(ConnectHandler)(handler)); } /// Set a socket option. @@ -206,6 +232,32 @@ public: return service_impl_.io_control(impl, command, ec); } + /// Gets the non-blocking mode of the socket. + bool non_blocking(const implementation_type& impl) const + { + return service_impl_.non_blocking(impl); + } + + /// Sets the non-blocking mode of the socket. + boost::system::error_code non_blocking(implementation_type& impl, + bool mode, boost::system::error_code& ec) + { + return service_impl_.non_blocking(impl, mode, ec); + } + + /// Gets the non-blocking mode of the native socket implementation. + bool native_non_blocking(const implementation_type& impl) const + { + return service_impl_.native_non_blocking(impl); + } + + /// Sets the non-blocking mode of the native socket implementation. + boost::system::error_code native_non_blocking(implementation_type& impl, + bool mode, boost::system::error_code& ec) + { + return service_impl_.native_non_blocking(impl, mode, ec); + } + /// Get the local endpoint. endpoint_type local_endpoint(const implementation_type& impl, boost::system::error_code& ec) const @@ -239,9 +291,11 @@ public: /// Start an asynchronous send. template <typename ConstBufferSequence, typename WriteHandler> void async_send(implementation_type& impl, const ConstBufferSequence& buffers, - socket_base::message_flags flags, WriteHandler handler) + socket_base::message_flags flags, + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { - service_impl_.async_send(impl, buffers, flags, handler); + service_impl_.async_send(impl, buffers, flags, + BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); } /// Send a datagram to the specified endpoint. @@ -257,9 +311,11 @@ public: template <typename ConstBufferSequence, typename WriteHandler> void async_send_to(implementation_type& impl, const ConstBufferSequence& buffers, const endpoint_type& destination, - socket_base::message_flags flags, WriteHandler handler) + socket_base::message_flags flags, + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { - service_impl_.async_send_to(impl, buffers, destination, flags, handler); + service_impl_.async_send_to(impl, buffers, destination, flags, + BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); } /// Receive some data from the peer. @@ -275,9 +331,11 @@ public: template <typename MutableBufferSequence, typename ReadHandler> void async_receive(implementation_type& impl, const MutableBufferSequence& buffers, - socket_base::message_flags flags, ReadHandler handler) + socket_base::message_flags flags, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { - service_impl_.async_receive(impl, buffers, flags, handler); + service_impl_.async_receive(impl, buffers, flags, + BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); } /// Receive a datagram with the endpoint of the sender. @@ -294,13 +352,20 @@ public: template <typename MutableBufferSequence, typename ReadHandler> void async_receive_from(implementation_type& impl, const MutableBufferSequence& buffers, endpoint_type& sender_endpoint, - socket_base::message_flags flags, ReadHandler handler) + socket_base::message_flags flags, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { service_impl_.async_receive_from(impl, buffers, sender_endpoint, flags, - handler); + BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); } private: + // Destroy all user-defined handler objects owned by the service. + void shutdown_service() + { + service_impl_.shutdown_service(); + } + // The platform-specific implementation. service_impl_type service_impl_; }; diff --git a/3rdParty/Boost/src/boost/asio/deadline_timer.hpp b/3rdParty/Boost/src/boost/asio/deadline_timer.hpp index 866588b..82e65a7 100644 --- a/3rdParty/Boost/src/boost/asio/deadline_timer.hpp +++ b/3rdParty/Boost/src/boost/asio/deadline_timer.hpp @@ -2,7 +2,7 @@ // deadline_timer.hpp // ~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/deadline_timer_service.hpp b/3rdParty/Boost/src/boost/asio/deadline_timer_service.hpp index ce8fd13..b538307 100644 --- a/3rdParty/Boost/src/boost/asio/deadline_timer_service.hpp +++ b/3rdParty/Boost/src/boost/asio/deadline_timer_service.hpp @@ -2,7 +2,7 @@ // deadline_timer_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -20,6 +20,7 @@ #include <boost/asio/detail/deadline_timer_service.hpp> #include <boost/asio/io_service.hpp> #include <boost/asio/time_traits.hpp> +#include <boost/asio/detail/timer_queue_ptime.hpp> #include <boost/asio/detail/push_options.hpp> @@ -72,12 +73,6 @@ public: { } - /// Destroy all user-defined handler objects owned by the service. - void shutdown_service() - { - service_impl_.shutdown_service(); - } - /// Construct a new timer implementation. void construct(implementation_type& impl) { @@ -96,6 +91,13 @@ public: return service_impl_.cancel(impl, ec); } + /// Cancels one asynchronous wait operation associated with the timer. + std::size_t cancel_one(implementation_type& impl, + boost::system::error_code& ec) + { + return service_impl_.cancel_one(impl, ec); + } + /// Get the expiry time for the timer as an absolute time. time_type expires_at(const implementation_type& impl) const { @@ -130,12 +132,19 @@ public: // Start an asynchronous wait on the timer. template <typename WaitHandler> - void async_wait(implementation_type& impl, WaitHandler handler) + void async_wait(implementation_type& impl, + BOOST_ASIO_MOVE_ARG(WaitHandler) handler) { - service_impl_.async_wait(impl, handler); + service_impl_.async_wait(impl, BOOST_ASIO_MOVE_CAST(WaitHandler)(handler)); } private: + // Destroy all user-defined handler objects owned by the service. + void shutdown_service() + { + service_impl_.shutdown_service(); + } + // The platform-specific implementation. service_impl_type service_impl_; }; diff --git a/3rdParty/Boost/src/boost/asio/detail/array.hpp b/3rdParty/Boost/src/boost/asio/detail/array.hpp new file mode 100644 index 0000000..be141b1 --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/detail/array.hpp @@ -0,0 +1,40 @@ +// +// detail/array.hpp +// ~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) +// + +#ifndef BOOST_ASIO_DETAIL_ARRAY_HPP +#define BOOST_ASIO_DETAIL_ARRAY_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> + +#if defined(BOOST_ASIO_HAS_STD_ARRAY) +# include <array> +#else // defined(BOOST_ASIO_HAS_STD_ARRAY) +# include <boost/array.hpp> +#endif // defined(BOOST_ASIO_HAS_STD_ARRAY) + +namespace boost { +namespace asio { +namespace detail { + +#if defined(BOOST_ASIO_HAS_STD_ARRAY) +using std::array; +#else // defined(BOOST_ASIO_HAS_STD_ARRAY) +using boost::array; +#endif // defined(BOOST_ASIO_HAS_STD_ARRAY) + +} // namespace detail +} // namespace asio +} // namespace boost + +#endif // BOOST_ASIO_DETAIL_ARRAY_HPP diff --git a/3rdParty/Boost/src/boost/asio/detail/array_fwd.hpp b/3rdParty/Boost/src/boost/asio/detail/array_fwd.hpp index b7a27bf..f97ed0b 100644 --- a/3rdParty/Boost/src/boost/asio/detail/array_fwd.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/array_fwd.hpp @@ -2,7 +2,7 @@ // detail/array_fwd.hpp // ~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -15,6 +15,8 @@ # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) +#include <boost/asio/detail/config.hpp> + namespace boost { template<class T, std::size_t N> @@ -22,4 +24,11 @@ class array; } // namespace boost +// Standard library components can't be forward declared, so we'll have to +// include the array header. Fortunately, it's fairly lightweight and doesn't +// add significantly to the compile time. +#if defined(BOOST_ASIO_HAS_STD_ARRAY) +# include <array> +#endif // defined(BOOST_ASIO_HAS_STD_ARRAY) + #endif // BOOST_ASIO_DETAIL_ARRAY_FWD_HPP diff --git a/3rdParty/Boost/src/boost/asio/detail/atomic_count.hpp b/3rdParty/Boost/src/boost/asio/detail/atomic_count.hpp new file mode 100644 index 0000000..5e0051a --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/detail/atomic_count.hpp @@ -0,0 +1,47 @@ +// +// detail/atomic_count.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) +// + +#ifndef BOOST_ASIO_DETAIL_ATOMIC_COUNT_HPP +#define BOOST_ASIO_DETAIL_ATOMIC_COUNT_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> + +#if !defined(BOOST_HAS_THREADS) || defined(BOOST_ASIO_DISABLE_THREADS) +// Nothing to include. +#elif defined(BOOST_ASIO_HAS_STD_ATOMIC) +# include <atomic> +#else // defined(BOOST_ASIO_HAS_STD_ATOMIC) +# include <boost/detail/atomic_count.hpp> +#endif // defined(BOOST_ASIO_HAS_STD_ATOMIC) + +namespace boost { +namespace asio { +namespace detail { + +#if !defined(BOOST_HAS_THREADS) || defined(BOOST_ASIO_DISABLE_THREADS) +typedef long atomic_count; +inline void increment(atomic_count& a, long b) { a += b; } +#elif defined(BOOST_ASIO_HAS_STD_ATOMIC) +typedef std::atomic<long> atomic_count; +inline void increment(atomic_count& a, long b) { a += b; } +#else // defined(BOOST_ASIO_HAS_STD_ATOMIC) +typedef boost::detail::atomic_count atomic_count; +inline void increment(atomic_count& a, long b) { while (b > 0) ++a, --b; } +#endif // defined(BOOST_ASIO_HAS_STD_ATOMIC) + +} // namespace detail +} // namespace asio +} // namespace boost + +#endif // BOOST_ASIO_DETAIL_ATOMIC_COUNT_HPP diff --git a/3rdParty/Boost/src/boost/asio/detail/base_from_completion_cond.hpp b/3rdParty/Boost/src/boost/asio/detail/base_from_completion_cond.hpp index b2b76d6..635b9c1 100644 --- a/3rdParty/Boost/src/boost/asio/detail/base_from_completion_cond.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/base_from_completion_cond.hpp @@ -2,7 +2,7 @@ // detail/base_from_completion_cond.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/bind_handler.hpp b/3rdParty/Boost/src/boost/asio/detail/bind_handler.hpp index 0199643..0bd7e53 100644 --- a/3rdParty/Boost/src/boost/asio/detail/bind_handler.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/bind_handler.hpp @@ -2,7 +2,7 @@ // detail/bind_handler.hpp // ~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -35,6 +35,12 @@ public: { } + binder1(Handler& handler, const Arg1& arg1) + : handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)), + arg1_(arg1) + { + } + void operator()() { handler_(static_cast<const Arg1&>(arg1_)); @@ -67,6 +73,14 @@ inline void asio_handler_deallocate(void* pointer, std::size_t size, } template <typename Function, typename Handler, typename Arg1> +inline void asio_handler_invoke(Function& function, + binder1<Handler, Arg1>* this_handler) +{ + boost_asio_handler_invoke_helpers::invoke( + function, this_handler->handler_); +} + +template <typename Function, typename Handler, typename Arg1> inline void asio_handler_invoke(const Function& function, binder1<Handler, Arg1>* this_handler) { @@ -75,7 +89,7 @@ inline void asio_handler_invoke(const Function& function, } template <typename Handler, typename Arg1> -inline binder1<Handler, Arg1> bind_handler(const Handler& handler, +inline binder1<Handler, Arg1> bind_handler(Handler handler, const Arg1& arg1) { return binder1<Handler, Arg1>(handler, arg1); @@ -92,6 +106,13 @@ public: { } + binder2(Handler& handler, const Arg1& arg1, const Arg2& arg2) + : handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)), + arg1_(arg1), + arg2_(arg2) + { + } + void operator()() { handler_(static_cast<const Arg1&>(arg1_), @@ -126,6 +147,14 @@ inline void asio_handler_deallocate(void* pointer, std::size_t size, } template <typename Function, typename Handler, typename Arg1, typename Arg2> +inline void asio_handler_invoke(Function& function, + binder2<Handler, Arg1, Arg2>* this_handler) +{ + boost_asio_handler_invoke_helpers::invoke( + function, this_handler->handler_); +} + +template <typename Function, typename Handler, typename Arg1, typename Arg2> inline void asio_handler_invoke(const Function& function, binder2<Handler, Arg1, Arg2>* this_handler) { @@ -134,7 +163,7 @@ inline void asio_handler_invoke(const Function& function, } template <typename Handler, typename Arg1, typename Arg2> -inline binder2<Handler, Arg1, Arg2> bind_handler(const Handler& handler, +inline binder2<Handler, Arg1, Arg2> bind_handler(Handler handler, const Arg1& arg1, const Arg2& arg2) { return binder2<Handler, Arg1, Arg2>(handler, arg1, arg2); @@ -153,6 +182,15 @@ public: { } + binder3(Handler& handler, const Arg1& arg1, const Arg2& arg2, + const Arg3& arg3) + : handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)), + arg1_(arg1), + arg2_(arg2), + arg3_(arg3) + { + } + void operator()() { handler_(static_cast<const Arg1&>(arg1_), @@ -190,6 +228,15 @@ inline void asio_handler_deallocate(void* pointer, std::size_t size, template <typename Function, typename Handler, typename Arg1, typename Arg2, typename Arg3> +inline void asio_handler_invoke(Function& function, + binder3<Handler, Arg1, Arg2, Arg3>* this_handler) +{ + boost_asio_handler_invoke_helpers::invoke( + function, this_handler->handler_); +} + +template <typename Function, typename Handler, typename Arg1, typename Arg2, + typename Arg3> inline void asio_handler_invoke(const Function& function, binder3<Handler, Arg1, Arg2, Arg3>* this_handler) { @@ -198,7 +245,7 @@ inline void asio_handler_invoke(const Function& function, } template <typename Handler, typename Arg1, typename Arg2, typename Arg3> -inline binder3<Handler, Arg1, Arg2, Arg3> bind_handler(const Handler& handler, +inline binder3<Handler, Arg1, Arg2, Arg3> bind_handler(Handler handler, const Arg1& arg1, const Arg2& arg2, const Arg3& arg3) { return binder3<Handler, Arg1, Arg2, Arg3>(handler, arg1, arg2, arg3); @@ -219,6 +266,16 @@ public: { } + binder4(Handler& handler, const Arg1& arg1, const Arg2& arg2, + const Arg3& arg3, const Arg4& arg4) + : handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)), + arg1_(arg1), + arg2_(arg2), + arg3_(arg3), + arg4_(arg4) + { + } + void operator()() { handler_(static_cast<const Arg1&>(arg1_), @@ -260,6 +317,15 @@ inline void asio_handler_deallocate(void* pointer, std::size_t size, template <typename Function, typename Handler, typename Arg1, typename Arg2, typename Arg3, typename Arg4> +inline void asio_handler_invoke(Function& function, + binder4<Handler, Arg1, Arg2, Arg3, Arg4>* this_handler) +{ + boost_asio_handler_invoke_helpers::invoke( + function, this_handler->handler_); +} + +template <typename Function, typename Handler, typename Arg1, typename Arg2, + typename Arg3, typename Arg4> inline void asio_handler_invoke(const Function& function, binder4<Handler, Arg1, Arg2, Arg3, Arg4>* this_handler) { @@ -270,7 +336,7 @@ inline void asio_handler_invoke(const Function& function, template <typename Handler, typename Arg1, typename Arg2, typename Arg3, typename Arg4> inline binder4<Handler, Arg1, Arg2, Arg3, Arg4> bind_handler( - const Handler& handler, const Arg1& arg1, const Arg2& arg2, + Handler handler, const Arg1& arg1, const Arg2& arg2, const Arg3& arg3, const Arg4& arg4) { return binder4<Handler, Arg1, Arg2, Arg3, Arg4>(handler, arg1, arg2, arg3, @@ -293,6 +359,17 @@ public: { } + binder5(Handler& handler, const Arg1& arg1, const Arg2& arg2, + const Arg3& arg3, const Arg4& arg4, const Arg5& arg5) + : handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)), + arg1_(arg1), + arg2_(arg2), + arg3_(arg3), + arg4_(arg4), + arg5_(arg5) + { + } + void operator()() { handler_(static_cast<const Arg1&>(arg1_), @@ -336,6 +413,15 @@ inline void asio_handler_deallocate(void* pointer, std::size_t size, template <typename Function, typename Handler, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5> +inline void asio_handler_invoke(Function& function, + binder5<Handler, Arg1, Arg2, Arg3, Arg4, Arg5>* this_handler) +{ + boost_asio_handler_invoke_helpers::invoke( + function, this_handler->handler_); +} + +template <typename Function, typename Handler, typename Arg1, typename Arg2, + typename Arg3, typename Arg4, typename Arg5> inline void asio_handler_invoke(const Function& function, binder5<Handler, Arg1, Arg2, Arg3, Arg4, Arg5>* this_handler) { @@ -346,7 +432,7 @@ inline void asio_handler_invoke(const Function& function, template <typename Handler, typename Arg1, typename Arg2, typename Arg3, typename Arg4, typename Arg5> inline binder5<Handler, Arg1, Arg2, Arg3, Arg4, Arg5> bind_handler( - const Handler& handler, const Arg1& arg1, const Arg2& arg2, + Handler handler, const Arg1& arg1, const Arg2& arg2, const Arg3& arg3, const Arg4& arg4, const Arg5& arg5) { return binder5<Handler, Arg1, Arg2, Arg3, Arg4, Arg5>(handler, arg1, arg2, diff --git a/3rdParty/Boost/src/boost/asio/detail/buffer_resize_guard.hpp b/3rdParty/Boost/src/boost/asio/detail/buffer_resize_guard.hpp index 7df4128..ea78330 100644 --- a/3rdParty/Boost/src/boost/asio/detail/buffer_resize_guard.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/buffer_resize_guard.hpp @@ -2,7 +2,7 @@ // detail/buffer_resize_guard.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/buffer_sequence_adapter.hpp b/3rdParty/Boost/src/boost/asio/detail/buffer_sequence_adapter.hpp index fdda23f..562aa55 100644 --- a/3rdParty/Boost/src/boost/asio/detail/buffer_sequence_adapter.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/buffer_sequence_adapter.hpp @@ -2,7 +2,7 @@ // detail/buffer_sequence_adapter.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -17,6 +17,7 @@ #include <boost/asio/detail/config.hpp> #include <boost/asio/buffer.hpp> +#include <boost/asio/detail/array_fwd.hpp> #include <boost/asio/detail/socket_types.hpp> #include <boost/asio/detail/push_options.hpp> @@ -81,11 +82,11 @@ class buffer_sequence_adapter : buffer_sequence_adapter_base { public: - explicit buffer_sequence_adapter(const Buffers& buffers) + explicit buffer_sequence_adapter(const Buffers& buffer_sequence) : count_(0), total_buffer_size_(0) { - typename Buffers::const_iterator iter = buffers.begin(); - typename Buffers::const_iterator end = buffers.end(); + typename Buffers::const_iterator iter = buffer_sequence.begin(); + typename Buffers::const_iterator end = buffer_sequence.end(); for (; iter != end && count_ < max_buffers; ++iter, ++count_) { Buffer buffer(*iter); @@ -109,10 +110,10 @@ public: return total_buffer_size_ == 0; } - static bool all_empty(const Buffers& buffers) + static bool all_empty(const Buffers& buffer_sequence) { - typename Buffers::const_iterator iter = buffers.begin(); - typename Buffers::const_iterator end = buffers.end(); + typename Buffers::const_iterator iter = buffer_sequence.begin(); + typename Buffers::const_iterator end = buffer_sequence.end(); std::size_t i = 0; for (; iter != end && i < max_buffers; ++iter, ++i) if (boost::asio::buffer_size(Buffer(*iter)) > 0) @@ -120,10 +121,10 @@ public: return true; } - static void validate(const Buffers& buffers) + static void validate(const Buffers& buffer_sequence) { - typename Buffers::const_iterator iter = buffers.begin(); - typename Buffers::const_iterator end = buffers.end(); + typename Buffers::const_iterator iter = buffer_sequence.begin(); + typename Buffers::const_iterator end = buffer_sequence.end(); for (; iter != end; ++iter) { Buffer buffer(*iter); @@ -131,10 +132,10 @@ public: } } - static Buffer first(const Buffers& buffers) + static Buffer first(const Buffers& buffer_sequence) { - typename Buffers::const_iterator iter = buffers.begin(); - typename Buffers::const_iterator end = buffers.end(); + typename Buffers::const_iterator iter = buffer_sequence.begin(); + typename Buffers::const_iterator end = buffer_sequence.end(); for (; iter != end; ++iter) { Buffer buffer(*iter); @@ -159,10 +160,10 @@ class buffer_sequence_adapter<Buffer, boost::asio::mutable_buffers_1> { public: explicit buffer_sequence_adapter( - const boost::asio::mutable_buffers_1& buffers) + const boost::asio::mutable_buffers_1& buffer_sequence) { - init_native_buffer(buffer_, Buffer(buffers)); - total_buffer_size_ = boost::asio::buffer_size(buffers); + init_native_buffer(buffer_, Buffer(buffer_sequence)); + total_buffer_size_ = boost::asio::buffer_size(buffer_sequence); } native_buffer_type* buffers() @@ -180,19 +181,19 @@ public: return total_buffer_size_ == 0; } - static bool all_empty(const boost::asio::mutable_buffers_1& buffers) + static bool all_empty(const boost::asio::mutable_buffers_1& buffer_sequence) { - return boost::asio::buffer_size(buffers) == 0; + return boost::asio::buffer_size(buffer_sequence) == 0; } - static void validate(const boost::asio::mutable_buffers_1& buffers) + static void validate(const boost::asio::mutable_buffers_1& buffer_sequence) { - boost::asio::buffer_cast<const void*>(buffers); + boost::asio::buffer_cast<const void*>(buffer_sequence); } - static Buffer first(const boost::asio::mutable_buffers_1& buffers) + static Buffer first(const boost::asio::mutable_buffers_1& buffer_sequence) { - return Buffer(buffers); + return Buffer(buffer_sequence); } private: @@ -206,10 +207,10 @@ class buffer_sequence_adapter<Buffer, boost::asio::const_buffers_1> { public: explicit buffer_sequence_adapter( - const boost::asio::const_buffers_1& buffers) + const boost::asio::const_buffers_1& buffer_sequence) { - init_native_buffer(buffer_, Buffer(buffers)); - total_buffer_size_ = boost::asio::buffer_size(buffers); + init_native_buffer(buffer_, Buffer(buffer_sequence)); + total_buffer_size_ = boost::asio::buffer_size(buffer_sequence); } native_buffer_type* buffers() @@ -227,19 +228,19 @@ public: return total_buffer_size_ == 0; } - static bool all_empty(const boost::asio::const_buffers_1& buffers) + static bool all_empty(const boost::asio::const_buffers_1& buffer_sequence) { - return boost::asio::buffer_size(buffers) == 0; + return boost::asio::buffer_size(buffer_sequence) == 0; } - static void validate(const boost::asio::const_buffers_1& buffers) + static void validate(const boost::asio::const_buffers_1& buffer_sequence) { - boost::asio::buffer_cast<const void*>(buffers); + boost::asio::buffer_cast<const void*>(buffer_sequence); } - static Buffer first(const boost::asio::const_buffers_1& buffers) + static Buffer first(const boost::asio::const_buffers_1& buffer_sequence) { - return Buffer(buffers); + return Buffer(buffer_sequence); } private: @@ -247,6 +248,114 @@ private: std::size_t total_buffer_size_; }; +template <typename Buffer, typename Elem> +class buffer_sequence_adapter<Buffer, boost::array<Elem, 2> > + : buffer_sequence_adapter_base +{ +public: + explicit buffer_sequence_adapter( + const boost::array<Elem, 2>& buffer_sequence) + { + init_native_buffer(buffers_[0], Buffer(buffer_sequence[0])); + init_native_buffer(buffers_[1], Buffer(buffer_sequence[1])); + total_buffer_size_ = boost::asio::buffer_size(buffer_sequence[0]) + + boost::asio::buffer_size(buffer_sequence[1]); + } + + native_buffer_type* buffers() + { + return buffers_; + } + + std::size_t count() const + { + return 2; + } + + bool all_empty() const + { + return total_buffer_size_ == 0; + } + + static bool all_empty(const boost::array<Elem, 2>& buffer_sequence) + { + return boost::asio::buffer_size(buffer_sequence[0]) == 0 + && boost::asio::buffer_size(buffer_sequence[1]) == 0; + } + + static void validate(const boost::array<Elem, 2>& buffer_sequence) + { + boost::asio::buffer_cast<const void*>(buffer_sequence[0]); + boost::asio::buffer_cast<const void*>(buffer_sequence[1]); + } + + static Buffer first(const boost::array<Elem, 2>& buffer_sequence) + { + return Buffer(boost::asio::buffer_size(buffer_sequence[0]) != 0 + ? buffer_sequence[0] : buffer_sequence[1]); + } + +private: + native_buffer_type buffers_[2]; + std::size_t total_buffer_size_; +}; + +#if defined(BOOST_ASIO_HAS_STD_ARRAY) + +template <typename Buffer, typename Elem> +class buffer_sequence_adapter<Buffer, std::array<Elem, 2> > + : buffer_sequence_adapter_base +{ +public: + explicit buffer_sequence_adapter( + const std::array<Elem, 2>& buffer_sequence) + { + init_native_buffer(buffers_[0], Buffer(buffer_sequence[0])); + init_native_buffer(buffers_[1], Buffer(buffer_sequence[1])); + total_buffer_size_ = boost::asio::buffer_size(buffer_sequence[0]) + + boost::asio::buffer_size(buffer_sequence[1]); + } + + native_buffer_type* buffers() + { + return buffers_; + } + + std::size_t count() const + { + return 2; + } + + bool all_empty() const + { + return total_buffer_size_ == 0; + } + + static bool all_empty(const std::array<Elem, 2>& buffer_sequence) + { + return boost::asio::buffer_size(buffer_sequence[0]) == 0 + && boost::asio::buffer_size(buffer_sequence[1]) == 0; + } + + static void validate(const std::array<Elem, 2>& buffer_sequence) + { + boost::asio::buffer_cast<const void*>(buffer_sequence[0]); + boost::asio::buffer_cast<const void*>(buffer_sequence[1]); + } + + static Buffer first(const std::array<Elem, 2>& buffer_sequence) + { + return Buffer(boost::asio::buffer_size(buffer_sequence[0]) != 0 + ? buffer_sequence[0] : buffer_sequence[1]); + } + +private: + native_buffer_type buffers_[2]; + std::size_t total_buffer_size_; +}; + +#endif // defined(BOOST_ASIO_HAS_STD_ARRAY) + } // namespace detail } // namespace asio } // namespace boost diff --git a/3rdParty/Boost/src/boost/asio/detail/buffered_stream_storage.hpp b/3rdParty/Boost/src/boost/asio/detail/buffered_stream_storage.hpp index 86763b5..3c7ba71 100644 --- a/3rdParty/Boost/src/boost/asio/detail/buffered_stream_storage.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/buffered_stream_storage.hpp @@ -2,7 +2,7 @@ // detail/buffered_stream_storage.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -16,7 +16,8 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> -#include <cassert> +#include <boost/asio/buffer.hpp> +#include <boost/assert.hpp> #include <cstddef> #include <cstring> #include <vector> @@ -37,10 +38,10 @@ public: typedef std::size_t size_type; // Constructor. - explicit buffered_stream_storage(std::size_t capacity) + explicit buffered_stream_storage(std::size_t buffer_capacity) : begin_offset_(0), end_offset_(0), - buffer_(capacity) + buffer_(buffer_capacity) { } @@ -52,15 +53,15 @@ public: } // Return a pointer to the beginning of the unread data. - byte_type* data() + mutable_buffer data() { - return &buffer_[0] + begin_offset_; + return boost::asio::buffer(buffer_) + begin_offset_; } // Return a pointer to the beginning of the unread data. - const byte_type* data() const + const_buffer data() const { - return &buffer_[0] + begin_offset_; + return boost::asio::buffer(buffer_) + begin_offset_; } // Is there no unread data in the buffer. @@ -78,7 +79,7 @@ public: // Resize the buffer to the specified length. void resize(size_type length) { - assert(length <= capacity()); + BOOST_ASSERT(length <= capacity()); if (begin_offset_ + length <= capacity()) { end_offset_ = begin_offset_ + length; @@ -101,7 +102,7 @@ public: // Consume multiple bytes from the beginning of the buffer. void consume(size_type count) { - assert(begin_offset_ + count <= end_offset_); + BOOST_ASSERT(begin_offset_ + count <= end_offset_); begin_offset_ += count; if (empty()) clear(); diff --git a/3rdParty/Boost/src/boost/asio/detail/call_stack.hpp b/3rdParty/Boost/src/boost/asio/detail/call_stack.hpp index d5f9099..db4cd1e 100644 --- a/3rdParty/Boost/src/boost/asio/detail/call_stack.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/call_stack.hpp @@ -2,7 +2,7 @@ // detail/call_stack.hpp // ~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -27,34 +27,60 @@ namespace detail { // Helper class to determine whether or not the current thread is inside an // invocation of io_service::run() for a specified io_service object. -template <typename Owner> +template <typename Key, typename Value = unsigned char> class call_stack { public: - // Context class automatically pushes an owner on to the stack. + // Context class automatically pushes the key/value pair on to the stack. class context : private noncopyable { public: - // Push the owner on to the stack. - explicit context(Owner* d) - : owner_(d), - next_(call_stack<Owner>::top_) + // Push the key on to the stack. + explicit context(Key* k) + : key_(k), + next_(call_stack<Key, Value>::top_) { - call_stack<Owner>::top_ = this; + value_ = reinterpret_cast<unsigned char*>(this); + call_stack<Key, Value>::top_ = this; } - // Pop the owner from the stack. + // Push the key/value pair on to the stack. + context(Key* k, Value& v) + : key_(k), + value_(&v), + next_(call_stack<Key, Value>::top_) + { + call_stack<Key, Value>::top_ = this; + } + + // Pop the key/value pair from the stack. ~context() { - call_stack<Owner>::top_ = next_; + call_stack<Key, Value>::top_ = next_; + } + + // Find the next context with the same key. + Value* next_by_key() const + { + context* elem = next_; + while (elem) + { + if (elem->key_ == key_) + return elem->value_; + elem = elem->next_; + } + return 0; } private: - friend class call_stack<Owner>; + friend class call_stack<Key, Value>; + + // The key associated with the context. + Key* key_; - // The owner associated with the context. - Owner* owner_; + // The value associated with the context. + Value* value_; // The next element in the stack. context* next_; @@ -62,17 +88,18 @@ public: friend class context; - // Determine whether the specified owner is on the stack. - static bool contains(Owner* d) + // Determine whether the specified owner is on the stack. Returns address of + // key if present, 0 otherwise. + static Value* contains(Key* k) { context* elem = top_; while (elem) { - if (elem->owner_ == d) - return true; + if (elem->key_ == k) + return elem->value_; elem = elem->next_; } - return false; + return 0; } private: @@ -80,9 +107,9 @@ private: static tss_ptr<context> top_; }; -template <typename Owner> -tss_ptr<typename call_stack<Owner>::context> -call_stack<Owner>::top_; +template <typename Key, typename Value> +tss_ptr<typename call_stack<Key, Value>::context> +call_stack<Key, Value>::top_; } // namespace detail } // namespace asio diff --git a/3rdParty/Boost/src/boost/asio/detail/chrono_time_traits.hpp b/3rdParty/Boost/src/boost/asio/detail/chrono_time_traits.hpp new file mode 100644 index 0000000..e56c8c3 --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/detail/chrono_time_traits.hpp @@ -0,0 +1,129 @@ +// +// detail/chrono_time_traits.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) +// + +#ifndef BOOST_ASIO_DETAIL_CHRONO_TIME_TRAITS_HPP +#define BOOST_ASIO_DETAIL_CHRONO_TIME_TRAITS_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/cstdint.hpp> + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { +namespace detail { + +// Adapts std::chrono clocks for use with a deadline timer. +template <typename Clock, typename WaitTraits> +struct chrono_time_traits +{ + // The clock type. + typedef Clock clock_type; + + // The duration type of the clock. + typedef typename clock_type::duration duration_type; + + // The time point type of the clock. + typedef typename clock_type::time_point time_type; + + // The period of the clock. + typedef typename duration_type::period period_type; + + // Get the current time. + static time_type now() + { + return clock_type::now(); + } + + // Add a duration to a time. + static time_type add(const time_type& t, const duration_type& d) + { + return t + d; + } + + // Subtract one time from another. + static duration_type subtract(const time_type& t1, const time_type& t2) + { + return t1 - t2; + } + + // Test whether one time is less than another. + static bool less_than(const time_type& t1, const time_type& t2) + { + return t1 < t2; + } + + // Implement just enough of the posix_time::time_duration interface to supply + // what the timer_queue requires. + class posix_time_duration + { + public: + explicit posix_time_duration(const duration_type& d) + : d_(d) + { + } + + boost::int64_t ticks() const + { + return d_.count(); + } + + boost::int64_t total_seconds() const + { + return duration_cast<1, 1>(); + } + + boost::int64_t total_milliseconds() const + { + return duration_cast<1, 1000>(); + } + + boost::int64_t total_microseconds() const + { + return duration_cast<1, 1000000>(); + } + + private: + template <boost::int64_t Num, boost::int64_t Den> + boost::int64_t duration_cast() const + { + const boost::int64_t num = period_type::num * Den; + const boost::int64_t den = period_type::den * Num; + + if (num == 1 && den == 1) + return ticks(); + else if (num != 1 && den == 1) + return ticks() * num; + else if (num == 1 && period_type::den != 1) + return ticks() / den; + else + return ticks() * num / den; + } + + duration_type d_; + }; + + // Convert to POSIX duration type. + static posix_time_duration to_posix_duration(const duration_type& d) + { + return posix_time_duration(WaitTraits::to_wait_duration(d)); + } +}; + +} // namespace detail +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#endif // BOOST_ASIO_DETAIL_CHRONO_TIME_TRAITS_HPP diff --git a/3rdParty/Boost/src/boost/asio/detail/completion_handler.hpp b/3rdParty/Boost/src/boost/asio/detail/completion_handler.hpp index 3b023d1..19b4360 100644 --- a/3rdParty/Boost/src/boost/asio/detail/completion_handler.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/completion_handler.hpp @@ -2,7 +2,7 @@ // detail/completion_handler.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -33,34 +33,39 @@ class completion_handler : public operation public: BOOST_ASIO_DEFINE_HANDLER_PTR(completion_handler); - completion_handler(Handler h) + completion_handler(Handler& h) : operation(&completion_handler::do_complete), - handler_(h) + handler_(BOOST_ASIO_MOVE_CAST(Handler)(h)) { } static void do_complete(io_service_impl* owner, operation* base, - boost::system::error_code /*ec*/, std::size_t /*bytes_transferred*/) + const boost::system::error_code& /*ec*/, + std::size_t /*bytes_transferred*/) { // Take ownership of the handler object. completion_handler* h(static_cast<completion_handler*>(base)); ptr p = { boost::addressof(h->handler_), h, h }; + BOOST_ASIO_HANDLER_COMPLETION((h)); + // Make a copy of the handler so that the memory can be deallocated before // the upcall is made. Even if we're not about to make an upcall, a // sub-object of the handler may be the true owner of the memory associated // with the handler. Consequently, a local copy of the handler is required // to ensure that any owning sub-object remains valid until after we have // deallocated the memory here. - Handler handler(h->handler_); + Handler handler(BOOST_ASIO_MOVE_CAST(Handler)(h->handler_)); p.h = boost::addressof(handler); p.reset(); // Make the upcall if required. if (owner) { - boost::asio::detail::fenced_block b; + fenced_block b(fenced_block::half); + BOOST_ASIO_HANDLER_INVOCATION_BEGIN(()); boost_asio_handler_invoke_helpers::invoke(handler, handler); + BOOST_ASIO_HANDLER_INVOCATION_END; } } diff --git a/3rdParty/Boost/src/boost/asio/detail/config.hpp b/3rdParty/Boost/src/boost/asio/detail/config.hpp index 45c2415..c47c007 100644 --- a/3rdParty/Boost/src/boost/asio/detail/config.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/config.hpp @@ -2,7 +2,7 @@ // detail/config.hpp // ~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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 +12,7 @@ #define BOOST_ASIO_DETAIL_CONFIG_HPP #include <boost/config.hpp> +#include <boost/version.hpp> // Default to a header-only implementation. The user must specifically request // separate compilation by defining either BOOST_ASIO_SEPARATE_COMPILATION or @@ -46,6 +47,151 @@ # define BOOST_ASIO_DECL #endif // !defined(BOOST_ASIO_DECL) +// Support move construction and assignment on compilers known to allow it. +#if !defined(BOOST_ASIO_DISABLE_MOVE) +# if defined(__GNUC__) +# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4) +# if defined(__GXX_EXPERIMENTAL_CXX0X__) +# define BOOST_ASIO_HAS_MOVE +# endif // defined(__GXX_EXPERIMENTAL_CXX0X__) +# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4) +# endif // defined(__GNUC__) +#endif // !defined(BOOST_ASIO_DISABLE_MOVE) + +// If BOOST_ASIO_MOVE_CAST isn't defined, and move support is available, define +// BOOST_ASIO_MOVE_ARG and BOOST_ASIO_MOVE_CAST to take advantage of rvalue +// references and perfect forwarding. +#if defined(BOOST_ASIO_HAS_MOVE) && !defined(BOOST_ASIO_MOVE_CAST) +# define BOOST_ASIO_MOVE_ARG(type) type&& +# define BOOST_ASIO_MOVE_CAST(type) static_cast<type&&> +#endif // defined(BOOST_ASIO_HAS_MOVE) && !defined(BOOST_ASIO_MOVE_CAST) + +// If BOOST_ASIO_MOVE_CAST still isn't defined, default to a C++03-compatible +// implementation. Note that older g++ and MSVC versions don't like it when you +// pass a non-member function through a const reference, so for most compilers +// we'll play it safe and stick with the old approach of passing the handler by +// value. +#if !defined(BOOST_ASIO_MOVE_CAST) +# if defined(__GNUC__) +# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 1)) || (__GNUC__ > 4) +# define BOOST_ASIO_MOVE_ARG(type) const type& +# else // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 1)) || (__GNUC__ > 4) +# define BOOST_ASIO_MOVE_ARG(type) type +# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 1)) || (__GNUC__ > 4) +# elif defined(BOOST_MSVC) +# if (_MSC_VER >= 1400) +# define BOOST_ASIO_MOVE_ARG(type) const type& +# else // (_MSC_VER >= 1400) +# define BOOST_ASIO_MOVE_ARG(type) type +# endif // (_MSC_VER >= 1400) +# else +# define BOOST_ASIO_MOVE_ARG(type) type +# endif +# define BOOST_ASIO_MOVE_CAST(type) static_cast<const type&> +#endif // !defined_BOOST_ASIO_MOVE_CAST + +// Support variadic templates on compilers known to allow it. +#if !defined(BOOST_ASIO_DISABLE_VARIADIC_TEMPLATES) +# if defined(__GNUC__) +# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4) +# if defined(__GXX_EXPERIMENTAL_CXX0X__) +# define BOOST_ASIO_HAS_VARIADIC_TEMPLATES +# endif // defined(__GXX_EXPERIMENTAL_CXX0X__) +# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4) +# endif // defined(__GNUC__) +#endif // !defined(BOOST_ASIO_DISABLE_VARIADIC_TEMPLATES) + +// Standard library support for system errors. +#if !defined(BOOST_ASIO_DISABLE_STD_SYSTEM_ERROR) +# if defined(__GNUC__) +# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4) +# if defined(__GXX_EXPERIMENTAL_CXX0X__) +# define BOOST_ASIO_HAS_STD_SYSTEM_ERROR +# endif // defined(__GXX_EXPERIMENTAL_CXX0X__) +# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4) +# endif // defined(__GNUC__) +#endif // !defined(BOOST_ASIO_DISABLE_STD_SYSTEM_ERROR) + +// Compliant C++11 compilers put noexcept specifiers on error_category members. +#if !defined(BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT) +# if defined(__GNUC__) +# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4) +# if defined(__GXX_EXPERIMENTAL_CXX0X__) +# define BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT noexcept(true) +# endif // defined(__GXX_EXPERIMENTAL_CXX0X__) +# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)) || (__GNUC__ > 4) +# endif // defined(__GNUC__) +# if !defined(BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT) +# define BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT +# endif // !defined(BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT) +#endif // !defined(BOOST_ASIO_ERROR_CATEGORY_NOEXCEPT) + +// Standard library support for arrays. +#if !defined(BOOST_ASIO_DISABLE_STD_ARRAY) +# if defined(__GNUC__) +# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4) +# if defined(__GXX_EXPERIMENTAL_CXX0X__) +# define BOOST_ASIO_HAS_STD_ARRAY +# endif // defined(__GXX_EXPERIMENTAL_CXX0X__) +# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4) +# endif // defined(__GNUC__) +# if defined(BOOST_MSVC) +# if (_MSC_VER >= 1600) +# define BOOST_ASIO_HAS_STD_ARRAY +# endif // (_MSC_VER >= 1600) +# endif // defined(BOOST_MSVC) +#endif // !defined(BOOST_ASIO_DISABLE_STD_ARRAY) + +// Standard library support for shared_ptr and weak_ptr. +#if !defined(BOOST_ASIO_DISABLE_STD_SHARED_PTR) +# if defined(__GNUC__) +# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4) +# if defined(__GXX_EXPERIMENTAL_CXX0X__) +# define BOOST_ASIO_HAS_STD_SHARED_PTR +# endif // defined(__GXX_EXPERIMENTAL_CXX0X__) +# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 4) +# endif // defined(__GNUC__) +# if defined(BOOST_MSVC) +# if (_MSC_VER >= 1600) +# define BOOST_ASIO_HAS_STD_SHARED_PTR +# endif // (_MSC_VER >= 1600) +# endif // defined(BOOST_MSVC) +#endif // !defined(BOOST_ASIO_DISABLE_STD_SHARED_PTR) + +// Standard library support for atomic operations. +#if !defined(BOOST_ASIO_DISABLE_STD_ATOMIC) +# if defined(__GNUC__) +# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4) +# if defined(__GXX_EXPERIMENTAL_CXX0X__) +# define BOOST_ASIO_HAS_STD_ATOMIC +# endif // defined(__GXX_EXPERIMENTAL_CXX0X__) +# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4) +# endif // defined(__GNUC__) +#endif // !defined(BOOST_ASIO_DISABLE_STD_ATOMIC) + +// Standard library support for chrono. Some standard libraries (such as the +// libstdc++ shipped with gcc 4.6) provide monotonic_clock as per early C++0x +// drafts, rather than the eventually standardised name of steady_clock. +#if !defined(BOOST_ASIO_DISABLE_STD_CHRONO) +# if defined(__GNUC__) +# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4) +# if defined(__GXX_EXPERIMENTAL_CXX0X__) +# define BOOST_ASIO_HAS_STD_CHRONO +# if ((__GNUC__ == 4) && (__GNUC_MINOR__ == 6)) +# define BOOST_ASIO_HAS_STD_CHRONO_MONOTONIC_CLOCK +# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ == 6)) +# endif // defined(__GXX_EXPERIMENTAL_CXX0X__) +# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 6)) || (__GNUC__ > 4) +# endif // defined(__GNUC__) +#endif // !defined(BOOST_ASIO_DISABLE_STD_CHRONO) + +// Boost support for chrono. +#if !defined(BOOST_ASIO_DISABLE_BOOST_CHRONO) +# if (BOOST_VERSION >= 104700) +# define BOOST_ASIO_HAS_BOOST_CHRONO +# endif // (BOOST_VERSION >= 104700) +#endif // !defined(BOOST_ASIO_DISABLE_BOOST_CHRONO) + // Windows: target OS version. #if defined(BOOST_WINDOWS) || defined(__CYGWIN__) # if !defined(_WIN32_WINNT) && !defined(_WIN32_WINDOWS) @@ -181,6 +327,15 @@ # endif // defined(BOOST_ASIO_HAS_IOCP) #endif // !defined(BOOST_ASIO_DISABLE_WINDOWS_RANDOM_ACCESS_HANDLE) +// Windows: object handles. +#if !defined(BOOST_ASIO_DISABLE_WINDOWS_OBJECT_HANDLE) +# if defined(BOOST_WINDOWS) || defined(__CYGWIN__) +# if !defined(UNDER_CE) +# define BOOST_ASIO_HAS_WINDOWS_OBJECT_HANDLE 1 +# endif // !defined(UNDER_CE) +# endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__) +#endif // !defined(BOOST_ASIO_DISABLE_WINDOWS_OBJECT_HANDLE) + // Windows: OVERLAPPED wrapper. #if !defined(BOOST_ASIO_DISABLE_WINDOWS_OVERLAPPED_PTR) # if defined(BOOST_ASIO_HAS_IOCP) @@ -202,4 +357,33 @@ # endif // !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) #endif // !defined(BOOST_ASIO_DISABLE_LOCAL_SOCKETS) +// Can use sigaction() instead of signal(). +#if !defined(BOOST_ASIO_DISABLE_SIGACTION) +# if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) +# define BOOST_ASIO_HAS_SIGACTION 1 +# endif // !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) +#endif // !defined(BOOST_ASIO_DISABLE_SIGACTION) + +// Can use signal(). +#if !defined(BOOST_ASIO_DISABLE_SIGNAL) +# if !defined(UNDER_CE) +# define BOOST_ASIO_HAS_SIGNAL 1 +# endif // !defined(UNDER_CE) +#endif // !defined(BOOST_ASIO_DISABLE_SIGNAL) + +// Support for the __thread keyword extension. +#if !defined(BOOST_ASIO_DISABLE_THREAD_KEYWORD_EXTENSION) +# if defined(__linux__) +# if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) +# if ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3) +# if !defined(__INTEL_COMPILER) && !defined(__ICL) +# define BOOST_ASIO_HAS_THREAD_KEYWORD_EXTENSION 1 +# elif defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1100) +# define BOOST_ASIO_HAS_THREAD_KEYWORD_EXTENSION 1 +# endif // defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 1100) +# endif // ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3) +# endif // defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) +# endif // defined(__linux__) +#endif // !defined(BOOST_ASIO_DISABLE_THREAD_KEYWORD_EXTENSION) + #endif // BOOST_ASIO_DETAIL_CONFIG_HPP diff --git a/3rdParty/Boost/src/boost/asio/detail/consuming_buffers.hpp b/3rdParty/Boost/src/boost/asio/detail/consuming_buffers.hpp index f50d4e0..e13403f 100644 --- a/3rdParty/Boost/src/boost/asio/detail/consuming_buffers.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/consuming_buffers.hpp @@ -2,7 +2,7 @@ // detail/consuming_buffers.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/date_time_fwd.hpp b/3rdParty/Boost/src/boost/asio/detail/date_time_fwd.hpp new file mode 100644 index 0000000..162ccdc --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/detail/date_time_fwd.hpp @@ -0,0 +1,34 @@ +// +// detail/date_time_fwd.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) +// + +#ifndef BOOST_ASIO_DETAIL_DATE_TIME_FWD_HPP +#define BOOST_ASIO_DETAIL_DATE_TIME_FWD_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> + +namespace boost { +namespace date_time { + +template<class T, class TimeSystem> +class base_time; + +} // namespace date_time +namespace posix_time { + +class ptime; + +} // namespace posix_time +} // namespace boost + +#endif // BOOST_ASIO_DETAIL_DATE_TIME_FWD_HPP diff --git a/3rdParty/Boost/src/boost/asio/detail/deadline_timer_service.hpp b/3rdParty/Boost/src/boost/asio/detail/deadline_timer_service.hpp index 82e0d43..833815a 100644 --- a/3rdParty/Boost/src/boost/asio/detail/deadline_timer_service.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/deadline_timer_service.hpp @@ -2,7 +2,7 @@ // detail/deadline_timer_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -24,14 +24,10 @@ #include <boost/asio/detail/noncopyable.hpp> #include <boost/asio/detail/socket_ops.hpp> #include <boost/asio/detail/socket_types.hpp> -#include <boost/asio/detail/timer_op.hpp> #include <boost/asio/detail/timer_queue.hpp> #include <boost/asio/detail/timer_scheduler.hpp> #include <boost/asio/detail/wait_handler.hpp> - -#include <boost/asio/detail/push_options.hpp> -#include <boost/date_time/posix_time/posix_time_types.hpp> -#include <boost/asio/detail/pop_options.hpp> +#include <boost/asio/detail/wait_op.hpp> #include <boost/asio/detail/push_options.hpp> @@ -100,12 +96,35 @@ public: ec = boost::system::error_code(); return 0; } + + BOOST_ASIO_HANDLER_OPERATION(("deadline_timer", &impl, "cancel")); + std::size_t count = scheduler_.cancel_timer(timer_queue_, impl.timer_data); impl.might_have_pending_waits = false; ec = boost::system::error_code(); return count; } + // Cancels one asynchronous wait operation associated with the timer. + std::size_t cancel_one(implementation_type& impl, + boost::system::error_code& ec) + { + if (!impl.might_have_pending_waits) + { + ec = boost::system::error_code(); + return 0; + } + + BOOST_ASIO_HANDLER_OPERATION(("deadline_timer", &impl, "cancel_one")); + + std::size_t count = scheduler_.cancel_timer( + timer_queue_, impl.timer_data, 1); + if (count == 0) + impl.might_have_pending_waits = false; + ec = boost::system::error_code(); + return count; + } + // Get the expiry time for the timer as an absolute time. time_type expires_at(const implementation_type& impl) const { @@ -140,18 +159,13 @@ public: void wait(implementation_type& impl, boost::system::error_code& ec) { time_type now = Time_Traits::now(); - while (Time_Traits::less_than(now, impl.expiry)) + ec = boost::system::error_code(); + while (Time_Traits::less_than(now, impl.expiry) && !ec) { - boost::posix_time::time_duration timeout = - Time_Traits::to_posix_duration(Time_Traits::subtract(impl.expiry, now)); - ::timeval tv; - tv.tv_sec = timeout.total_seconds(); - tv.tv_usec = timeout.total_microseconds() % 1000000; - boost::system::error_code ec; - socket_ops::select(0, 0, 0, 0, &tv, ec); + this->do_wait(Time_Traits::to_posix_duration( + Time_Traits::subtract(impl.expiry, now)), ec); now = Time_Traits::now(); } - ec = boost::system::error_code(); } // Start an asynchronous wait on the timer. @@ -167,11 +181,25 @@ public: impl.might_have_pending_waits = true; + BOOST_ASIO_HANDLER_CREATION((p.p, "deadline_timer", &impl, "async_wait")); + scheduler_.schedule_timer(timer_queue_, impl.expiry, impl.timer_data, p.p); p.v = p.p = 0; } private: + // Helper function to wait given a duration type. The duration type should + // either be of type boost::posix_time::time_duration, or implement the + // required subset of its interface. + template <typename Duration> + void do_wait(const Duration& timeout, boost::system::error_code& ec) + { + ::timeval tv; + tv.tv_sec = timeout.total_seconds(); + tv.tv_usec = timeout.total_microseconds() % 1000000; + socket_ops::select(0, 0, 0, 0, &tv, ec); + } + // The queue of timers. timer_queue<Time_Traits> timer_queue_; diff --git a/3rdParty/Boost/src/boost/asio/detail/dependent_type.hpp b/3rdParty/Boost/src/boost/asio/detail/dependent_type.hpp new file mode 100644 index 0000000..c7b1c1b --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/detail/dependent_type.hpp @@ -0,0 +1,38 @@ +// +// detail/dependent_type.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) +// + +#ifndef BOOST_ASIO_DETAIL_DEPENDENT_TYPE_HPP +#define BOOST_ASIO_DETAIL_DEPENDENT_TYPE_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { +namespace detail { + +template <typename DependsOn, typename T> +struct dependent_type +{ + typedef T type; +}; + +} // namespace detail +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#endif // BOOST_ASIO_DETAIL_DEPENDENT_TYPE_HPP diff --git a/3rdParty/Boost/src/boost/asio/detail/descriptor_ops.hpp b/3rdParty/Boost/src/boost/asio/detail/descriptor_ops.hpp index f92a7b4..72ea6e2 100644 --- a/3rdParty/Boost/src/boost/asio/detail/descriptor_ops.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/descriptor_ops.hpp @@ -2,7 +2,7 @@ // detail/descriptor_ops.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -40,7 +40,10 @@ enum internal_non_blocking = 2, // Helper "state" used to determine whether the descriptor is non-blocking. - non_blocking = user_set_non_blocking | internal_non_blocking + non_blocking = user_set_non_blocking | internal_non_blocking, + + // The descriptor may have been dup()-ed. + possible_dup = 4 }; typedef unsigned char state_type; @@ -60,8 +63,11 @@ BOOST_ASIO_DECL int open(const char* path, int flags, BOOST_ASIO_DECL int close(int d, state_type& state, boost::system::error_code& ec); +BOOST_ASIO_DECL bool set_user_non_blocking(int d, + state_type& state, bool value, boost::system::error_code& ec); + BOOST_ASIO_DECL bool set_internal_non_blocking(int d, - state_type& state, boost::system::error_code& ec); + state_type& state, bool value, boost::system::error_code& ec); typedef iovec buf; @@ -87,9 +93,11 @@ BOOST_ASIO_DECL int fcntl(int d, long cmd, boost::system::error_code& ec); BOOST_ASIO_DECL int fcntl(int d, long cmd, long arg, boost::system::error_code& ec); -BOOST_ASIO_DECL int poll_read(int d, boost::system::error_code& ec); +BOOST_ASIO_DECL int poll_read(int d, + state_type state, boost::system::error_code& ec); -BOOST_ASIO_DECL int poll_write(int d, boost::system::error_code& ec); +BOOST_ASIO_DECL int poll_write(int d, + state_type state, boost::system::error_code& ec); } // namespace descriptor_ops } // namespace detail diff --git a/3rdParty/Boost/src/boost/asio/detail/descriptor_read_op.hpp b/3rdParty/Boost/src/boost/asio/detail/descriptor_read_op.hpp index 884f8f6..9f4adff 100644 --- a/3rdParty/Boost/src/boost/asio/detail/descriptor_read_op.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/descriptor_read_op.hpp @@ -2,7 +2,7 @@ // detail/descriptor_read_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -68,20 +68,23 @@ public: BOOST_ASIO_DEFINE_HANDLER_PTR(descriptor_read_op); descriptor_read_op(int descriptor, - const MutableBufferSequence& buffers, Handler handler) + const MutableBufferSequence& buffers, Handler& handler) : descriptor_read_op_base<MutableBufferSequence>( descriptor, buffers, &descriptor_read_op::do_complete), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)) { } static void do_complete(io_service_impl* owner, operation* base, - boost::system::error_code /*ec*/, std::size_t /*bytes_transferred*/) + const boost::system::error_code& /*ec*/, + std::size_t /*bytes_transferred*/) { // Take ownership of the handler object. descriptor_read_op* o(static_cast<descriptor_read_op*>(base)); ptr p = { boost::addressof(o->handler_), o, o }; + BOOST_ASIO_HANDLER_COMPLETION((o)); + // Make a copy of the handler so that the memory can be deallocated before // the upcall is made. Even if we're not about to make an upcall, a // sub-object of the handler may be the true owner of the memory associated @@ -96,8 +99,10 @@ public: // Make the upcall if required. if (owner) { - boost::asio::detail::fenced_block b; + fenced_block b(fenced_block::half); + BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_)); boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_); + BOOST_ASIO_HANDLER_INVOCATION_END; } } diff --git a/3rdParty/Boost/src/boost/asio/detail/descriptor_write_op.hpp b/3rdParty/Boost/src/boost/asio/detail/descriptor_write_op.hpp index 805eb0b..88c80c8 100644 --- a/3rdParty/Boost/src/boost/asio/detail/descriptor_write_op.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/descriptor_write_op.hpp @@ -2,7 +2,7 @@ // detail/descriptor_write_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -68,20 +68,23 @@ public: BOOST_ASIO_DEFINE_HANDLER_PTR(descriptor_write_op); descriptor_write_op(int descriptor, - const ConstBufferSequence& buffers, Handler handler) + const ConstBufferSequence& buffers, Handler& handler) : descriptor_write_op_base<ConstBufferSequence>( descriptor, buffers, &descriptor_write_op::do_complete), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)) { } static void do_complete(io_service_impl* owner, operation* base, - boost::system::error_code /*ec*/, std::size_t /*bytes_transferred*/) + const boost::system::error_code& /*ec*/, + std::size_t /*bytes_transferred*/) { // Take ownership of the handler object. descriptor_write_op* o(static_cast<descriptor_write_op*>(base)); ptr p = { boost::addressof(o->handler_), o, o }; + BOOST_ASIO_HANDLER_COMPLETION((o)); + // Make a copy of the handler so that the memory can be deallocated before // the upcall is made. Even if we're not about to make an upcall, a // sub-object of the handler may be the true owner of the memory associated @@ -96,8 +99,10 @@ public: // Make the upcall if required. if (owner) { - boost::asio::detail::fenced_block b; + fenced_block b(fenced_block::half); + BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_)); boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_); + BOOST_ASIO_HANDLER_INVOCATION_END; } } diff --git a/3rdParty/Boost/src/boost/asio/detail/dev_poll_reactor.hpp b/3rdParty/Boost/src/boost/asio/detail/dev_poll_reactor.hpp index 79c1cbb..e6b6e12 100644 --- a/3rdParty/Boost/src/boost/asio/detail/dev_poll_reactor.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/dev_poll_reactor.hpp @@ -2,7 +2,7 @@ // detail/dev_poll_reactor.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -19,6 +19,7 @@ #if defined(BOOST_ASIO_HAS_DEV_POLL) +#include <boost/limits.hpp> #include <cstddef> #include <vector> #include <sys/devpoll.h> @@ -30,10 +31,10 @@ #include <boost/asio/detail/reactor_op_queue.hpp> #include <boost/asio/detail/select_interrupter.hpp> #include <boost/asio/detail/socket_types.hpp> -#include <boost/asio/detail/timer_op.hpp> #include <boost/asio/detail/timer_queue_base.hpp> #include <boost/asio/detail/timer_queue_fwd.hpp> #include <boost/asio/detail/timer_queue_set.hpp> +#include <boost/asio/detail/wait_op.hpp> #include <boost/asio/io_service.hpp> #include <boost/asio/detail/push_options.hpp> @@ -63,6 +64,10 @@ public: // Destroy all user-defined handler objects owned by the service. BOOST_ASIO_DECL void shutdown_service(); + // Recreate internal descriptors following a fork. + BOOST_ASIO_DECL void fork_service( + boost::asio::io_service::fork_event fork_ev); + // Initialise the task. BOOST_ASIO_DECL void init_task(); @@ -70,6 +75,17 @@ public: // code on failure. BOOST_ASIO_DECL int register_descriptor(socket_type, per_descriptor_data&); + // Register a descriptor with an associated single operation. Returns 0 on + // success, system error code on failure. + BOOST_ASIO_DECL int register_internal_descriptor( + int op_type, socket_type descriptor, + per_descriptor_data& descriptor_data, reactor_op* op); + + // Move descriptor registration from one descriptor_data object to another. + BOOST_ASIO_DECL void move_descriptor(socket_type descriptor, + per_descriptor_data& target_descriptor_data, + per_descriptor_data& source_descriptor_data); + // Post a reactor operation for immediate completion. void post_immediate_completion(reactor_op* op) { @@ -88,7 +104,12 @@ public: // Cancel any operations that are running against the descriptor and remove // its registration from the reactor. - BOOST_ASIO_DECL void close_descriptor( + BOOST_ASIO_DECL void deregister_descriptor(socket_type descriptor, + per_descriptor_data&, bool closing); + + // Cancel any operations that are running against the descriptor and remove + // its registration from the reactor. + BOOST_ASIO_DECL void deregister_internal_descriptor( socket_type descriptor, per_descriptor_data&); // Add a new timer queue to the reactor. @@ -104,13 +125,14 @@ public: template <typename Time_Traits> void schedule_timer(timer_queue<Time_Traits>& queue, const typename Time_Traits::time_type& time, - typename timer_queue<Time_Traits>::per_timer_data& timer, timer_op* op); + typename timer_queue<Time_Traits>::per_timer_data& timer, wait_op* op); // Cancel the timer operations associated with the given token. Returns the // number of operations that have been posted or dispatched. template <typename Time_Traits> std::size_t cancel_timer(timer_queue<Time_Traits>& queue, - typename timer_queue<Time_Traits>::per_timer_data& timer); + typename timer_queue<Time_Traits>::per_timer_data& timer, + std::size_t max_cancelled = (std::numeric_limits<std::size_t>::max)()); // Run /dev/poll once until interrupted or events are ready to be dispatched. BOOST_ASIO_DECL void run(bool block, op_queue<operation>& ops); @@ -140,6 +162,10 @@ private: BOOST_ASIO_DECL void cancel_ops_unlocked(socket_type descriptor, const boost::system::error_code& ec); + // Helper class used to reregister descriptors after a fork. + class fork_helper; + friend class fork_helper; + // Add a pending event entry for the given descriptor. BOOST_ASIO_DECL ::pollfd& add_pending_event_change(int descriptor); diff --git a/3rdParty/Boost/src/boost/asio/detail/dev_poll_reactor_fwd.hpp b/3rdParty/Boost/src/boost/asio/detail/dev_poll_reactor_fwd.hpp index c5ceab2..026f91a 100644 --- a/3rdParty/Boost/src/boost/asio/detail/dev_poll_reactor_fwd.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/dev_poll_reactor_fwd.hpp @@ -2,7 +2,7 @@ // detail/dev_poll_reactor_fwd.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/epoll_reactor.hpp b/3rdParty/Boost/src/boost/asio/detail/epoll_reactor.hpp index 1889017..8f66f74 100644 --- a/3rdParty/Boost/src/boost/asio/detail/epoll_reactor.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/epoll_reactor.hpp @@ -2,7 +2,7 @@ // detail/epoll_reactor.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -19,7 +19,10 @@ #if defined(BOOST_ASIO_HAS_EPOLL) +#include <boost/cstdint.hpp> +#include <boost/limits.hpp> #include <boost/asio/io_service.hpp> +#include <boost/asio/detail/atomic_count.hpp> #include <boost/asio/detail/epoll_reactor_fwd.hpp> #include <boost/asio/detail/mutex.hpp> #include <boost/asio/detail/object_pool.hpp> @@ -27,10 +30,10 @@ #include <boost/asio/detail/reactor_op.hpp> #include <boost/asio/detail/select_interrupter.hpp> #include <boost/asio/detail/socket_types.hpp> -#include <boost/asio/detail/timer_op.hpp> #include <boost/asio/detail/timer_queue_base.hpp> #include <boost/asio/detail/timer_queue_fwd.hpp> #include <boost/asio/detail/timer_queue_set.hpp> +#include <boost/asio/detail/wait_op.hpp> #include <boost/asio/detail/push_options.hpp> @@ -46,15 +49,27 @@ public: connect_op = 1, except_op = 2, max_ops = 3 }; // Per-descriptor queues. - class descriptor_state + class descriptor_state : operation { friend class epoll_reactor; friend class object_pool_access; + + descriptor_state* next_; + descriptor_state* prev_; + mutex mutex_; + epoll_reactor* reactor_; + int descriptor_; + boost::uint32_t registered_events_; op_queue<reactor_op> op_queue_[max_ops]; bool shutdown_; - descriptor_state* next_; - descriptor_state* prev_; + + BOOST_ASIO_DECL descriptor_state(); + void set_ready_events(uint32_t events) { task_result_ = events; } + BOOST_ASIO_DECL operation* perform_io(uint32_t events); + BOOST_ASIO_DECL static void do_complete( + io_service_impl* owner, operation* base, + const boost::system::error_code& ec, std::size_t bytes_transferred); }; // Per-descriptor data. @@ -69,6 +84,10 @@ public: // Destroy all user-defined handler objects owned by the service. BOOST_ASIO_DECL void shutdown_service(); + // Recreate internal descriptors following a fork. + BOOST_ASIO_DECL void fork_service( + boost::asio::io_service::fork_event fork_ev); + // Initialise the task. BOOST_ASIO_DECL void init_task(); @@ -77,6 +96,17 @@ public: BOOST_ASIO_DECL int register_descriptor(socket_type descriptor, per_descriptor_data& descriptor_data); + // Register a descriptor with an associated single operation. Returns 0 on + // success, system error code on failure. + BOOST_ASIO_DECL int register_internal_descriptor( + int op_type, socket_type descriptor, + per_descriptor_data& descriptor_data, reactor_op* op); + + // Move descriptor registration from one descriptor_data object to another. + BOOST_ASIO_DECL void move_descriptor(socket_type descriptor, + per_descriptor_data& target_descriptor_data, + per_descriptor_data& source_descriptor_data); + // Post a reactor operation for immediate completion. void post_immediate_completion(reactor_op* op) { @@ -86,8 +116,8 @@ public: // Start a new operation. The reactor operation will be performed when the // given descriptor is flagged as ready, or an error has occurred. BOOST_ASIO_DECL void start_op(int op_type, socket_type descriptor, - per_descriptor_data& descriptor_data, - reactor_op* op, bool allow_speculative); + per_descriptor_data& descriptor_data, reactor_op* op, + bool allow_speculative); // Cancel all operations associated with the given descriptor. The // handlers associated with the descriptor will be invoked with the @@ -97,8 +127,12 @@ public: // Cancel any operations that are running against the descriptor and remove // its registration from the reactor. - BOOST_ASIO_DECL void close_descriptor(socket_type descriptor, - per_descriptor_data& descriptor_data); + BOOST_ASIO_DECL void deregister_descriptor(socket_type descriptor, + per_descriptor_data& descriptor_data, bool closing); + + // Remote the descriptor's registration from the reactor. + BOOST_ASIO_DECL void deregister_internal_descriptor( + socket_type descriptor, per_descriptor_data& descriptor_data); // Add a new timer queue to the reactor. template <typename Time_Traits> @@ -113,13 +147,14 @@ public: template <typename Time_Traits> void schedule_timer(timer_queue<Time_Traits>& queue, const typename Time_Traits::time_type& time, - typename timer_queue<Time_Traits>::per_timer_data& timer, timer_op* op); + typename timer_queue<Time_Traits>::per_timer_data& timer, wait_op* op); // Cancel the timer operations associated with the given token. Returns the // number of operations that have been posted or dispatched. template <typename Time_Traits> std::size_t cancel_timer(timer_queue<Time_Traits>& queue, - typename timer_queue<Time_Traits>::per_timer_data& timer); + typename timer_queue<Time_Traits>::per_timer_data& timer, + std::size_t max_cancelled = (std::numeric_limits<std::size_t>::max)()); // Run epoll once until interrupted or events are ready to be dispatched. BOOST_ASIO_DECL void run(bool block, op_queue<operation>& ops); @@ -135,6 +170,15 @@ private: // cannot be created. BOOST_ASIO_DECL static int do_epoll_create(); + // Create the timerfd file descriptor. Does not throw. + BOOST_ASIO_DECL static int do_timerfd_create(); + + // Allocate a new descriptor state object. + BOOST_ASIO_DECL descriptor_state* allocate_descriptor_state(); + + // Free an existing descriptor state object. + BOOST_ASIO_DECL void free_descriptor_state(descriptor_state* s); + // Helper function to add a new timer queue. BOOST_ASIO_DECL void do_add_timer_queue(timer_queue_base& queue); @@ -161,15 +205,15 @@ private: // Mutex to protect access to internal data. mutex mutex_; + // The interrupter is used to break a blocking epoll_wait call. + select_interrupter interrupter_; + // The epoll file descriptor. int epoll_fd_; // The timer file descriptor. int timer_fd_; - // The interrupter is used to break a blocking epoll_wait call. - select_interrupter interrupter_; - // The timer queues. timer_queue_set timer_queues_; @@ -181,6 +225,10 @@ private: // Keep track of all registered descriptors. object_pool<descriptor_state> registered_descriptors_; + + // Helper class to do post-perform_io cleanup. + struct perform_io_cleanup_on_block_exit; + friend struct perform_io_cleanup_on_block_exit; }; } // namespace detail diff --git a/3rdParty/Boost/src/boost/asio/detail/epoll_reactor_fwd.hpp b/3rdParty/Boost/src/boost/asio/detail/epoll_reactor_fwd.hpp index 01ee84c..aa28271 100644 --- a/3rdParty/Boost/src/boost/asio/detail/epoll_reactor_fwd.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/epoll_reactor_fwd.hpp @@ -2,7 +2,7 @@ // detail/epoll_reactor_fwd.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/event.hpp b/3rdParty/Boost/src/boost/asio/detail/event.hpp index c8109d1..0ee6b6e 100644 --- a/3rdParty/Boost/src/boost/asio/detail/event.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/event.hpp @@ -2,7 +2,7 @@ // detail/event.hpp // ~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/eventfd_select_interrupter.hpp b/3rdParty/Boost/src/boost/asio/detail/eventfd_select_interrupter.hpp index 954fe79..cf40eee 100644 --- a/3rdParty/Boost/src/boost/asio/detail/eventfd_select_interrupter.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/eventfd_select_interrupter.hpp @@ -2,7 +2,7 @@ // detail/eventfd_select_interrupter.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) // Copyright (c) 2008 Roelof Naude (roelof.naude at gmail dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -35,6 +35,9 @@ public: // Destructor. BOOST_ASIO_DECL ~eventfd_select_interrupter(); + // Recreate the interrupter's descriptors. Used after a fork. + BOOST_ASIO_DECL void recreate(); + // Interrupt the select call. BOOST_ASIO_DECL void interrupt(); @@ -48,6 +51,12 @@ public: } private: + // Open the descriptors. Throws on error. + BOOST_ASIO_DECL void open_descriptors(); + + // Close the descriptors. + BOOST_ASIO_DECL void close_descriptors(); + // The read end of a connection used to interrupt the select call. This file // descriptor is passed to select such that when it is time to stop, a single // 64bit value will be written on the other end of the connection and this diff --git a/3rdParty/Boost/src/boost/asio/detail/fd_set_adapter.hpp b/3rdParty/Boost/src/boost/asio/detail/fd_set_adapter.hpp index 8df0426..51fe927 100644 --- a/3rdParty/Boost/src/boost/asio/detail/fd_set_adapter.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/fd_set_adapter.hpp @@ -2,7 +2,7 @@ // detail/fd_set_adapter.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/fenced_block.hpp b/3rdParty/Boost/src/boost/asio/detail/fenced_block.hpp index 4cb27dc..d9e8a04 100644 --- a/3rdParty/Boost/src/boost/asio/detail/fenced_block.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/fenced_block.hpp @@ -2,7 +2,7 @@ // detail/fenced_block.hpp // ~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -25,17 +25,18 @@ # include <boost/asio/detail/macos_fenced_block.hpp> #elif defined(__sun) # include <boost/asio/detail/solaris_fenced_block.hpp> -#elif defined(__GNUC__) && defined(__arm__) +#elif defined(__GNUC__) && defined(__arm__) \ + && !defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4) # include <boost/asio/detail/gcc_arm_fenced_block.hpp> #elif defined(__GNUC__) && (defined(__hppa) || defined(__hppa__)) # include <boost/asio/detail/gcc_hppa_fenced_block.hpp> +#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) +# include <boost/asio/detail/gcc_x86_fenced_block.hpp> #elif defined(__GNUC__) \ && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)) \ && !defined(__INTEL_COMPILER) && !defined(__ICL) \ && !defined(__ICC) && !defined(__ECC) && !defined(__PATHSCALE__) # include <boost/asio/detail/gcc_sync_fenced_block.hpp> -#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) -# include <boost/asio/detail/gcc_x86_fenced_block.hpp> #elif defined(BOOST_WINDOWS) && !defined(UNDER_CE) # include <boost/asio/detail/win_fenced_block.hpp> #else @@ -54,17 +55,18 @@ typedef null_fenced_block fenced_block; typedef macos_fenced_block fenced_block; #elif defined(__sun) typedef solaris_fenced_block fenced_block; -#elif defined(__GNUC__) && defined(__arm__) +#elif defined(__GNUC__) && defined(__arm__) \ + && !defined(__GCC_HAVE_SYNC_COMPARE_AND_SWAP_4) typedef gcc_arm_fenced_block fenced_block; #elif defined(__GNUC__) && (defined(__hppa) || defined(__hppa__)) typedef gcc_hppa_fenced_block fenced_block; +#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) +typedef gcc_x86_fenced_block fenced_block; #elif defined(__GNUC__) \ && ((__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4)) \ && !defined(__INTEL_COMPILER) && !defined(__ICL) \ && !defined(__ICC) && !defined(__ECC) && !defined(__PATHSCALE__) typedef gcc_sync_fenced_block fenced_block; -#elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__)) -typedef gcc_x86_fenced_block fenced_block; #elif defined(BOOST_WINDOWS) && !defined(UNDER_CE) typedef win_fenced_block fenced_block; #else diff --git a/3rdParty/Boost/src/boost/asio/detail/gcc_arm_fenced_block.hpp b/3rdParty/Boost/src/boost/asio/detail/gcc_arm_fenced_block.hpp index 58cdfb4..1b3c764 100644 --- a/3rdParty/Boost/src/boost/asio/detail/gcc_arm_fenced_block.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/gcc_arm_fenced_block.hpp @@ -2,7 +2,7 @@ // detail/gcc_arm_fenced_block.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -29,8 +29,16 @@ class gcc_arm_fenced_block : private noncopyable { public: - // Constructor. - gcc_arm_fenced_block() + enum half_t { half }; + enum full_t { full }; + + // Constructor for a half fenced block. + explicit gcc_arm_fenced_block(half_t) + { + } + + // Constructor for a full fenced block. + explicit gcc_arm_fenced_block(full_t) { barrier(); } @@ -57,9 +65,14 @@ private: || defined(__ARM_ARCH_6Z__) \ || defined(__ARM_ARCH_6ZK__) \ || defined(__ARM_ARCH_6T2__) +# if defined(__thumb__) + // This is just a placeholder and almost certainly not sufficient. + __asm__ __volatile__ ("" : : : "memory"); +# else // defined(__thumb__) int a = 0, b = 0; __asm__ __volatile__ ("swp %0, %1, [%2]" : "=&r"(a) : "r"(1), "r"(&b) : "memory", "cc"); +# endif // defined(__thumb__) #else // ARMv7 and later. __asm__ __volatile__ ("dmb" : : : "memory"); diff --git a/3rdParty/Boost/src/boost/asio/detail/gcc_hppa_fenced_block.hpp b/3rdParty/Boost/src/boost/asio/detail/gcc_hppa_fenced_block.hpp index 6c5226b..421d3a6 100644 --- a/3rdParty/Boost/src/boost/asio/detail/gcc_hppa_fenced_block.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/gcc_hppa_fenced_block.hpp @@ -2,7 +2,7 @@ // detail/gcc_hppa_fenced_block.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -29,8 +29,16 @@ class gcc_hppa_fenced_block : private noncopyable { public: - // Constructor. - gcc_hppa_fenced_block() + enum half_t { half }; + enum full_t { full }; + + // Constructor for a half fenced block. + explicit gcc_hppa_fenced_block(half_t) + { + } + + // Constructor for a full fenced block. + explicit gcc_hppa_fenced_block(full_t) { barrier(); } diff --git a/3rdParty/Boost/src/boost/asio/detail/gcc_sync_fenced_block.hpp b/3rdParty/Boost/src/boost/asio/detail/gcc_sync_fenced_block.hpp index 65472cc..81aaeb0 100644 --- a/3rdParty/Boost/src/boost/asio/detail/gcc_sync_fenced_block.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/gcc_sync_fenced_block.hpp @@ -2,7 +2,7 @@ // detail/gcc_sync_fenced_block.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -32,8 +32,10 @@ class gcc_sync_fenced_block : private noncopyable { public: + enum half_or_full_t { half, full }; + // Constructor. - gcc_sync_fenced_block() + explicit gcc_sync_fenced_block(half_or_full_t) : value_(0) { __sync_lock_test_and_set(&value_, 1); diff --git a/3rdParty/Boost/src/boost/asio/detail/gcc_x86_fenced_block.hpp b/3rdParty/Boost/src/boost/asio/detail/gcc_x86_fenced_block.hpp index fb8473c..973165a 100644 --- a/3rdParty/Boost/src/boost/asio/detail/gcc_x86_fenced_block.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/gcc_x86_fenced_block.hpp @@ -2,7 +2,7 @@ // detail/gcc_x86_fenced_block.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -29,25 +29,55 @@ class gcc_x86_fenced_block : private noncopyable { public: - // Constructor. - gcc_x86_fenced_block() + enum half_t { half }; + enum full_t { full }; + + // Constructor for a half fenced block. + explicit gcc_x86_fenced_block(half_t) { - barrier(); + } + + // Constructor for a full fenced block. + explicit gcc_x86_fenced_block(full_t) + { + lbarrier(); } // Destructor. ~gcc_x86_fenced_block() { - barrier(); + sbarrier(); } private: static int barrier() { - int r = 0; - __asm__ __volatile__ ("xchgl %%eax, %0" : "=m" (r) : : "memory", "cc"); + int r = 0, m = 1; + __asm__ __volatile__ ( + "xchgl %0, %1" : + "=r"(r), "=m"(m) : + "0"(1), "m"(m) : + "memory", "cc"); return r; } + + static void lbarrier() + { +#if defined(__SSE2__) + __asm__ __volatile__ ("lfence" ::: "memory"); +#else // defined(__SSE2__) + barrier(); +#endif // defined(__SSE2__) + } + + static void sbarrier() + { +#if defined(__SSE2__) + __asm__ __volatile__ ("sfence" ::: "memory"); +#else // defined(__SSE2__) + barrier(); +#endif // defined(__SSE2__) + } }; } // namespace detail diff --git a/3rdParty/Boost/src/boost/asio/detail/handler_alloc_helpers.hpp b/3rdParty/Boost/src/boost/asio/detail/handler_alloc_helpers.hpp index fc3ec33..91e993c 100644 --- a/3rdParty/Boost/src/boost/asio/detail/handler_alloc_helpers.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/handler_alloc_helpers.hpp @@ -2,7 +2,7 @@ // detail/handler_alloc_helpers.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -35,7 +35,7 @@ inline void* allocate(std::size_t s, Handler& h) || BOOST_WORKAROUND(__GNUC__, < 3) return ::operator new(s); #else - using namespace boost::asio; + using boost::asio::asio_handler_allocate; return asio_handler_allocate(s, boost::addressof(h)); #endif } @@ -47,7 +47,7 @@ inline void deallocate(void* p, std::size_t s, Handler& h) || BOOST_WORKAROUND(__GNUC__, < 3) ::operator delete(p); #else - using namespace boost::asio; + using boost::asio::asio_handler_deallocate; asio_handler_deallocate(p, s, boost::addressof(h)); #endif } diff --git a/3rdParty/Boost/src/boost/asio/detail/handler_invoke_helpers.hpp b/3rdParty/Boost/src/boost/asio/detail/handler_invoke_helpers.hpp index 3b44997..f6172a0 100644 --- a/3rdParty/Boost/src/boost/asio/detail/handler_invoke_helpers.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/handler_invoke_helpers.hpp @@ -2,7 +2,7 @@ // detail/handler_invoke_helpers.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -28,6 +28,19 @@ namespace boost_asio_handler_invoke_helpers { template <typename Function, typename Context> +inline void invoke(Function& function, Context& context) +{ +#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) \ + || BOOST_WORKAROUND(__GNUC__, < 3) + Function tmp(function); + tmp(); +#else + using boost::asio::asio_handler_invoke; + asio_handler_invoke(function, boost::addressof(context)); +#endif +} + +template <typename Function, typename Context> inline void invoke(const Function& function, Context& context) { #if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) \ @@ -35,7 +48,7 @@ inline void invoke(const Function& function, Context& context) Function tmp(function); tmp(); #else - using namespace boost::asio; + using boost::asio::asio_handler_invoke; asio_handler_invoke(function, boost::addressof(context)); #endif } diff --git a/3rdParty/Boost/src/boost/asio/detail/handler_tracking.hpp b/3rdParty/Boost/src/boost/asio/detail/handler_tracking.hpp new file mode 100644 index 0000000..9c96e18 --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/detail/handler_tracking.hpp @@ -0,0 +1,161 @@ +// +// detail/handler_tracking.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) +// + +#ifndef BOOST_ASIO_DETAIL_HANDLER_TRACKING_HPP +#define BOOST_ASIO_DETAIL_HANDLER_TRACKING_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> + +#if defined(BOOST_ASIO_ENABLE_HANDLER_TRACKING) +# include <boost/cstdint.hpp> +# include <boost/system/error_code.hpp> +# include <boost/asio/detail/static_mutex.hpp> +# include <boost/asio/detail/tss_ptr.hpp> +#endif // defined(BOOST_ASIO_ENABLE_HANDLER_TRACKING) + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { +namespace detail { + +#if defined(BOOST_ASIO_ENABLE_HANDLER_TRACKING) + +class handler_tracking +{ +public: + class completion; + + // Base class for objects containing tracked handlers. + class tracked_handler + { + private: + // Only the handler_tracking class will have access to the id. + friend class handler_tracking; + friend class completion; + boost::uint64_t id_; + + protected: + // Constructor initialises with no id. + tracked_handler() : id_(0) {} + + // Prevent deletion through this type. + ~tracked_handler() {} + }; + + // Initialise the tracking system. + BOOST_ASIO_DECL static void init(); + + // Record the creation of a tracked handler. + BOOST_ASIO_DECL static void creation(tracked_handler* h, + const char* object_type, void* object, const char* op_name); + + class completion + { + public: + // Constructor records that handler is to be invoked with no arguments. + BOOST_ASIO_DECL explicit completion(tracked_handler* h); + + // Destructor records only when an exception is thrown from the handler, or + // if the memory is being freed without the handler having been invoked. + BOOST_ASIO_DECL ~completion(); + + // Records that handler is to be invoked with no arguments. + BOOST_ASIO_DECL void invocation_begin(); + + // Records that handler is to be invoked with one arguments. + BOOST_ASIO_DECL void invocation_begin(const boost::system::error_code& ec); + + // Constructor records that handler is to be invoked with two arguments. + BOOST_ASIO_DECL void invocation_begin( + const boost::system::error_code& ec, std::size_t bytes_transferred); + + // Constructor records that handler is to be invoked with two arguments. + BOOST_ASIO_DECL void invocation_begin( + const boost::system::error_code& ec, int signal_number); + + // Constructor records that handler is to be invoked with two arguments. + BOOST_ASIO_DECL void invocation_begin( + const boost::system::error_code& ec, const char* arg); + + // Record that handler invocation has ended. + BOOST_ASIO_DECL void invocation_end(); + + private: + friend class handler_tracking; + boost::uint64_t id_; + bool invoked_; + completion* next_; + }; + + // Record an operation that affects pending handlers. + BOOST_ASIO_DECL static void operation(const char* object_type, + void* object, const char* op_name); + + // Write a line of output. + BOOST_ASIO_DECL static void write_line(const char* format, ...); + +private: + struct tracking_state; + BOOST_ASIO_DECL static tracking_state* get_state(); +}; + +# define BOOST_ASIO_INHERIT_TRACKED_HANDLER \ + : public boost::asio::detail::handler_tracking::tracked_handler + +# define BOOST_ASIO_ALSO_INHERIT_TRACKED_HANDLER \ + , public boost::asio::detail::handler_tracking::tracked_handler + +# define BOOST_ASIO_HANDLER_TRACKING_INIT \ + boost::asio::detail::handler_tracking::init() + +# define BOOST_ASIO_HANDLER_CREATION(args) \ + boost::asio::detail::handler_tracking::creation args + +# define BOOST_ASIO_HANDLER_COMPLETION(args) \ + boost::asio::detail::handler_tracking::completion tracked_completion args + +# define BOOST_ASIO_HANDLER_INVOCATION_BEGIN(args) \ + tracked_completion.invocation_begin args + +# define BOOST_ASIO_HANDLER_INVOCATION_END \ + tracked_completion.invocation_end() + +# define BOOST_ASIO_HANDLER_OPERATION(args) \ + boost::asio::detail::handler_tracking::operation args + +#else // defined(BOOST_ASIO_ENABLE_HANDLER_TRACKING) + +# define BOOST_ASIO_INHERIT_TRACKED_HANDLER +# define BOOST_ASIO_ALSO_INHERIT_TRACKED_HANDLER +# define BOOST_ASIO_HANDLER_TRACKING_INIT (void)0 +# define BOOST_ASIO_HANDLER_CREATION(args) (void)0 +# define BOOST_ASIO_HANDLER_COMPLETION(args) (void)0 +# define BOOST_ASIO_HANDLER_INVOCATION_BEGIN(args) (void)0 +# define BOOST_ASIO_HANDLER_INVOCATION_END (void)0 +# define BOOST_ASIO_HANDLER_OPERATION(args) (void)0 + +#endif // defined(BOOST_ASIO_ENABLE_HANDLER_TRACKING) + +} // namespace detail +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#if defined(BOOST_ASIO_HEADER_ONLY) +# include <boost/asio/detail/impl/handler_tracking.ipp> +#endif // defined(BOOST_ASIO_HEADER_ONLY) + +#endif // BOOST_ASIO_DETAIL_HANDLER_TRACKING_HPP diff --git a/3rdParty/Boost/src/boost/asio/detail/handler_type_requirements.hpp b/3rdParty/Boost/src/boost/asio/detail/handler_type_requirements.hpp new file mode 100644 index 0000000..a7f47c2 --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/detail/handler_type_requirements.hpp @@ -0,0 +1,362 @@ +// +// detail/handler_type_requirements.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) +// + +#ifndef BOOST_ASIO_DETAIL_HANDLER_TYPE_REQUIREMENTS_HPP +#define BOOST_ASIO_DETAIL_HANDLER_TYPE_REQUIREMENTS_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> + +// Older versions of gcc have difficulty compiling the sizeof expressions where +// we test the handler type requirements. We'll disable checking of handler type +// requirements for those compilers, but otherwise enable it by default. +#if !defined(BOOST_ASIO_DISABLE_HANDLER_TYPE_REQUIREMENTS) +# if !defined(__GNUC__) || (__GNUC__ >= 4) +# define BOOST_ASIO_ENABLE_HANDLER_TYPE_REQUIREMENTS 1 +# endif // !defined(__GNUC__) || (__GNUC__ >= 4) +#endif // !defined(BOOST_ASIO_DISABLE_HANDLER_TYPE_REQUIREMENTS) + +// With C++0x we can use a combination of enhanced SFINAE and static_assert to +// generate better template error messages. As this technique is not yet widely +// portable, we'll only enable it for tested compilers. +#if !defined(BOOST_ASIO_DISABLE_HANDLER_TYPE_REQUIREMENTS_ASSERT) +# if defined(__GNUC__) +# if ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4) +# if defined(__GXX_EXPERIMENTAL_CXX0X__) +# define BOOST_ASIO_ENABLE_HANDLER_TYPE_REQUIREMENTS_ASSERT 1 +# endif // defined(__GXX_EXPERIMENTAL_CXX0X__) +# endif // ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 5)) || (__GNUC__ > 4) +# endif // defined(__GNUC__) +# if defined(BOOST_MSVC) +# if (_MSC_VER >= 1600) +# define BOOST_ASIO_ENABLE_HANDLER_TYPE_REQUIREMENTS_ASSERT 1 +# endif // (_MSC_VER >= 1600) +# endif // defined(BOOST_MSVC) +#endif // !defined(BOOST_ASIO_DISABLE_HANDLER_TYPE_REQUIREMENTS) + +namespace boost { +namespace asio { +namespace detail { + +#if defined(BOOST_ASIO_ENABLE_HANDLER_TYPE_REQUIREMENTS) + +# if defined(BOOST_ASIO_ENABLE_HANDLER_TYPE_REQUIREMENTS_ASSERT) + +template <typename Handler> +auto zero_arg_handler_test(Handler h, void*) + -> decltype( + sizeof(Handler(static_cast<const Handler&>(h))), + ((h)()), + char(0)); + +template <typename Handler> +char (&zero_arg_handler_test(Handler, ...))[2]; + +template <typename Handler, typename Arg1> +auto one_arg_handler_test(Handler h, Arg1* a1) + -> decltype( + sizeof(Handler(static_cast<const Handler&>(h))), + ((h)(*a1)), + char(0)); + +template <typename Handler> +char (&one_arg_handler_test(Handler h, ...))[2]; + +template <typename Handler, typename Arg1, typename Arg2> +auto two_arg_handler_test(Handler h, Arg1* a1, Arg2* a2) + -> decltype( + sizeof(Handler(static_cast<const Handler&>(h))), + ((h)(*a1, *a2)), + char(0)); + +template <typename Handler> +char (&two_arg_handler_test(Handler, ...))[2]; + +# define BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT(expr, msg) \ + static_assert(expr, msg); + +# else // defined(BOOST_ASIO_ENABLE_HANDLER_TYPE_REQUIREMENTS_ASSERT) + +# define BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT(expr, msg) + +# endif // defined(BOOST_ASIO_ENABLE_HANDLER_TYPE_REQUIREMENTS_ASSERT) + +template <typename T> T& lvref(); +template <typename T> T& lvref(T); +template <typename T> const T& clvref(T); +template <typename T> char argbyv(T); + +template <int> +struct handler_type_requirements +{ +}; + +#define BOOST_ASIO_COMPLETION_HANDLER_CHECK( \ + handler_type, handler) \ + \ + BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \ + sizeof(boost::asio::detail::zero_arg_handler_test( \ + handler, 0)) == 1, \ + "CompletionHandler type requirements not met") \ + \ + typedef boost::asio::detail::handler_type_requirements< \ + sizeof( \ + boost::asio::detail::argbyv( \ + boost::asio::detail::clvref(handler))) + \ + sizeof( \ + boost::asio::detail::lvref(handler)(), \ + char(0))> + +#define BOOST_ASIO_READ_HANDLER_CHECK( \ + handler_type, handler) \ + \ + BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \ + sizeof(boost::asio::detail::two_arg_handler_test( \ + handler, \ + static_cast<const boost::system::error_code*>(0), \ + static_cast<const std::size_t*>(0))) == 1, \ + "ReadHandler type requirements not met") \ + \ + typedef boost::asio::detail::handler_type_requirements< \ + sizeof( \ + boost::asio::detail::argbyv( \ + boost::asio::detail::clvref(handler))) + \ + sizeof( \ + boost::asio::detail::lvref(handler)( \ + boost::asio::detail::lvref<const boost::system::error_code>(), \ + boost::asio::detail::lvref<const std::size_t>()), \ + char(0))> + +#define BOOST_ASIO_WRITE_HANDLER_CHECK( \ + handler_type, handler) \ + \ + BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \ + sizeof(boost::asio::detail::two_arg_handler_test( \ + handler, \ + static_cast<const boost::system::error_code*>(0), \ + static_cast<const std::size_t*>(0))) == 1, \ + "WriteHandler type requirements not met") \ + \ + typedef boost::asio::detail::handler_type_requirements< \ + sizeof( \ + boost::asio::detail::argbyv( \ + boost::asio::detail::clvref(handler))) + \ + sizeof( \ + boost::asio::detail::lvref(handler)( \ + boost::asio::detail::lvref<const boost::system::error_code>(), \ + boost::asio::detail::lvref<const std::size_t>()), \ + char(0))> + +#define BOOST_ASIO_ACCEPT_HANDLER_CHECK( \ + handler_type, handler) \ + \ + BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \ + sizeof(boost::asio::detail::one_arg_handler_test( \ + handler, \ + static_cast<const boost::system::error_code*>(0))) == 1, \ + "AcceptHandler type requirements not met") \ + \ + typedef boost::asio::detail::handler_type_requirements< \ + sizeof( \ + boost::asio::detail::argbyv( \ + boost::asio::detail::clvref(handler))) + \ + sizeof( \ + boost::asio::detail::lvref(handler)( \ + boost::asio::detail::lvref<const boost::system::error_code>()), \ + char(0))> + +#define BOOST_ASIO_CONNECT_HANDLER_CHECK( \ + handler_type, handler) \ + \ + BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \ + sizeof(boost::asio::detail::one_arg_handler_test( \ + handler, \ + static_cast<const boost::system::error_code*>(0))) == 1, \ + "ConnectHandler type requirements not met") \ + \ + typedef boost::asio::detail::handler_type_requirements< \ + sizeof( \ + boost::asio::detail::argbyv( \ + boost::asio::detail::clvref(handler))) + \ + sizeof( \ + boost::asio::detail::lvref(handler)( \ + boost::asio::detail::lvref<const boost::system::error_code>()), \ + char(0))> + +#define BOOST_ASIO_COMPOSED_CONNECT_HANDLER_CHECK( \ + handler_type, handler, iter_type) \ + \ + BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \ + sizeof(boost::asio::detail::two_arg_handler_test( \ + handler, \ + static_cast<const boost::system::error_code*>(0), \ + static_cast<const iter_type*>(0))) == 1, \ + "ComposedConnectHandler type requirements not met") \ + \ + typedef boost::asio::detail::handler_type_requirements< \ + sizeof( \ + boost::asio::detail::argbyv( \ + boost::asio::detail::clvref(handler))) + \ + sizeof( \ + boost::asio::detail::lvref(handler)( \ + boost::asio::detail::lvref<const boost::system::error_code>(), \ + boost::asio::detail::lvref<const iter_type>()), \ + char(0))> + +#define BOOST_ASIO_RESOLVE_HANDLER_CHECK( \ + handler_type, handler, iter_type) \ + \ + BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \ + sizeof(boost::asio::detail::two_arg_handler_test( \ + handler, \ + static_cast<const boost::system::error_code*>(0), \ + static_cast<const iter_type*>(0))) == 1, \ + "ResolveHandler type requirements not met") \ + \ + typedef boost::asio::detail::handler_type_requirements< \ + sizeof( \ + boost::asio::detail::argbyv( \ + boost::asio::detail::clvref(handler))) + \ + sizeof( \ + boost::asio::detail::lvref(handler)( \ + boost::asio::detail::lvref<const boost::system::error_code>(), \ + boost::asio::detail::lvref<const iter_type>()), \ + char(0))> + +#define BOOST_ASIO_WAIT_HANDLER_CHECK( \ + handler_type, handler) \ + \ + BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \ + sizeof(boost::asio::detail::one_arg_handler_test( \ + handler, \ + static_cast<const boost::system::error_code*>(0))) == 1, \ + "WaitHandler type requirements not met") \ + \ + typedef boost::asio::detail::handler_type_requirements< \ + sizeof( \ + boost::asio::detail::argbyv( \ + boost::asio::detail::clvref(handler))) + \ + sizeof( \ + boost::asio::detail::lvref(handler)( \ + boost::asio::detail::lvref<const boost::system::error_code>()), \ + char(0))> + +#define BOOST_ASIO_SIGNAL_HANDLER_CHECK( \ + handler_type, handler) \ + \ + BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \ + sizeof(boost::asio::detail::two_arg_handler_test( \ + handler, \ + static_cast<const boost::system::error_code*>(0), \ + static_cast<const int*>(0))) == 1, \ + "SignalHandler type requirements not met") \ + \ + typedef boost::asio::detail::handler_type_requirements< \ + sizeof( \ + boost::asio::detail::argbyv( \ + boost::asio::detail::clvref(handler))) + \ + sizeof( \ + boost::asio::detail::lvref(handler)( \ + boost::asio::detail::lvref<const boost::system::error_code>(), \ + boost::asio::detail::lvref<const int>()), \ + char(0))> + +#define BOOST_ASIO_HANDSHAKE_HANDLER_CHECK( \ + handler_type, handler) \ + \ + BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \ + sizeof(boost::asio::detail::one_arg_handler_test( \ + handler, \ + static_cast<const boost::system::error_code*>(0))) == 1, \ + "HandshakeHandler type requirements not met") \ + \ + typedef boost::asio::detail::handler_type_requirements< \ + sizeof( \ + boost::asio::detail::argbyv( \ + boost::asio::detail::clvref(handler))) + \ + sizeof( \ + boost::asio::detail::lvref(handler)( \ + boost::asio::detail::lvref<const boost::system::error_code>()), \ + char(0))> + +#define BOOST_ASIO_SHUTDOWN_HANDLER_CHECK( \ + handler_type, handler) \ + \ + BOOST_ASIO_HANDLER_TYPE_REQUIREMENTS_ASSERT( \ + sizeof(boost::asio::detail::one_arg_handler_test( \ + handler, \ + static_cast<const boost::system::error_code*>(0))) == 1, \ + "ShutdownHandler type requirements not met") \ + \ + typedef boost::asio::detail::handler_type_requirements< \ + sizeof( \ + boost::asio::detail::argbyv( \ + boost::asio::detail::clvref(handler))) + \ + sizeof( \ + boost::asio::detail::lvref(handler)( \ + boost::asio::detail::lvref<const boost::system::error_code>()), \ + char(0))> + +#else // !defined(BOOST_ASIO_ENABLE_HANDLER_TYPE_REQUIREMENTS) + +#define BOOST_ASIO_COMPLETION_HANDLER_CHECK( \ + handler_type, handler) \ + typedef int + +#define BOOST_ASIO_READ_HANDLER_CHECK( \ + handler_type, handler) \ + typedef int + +#define BOOST_ASIO_WRITE_HANDLER_CHECK( \ + handler_type, handler) \ + typedef int + +#define BOOST_ASIO_ACCEPT_HANDLER_CHECK( \ + handler_type, handler) \ + typedef int + +#define BOOST_ASIO_CONNECT_HANDLER_CHECK( \ + handler_type, handler) \ + typedef int + +#define BOOST_ASIO_COMPOSED_CONNECT_HANDLER_CHECK( \ + handler_type, handler, iter_type) \ + typedef int + +#define BOOST_ASIO_RESOLVE_HANDLER_CHECK( \ + handler_type, handler, iter_type) \ + typedef int + +#define BOOST_ASIO_WAIT_HANDLER_CHECK( \ + handler_type, handler) \ + typedef int + +#define BOOST_ASIO_SIGNAL_HANDLER_CHECK( \ + handler_type, handler) \ + typedef int + +#define BOOST_ASIO_HANDSHAKE_HANDLER_CHECK( \ + handler_type, handler) \ + typedef int + +#define BOOST_ASIO_SHUTDOWN_HANDLER_CHECK( \ + handler_type, handler) \ + typedef int + +#endif // !defined(BOOST_ASIO_ENABLE_HANDLER_TYPE_REQUIREMENTS) + +} // namespace detail +} // namespace asio +} // namespace boost + +#endif // BOOST_ASIO_DETAIL_HANDLER_TYPE_REQUIREMENTS_HPP diff --git a/3rdParty/Boost/src/boost/asio/detail/hash_map.hpp b/3rdParty/Boost/src/boost/asio/detail/hash_map.hpp index 4f4eed3..339ab9d 100644 --- a/3rdParty/Boost/src/boost/asio/detail/hash_map.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/hash_map.hpp @@ -2,7 +2,7 @@ // detail/hash_map.hpp // ~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -16,7 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> -#include <cassert> +#include <boost/assert.hpp> #include <list> #include <utility> #include <boost/asio/detail/noncopyable.hpp> @@ -117,9 +117,9 @@ public: iterator it = buckets_[bucket].first; if (it == values_.end()) return values_.end(); - iterator end = buckets_[bucket].last; - ++end; - while (it != end) + iterator end_it = buckets_[bucket].last; + ++end_it; + while (it != end_it) { if (it->first == k) return it; @@ -138,9 +138,9 @@ public: const_iterator it = buckets_[bucket].first; if (it == values_.end()) return it; - const_iterator end = buckets_[bucket].last; - ++end; - while (it != end) + const_iterator end_it = buckets_[bucket].last; + ++end_it; + while (it != end_it) { if (it->first == k) return it; @@ -164,15 +164,15 @@ public: ++size_; return std::pair<iterator, bool>(buckets_[bucket].last, true); } - iterator end = buckets_[bucket].last; - ++end; - while (it != end) + iterator end_it = buckets_[bucket].last; + ++end_it; + while (it != end_it) { if (it->first == v.first) return std::pair<iterator, bool>(it, false); ++it; } - buckets_[bucket].last = values_insert(end, v); + buckets_[bucket].last = values_insert(end_it, v); ++size_; return std::pair<iterator, bool>(buckets_[bucket].last, true); } @@ -180,7 +180,7 @@ public: // Erase an entry from the map. void erase(iterator it) { - assert(it != values_.end()); + BOOST_ASSERT(it != values_.end()); size_t bucket = calculate_hash_value(it->first) % num_buckets_; bool is_first = (it == buckets_[bucket].first); @@ -212,9 +212,9 @@ public: size_ = 0; // Initialise all buckets to empty. - iterator end = values_.end(); + iterator end_it = values_.end(); for (size_t i = 0; i < num_buckets_; ++i) - buckets_[i].first = buckets_[i].last = end; + buckets_[i].first = buckets_[i].last = end_it; } private: @@ -245,21 +245,21 @@ private: return; num_buckets_ = num_buckets; - iterator end = values_.end(); + iterator end_iter = values_.end(); // Update number of buckets and initialise all buckets to empty. bucket_type* tmp = new bucket_type[num_buckets_]; delete[] buckets_; buckets_ = tmp; for (std::size_t i = 0; i < num_buckets_; ++i) - buckets_[i].first = buckets_[i].last = end; + buckets_[i].first = buckets_[i].last = end_iter; // Put all values back into the hash. iterator iter = values_.begin(); - while (iter != end) + while (iter != end_iter) { std::size_t bucket = calculate_hash_value(iter->first) % num_buckets_; - if (buckets_[bucket].last == end) + if (buckets_[bucket].last == end_iter) { buckets_[bucket].first = buckets_[bucket].last = iter++; } diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/descriptor_ops.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/descriptor_ops.ipp index 9a2bb3b..6c3528f 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/descriptor_ops.ipp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/descriptor_ops.ipp @@ -2,7 +2,7 @@ // detail/impl/descriptor_ops.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -43,8 +43,19 @@ int close(int d, state_type& state, boost::system::error_code& ec) int result = 0; if (d != -1) { - if (state & internal_non_blocking) + errno = 0; + result = error_wrapper(::close(d), ec); + + if (result != 0 + && (ec == boost::asio::error::would_block + || ec == boost::asio::error::try_again)) { + // According to UNIX Network Programming Vol. 1, it is possible for + // close() to fail with EWOULDBLOCK under certain circumstances. What + // isn't clear is the state of the descriptor after this error. The one + // current OS where this behaviour is seen, Windows, says that the socket + // remains open. Therefore we'll put the descriptor back into blocking + // mode and have another attempt at closing it. #if defined(__SYMBIAN32__) int flags = ::fcntl(d, F_GETFL, 0); if (flags >= 0) @@ -53,11 +64,11 @@ int close(int d, state_type& state, boost::system::error_code& ec) ioctl_arg_type arg = 0; ::ioctl(d, FIONBIO, &arg); #endif // defined(__SYMBIAN32__) - state &= ~internal_non_blocking; - } + state &= ~non_blocking; - errno = 0; - result = error_wrapper(::close(d), ec); + errno = 0; + result = error_wrapper(::close(d), ec); + } } if (result == 0) @@ -65,8 +76,49 @@ int close(int d, state_type& state, boost::system::error_code& ec) return result; } -bool set_internal_non_blocking(int d, - state_type& state, boost::system::error_code& ec) +bool set_user_non_blocking(int d, state_type& state, + bool value, boost::system::error_code& ec) +{ + if (d == -1) + { + ec = boost::asio::error::bad_descriptor; + return false; + } + + errno = 0; +#if defined(__SYMBIAN32__) + int result = error_wrapper(::fcntl(d, F_GETFL, 0), ec); + if (result >= 0) + { + errno = 0; + int flag = (value ? (result | O_NONBLOCK) : (result & ~O_NONBLOCK)); + result = error_wrapper(::fcntl(d, F_SETFL, flag), ec); + } +#else // defined(__SYMBIAN32__) + ioctl_arg_type arg = (value ? 1 : 0); + int result = error_wrapper(::ioctl(d, FIONBIO, &arg), ec); +#endif // defined(__SYMBIAN32__) + + if (result >= 0) + { + ec = boost::system::error_code(); + if (value) + state |= user_set_non_blocking; + else + { + // Clearing the user-set non-blocking mode always overrides any + // internally-set non-blocking flag. Any subsequent asynchronous + // operations will need to re-enable non-blocking I/O. + state &= ~(user_set_non_blocking | internal_non_blocking); + } + return true; + } + + return false; +} + +bool set_internal_non_blocking(int d, state_type& state, + bool value, boost::system::error_code& ec) { if (d == -1) { @@ -74,23 +126,36 @@ bool set_internal_non_blocking(int d, return false; } + if (!value && (state & user_set_non_blocking)) + { + // It does not make sense to clear the internal non-blocking flag if the + // user still wants non-blocking behaviour. Return an error and let the + // caller figure out whether to update the user-set non-blocking flag. + ec = boost::asio::error::invalid_argument; + return false; + } + errno = 0; #if defined(__SYMBIAN32__) int result = error_wrapper(::fcntl(d, F_GETFL, 0), ec); if (result >= 0) { errno = 0; - result = error_wrapper(::fcntl(d, F_SETFL, result | O_NONBLOCK), ec); + int flag = (value ? (result | O_NONBLOCK) : (result & ~O_NONBLOCK)); + result = error_wrapper(::fcntl(d, F_SETFL, flag), ec); } #else // defined(__SYMBIAN32__) - ioctl_arg_type arg = 1; + ioctl_arg_type arg = (value ? 1 : 0); int result = error_wrapper(::ioctl(d, FIONBIO, &arg), ec); #endif // defined(__SYMBIAN32__) if (result >= 0) { ec = boost::system::error_code(); - state |= internal_non_blocking; + if (value) + state |= internal_non_blocking; + else + state &= ~internal_non_blocking; return true; } @@ -138,7 +203,7 @@ std::size_t sync_read(int d, state_type state, buf* bufs, return 0; // Wait for descriptor to become ready. - if (descriptor_ops::poll_read(d, ec) < 0) + if (descriptor_ops::poll_read(d, 0, ec) < 0) return 0; } } @@ -215,7 +280,7 @@ std::size_t sync_write(int d, state_type state, const buf* bufs, return 0; // Wait for descriptor to become ready. - if (descriptor_ops::poll_write(d, ec) < 0) + if (descriptor_ops::poll_write(d, 0, ec) < 0) return 0; } } @@ -322,7 +387,7 @@ int fcntl(int d, long cmd, long arg, boost::system::error_code& ec) return result; } -int poll_read(int d, boost::system::error_code& ec) +int poll_read(int d, state_type state, boost::system::error_code& ec) { if (d == -1) { @@ -334,14 +399,18 @@ int poll_read(int d, boost::system::error_code& ec) fds.fd = d; fds.events = POLLIN; fds.revents = 0; + int timeout = (state & user_set_non_blocking) ? 0 : -1; errno = 0; - int result = error_wrapper(::poll(&fds, 1, -1), ec); - if (result >= 0) + int result = error_wrapper(::poll(&fds, 1, timeout), ec); + if (result == 0) + ec = (state & user_set_non_blocking) + ? boost::asio::error::would_block : boost::system::error_code(); + else if (result > 0) ec = boost::system::error_code(); return result; } -int poll_write(int d, boost::system::error_code& ec) +int poll_write(int d, state_type state, boost::system::error_code& ec) { if (d == -1) { @@ -353,9 +422,13 @@ int poll_write(int d, boost::system::error_code& ec) fds.fd = d; fds.events = POLLOUT; fds.revents = 0; + int timeout = (state & user_set_non_blocking) ? 0 : -1; errno = 0; - int result = error_wrapper(::poll(&fds, 1, -1), ec); - if (result >= 0) + int result = error_wrapper(::poll(&fds, 1, timeout), ec); + if (result == 0) + ec = (state & user_set_non_blocking) + ? boost::asio::error::would_block : boost::system::error_code(); + else if (result > 0) ec = boost::system::error_code(); return result; } diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/dev_poll_reactor.hpp b/3rdParty/Boost/src/boost/asio/detail/impl/dev_poll_reactor.hpp index a6b7078..12860af 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/dev_poll_reactor.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/dev_poll_reactor.hpp @@ -2,7 +2,7 @@ // detail/impl/dev_poll_reactor.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -40,7 +40,7 @@ void dev_poll_reactor::remove_timer_queue(timer_queue<Time_Traits>& queue) template <typename Time_Traits> void dev_poll_reactor::schedule_timer(timer_queue<Time_Traits>& queue, const typename Time_Traits::time_type& time, - typename timer_queue<Time_Traits>::per_timer_data& timer, timer_op* op) + typename timer_queue<Time_Traits>::per_timer_data& timer, wait_op* op) { boost::asio::detail::mutex::scoped_lock lock(mutex_); @@ -58,11 +58,12 @@ void dev_poll_reactor::schedule_timer(timer_queue<Time_Traits>& queue, template <typename Time_Traits> std::size_t dev_poll_reactor::cancel_timer(timer_queue<Time_Traits>& queue, - typename timer_queue<Time_Traits>::per_timer_data& timer) + typename timer_queue<Time_Traits>::per_timer_data& timer, + std::size_t max_cancelled) { boost::asio::detail::mutex::scoped_lock lock(mutex_); op_queue<operation> ops; - std::size_t n = queue.cancel_timer(timer, ops); + std::size_t n = queue.cancel_timer(timer, ops, max_cancelled); lock.unlock(); io_service_.post_deferred_completions(ops); return n; diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/dev_poll_reactor.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/dev_poll_reactor.ipp index b9d5e61..a648bf1 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/dev_poll_reactor.ipp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/dev_poll_reactor.ipp @@ -2,7 +2,7 @@ // detail/impl/dev_poll_reactor.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -19,6 +19,7 @@ #if defined(BOOST_ASIO_HAS_DEV_POLL) +#include <boost/assert.hpp> #include <boost/asio/detail/dev_poll_reactor.hpp> #include <boost/asio/detail/throw_error.hpp> #include <boost/asio/error.hpp> @@ -38,7 +39,7 @@ dev_poll_reactor::dev_poll_reactor(boost::asio::io_service& io_service) shutdown_(false) { // Add the interrupter's descriptor to /dev/poll. - ::pollfd ev = { 0 }; + ::pollfd ev = { 0, 0, 0 }; ev.fd = interrupter_.read_descriptor(); ev.events = POLLIN | POLLERR; ev.revents = 0; @@ -63,8 +64,68 @@ void dev_poll_reactor::shutdown_service() op_queue_[i].get_all_operations(ops); timer_queues_.get_all_timers(ops); + + io_service_.abandon_operations(ops); } +// Helper class to re-register all descriptors with /dev/poll. +class dev_poll_reactor::fork_helper +{ +public: + fork_helper(dev_poll_reactor* reactor, short events) + : reactor_(reactor), events_(events) + { + } + + bool set(int descriptor) + { + ::pollfd& ev = reactor_->add_pending_event_change(descriptor); + ev.events = events_; + return true; + } + +private: + dev_poll_reactor* reactor_; + short events_; +}; + +void dev_poll_reactor::fork_service(boost::asio::io_service::fork_event fork_ev) +{ + if (fork_ev == boost::asio::io_service::fork_child) + { + detail::mutex::scoped_lock lock(mutex_); + + if (dev_poll_fd_ != -1) + ::close(dev_poll_fd_); + dev_poll_fd_ = -1; + dev_poll_fd_ = do_dev_poll_create(); + + interrupter_.recreate(); + + // Add the interrupter's descriptor to /dev/poll. + ::pollfd ev = { 0, 0, 0 }; + ev.fd = interrupter_.read_descriptor(); + ev.events = POLLIN | POLLERR; + ev.revents = 0; + ::write(dev_poll_fd_, &ev, sizeof(ev)); + + // Re-register all descriptors with /dev/poll. The changes will be written + // to the /dev/poll descriptor the next time the reactor is run. + op_queue<operation> ops; + fork_helper read_op_helper(this, POLLERR | POLLHUP | POLLIN); + op_queue_[read_op].get_descriptors(read_op_helper, ops); + fork_helper write_op_helper(this, POLLERR | POLLHUP | POLLOUT); + op_queue_[write_op].get_descriptors(write_op_helper, ops); + fork_helper except_op_helper(this, POLLERR | POLLHUP | POLLPRI); + op_queue_[except_op].get_descriptors(except_op_helper, ops); + interrupter_.interrupt(); + + // The ops op_queue will always be empty because the fork_helper's set() + // member function never returns false. + BOOST_ASSERT(ops.empty()); + } +} + void dev_poll_reactor::init_task() { io_service_.init_task(); @@ -75,6 +136,32 @@ int dev_poll_reactor::register_descriptor(socket_type, per_descriptor_data&) return 0; } +int dev_poll_reactor::register_internal_descriptor(int op_type, + socket_type descriptor, per_descriptor_data&, reactor_op* op) +{ + boost::asio::detail::mutex::scoped_lock lock(mutex_); + + op_queue_[op_type].enqueue_operation(descriptor, op); + ::pollfd& ev = add_pending_event_change(descriptor); + ev.events = POLLERR | POLLHUP; + switch (op_type) + { + case read_op: ev.events |= POLLIN; break; + case write_op: ev.events |= POLLOUT; break; + case except_op: ev.events |= POLLPRI; break; + default: break; + } + interrupter_.interrupt(); + + return 0; +} + +void dev_poll_reactor::move_descriptor(socket_type, + dev_poll_reactor::per_descriptor_data&, + dev_poll_reactor::per_descriptor_data&) +{ +} + void dev_poll_reactor::start_op(int op_type, socket_type descriptor, dev_poll_reactor::per_descriptor_data&, reactor_op* op, bool allow_speculative) @@ -129,8 +216,8 @@ void dev_poll_reactor::cancel_ops(socket_type descriptor, cancel_ops_unlocked(descriptor, boost::asio::error::operation_aborted); } -void dev_poll_reactor::close_descriptor(socket_type descriptor, - dev_poll_reactor::per_descriptor_data&) +void dev_poll_reactor::deregister_descriptor(socket_type descriptor, + dev_poll_reactor::per_descriptor_data&, bool) { boost::asio::detail::mutex::scoped_lock lock(mutex_); @@ -143,6 +230,26 @@ void dev_poll_reactor::close_descriptor(socket_type descriptor, cancel_ops_unlocked(descriptor, boost::asio::error::operation_aborted); } +void dev_poll_reactor::deregister_internal_descriptor( + socket_type descriptor, dev_poll_reactor::per_descriptor_data&) +{ + boost::asio::detail::mutex::scoped_lock lock(mutex_); + + // Remove the descriptor from /dev/poll. Since this function is only called + // during a fork, we can apply the change immediately. + ::pollfd ev = { 0, 0, 0 }; + ev.fd = descriptor; + ev.events = POLLREMOVE; + ev.revents = 0; + ::write(dev_poll_fd_, &ev, sizeof(ev)); + + // Destroy all operations associated with the descriptor. + op_queue<operation> ops; + boost::system::error_code ec; + for (int i = 0; i < max_ops; ++i) + op_queue_[i].cancel_operations(descriptor, ops, ec); +} + void dev_poll_reactor::run(bool block, op_queue<operation>& ops) { boost::asio::detail::mutex::scoped_lock lock(mutex_); @@ -179,8 +286,8 @@ void dev_poll_reactor::run(bool block, op_queue<operation>& ops) lock.unlock(); // Block on the /dev/poll descriptor. - ::pollfd events[128] = { { 0 } }; - ::dvpoll dp = { 0 }; + ::pollfd events[128] = { { 0, 0, 0 } }; + ::dvpoll dp = { 0, 0, 0 }; dp.dp_fds = events; dp.dp_nfds = 128; dp.dp_timeout = timeout; @@ -228,7 +335,7 @@ void dev_poll_reactor::run(bool block, op_queue<operation>& ops) // The poll operation can produce POLLHUP or POLLERR events when there // is no operation pending, so if we do not remove the descriptor we // can end up in a tight polling loop. - ::pollfd ev = { 0 }; + ::pollfd ev = { 0, 0, 0 }; ev.fd = descriptor; ev.events = POLLREMOVE; ev.revents = 0; @@ -236,7 +343,7 @@ void dev_poll_reactor::run(bool block, op_queue<operation>& ops) } else { - ::pollfd ev = { 0 }; + ::pollfd ev = { 0, 0, 0 }; ev.fd = descriptor; ev.events = POLLERR | POLLHUP; if (more_reads) diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/epoll_reactor.hpp b/3rdParty/Boost/src/boost/asio/detail/impl/epoll_reactor.hpp index 0339cfd..215f484 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/epoll_reactor.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/epoll_reactor.hpp @@ -2,7 +2,7 @@ // detail/impl/epoll_reactor.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -38,7 +38,7 @@ void epoll_reactor::remove_timer_queue(timer_queue<Time_Traits>& queue) template <typename Time_Traits> void epoll_reactor::schedule_timer(timer_queue<Time_Traits>& queue, const typename Time_Traits::time_type& time, - typename timer_queue<Time_Traits>::per_timer_data& timer, timer_op* op) + typename timer_queue<Time_Traits>::per_timer_data& timer, wait_op* op) { mutex::scoped_lock lock(mutex_); @@ -56,11 +56,12 @@ void epoll_reactor::schedule_timer(timer_queue<Time_Traits>& queue, template <typename Time_Traits> std::size_t epoll_reactor::cancel_timer(timer_queue<Time_Traits>& queue, - typename timer_queue<Time_Traits>::per_timer_data& timer) + typename timer_queue<Time_Traits>::per_timer_data& timer, + std::size_t max_cancelled) { mutex::scoped_lock lock(mutex_); op_queue<operation> ops; - std::size_t n = queue.cancel_timer(timer, ops); + std::size_t n = queue.cancel_timer(timer, ops, max_cancelled); lock.unlock(); io_service_.post_deferred_completions(ops); return n; diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/epoll_reactor.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/epoll_reactor.ipp index 5afb891..073bd08 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/epoll_reactor.ipp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/epoll_reactor.ipp @@ -2,7 +2,7 @@ // detail/impl/epoll_reactor.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -39,13 +39,9 @@ epoll_reactor::epoll_reactor(boost::asio::io_service& io_service) : boost::asio::detail::service_base<epoll_reactor>(io_service), io_service_(use_service<io_service_impl>(io_service)), mutex_(), - epoll_fd_(do_epoll_create()), -#if defined(BOOST_ASIO_HAS_TIMERFD) - timer_fd_(timerfd_create(CLOCK_MONOTONIC, 0)), -#else // defined(BOOST_ASIO_HAS_TIMERFD) - timer_fd_(-1), -#endif // defined(BOOST_ASIO_HAS_TIMERFD) interrupter_(), + epoll_fd_(do_epoll_create()), + timer_fd_(do_timerfd_create()), shutdown_(false) { // Add the interrupter's descriptor to epoll. @@ -66,7 +62,8 @@ epoll_reactor::epoll_reactor(boost::asio::io_service& io_service) epoll_reactor::~epoll_reactor() { - close(epoll_fd_); + if (epoll_fd_ != -1) + close(epoll_fd_); if (timer_fd_ != -1) close(timer_fd_); } @@ -88,6 +85,59 @@ void epoll_reactor::shutdown_service() } timer_queues_.get_all_timers(ops); + + io_service_.abandon_operations(ops); +} + +void epoll_reactor::fork_service(boost::asio::io_service::fork_event fork_ev) +{ + if (fork_ev == boost::asio::io_service::fork_child) + { + if (epoll_fd_ != -1) + ::close(epoll_fd_); + epoll_fd_ = -1; + epoll_fd_ = do_epoll_create(); + + if (timer_fd_ != -1) + ::close(timer_fd_); + timer_fd_ = -1; + timer_fd_ = do_timerfd_create(); + + interrupter_.recreate(); + + // Add the interrupter's descriptor to epoll. + epoll_event ev = { 0, { 0 } }; + ev.events = EPOLLIN | EPOLLERR | EPOLLET; + ev.data.ptr = &interrupter_; + epoll_ctl(epoll_fd_, EPOLL_CTL_ADD, interrupter_.read_descriptor(), &ev); + interrupter_.interrupt(); + + // Add the timer descriptor to epoll. + if (timer_fd_ != -1) + { + ev.events = EPOLLIN | EPOLLERR; + ev.data.ptr = &timer_fd_; + epoll_ctl(epoll_fd_, EPOLL_CTL_ADD, timer_fd_, &ev); + } + + update_timeout(); + + // Re-register all descriptors with epoll. + mutex::scoped_lock descriptors_lock(registered_descriptors_mutex_); + for (descriptor_state* state = registered_descriptors_.first(); + state != 0; state = state->next_) + { + ev.events = state->registered_events_; + ev.data.ptr = state; + int result = epoll_ctl(epoll_fd_, EPOLL_CTL_ADD, state->descriptor_, &ev); + if (result != 0) + { + boost::system::error_code ec(errno, + boost::asio::error::get_system_category()); + boost::asio::detail::throw_error(ec, "epoll re-registration"); + } + } + } } void epoll_reactor::init_task() @@ -98,15 +148,19 @@ void epoll_reactor::init_task() int epoll_reactor::register_descriptor(socket_type descriptor, epoll_reactor::per_descriptor_data& descriptor_data) { - mutex::scoped_lock lock(registered_descriptors_mutex_); + descriptor_data = allocate_descriptor_state(); - descriptor_data = registered_descriptors_.alloc(); - descriptor_data->shutdown_ = false; + { + mutex::scoped_lock descriptor_lock(descriptor_data->mutex_); - lock.unlock(); + descriptor_data->reactor_ = this; + descriptor_data->descriptor_ = descriptor; + descriptor_data->shutdown_ = false; + } epoll_event ev = { 0, { 0 } }; - ev.events = EPOLLIN | EPOLLERR | EPOLLHUP | EPOLLOUT | EPOLLPRI | EPOLLET; + ev.events = EPOLLIN | EPOLLERR | EPOLLHUP | EPOLLPRI | EPOLLET; + descriptor_data->registered_events_ = ev.events; ev.data.ptr = descriptor_data; int result = epoll_ctl(epoll_fd_, EPOLL_CTL_ADD, descriptor, &ev); if (result != 0) @@ -115,6 +169,40 @@ int epoll_reactor::register_descriptor(socket_type descriptor, return 0; } +int epoll_reactor::register_internal_descriptor( + int op_type, socket_type descriptor, + epoll_reactor::per_descriptor_data& descriptor_data, reactor_op* op) +{ + descriptor_data = allocate_descriptor_state(); + + { + mutex::scoped_lock descriptor_lock(descriptor_data->mutex_); + + descriptor_data->reactor_ = this; + descriptor_data->descriptor_ = descriptor; + descriptor_data->shutdown_ = false; + descriptor_data->op_queue_[op_type].push(op); + } + + epoll_event ev = { 0, { 0 } }; + ev.events = EPOLLIN | EPOLLERR | EPOLLHUP | EPOLLPRI | EPOLLET; + descriptor_data->registered_events_ = ev.events; + ev.data.ptr = descriptor_data; + int result = epoll_ctl(epoll_fd_, EPOLL_CTL_ADD, descriptor, &ev); + if (result != 0) + return errno; + + return 0; +} + +void epoll_reactor::move_descriptor(socket_type, + epoll_reactor::per_descriptor_data& target_descriptor_data, + epoll_reactor::per_descriptor_data& source_descriptor_data) +{ + target_descriptor_data = source_descriptor_data; + source_descriptor_data = 0; +} + void epoll_reactor::start_op(int op_type, socket_type descriptor, epoll_reactor::per_descriptor_data& descriptor_data, reactor_op* op, bool allow_speculative) @@ -146,12 +234,37 @@ void epoll_reactor::start_op(int op_type, socket_type descriptor, io_service_.post_immediate_completion(op); return; } + + if (op_type == write_op) + { + if ((descriptor_data->registered_events_ & EPOLLOUT) == 0) + { + epoll_event ev = { 0, { 0 } }; + ev.events = descriptor_data->registered_events_ | EPOLLOUT; + ev.data.ptr = descriptor_data; + if (epoll_ctl(epoll_fd_, EPOLL_CTL_MOD, descriptor, &ev) == 0) + { + descriptor_data->registered_events_ |= ev.events; + } + else + { + op->ec_ = boost::system::error_code(errno, + boost::asio::error::get_system_category()); + io_service_.post_immediate_completion(op); + return; + } + } + } } else { + if (op_type == write_op) + { + descriptor_data->registered_events_ |= EPOLLOUT; + } + epoll_event ev = { 0, { 0 } }; - ev.events = EPOLLIN | EPOLLERR | EPOLLHUP - | EPOLLOUT | EPOLLPRI | EPOLLET; + ev.events = descriptor_data->registered_events_; ev.data.ptr = descriptor_data; epoll_ctl(epoll_fd_, EPOLL_CTL_MOD, descriptor, &ev); } @@ -185,19 +298,26 @@ void epoll_reactor::cancel_ops(socket_type, io_service_.post_deferred_completions(ops); } -void epoll_reactor::close_descriptor(socket_type, - epoll_reactor::per_descriptor_data& descriptor_data) +void epoll_reactor::deregister_descriptor(socket_type descriptor, + epoll_reactor::per_descriptor_data& descriptor_data, bool closing) { if (!descriptor_data) return; mutex::scoped_lock descriptor_lock(descriptor_data->mutex_); - mutex::scoped_lock descriptors_lock(registered_descriptors_mutex_); if (!descriptor_data->shutdown_) { - // Remove the descriptor from the set of known descriptors. The descriptor - // will be automatically removed from the epoll set when it is closed. + if (closing) + { + // The descriptor will be automatically removed from the epoll set when + // it is closed. + } + else + { + epoll_event ev = { 0, { 0 } }; + epoll_ctl(epoll_fd_, EPOLL_CTL_DEL, descriptor, &ev); + } op_queue<operation> ops; for (int i = 0; i < max_ops; ++i) @@ -210,21 +330,53 @@ void epoll_reactor::close_descriptor(socket_type, } } + descriptor_data->descriptor_ = -1; descriptor_data->shutdown_ = true; descriptor_lock.unlock(); - registered_descriptors_.free(descriptor_data); + free_descriptor_state(descriptor_data); descriptor_data = 0; - descriptors_lock.unlock(); - io_service_.post_deferred_completions(ops); } } +void epoll_reactor::deregister_internal_descriptor(socket_type descriptor, + epoll_reactor::per_descriptor_data& descriptor_data) +{ + if (!descriptor_data) + return; + + mutex::scoped_lock descriptor_lock(descriptor_data->mutex_); + + if (!descriptor_data->shutdown_) + { + epoll_event ev = { 0, { 0 } }; + epoll_ctl(epoll_fd_, EPOLL_CTL_DEL, descriptor, &ev); + + op_queue<operation> ops; + for (int i = 0; i < max_ops; ++i) + ops.push(descriptor_data->op_queue_[i]); + + descriptor_data->descriptor_ = -1; + descriptor_data->shutdown_ = true; + + descriptor_lock.unlock(); + + free_descriptor_state(descriptor_data); + descriptor_data = 0; + } +} + void epoll_reactor::run(bool block, op_queue<operation>& ops) { + // This code relies on the fact that the task_io_service queues the reactor + // task behind all descriptor operations generated by this function. This + // means, that by the time we reach this point, any previously returned + // descriptor operations have already been dequeued. Therefore it is now safe + // for us to reuse and return them for the task_io_service to queue again. + // Calculate a timeout only if timerfd is not used. int timeout; if (timer_fd_ != -1) @@ -271,28 +423,12 @@ void epoll_reactor::run(bool block, op_queue<operation>& ops) #endif // defined(BOOST_ASIO_HAS_TIMERFD) else { + // The descriptor operation doesn't count as work in and of itself, so we + // don't call work_started() here. This still allows the io_service to + // stop if the only remaining operations are descriptor operations. descriptor_state* descriptor_data = static_cast<descriptor_state*>(ptr); - mutex::scoped_lock descriptor_lock(descriptor_data->mutex_); - - // Exception operations must be processed first to ensure that any - // out-of-band data is read before normal data. - static const int flag[max_ops] = { EPOLLIN, EPOLLOUT, EPOLLPRI }; - for (int j = max_ops - 1; j >= 0; --j) - { - if (events[i].events & (flag[j] | EPOLLERR | EPOLLHUP)) - { - while (reactor_op* op = descriptor_data->op_queue_[j].front()) - { - if (op->perform()) - { - descriptor_data->op_queue_[j].pop(); - ops.push(op); - } - else - break; - } - } - } + descriptor_data->set_ready_events(events[i].events); + ops.push(descriptor_data); } } @@ -323,16 +459,65 @@ void epoll_reactor::interrupt() int epoll_reactor::do_epoll_create() { - int fd = epoll_create(epoll_size); +#if defined(EPOLL_CLOEXEC) + int fd = epoll_create1(EPOLL_CLOEXEC); +#else // defined(EPOLL_CLOEXEC) + int fd = -1; + errno = EINVAL; +#endif // defined(EPOLL_CLOEXEC) + + if (fd == -1 && (errno == EINVAL || errno == ENOSYS)) + { + fd = epoll_create(epoll_size); + if (fd != -1) + ::fcntl(fd, F_SETFD, FD_CLOEXEC); + } + if (fd == -1) { boost::system::error_code ec(errno, boost::asio::error::get_system_category()); boost::asio::detail::throw_error(ec, "epoll"); } + return fd; } +int epoll_reactor::do_timerfd_create() +{ +#if defined(BOOST_ASIO_HAS_TIMERFD) +# if defined(TFD_CLOEXEC) + int fd = timerfd_create(CLOCK_MONOTONIC, TFD_CLOEXEC); +# else // defined(TFD_CLOEXEC) + int fd = -1; + errno = EINVAL; +# endif // defined(TFD_CLOEXEC) + + if (fd == -1 && errno == EINVAL) + { + fd = timerfd_create(CLOCK_MONOTONIC, 0); + if (fd != -1) + ::fcntl(fd, F_SETFD, FD_CLOEXEC); + } + + return fd; +#else // defined(BOOST_ASIO_HAS_TIMERFD) + return -1; +#endif // defined(BOOST_ASIO_HAS_TIMERFD) +} + +epoll_reactor::descriptor_state* epoll_reactor::allocate_descriptor_state() +{ + mutex::scoped_lock descriptors_lock(registered_descriptors_mutex_); + return registered_descriptors_.alloc(); +} + +void epoll_reactor::free_descriptor_state(epoll_reactor::descriptor_state* s) +{ + mutex::scoped_lock descriptors_lock(registered_descriptors_mutex_); + registered_descriptors_.free(s); +} + void epoll_reactor::do_add_timer_queue(timer_queue_base& queue) { mutex::scoped_lock lock(mutex_); @@ -381,6 +566,92 @@ int epoll_reactor::get_timeout(itimerspec& ts) } #endif // defined(BOOST_ASIO_HAS_TIMERFD) +struct epoll_reactor::perform_io_cleanup_on_block_exit +{ + explicit perform_io_cleanup_on_block_exit(epoll_reactor* r) + : reactor_(r), first_op_(0) + { + } + + ~perform_io_cleanup_on_block_exit() + { + if (first_op_) + { + // Post the remaining completed operations for invocation. + if (!ops_.empty()) + reactor_->io_service_.post_deferred_completions(ops_); + + // A user-initiated operation has completed, but there's no need to + // explicitly call work_finished() here. Instead, we'll take advantage of + // the fact that the task_io_service will call work_finished() once we + // return. + } + else + { + // No user-initiated operations have completed, so we need to compensate + // for the work_finished() call that the task_io_service will make once + // this operation returns. + reactor_->io_service_.work_started(); + } + } + + epoll_reactor* reactor_; + op_queue<operation> ops_; + operation* first_op_; +}; + +epoll_reactor::descriptor_state::descriptor_state() + : operation(&epoll_reactor::descriptor_state::do_complete) +{ +} + +operation* epoll_reactor::descriptor_state::perform_io(uint32_t events) +{ + perform_io_cleanup_on_block_exit io_cleanup(reactor_); + mutex::scoped_lock descriptor_lock(mutex_); + + // Exception operations must be processed first to ensure that any + // out-of-band data is read before normal data. + static const int flag[max_ops] = { EPOLLIN, EPOLLOUT, EPOLLPRI }; + for (int j = max_ops - 1; j >= 0; --j) + { + if (events & (flag[j] | EPOLLERR | EPOLLHUP)) + { + while (reactor_op* op = op_queue_[j].front()) + { + if (op->perform()) + { + op_queue_[j].pop(); + io_cleanup.ops_.push(op); + } + else + break; + } + } + } + + // The first operation will be returned for completion now. The others will + // be posted for later by the io_cleanup object's destructor. + io_cleanup.first_op_ = io_cleanup.ops_.front(); + io_cleanup.ops_.pop(); + return io_cleanup.first_op_; +} + +void epoll_reactor::descriptor_state::do_complete( + io_service_impl* owner, operation* base, + const boost::system::error_code& ec, std::size_t bytes_transferred) +{ + if (owner) + { + descriptor_state* descriptor_data = static_cast<descriptor_state*>(base); + uint32_t events = static_cast<uint32_t>(bytes_transferred); + if (operation* op = descriptor_data->perform_io(events)) + { + op->complete(*owner, ec, 0); + } + } +} + } // namespace detail } // namespace asio } // namespace boost diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/eventfd_select_interrupter.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/eventfd_select_interrupter.ipp index d270b31..22154bb 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/eventfd_select_interrupter.ipp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/eventfd_select_interrupter.ipp @@ -2,7 +2,7 @@ // detail/impl/eventfd_select_interrupter.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) // Copyright (c) 2008 Roelof Naude (roelof.naude at gmail dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -40,24 +40,48 @@ namespace detail { eventfd_select_interrupter::eventfd_select_interrupter() { + open_descriptors(); +} + +void eventfd_select_interrupter::open_descriptors() +{ #if __GLIBC__ == 2 && __GLIBC_MINOR__ < 8 write_descriptor_ = read_descriptor_ = syscall(__NR_eventfd, 0); -#else // __GLIBC__ == 2 && __GLIBC_MINOR__ < 8 - write_descriptor_ = read_descriptor_ = ::eventfd(0, 0); -#endif // __GLIBC__ == 2 && __GLIBC_MINOR__ < 8 if (read_descriptor_ != -1) { ::fcntl(read_descriptor_, F_SETFL, O_NONBLOCK); + ::fcntl(read_descriptor_, F_SETFD, FD_CLOEXEC); } - else +#else // __GLIBC__ == 2 && __GLIBC_MINOR__ < 8 +# if defined(EFD_CLOEXEC) && defined(EFD_NONBLOCK) + write_descriptor_ = read_descriptor_ = + ::eventfd(0, EFD_CLOEXEC | EFD_NONBLOCK); +# else // defined(EFD_CLOEXEC) && defined(EFD_NONBLOCK) + errno = EINVAL; + write_descriptor_ = read_descriptor_ = -1; +# endif // defined(EFD_CLOEXEC) && defined(EFD_NONBLOCK) + if (read_descriptor_ == -1 && errno == EINVAL) + { + write_descriptor_ = read_descriptor_ = ::eventfd(0, 0); + if (read_descriptor_ != -1) + { + ::fcntl(read_descriptor_, F_SETFL, O_NONBLOCK); + ::fcntl(read_descriptor_, F_SETFD, FD_CLOEXEC); + } + } +#endif // __GLIBC__ == 2 && __GLIBC_MINOR__ < 8 + + if (read_descriptor_ == -1) { int pipe_fds[2]; if (pipe(pipe_fds) == 0) { read_descriptor_ = pipe_fds[0]; ::fcntl(read_descriptor_, F_SETFL, O_NONBLOCK); + ::fcntl(read_descriptor_, F_SETFD, FD_CLOEXEC); write_descriptor_ = pipe_fds[1]; ::fcntl(write_descriptor_, F_SETFL, O_NONBLOCK); + ::fcntl(write_descriptor_, F_SETFD, FD_CLOEXEC); } else { @@ -70,12 +94,27 @@ eventfd_select_interrupter::eventfd_select_interrupter() eventfd_select_interrupter::~eventfd_select_interrupter() { + close_descriptors(); +} + +void eventfd_select_interrupter::close_descriptors() +{ if (write_descriptor_ != -1 && write_descriptor_ != read_descriptor_) ::close(write_descriptor_); if (read_descriptor_ != -1) ::close(read_descriptor_); } +void eventfd_select_interrupter::recreate() +{ + close_descriptors(); + + write_descriptor_ = -1; + read_descriptor_ = -1; + + open_descriptors(); +} + void eventfd_select_interrupter::interrupt() { uint64_t counter(1UL); diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/handler_tracking.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/handler_tracking.ipp new file mode 100644 index 0000000..70342e3 --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/detail/impl/handler_tracking.ipp @@ -0,0 +1,299 @@ +// +// detail/impl/handler_tracking.ipp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) +// + +#ifndef BOOST_ASIO_DETAIL_IMPL_HANDLER_TRACKING_IPP +#define BOOST_ASIO_DETAIL_IMPL_HANDLER_TRACKING_IPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> + +#if defined(BOOST_ASIO_ENABLE_HANDLER_TRACKING) + +#include <cstdarg> +#include <cstdio> +#include <boost/asio/detail/handler_tracking.hpp> + +#include <boost/asio/detail/push_options.hpp> +#include <boost/date_time/posix_time/posix_time_types.hpp> +#include <boost/asio/detail/pop_options.hpp> + +#if !defined(BOOST_WINDOWS) +# include <unistd.h> +#endif // !defined(BOOST_WINDOWS) + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { +namespace detail { + +struct handler_tracking::tracking_state +{ + static_mutex mutex_; + boost::uint64_t next_id_; + tss_ptr<completion>* current_completion_; +}; + +handler_tracking::tracking_state* handler_tracking::get_state() +{ + static tracking_state state = { BOOST_ASIO_STATIC_MUTEX_INIT, 1, 0 }; + return &state; +} + +void handler_tracking::init() +{ + static tracking_state* state = get_state(); + + state->mutex_.init(); + + static_mutex::scoped_lock lock(state->mutex_); + if (state->current_completion_ == 0) + state->current_completion_ = new tss_ptr<completion>; +} + +void handler_tracking::creation(handler_tracking::tracked_handler* h, + const char* object_type, void* object, const char* op_name) +{ + static tracking_state* state = get_state(); + + static_mutex::scoped_lock lock(state->mutex_); + h->id_ = state->next_id_++; + lock.unlock(); + + boost::posix_time::ptime epoch(boost::gregorian::date(1970, 1, 1)); + boost::posix_time::time_duration now = + boost::posix_time::microsec_clock::universal_time() - epoch; + + boost::uint64_t current_id = 0; + if (completion* current_completion = *state->current_completion_) + current_id = current_completion->id_; + + write_line( +#if defined(BOOST_WINDOWS) + "@asio|%I64u.%06I64u|%I64u*%I64u|%.20s@%p.%.50s\n", +#else // defined(BOOST_WINDOWS) + "@asio|%llu.%06llu|%llu*%llu|%.20s@%p.%.50s\n", +#endif // defined(BOOST_WINDOWS) + static_cast<boost::uint64_t>(now.total_seconds()), + static_cast<boost::uint64_t>(now.total_microseconds() % 1000000), + current_id, h->id_, object_type, object, op_name); +} + +handler_tracking::completion::completion(handler_tracking::tracked_handler* h) + : id_(h->id_), + invoked_(false), + next_(*get_state()->current_completion_) +{ + *get_state()->current_completion_ = this; +} + +handler_tracking::completion::~completion() +{ + if (id_) + { + boost::posix_time::ptime epoch(boost::gregorian::date(1970, 1, 1)); + boost::posix_time::time_duration now = + boost::posix_time::microsec_clock::universal_time() - epoch; + + write_line( +#if defined(BOOST_WINDOWS) + "@asio|%I64u.%06I64u|%c%I64u|\n", +#else // defined(BOOST_WINDOWS) + "@asio|%llu.%06llu|%c%llu|\n", +#endif // defined(BOOST_WINDOWS) + static_cast<boost::uint64_t>(now.total_seconds()), + static_cast<boost::uint64_t>(now.total_microseconds() % 1000000), + invoked_ ? '!' : '~', id_); + } + + *get_state()->current_completion_ = next_; +} + +void handler_tracking::completion::invocation_begin() +{ + boost::posix_time::ptime epoch(boost::gregorian::date(1970, 1, 1)); + boost::posix_time::time_duration now = + boost::posix_time::microsec_clock::universal_time() - epoch; + + write_line( +#if defined(BOOST_WINDOWS) + "@asio|%I64u.%06I64u|>%I64u|\n", +#else // defined(BOOST_WINDOWS) + "@asio|%llu.%06llu|>%llu|\n", +#endif // defined(BOOST_WINDOWS) + static_cast<boost::uint64_t>(now.total_seconds()), + static_cast<boost::uint64_t>(now.total_microseconds() % 1000000), id_); + + invoked_ = true; +} + +void handler_tracking::completion::invocation_begin( + const boost::system::error_code& ec) +{ + boost::posix_time::ptime epoch(boost::gregorian::date(1970, 1, 1)); + boost::posix_time::time_duration now = + boost::posix_time::microsec_clock::universal_time() - epoch; + + write_line( +#if defined(BOOST_WINDOWS) + "@asio|%I64u.%06I64u|>%I64u|ec=%.20s:%d\n", +#else // defined(BOOST_WINDOWS) + "@asio|%llu.%06llu|>%llu|ec=%.20s:%d\n", +#endif // defined(BOOST_WINDOWS) + static_cast<boost::uint64_t>(now.total_seconds()), + static_cast<boost::uint64_t>(now.total_microseconds() % 1000000), + id_, ec.category().name(), ec.value()); + + invoked_ = true; +} + +void handler_tracking::completion::invocation_begin( + const boost::system::error_code& ec, std::size_t bytes_transferred) +{ + boost::posix_time::ptime epoch(boost::gregorian::date(1970, 1, 1)); + boost::posix_time::time_duration now = + boost::posix_time::microsec_clock::universal_time() - epoch; + + write_line( +#if defined(BOOST_WINDOWS) + "@asio|%I64u.%06I64u|>%I64u|ec=%.20s:%d,bytes_transferred=%I64u\n", +#else // defined(BOOST_WINDOWS) + "@asio|%llu.%06llu|>%llu|ec=%.20s:%d,bytes_transferred=%llu\n", +#endif // defined(BOOST_WINDOWS) + static_cast<boost::uint64_t>(now.total_seconds()), + static_cast<boost::uint64_t>(now.total_microseconds() % 1000000), + id_, ec.category().name(), ec.value(), + static_cast<boost::uint64_t>(bytes_transferred)); + + invoked_ = true; +} + +void handler_tracking::completion::invocation_begin( + const boost::system::error_code& ec, int signal_number) +{ + boost::posix_time::ptime epoch(boost::gregorian::date(1970, 1, 1)); + boost::posix_time::time_duration now = + boost::posix_time::microsec_clock::universal_time() - epoch; + + write_line( +#if defined(BOOST_WINDOWS) + "@asio|%I64u.%06I64u|>%I64u|ec=%.20s:%d,signal_number=%d\n", +#else // defined(BOOST_WINDOWS) + "@asio|%llu.%06llu|>%llu|ec=%.20s:%d,signal_number=%d\n", +#endif // defined(BOOST_WINDOWS) + static_cast<boost::uint64_t>(now.total_seconds()), + static_cast<boost::uint64_t>(now.total_microseconds() % 1000000), + id_, ec.category().name(), ec.value(), signal_number); + + invoked_ = true; +} + +void handler_tracking::completion::invocation_begin( + const boost::system::error_code& ec, const char* arg) +{ + boost::posix_time::ptime epoch(boost::gregorian::date(1970, 1, 1)); + boost::posix_time::time_duration now = + boost::posix_time::microsec_clock::universal_time() - epoch; + + write_line( +#if defined(BOOST_WINDOWS) + "@asio|%I64u.%06I64u|>%I64u|ec=%.20s:%d,%.50s\n", +#else // defined(BOOST_WINDOWS) + "@asio|%llu.%06llu|>%llu|ec=%.20s:%d,%.50s\n", +#endif // defined(BOOST_WINDOWS) + static_cast<boost::uint64_t>(now.total_seconds()), + static_cast<boost::uint64_t>(now.total_microseconds() % 1000000), + id_, ec.category().name(), ec.value(), arg); + + invoked_ = true; +} + +void handler_tracking::completion::invocation_end() +{ + if (id_) + { + boost::posix_time::ptime epoch(boost::gregorian::date(1970, 1, 1)); + boost::posix_time::time_duration now = + boost::posix_time::microsec_clock::universal_time() - epoch; + + write_line( +#if defined(BOOST_WINDOWS) + "@asio|%I64u.%06I64u|<%I64u|\n", +#else // defined(BOOST_WINDOWS) + "@asio|%llu.%06llu|<%llu|\n", +#endif // defined(BOOST_WINDOWS) + static_cast<boost::uint64_t>(now.total_seconds()), + static_cast<boost::uint64_t>(now.total_microseconds() % 1000000), id_); + + id_ = 0; + } +} + +void handler_tracking::operation(const char* object_type, + void* object, const char* op_name) +{ + static tracking_state* state = get_state(); + + boost::posix_time::ptime epoch(boost::gregorian::date(1970, 1, 1)); + boost::posix_time::time_duration now = + boost::posix_time::microsec_clock::universal_time() - epoch; + + unsigned long long current_id = 0; + if (completion* current_completion = *state->current_completion_) + current_id = current_completion->id_; + + write_line( +#if defined(BOOST_WINDOWS) + "@asio|%I64u.%06I64u|%I64u|%.20s@%p.%.50s\n", +#else // defined(BOOST_WINDOWS) + "@asio|%llu.%06llu|%llu|%.20s@%p.%.50s\n", +#endif // defined(BOOST_WINDOWS) + static_cast<boost::uint64_t>(now.total_seconds()), + static_cast<boost::uint64_t>(now.total_microseconds() % 1000000), + current_id, object_type, object, op_name); +} + +void handler_tracking::write_line(const char* format, ...) +{ + using namespace std; // For sprintf (or equivalent). + + va_list args; + va_start(args, format); + + char line[256] = ""; +#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(UNDER_CE) + int length = vsprintf_s(line, sizeof(line), format, args); +#else // BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(UNDER_CE) + int length = vsprintf(line, format, args); +#endif // BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(UNDER_CE) + + va_end(args); + +#if defined(BOOST_WINDOWS) + HANDLE stderr_handle = ::GetStdHandle(STD_ERROR_HANDLE); + DWORD bytes_written = 0; + ::WriteFile(stderr_handle, line, length, &bytes_written, 0); +#else // defined(BOOST_WINDOWS) + ::write(STDERR_FILENO, line, length); +#endif // defined(BOOST_WINDOWS) +} + +} // namespace detail +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#endif // defined(BOOST_ASIO_ENABLE_HANDLER_TRACKING) + +#endif // BOOST_ASIO_DETAIL_IMPL_HANDLER_TRACKING_IPP diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/kqueue_reactor.hpp b/3rdParty/Boost/src/boost/asio/detail/impl/kqueue_reactor.hpp index 779f272..d3445cd 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/kqueue_reactor.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/kqueue_reactor.hpp @@ -2,7 +2,7 @@ // detail/impl/kqueue_reactor.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) // Copyright (c) 2005 Stefan Arentz (stefan at soze dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -42,7 +42,7 @@ void kqueue_reactor::remove_timer_queue(timer_queue<Time_Traits>& queue) template <typename Time_Traits> void kqueue_reactor::schedule_timer(timer_queue<Time_Traits>& queue, const typename Time_Traits::time_type& time, - typename timer_queue<Time_Traits>::per_timer_data& timer, timer_op* op) + typename timer_queue<Time_Traits>::per_timer_data& timer, wait_op* op) { boost::asio::detail::mutex::scoped_lock lock(mutex_); @@ -60,11 +60,12 @@ void kqueue_reactor::schedule_timer(timer_queue<Time_Traits>& queue, template <typename Time_Traits> std::size_t kqueue_reactor::cancel_timer(timer_queue<Time_Traits>& queue, - typename timer_queue<Time_Traits>::per_timer_data& timer) + typename timer_queue<Time_Traits>::per_timer_data& timer, + std::size_t max_cancelled) { boost::asio::detail::mutex::scoped_lock lock(mutex_); op_queue<operation> ops; - std::size_t n = queue.cancel_timer(timer, ops); + std::size_t n = queue.cancel_timer(timer, ops, max_cancelled); lock.unlock(); io_service_.post_deferred_completions(ops); return n; diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/kqueue_reactor.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/kqueue_reactor.ipp index 3ac9eae..a819eb9 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/kqueue_reactor.ipp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/kqueue_reactor.ipp @@ -2,7 +2,7 @@ // detail/impl/kqueue_reactor.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) // Copyright (c) 2005 Stefan Arentz (stefan at soze dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -28,8 +28,8 @@ #if defined(__NetBSD__) # define BOOST_ASIO_KQUEUE_EV_SET(ev, ident, filt, flags, fflags, data, udata) \ - EV_SET(ev, ident, filt, flags, fflags, \ - data, reinterpret_cast<intptr_t>(udata)) + EV_SET(ev, ident, filt, flags, fflags, data, \ + reinterpret_cast<intptr_t>(static_cast<void*>(udata))) #else # define BOOST_ASIO_KQUEUE_EV_SET(ev, ident, filt, flags, fflags, data, udata) \ EV_SET(ev, ident, filt, flags, fflags, data, udata) @@ -75,6 +75,47 @@ void kqueue_reactor::shutdown_service() } timer_queues_.get_all_timers(ops); + + io_service_.abandon_operations(ops); +} + +void kqueue_reactor::fork_service(boost::asio::io_service::fork_event fork_ev) +{ + if (fork_ev == boost::asio::io_service::fork_child) + { + // The kqueue descriptor is automatically closed in the child. + kqueue_fd_ = -1; + kqueue_fd_ = do_kqueue_create(); + + interrupter_.recreate(); + + // Re-register all descriptors with kqueue. + mutex::scoped_lock descriptors_lock(registered_descriptors_mutex_); + for (descriptor_state* state = registered_descriptors_.first(); + state != 0; state = state->next_) + { + struct kevent events[2]; + int num_events = 0; + + if (!state->op_queue_[read_op].empty()) + BOOST_ASIO_KQUEUE_EV_SET(&events[num_events++], state->descriptor_, + EVFILT_READ, EV_ADD | EV_CLEAR, 0, 0, state); + else if (!state->op_queue_[except_op].empty()) + BOOST_ASIO_KQUEUE_EV_SET(&events[num_events++], state->descriptor_, + EVFILT_READ, EV_ADD | EV_CLEAR, EV_OOBAND, 0, state); + + if (!state->op_queue_[write_op].empty()) + BOOST_ASIO_KQUEUE_EV_SET(&events[num_events++], state->descriptor_, + EVFILT_WRITE, EV_ADD | EV_CLEAR, 0, 0, state); + + if (num_events && ::kevent(kqueue_fd_, events, num_events, 0, 0, 0) == -1) + { + boost::system::error_code error(errno, + boost::asio::error::get_system_category()); + boost::asio::detail::throw_error(error); + } + } + } } void kqueue_reactor::init_task() @@ -82,17 +123,60 @@ void kqueue_reactor::init_task() io_service_.init_task(); } -int kqueue_reactor::register_descriptor(socket_type, +int kqueue_reactor::register_descriptor(socket_type descriptor, kqueue_reactor::per_descriptor_data& descriptor_data) { - mutex::scoped_lock lock(registered_descriptors_mutex_); + descriptor_data = allocate_descriptor_state(); + + mutex::scoped_lock lock(descriptor_data->mutex_); + + descriptor_data->descriptor_ = descriptor; + descriptor_data->shutdown_ = false; + + return 0; +} + +int kqueue_reactor::register_internal_descriptor( + int op_type, socket_type descriptor, + kqueue_reactor::per_descriptor_data& descriptor_data, reactor_op* op) +{ + descriptor_data = allocate_descriptor_state(); - descriptor_data = registered_descriptors_.alloc(); + mutex::scoped_lock lock(descriptor_data->mutex_); + + descriptor_data->descriptor_ = descriptor; descriptor_data->shutdown_ = false; + descriptor_data->op_queue_[op_type].push(op); + + struct kevent event; + switch (op_type) + { + case read_op: + BOOST_ASIO_KQUEUE_EV_SET(&event, descriptor, EVFILT_READ, + EV_ADD | EV_CLEAR, 0, 0, descriptor_data); + break; + case write_op: + BOOST_ASIO_KQUEUE_EV_SET(&event, descriptor, EVFILT_WRITE, + EV_ADD | EV_CLEAR, 0, 0, descriptor_data); + break; + case except_op: + BOOST_ASIO_KQUEUE_EV_SET(&event, descriptor, EVFILT_READ, + EV_ADD | EV_CLEAR, EV_OOBAND, 0, descriptor_data); + break; + } + ::kevent(kqueue_fd_, &event, 1, 0, 0, 0); return 0; } +void kqueue_reactor::move_descriptor(socket_type, + kqueue_reactor::per_descriptor_data& target_descriptor_data, + kqueue_reactor::per_descriptor_data& source_descriptor_data) +{ + target_descriptor_data = source_descriptor_data; + source_descriptor_data = 0; +} + void kqueue_reactor::start_op(int op_type, socket_type descriptor, kqueue_reactor::per_descriptor_data& descriptor_data, reactor_op* op, bool allow_speculative) @@ -187,19 +271,30 @@ void kqueue_reactor::cancel_ops(socket_type, io_service_.post_deferred_completions(ops); } -void kqueue_reactor::close_descriptor(socket_type, - kqueue_reactor::per_descriptor_data& descriptor_data) +void kqueue_reactor::deregister_descriptor(socket_type descriptor, + kqueue_reactor::per_descriptor_data& descriptor_data, bool closing) { if (!descriptor_data) return; mutex::scoped_lock descriptor_lock(descriptor_data->mutex_); - mutex::scoped_lock descriptors_lock(registered_descriptors_mutex_); if (!descriptor_data->shutdown_) { - // Remove the descriptor from the set of known descriptors. The descriptor - // will be automatically removed from the kqueue set when it is closed. + if (closing) + { + // The descriptor will be automatically removed from the kqueue when it + // is closed. + } + else + { + struct kevent events[2]; + BOOST_ASIO_KQUEUE_EV_SET(&events[0], descriptor, + EVFILT_READ, EV_DELETE, 0, 0, 0); + BOOST_ASIO_KQUEUE_EV_SET(&events[1], descriptor, + EVFILT_WRITE, EV_DELETE, 0, 0, 0); + ::kevent(kqueue_fd_, events, 2, 0, 0, 0); + } op_queue<operation> ops; for (int i = 0; i < max_ops; ++i) @@ -212,19 +307,49 @@ void kqueue_reactor::close_descriptor(socket_type, } } + descriptor_data->descriptor_ = -1; descriptor_data->shutdown_ = true; descriptor_lock.unlock(); - registered_descriptors_.free(descriptor_data); + free_descriptor_state(descriptor_data); descriptor_data = 0; - descriptors_lock.unlock(); - io_service_.post_deferred_completions(ops); } } +void kqueue_reactor::deregister_internal_descriptor(socket_type descriptor, + kqueue_reactor::per_descriptor_data& descriptor_data) +{ + if (!descriptor_data) + return; + + mutex::scoped_lock descriptor_lock(descriptor_data->mutex_); + + if (!descriptor_data->shutdown_) + { + struct kevent events[2]; + BOOST_ASIO_KQUEUE_EV_SET(&events[0], descriptor, + EVFILT_READ, EV_DELETE, 0, 0, 0); + BOOST_ASIO_KQUEUE_EV_SET(&events[1], descriptor, + EVFILT_WRITE, EV_DELETE, 0, 0, 0); + ::kevent(kqueue_fd_, events, 2, 0, 0, 0); + + op_queue<operation> ops; + for (int i = 0; i < max_ops; ++i) + ops.push(descriptor_data->op_queue_[i]); + + descriptor_data->descriptor_ = -1; + descriptor_data->shutdown_ = true; + + descriptor_lock.unlock(); + + free_descriptor_state(descriptor_data); + descriptor_data = 0; + } +} + void kqueue_reactor::run(bool block, op_queue<operation>& ops) { mutex::scoped_lock lock(mutex_); @@ -354,6 +479,18 @@ int kqueue_reactor::do_kqueue_create() return fd; } +kqueue_reactor::descriptor_state* kqueue_reactor::allocate_descriptor_state() +{ + mutex::scoped_lock descriptors_lock(registered_descriptors_mutex_); + return registered_descriptors_.alloc(); +} + +void kqueue_reactor::free_descriptor_state(kqueue_reactor::descriptor_state* s) +{ + mutex::scoped_lock descriptors_lock(registered_descriptors_mutex_); + registered_descriptors_.free(s); +} + void kqueue_reactor::do_add_timer_queue(timer_queue_base& queue) { mutex::scoped_lock lock(mutex_); diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/pipe_select_interrupter.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/pipe_select_interrupter.ipp index 9a0a872..75a8d16 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/pipe_select_interrupter.ipp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/pipe_select_interrupter.ipp @@ -2,7 +2,7 @@ // detail/impl/pipe_select_interrupter.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -38,6 +38,11 @@ namespace detail { pipe_select_interrupter::pipe_select_interrupter() { + open_descriptors(); +} + +void pipe_select_interrupter::open_descriptors() +{ int pipe_fds[2]; if (pipe(pipe_fds) == 0) { @@ -45,6 +50,11 @@ pipe_select_interrupter::pipe_select_interrupter() ::fcntl(read_descriptor_, F_SETFL, O_NONBLOCK); write_descriptor_ = pipe_fds[1]; ::fcntl(write_descriptor_, F_SETFL, O_NONBLOCK); + +#if defined(FD_CLOEXEC) + ::fcntl(read_descriptor_, F_SETFD, FD_CLOEXEC); + ::fcntl(write_descriptor_, F_SETFD, FD_CLOEXEC); +#endif // defined(FD_CLOEXEC) } else { @@ -56,12 +66,27 @@ pipe_select_interrupter::pipe_select_interrupter() pipe_select_interrupter::~pipe_select_interrupter() { + close_descriptors(); +} + +void pipe_select_interrupter::close_descriptors() +{ if (read_descriptor_ != -1) ::close(read_descriptor_); if (write_descriptor_ != -1) ::close(write_descriptor_); } +void pipe_select_interrupter::recreate() +{ + close_descriptors(); + + write_descriptor_ = -1; + read_descriptor_ = -1; + + open_descriptors(); +} + void pipe_select_interrupter::interrupt() { char byte = 0; diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/posix_event.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/posix_event.ipp index 893e8cc..08eae05 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/posix_event.ipp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/posix_event.ipp @@ -2,7 +2,7 @@ // detail/impl/posix_event.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/posix_mutex.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/posix_mutex.ipp index 908bfab..94b9bf4 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/posix_mutex.ipp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/posix_mutex.ipp @@ -2,7 +2,7 @@ // detail/impl/posix_mutex.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/posix_thread.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/posix_thread.ipp index feb6dd1..0c52971 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/posix_thread.ipp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/posix_thread.ipp @@ -2,7 +2,7 @@ // detail/impl/posix_thread.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/posix_tss_ptr.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/posix_tss_ptr.ipp index 89c1bf5..5124c5f 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/posix_tss_ptr.ipp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/posix_tss_ptr.ipp @@ -2,7 +2,7 @@ // detail/impl/posix_tss_ptr.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/reactive_descriptor_service.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/reactive_descriptor_service.ipp index a1ee09a..dff0a82 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/reactive_descriptor_service.ipp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/reactive_descriptor_service.ipp @@ -2,7 +2,7 @@ // detail/impl/reactive_descriptor_service.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -46,11 +46,47 @@ void reactive_descriptor_service::construct( impl.state_ = 0; } +void reactive_descriptor_service::move_construct( + reactive_descriptor_service::implementation_type& impl, + reactive_descriptor_service::implementation_type& other_impl) +{ + impl.descriptor_ = other_impl.descriptor_; + other_impl.descriptor_ = -1; + + impl.state_ = other_impl.state_; + other_impl.state_ = 0; + + reactor_.move_descriptor(impl.descriptor_, + impl.reactor_data_, other_impl.reactor_data_); +} + +void reactive_descriptor_service::move_assign( + reactive_descriptor_service::implementation_type& impl, + reactive_descriptor_service& other_service, + reactive_descriptor_service::implementation_type& other_impl) +{ + destroy(impl); + + impl.descriptor_ = other_impl.descriptor_; + other_impl.descriptor_ = -1; + + impl.state_ = other_impl.state_; + other_impl.state_ = 0; + + other_service.reactor_.move_descriptor(impl.descriptor_, + impl.reactor_data_, other_impl.reactor_data_); +} + void reactive_descriptor_service::destroy( reactive_descriptor_service::implementation_type& impl) { if (is_open(impl)) - reactor_.close_descriptor(impl.descriptor_, impl.reactor_data_); + { + BOOST_ASIO_HANDLER_OPERATION(("descriptor", &impl, "close")); + + reactor_.deregister_descriptor(impl.descriptor_, impl.reactor_data_, + (impl.state_ & descriptor_ops::possible_dup) == 0); + } boost::system::error_code ignored_ec; descriptor_ops::close(impl.descriptor_, impl.state_, ignored_ec); @@ -58,7 +94,7 @@ void reactive_descriptor_service::destroy( boost::system::error_code reactive_descriptor_service::assign( reactive_descriptor_service::implementation_type& impl, - const native_type& native_descriptor, boost::system::error_code& ec) + const native_handle_type& native_descriptor, boost::system::error_code& ec) { if (is_open(impl)) { @@ -75,7 +111,7 @@ boost::system::error_code reactive_descriptor_service::assign( } impl.descriptor_ = native_descriptor; - impl.state_ = 0; + impl.state_ = descriptor_ops::possible_dup; ec = boost::system::error_code(); return ec; } @@ -85,14 +121,43 @@ boost::system::error_code reactive_descriptor_service::close( boost::system::error_code& ec) { if (is_open(impl)) - reactor_.close_descriptor(impl.descriptor_, impl.reactor_data_); + { + BOOST_ASIO_HANDLER_OPERATION(("descriptor", &impl, "close")); - if (descriptor_ops::close(impl.descriptor_, impl.state_, ec) == 0) - construct(impl); + reactor_.deregister_descriptor(impl.descriptor_, impl.reactor_data_, + (impl.state_ & descriptor_ops::possible_dup) == 0); + } + + descriptor_ops::close(impl.descriptor_, impl.state_, ec); + + // The descriptor is closed by the OS even if close() returns an error. + // + // (Actually, POSIX says the state of the descriptor is unspecified. On + // Linux the descriptor is apparently closed anyway; e.g. see + // http://lkml.org/lkml/2005/9/10/129 + // We'll just have to assume that other OSes follow the same behaviour.) + construct(impl); return ec; } +reactive_descriptor_service::native_handle_type +reactive_descriptor_service::release( + reactive_descriptor_service::implementation_type& impl) +{ + native_handle_type descriptor = impl.descriptor_; + + if (is_open(impl)) + { + BOOST_ASIO_HANDLER_OPERATION(("descriptor", &impl, "release")); + + reactor_.deregister_descriptor(impl.descriptor_, impl.reactor_data_, false); + construct(impl); + } + + return descriptor; +} + boost::system::error_code reactive_descriptor_service::cancel( reactive_descriptor_service::implementation_type& impl, boost::system::error_code& ec) @@ -103,6 +168,8 @@ boost::system::error_code reactive_descriptor_service::cancel( return ec; } + BOOST_ASIO_HANDLER_OPERATION(("descriptor", &impl, "cancel")); + reactor_.cancel_ops(impl.descriptor_, impl.reactor_data_); ec = boost::system::error_code(); return ec; @@ -110,16 +177,16 @@ boost::system::error_code reactive_descriptor_service::cancel( void reactive_descriptor_service::start_op( reactive_descriptor_service::implementation_type& impl, - int op_type, reactor_op* op, bool non_blocking, bool noop) + int op_type, reactor_op* op, bool is_non_blocking, bool noop) { if (!noop) { if ((impl.state_ & descriptor_ops::non_blocking) || descriptor_ops::set_internal_non_blocking( - impl.descriptor_, impl.state_, op->ec_)) + impl.descriptor_, impl.state_, true, op->ec_)) { reactor_.start_op(op_type, impl.descriptor_, - impl.reactor_data_, op, non_blocking); + impl.reactor_data_, op, is_non_blocking); return; } } diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/reactive_serial_port_service.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/reactive_serial_port_service.ipp index ece61d3..0f530d7 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/reactive_serial_port_service.ipp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/reactive_serial_port_service.ipp @@ -2,7 +2,7 @@ // detail/impl/reactive_serial_port_service.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) // Copyright (c) 2008 Rep Invariant Systems, Inc. (info@repinvariant.com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -113,7 +113,7 @@ boost::system::error_code reactive_serial_port_service::do_set_option( termios ios; errno = 0; descriptor_ops::error_wrapper(::tcgetattr( - descriptor_service_.native(impl), &ios), ec); + descriptor_service_.native_handle(impl), &ios), ec); if (ec) return ec; @@ -122,7 +122,7 @@ boost::system::error_code reactive_serial_port_service::do_set_option( errno = 0; descriptor_ops::error_wrapper(::tcsetattr( - descriptor_service_.native(impl), TCSANOW, &ios), ec); + descriptor_service_.native_handle(impl), TCSANOW, &ios), ec); return ec; } @@ -134,7 +134,7 @@ boost::system::error_code reactive_serial_port_service::do_get_option( termios ios; errno = 0; descriptor_ops::error_wrapper(::tcgetattr( - descriptor_service_.native(impl), &ios), ec); + descriptor_service_.native_handle(impl), &ios), ec); if (ec) return ec; diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/reactive_socket_service_base.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/reactive_socket_service_base.ipp index 31f5bc4..93277e0 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/reactive_socket_service_base.ipp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/reactive_socket_service_base.ipp @@ -2,7 +2,7 @@ // detail/reactive_socket_service_base.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -45,12 +45,46 @@ void reactive_socket_service_base::construct( impl.state_ = 0; } +void reactive_socket_service_base::base_move_construct( + reactive_socket_service_base::base_implementation_type& impl, + reactive_socket_service_base::base_implementation_type& other_impl) +{ + impl.socket_ = other_impl.socket_; + other_impl.socket_ = invalid_socket; + + impl.state_ = other_impl.state_; + other_impl.state_ = 0; + + reactor_.move_descriptor(impl.socket_, + impl.reactor_data_, other_impl.reactor_data_); +} + +void reactive_socket_service_base::base_move_assign( + reactive_socket_service_base::base_implementation_type& impl, + reactive_socket_service_base& other_service, + reactive_socket_service_base::base_implementation_type& other_impl) +{ + destroy(impl); + + impl.socket_ = other_impl.socket_; + other_impl.socket_ = invalid_socket; + + impl.state_ = other_impl.state_; + other_impl.state_ = 0; + + other_service.reactor_.move_descriptor(impl.socket_, + impl.reactor_data_, other_impl.reactor_data_); +} + void reactive_socket_service_base::destroy( reactive_socket_service_base::base_implementation_type& impl) { if (impl.socket_ != invalid_socket) { - reactor_.close_descriptor(impl.socket_, impl.reactor_data_); + BOOST_ASIO_HANDLER_OPERATION(("socket", &impl, "close")); + + reactor_.deregister_descriptor(impl.socket_, impl.reactor_data_, + (impl.state_ & socket_ops::possible_dup) == 0); boost::system::error_code ignored_ec; socket_ops::close(impl.socket_, impl.state_, true, ignored_ec); @@ -62,10 +96,24 @@ boost::system::error_code reactive_socket_service_base::close( boost::system::error_code& ec) { if (is_open(impl)) - reactor_.close_descriptor(impl.socket_, impl.reactor_data_); + { + BOOST_ASIO_HANDLER_OPERATION(("socket", &impl, "close")); - if (socket_ops::close(impl.socket_, impl.state_, false, ec) == 0) - construct(impl); + reactor_.deregister_descriptor(impl.socket_, impl.reactor_data_, + (impl.state_ & socket_ops::possible_dup) == 0); + } + + socket_ops::close(impl.socket_, impl.state_, false, ec); + + // The descriptor is closed by the OS even if close() returns an error. + // + // (Actually, POSIX says the state of the descriptor is unspecified. On + // Linux the descriptor is apparently closed anyway; e.g. see + // http://lkml.org/lkml/2005/9/10/129 + // We'll just have to assume that other OSes follow the same behaviour. The + // known exception is when Windows's closesocket() function fails with + // WSAEWOULDBLOCK, but this case is handled inside socket_ops::close(). + construct(impl); return ec; } @@ -80,6 +128,8 @@ boost::system::error_code reactive_socket_service_base::cancel( return ec; } + BOOST_ASIO_HANDLER_OPERATION(("socket", &impl, "cancel")); + reactor_.cancel_ops(impl.socket_, impl.reactor_data_); ec = boost::system::error_code(); return ec; @@ -119,7 +169,7 @@ boost::system::error_code reactive_socket_service_base::do_open( boost::system::error_code reactive_socket_service_base::do_assign( reactive_socket_service_base::base_implementation_type& impl, int type, - const reactive_socket_service_base::native_type& native_socket, + const reactive_socket_service_base::native_handle_type& native_socket, boost::system::error_code& ec) { if (is_open(impl)) @@ -143,22 +193,23 @@ boost::system::error_code reactive_socket_service_base::do_assign( case SOCK_DGRAM: impl.state_ = socket_ops::datagram_oriented; break; default: impl.state_ = 0; break; } + impl.state_ |= socket_ops::possible_dup; ec = boost::system::error_code(); return ec; } void reactive_socket_service_base::start_op( reactive_socket_service_base::base_implementation_type& impl, - int op_type, reactor_op* op, bool non_blocking, bool noop) + int op_type, reactor_op* op, bool is_non_blocking, bool noop) { if (!noop) { if ((impl.state_ & socket_ops::non_blocking) || socket_ops::set_internal_non_blocking( - impl.socket_, impl.state_, op->ec_)) + impl.socket_, impl.state_, true, op->ec_)) { reactor_.start_op(op_type, impl.socket_, - impl.reactor_data_, op, non_blocking); + impl.reactor_data_, op, is_non_blocking); return; } } @@ -185,7 +236,7 @@ void reactive_socket_service_base::start_connect_op( { if ((impl.state_ & socket_ops::non_blocking) || socket_ops::set_internal_non_blocking( - impl.socket_, impl.state_, op->ec_)) + impl.socket_, impl.state_, true, op->ec_)) { if (socket_ops::connect(impl.socket_, addr, addrlen, op->ec_) != 0) { diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/resolver_service_base.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/resolver_service_base.ipp index e456bb9..6a384e4 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/resolver_service_base.ipp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/resolver_service_base.ipp @@ -2,7 +2,7 @@ // detail/impl/resolver_service_base.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -53,10 +53,10 @@ resolver_service_base::~resolver_service_base() void resolver_service_base::shutdown_service() { work_.reset(); - if (work_io_service_) + if (work_io_service_.get()) { work_io_service_->stop(); - if (work_thread_) + if (work_thread_.get()) { work_thread_->join(); work_thread_.reset(); @@ -65,6 +65,25 @@ void resolver_service_base::shutdown_service() } } +void resolver_service_base::fork_service( + boost::asio::io_service::fork_event fork_ev) +{ + if (work_thread_.get()) + { + if (fork_ev == boost::asio::io_service::fork_prepare) + { + work_io_service_->stop(); + work_thread_->join(); + } + else + { + work_io_service_->reset(); + work_thread_.reset(new boost::asio::detail::thread( + work_io_service_runner(*work_io_service_))); + } + } +} + void resolver_service_base::construct( resolver_service_base::implementation_type& impl) { @@ -72,13 +91,18 @@ void resolver_service_base::construct( } void resolver_service_base::destroy( - resolver_service_base::implementation_type&) + resolver_service_base::implementation_type& impl) { + BOOST_ASIO_HANDLER_OPERATION(("resolver", &impl, "cancel")); + + impl.reset(); } void resolver_service_base::cancel( resolver_service_base::implementation_type& impl) { + BOOST_ASIO_HANDLER_OPERATION(("resolver", &impl, "cancel")); + impl.reset(static_cast<void*>(0), socket_ops::noop_deleter()); } @@ -92,7 +116,7 @@ void resolver_service_base::start_resolve_op(operation* op) void resolver_service_base::start_work_thread() { boost::asio::detail::mutex::scoped_lock lock(mutex_); - if (!work_thread_) + if (!work_thread_.get()) { work_thread_.reset(new boost::asio::detail::thread( work_io_service_runner(*work_io_service_))); diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/select_reactor.hpp b/3rdParty/Boost/src/boost/asio/detail/impl/select_reactor.hpp index 3773bfb..0d4097e 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/select_reactor.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/select_reactor.hpp @@ -2,7 +2,7 @@ // detail/impl/select_reactor.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -44,7 +44,7 @@ void select_reactor::remove_timer_queue(timer_queue<Time_Traits>& queue) template <typename Time_Traits> void select_reactor::schedule_timer(timer_queue<Time_Traits>& queue, const typename Time_Traits::time_type& time, - typename timer_queue<Time_Traits>::per_timer_data& timer, timer_op* op) + typename timer_queue<Time_Traits>::per_timer_data& timer, wait_op* op) { boost::asio::detail::mutex::scoped_lock lock(mutex_); @@ -62,11 +62,12 @@ void select_reactor::schedule_timer(timer_queue<Time_Traits>& queue, template <typename Time_Traits> std::size_t select_reactor::cancel_timer(timer_queue<Time_Traits>& queue, - typename timer_queue<Time_Traits>::per_timer_data& timer) + typename timer_queue<Time_Traits>::per_timer_data& timer, + std::size_t max_cancelled) { boost::asio::detail::mutex::scoped_lock lock(mutex_); op_queue<operation> ops; - std::size_t n = queue.cancel_timer(timer, ops); + std::size_t n = queue.cancel_timer(timer, ops, max_cancelled); lock.unlock(); io_service_.post_deferred_completions(ops); return n; diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/select_reactor.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/select_reactor.ipp index 8fcf68e..d11904e 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/select_reactor.ipp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/select_reactor.ipp @@ -2,7 +2,7 @@ // detail/impl/select_reactor.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -82,6 +82,14 @@ void select_reactor::shutdown_service() op_queue_[i].get_all_operations(ops); timer_queues_.get_all_timers(ops); + + io_service_.abandon_operations(ops); +} + +void select_reactor::fork_service(boost::asio::io_service::fork_event fork_ev) +{ + if (fork_ev == boost::asio::io_service::fork_child) + interrupter_.recreate(); } void select_reactor::init_task() @@ -95,6 +103,24 @@ int select_reactor::register_descriptor(socket_type, return 0; } +int select_reactor::register_internal_descriptor( + int op_type, socket_type descriptor, + select_reactor::per_descriptor_data&, reactor_op* op) +{ + boost::asio::detail::mutex::scoped_lock lock(mutex_); + + op_queue_[op_type].enqueue_operation(descriptor, op); + interrupter_.interrupt(); + + return 0; +} + +void select_reactor::move_descriptor(socket_type, + select_reactor::per_descriptor_data&, + select_reactor::per_descriptor_data&) +{ +} + void select_reactor::start_op(int op_type, socket_type descriptor, select_reactor::per_descriptor_data&, reactor_op* op, bool) { @@ -119,13 +145,22 @@ void select_reactor::cancel_ops(socket_type descriptor, cancel_ops_unlocked(descriptor, boost::asio::error::operation_aborted); } -void select_reactor::close_descriptor(socket_type descriptor, - select_reactor::per_descriptor_data&) +void select_reactor::deregister_descriptor(socket_type descriptor, + select_reactor::per_descriptor_data&, bool) { boost::asio::detail::mutex::scoped_lock lock(mutex_); cancel_ops_unlocked(descriptor, boost::asio::error::operation_aborted); } +void select_reactor::deregister_internal_descriptor( + socket_type descriptor, select_reactor::per_descriptor_data&) +{ + boost::asio::detail::mutex::scoped_lock lock(mutex_); + op_queue<operation> ops; + for (int i = 0; i < max_ops; ++i) + op_queue_[i].cancel_operations(descriptor, ops); +} + void select_reactor::run(bool block, op_queue<operation>& ops) { boost::asio::detail::mutex::scoped_lock lock(mutex_); @@ -137,27 +172,28 @@ void select_reactor::run(bool block, op_queue<operation>& ops) #endif // defined(BOOST_ASIO_HAS_IOCP) // Set up the descriptor sets. - fd_set_adapter fds[max_select_ops]; - fds[read_op].set(interrupter_.read_descriptor()); + for (int i = 0; i < max_select_ops; ++i) + fd_sets_[i].reset(); + fd_sets_[read_op].set(interrupter_.read_descriptor()); socket_type max_fd = 0; bool have_work_to_do = !timer_queues_.all_empty(); for (int i = 0; i < max_select_ops; ++i) { have_work_to_do = have_work_to_do || !op_queue_[i].empty(); - op_queue_[i].get_descriptors(fds[i], ops); - if (fds[i].max_descriptor() > max_fd) - max_fd = fds[i].max_descriptor(); + op_queue_[i].get_descriptors(fd_sets_[i], ops); + if (fd_sets_[i].max_descriptor() > max_fd) + max_fd = fd_sets_[i].max_descriptor(); } #if defined(BOOST_WINDOWS) || defined(__CYGWIN__) // Connection operations on Windows use both except and write fd_sets. have_work_to_do = have_work_to_do || !op_queue_[connect_op].empty(); - op_queue_[connect_op].get_descriptors(fds[write_op], ops); - if (fds[write_op].max_descriptor() > max_fd) - max_fd = fds[write_op].max_descriptor(); - op_queue_[connect_op].get_descriptors(fds[except_op], ops); - if (fds[except_op].max_descriptor() > max_fd) - max_fd = fds[except_op].max_descriptor(); + op_queue_[connect_op].get_descriptors(fd_sets_[write_op], ops); + if (fd_sets_[write_op].max_descriptor() > max_fd) + max_fd = fd_sets_[write_op].max_descriptor(); + op_queue_[connect_op].get_descriptors(fd_sets_[except_op], ops); + if (fd_sets_[except_op].max_descriptor() > max_fd) + max_fd = fd_sets_[except_op].max_descriptor(); #endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__) // We can return immediately if there's no work to do and the reactor is @@ -174,11 +210,14 @@ void select_reactor::run(bool block, op_queue<operation>& ops) // Block on the select call until descriptors become ready. boost::system::error_code ec; int retval = socket_ops::select(static_cast<int>(max_fd + 1), - fds[read_op], fds[write_op], fds[except_op], tv, ec); + fd_sets_[read_op], fd_sets_[write_op], fd_sets_[except_op], tv, ec); // Reset the interrupter. - if (retval > 0 && fds[read_op].is_set(interrupter_.read_descriptor())) + if (retval > 0 && fd_sets_[read_op].is_set(interrupter_.read_descriptor())) + { interrupter_.reset(); + --retval; + } lock.lock(); @@ -188,15 +227,15 @@ void select_reactor::run(bool block, op_queue<operation>& ops) #if defined(BOOST_WINDOWS) || defined(__CYGWIN__) // Connection operations on Windows use both except and write fd_sets. op_queue_[connect_op].perform_operations_for_descriptors( - fds[except_op], ops); + fd_sets_[except_op], ops); op_queue_[connect_op].perform_operations_for_descriptors( - fds[write_op], ops); + fd_sets_[write_op], ops); #endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__) // Exception operations must be processed first to ensure that any // out-of-band data is read before normal data. for (int i = max_select_ops - 1; i >= 0; --i) - op_queue_[i].perform_operations_for_descriptors(fds[i], ops); + op_queue_[i].perform_operations_for_descriptors(fd_sets_[i], ops); } timer_queues_.get_ready_timers(ops); } diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/service_registry.hpp b/3rdParty/Boost/src/boost/asio/detail/impl/service_registry.hpp index 97f5771..eef25ac 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/service_registry.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/service_registry.hpp @@ -2,7 +2,7 @@ // detail/impl/service_registry.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -21,6 +21,24 @@ namespace boost { namespace asio { namespace detail { +template <typename Service, typename Arg> +service_registry::service_registry( + boost::asio::io_service& o, Service*, Arg arg) + : owner_(o), + first_service_(new Service(o, arg)) +{ + boost::asio::io_service::service::key key; + init_key(key, Service::id); + first_service_->key_ = key; + first_service_->next_ = 0; +} + +template <typename Service> +Service& service_registry::first_service() +{ + return *static_cast<Service*>(first_service_); +} + template <typename Service> Service& service_registry::use_service() { diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/service_registry.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/service_registry.ipp index c2f07ec..6715010 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/service_registry.ipp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/service_registry.ipp @@ -2,7 +2,7 @@ // detail/impl/service_registry.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -17,6 +17,7 @@ #include <boost/asio/detail/config.hpp> #include <boost/throw_exception.hpp> +#include <vector> #include <boost/asio/detail/service_registry.hpp> #include <boost/asio/detail/push_options.hpp> @@ -25,12 +26,6 @@ namespace boost { namespace asio { namespace detail { -service_registry::service_registry(boost::asio::io_service& o) - : owner_(o), - first_service_(0) -{ -} - service_registry::~service_registry() { // Shutdown all services. This must be done in a separate loop before the @@ -52,6 +47,35 @@ service_registry::~service_registry() } } +void service_registry::notify_fork(boost::asio::io_service::fork_event fork_ev) +{ + // Make a copy of all of the services while holding the lock. We don't want + // to hold the lock while calling into each service, as it may try to call + // back into this class. + std::vector<boost::asio::io_service::service*> services; + { + boost::asio::detail::mutex::scoped_lock lock(mutex_); + boost::asio::io_service::service* service = first_service_; + while (service) + { + services.push_back(service); + service = service->next_; + } + } + + // If processing the fork_prepare event, we want to go in reverse order of + // service registration, which happens to be the existing order of the + // services in the vector. For the other events we want to go in the other + // direction. + std::size_t num_services = services.size(); + if (fork_ev == boost::asio::io_service::fork_prepare) + for (std::size_t i = 0; i < num_services; ++i) + services[i]->fork_service(fork_ev); + else + for (std::size_t i = num_services; i > 0; --i) + services[i - 1]->fork_service(fork_ev); +} + void service_registry::init_key(boost::asio::io_service::service::key& key, const boost::asio::io_service::id& id) { @@ -121,7 +145,7 @@ void service_registry::do_add_service( const boost::asio::io_service::service::key& key, boost::asio::io_service::service* new_service) { - if (&owner_ != &new_service->io_service()) + if (&owner_ != &new_service->get_io_service()) boost::throw_exception(invalid_service_owner()); boost::asio::detail::mutex::scoped_lock lock(mutex_); diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/signal_set_service.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/signal_set_service.ipp new file mode 100644 index 0000000..0b57007 --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/detail/impl/signal_set_service.ipp @@ -0,0 +1,593 @@ +// +// detail/impl/signal_set_service.ipp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) +// + +#ifndef BOOST_ASIO_DETAIL_IMPL_SIGNAL_SET_SERVICE_IPP +#define BOOST_ASIO_DETAIL_IMPL_SIGNAL_SET_SERVICE_IPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> + +#include <cstring> +#include <boost/asio/detail/reactor.hpp> +#include <boost/asio/detail/signal_blocker.hpp> +#include <boost/asio/detail/signal_set_service.hpp> +#include <boost/asio/detail/static_mutex.hpp> + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { +namespace detail { + +struct signal_state +{ + // Mutex used for protecting global state. + static_mutex mutex_; + + // The read end of the pipe used for signal notifications. + int read_descriptor_; + + // The write end of the pipe used for signal notifications. + int write_descriptor_; + + // Whether the signal state has been prepared for a fork. + bool fork_prepared_; + + // The head of a linked list of all signal_set_service instances. + class signal_set_service* service_list_; + + // A count of the number of objects that are registered for each signal. + std::size_t registration_count_[max_signal_number]; +}; + +signal_state* get_signal_state() +{ + static signal_state state = { + BOOST_ASIO_STATIC_MUTEX_INIT, -1, -1, false, 0, { 0 } }; + return &state; +} + +void asio_signal_handler(int signal_number) +{ +#if defined(BOOST_WINDOWS) || defined(__CYGWIN__) + signal_set_service::deliver_signal(signal_number); +#else // defined(BOOST_WINDOWS) || defined(__CYGWIN__) + int saved_errno = errno; + signal_state* state = get_signal_state(); + int result = ::write(state->write_descriptor_, + &signal_number, sizeof(signal_number)); + (void)result; + errno = saved_errno; +#endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__) + +#if defined(BOOST_ASIO_HAS_SIGNAL) && !defined(BOOST_ASIO_HAS_SIGACTION) + ::signal(signal_number, asio_signal_handler); +#endif // defined(BOOST_ASIO_HAS_SIGNAL) && !defined(BOOST_ASIO_HAS_SIGACTION) +} + +#if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) +class signal_set_service::pipe_read_op : public reactor_op +{ +public: + pipe_read_op() + : reactor_op(&pipe_read_op::do_perform, pipe_read_op::do_complete) + { + } + + static bool do_perform(reactor_op*) + { + signal_state* state = get_signal_state(); + + int fd = state->read_descriptor_; + int signal_number = 0; + while (::read(fd, &signal_number, sizeof(int)) == sizeof(int)) + if (signal_number >= 0 && signal_number < max_signal_number) + signal_set_service::deliver_signal(signal_number); + + return false; + } + + static void do_complete(io_service_impl* /*owner*/, operation* base, + const boost::system::error_code& /*ec*/, + std::size_t /*bytes_transferred*/) + { + pipe_read_op* o(static_cast<pipe_read_op*>(base)); + delete o; + } +}; +#endif // !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) + +signal_set_service::signal_set_service( + boost::asio::io_service& io_service) + : io_service_(boost::asio::use_service<io_service_impl>(io_service)), +#if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) + reactor_(boost::asio::use_service<reactor>(io_service)), +#endif // !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) + next_(0), + prev_(0) +{ + get_signal_state()->mutex_.init(); + +#if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) + reactor_.init_task(); +#endif // !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) + + for (int i = 0; i < max_signal_number; ++i) + registrations_[i] = 0; + + add_service(this); +} + +signal_set_service::~signal_set_service() +{ + remove_service(this); +} + +void signal_set_service::shutdown_service() +{ + remove_service(this); + + op_queue<operation> ops; + + for (int i = 0; i < max_signal_number; ++i) + { + registration* reg = registrations_[i]; + while (reg) + { + ops.push(*reg->queue_); + reg = reg->next_in_table_; + } + } + + io_service_.abandon_operations(ops); +} + +void signal_set_service::fork_service( + boost::asio::io_service::fork_event fork_ev) +{ +#if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) + signal_state* state = get_signal_state(); + static_mutex::scoped_lock lock(state->mutex_); + + switch (fork_ev) + { + case boost::asio::io_service::fork_prepare: + reactor_.deregister_internal_descriptor( + state->read_descriptor_, reactor_data_); + state->fork_prepared_ = true; + break; + case boost::asio::io_service::fork_parent: + state->fork_prepared_ = false; + reactor_.register_internal_descriptor(reactor::read_op, + state->read_descriptor_, reactor_data_, new pipe_read_op); + break; + case boost::asio::io_service::fork_child: + if (state->fork_prepared_) + { + boost::asio::detail::signal_blocker blocker; + close_descriptors(); + open_descriptors(); + state->fork_prepared_ = false; + } + reactor_.register_internal_descriptor(reactor::read_op, + state->read_descriptor_, reactor_data_, new pipe_read_op); + break; + default: + break; + } +#else // !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) + (void)fork_ev; +#endif // !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) +} + +void signal_set_service::construct( + signal_set_service::implementation_type& impl) +{ + impl.signals_ = 0; +} + +void signal_set_service::destroy( + signal_set_service::implementation_type& impl) +{ + boost::system::error_code ignored_ec; + clear(impl, ignored_ec); + cancel(impl, ignored_ec); +} + +boost::system::error_code signal_set_service::add( + signal_set_service::implementation_type& impl, + int signal_number, boost::system::error_code& ec) +{ + // Check that the signal number is valid. + if (signal_number < 0 || signal_number > max_signal_number) + { + ec = boost::asio::error::invalid_argument; + return ec; + } + + signal_state* state = get_signal_state(); + static_mutex::scoped_lock lock(state->mutex_); + + // Find the appropriate place to insert the registration. + registration** insertion_point = &impl.signals_; + registration* next = impl.signals_; + while (next && next->signal_number_ < signal_number) + { + insertion_point = &next->next_in_set_; + next = next->next_in_set_; + } + + // Only do something if the signal is not already registered. + if (next == 0 || next->signal_number_ != signal_number) + { + registration* new_registration = new registration; + +#if defined(BOOST_ASIO_HAS_SIGNAL) || defined(BOOST_ASIO_HAS_SIGACTION) + // Register for the signal if we're the first. + if (state->registration_count_[signal_number] == 0) + { +# if defined(BOOST_ASIO_HAS_SIGACTION) + using namespace std; // For memset. + struct sigaction sa; + memset(&sa, 0, sizeof(sa)); + sa.sa_handler = asio_signal_handler; + sigfillset(&sa.sa_mask); + if (::sigaction(signal_number, &sa, 0) == -1) +# else // defined(BOOST_ASIO_HAS_SIGACTION) + if (::signal(signal_number, asio_signal_handler) == SIG_ERR) +# endif // defined(BOOST_ASIO_HAS_SIGACTION) + { +# if defined(BOOST_WINDOWS) || defined(__CYGWIN__) + ec = boost::asio::error::invalid_argument; +# else // defined(BOOST_WINDOWS) || defined(__CYGWIN__) + ec = boost::system::error_code(errno, + boost::asio::error::get_system_category()); +# endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__) + delete new_registration; + return ec; + } + } +#endif // defined(BOOST_ASIO_HAS_SIGNAL) || defined(BOOST_ASIO_HAS_SIGACTION) + + // Record the new registration in the set. + new_registration->signal_number_ = signal_number; + new_registration->queue_ = &impl.queue_; + new_registration->next_in_set_ = next; + *insertion_point = new_registration; + + // Insert registration into the registration table. + new_registration->next_in_table_ = registrations_[signal_number]; + if (registrations_[signal_number]) + registrations_[signal_number]->prev_in_table_ = new_registration; + registrations_[signal_number] = new_registration; + + ++state->registration_count_[signal_number]; + } + + ec = boost::system::error_code(); + return ec; +} + +boost::system::error_code signal_set_service::remove( + signal_set_service::implementation_type& impl, + int signal_number, boost::system::error_code& ec) +{ + // Check that the signal number is valid. + if (signal_number < 0 || signal_number > max_signal_number) + { + ec = boost::asio::error::invalid_argument; + return ec; + } + + signal_state* state = get_signal_state(); + static_mutex::scoped_lock lock(state->mutex_); + + // Find the signal number in the list of registrations. + registration** deletion_point = &impl.signals_; + registration* reg = impl.signals_; + while (reg && reg->signal_number_ < signal_number) + { + deletion_point = ®->next_in_set_; + reg = reg->next_in_set_; + } + + if (reg != 0 && reg->signal_number_ == signal_number) + { +#if defined(BOOST_ASIO_HAS_SIGNAL) || defined(BOOST_ASIO_HAS_SIGACTION) + // Set signal handler back to the default if we're the last. + if (state->registration_count_[signal_number] == 1) + { +# if defined(BOOST_ASIO_HAS_SIGACTION) + using namespace std; // For memset. + struct sigaction sa; + memset(&sa, 0, sizeof(sa)); + sa.sa_handler = SIG_DFL; + if (::sigaction(signal_number, &sa, 0) == -1) +# else // defined(BOOST_ASIO_HAS_SIGACTION) + if (::signal(signal_number, SIG_DFL) == SIG_ERR) +# endif // defined(BOOST_ASIO_HAS_SIGACTION) + { +# if defined(BOOST_WINDOWS) || defined(__CYGWIN__) + ec = boost::asio::error::invalid_argument; +# else // defined(BOOST_WINDOWS) || defined(__CYGWIN__) + ec = boost::system::error_code(errno, + boost::asio::error::get_system_category()); +# endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__) + return ec; + } + } +#endif // defined(BOOST_ASIO_HAS_SIGNAL) || defined(BOOST_ASIO_HAS_SIGACTION) + + // Remove the registration from the set. + *deletion_point = reg->next_in_set_; + + // Remove the registration from the registration table. + if (registrations_[signal_number] == reg) + registrations_[signal_number] = reg->next_in_table_; + if (reg->prev_in_table_) + reg->prev_in_table_->next_in_table_ = reg->next_in_table_; + if (reg->next_in_table_) + reg->next_in_table_->prev_in_table_ = reg->prev_in_table_; + + --state->registration_count_[signal_number]; + + delete reg; + } + + ec = boost::system::error_code(); + return ec; +} + +boost::system::error_code signal_set_service::clear( + signal_set_service::implementation_type& impl, + boost::system::error_code& ec) +{ + signal_state* state = get_signal_state(); + static_mutex::scoped_lock lock(state->mutex_); + + while (registration* reg = impl.signals_) + { +#if defined(BOOST_ASIO_HAS_SIGNAL) || defined(BOOST_ASIO_HAS_SIGACTION) + // Set signal handler back to the default if we're the last. + if (state->registration_count_[reg->signal_number_] == 1) + { +# if defined(BOOST_ASIO_HAS_SIGACTION) + using namespace std; // For memset. + struct sigaction sa; + memset(&sa, 0, sizeof(sa)); + sa.sa_handler = SIG_DFL; + if (::sigaction(reg->signal_number_, &sa, 0) == -1) +# else // defined(BOOST_ASIO_HAS_SIGACTION) + if (::signal(reg->signal_number_, SIG_DFL) == SIG_ERR) +# endif // defined(BOOST_ASIO_HAS_SIGACTION) + { +# if defined(BOOST_WINDOWS) || defined(__CYGWIN__) + ec = boost::asio::error::invalid_argument; +# else // defined(BOOST_WINDOWS) || defined(__CYGWIN__) + ec = boost::system::error_code(errno, + boost::asio::error::get_system_category()); +# endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__) + return ec; + } + } +#endif // defined(BOOST_ASIO_HAS_SIGNAL) || defined(BOOST_ASIO_HAS_SIGACTION) + + // Remove the registration from the registration table. + if (registrations_[reg->signal_number_] == reg) + registrations_[reg->signal_number_] = reg->next_in_table_; + if (reg->prev_in_table_) + reg->prev_in_table_->next_in_table_ = reg->next_in_table_; + if (reg->next_in_table_) + reg->next_in_table_->prev_in_table_ = reg->prev_in_table_; + + --state->registration_count_[reg->signal_number_]; + + impl.signals_ = reg->next_in_set_; + delete reg; + } + + ec = boost::system::error_code(); + return ec; +} + +boost::system::error_code signal_set_service::cancel( + signal_set_service::implementation_type& impl, + boost::system::error_code& ec) +{ + BOOST_ASIO_HANDLER_OPERATION(("signal_set", &impl, "cancel")); + + op_queue<operation> ops; + { + signal_state* state = get_signal_state(); + static_mutex::scoped_lock lock(state->mutex_); + + while (signal_op* op = impl.queue_.front()) + { + op->ec_ = boost::asio::error::operation_aborted; + impl.queue_.pop(); + ops.push(op); + } + } + + io_service_.post_deferred_completions(ops); + + ec = boost::system::error_code(); + return ec; +} + +void signal_set_service::deliver_signal(int signal_number) +{ + signal_state* state = get_signal_state(); + static_mutex::scoped_lock lock(state->mutex_); + + signal_set_service* service = state->service_list_; + while (service) + { + op_queue<operation> ops; + + registration* reg = service->registrations_[signal_number]; + while (reg) + { + if (reg->queue_->empty()) + { + ++reg->undelivered_; + } + else + { + while (signal_op* op = reg->queue_->front()) + { + op->signal_number_ = signal_number; + reg->queue_->pop(); + ops.push(op); + } + } + + reg = reg->next_in_table_; + } + + service->io_service_.post_deferred_completions(ops); + + service = service->next_; + } +} + +void signal_set_service::add_service(signal_set_service* service) +{ + signal_state* state = get_signal_state(); + static_mutex::scoped_lock lock(state->mutex_); + +#if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) + // If this is the first service to be created, open a new pipe. + if (state->service_list_ == 0) + open_descriptors(); +#endif // !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) + + // Insert service into linked list of all services. + service->next_ = state->service_list_; + service->prev_ = 0; + if (state->service_list_) + state->service_list_->prev_ = service; + state->service_list_ = service; + +#if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) + // Register for pipe readiness notifications. + service->reactor_.register_internal_descriptor(reactor::read_op, + state->read_descriptor_, service->reactor_data_, new pipe_read_op); +#endif // !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) +} + +void signal_set_service::remove_service(signal_set_service* service) +{ + signal_state* state = get_signal_state(); + static_mutex::scoped_lock lock(state->mutex_); + + if (service->next_ || service->prev_ || state->service_list_ == service) + { +#if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) + // Disable the pipe readiness notifications. + service->reactor_.deregister_descriptor( + state->read_descriptor_, service->reactor_data_, false); +#endif // !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) + + // Remove service from linked list of all services. + if (state->service_list_ == service) + state->service_list_ = service->next_; + if (service->prev_) + service->prev_->next_ = service->next_; + if (service->next_) + service->next_->prev_= service->prev_; + service->next_ = 0; + service->prev_ = 0; + +#if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) + // If this is the last service to be removed, close the pipe. + if (state->service_list_ == 0) + close_descriptors(); +#endif // !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) + } +} + +void signal_set_service::open_descriptors() +{ +#if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) + signal_state* state = get_signal_state(); + + int pipe_fds[2]; + if (::pipe(pipe_fds) == 0) + { + state->read_descriptor_ = pipe_fds[0]; + ::fcntl(state->read_descriptor_, F_SETFL, O_NONBLOCK); + + state->write_descriptor_ = pipe_fds[1]; + ::fcntl(state->write_descriptor_, F_SETFL, O_NONBLOCK); + +#if defined(FD_CLOEXEC) + ::fcntl(state->read_descriptor_, F_SETFD, FD_CLOEXEC); + ::fcntl(state->write_descriptor_, F_SETFD, FD_CLOEXEC); +#endif // defined(FD_CLOEXEC) + } + else + { + boost::system::error_code ec(errno, + boost::asio::error::get_system_category()); + boost::asio::detail::throw_error(ec, "signal_set_service pipe"); + } +#endif // !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) +} + +void signal_set_service::close_descriptors() +{ +#if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) + signal_state* state = get_signal_state(); + + if (state->read_descriptor_ != -1) + ::close(state->read_descriptor_); + state->read_descriptor_ = -1; + + if (state->write_descriptor_ != -1) + ::close(state->write_descriptor_); + state->write_descriptor_ = -1; +#endif // !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) +} + +void signal_set_service::start_wait_op( + signal_set_service::implementation_type& impl, signal_op* op) +{ + io_service_.work_started(); + + signal_state* state = get_signal_state(); + static_mutex::scoped_lock lock(state->mutex_); + + registration* reg = impl.signals_; + while (reg) + { + if (reg->undelivered_ > 0) + { + --reg->undelivered_; + io_service_.post_deferred_completion(op); + return; + } + + reg = reg->next_in_set_; + } + + impl.queue_.push(op); +} + +} // namespace detail +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#endif // BOOST_ASIO_DETAIL_IMPL_SIGNAL_SET_SERVICE_IPP diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/socket_ops.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/socket_ops.ipp index e240acd..16e9536 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/socket_ops.ipp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/socket_ops.ipp @@ -2,7 +2,7 @@ // detail/impl/socket_ops.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -18,6 +18,7 @@ #include <boost/asio/detail/config.hpp> #include <boost/assert.hpp> #include <boost/detail/workaround.hpp> +#include <cctype> #include <cstdio> #include <cstdlib> #include <cstring> @@ -148,7 +149,7 @@ socket_type sync_accept(socket_type s, state_type state, return invalid_socket; // Wait for socket to become ready. - if (socket_ops::poll_read(s, ec) < 0) + if (socket_ops::poll_read(s, 0, ec) < 0) return invalid_socket; } } @@ -278,28 +279,9 @@ int close(socket_type s, state_type& state, int result = 0; if (s != invalid_socket) { -#if defined(BOOST_WINDOWS) || defined(__CYGWIN__) - if ((state & non_blocking) && (state & user_set_linger)) - { - ioctl_arg_type arg = 0; - ::ioctlsocket(s, FIONBIO, &arg); - state &= ~non_blocking; - } -#else // defined(BOOST_WINDOWS) || defined(__CYGWIN__) - if (state & non_blocking) - { -#if defined(__SYMBIAN32__) - int flags = ::fcntl(s, F_GETFL, 0); - if (flags >= 0) - ::fcntl(s, F_SETFL, flags & ~O_NONBLOCK); -#else // defined(__SYMBIAN32__) - ioctl_arg_type arg = 0; - ::ioctl(s, FIONBIO, &arg); -#endif // defined(__SYMBIAN32__) - state &= ~non_blocking; - } -#endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__) - + // We don't want the destructor to block, so set the socket to linger in + // the background. If the user doesn't like this behaviour then they need + // to explicitly close the socket. if (destruction && (state & user_set_linger)) { ::linger opt; @@ -316,6 +298,39 @@ int close(socket_type s, state_type& state, #else // defined(BOOST_WINDOWS) || defined(__CYGWIN__) result = error_wrapper(::close(s), ec); #endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__) + + if (result != 0 + && (ec == boost::asio::error::would_block + || ec == boost::asio::error::try_again)) + { + // According to UNIX Network Programming Vol. 1, it is possible for + // close() to fail with EWOULDBLOCK under certain circumstances. What + // isn't clear is the state of the descriptor after this error. The one + // current OS where this behaviour is seen, Windows, says that the socket + // remains open. Therefore we'll put the descriptor back into blocking + // mode and have another attempt at closing it. +#if defined(BOOST_WINDOWS) || defined(__CYGWIN__) + ioctl_arg_type arg = 0; + ::ioctlsocket(s, FIONBIO, &arg); +#else // defined(BOOST_WINDOWS) || defined(__CYGWIN__) +# if defined(__SYMBIAN32__) + int flags = ::fcntl(s, F_GETFL, 0); + if (flags >= 0) + ::fcntl(s, F_SETFL, flags & ~O_NONBLOCK); +# else // defined(__SYMBIAN32__) + ioctl_arg_type arg = 0; + ::ioctl(s, FIONBIO, &arg); +# endif // defined(__SYMBIAN32__) +#endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__) + state &= ~non_blocking; + + clear_last_error(); +#if defined(BOOST_WINDOWS) || defined(__CYGWIN__) + result = error_wrapper(::closesocket(s), ec); +#else // defined(BOOST_WINDOWS) || defined(__CYGWIN__) + result = error_wrapper(::close(s), ec); +#endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__) + } } if (result == 0) @@ -323,8 +338,52 @@ int close(socket_type s, state_type& state, return result; } +bool set_user_non_blocking(socket_type s, + state_type& state, bool value, boost::system::error_code& ec) +{ + if (s == invalid_socket) + { + ec = boost::asio::error::bad_descriptor; + return false; + } + + clear_last_error(); +#if defined(BOOST_WINDOWS) || defined(__CYGWIN__) + ioctl_arg_type arg = (value ? 1 : 0); + int result = error_wrapper(::ioctlsocket(s, FIONBIO, &arg), ec); +#elif defined(__SYMBIAN32__) + int result = error_wrapper(::fcntl(s, F_GETFL, 0), ec); + if (result >= 0) + { + clear_last_error(); + int flag = (value ? (result | O_NONBLOCK) : (result & ~O_NONBLOCK)); + result = error_wrapper(::fcntl(s, F_SETFL, flag), ec); + } +#else + ioctl_arg_type arg = (value ? 1 : 0); + int result = error_wrapper(::ioctl(s, FIONBIO, &arg), ec); +#endif + + if (result >= 0) + { + ec = boost::system::error_code(); + if (value) + state |= user_set_non_blocking; + else + { + // Clearing the user-set non-blocking mode always overrides any + // internally-set non-blocking flag. Any subsequent asynchronous + // operations will need to re-enable non-blocking I/O. + state &= ~(user_set_non_blocking | internal_non_blocking); + } + return true; + } + + return false; +} + bool set_internal_non_blocking(socket_type s, - state_type& state, boost::system::error_code& ec) + state_type& state, bool value, boost::system::error_code& ec) { if (s == invalid_socket) { @@ -332,26 +391,39 @@ bool set_internal_non_blocking(socket_type s, return false; } + if (!value && (state & user_set_non_blocking)) + { + // It does not make sense to clear the internal non-blocking flag if the + // user still wants non-blocking behaviour. Return an error and let the + // caller figure out whether to update the user-set non-blocking flag. + ec = boost::asio::error::invalid_argument; + return false; + } + clear_last_error(); #if defined(BOOST_WINDOWS) || defined(__CYGWIN__) - ioctl_arg_type arg = 1; + ioctl_arg_type arg = (value ? 1 : 0); int result = error_wrapper(::ioctlsocket(s, FIONBIO, &arg), ec); #elif defined(__SYMBIAN32__) int result = error_wrapper(::fcntl(s, F_GETFL, 0), ec); if (result >= 0) { clear_last_error(); - result = error_wrapper(::fcntl(s, F_SETFL, result | O_NONBLOCK), ec); + int flag = (value ? (result | O_NONBLOCK) : (result & ~O_NONBLOCK)); + result = error_wrapper(::fcntl(s, F_SETFL, flag), ec); } #else - ioctl_arg_type arg = 1; + ioctl_arg_type arg = (value ? 1 : 0); int result = error_wrapper(::ioctl(s, FIONBIO, &arg), ec); #endif if (result >= 0) { ec = boost::system::error_code(); - state |= internal_non_blocking; + if (value) + state |= internal_non_blocking; + else + state &= ~internal_non_blocking; return true; } @@ -394,6 +466,10 @@ int connect(socket_type s, const socket_addr_type* addr, &msghdr::msg_namelen, s, addr, addrlen), ec); if (result == 0) ec = boost::system::error_code(); +#if defined(__linux__) + else if (ec == boost::asio::error::try_again) + ec = boost::asio::error::no_buffer_space; +#endif // defined(__linux__) return result; } @@ -664,7 +740,7 @@ size_t sync_recv(socket_type s, state_type state, buf* bufs, return 0; // Wait for socket to become ready. - if (socket_ops::poll_read(s, ec) < 0) + if (socket_ops::poll_read(s, 0, ec) < 0) return 0; } } @@ -802,7 +878,7 @@ size_t sync_recvfrom(socket_type s, state_type state, buf* bufs, return 0; // Wait for socket to become ready. - if (socket_ops::poll_read(s, ec) < 0) + if (socket_ops::poll_read(s, 0, ec) < 0) return 0; } } @@ -863,6 +939,116 @@ bool non_blocking_recvfrom(socket_type s, #endif // defined(BOOST_ASIO_HAS_IOCP) +int recvmsg(socket_type s, buf* bufs, size_t count, + int in_flags, int& out_flags, boost::system::error_code& ec) +{ + clear_last_error(); +#if defined(BOOST_WINDOWS) || defined(__CYGWIN__) + out_flags = 0; + return socket_ops::recv(s, bufs, count, in_flags, ec); +#else // defined(BOOST_WINDOWS) || defined(__CYGWIN__) + msghdr msg = msghdr(); + msg.msg_iov = bufs; + msg.msg_iovlen = count; + int result = error_wrapper(::recvmsg(s, &msg, in_flags), ec); + if (result >= 0) + { + ec = boost::system::error_code(); + out_flags = msg.msg_flags; + } + else + out_flags = 0; + return result; +#endif // defined(BOOST_WINDOWS) || defined(__CYGWIN__) +} + +size_t sync_recvmsg(socket_type s, state_type state, + buf* bufs, size_t count, int in_flags, int& out_flags, + boost::system::error_code& ec) +{ + if (s == invalid_socket) + { + ec = boost::asio::error::bad_descriptor; + return 0; + } + + // Read some data. + for (;;) + { + // Try to complete the operation without blocking. + int bytes = socket_ops::recvmsg(s, bufs, count, in_flags, out_flags, ec); + + // Check if operation succeeded. + if (bytes >= 0) + return bytes; + + // Operation failed. + if ((state & user_set_non_blocking) + || (ec != boost::asio::error::would_block + && ec != boost::asio::error::try_again)) + return 0; + + // Wait for socket to become ready. + if (socket_ops::poll_read(s, 0, ec) < 0) + return 0; + } +} + +#if defined(BOOST_ASIO_HAS_IOCP) + +void complete_iocp_recvmsg( + const weak_cancel_token_type& cancel_token, + boost::system::error_code& ec) +{ + // Map non-portable errors to their portable counterparts. + if (ec.value() == ERROR_NETNAME_DELETED) + { + if (cancel_token.expired()) + ec = boost::asio::error::operation_aborted; + else + ec = boost::asio::error::connection_reset; + } + else if (ec.value() == ERROR_PORT_UNREACHABLE) + { + ec = boost::asio::error::connection_refused; + } +} + +#else // defined(BOOST_ASIO_HAS_IOCP) + +bool non_blocking_recvmsg(socket_type s, + buf* bufs, size_t count, int in_flags, int& out_flags, + boost::system::error_code& ec, size_t& bytes_transferred) +{ + for (;;) + { + // Read some data. + int bytes = socket_ops::recvmsg(s, bufs, count, in_flags, out_flags, ec); + + // Retry operation if interrupted by signal. + if (ec == boost::asio::error::interrupted) + continue; + + // Check if we need to run the operation again. + if (ec == boost::asio::error::would_block + || ec == boost::asio::error::try_again) + return false; + + // Operation is complete. + if (bytes >= 0) + { + ec = boost::system::error_code(); + bytes_transferred = bytes; + } + else + bytes_transferred = 0; + + return true; + } +} + +#endif // defined(BOOST_ASIO_HAS_IOCP) + int send(socket_type s, const buf* bufs, size_t count, int flags, boost::system::error_code& ec) { @@ -929,7 +1115,7 @@ size_t sync_send(socket_type s, state_type state, const buf* bufs, return 0; // Wait for socket to become ready. - if (socket_ops::poll_write(s, ec) < 0) + if (socket_ops::poll_write(s, 0, ec) < 0) return 0; } } @@ -1052,7 +1238,7 @@ size_t sync_sendto(socket_type s, state_type state, const buf* bufs, return 0; // Wait for socket to become ready. - if (socket_ops::poll_write(s, ec) < 0) + if (socket_ops::poll_write(s, 0, ec) < 0) return 0; } } @@ -1502,7 +1688,7 @@ int select(int nfds, fd_set* readfds, fd_set* writefds, #endif } -int poll_read(socket_type s, boost::system::error_code& ec) +int poll_read(socket_type s, state_type state, boost::system::error_code& ec) { if (s == invalid_socket) { @@ -1516,11 +1702,12 @@ int poll_read(socket_type s, boost::system::error_code& ec) fd_set fds; FD_ZERO(&fds); FD_SET(s, &fds); + timeval zero_timeout; + zero_timeout.tv_sec = 0; + zero_timeout.tv_usec = 0; + timeval* timeout = (state & user_set_non_blocking) ? &zero_timeout : 0; clear_last_error(); - int result = error_wrapper(::select(s, &fds, 0, 0, 0), ec); - if (result >= 0) - ec = boost::system::error_code(); - return result; + int result = error_wrapper(::select(s, &fds, 0, 0, timeout), ec); #else // defined(BOOST_WINDOWS) // || defined(__CYGWIN__) // || defined(__SYMBIAN32__) @@ -1528,17 +1715,21 @@ int poll_read(socket_type s, boost::system::error_code& ec) fds.fd = s; fds.events = POLLIN; fds.revents = 0; + int timeout = (state & user_set_non_blocking) ? 0 : -1; clear_last_error(); - int result = error_wrapper(::poll(&fds, 1, -1), ec); - if (result >= 0) - ec = boost::system::error_code(); - return result; + int result = error_wrapper(::poll(&fds, 1, timeout), ec); #endif // defined(BOOST_WINDOWS) // || defined(__CYGWIN__) // || defined(__SYMBIAN32__) + if (result == 0) + ec = (state & user_set_non_blocking) + ? boost::asio::error::would_block : boost::system::error_code(); + else if (result > 0) + ec = boost::system::error_code(); + return result; } -int poll_write(socket_type s, boost::system::error_code& ec) +int poll_write(socket_type s, state_type state, boost::system::error_code& ec) { if (s == invalid_socket) { @@ -1552,11 +1743,12 @@ int poll_write(socket_type s, boost::system::error_code& ec) fd_set fds; FD_ZERO(&fds); FD_SET(s, &fds); + timeval zero_timeout; + zero_timeout.tv_sec = 0; + zero_timeout.tv_usec = 0; + timeval* timeout = (state & user_set_non_blocking) ? &zero_timeout : 0; clear_last_error(); - int result = error_wrapper(::select(s, 0, &fds, 0, 0), ec); - if (result >= 0) - ec = boost::system::error_code(); - return result; + int result = error_wrapper(::select(s, 0, &fds, 0, timeout), ec); #else // defined(BOOST_WINDOWS) // || defined(__CYGWIN__) // || defined(__SYMBIAN32__) @@ -1564,14 +1756,18 @@ int poll_write(socket_type s, boost::system::error_code& ec) fds.fd = s; fds.events = POLLOUT; fds.revents = 0; + int timeout = (state & user_set_non_blocking) ? 0 : -1; clear_last_error(); - int result = error_wrapper(::poll(&fds, 1, -1), ec); - if (result >= 0) - ec = boost::system::error_code(); - return result; + int result = error_wrapper(::poll(&fds, 1, timeout), ec); #endif // defined(BOOST_WINDOWS) // || defined(__CYGWIN__) // || defined(__SYMBIAN32__) + if (result == 0) + ec = (state & user_set_non_blocking) + ? boost::asio::error::would_block : boost::system::error_code(); + else if (result > 0) + ec = boost::system::error_code(); + return result; } int poll_connect(socket_type s, boost::system::error_code& ec) @@ -1680,7 +1876,8 @@ const char* inet_ntop(int af, const void* src, char* dest, size_t length, using namespace std; // For strcat and sprintf. char if_name[IF_NAMESIZE + 1] = "%"; const in6_addr_type* ipv6_address = static_cast<const in6_addr_type*>(src); - bool is_link_local = IN6_IS_ADDR_LINKLOCAL(ipv6_address); + bool is_link_local = ((ipv6_address->s6_addr[0] == 0xfe) + && ((ipv6_address->s6_addr[1] & 0xc0) == 0x80)); if (!is_link_local || if_indextoname(scope_id, if_name + 1) == 0) sprintf(if_name + 1, "%lu", scope_id); strcat(dest, if_name); @@ -1764,7 +1961,8 @@ int inet_pton(int af, const char* src, void* dest, if (const char* if_name = strchr(src, '%')) { in6_addr_type* ipv6_address = static_cast<in6_addr_type*>(dest); - bool is_link_local = IN6_IS_ADDR_LINKLOCAL(ipv6_address); + bool is_link_local = ((ipv6_address->s6_addr[0] == 0xfe) + && ((ipv6_address->s6_addr[1] & 0xc0) == 0x80)); if (is_link_local) *scope_id = if_nametoindex(if_name + 1); if (*scope_id == 0) diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/socket_select_interrupter.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/socket_select_interrupter.ipp index 3b64771..6005f12 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/socket_select_interrupter.ipp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/socket_select_interrupter.ipp @@ -2,7 +2,7 @@ // detail/impl/socket_select_interrupter.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -36,6 +36,11 @@ namespace detail { socket_select_interrupter::socket_select_interrupter() { + open_descriptors(); +} + +void socket_select_interrupter::open_descriptors() +{ boost::system::error_code ec; socket_holder acceptor(socket_ops::socket( AF_INET, SOCK_STREAM, IPPROTO_TCP, ec)); @@ -110,6 +115,11 @@ socket_select_interrupter::socket_select_interrupter() socket_select_interrupter::~socket_select_interrupter() { + close_descriptors(); +} + +void socket_select_interrupter::close_descriptors() +{ boost::system::error_code ec; socket_ops::state_type state = socket_ops::internal_non_blocking; if (read_descriptor_ != invalid_socket) @@ -118,6 +128,16 @@ socket_select_interrupter::~socket_select_interrupter() socket_ops::close(write_descriptor_, state, true, ec); } +void socket_select_interrupter::recreate() +{ + close_descriptors(); + + write_descriptor_ = invalid_socket; + read_descriptor_ = invalid_socket; + + open_descriptors(); +} + void socket_select_interrupter::interrupt() { char byte = 0; diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/strand_service.hpp b/3rdParty/Boost/src/boost/asio/detail/impl/strand_service.hpp index 5cb320d..7581852 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/strand_service.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/strand_service.hpp @@ -2,7 +2,7 @@ // detail/impl/strand_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -29,7 +29,7 @@ namespace detail { inline strand_service::strand_impl::strand_impl() : operation(&strand_service::do_complete), - count_(0) + locked_(false) { } @@ -41,7 +41,8 @@ struct strand_service::on_dispatch_exit ~on_dispatch_exit() { impl_->mutex_.lock(); - bool more_handlers = (--impl_->count_ > 0); + impl_->ready_queue_.push(impl_->waiting_queue_); + bool more_handlers = impl_->locked_ = !impl_->ready_queue_.empty(); impl_->mutex_.unlock(); if (more_handlers) @@ -49,11 +50,6 @@ struct strand_service::on_dispatch_exit } }; -inline void strand_service::destroy(strand_service::implementation_type& impl) -{ - impl = 0; -} - template <typename Handler> void strand_service::dispatch(strand_service::implementation_type& impl, Handler handler) @@ -61,7 +57,7 @@ void strand_service::dispatch(strand_service::implementation_type& impl, // If we are already in the strand then the handler can run immediately. if (call_stack<strand_impl>::contains(impl)) { - boost::asio::detail::fenced_block b; + fenced_block b(fenced_block::full); boost_asio_handler_invoke_helpers::invoke(handler, handler); return; } @@ -73,19 +69,14 @@ void strand_service::dispatch(strand_service::implementation_type& impl, sizeof(op), handler), 0 }; p.p = new (p.v) op(handler); - // If we are running inside the io_service, and no other handler is queued - // or running, then the handler can run immediately. - bool can_dispatch = call_stack<io_service_impl>::contains(&io_service_); - impl->mutex_.lock(); - bool first = (++impl->count_ == 1); - if (can_dispatch && first) - { - // Immediate invocation is allowed. - impl->mutex_.unlock(); + BOOST_ASIO_HANDLER_CREATION((p.p, "strand", impl, "dispatch")); - // Memory must be releaesed before any upcall is made. - p.reset(); + bool dispatch_immediately = do_dispatch(impl, p.p); + operation* o = p.p; + p.v = p.p = 0; + if (dispatch_immediately) + { // Indicate that this strand is executing on the current thread. call_stack<strand_impl>::context ctx(impl); @@ -93,20 +84,9 @@ void strand_service::dispatch(strand_service::implementation_type& impl, on_dispatch_exit on_exit = { &io_service_, impl }; (void)on_exit; - boost::asio::detail::fenced_block b; - boost_asio_handler_invoke_helpers::invoke(handler, handler); - return; + completion_handler<Handler>::do_complete( + &io_service_, o, boost::system::error_code(), 0); } - - // Immediate invocation is not allowed, so enqueue for later. - impl->queue_.push(p.p); - impl->mutex_.unlock(); - p.v = p.p = 0; - - // The first handler to be enqueued is responsible for scheduling the - // strand. - if (first) - io_service_.post_immediate_completion(impl); } // Request the io_service to invoke the given handler and return immediately. @@ -121,16 +101,10 @@ void strand_service::post(strand_service::implementation_type& impl, sizeof(op), handler), 0 }; p.p = new (p.v) op(handler); - // Add the handler to the queue. - impl->mutex_.lock(); - bool first = (++impl->count_ == 1); - impl->queue_.push(p.p); - impl->mutex_.unlock(); - p.v = p.p = 0; + BOOST_ASIO_HANDLER_CREATION((p.p, "strand", impl, "post")); - // The first handler to be enqueue is responsible for scheduling the strand. - if (first) - io_service_.post_immediate_completion(impl); + do_post(impl, p.p); + p.v = p.p = 0; } } // namespace detail diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/strand_service.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/strand_service.ipp index 6a42146..1912d80 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/strand_service.ipp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/strand_service.ipp @@ -2,7 +2,7 @@ // detail/impl/strand_service.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -33,11 +33,12 @@ struct strand_service::on_do_complete_exit ~on_do_complete_exit() { impl_->mutex_.lock(); - bool more_handlers = (--impl_->count_ > 0); + impl_->ready_queue_.push(impl_->waiting_queue_); + bool more_handlers = impl_->locked_ = !impl_->ready_queue_.empty(); impl_->mutex_.unlock(); if (more_handlers) - owner_->post_immediate_completion(impl_); + owner_->post_private_immediate_completion(impl_); } }; @@ -56,38 +57,94 @@ void strand_service::shutdown_service() boost::asio::detail::mutex::scoped_lock lock(mutex_); for (std::size_t i = 0; i < num_implementations; ++i) + { if (strand_impl* impl = implementations_[i].get()) - ops.push(impl->queue_); + { + ops.push(impl->waiting_queue_); + ops.push(impl->ready_queue_); + } + } } void strand_service::construct(strand_service::implementation_type& impl) { + boost::asio::detail::mutex::scoped_lock lock(mutex_); + std::size_t salt = salt_++; +#if defined(BOOST_ASIO_ENABLE_SEQUENTIAL_STRAND_ALLOCATION) + std::size_t index = salt; +#else // defined(BOOST_ASIO_ENABLE_SEQUENTIAL_STRAND_ALLOCATION) std::size_t index = reinterpret_cast<std::size_t>(&impl); index += (reinterpret_cast<std::size_t>(&impl) >> 3); index ^= salt + 0x9e3779b9 + (index << 6) + (index >> 2); +#endif // defined(BOOST_ASIO_ENABLE_SEQUENTIAL_STRAND_ALLOCATION) index = index % num_implementations; - boost::asio::detail::mutex::scoped_lock lock(mutex_); - - if (!implementations_[index]) + if (!implementations_[index].get()) implementations_[index].reset(new strand_impl); impl = implementations_[index].get(); } +bool strand_service::do_dispatch(implementation_type& impl, operation* op) +{ + // If we are running inside the io_service, and no other handler already + // holds the strand lock, then the handler can run immediately. + bool can_dispatch = io_service_.can_dispatch(); + impl->mutex_.lock(); + if (can_dispatch && !impl->locked_) + { + // Immediate invocation is allowed. + impl->locked_ = true; + impl->mutex_.unlock(); + return true; + } + + if (impl->locked_) + { + // Some other handler already holds the strand lock. Enqueue for later. + impl->waiting_queue_.push(op); + impl->mutex_.unlock(); + } + else + { + // The handler is acquiring the strand lock and so is responsible for + // scheduling the strand. + impl->locked_ = true; + impl->mutex_.unlock(); + impl->ready_queue_.push(op); + io_service_.post_immediate_completion(impl); + } + + return false; +} + +void strand_service::do_post(implementation_type& impl, operation* op) +{ + impl->mutex_.lock(); + if (impl->locked_) + { + // Some other handler already holds the strand lock. Enqueue for later. + impl->waiting_queue_.push(op); + impl->mutex_.unlock(); + } + else + { + // The handler is acquiring the strand lock and so is responsible for + // scheduling the strand. + impl->locked_ = true; + impl->mutex_.unlock(); + impl->ready_queue_.push(op); + io_service_.post_immediate_completion(impl); + } +} + void strand_service::do_complete(io_service_impl* owner, operation* base, - boost::system::error_code /*ec*/, std::size_t /*bytes_transferred*/) + const boost::system::error_code& ec, std::size_t /*bytes_transferred*/) { if (owner) { strand_impl* impl = static_cast<strand_impl*>(base); - // Get the next handler to be executed. - impl->mutex_.lock(); - operation* o = impl->queue_.front(); - impl->queue_.pop(); - impl->mutex_.unlock(); - // Indicate that this strand is executing on the current thread. call_stack<strand_impl>::context ctx(impl); @@ -95,7 +152,13 @@ void strand_service::do_complete(io_service_impl* owner, operation* base, on_do_complete_exit on_exit = { owner, impl }; (void)on_exit; - o->complete(*owner); + // Run all ready handlers. No lock is required since the ready queue is + // accessed only within the strand. + while (operation* o = impl->ready_queue_.front()) + { + impl->ready_queue_.pop(); + o->complete(*owner, ec, 0); + } } } diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/task_io_service.hpp b/3rdParty/Boost/src/boost/asio/detail/impl/task_io_service.hpp index a002189..2cc7b7e 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/task_io_service.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/task_io_service.hpp @@ -2,7 +2,7 @@ // detail/impl/task_io_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -15,7 +15,6 @@ # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) -#include <boost/asio/detail/call_stack.hpp> #include <boost/asio/detail/completion_handler.hpp> #include <boost/asio/detail/fenced_block.hpp> #include <boost/asio/detail/handler_alloc_helpers.hpp> @@ -30,13 +29,25 @@ namespace detail { template <typename Handler> void task_io_service::dispatch(Handler handler) { - if (call_stack<task_io_service>::contains(this)) + if (thread_call_stack::contains(this)) { - boost::asio::detail::fenced_block b; + fenced_block b(fenced_block::full); boost_asio_handler_invoke_helpers::invoke(handler, handler); } else - post(handler); + { + // Allocate and construct an operation to wrap the handler. + typedef completion_handler<Handler> op; + typename op::ptr p = { boost::addressof(handler), + boost_asio_handler_alloc_helpers::allocate( + sizeof(op), handler), 0 }; + p.p = new (p.v) op(handler); + + BOOST_ASIO_HANDLER_CREATION((p.p, "io_service", this, "dispatch")); + + post_non_private_immediate_completion(p.p); + p.v = p.p = 0; + } } template <typename Handler> @@ -49,6 +60,8 @@ void task_io_service::post(Handler handler) sizeof(op), handler), 0 }; p.p = new (p.v) op(handler); + BOOST_ASIO_HANDLER_CREATION((p.p, "io_service", this, "post")); + post_immediate_completion(p.p); p.v = p.p = 0; } diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/task_io_service.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/task_io_service.ipp index babfa7b..674df63 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/task_io_service.ipp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/task_io_service.ipp @@ -2,7 +2,7 @@ // detail/impl/task_io_service.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -20,7 +20,6 @@ #if !defined(BOOST_ASIO_HAS_IOCP) #include <boost/limits.hpp> -#include <boost/asio/detail/call_stack.hpp> #include <boost/asio/detail/event.hpp> #include <boost/asio/detail/reactor.hpp> #include <boost/asio/detail/task_io_service.hpp> @@ -31,41 +30,73 @@ namespace boost { namespace asio { namespace detail { +struct task_io_service::thread_info +{ + event* wakeup_event; + op_queue<operation> private_op_queue; + long private_outstanding_work; + thread_info* next; +}; + struct task_io_service::task_cleanup { ~task_cleanup() { + if (this_thread_->private_outstanding_work > 0) + { + boost::asio::detail::increment( + task_io_service_->outstanding_work_, + this_thread_->private_outstanding_work); + } + this_thread_->private_outstanding_work = 0; + // Enqueue the completed operations and reinsert the task at the end of // the operation queue. lock_->lock(); task_io_service_->task_interrupted_ = true; - task_io_service_->op_queue_.push(*ops_); + task_io_service_->op_queue_.push(this_thread_->private_op_queue); task_io_service_->op_queue_.push(&task_io_service_->task_operation_); } task_io_service* task_io_service_; mutex::scoped_lock* lock_; - op_queue<operation>* ops_; + thread_info* this_thread_; }; -struct task_io_service::work_finished_on_block_exit +struct task_io_service::work_cleanup { - ~work_finished_on_block_exit() + ~work_cleanup() { - task_io_service_->work_finished(); + if (this_thread_->private_outstanding_work > 1) + { + boost::asio::detail::increment( + task_io_service_->outstanding_work_, + this_thread_->private_outstanding_work - 1); + } + else if (this_thread_->private_outstanding_work < 1) + { + task_io_service_->work_finished(); + } + this_thread_->private_outstanding_work = 0; + +#if defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) + if (!this_thread_->private_op_queue.empty()) + { + lock_->lock(); + task_io_service_->op_queue_.push(this_thread_->private_op_queue); + } +#endif // defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) } task_io_service* task_io_service_; + mutex::scoped_lock* lock_; + thread_info* this_thread_; }; -struct task_io_service::idle_thread_info -{ - event wakeup_event; - idle_thread_info* next; -}; - -task_io_service::task_io_service(boost::asio::io_service& io_service) +task_io_service::task_io_service( + boost::asio::io_service& io_service, std::size_t concurrency_hint) : boost::asio::detail::service_base<task_io_service>(io_service), + one_thread_(concurrency_hint == 1), mutex_(), task_(0), task_interrupted_(true), @@ -74,10 +105,7 @@ task_io_service::task_io_service(boost::asio::io_service& io_service) shutdown_(false), first_idle_thread_(0) { -} - -void task_io_service::init(std::size_t /*concurrency_hint*/) -{ + BOOST_ASIO_HANDLER_TRACKING_INIT; } void task_io_service::shutdown_service() @@ -119,15 +147,17 @@ std::size_t task_io_service::run(boost::system::error_code& ec) return 0; } - call_stack<task_io_service>::context ctx(this); - - idle_thread_info this_idle_thread; - this_idle_thread.next = 0; + thread_info this_thread; + event wakeup_event; + this_thread.wakeup_event = &wakeup_event; + this_thread.private_outstanding_work = 0; + this_thread.next = 0; + thread_call_stack::context ctx(this, this_thread); mutex::scoped_lock lock(mutex_); std::size_t n = 0; - for (; do_one(lock, &this_idle_thread); lock.lock()) + for (; do_run_one(lock, this_thread, ec); lock.lock()) if (n != (std::numeric_limits<std::size_t>::max)()) ++n; return n; @@ -142,31 +172,46 @@ std::size_t task_io_service::run_one(boost::system::error_code& ec) return 0; } - call_stack<task_io_service>::context ctx(this); - - idle_thread_info this_idle_thread; - this_idle_thread.next = 0; + thread_info this_thread; + event wakeup_event; + this_thread.wakeup_event = &wakeup_event; + this_thread.private_outstanding_work = 0; + this_thread.next = 0; + thread_call_stack::context ctx(this, this_thread); mutex::scoped_lock lock(mutex_); - return do_one(lock, &this_idle_thread); + return do_run_one(lock, this_thread, ec); } std::size_t task_io_service::poll(boost::system::error_code& ec) { + ec = boost::system::error_code(); if (outstanding_work_ == 0) { stop(); - ec = boost::system::error_code(); return 0; } - call_stack<task_io_service>::context ctx(this); + thread_info this_thread; + this_thread.wakeup_event = 0; + this_thread.private_outstanding_work = 0; + this_thread.next = 0; + thread_call_stack::context ctx(this, this_thread); mutex::scoped_lock lock(mutex_); +#if defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) + // We want to support nested calls to poll() and poll_one(), so any handlers + // that are already on a thread-private queue need to be put on to the main + // queue now. + if (one_thread_) + if (thread_info* outer_thread_info = ctx.next_by_key()) + op_queue_.push(outer_thread_info->private_op_queue); +#endif // defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) + std::size_t n = 0; - for (; do_one(lock, 0); lock.lock()) + for (; do_poll_one(lock, this_thread, ec); lock.lock()) if (n != (std::numeric_limits<std::size_t>::max)()) ++n; return n; @@ -181,11 +226,24 @@ std::size_t task_io_service::poll_one(boost::system::error_code& ec) return 0; } - call_stack<task_io_service>::context ctx(this); + thread_info this_thread; + this_thread.wakeup_event = 0; + this_thread.private_outstanding_work = 0; + this_thread.next = 0; + thread_call_stack::context ctx(this, this_thread); mutex::scoped_lock lock(mutex_); - return do_one(lock, 0); +#if defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) + // We want to support nested calls to poll() and poll_one(), so any handlers + // that are already on a thread-private queue need to be put on to the main + // queue now. + if (one_thread_) + if (thread_info* outer_thread_info = ctx.next_by_key()) + op_queue_.push(outer_thread_info->private_op_queue); +#endif // defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) + + return do_poll_one(lock, this_thread, ec); } void task_io_service::stop() @@ -194,6 +252,12 @@ void task_io_service::stop() stop_all_threads(lock); } +bool task_io_service::stopped() const +{ + mutex::scoped_lock lock(mutex_); + return stopped_; +} + void task_io_service::reset() { mutex::scoped_lock lock(mutex_); @@ -202,12 +266,37 @@ void task_io_service::reset() void task_io_service::post_immediate_completion(task_io_service::operation* op) { +#if defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) + if (one_thread_) + { + if (thread_info* this_thread = thread_call_stack::contains(this)) + { + ++this_thread->private_outstanding_work; + this_thread->private_op_queue.push(op); + return; + } + } +#endif // defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) + work_started(); - post_deferred_completion(op); + mutex::scoped_lock lock(mutex_); + op_queue_.push(op); + wake_one_thread_and_unlock(lock); } void task_io_service::post_deferred_completion(task_io_service::operation* op) { +#if defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) + if (one_thread_) + { + if (thread_info* this_thread = thread_call_stack::contains(this)) + { + this_thread->private_op_queue.push(op); + return; + } + } +#endif // defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) + mutex::scoped_lock lock(mutex_); op_queue_.push(op); wake_one_thread_and_unlock(lock); @@ -218,17 +307,72 @@ void task_io_service::post_deferred_completions( { if (!ops.empty()) { +#if defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) + if (one_thread_) + { + if (thread_info* this_thread = thread_call_stack::contains(this)) + { + this_thread->private_op_queue.push(ops); + return; + } + } +#endif // defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) + mutex::scoped_lock lock(mutex_); op_queue_.push(ops); wake_one_thread_and_unlock(lock); } } -std::size_t task_io_service::do_one(mutex::scoped_lock& lock, - task_io_service::idle_thread_info* this_idle_thread) +void task_io_service::post_private_immediate_completion( + task_io_service::operation* op) +{ + work_started(); + post_private_deferred_completion(op); +} + +void task_io_service::post_private_deferred_completion( + task_io_service::operation* op) +{ +#if defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) + if (thread_info* this_thread = thread_call_stack::contains(this)) + { + this_thread->private_op_queue.push(op); + return; + } +#endif // defined(BOOST_HAS_THREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) + + mutex::scoped_lock lock(mutex_); + op_queue_.push(op); + wake_one_thread_and_unlock(lock); +} + +void task_io_service::post_non_private_immediate_completion( + task_io_service::operation* op) +{ + work_started(); + post_non_private_deferred_completion(op); +} + +void task_io_service::post_non_private_deferred_completion( + task_io_service::operation* op) +{ + mutex::scoped_lock lock(mutex_); + op_queue_.push(op); + wake_one_thread_and_unlock(lock); +} + +void task_io_service::abandon_operations( + op_queue<task_io_service::operation>& ops) +{ + op_queue<task_io_service::operation> ops2; + ops2.push(ops); +} + +std::size_t task_io_service::do_run_one(mutex::scoped_lock& lock, + task_io_service::thread_info& this_thread, + const boost::system::error_code& ec) { - bool polling = !this_idle_thread; - bool task_has_run = false; while (!stopped_) { if (!op_queue_.empty()) @@ -240,61 +384,105 @@ std::size_t task_io_service::do_one(mutex::scoped_lock& lock, if (o == &task_operation_) { - task_interrupted_ = more_handlers || polling; + task_interrupted_ = more_handlers; - // If the task has already run and we're polling then we're done. - if (task_has_run && polling) + if (more_handlers && !one_thread_) { - task_interrupted_ = true; - op_queue_.push(&task_operation_); - return 0; + if (!wake_one_idle_thread_and_unlock(lock)) + lock.unlock(); } - task_has_run = true; - - if (!more_handlers || !wake_one_idle_thread_and_unlock(lock)) + else lock.unlock(); - op_queue<operation> completed_ops; - task_cleanup c = { this, &lock, &completed_ops }; - (void)c; + task_cleanup on_exit = { this, &lock, &this_thread }; + (void)on_exit; // Run the task. May throw an exception. Only block if the operation // queue is empty and we're not polling, otherwise we want to return // as soon as possible. - task_->run(!more_handlers && !polling, completed_ops); + task_->run(!more_handlers, this_thread.private_op_queue); } else { - if (more_handlers) + std::size_t task_result = o->task_result_; + + if (more_handlers && !one_thread_) wake_one_thread_and_unlock(lock); else lock.unlock(); // Ensure the count of outstanding work is decremented on block exit. - work_finished_on_block_exit on_exit = { this }; + work_cleanup on_exit = { this, &lock, &this_thread }; (void)on_exit; - // Complete the operation. May throw an exception. - o->complete(*this); // deletes the operation object + // Complete the operation. May throw an exception. Deletes the object. + o->complete(*this, ec, task_result); return 1; } } - else if (this_idle_thread) + else { // Nothing to run right now, so just wait for work to do. - this_idle_thread->next = first_idle_thread_; - first_idle_thread_ = this_idle_thread; - this_idle_thread->wakeup_event.clear(lock); - this_idle_thread->wakeup_event.wait(lock); + this_thread.next = first_idle_thread_; + first_idle_thread_ = &this_thread; + this_thread.wakeup_event->clear(lock); + this_thread.wakeup_event->wait(lock); } - else + } + + return 0; +} + +std::size_t task_io_service::do_poll_one(mutex::scoped_lock& lock, + task_io_service::thread_info& this_thread, + const boost::system::error_code& ec) +{ + if (stopped_) + return 0; + + operation* o = op_queue_.front(); + if (o == &task_operation_) + { + op_queue_.pop(); + lock.unlock(); + { - return 0; + task_cleanup c = { this, &lock, &this_thread }; + (void)c; + + // Run the task. May throw an exception. Only block if the operation + // queue is empty and we're not polling, otherwise we want to return + // as soon as possible. + task_->run(false, this_thread.private_op_queue); } + + o = op_queue_.front(); + if (o == &task_operation_) + return 0; } - return 0; + if (o == 0) + return 0; + + op_queue_.pop(); + bool more_handlers = (!op_queue_.empty()); + + std::size_t task_result = o->task_result_; + + if (more_handlers && !one_thread_) + wake_one_thread_and_unlock(lock); + else + lock.unlock(); + + // Ensure the count of outstanding work is decremented on block exit. + work_cleanup on_exit = { this, &lock, &this_thread }; + (void)on_exit; + + // Complete the operation. May throw an exception. Deletes the object. + o->complete(*this, ec, task_result); + + return 1; } void task_io_service::stop_all_threads( @@ -304,10 +492,10 @@ void task_io_service::stop_all_threads( while (first_idle_thread_) { - idle_thread_info* idle_thread = first_idle_thread_; + thread_info* idle_thread = first_idle_thread_; first_idle_thread_ = idle_thread->next; idle_thread->next = 0; - idle_thread->wakeup_event.signal(lock); + idle_thread->wakeup_event->signal(lock); } if (!task_interrupted_ && task_) @@ -322,10 +510,10 @@ bool task_io_service::wake_one_idle_thread_and_unlock( { if (first_idle_thread_) { - idle_thread_info* idle_thread = first_idle_thread_; + thread_info* idle_thread = first_idle_thread_; first_idle_thread_ = idle_thread->next; idle_thread->next = 0; - idle_thread->wakeup_event.signal_and_unlock(lock); + idle_thread->wakeup_event->signal_and_unlock(lock); return true; } return false; diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/throw_error.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/throw_error.ipp index 5ba6b9c..dbe6112 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/throw_error.ipp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/throw_error.ipp @@ -2,7 +2,7 @@ // detail/impl/throw_error.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/timer_queue_ptime.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/timer_queue_ptime.ipp new file mode 100644 index 0000000..c72d885 --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/detail/impl/timer_queue_ptime.ipp @@ -0,0 +1,82 @@ +// +// detail/impl/timer_queue_ptime.ipp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) +// + +#ifndef BOOST_ASIO_DETAIL_IMPL_TIMER_QUEUE_PTIME_IPP +#define BOOST_ASIO_DETAIL_IMPL_TIMER_QUEUE_PTIME_IPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> +#include <boost/asio/detail/timer_queue_ptime.hpp> + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { +namespace detail { + +timer_queue<time_traits<boost::posix_time::ptime> >::timer_queue() +{ +} + +timer_queue<time_traits<boost::posix_time::ptime> >::~timer_queue() +{ +} + +bool timer_queue<time_traits<boost::posix_time::ptime> >::enqueue_timer( + const time_type& time, per_timer_data& timer, wait_op* op) +{ + return impl_.enqueue_timer(time, timer, op); +} + +bool timer_queue<time_traits<boost::posix_time::ptime> >::empty() const +{ + return impl_.empty(); +} + +long timer_queue<time_traits<boost::posix_time::ptime> >::wait_duration_msec( + long max_duration) const +{ + return impl_.wait_duration_msec(max_duration); +} + +long timer_queue<time_traits<boost::posix_time::ptime> >::wait_duration_usec( + long max_duration) const +{ + return impl_.wait_duration_usec(max_duration); +} + +void timer_queue<time_traits<boost::posix_time::ptime> >::get_ready_timers( + op_queue<operation>& ops) +{ + impl_.get_ready_timers(ops); +} + +void timer_queue<time_traits<boost::posix_time::ptime> >::get_all_timers( + op_queue<operation>& ops) +{ + impl_.get_all_timers(ops); +} + +std::size_t timer_queue<time_traits<boost::posix_time::ptime> >::cancel_timer( + per_timer_data& timer, op_queue<operation>& ops, std::size_t max_cancelled) +{ + return impl_.cancel_timer(timer, ops, max_cancelled); +} + +} // namespace detail +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#endif // BOOST_ASIO_DETAIL_IMPL_TIMER_QUEUE_PTIME_IPP diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/timer_queue_set.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/timer_queue_set.ipp index d1027e6..7f9a662 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/timer_queue_set.ipp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/timer_queue_set.ipp @@ -2,7 +2,7 @@ // detail/impl/timer_queue_set.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/win_event.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/win_event.ipp index fe904fb..252242c 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/win_event.ipp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/win_event.ipp @@ -2,7 +2,7 @@ // detail/win_event.ipp // ~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/win_iocp_handle_service.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/win_iocp_handle_service.ipp index eb6643a..ecd45c0 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/win_iocp_handle_service.ipp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/win_iocp_handle_service.ipp @@ -2,7 +2,7 @@ // detail/impl/win_iocp_handle_service.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) // Copyright (c) 2008 Rep Invariant Systems, Inc. (info@repinvariant.com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -100,6 +100,64 @@ void win_iocp_handle_service::construct( impl_list_ = &impl; } +void win_iocp_handle_service::move_construct( + win_iocp_handle_service::implementation_type& impl, + win_iocp_handle_service::implementation_type& other_impl) +{ + impl.handle_ = other_impl.handle_; + other_impl.handle_ = INVALID_HANDLE_VALUE; + + impl.safe_cancellation_thread_id_ = other_impl.safe_cancellation_thread_id_; + other_impl.safe_cancellation_thread_id_ = 0; + + // Insert implementation into linked list of all implementations. + boost::asio::detail::mutex::scoped_lock lock(mutex_); + impl.next_ = impl_list_; + impl.prev_ = 0; + if (impl_list_) + impl_list_->prev_ = &impl; + impl_list_ = &impl; +} + +void win_iocp_handle_service::move_assign( + win_iocp_handle_service::implementation_type& impl, + win_iocp_handle_service& other_service, + win_iocp_handle_service::implementation_type& other_impl) +{ + close_for_destruction(impl); + + if (this != &other_service) + { + // Remove implementation from linked list of all implementations. + boost::asio::detail::mutex::scoped_lock lock(mutex_); + if (impl_list_ == &impl) + impl_list_ = impl.next_; + if (impl.prev_) + impl.prev_->next_ = impl.next_; + if (impl.next_) + impl.next_->prev_= impl.prev_; + impl.next_ = 0; + impl.prev_ = 0; + } + + impl.handle_ = other_impl.handle_; + other_impl.handle_ = INVALID_HANDLE_VALUE; + + impl.safe_cancellation_thread_id_ = other_impl.safe_cancellation_thread_id_; + other_impl.safe_cancellation_thread_id_ = 0; + + if (this != &other_service) + { + // Insert implementation into linked list of all implementations. + boost::asio::detail::mutex::scoped_lock lock(other_service.mutex_); + impl.next_ = other_service.impl_list_; + impl.prev_ = 0; + if (other_service.impl_list_) + other_service.impl_list_->prev_ = &impl; + other_service.impl_list_ = &impl; + } +} + void win_iocp_handle_service::destroy( win_iocp_handle_service::implementation_type& impl) { @@ -119,7 +177,7 @@ void win_iocp_handle_service::destroy( boost::system::error_code win_iocp_handle_service::assign( win_iocp_handle_service::implementation_type& impl, - const native_type& native_handle, boost::system::error_code& ec) + const native_handle_type& handle, boost::system::error_code& ec) { if (is_open(impl)) { @@ -127,10 +185,10 @@ boost::system::error_code win_iocp_handle_service::assign( return ec; } - if (iocp_service_.register_handle(native_handle, ec)) + if (iocp_service_.register_handle(handle, ec)) return ec; - impl.handle_ = native_handle; + impl.handle_ = handle; ec = boost::system::error_code(); return ec; } @@ -141,19 +199,27 @@ boost::system::error_code win_iocp_handle_service::close( { if (is_open(impl)) { + BOOST_ASIO_HANDLER_OPERATION(("handle", &impl, "close")); + if (!::CloseHandle(impl.handle_)) { DWORD last_error = ::GetLastError(); ec = boost::system::error_code(last_error, boost::asio::error::get_system_category()); - return ec; + } + else + { + ec = boost::system::error_code(); } impl.handle_ = INVALID_HANDLE_VALUE; impl.safe_cancellation_thread_id_ = 0; } + else + { + ec = boost::system::error_code(); + } - ec = boost::system::error_code(); return ec; } @@ -164,8 +230,12 @@ boost::system::error_code win_iocp_handle_service::cancel( if (!is_open(impl)) { ec = boost::asio::error::bad_descriptor; + return ec; } - else if (FARPROC cancel_io_ex_ptr = ::GetProcAddress( + + BOOST_ASIO_HANDLER_OPERATION(("handle", &impl, "cancel")); + + if (FARPROC cancel_io_ex_ptr = ::GetProcAddress( ::GetModuleHandleA("KERNEL32"), "CancelIoEx")) { // The version of Windows supports cancellation from any thread. @@ -437,6 +507,8 @@ void win_iocp_handle_service::close_for_destruction(implementation_type& impl) { if (is_open(impl)) { + BOOST_ASIO_HANDLER_OPERATION(("handle", &impl, "close")); + ::CloseHandle(impl.handle_); impl.handle_ = INVALID_HANDLE_VALUE; impl.safe_cancellation_thread_id_ = 0; diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/win_iocp_io_service.hpp b/3rdParty/Boost/src/boost/asio/detail/impl/win_iocp_io_service.hpp index 18b9413..871f6fa 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/win_iocp_io_service.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/win_iocp_io_service.hpp @@ -2,7 +2,7 @@ // detail/impl/win_iocp_io_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -19,7 +19,6 @@ #if defined(BOOST_ASIO_HAS_IOCP) -#include <boost/asio/detail/call_stack.hpp> #include <boost/asio/detail/completion_handler.hpp> #include <boost/asio/detail/fenced_block.hpp> #include <boost/asio/detail/handler_alloc_helpers.hpp> @@ -36,11 +35,23 @@ void win_iocp_io_service::dispatch(Handler handler) { if (call_stack<win_iocp_io_service>::contains(this)) { - boost::asio::detail::fenced_block b; + fenced_block b(fenced_block::full); boost_asio_handler_invoke_helpers::invoke(handler, handler); } else - post(handler); + { + // Allocate and construct an operation to wrap the handler. + typedef completion_handler<Handler> op; + typename op::ptr p = { boost::addressof(handler), + boost_asio_handler_alloc_helpers::allocate( + sizeof(op), handler), 0 }; + p.p = new (p.v) op(handler); + + BOOST_ASIO_HANDLER_CREATION((p.p, "io_service", this, "dispatch")); + + post_immediate_completion(p.p); + p.v = p.p = 0; + } } template <typename Handler> @@ -53,6 +64,8 @@ void win_iocp_io_service::post(Handler handler) sizeof(op), handler), 0 }; p.p = new (p.v) op(handler); + BOOST_ASIO_HANDLER_CREATION((p.p, "io_service", this, "post")); + post_immediate_completion(p.p); p.v = p.p = 0; } @@ -74,7 +87,7 @@ void win_iocp_io_service::remove_timer_queue( template <typename Time_Traits> void win_iocp_io_service::schedule_timer(timer_queue<Time_Traits>& queue, const typename Time_Traits::time_type& time, - typename timer_queue<Time_Traits>::per_timer_data& timer, timer_op* op) + typename timer_queue<Time_Traits>::per_timer_data& timer, wait_op* op) { // If the service has been shut down we silently discard the timer. if (::InterlockedExchangeAdd(&shutdown_, 0) != 0) @@ -93,7 +106,8 @@ void win_iocp_io_service::schedule_timer(timer_queue<Time_Traits>& queue, template <typename Time_Traits> std::size_t win_iocp_io_service::cancel_timer(timer_queue<Time_Traits>& queue, - typename timer_queue<Time_Traits>::per_timer_data& timer) + typename timer_queue<Time_Traits>::per_timer_data& timer, + std::size_t max_cancelled) { // If the service has been shut down we silently ignore the cancellation. if (::InterlockedExchangeAdd(&shutdown_, 0) != 0) @@ -101,7 +115,7 @@ std::size_t win_iocp_io_service::cancel_timer(timer_queue<Time_Traits>& queue, mutex::scoped_lock lock(dispatch_mutex_); op_queue<win_iocp_operation> ops; - std::size_t n = queue.cancel_timer(timer, ops); + std::size_t n = queue.cancel_timer(timer, ops, max_cancelled); post_deferred_completions(ops); return n; } diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/win_iocp_io_service.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/win_iocp_io_service.ipp index 9711702..72f4af7 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/win_iocp_io_service.ipp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/win_iocp_io_service.ipp @@ -2,7 +2,7 @@ // detail/impl/win_iocp_io_service.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -62,7 +62,8 @@ struct win_iocp_io_service::timer_thread_function win_iocp_io_service* io_service_; }; -win_iocp_io_service::win_iocp_io_service(boost::asio::io_service& io_service) +win_iocp_io_service::win_iocp_io_service( + boost::asio::io_service& io_service, size_t concurrency_hint) : boost::asio::detail::service_base<win_iocp_io_service>(io_service), iocp_(), outstanding_work_(0), @@ -70,10 +71,8 @@ win_iocp_io_service::win_iocp_io_service(boost::asio::io_service& io_service) shutdown_(0), dispatch_required_(0) { -} + BOOST_ASIO_HANDLER_TRACKING_INIT; -void win_iocp_io_service::init(size_t concurrency_hint) -{ iocp_.handle = ::CreateIoCompletionPort(INVALID_HANDLE_VALUE, 0, 0, static_cast<DWORD>((std::min<size_t>)(concurrency_hint, DWORD(~0)))); if (!iocp_.handle) @@ -89,7 +88,7 @@ void win_iocp_io_service::shutdown_service() { ::InterlockedExchange(&shutdown_, 1); - if (timer_thread_) + if (timer_thread_.get()) { LARGE_INTEGER timeout; timeout.QuadPart = 1; @@ -125,7 +124,7 @@ void win_iocp_io_service::shutdown_service() } } - if (timer_thread_) + if (timer_thread_.get()) timer_thread_->join(); } @@ -149,7 +148,7 @@ size_t win_iocp_io_service::run(boost::system::error_code& ec) { if (::InterlockedExchangeAdd(&outstanding_work_, 0) == 0) { - stop(); + InterlockedExchange(&stopped_, 1); ec = boost::system::error_code(); return 0; } @@ -167,7 +166,7 @@ size_t win_iocp_io_service::run_one(boost::system::error_code& ec) { if (::InterlockedExchangeAdd(&outstanding_work_, 0) == 0) { - stop(); + InterlockedExchange(&stopped_, 1); ec = boost::system::error_code(); return 0; } @@ -181,7 +180,7 @@ size_t win_iocp_io_service::poll(boost::system::error_code& ec) { if (::InterlockedExchangeAdd(&outstanding_work_, 0) == 0) { - stop(); + InterlockedExchange(&stopped_, 1); ec = boost::system::error_code(); return 0; } @@ -199,7 +198,7 @@ size_t win_iocp_io_service::poll_one(boost::system::error_code& ec) { if (::InterlockedExchangeAdd(&outstanding_work_, 0) == 0) { - stop(); + InterlockedExchange(&stopped_, 1); ec = boost::system::error_code(); return 0; } @@ -262,6 +261,17 @@ void win_iocp_io_service::post_deferred_completions( } } +void win_iocp_io_service::abandon_operations( + op_queue<win_iocp_operation>& ops) +{ + while (win_iocp_operation* op = ops.front()) + { + ops.pop(); + ::InterlockedDecrement(&outstanding_work_); + op->destroy(); + } +} + void win_iocp_io_service::on_pending(win_iocp_operation* op) { if (::InterlockedCompareExchange(&op->ready_, 1, 0) == 1) @@ -455,7 +465,7 @@ void win_iocp_io_service::do_add_timer_queue(timer_queue_base& queue) &timeout, max_timeout_msec, 0, 0, FALSE); } - if (!timer_thread_) + if (!timer_thread_.get()) { timer_thread_function thread_function = { this }; timer_thread_.reset(new thread(thread_function, 65536)); @@ -471,7 +481,7 @@ void win_iocp_io_service::do_remove_timer_queue(timer_queue_base& queue) void win_iocp_io_service::update_timeout() { - if (timer_thread_) + if (timer_thread_.get()) { // There's no point updating the waitable timer if the new timeout period // exceeds the maximum timeout. In that case, we might as well wait for the diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/win_iocp_serial_port_service.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/win_iocp_serial_port_service.ipp index 32ab6d1..e98ad87 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/win_iocp_serial_port_service.ipp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/win_iocp_serial_port_service.ipp @@ -2,7 +2,7 @@ // detail/impl/win_iocp_serial_port_service.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) // Copyright (c) 2008 Rep Invariant Systems, Inc. (info@repinvariant.com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -127,7 +127,7 @@ boost::system::error_code win_iocp_serial_port_service::do_set_option( ::DCB dcb; memset(&dcb, 0, sizeof(DCB)); dcb.DCBlength = sizeof(DCB); - if (!::GetCommState(handle_service_.native(impl), &dcb)) + if (!::GetCommState(handle_service_.native_handle(impl), &dcb)) { DWORD last_error = ::GetLastError(); ec = boost::system::error_code(last_error, @@ -138,7 +138,7 @@ boost::system::error_code win_iocp_serial_port_service::do_set_option( if (store(option, dcb, ec)) return ec; - if (!::SetCommState(handle_service_.native(impl), &dcb)) + if (!::SetCommState(handle_service_.native_handle(impl), &dcb)) { DWORD last_error = ::GetLastError(); ec = boost::system::error_code(last_error, @@ -160,7 +160,7 @@ boost::system::error_code win_iocp_serial_port_service::do_get_option( ::DCB dcb; memset(&dcb, 0, sizeof(DCB)); dcb.DCBlength = sizeof(DCB); - if (!::GetCommState(handle_service_.native(impl), &dcb)) + if (!::GetCommState(handle_service_.native_handle(impl), &dcb)) { DWORD last_error = ::GetLastError(); ec = boost::system::error_code(last_error, diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/win_iocp_socket_service_base.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/win_iocp_socket_service_base.ipp index 0a2825b..0466e33 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/win_iocp_socket_service_base.ipp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/win_iocp_socket_service_base.ipp @@ -2,7 +2,7 @@ // detail/impl/win_iocp_socket_service_base.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -69,6 +69,80 @@ void win_iocp_socket_service_base::construct( impl_list_ = &impl; } +void win_iocp_socket_service_base::base_move_construct( + win_iocp_socket_service_base::base_implementation_type& impl, + win_iocp_socket_service_base::base_implementation_type& other_impl) +{ + impl.socket_ = other_impl.socket_; + other_impl.socket_ = invalid_socket; + + impl.state_ = other_impl.state_; + other_impl.state_ = 0; + + impl.cancel_token_ = other_impl.cancel_token_; + other_impl.cancel_token_.reset(); + +#if defined(BOOST_ASIO_ENABLE_CANCELIO) + impl.safe_cancellation_thread_id_ = other_impl.safe_cancellation_thread_id_; + other_impl.safe_cancellation_thread_id_ = 0; +#endif // defined(BOOST_ASIO_ENABLE_CANCELIO) + + // Insert implementation into linked list of all implementations. + boost::asio::detail::mutex::scoped_lock lock(mutex_); + impl.next_ = impl_list_; + impl.prev_ = 0; + if (impl_list_) + impl_list_->prev_ = &impl; + impl_list_ = &impl; +} + +void win_iocp_socket_service_base::base_move_assign( + win_iocp_socket_service_base::base_implementation_type& impl, + win_iocp_socket_service_base& other_service, + win_iocp_socket_service_base::base_implementation_type& other_impl) +{ + close_for_destruction(impl); + + if (this != &other_service) + { + // Remove implementation from linked list of all implementations. + boost::asio::detail::mutex::scoped_lock lock(mutex_); + if (impl_list_ == &impl) + impl_list_ = impl.next_; + if (impl.prev_) + impl.prev_->next_ = impl.next_; + if (impl.next_) + impl.next_->prev_= impl.prev_; + impl.next_ = 0; + impl.prev_ = 0; + } + + impl.socket_ = other_impl.socket_; + other_impl.socket_ = invalid_socket; + + impl.state_ = other_impl.state_; + other_impl.state_ = 0; + + impl.cancel_token_ = other_impl.cancel_token_; + other_impl.cancel_token_.reset(); + +#if defined(BOOST_ASIO_ENABLE_CANCELIO) + impl.safe_cancellation_thread_id_ = other_impl.safe_cancellation_thread_id_; + other_impl.safe_cancellation_thread_id_ = 0; +#endif // defined(BOOST_ASIO_ENABLE_CANCELIO) + + if (this != &other_service) + { + // Insert implementation into linked list of all implementations. + boost::asio::detail::mutex::scoped_lock lock(other_service.mutex_); + impl.next_ = other_service.impl_list_; + impl.prev_ = 0; + if (other_service.impl_list_) + other_service.impl_list_->prev_ = &impl; + other_service.impl_list_ = &impl; + } +} + void win_iocp_socket_service_base::destroy( win_iocp_socket_service_base::base_implementation_type& impl) { @@ -92,6 +166,8 @@ boost::system::error_code win_iocp_socket_service_base::close( { if (is_open(impl)) { + BOOST_ASIO_HANDLER_OPERATION(("socket", &impl, "close")); + // Check if the reactor was created, in which case we need to close the // socket on the reactor as well to cancel any operations that might be // running there. @@ -99,18 +175,17 @@ boost::system::error_code win_iocp_socket_service_base::close( interlocked_compare_exchange_pointer( reinterpret_cast<void**>(&reactor_), 0, 0)); if (r) - r->close_descriptor(impl.socket_, impl.reactor_data_); + r->deregister_descriptor(impl.socket_, impl.reactor_data_, true); } - if (socket_ops::close(impl.socket_, impl.state_, false, ec) == 0) - { - impl.socket_ = invalid_socket; - impl.state_ = 0; - impl.cancel_token_.reset(); + socket_ops::close(impl.socket_, impl.state_, false, ec); + + impl.socket_ = invalid_socket; + impl.state_ = 0; + impl.cancel_token_.reset(); #if defined(BOOST_ASIO_ENABLE_CANCELIO) - impl.safe_cancellation_thread_id_ = 0; + impl.safe_cancellation_thread_id_ = 0; #endif // defined(BOOST_ASIO_ENABLE_CANCELIO) - } return ec; } @@ -124,7 +199,10 @@ boost::system::error_code win_iocp_socket_service_base::cancel( ec = boost::asio::error::bad_descriptor; return ec; } - else if (FARPROC cancel_io_ex_ptr = ::GetProcAddress( + + BOOST_ASIO_HANDLER_OPERATION(("socket", &impl, "cancel")); + + if (FARPROC cancel_io_ex_ptr = ::GetProcAddress( ::GetModuleHandleA("KERNEL32"), "CancelIoEx")) { // The version of Windows supports cancellation from any thread. @@ -474,7 +552,7 @@ void win_iocp_socket_service_base::start_connect_op( if ((impl.state_ & socket_ops::non_blocking) != 0 || socket_ops::set_internal_non_blocking( - impl.socket_, impl.state_, op->ec_)) + impl.socket_, impl.state_, true, op->ec_)) { if (socket_ops::connect(impl.socket_, addr, addrlen, op->ec_) != 0) { @@ -497,6 +575,8 @@ void win_iocp_socket_service_base::close_for_destruction( { if (is_open(impl)) { + BOOST_ASIO_HANDLER_OPERATION(("socket", &impl, "close")); + // Check if the reactor was created, in which case we need to close the // socket on the reactor as well to cancel any operations that might be // running there. @@ -504,7 +584,7 @@ void win_iocp_socket_service_base::close_for_destruction( interlocked_compare_exchange_pointer( reinterpret_cast<void**>(&reactor_), 0, 0)); if (r) - r->close_descriptor(impl.socket_, impl.reactor_data_); + r->deregister_descriptor(impl.socket_, impl.reactor_data_, true); } boost::system::error_code ignored_ec; diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/win_mutex.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/win_mutex.ipp index af0d20e..05a7492 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/win_mutex.ipp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/win_mutex.ipp @@ -2,7 +2,7 @@ // detail/impl/win_mutex.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/win_object_handle_service.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/win_object_handle_service.ipp new file mode 100644 index 0000000..d91ccac --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/detail/impl/win_object_handle_service.ipp @@ -0,0 +1,446 @@ +// +// detail/impl/win_object_handle_service.ipp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2011 Boris Schaeling (boris@highscore.de) +// +// 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_ASIO_DETAIL_IMPL_WIN_OBJECT_HANDLE_SERVICE_IPP +#define BOOST_ASIO_DETAIL_IMPL_WIN_OBJECT_HANDLE_SERVICE_IPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> + +#if defined(BOOST_ASIO_HAS_WINDOWS_OBJECT_HANDLE) + +#include <boost/asio/detail/win_object_handle_service.hpp> + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { +namespace detail { + +win_object_handle_service::win_object_handle_service( + boost::asio::io_service& io_service) + : io_service_(boost::asio::use_service<io_service_impl>(io_service)), + mutex_(), + impl_list_(0), + shutdown_(false) +{ +} + +void win_object_handle_service::shutdown_service() +{ + mutex::scoped_lock lock(mutex_); + + // Setting this flag to true prevents new objects from being registered, and + // new asynchronous wait operations from being started. We only need to worry + // about cleaning up the operations that are currently in progress. + shutdown_ = true; + + op_queue<operation> ops; + for (implementation_type* impl = impl_list_; impl; impl = impl->next_) + ops.push(impl->op_queue_); + + lock.unlock(); + + io_service_.abandon_operations(ops); +} + +void win_object_handle_service::construct( + win_object_handle_service::implementation_type& impl) +{ + impl.handle_ = INVALID_HANDLE_VALUE; + impl.wait_handle_ = INVALID_HANDLE_VALUE; + impl.owner_ = this; + + // Insert implementation into linked list of all implementations. + mutex::scoped_lock lock(mutex_); + if (!shutdown_) + { + impl.next_ = impl_list_; + impl.prev_ = 0; + if (impl_list_) + impl_list_->prev_ = &impl; + impl_list_ = &impl; + } +} + +void win_object_handle_service::move_construct( + win_object_handle_service::implementation_type& impl, + win_object_handle_service::implementation_type& other_impl) +{ + mutex::scoped_lock lock(mutex_); + + // Insert implementation into linked list of all implementations. + if (!shutdown_) + { + impl.next_ = impl_list_; + impl.prev_ = 0; + if (impl_list_) + impl_list_->prev_ = &impl; + impl_list_ = &impl; + } + + impl.handle_ = other_impl.handle_; + other_impl.handle_ = INVALID_HANDLE_VALUE; + impl.wait_handle_ = other_impl.wait_handle_; + other_impl.wait_handle_ = INVALID_HANDLE_VALUE; + impl.op_queue_.push(other_impl.op_queue_); + impl.owner_ = this; + + // We must not hold the lock while calling UnregisterWaitEx. This is because + // the registered callback function might be invoked while we are waiting for + // UnregisterWaitEx to complete. + lock.unlock(); + + if (impl.wait_handle_ != INVALID_HANDLE_VALUE) + ::UnregisterWaitEx(impl.wait_handle_, INVALID_HANDLE_VALUE); + + if (!impl.op_queue_.empty()) + register_wait_callback(impl, lock); +} + +void win_object_handle_service::move_assign( + win_object_handle_service::implementation_type& impl, + win_object_handle_service& other_service, + win_object_handle_service::implementation_type& other_impl) +{ + boost::system::error_code ignored_ec; + close(impl, ignored_ec); + + mutex::scoped_lock lock(mutex_); + + if (this != &other_service) + { + // Remove implementation from linked list of all implementations. + if (impl_list_ == &impl) + impl_list_ = impl.next_; + if (impl.prev_) + impl.prev_->next_ = impl.next_; + if (impl.next_) + impl.next_->prev_= impl.prev_; + impl.next_ = 0; + impl.prev_ = 0; + } + + impl.handle_ = other_impl.handle_; + other_impl.handle_ = INVALID_HANDLE_VALUE; + impl.wait_handle_ = other_impl.wait_handle_; + other_impl.wait_handle_ = INVALID_HANDLE_VALUE; + impl.op_queue_.push(other_impl.op_queue_); + impl.owner_ = this; + + if (this != &other_service) + { + // Insert implementation into linked list of all implementations. + impl.next_ = other_service.impl_list_; + impl.prev_ = 0; + if (other_service.impl_list_) + other_service.impl_list_->prev_ = &impl; + other_service.impl_list_ = &impl; + } + + // We must not hold the lock while calling UnregisterWaitEx. This is because + // the registered callback function might be invoked while we are waiting for + // UnregisterWaitEx to complete. + lock.unlock(); + + if (impl.wait_handle_ != INVALID_HANDLE_VALUE) + ::UnregisterWaitEx(impl.wait_handle_, INVALID_HANDLE_VALUE); + + if (!impl.op_queue_.empty()) + register_wait_callback(impl, lock); +} + +void win_object_handle_service::destroy( + win_object_handle_service::implementation_type& impl) +{ + mutex::scoped_lock lock(mutex_); + + // Remove implementation from linked list of all implementations. + if (impl_list_ == &impl) + impl_list_ = impl.next_; + if (impl.prev_) + impl.prev_->next_ = impl.next_; + if (impl.next_) + impl.next_->prev_= impl.prev_; + impl.next_ = 0; + impl.prev_ = 0; + + if (is_open(impl)) + { + BOOST_ASIO_HANDLER_OPERATION(("object_handle", &impl, "close")); + + HANDLE wait_handle = impl.wait_handle_; + impl.wait_handle_ = INVALID_HANDLE_VALUE; + + op_queue<operation> ops; + while (wait_op* op = impl.op_queue_.front()) + { + op->ec_ = boost::asio::error::operation_aborted; + impl.op_queue_.pop(); + ops.push(op); + } + + // We must not hold the lock while calling UnregisterWaitEx. This is + // because the registered callback function might be invoked while we are + // waiting for UnregisterWaitEx to complete. + lock.unlock(); + + if (wait_handle != INVALID_HANDLE_VALUE) + ::UnregisterWaitEx(wait_handle, INVALID_HANDLE_VALUE); + + ::CloseHandle(impl.handle_); + impl.handle_ = INVALID_HANDLE_VALUE; + + io_service_.post_deferred_completions(ops); + } +} + +boost::system::error_code win_object_handle_service::assign( + win_object_handle_service::implementation_type& impl, + const native_handle_type& handle, boost::system::error_code& ec) +{ + if (is_open(impl)) + { + ec = boost::asio::error::already_open; + return ec; + } + + impl.handle_ = handle; + ec = boost::system::error_code(); + return ec; +} + +boost::system::error_code win_object_handle_service::close( + win_object_handle_service::implementation_type& impl, + boost::system::error_code& ec) +{ + if (is_open(impl)) + { + BOOST_ASIO_HANDLER_OPERATION(("object_handle", &impl, "close")); + + mutex::scoped_lock lock(mutex_); + + HANDLE wait_handle = impl.wait_handle_; + impl.wait_handle_ = INVALID_HANDLE_VALUE; + + op_queue<operation> completed_ops; + while (wait_op* op = impl.op_queue_.front()) + { + impl.op_queue_.pop(); + op->ec_ = boost::asio::error::operation_aborted; + completed_ops.push(op); + } + + // We must not hold the lock while calling UnregisterWaitEx. This is + // because the registered callback function might be invoked while we are + // waiting for UnregisterWaitEx to complete. + lock.unlock(); + + if (wait_handle != INVALID_HANDLE_VALUE) + ::UnregisterWaitEx(wait_handle, INVALID_HANDLE_VALUE); + + if (::CloseHandle(impl.handle_)) + { + impl.handle_ = INVALID_HANDLE_VALUE; + ec = boost::system::error_code(); + } + else + { + DWORD last_error = ::GetLastError(); + ec = boost::system::error_code(last_error, + boost::asio::error::get_system_category()); + } + + io_service_.post_deferred_completions(completed_ops); + } + else + { + ec = boost::system::error_code(); + } + + return ec; +} + +boost::system::error_code win_object_handle_service::cancel( + win_object_handle_service::implementation_type& impl, + boost::system::error_code& ec) +{ + if (is_open(impl)) + { + BOOST_ASIO_HANDLER_OPERATION(("object_handle", &impl, "cancel")); + + mutex::scoped_lock lock(mutex_); + + HANDLE wait_handle = impl.wait_handle_; + impl.wait_handle_ = INVALID_HANDLE_VALUE; + + op_queue<operation> completed_ops; + while (wait_op* op = impl.op_queue_.front()) + { + op->ec_ = boost::asio::error::operation_aborted; + impl.op_queue_.pop(); + completed_ops.push(op); + } + + // We must not hold the lock while calling UnregisterWaitEx. This is + // because the registered callback function might be invoked while we are + // waiting for UnregisterWaitEx to complete. + lock.unlock(); + + if (wait_handle != INVALID_HANDLE_VALUE) + ::UnregisterWaitEx(wait_handle, INVALID_HANDLE_VALUE); + + ec = boost::system::error_code(); + + io_service_.post_deferred_completions(completed_ops); + } + else + { + ec = boost::asio::error::bad_descriptor; + } + + return ec; +} + +void win_object_handle_service::wait( + win_object_handle_service::implementation_type& impl, + boost::system::error_code& ec) +{ + switch (::WaitForSingleObject(impl.handle_, INFINITE)) + { + case WAIT_FAILED: + { + DWORD last_error = ::GetLastError(); + ec = boost::system::error_code(last_error, + boost::asio::error::get_system_category()); + break; + } + case WAIT_OBJECT_0: + case WAIT_ABANDONED: + default: + ec = boost::system::error_code(); + break; + } +} + +void win_object_handle_service::start_wait_op( + win_object_handle_service::implementation_type& impl, wait_op* op) +{ + io_service_.work_started(); + + if (is_open(impl)) + { + mutex::scoped_lock lock(mutex_); + + if (!shutdown_) + { + impl.op_queue_.push(op); + + // Only the first operation to be queued gets to register a wait callback. + // Subsequent operations have to wait for the first to finish. + if (impl.op_queue_.front() == op) + register_wait_callback(impl, lock); + } + else + { + lock.unlock(); + io_service_.post_deferred_completion(op); + } + } + else + { + op->ec_ = boost::asio::error::bad_descriptor; + io_service_.post_deferred_completion(op); + } +} + +void win_object_handle_service::register_wait_callback( + win_object_handle_service::implementation_type& impl, + mutex::scoped_lock& lock) +{ + lock.lock(); + + if (!RegisterWaitForSingleObject(&impl.wait_handle_, + impl.handle_, &win_object_handle_service::wait_callback, + &impl, INFINITE, WT_EXECUTEONLYONCE)) + { + DWORD last_error = ::GetLastError(); + boost::system::error_code ec(last_error, + boost::asio::error::get_system_category()); + + op_queue<operation> completed_ops; + while (wait_op* op = impl.op_queue_.front()) + { + op->ec_ = ec; + impl.op_queue_.pop(); + completed_ops.push(op); + } + + lock.unlock(); + io_service_.post_deferred_completions(completed_ops); + } +} + +void win_object_handle_service::wait_callback(PVOID param, BOOLEAN) +{ + implementation_type* impl = static_cast<implementation_type*>(param); + mutex::scoped_lock lock(impl->owner_->mutex_); + + if (impl->wait_handle_ != INVALID_HANDLE_VALUE) + { + ::UnregisterWaitEx(impl->wait_handle_, NULL); + impl->wait_handle_ = INVALID_HANDLE_VALUE; + } + + if (wait_op* op = impl->op_queue_.front()) + { + op_queue<operation> completed_ops; + + op->ec_ = boost::system::error_code(); + impl->op_queue_.pop(); + completed_ops.push(op); + + if (!impl->op_queue_.empty()) + { + if (!RegisterWaitForSingleObject(&impl->wait_handle_, + impl->handle_, &win_object_handle_service::wait_callback, + param, INFINITE, WT_EXECUTEONLYONCE)) + { + DWORD last_error = ::GetLastError(); + boost::system::error_code ec(last_error, + boost::asio::error::get_system_category()); + + while (wait_op* op = impl->op_queue_.front()) + { + op->ec_ = ec; + impl->op_queue_.pop(); + completed_ops.push(op); + } + } + } + + lock.unlock(); + impl->owner_->io_service_.post_deferred_completions(completed_ops); + } +} + +} // namespace detail +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#endif // defined(BOOST_ASIO_HAS_WINDOWS_OBJECT_HANDLE) + +#endif // BOOST_ASIO_DETAIL_IMPL_WIN_OBJECT_HANDLE_SERVICE_IPP diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/win_static_mutex.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/win_static_mutex.ipp new file mode 100644 index 0000000..3ec104d --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/detail/impl/win_static_mutex.ipp @@ -0,0 +1,120 @@ +// +// detail/impl/win_static_mutex.ipp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) +// + +#ifndef BOOST_ASIO_DETAIL_IMPL_WIN_STATIC_MUTEX_IPP +#define BOOST_ASIO_DETAIL_IMPL_WIN_STATIC_MUTEX_IPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> + +#if defined(BOOST_WINDOWS) + +#include <cstdio> +#include <boost/asio/detail/throw_error.hpp> +#include <boost/asio/detail/win_static_mutex.hpp> +#include <boost/asio/error.hpp> + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { +namespace detail { + +void win_static_mutex::init() +{ + int error = do_init(); + boost::system::error_code ec(error, + boost::asio::error::get_system_category()); + boost::asio::detail::throw_error(ec, "static_mutex"); +} + +int win_static_mutex::do_init() +{ + using namespace std; // For sprintf. + wchar_t mutex_name[128]; +#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(UNDER_CE) + swprintf_s(mutex_name, 128, +#else // BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(UNDER_CE) + swprintf(mutex_name, +#endif // BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(UNDER_CE) + L"asio-58CCDC44-6264-4842-90C2-F3C545CB8AA7-%u-%p", + static_cast<unsigned int>(::GetCurrentProcessId()), this); + + HANDLE mutex = ::CreateMutexW(0, TRUE, mutex_name); + DWORD last_error = ::GetLastError(); + if (mutex == 0) + return ::GetLastError(); + + if (last_error == ERROR_ALREADY_EXISTS) + ::WaitForSingleObject(mutex, INFINITE); + + if (initialised_) + { + ::ReleaseMutex(mutex); + ::CloseHandle(mutex); + return 0; + } + +#if defined(__MINGW32__) + // Not sure if MinGW supports structured exception handling, so for now + // we'll just call the Windows API and hope. +# if defined(UNDER_CE) + ::InitializeCriticalSection(&crit_section_); +# else + if (!::InitializeCriticalSectionAndSpinCount(&crit_section_, 0x80000000)) + { + last_error = ::GetLastError(); + ::ReleaseMutex(mutex); + ::CloseHandle(mutex); + return last_error; + } +# endif +#else + __try + { +# if defined(UNDER_CE) + ::InitializeCriticalSection(&crit_section_); +# else + if (!::InitializeCriticalSectionAndSpinCount(&crit_section_, 0x80000000)) + { + last_error = ::GetLastError(); + ::ReleaseMutex(mutex); + ::CloseHandle(mutex); + return last_error; + } +# endif + } + __except(GetExceptionCode() == STATUS_NO_MEMORY + ? EXCEPTION_EXECUTE_HANDLER : EXCEPTION_CONTINUE_SEARCH) + { + ::ReleaseMutex(mutex); + ::CloseHandle(mutex); + return ERROR_OUTOFMEMORY; + } +#endif + + initialised_ = true; + ::ReleaseMutex(mutex); + ::CloseHandle(mutex); + return 0; +} + +} // namespace detail +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#endif // defined(BOOST_WINDOWS) + +#endif // BOOST_ASIO_DETAIL_IMPL_WIN_STATIC_MUTEX_IPP diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/win_thread.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/win_thread.ipp index 07cc5c2..744990d 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/win_thread.ipp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/win_thread.ipp @@ -2,7 +2,7 @@ // detail/impl/win_thread.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -102,12 +102,12 @@ void win_thread::start_thread(func_base* arg, unsigned int stack_size) unsigned int __stdcall win_thread_function(void* arg) { - std::auto_ptr<win_thread::func_base> func( - static_cast<win_thread::func_base*>(arg)); + win_thread::auto_func_base_ptr func = { + static_cast<win_thread::func_base*>(arg) }; - ::SetEvent(func->entry_event_); + ::SetEvent(func.ptr->entry_event_); - func->run(); + func.ptr->run(); // Signal that the thread has finished its work, but rather than returning go // to sleep to put the thread into a well known state. If the thread is being @@ -115,8 +115,9 @@ unsigned int __stdcall win_thread_function(void* arg) // TerminateThread (to avoid a deadlock in DllMain). Otherwise, the SleepEx // call will be interrupted using QueueUserAPC and the thread will shut down // cleanly. - HANDLE exit_event = func->exit_event_; - func.reset(); + HANDLE exit_event = func.ptr->exit_event_; + delete func.ptr; + func.ptr = 0; ::SetEvent(exit_event); ::SleepEx(INFINITE, TRUE); diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/win_tss_ptr.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/win_tss_ptr.ipp index 02abd55..9da761c 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/win_tss_ptr.ipp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/win_tss_ptr.ipp @@ -2,7 +2,7 @@ // detail/impl/win_tss_ptr.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/impl/winsock_init.ipp b/3rdParty/Boost/src/boost/asio/detail/impl/winsock_init.ipp index e8fd647..8916934 100644 --- a/3rdParty/Boost/src/boost/asio/detail/impl/winsock_init.ipp +++ b/3rdParty/Boost/src/boost/asio/detail/impl/winsock_init.ipp @@ -2,7 +2,7 @@ // detail/impl/winsock_init.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/io_control.hpp b/3rdParty/Boost/src/boost/asio/detail/io_control.hpp index c63e6e5..e08a4fc 100644 --- a/3rdParty/Boost/src/boost/asio/detail/io_control.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/io_control.hpp @@ -2,7 +2,7 @@ // detail/io_control.hpp // ~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -46,7 +46,7 @@ public: // Get the name of the IO control command. int name() const { - return FIONBIO; + return static_cast<int>(FIONBIO); } // Set the value of the I/O control command. @@ -96,7 +96,7 @@ public: // Get the name of the IO control command. int name() const { - return FIONREAD; + return static_cast<int>(FIONREAD); } // Set the value of the I/O control command. diff --git a/3rdParty/Boost/src/boost/asio/detail/keyword_tss_ptr.hpp b/3rdParty/Boost/src/boost/asio/detail/keyword_tss_ptr.hpp new file mode 100644 index 0000000..10dd01a --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/detail/keyword_tss_ptr.hpp @@ -0,0 +1,72 @@ +// +// detail/keyword_tss_ptr.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) +// + +#ifndef BOOST_ASIO_DETAIL_KEYWORD_TSS_PTR_HPP +#define BOOST_ASIO_DETAIL_KEYWORD_TSS_PTR_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> + +#if defined(BOOST_ASIO_HAS_THREAD_KEYWORD_EXTENSION) + +#include <boost/asio/detail/noncopyable.hpp> + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { +namespace detail { + +template <typename T> +class keyword_tss_ptr + : private noncopyable +{ +public: + // Constructor. + keyword_tss_ptr() + { + } + + // Destructor. + ~keyword_tss_ptr() + { + } + + // Get the value. + operator T*() const + { + return value_; + } + + // Set the value. + void operator=(T* value) + { + value_ = value; + } + +private: + static __thread T* value_; +}; + +template <typename T> +__thread T* keyword_tss_ptr<T>::value_; + +} // namespace detail +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#endif // defined(BOOST_ASIO_HAS_THREAD_KEYWORD_EXTENSION) + +#endif // BOOST_ASIO_DETAIL_KEYWORD_TSS_PTR_HPP diff --git a/3rdParty/Boost/src/boost/asio/detail/kqueue_reactor.hpp b/3rdParty/Boost/src/boost/asio/detail/kqueue_reactor.hpp index 80f7ca3..b3e111d 100644 --- a/3rdParty/Boost/src/boost/asio/detail/kqueue_reactor.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/kqueue_reactor.hpp @@ -2,7 +2,7 @@ // detail/kqueue_reactor.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) // Copyright (c) 2005 Stefan Arentz (stefan at soze dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -20,6 +20,7 @@ #if defined(BOOST_ASIO_HAS_KQUEUE) +#include <boost/limits.hpp> #include <cstddef> #include <sys/types.h> #include <sys/event.h> @@ -31,10 +32,10 @@ #include <boost/asio/detail/reactor_op.hpp> #include <boost/asio/detail/select_interrupter.hpp> #include <boost/asio/detail/socket_types.hpp> -#include <boost/asio/detail/timer_op.hpp> #include <boost/asio/detail/timer_queue_base.hpp> #include <boost/asio/detail/timer_queue_fwd.hpp> #include <boost/asio/detail/timer_queue_set.hpp> +#include <boost/asio/detail/wait_op.hpp> #include <boost/asio/error.hpp> #include <boost/asio/io_service.hpp> @@ -61,11 +62,14 @@ public: { friend class kqueue_reactor; friend class object_pool_access; + + descriptor_state* next_; + descriptor_state* prev_; + mutex mutex_; + int descriptor_; op_queue<reactor_op> op_queue_[max_ops]; bool shutdown_; - descriptor_state* next_; - descriptor_state* prev_; }; // Per-descriptor data. @@ -80,6 +84,10 @@ public: // Destroy all user-defined handler objects owned by the service. BOOST_ASIO_DECL void shutdown_service(); + // Recreate internal descriptors following a fork. + BOOST_ASIO_DECL void fork_service( + boost::asio::io_service::fork_event fork_ev); + // Initialise the task. BOOST_ASIO_DECL void init_task(); @@ -88,6 +96,17 @@ public: BOOST_ASIO_DECL int register_descriptor(socket_type descriptor, per_descriptor_data& descriptor_data); + // Register a descriptor with an associated single operation. Returns 0 on + // success, system error code on failure. + BOOST_ASIO_DECL int register_internal_descriptor( + int op_type, socket_type descriptor, + per_descriptor_data& descriptor_data, reactor_op* op); + + // Move descriptor registration from one descriptor_data object to another. + BOOST_ASIO_DECL void move_descriptor(socket_type descriptor, + per_descriptor_data& target_descriptor_data, + per_descriptor_data& source_descriptor_data); + // Post a reactor operation for immediate completion. void post_immediate_completion(reactor_op* op) { @@ -108,8 +127,12 @@ public: // Cancel any operations that are running against the descriptor and remove // its registration from the reactor. - BOOST_ASIO_DECL void close_descriptor(socket_type descriptor, - per_descriptor_data& descriptor_data); + BOOST_ASIO_DECL void deregister_descriptor(socket_type descriptor, + per_descriptor_data& descriptor_data, bool closing); + + // Remote the descriptor's registration from the reactor. + BOOST_ASIO_DECL void deregister_internal_descriptor( + socket_type descriptor, per_descriptor_data& descriptor_data); // Add a new timer queue to the reactor. template <typename Time_Traits> @@ -124,13 +147,14 @@ public: template <typename Time_Traits> void schedule_timer(timer_queue<Time_Traits>& queue, const typename Time_Traits::time_type& time, - typename timer_queue<Time_Traits>::per_timer_data& timer, timer_op* op); + typename timer_queue<Time_Traits>::per_timer_data& timer, wait_op* op); // Cancel the timer operations associated with the given token. Returns the // number of operations that have been posted or dispatched. template <typename Time_Traits> std::size_t cancel_timer(timer_queue<Time_Traits>& queue, - typename timer_queue<Time_Traits>::per_timer_data& timer); + typename timer_queue<Time_Traits>::per_timer_data& timer, + std::size_t max_cancelled = (std::numeric_limits<std::size_t>::max)()); // Run the kqueue loop. BOOST_ASIO_DECL void run(bool block, op_queue<operation>& ops); @@ -143,6 +167,12 @@ private: // cannot be created. BOOST_ASIO_DECL static int do_kqueue_create(); + // Allocate a new descriptor state object. + BOOST_ASIO_DECL descriptor_state* allocate_descriptor_state(); + + // Free an existing descriptor state object. + BOOST_ASIO_DECL void free_descriptor_state(descriptor_state* s); + // Helper function to add a new timer queue. BOOST_ASIO_DECL void do_add_timer_queue(timer_queue_base& queue); diff --git a/3rdParty/Boost/src/boost/asio/detail/kqueue_reactor_fwd.hpp b/3rdParty/Boost/src/boost/asio/detail/kqueue_reactor_fwd.hpp index 1bceb30..517a307 100644 --- a/3rdParty/Boost/src/boost/asio/detail/kqueue_reactor_fwd.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/kqueue_reactor_fwd.hpp @@ -2,7 +2,7 @@ // detail/kqueue_reactor_fwd.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) // Copyright (c) 2005 Stefan Arentz (stefan at soze dot com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying diff --git a/3rdParty/Boost/src/boost/asio/detail/macos_fenced_block.hpp b/3rdParty/Boost/src/boost/asio/detail/macos_fenced_block.hpp index d37eea6..dc3b47d 100644 --- a/3rdParty/Boost/src/boost/asio/detail/macos_fenced_block.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/macos_fenced_block.hpp @@ -2,7 +2,7 @@ // detail/macos_fenced_block.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -31,8 +31,16 @@ class macos_fenced_block : private noncopyable { public: - // Constructor. - macos_fenced_block() + enum half_t { half }; + enum full_t { full }; + + // Constructor for a half fenced block. + explicit macos_fenced_block(half_t) + { + } + + // Constructor for a full fenced block. + explicit macos_fenced_block(full_t) { OSMemoryBarrier(); } diff --git a/3rdParty/Boost/src/boost/asio/detail/mutex.hpp b/3rdParty/Boost/src/boost/asio/detail/mutex.hpp index 988dd3a..bd3e0c6 100644 --- a/3rdParty/Boost/src/boost/asio/detail/mutex.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/mutex.hpp @@ -2,7 +2,7 @@ // detail/mutex.hpp // ~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/noncopyable.hpp b/3rdParty/Boost/src/boost/asio/detail/noncopyable.hpp index 234ce93..5f7e8cc 100644 --- a/3rdParty/Boost/src/boost/asio/detail/noncopyable.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/noncopyable.hpp @@ -2,7 +2,7 @@ // detail/noncopyable.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/null_event.hpp b/3rdParty/Boost/src/boost/asio/detail/null_event.hpp index 7f079ae..1130d18 100644 --- a/3rdParty/Boost/src/boost/asio/detail/null_event.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/null_event.hpp @@ -2,7 +2,7 @@ // detail/null_event.hpp // ~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/null_fenced_block.hpp b/3rdParty/Boost/src/boost/asio/detail/null_fenced_block.hpp index 70680c5..64bedec 100644 --- a/3rdParty/Boost/src/boost/asio/detail/null_fenced_block.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/null_fenced_block.hpp @@ -2,7 +2,7 @@ // detail/null_fenced_block.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -25,8 +25,10 @@ class null_fenced_block : private noncopyable { public: + enum half_or_full_t { half, full }; + // Constructor. - null_fenced_block() + explicit null_fenced_block(half_or_full_t) { } diff --git a/3rdParty/Boost/src/boost/asio/detail/null_mutex.hpp b/3rdParty/Boost/src/boost/asio/detail/null_mutex.hpp index e095e01..5d810bb 100644 --- a/3rdParty/Boost/src/boost/asio/detail/null_mutex.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/null_mutex.hpp @@ -2,7 +2,7 @@ // detail/null_mutex.hpp // ~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/null_signal_blocker.hpp b/3rdParty/Boost/src/boost/asio/detail/null_signal_blocker.hpp index bcf813b..5eeb293 100644 --- a/3rdParty/Boost/src/boost/asio/detail/null_signal_blocker.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/null_signal_blocker.hpp @@ -2,7 +2,7 @@ // detail/null_signal_blocker.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/null_static_mutex.hpp b/3rdParty/Boost/src/boost/asio/detail/null_static_mutex.hpp new file mode 100644 index 0000000..3032896 --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/detail/null_static_mutex.hpp @@ -0,0 +1,62 @@ +// +// detail/null_static_mutex.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) +// + +#ifndef BOOST_ASIO_DETAIL_NULL_STATIC_MUTEX_HPP +#define BOOST_ASIO_DETAIL_NULL_STATIC_MUTEX_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> + +#if !defined(BOOST_HAS_THREADS) || defined(BOOST_ASIO_DISABLE_THREADS) + +#include <boost/asio/detail/scoped_lock.hpp> + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { +namespace detail { + +struct null_static_mutex +{ + typedef boost::asio::detail::scoped_lock<null_static_mutex> scoped_lock; + + // Initialise the mutex. + void init() + { + } + + // Lock the mutex. + void lock() + { + } + + // Unlock the mutex. + void unlock() + { + } + + int unused_; +}; + +#define BOOST_ASIO_NULL_STATIC_MUTEX_INIT { 0 } + +} // namespace detail +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#endif // !defined(BOOST_HAS_THREADS) || defined(BOOST_ASIO_DISABLE_THREADS) + +#endif // BOOST_ASIO_DETAIL_NULL_STATIC_MUTEX_HPP diff --git a/3rdParty/Boost/src/boost/asio/detail/null_thread.hpp b/3rdParty/Boost/src/boost/asio/detail/null_thread.hpp index ae32014..0212dbe 100644 --- a/3rdParty/Boost/src/boost/asio/detail/null_thread.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/null_thread.hpp @@ -2,7 +2,7 @@ // detail/null_thread.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/null_tss_ptr.hpp b/3rdParty/Boost/src/boost/asio/detail/null_tss_ptr.hpp index c44b4de..07be3e6 100644 --- a/3rdParty/Boost/src/boost/asio/detail/null_tss_ptr.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/null_tss_ptr.hpp @@ -2,7 +2,7 @@ // detail/null_tss_ptr.hpp // ~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/object_pool.hpp b/3rdParty/Boost/src/boost/asio/detail/object_pool.hpp index 69790a0..d315236 100644 --- a/3rdParty/Boost/src/boost/asio/detail/object_pool.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/object_pool.hpp @@ -2,7 +2,7 @@ // detail/object_pool.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/old_win_sdk_compat.hpp b/3rdParty/Boost/src/boost/asio/detail/old_win_sdk_compat.hpp index d385d3e..fcc27cf 100644 --- a/3rdParty/Boost/src/boost/asio/detail/old_win_sdk_compat.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/old_win_sdk_compat.hpp @@ -2,7 +2,7 @@ // detail/old_win_sdk_compat.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -85,14 +85,6 @@ struct ipv6_mreq_emulation unsigned int ipv6mr_interface; }; -#if !defined(IN6ADDR_ANY_INIT) -# define IN6ADDR_ANY_INIT { 0 } -#endif - -#if !defined(IN6ADDR_LOOPBACK_INIT) -# define IN6ADDR_LOOPBACK_INIT { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1 } -#endif - struct addrinfo_emulation { int ai_flags; @@ -201,122 +193,6 @@ struct addrinfo_emulation # define IPV6_LEAVE_GROUP 13 #endif -inline int IN6_IS_ADDR_UNSPECIFIED(const in6_addr_emulation* a) -{ - return ((a->s6_addr[0] == 0) - && (a->s6_addr[1] == 0) - && (a->s6_addr[2] == 0) - && (a->s6_addr[3] == 0) - && (a->s6_addr[4] == 0) - && (a->s6_addr[5] == 0) - && (a->s6_addr[6] == 0) - && (a->s6_addr[7] == 0) - && (a->s6_addr[8] == 0) - && (a->s6_addr[9] == 0) - && (a->s6_addr[10] == 0) - && (a->s6_addr[11] == 0) - && (a->s6_addr[12] == 0) - && (a->s6_addr[13] == 0) - && (a->s6_addr[14] == 0) - && (a->s6_addr[15] == 0)); -} - -inline int IN6_IS_ADDR_LOOPBACK(const in6_addr_emulation* a) -{ - return ((a->s6_addr[0] == 0) - && (a->s6_addr[1] == 0) - && (a->s6_addr[2] == 0) - && (a->s6_addr[3] == 0) - && (a->s6_addr[4] == 0) - && (a->s6_addr[5] == 0) - && (a->s6_addr[6] == 0) - && (a->s6_addr[7] == 0) - && (a->s6_addr[8] == 0) - && (a->s6_addr[9] == 0) - && (a->s6_addr[10] == 0) - && (a->s6_addr[11] == 0) - && (a->s6_addr[12] == 0) - && (a->s6_addr[13] == 0) - && (a->s6_addr[14] == 0) - && (a->s6_addr[15] == 1)); -} - -inline int IN6_IS_ADDR_MULTICAST(const in6_addr_emulation* a) -{ - return (a->s6_addr[0] == 0xff); -} - -inline int IN6_IS_ADDR_LINKLOCAL(const in6_addr_emulation* a) -{ - return ((a->s6_addr[0] == 0xfe) && ((a->s6_addr[1] & 0xc0) == 0x80)); -} - -inline int IN6_IS_ADDR_SITELOCAL(const in6_addr_emulation* a) -{ - return ((a->s6_addr[0] == 0xfe) && ((a->s6_addr[1] & 0xc0) == 0xc0)); -} - -inline int IN6_IS_ADDR_V4MAPPED(const in6_addr_emulation* a) -{ - return ((a->s6_addr[0] == 0) - && (a->s6_addr[1] == 0) - && (a->s6_addr[2] == 0) - && (a->s6_addr[3] == 0) - && (a->s6_addr[4] == 0) - && (a->s6_addr[5] == 0) - && (a->s6_addr[6] == 0) - && (a->s6_addr[7] == 0) - && (a->s6_addr[8] == 0) - && (a->s6_addr[9] == 0) - && (a->s6_addr[10] == 0xff) - && (a->s6_addr[11] == 0xff)); -} - -inline int IN6_IS_ADDR_V4COMPAT(const in6_addr_emulation* a) -{ - return ((a->s6_addr[0] == 0) - && (a->s6_addr[1] == 0) - && (a->s6_addr[2] == 0) - && (a->s6_addr[3] == 0) - && (a->s6_addr[4] == 0) - && (a->s6_addr[5] == 0) - && (a->s6_addr[6] == 0) - && (a->s6_addr[7] == 0) - && (a->s6_addr[8] == 0) - && (a->s6_addr[9] == 0) - && (a->s6_addr[10] == 0xff) - && (a->s6_addr[11] == 0xff) - && !((a->s6_addr[12] == 0) - && (a->s6_addr[13] == 0) - && (a->s6_addr[14] == 0) - && ((a->s6_addr[15] == 0) || (a->s6_addr[15] == 1)))); -} - -inline int IN6_IS_ADDR_MC_NODELOCAL(const in6_addr_emulation* a) -{ - return IN6_IS_ADDR_MULTICAST(a) && ((a->s6_addr[1] & 0xf) == 1); -} - -inline int IN6_IS_ADDR_MC_LINKLOCAL(const in6_addr_emulation* a) -{ - return IN6_IS_ADDR_MULTICAST(a) && ((a->s6_addr[1] & 0xf) == 2); -} - -inline int IN6_IS_ADDR_MC_SITELOCAL(const in6_addr_emulation* a) -{ - return IN6_IS_ADDR_MULTICAST(a) && ((a->s6_addr[1] & 0xf) == 5); -} - -inline int IN6_IS_ADDR_MC_ORGLOCAL(const in6_addr_emulation* a) -{ - return IN6_IS_ADDR_MULTICAST(a) && ((a->s6_addr[1] & 0xf) == 8); -} - -inline int IN6_IS_ADDR_MC_GLOBAL(const in6_addr_emulation* a) -{ - return IN6_IS_ADDR_MULTICAST(a) && ((a->s6_addr[1] & 0xf) == 0xe); -} - } // namespace detail } // namespace asio } // namespace boost diff --git a/3rdParty/Boost/src/boost/asio/detail/op_queue.hpp b/3rdParty/Boost/src/boost/asio/detail/op_queue.hpp index d508e9d..ad61910 100644 --- a/3rdParty/Boost/src/boost/asio/detail/op_queue.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/op_queue.hpp @@ -2,7 +2,7 @@ // detail/op_queue.hpp // ~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/operation.hpp b/3rdParty/Boost/src/boost/asio/detail/operation.hpp index d2015e7..99371a9 100644 --- a/3rdParty/Boost/src/boost/asio/detail/operation.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/operation.hpp @@ -2,7 +2,7 @@ // detail/operation.hpp // ~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/pipe_select_interrupter.hpp b/3rdParty/Boost/src/boost/asio/detail/pipe_select_interrupter.hpp index ad32736..0aee2a2 100644 --- a/3rdParty/Boost/src/boost/asio/detail/pipe_select_interrupter.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/pipe_select_interrupter.hpp @@ -2,7 +2,7 @@ // detail/pipe_select_interrupter.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -37,6 +37,9 @@ public: // Destructor. BOOST_ASIO_DECL ~pipe_select_interrupter(); + // Recreate the interrupter's descriptors. Used after a fork. + BOOST_ASIO_DECL void recreate(); + // Interrupt the select call. BOOST_ASIO_DECL void interrupt(); @@ -50,6 +53,12 @@ public: } private: + // Open the descriptors. Throws on error. + BOOST_ASIO_DECL void open_descriptors(); + + // Close the descriptors. + BOOST_ASIO_DECL void close_descriptors(); + // The read end of a connection used to interrupt the select call. This file // descriptor is passed to select such that when it is time to stop, a single // byte will be written on the other end of the connection and this diff --git a/3rdParty/Boost/src/boost/asio/detail/pop_options.hpp b/3rdParty/Boost/src/boost/asio/detail/pop_options.hpp index 75afc2b..6e78ddf 100644 --- a/3rdParty/Boost/src/boost/asio/detail/pop_options.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/pop_options.hpp @@ -2,7 +2,7 @@ // detail/pop_options.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/posix_event.hpp b/3rdParty/Boost/src/boost/asio/detail/posix_event.hpp index dc2ed31..b77f384 100644 --- a/3rdParty/Boost/src/boost/asio/detail/posix_event.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/posix_event.hpp @@ -2,7 +2,7 @@ // detail/posix_event.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/posix_fd_set_adapter.hpp b/3rdParty/Boost/src/boost/asio/detail/posix_fd_set_adapter.hpp index b8be596..f6476e6 100644 --- a/3rdParty/Boost/src/boost/asio/detail/posix_fd_set_adapter.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/posix_fd_set_adapter.hpp @@ -2,7 +2,7 @@ // detail/posix_fd_set_adapter.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -20,6 +20,7 @@ #if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) #include <cstring> +#include <boost/asio/detail/noncopyable.hpp> #include <boost/asio/detail/socket_types.hpp> #include <boost/asio/detail/push_options.hpp> @@ -29,7 +30,7 @@ namespace asio { namespace detail { // Adapts the FD_SET type to meet the Descriptor_Set concept's requirements. -class posix_fd_set_adapter +class posix_fd_set_adapter : noncopyable { public: posix_fd_set_adapter() @@ -39,6 +40,12 @@ public: FD_ZERO(&fd_set_); } + void reset() + { + using namespace std; // Needed for memset on Solaris. + FD_ZERO(&fd_set_); + } + bool set(socket_type descriptor) { if (descriptor < (socket_type)FD_SETSIZE) diff --git a/3rdParty/Boost/src/boost/asio/detail/posix_mutex.hpp b/3rdParty/Boost/src/boost/asio/detail/posix_mutex.hpp index 5f5fd83..a456c2a 100644 --- a/3rdParty/Boost/src/boost/asio/detail/posix_mutex.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/posix_mutex.hpp @@ -2,7 +2,7 @@ // detail/posix_mutex.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/posix_signal_blocker.hpp b/3rdParty/Boost/src/boost/asio/detail/posix_signal_blocker.hpp index 88fa330..0347778 100644 --- a/3rdParty/Boost/src/boost/asio/detail/posix_signal_blocker.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/posix_signal_blocker.hpp @@ -2,7 +2,7 @@ // detail/posix_signal_blocker.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/posix_static_mutex.hpp b/3rdParty/Boost/src/boost/asio/detail/posix_static_mutex.hpp new file mode 100644 index 0000000..a27d9d8 --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/detail/posix_static_mutex.hpp @@ -0,0 +1,66 @@ +// +// detail/posix_static_mutex.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) +// + +#ifndef BOOST_ASIO_DETAIL_POSIX_STATIC_MUTEX_HPP +#define BOOST_ASIO_DETAIL_POSIX_STATIC_MUTEX_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> + +#if defined(BOOST_HAS_PTHREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) + +#include <pthread.h> +#include <boost/asio/detail/scoped_lock.hpp> + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { +namespace detail { + +struct posix_static_mutex +{ + typedef boost::asio::detail::scoped_lock<posix_static_mutex> scoped_lock; + + // Initialise the mutex. + void init() + { + // Nothing to do. + } + + // Lock the mutex. + void lock() + { + (void)::pthread_mutex_lock(&mutex_); // Ignore EINVAL. + } + + // Unlock the mutex. + void unlock() + { + (void)::pthread_mutex_unlock(&mutex_); // Ignore EINVAL. + } + + ::pthread_mutex_t mutex_; +}; + +#define BOOST_ASIO_POSIX_STATIC_MUTEX_INIT { PTHREAD_MUTEX_INITIALIZER } + +} // namespace detail +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#endif // defined(BOOST_HAS_PTHREADS) && !defined(BOOST_ASIO_DISABLE_THREADS) + +#endif // BOOST_ASIO_DETAIL_POSIX_STATIC_MUTEX_HPP diff --git a/3rdParty/Boost/src/boost/asio/detail/posix_thread.hpp b/3rdParty/Boost/src/boost/asio/detail/posix_thread.hpp index 5d8b684..44bf62c 100644 --- a/3rdParty/Boost/src/boost/asio/detail/posix_thread.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/posix_thread.hpp @@ -2,7 +2,7 @@ // detail/posix_thread.hpp // ~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -39,7 +39,7 @@ class posix_thread public: // Constructor. template <typename Function> - posix_thread(Function f) + posix_thread(Function f, unsigned int = 0) : joined_(false) { start_thread(new func<Function>(f)); diff --git a/3rdParty/Boost/src/boost/asio/detail/posix_tss_ptr.hpp b/3rdParty/Boost/src/boost/asio/detail/posix_tss_ptr.hpp index 2edcbc1..33ac502 100644 --- a/3rdParty/Boost/src/boost/asio/detail/posix_tss_ptr.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/posix_tss_ptr.hpp @@ -2,7 +2,7 @@ // detail/posix_tss_ptr.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/push_options.hpp b/3rdParty/Boost/src/boost/asio/detail/push_options.hpp index 050549d..fef517d 100644 --- a/3rdParty/Boost/src/boost/asio/detail/push_options.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/push_options.hpp @@ -2,7 +2,7 @@ // detail/push_options.hpp // ~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -100,6 +100,7 @@ # pragma warning (disable:4103) # pragma warning (push) # pragma warning (disable:4127) +# pragma warning (disable:4180) # pragma warning (disable:4244) # pragma warning (disable:4355) # pragma warning (disable:4512) diff --git a/3rdParty/Boost/src/boost/asio/detail/reactive_descriptor_service.hpp b/3rdParty/Boost/src/boost/asio/detail/reactive_descriptor_service.hpp index 510c505..5efb24b 100644 --- a/3rdParty/Boost/src/boost/asio/detail/reactive_descriptor_service.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/reactive_descriptor_service.hpp @@ -2,7 +2,7 @@ // detail/reactive_descriptor_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -42,7 +42,7 @@ class reactive_descriptor_service { public: // The native type of a descriptor. - typedef int native_type; + typedef int native_handle_type; // The implementation type of the descriptor. class implementation_type @@ -80,12 +80,22 @@ public: // Construct a new descriptor implementation. BOOST_ASIO_DECL void construct(implementation_type& impl); + // Move-construct a new descriptor implementation. + BOOST_ASIO_DECL void move_construct(implementation_type& impl, + implementation_type& other_impl); + + // Move-assign from another descriptor implementation. + BOOST_ASIO_DECL void move_assign(implementation_type& impl, + reactive_descriptor_service& other_service, + implementation_type& other_impl); + // Destroy a descriptor implementation. BOOST_ASIO_DECL void destroy(implementation_type& impl); // Assign a native descriptor to a descriptor implementation. BOOST_ASIO_DECL boost::system::error_code assign(implementation_type& impl, - const native_type& native_descriptor, boost::system::error_code& ec); + const native_handle_type& native_descriptor, + boost::system::error_code& ec); // Determine whether the descriptor is open. bool is_open(const implementation_type& impl) const @@ -98,11 +108,14 @@ public: boost::system::error_code& ec); // Get the native descriptor representation. - native_type native(const implementation_type& impl) const + native_handle_type native_handle(const implementation_type& impl) const { return impl.descriptor_; } + // Release ownership of the native descriptor representation. + BOOST_ASIO_DECL native_handle_type release(implementation_type& impl); + // Cancel all operations associated with the descriptor. BOOST_ASIO_DECL boost::system::error_code cancel(implementation_type& impl, boost::system::error_code& ec); @@ -117,6 +130,36 @@ public: return ec; } + // Gets the non-blocking mode of the descriptor. + bool non_blocking(const implementation_type& impl) const + { + return (impl.state_ & descriptor_ops::user_set_non_blocking) != 0; + } + + // Sets the non-blocking mode of the descriptor. + boost::system::error_code non_blocking(implementation_type& impl, + bool mode, boost::system::error_code& ec) + { + descriptor_ops::set_user_non_blocking( + impl.descriptor_, impl.state_, mode, ec); + return ec; + } + + // Gets the non-blocking mode of the native descriptor implementation. + bool native_non_blocking(const implementation_type& impl) const + { + return (impl.state_ & descriptor_ops::internal_non_blocking) != 0; + } + + // Sets the non-blocking mode of the native descriptor implementation. + boost::system::error_code native_non_blocking(implementation_type& impl, + bool mode, boost::system::error_code& ec) + { + descriptor_ops::set_internal_non_blocking( + impl.descriptor_, impl.state_, mode, ec); + return ec; + } + // Write some data to the descriptor. template <typename ConstBufferSequence> size_t write_some(implementation_type& impl, @@ -134,7 +177,7 @@ public: const null_buffers&, boost::system::error_code& ec) { // Wait for descriptor to become ready. - descriptor_ops::poll_write(impl.descriptor_, ec); + descriptor_ops::poll_write(impl.descriptor_, impl.state_, ec); return 0; } @@ -152,6 +195,8 @@ public: sizeof(op), handler), 0 }; p.p = new (p.v) op(impl.descriptor_, buffers, handler); + BOOST_ASIO_HANDLER_CREATION((p.p, "descriptor", &impl, "async_write_some")); + start_op(impl, reactor::write_op, p.p, true, buffer_sequence_adapter<boost::asio::const_buffer, ConstBufferSequence>::all_empty(buffers)); @@ -170,6 +215,9 @@ public: sizeof(op), handler), 0 }; p.p = new (p.v) op(handler); + BOOST_ASIO_HANDLER_CREATION((p.p, "descriptor", + &impl, "async_write_some(null_buffers)")); + start_op(impl, reactor::write_op, p.p, false, false); p.v = p.p = 0; } @@ -191,7 +239,7 @@ public: const null_buffers&, boost::system::error_code& ec) { // Wait for descriptor to become ready. - descriptor_ops::poll_read(impl.descriptor_, ec); + descriptor_ops::poll_read(impl.descriptor_, impl.state_, ec); return 0; } @@ -209,6 +257,8 @@ public: sizeof(op), handler), 0 }; p.p = new (p.v) op(impl.descriptor_, buffers, handler); + BOOST_ASIO_HANDLER_CREATION((p.p, "descriptor", &impl, "async_read_some")); + start_op(impl, reactor::read_op, p.p, true, buffer_sequence_adapter<boost::asio::mutable_buffer, MutableBufferSequence>::all_empty(buffers)); @@ -227,6 +277,9 @@ public: sizeof(op), handler), 0 }; p.p = new (p.v) op(handler); + BOOST_ASIO_HANDLER_CREATION((p.p, "descriptor", + &impl, "async_read_some(null_buffers)")); + start_op(impl, reactor::read_op, p.p, false, false); p.v = p.p = 0; } @@ -234,7 +287,7 @@ public: private: // Start the asynchronous operation. BOOST_ASIO_DECL void start_op(implementation_type& impl, int op_type, - reactor_op* op, bool non_blocking, bool noop); + reactor_op* op, bool is_non_blocking, bool noop); // The selector that performs event demultiplexing for the service. reactor& reactor_; diff --git a/3rdParty/Boost/src/boost/asio/detail/reactive_null_buffers_op.hpp b/3rdParty/Boost/src/boost/asio/detail/reactive_null_buffers_op.hpp index 6ccc19e..3881e96 100644 --- a/3rdParty/Boost/src/boost/asio/detail/reactive_null_buffers_op.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/reactive_null_buffers_op.hpp @@ -2,7 +2,7 @@ // detail/reactive_null_buffers_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -34,10 +34,10 @@ class reactive_null_buffers_op : public reactor_op public: BOOST_ASIO_DEFINE_HANDLER_PTR(reactive_null_buffers_op); - reactive_null_buffers_op(Handler handler) + reactive_null_buffers_op(Handler& handler) : reactor_op(&reactive_null_buffers_op::do_perform, &reactive_null_buffers_op::do_complete), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)) { } @@ -47,12 +47,15 @@ public: } static void do_complete(io_service_impl* owner, operation* base, - boost::system::error_code /*ec*/, std::size_t /*bytes_transferred*/) + const boost::system::error_code& /*ec*/, + std::size_t /*bytes_transferred*/) { // Take ownership of the handler object. reactive_null_buffers_op* o(static_cast<reactive_null_buffers_op*>(base)); ptr p = { boost::addressof(o->handler_), o, o }; + BOOST_ASIO_HANDLER_COMPLETION((o)); + // Make a copy of the handler so that the memory can be deallocated before // the upcall is made. Even if we're not about to make an upcall, a // sub-object of the handler may be the true owner of the memory associated @@ -67,8 +70,10 @@ public: // Make the upcall if required. if (owner) { - boost::asio::detail::fenced_block b; + fenced_block b(fenced_block::half); + BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_)); boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_); + BOOST_ASIO_HANDLER_INVOCATION_END; } } diff --git a/3rdParty/Boost/src/boost/asio/detail/reactive_serial_port_service.hpp b/3rdParty/Boost/src/boost/asio/detail/reactive_serial_port_service.hpp index 303c1f0..a32088f 100644 --- a/3rdParty/Boost/src/boost/asio/detail/reactive_serial_port_service.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/reactive_serial_port_service.hpp @@ -2,7 +2,7 @@ // detail/reactive_serial_port_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) // Copyright (c) 2008 Rep Invariant Systems, Inc. (info@repinvariant.com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -39,7 +39,7 @@ class reactive_serial_port_service { public: // The native type of a serial port. - typedef reactive_descriptor_service::native_type native_type; + typedef reactive_descriptor_service::native_handle_type native_handle_type; // The implementation type of the serial port. typedef reactive_descriptor_service::implementation_type implementation_type; @@ -56,6 +56,22 @@ public: descriptor_service_.construct(impl); } + // Move-construct a new serial port implementation. + void move_construct(implementation_type& impl, + implementation_type& other_impl) + { + descriptor_service_.move_construct(impl, other_impl); + } + + // Move-assign from another serial port implementation. + void move_assign(implementation_type& impl, + reactive_serial_port_service& other_service, + implementation_type& other_impl) + { + descriptor_service_.move_assign(impl, + other_service.descriptor_service_, other_impl); + } + // Destroy a serial port implementation. void destroy(implementation_type& impl) { @@ -68,7 +84,8 @@ public: // Assign a native descriptor to a serial port implementation. boost::system::error_code assign(implementation_type& impl, - const native_type& native_descriptor, boost::system::error_code& ec) + const native_handle_type& native_descriptor, + boost::system::error_code& ec) { return descriptor_service_.assign(impl, native_descriptor, ec); } @@ -87,9 +104,9 @@ public: } // Get the native serial port representation. - native_type native(implementation_type& impl) + native_handle_type native_handle(implementation_type& impl) { - return descriptor_service_.native(impl); + return descriptor_service_.native_handle(impl); } // Cancel all operations associated with the serial port. @@ -125,7 +142,7 @@ public: { errno = 0; descriptor_ops::error_wrapper(::tcsendbreak( - descriptor_service_.native(impl), 0), ec); + descriptor_service_.native_handle(impl), 0), ec); return ec; } diff --git a/3rdParty/Boost/src/boost/asio/detail/reactive_socket_accept_op.hpp b/3rdParty/Boost/src/boost/asio/detail/reactive_socket_accept_op.hpp index 3805c9f..d80bdea 100644 --- a/3rdParty/Boost/src/boost/asio/detail/reactive_socket_accept_op.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/reactive_socket_accept_op.hpp @@ -2,7 +2,7 @@ // detail/reactive_socket_accept_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -87,20 +87,23 @@ public: reactive_socket_accept_op(socket_type socket, socket_ops::state_type state, Socket& peer, const Protocol& protocol, - typename Protocol::endpoint* peer_endpoint, Handler handler) + typename Protocol::endpoint* peer_endpoint, Handler& handler) : reactive_socket_accept_op_base<Socket, Protocol>(socket, state, peer, protocol, peer_endpoint, &reactive_socket_accept_op::do_complete), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)) { } static void do_complete(io_service_impl* owner, operation* base, - boost::system::error_code /*ec*/, std::size_t /*bytes_transferred*/) + const boost::system::error_code& /*ec*/, + std::size_t /*bytes_transferred*/) { // Take ownership of the handler object. reactive_socket_accept_op* o(static_cast<reactive_socket_accept_op*>(base)); ptr p = { boost::addressof(o->handler_), o, o }; + BOOST_ASIO_HANDLER_COMPLETION((o)); + // Make a copy of the handler so that the memory can be deallocated before // the upcall is made. Even if we're not about to make an upcall, a // sub-object of the handler may be the true owner of the memory associated @@ -115,8 +118,10 @@ public: // Make the upcall if required. if (owner) { - boost::asio::detail::fenced_block b; + fenced_block b(fenced_block::half); + BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_)); boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_); + BOOST_ASIO_HANDLER_INVOCATION_END; } } diff --git a/3rdParty/Boost/src/boost/asio/detail/reactive_socket_connect_op.hpp b/3rdParty/Boost/src/boost/asio/detail/reactive_socket_connect_op.hpp index 6de7474..6463a03 100644 --- a/3rdParty/Boost/src/boost/asio/detail/reactive_socket_connect_op.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/reactive_socket_connect_op.hpp @@ -2,7 +2,7 @@ // detail/reactive_socket_connect_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -56,21 +56,24 @@ class reactive_socket_connect_op : public reactive_socket_connect_op_base public: BOOST_ASIO_DEFINE_HANDLER_PTR(reactive_socket_connect_op); - reactive_socket_connect_op(socket_type socket, Handler handler) + reactive_socket_connect_op(socket_type socket, Handler& handler) : reactive_socket_connect_op_base(socket, &reactive_socket_connect_op::do_complete), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)) { } static void do_complete(io_service_impl* owner, operation* base, - boost::system::error_code /*ec*/, std::size_t /*bytes_transferred*/) + const boost::system::error_code& /*ec*/, + std::size_t /*bytes_transferred*/) { // Take ownership of the handler object. reactive_socket_connect_op* o (static_cast<reactive_socket_connect_op*>(base)); ptr p = { boost::addressof(o->handler_), o, o }; + BOOST_ASIO_HANDLER_COMPLETION((o)); + // Make a copy of the handler so that the memory can be deallocated before // the upcall is made. Even if we're not about to make an upcall, a // sub-object of the handler may be the true owner of the memory associated @@ -85,8 +88,10 @@ public: // Make the upcall if required. if (owner) { - boost::asio::detail::fenced_block b; + fenced_block b(fenced_block::half); + BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_)); boost_asio_handler_invoke_helpers::invoke(handler, handler); + BOOST_ASIO_HANDLER_INVOCATION_END; } } diff --git a/3rdParty/Boost/src/boost/asio/detail/reactive_socket_recv_op.hpp b/3rdParty/Boost/src/boost/asio/detail/reactive_socket_recv_op.hpp index 75ce44f..8814c1e 100644 --- a/3rdParty/Boost/src/boost/asio/detail/reactive_socket_recv_op.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/reactive_socket_recv_op.hpp @@ -2,7 +2,7 @@ // detail/reactive_socket_recv_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -54,7 +54,7 @@ public: return socket_ops::non_blocking_recv(o->socket_, bufs.buffers(), bufs.count(), o->flags_, - (o->state_ & socket_ops::stream_oriented), + (o->state_ & socket_ops::stream_oriented) != 0, o->ec_, o->bytes_transferred_); } @@ -74,20 +74,23 @@ public: reactive_socket_recv_op(socket_type socket, socket_ops::state_type state, const MutableBufferSequence& buffers, - socket_base::message_flags flags, Handler handler) + socket_base::message_flags flags, Handler& handler) : reactive_socket_recv_op_base<MutableBufferSequence>(socket, state, buffers, flags, &reactive_socket_recv_op::do_complete), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)) { } static void do_complete(io_service_impl* owner, operation* base, - boost::system::error_code /*ec*/, std::size_t /*bytes_transferred*/) + const boost::system::error_code& /*ec*/, + std::size_t /*bytes_transferred*/) { // Take ownership of the handler object. reactive_socket_recv_op* o(static_cast<reactive_socket_recv_op*>(base)); ptr p = { boost::addressof(o->handler_), o, o }; + BOOST_ASIO_HANDLER_COMPLETION((o)); + // Make a copy of the handler so that the memory can be deallocated before // the upcall is made. Even if we're not about to make an upcall, a // sub-object of the handler may be the true owner of the memory associated @@ -102,8 +105,10 @@ public: // Make the upcall if required. if (owner) { - boost::asio::detail::fenced_block b; + fenced_block b(fenced_block::half); + BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_)); boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_); + BOOST_ASIO_HANDLER_INVOCATION_END; } } diff --git a/3rdParty/Boost/src/boost/asio/detail/reactive_socket_recvfrom_op.hpp b/3rdParty/Boost/src/boost/asio/detail/reactive_socket_recvfrom_op.hpp index b496ea0..a6b37e4 100644 --- a/3rdParty/Boost/src/boost/asio/detail/reactive_socket_recvfrom_op.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/reactive_socket_recvfrom_op.hpp @@ -2,7 +2,7 @@ // detail/reactive_socket_recvfrom_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -82,22 +82,25 @@ public: reactive_socket_recvfrom_op(socket_type socket, int protocol_type, const MutableBufferSequence& buffers, Endpoint& endpoint, - socket_base::message_flags flags, Handler handler) + socket_base::message_flags flags, Handler& handler) : reactive_socket_recvfrom_op_base<MutableBufferSequence, Endpoint>( socket, protocol_type, buffers, endpoint, flags, &reactive_socket_recvfrom_op::do_complete), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)) { } static void do_complete(io_service_impl* owner, operation* base, - boost::system::error_code /*ec*/, std::size_t /*bytes_transferred*/) + const boost::system::error_code& /*ec*/, + std::size_t /*bytes_transferred*/) { // Take ownership of the handler object. reactive_socket_recvfrom_op* o( static_cast<reactive_socket_recvfrom_op*>(base)); ptr p = { boost::addressof(o->handler_), o, o }; + BOOST_ASIO_HANDLER_COMPLETION((o)); + // Make a copy of the handler so that the memory can be deallocated before // the upcall is made. Even if we're not about to make an upcall, a // sub-object of the handler may be the true owner of the memory associated @@ -112,8 +115,10 @@ public: // Make the upcall if required. if (owner) { - boost::asio::detail::fenced_block b; + fenced_block b(fenced_block::half); + BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_)); boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_); + BOOST_ASIO_HANDLER_INVOCATION_END; } } diff --git a/3rdParty/Boost/src/boost/asio/detail/reactive_socket_recvmsg_op.hpp b/3rdParty/Boost/src/boost/asio/detail/reactive_socket_recvmsg_op.hpp new file mode 100644 index 0000000..e9c2483 --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/detail/reactive_socket_recvmsg_op.hpp @@ -0,0 +1,127 @@ +// +// detail/reactive_socket_recvmsg_op.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) +// + +#ifndef BOOST_ASIO_DETAIL_REACTIVE_SOCKET_RECVMSG_OP_HPP +#define BOOST_ASIO_DETAIL_REACTIVE_SOCKET_RECVMSG_OP_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> +#include <boost/utility/addressof.hpp> +#include <boost/asio/detail/bind_handler.hpp> +#include <boost/asio/detail/buffer_sequence_adapter.hpp> +#include <boost/asio/detail/fenced_block.hpp> +#include <boost/asio/detail/reactor_op.hpp> +#include <boost/asio/detail/socket_ops.hpp> +#include <boost/asio/socket_base.hpp> + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { +namespace detail { + +template <typename MutableBufferSequence> +class reactive_socket_recvmsg_op_base : public reactor_op +{ +public: + reactive_socket_recvmsg_op_base(socket_type socket, + const MutableBufferSequence& buffers, socket_base::message_flags in_flags, + socket_base::message_flags& out_flags, func_type complete_func) + : reactor_op(&reactive_socket_recvmsg_op_base::do_perform, complete_func), + socket_(socket), + buffers_(buffers), + in_flags_(in_flags), + out_flags_(out_flags) + { + } + + static bool do_perform(reactor_op* base) + { + reactive_socket_recvmsg_op_base* o( + static_cast<reactive_socket_recvmsg_op_base*>(base)); + + buffer_sequence_adapter<boost::asio::mutable_buffer, + MutableBufferSequence> bufs(o->buffers_); + + return socket_ops::non_blocking_recvmsg(o->socket_, + bufs.buffers(), bufs.count(), + o->in_flags_, o->out_flags_, + o->ec_, o->bytes_transferred_); + } + +private: + socket_type socket_; + MutableBufferSequence buffers_; + socket_base::message_flags in_flags_; + socket_base::message_flags& out_flags_; +}; + +template <typename MutableBufferSequence, typename Handler> +class reactive_socket_recvmsg_op : + public reactive_socket_recvmsg_op_base<MutableBufferSequence> +{ +public: + BOOST_ASIO_DEFINE_HANDLER_PTR(reactive_socket_recvmsg_op); + + reactive_socket_recvmsg_op(socket_type socket, + const MutableBufferSequence& buffers, socket_base::message_flags in_flags, + socket_base::message_flags& out_flags, Handler& handler) + : reactive_socket_recvmsg_op_base<MutableBufferSequence>(socket, buffers, + in_flags, out_flags, &reactive_socket_recvmsg_op::do_complete), + handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)) + { + } + + static void do_complete(io_service_impl* owner, operation* base, + const boost::system::error_code& /*ec*/, + std::size_t /*bytes_transferred*/) + { + // Take ownership of the handler object. + reactive_socket_recvmsg_op* o( + static_cast<reactive_socket_recvmsg_op*>(base)); + ptr p = { boost::addressof(o->handler_), o, o }; + + BOOST_ASIO_HANDLER_COMPLETION((o)); + + // Make a copy of the handler so that the memory can be deallocated before + // the upcall is made. Even if we're not about to make an upcall, a + // sub-object of the handler may be the true owner of the memory associated + // with the handler. Consequently, a local copy of the handler is required + // to ensure that any owning sub-object remains valid until after we have + // deallocated the memory here. + detail::binder2<Handler, boost::system::error_code, std::size_t> + handler(o->handler_, o->ec_, o->bytes_transferred_); + p.h = boost::addressof(handler.handler_); + p.reset(); + + // Make the upcall if required. + if (owner) + { + fenced_block b(fenced_block::half); + BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_)); + boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_); + BOOST_ASIO_HANDLER_INVOCATION_END; + } + } + +private: + Handler handler_; +}; + +} // namespace detail +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#endif // BOOST_ASIO_DETAIL_REACTIVE_SOCKET_RECVMSG_OP_HPP diff --git a/3rdParty/Boost/src/boost/asio/detail/reactive_socket_send_op.hpp b/3rdParty/Boost/src/boost/asio/detail/reactive_socket_send_op.hpp index 2fe195e..b1c3f65 100644 --- a/3rdParty/Boost/src/boost/asio/detail/reactive_socket_send_op.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/reactive_socket_send_op.hpp @@ -2,7 +2,7 @@ // detail/reactive_socket_send_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -71,20 +71,23 @@ public: reactive_socket_send_op(socket_type socket, const ConstBufferSequence& buffers, - socket_base::message_flags flags, Handler handler) + socket_base::message_flags flags, Handler& handler) : reactive_socket_send_op_base<ConstBufferSequence>(socket, buffers, flags, &reactive_socket_send_op::do_complete), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)) { } static void do_complete(io_service_impl* owner, operation* base, - boost::system::error_code /*ec*/, std::size_t /*bytes_transferred*/) + const boost::system::error_code& /*ec*/, + std::size_t /*bytes_transferred*/) { // Take ownership of the handler object. reactive_socket_send_op* o(static_cast<reactive_socket_send_op*>(base)); ptr p = { boost::addressof(o->handler_), o, o }; + BOOST_ASIO_HANDLER_COMPLETION((o)); + // Make a copy of the handler so that the memory can be deallocated before // the upcall is made. Even if we're not about to make an upcall, a // sub-object of the handler may be the true owner of the memory associated @@ -99,8 +102,10 @@ public: // Make the upcall if required. if (owner) { - boost::asio::detail::fenced_block b; + fenced_block b(fenced_block::half); + BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_)); boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_); + BOOST_ASIO_HANDLER_INVOCATION_END; } } diff --git a/3rdParty/Boost/src/boost/asio/detail/reactive_socket_sendto_op.hpp b/3rdParty/Boost/src/boost/asio/detail/reactive_socket_sendto_op.hpp index 12046c3..08396a0 100644 --- a/3rdParty/Boost/src/boost/asio/detail/reactive_socket_sendto_op.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/reactive_socket_sendto_op.hpp @@ -2,7 +2,7 @@ // detail/reactive_socket_sendto_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -74,20 +74,23 @@ public: reactive_socket_sendto_op(socket_type socket, const ConstBufferSequence& buffers, const Endpoint& endpoint, - socket_base::message_flags flags, Handler handler) + socket_base::message_flags flags, Handler& handler) : reactive_socket_sendto_op_base<ConstBufferSequence, Endpoint>(socket, buffers, endpoint, flags, &reactive_socket_sendto_op::do_complete), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)) { } static void do_complete(io_service_impl* owner, operation* base, - boost::system::error_code /*ec*/, std::size_t /*bytes_transferred*/) + const boost::system::error_code& /*ec*/, + std::size_t /*bytes_transferred*/) { // Take ownership of the handler object. reactive_socket_sendto_op* o(static_cast<reactive_socket_sendto_op*>(base)); ptr p = { boost::addressof(o->handler_), o, o }; + BOOST_ASIO_HANDLER_COMPLETION((o)); + // Make a copy of the handler so that the memory can be deallocated before // the upcall is made. Even if we're not about to make an upcall, a // sub-object of the handler may be the true owner of the memory associated @@ -102,8 +105,10 @@ public: // Make the upcall if required. if (owner) { - boost::asio::detail::fenced_block b; + fenced_block b(fenced_block::half); + BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_)); boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_); + BOOST_ASIO_HANDLER_INVOCATION_END; } } diff --git a/3rdParty/Boost/src/boost/asio/detail/reactive_socket_service.hpp b/3rdParty/Boost/src/boost/asio/detail/reactive_socket_service.hpp index 92eef4a..f66e25f 100644 --- a/3rdParty/Boost/src/boost/asio/detail/reactive_socket_service.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/reactive_socket_service.hpp @@ -2,7 +2,7 @@ // detail/reactive_socket_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -56,7 +56,7 @@ public: typedef typename Protocol::endpoint endpoint_type; // The native type of a socket. - typedef socket_type native_type; + typedef socket_type native_handle_type; // The implementation type of the socket. struct implementation_type : @@ -78,6 +78,27 @@ public: { } + // Move-construct a new socket implementation. + void move_construct(implementation_type& impl, + implementation_type& other_impl) + { + this->base_move_construct(impl, other_impl); + + impl.protocol_ = other_impl.protocol_; + other_impl.protocol_ = endpoint_type().protocol(); + } + + // Move-assign from another socket implementation. + void move_assign(implementation_type& impl, + reactive_socket_service_base& other_service, + implementation_type& other_impl) + { + this->base_move_assign(impl, other_service, other_impl); + + impl.protocol_ = other_impl.protocol_; + other_impl.protocol_ = endpoint_type().protocol(); + } + // Open a new socket implementation. boost::system::error_code open(implementation_type& impl, const protocol_type& protocol, boost::system::error_code& ec) @@ -90,7 +111,7 @@ public: // Assign a native socket to a socket implementation. boost::system::error_code assign(implementation_type& impl, - const protocol_type& protocol, const native_type& native_socket, + const protocol_type& protocol, const native_handle_type& native_socket, boost::system::error_code& ec) { if (!do_assign(impl, protocol.type(), native_socket, ec)) @@ -99,7 +120,7 @@ public: } // Get the native socket representation. - native_type native(implementation_type& impl) + native_handle_type native_handle(implementation_type& impl) { return impl.socket_; } @@ -183,7 +204,7 @@ public: boost::system::error_code& ec) { // Wait for socket to become ready. - socket_ops::poll_write(impl.socket_, ec); + socket_ops::poll_write(impl.socket_, impl.state_, ec); return 0; } @@ -204,6 +225,8 @@ public: sizeof(op), handler), 0 }; p.p = new (p.v) op(impl.socket_, buffers, destination, flags, handler); + BOOST_ASIO_HANDLER_CREATION((p.p, "socket", &impl, "async_send_to")); + start_op(impl, reactor::write_op, p.p, true, false); p.v = p.p = 0; } @@ -220,6 +243,9 @@ public: sizeof(op), handler), 0 }; p.p = new (p.v) op(handler); + BOOST_ASIO_HANDLER_CREATION((p.p, "socket", + &impl, "async_send_to(null_buffers)")); + start_op(impl, reactor::write_op, p.p, false, false); p.v = p.p = 0; } @@ -252,7 +278,7 @@ public: boost::system::error_code& ec) { // Wait for socket to become ready. - socket_ops::poll_read(impl.socket_, ec); + socket_ops::poll_read(impl.socket_, impl.state_, ec); // Reset endpoint since it can be given no sensible value at this time. sender_endpoint = endpoint_type(); @@ -274,10 +300,13 @@ public: typename op::ptr p = { boost::addressof(handler), boost_asio_handler_alloc_helpers::allocate( sizeof(op), handler), 0 }; - int protocol_type = impl.protocol_.type(); - p.p = new (p.v) op(impl.socket_, protocol_type, + int protocol = impl.protocol_.type(); + p.p = new (p.v) op(impl.socket_, protocol, buffers, sender_endpoint, flags, handler); + BOOST_ASIO_HANDLER_CREATION((p.p, "socket", + &impl, "async_receive_from")); + start_op(impl, (flags & socket_base::message_out_of_band) ? reactor::except_op : reactor::read_op, @@ -298,6 +327,9 @@ public: sizeof(op), handler), 0 }; p.p = new (p.v) op(handler); + BOOST_ASIO_HANDLER_CREATION((p.p, "socket", + &impl, "async_receive_from(null_buffers)")); + // Reset endpoint since it can be given no sensible value at this time. sender_endpoint = endpoint_type(); @@ -351,6 +383,8 @@ public: p.p = new (p.v) op(impl.socket_, impl.state_, peer, impl.protocol_, peer_endpoint, handler); + BOOST_ASIO_HANDLER_CREATION((p.p, "socket", &impl, "async_accept")); + start_accept_op(impl, p.p, peer.is_open()); p.v = p.p = 0; } @@ -376,6 +410,8 @@ public: sizeof(op), handler), 0 }; p.p = new (p.v) op(impl.socket_, handler); + BOOST_ASIO_HANDLER_CREATION((p.p, "socket", &impl, "async_connect")); + start_connect_op(impl, p.p, peer_endpoint.data(), peer_endpoint.size()); p.v = p.p = 0; } diff --git a/3rdParty/Boost/src/boost/asio/detail/reactive_socket_service_base.hpp b/3rdParty/Boost/src/boost/asio/detail/reactive_socket_service_base.hpp index df87ddb..0180435 100644 --- a/3rdParty/Boost/src/boost/asio/detail/reactive_socket_service_base.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/reactive_socket_service_base.hpp @@ -2,7 +2,7 @@ // detail/reactive_socket_service_base.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -27,6 +27,7 @@ #include <boost/asio/detail/buffer_sequence_adapter.hpp> #include <boost/asio/detail/reactive_null_buffers_op.hpp> #include <boost/asio/detail/reactive_socket_recv_op.hpp> +#include <boost/asio/detail/reactive_socket_recvmsg_op.hpp> #include <boost/asio/detail/reactive_socket_send_op.hpp> #include <boost/asio/detail/reactor.hpp> #include <boost/asio/detail/reactor_op.hpp> @@ -44,7 +45,7 @@ class reactive_socket_service_base { public: // The native type of a socket. - typedef socket_type native_type; + typedef socket_type native_handle_type; // The implementation type of the socket. struct base_implementation_type @@ -69,6 +70,15 @@ public: // Construct a new socket implementation. BOOST_ASIO_DECL void construct(base_implementation_type& impl); + // Move-construct a new socket implementation. + BOOST_ASIO_DECL void base_move_construct(base_implementation_type& impl, + base_implementation_type& other_impl); + + // Move-assign from another socket implementation. + BOOST_ASIO_DECL void base_move_assign(base_implementation_type& impl, + reactive_socket_service_base& other_service, + base_implementation_type& other_impl); + // Destroy a socket implementation. BOOST_ASIO_DECL void destroy(base_implementation_type& impl); @@ -83,7 +93,7 @@ public: base_implementation_type& impl, boost::system::error_code& ec); // Get the native socket representation. - native_type native(base_implementation_type& impl) + native_handle_type native_handle(base_implementation_type& impl) { return impl.socket_; } @@ -124,7 +134,35 @@ public: return ec; } - /// Disable sends or receives on the socket. + // Gets the non-blocking mode of the socket. + bool non_blocking(const base_implementation_type& impl) const + { + return (impl.state_ & socket_ops::user_set_non_blocking) != 0; + } + + // Sets the non-blocking mode of the socket. + boost::system::error_code non_blocking(base_implementation_type& impl, + bool mode, boost::system::error_code& ec) + { + socket_ops::set_user_non_blocking(impl.socket_, impl.state_, mode, ec); + return ec; + } + + // Gets the non-blocking mode of the native socket implementation. + bool native_non_blocking(const base_implementation_type& impl) const + { + return (impl.state_ & socket_ops::internal_non_blocking) != 0; + } + + // Sets the non-blocking mode of the native socket implementation. + boost::system::error_code native_non_blocking(base_implementation_type& impl, + bool mode, boost::system::error_code& ec) + { + socket_ops::set_internal_non_blocking(impl.socket_, impl.state_, mode, ec); + return ec; + } + + // Disable sends or receives on the socket. boost::system::error_code shutdown(base_implementation_type& impl, socket_base::shutdown_type what, boost::system::error_code& ec) { @@ -150,7 +188,7 @@ public: socket_base::message_flags, boost::system::error_code& ec) { // Wait for socket to become ready. - socket_ops::poll_write(impl.socket_, ec); + socket_ops::poll_write(impl.socket_, impl.state_, ec); return 0; } @@ -169,6 +207,8 @@ public: sizeof(op), handler), 0 }; p.p = new (p.v) op(impl.socket_, buffers, flags, handler); + BOOST_ASIO_HANDLER_CREATION((p.p, "socket", &impl, "async_send")); + start_op(impl, reactor::write_op, p.p, true, ((impl.state_ & socket_ops::stream_oriented) && buffer_sequence_adapter<boost::asio::const_buffer, @@ -188,6 +228,9 @@ public: sizeof(op), handler), 0 }; p.p = new (p.v) op(handler); + BOOST_ASIO_HANDLER_CREATION((p.p, "socket", + &impl, "async_send(null_buffers)")); + start_op(impl, reactor::write_op, p.p, false, false); p.v = p.p = 0; } @@ -210,7 +253,7 @@ public: socket_base::message_flags, boost::system::error_code& ec) { // Wait for socket to become ready. - socket_ops::poll_read(impl.socket_, ec); + socket_ops::poll_read(impl.socket_, impl.state_, ec); return 0; } @@ -229,6 +272,8 @@ public: sizeof(op), handler), 0 }; p.p = new (p.v) op(impl.socket_, impl.state_, buffers, flags, handler); + BOOST_ASIO_HANDLER_CREATION((p.p, "socket", &impl, "async_receive")); + start_op(impl, (flags & socket_base::message_out_of_band) ? reactor::except_op : reactor::read_op, @@ -251,6 +296,9 @@ public: sizeof(op), handler), 0 }; p.p = new (p.v) op(handler); + BOOST_ASIO_HANDLER_CREATION((p.p, "socket", + &impl, "async_receive(null_buffers)")); + start_op(impl, (flags & socket_base::message_out_of_band) ? reactor::except_op : reactor::read_op, @@ -258,6 +306,87 @@ public: p.v = p.p = 0; } + // Receive some data with associated flags. Returns the number of bytes + // received. + template <typename MutableBufferSequence> + size_t receive_with_flags(base_implementation_type& impl, + const MutableBufferSequence& buffers, + socket_base::message_flags in_flags, + socket_base::message_flags& out_flags, boost::system::error_code& ec) + { + buffer_sequence_adapter<boost::asio::mutable_buffer, + MutableBufferSequence> bufs(buffers); + + return socket_ops::sync_recvmsg(impl.socket_, impl.state_, + bufs.buffers(), bufs.count(), in_flags, out_flags, ec); + } + + // Wait until data can be received without blocking. + size_t receive_with_flags(base_implementation_type& impl, + const null_buffers&, socket_base::message_flags, + socket_base::message_flags& out_flags, boost::system::error_code& ec) + { + // Wait for socket to become ready. + socket_ops::poll_read(impl.socket_, impl.state_, ec); + + // Clear out_flags, since we cannot give it any other sensible value when + // performing a null_buffers operation. + out_flags = 0; + + return 0; + } + + // Start an asynchronous receive. The buffer for the data being received + // must be valid for the lifetime of the asynchronous operation. + template <typename MutableBufferSequence, typename Handler> + void async_receive_with_flags(base_implementation_type& impl, + const MutableBufferSequence& buffers, socket_base::message_flags in_flags, + socket_base::message_flags& out_flags, Handler handler) + { + // Allocate and construct an operation to wrap the handler. + typedef reactive_socket_recvmsg_op<MutableBufferSequence, Handler> op; + typename op::ptr p = { boost::addressof(handler), + boost_asio_handler_alloc_helpers::allocate( + sizeof(op), handler), 0 }; + p.p = new (p.v) op(impl.socket_, buffers, in_flags, out_flags, handler); + + BOOST_ASIO_HANDLER_CREATION((p.p, "socket", + &impl, "async_receive_with_flags")); + + start_op(impl, + (in_flags & socket_base::message_out_of_band) + ? reactor::except_op : reactor::read_op, + p.p, (in_flags & socket_base::message_out_of_band) == 0, false); + p.v = p.p = 0; + } + + // Wait until data can be received without blocking. + template <typename Handler> + void async_receive_with_flags(base_implementation_type& impl, + const null_buffers&, socket_base::message_flags in_flags, + socket_base::message_flags& out_flags, Handler handler) + { + // Allocate and construct an operation to wrap the handler. + typedef reactive_null_buffers_op<Handler> op; + typename op::ptr p = { boost::addressof(handler), + boost_asio_handler_alloc_helpers::allocate( + sizeof(op), handler), 0 }; + p.p = new (p.v) op(handler); + + BOOST_ASIO_HANDLER_CREATION((p.p, "socket", &impl, + "async_receive_with_flags(null_buffers)")); + + // Clear out_flags, since we cannot give it any other sensible value when + // performing a null_buffers operation. + out_flags = 0; + + start_op(impl, + (in_flags & socket_base::message_out_of_band) + ? reactor::except_op : reactor::read_op, + p.p, false, false); + p.v = p.p = 0; + } + protected: // Open a new socket implementation. BOOST_ASIO_DECL boost::system::error_code do_open( @@ -267,11 +396,11 @@ protected: // Assign a native socket to a socket implementation. BOOST_ASIO_DECL boost::system::error_code do_assign( base_implementation_type& impl, int type, - const native_type& native_socket, boost::system::error_code& ec); + const native_handle_type& native_socket, boost::system::error_code& ec); // Start the asynchronous read or write operation. BOOST_ASIO_DECL void start_op(base_implementation_type& impl, int op_type, - reactor_op* op, bool non_blocking, bool noop); + reactor_op* op, bool is_non_blocking, bool noop); // Start the asynchronous accept operation. BOOST_ASIO_DECL void start_accept_op(base_implementation_type& impl, diff --git a/3rdParty/Boost/src/boost/asio/detail/reactor.hpp b/3rdParty/Boost/src/boost/asio/detail/reactor.hpp index f225ea0..7e28679 100644 --- a/3rdParty/Boost/src/boost/asio/detail/reactor.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/reactor.hpp @@ -2,7 +2,7 @@ // detail/reactor.hpp // ~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/reactor_fwd.hpp b/3rdParty/Boost/src/boost/asio/detail/reactor_fwd.hpp index a4ff94a..7ea119e 100644 --- a/3rdParty/Boost/src/boost/asio/detail/reactor_fwd.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/reactor_fwd.hpp @@ -2,7 +2,7 @@ // detail/reactor_fwd.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/reactor_op.hpp b/3rdParty/Boost/src/boost/asio/detail/reactor_op.hpp index 0c8271c..3b8e7f9 100644 --- a/3rdParty/Boost/src/boost/asio/detail/reactor_op.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/reactor_op.hpp @@ -2,7 +2,7 @@ // detail/reactor_op.hpp // ~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/reactor_op_queue.hpp b/3rdParty/Boost/src/boost/asio/detail/reactor_op_queue.hpp index 02b8ea2..692a2ee 100644 --- a/3rdParty/Boost/src/boost/asio/detail/reactor_op_queue.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/reactor_op_queue.hpp @@ -2,7 +2,7 @@ // detail/reactor_op_queue.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/regex_fwd.hpp b/3rdParty/Boost/src/boost/asio/detail/regex_fwd.hpp index d61ad61..679146e 100644 --- a/3rdParty/Boost/src/boost/asio/detail/regex_fwd.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/regex_fwd.hpp @@ -2,7 +2,7 @@ // detail/regex_fwd.hpp // ~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/resolve_endpoint_op.hpp b/3rdParty/Boost/src/boost/asio/detail/resolve_endpoint_op.hpp index 46acda3..e6c901a 100644 --- a/3rdParty/Boost/src/boost/asio/detail/resolve_endpoint_op.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/resolve_endpoint_op.hpp @@ -2,7 +2,7 @@ // detail/resolve_endpoint_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -43,17 +43,18 @@ public: typedef boost::asio::ip::basic_resolver_iterator<Protocol> iterator_type; resolve_endpoint_op(socket_ops::weak_cancel_token_type cancel_token, - const endpoint_type& endpoint, io_service_impl& ios, Handler handler) + const endpoint_type& endpoint, io_service_impl& ios, Handler& handler) : operation(&resolve_endpoint_op::do_complete), cancel_token_(cancel_token), endpoint_(endpoint), io_service_impl_(ios), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)) { } static void do_complete(io_service_impl* owner, operation* base, - boost::system::error_code /*ec*/, std::size_t /*bytes_transferred*/) + const boost::system::error_code& /*ec*/, + std::size_t /*bytes_transferred*/) { // Take ownership of the operation object. resolve_endpoint_op* o(static_cast<resolve_endpoint_op*>(base)); @@ -81,6 +82,8 @@ public: // The operation has been returned to the main io_service. The completion // handler is ready to be delivered. + BOOST_ASIO_HANDLER_COMPLETION((o)); + // Make a copy of the handler so that the memory can be deallocated // before the upcall is made. Even if we're not about to make an upcall, // a sub-object of the handler may be the true owner of the memory @@ -94,8 +97,10 @@ public: if (owner) { - boost::asio::detail::fenced_block b; + fenced_block b(fenced_block::half); + BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, "...")); boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_); + BOOST_ASIO_HANDLER_INVOCATION_END; } } } diff --git a/3rdParty/Boost/src/boost/asio/detail/resolve_op.hpp b/3rdParty/Boost/src/boost/asio/detail/resolve_op.hpp index 379ec39..b640979 100644 --- a/3rdParty/Boost/src/boost/asio/detail/resolve_op.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/resolve_op.hpp @@ -2,7 +2,7 @@ // detail/resolve_op.hpp // ~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -44,12 +44,12 @@ public: typedef boost::asio::ip::basic_resolver_iterator<Protocol> iterator_type; resolve_op(socket_ops::weak_cancel_token_type cancel_token, - const query_type& query, io_service_impl& ios, Handler handler) + const query_type& query, io_service_impl& ios, Handler& handler) : operation(&resolve_op::do_complete), cancel_token_(cancel_token), query_(query), io_service_impl_(ios), - handler_(handler), + handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)), addrinfo_(0) { } @@ -61,7 +61,8 @@ public: } static void do_complete(io_service_impl* owner, operation* base, - boost::system::error_code /*ec*/, std::size_t /*bytes_transferred*/) + const boost::system::error_code& /*ec*/, + std::size_t /*bytes_transferred*/) { // Take ownership of the operation object. resolve_op* o(static_cast<resolve_op*>(base)); @@ -86,6 +87,8 @@ public: // The operation has been returned to the main io_service. The completion // handler is ready to be delivered. + BOOST_ASIO_HANDLER_COMPLETION((o)); + // Make a copy of the handler so that the memory can be deallocated // before the upcall is made. Even if we're not about to make an upcall, // a sub-object of the handler may be the true owner of the memory @@ -104,8 +107,10 @@ public: if (owner) { - boost::asio::detail::fenced_block b; + fenced_block b(fenced_block::half); + BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, "...")); boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_); + BOOST_ASIO_HANDLER_INVOCATION_END; } } } diff --git a/3rdParty/Boost/src/boost/asio/detail/resolver_service.hpp b/3rdParty/Boost/src/boost/asio/detail/resolver_service.hpp index 1c343cb..8225844 100644 --- a/3rdParty/Boost/src/boost/asio/detail/resolver_service.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/resolver_service.hpp @@ -2,7 +2,7 @@ // detail/resolver_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -67,8 +67,8 @@ public: // Asynchronously resolve a query to a list of entries. template <typename Handler> - void async_resolve(implementation_type& impl, const query_type& query, - Handler handler) + void async_resolve(implementation_type& impl, + const query_type& query, Handler handler) { // Allocate and construct an operation to wrap the handler. typedef resolve_op<Protocol, Handler> op; @@ -77,6 +77,8 @@ public: sizeof(op), handler), 0 }; p.p = new (p.v) op(impl, query, io_service_impl_, handler); + BOOST_ASIO_HANDLER_CREATION((p.p, "resolver", &impl, "async_resolve")); + start_resolve_op(p.p); p.v = p.p = 0; } @@ -97,8 +99,8 @@ public: // Asynchronously resolve an endpoint to a list of entries. template <typename Handler> - void async_resolve(implementation_type& impl, const endpoint_type& endpoint, - Handler handler) + void async_resolve(implementation_type& impl, + const endpoint_type& endpoint, Handler handler) { // Allocate and construct an operation to wrap the handler. typedef resolve_endpoint_op<Protocol, Handler> op; @@ -107,6 +109,8 @@ public: sizeof(op), handler), 0 }; p.p = new (p.v) op(impl, endpoint, io_service_impl_, handler); + BOOST_ASIO_HANDLER_CREATION((p.p, "resolver", &impl, "async_resolve")); + start_resolve_op(p.p); p.v = p.p = 0; } diff --git a/3rdParty/Boost/src/boost/asio/detail/resolver_service_base.hpp b/3rdParty/Boost/src/boost/asio/detail/resolver_service_base.hpp index 60e9e09..3a48d06 100644 --- a/3rdParty/Boost/src/boost/asio/detail/resolver_service_base.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/resolver_service_base.hpp @@ -2,7 +2,7 @@ // detail/resolver_service_base.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -16,7 +16,6 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> -#include <boost/scoped_ptr.hpp> #include <boost/asio/error.hpp> #include <boost/asio/io_service.hpp> #include <boost/asio/detail/mutex.hpp> @@ -24,6 +23,7 @@ #include <boost/asio/detail/operation.hpp> #include <boost/asio/detail/socket_ops.hpp> #include <boost/asio/detail/socket_types.hpp> +#include <boost/asio/detail/scoped_ptr.hpp> #include <boost/asio/detail/thread.hpp> #include <boost/asio/detail/push_options.hpp> @@ -48,6 +48,10 @@ public: // Destroy all user-defined handler objects owned by the service. BOOST_ASIO_DECL void shutdown_service(); + // Perform any fork-related housekeeping. + BOOST_ASIO_DECL void fork_service( + boost::asio::io_service::fork_event fork_ev); + // Construct a new resolver implementation. BOOST_ASIO_DECL void construct(implementation_type& impl); @@ -100,16 +104,16 @@ private: boost::asio::detail::mutex mutex_; // Private io_service used for performing asynchronous host resolution. - boost::scoped_ptr<boost::asio::io_service> work_io_service_; + boost::asio::detail::scoped_ptr<boost::asio::io_service> work_io_service_; // The work io_service implementation used to post completions. io_service_impl& work_io_service_impl_; // Work for the private io_service to perform. - boost::scoped_ptr<boost::asio::io_service::work> work_; + boost::asio::detail::scoped_ptr<boost::asio::io_service::work> work_; // Thread used for running the work io_service's run loop. - boost::scoped_ptr<boost::asio::detail::thread> work_thread_; + boost::asio::detail::scoped_ptr<boost::asio::detail::thread> work_thread_; }; } // namespace detail diff --git a/3rdParty/Boost/src/boost/asio/detail/scoped_lock.hpp b/3rdParty/Boost/src/boost/asio/detail/scoped_lock.hpp index b523ae5..a2e6fd4 100644 --- a/3rdParty/Boost/src/boost/asio/detail/scoped_lock.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/scoped_lock.hpp @@ -2,7 +2,7 @@ // detail/scoped_lock.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/scoped_ptr.hpp b/3rdParty/Boost/src/boost/asio/detail/scoped_ptr.hpp new file mode 100644 index 0000000..16436dd --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/detail/scoped_ptr.hpp @@ -0,0 +1,81 @@ +// +// detail/scoped_ptr.hpp +// ~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) +// + +#ifndef BOOST_ASIO_DETAIL_SCOPED_PTR_HPP +#define BOOST_ASIO_DETAIL_SCOPED_PTR_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { +namespace detail { + +template <typename T> +class scoped_ptr +{ +public: + // Constructor. + explicit scoped_ptr(T* p = 0) + : p_(p) + { + } + + // Destructor. + ~scoped_ptr() + { + delete p_; + } + + // Access. + T* get() + { + return p_; + } + + // Access. + T* operator->() + { + return p_; + } + + // Dereference. + T& operator*() + { + return *p_; + } + + // Reset pointer. + void reset(T* p = 0) + { + delete p_; + p_ = p; + } + +private: + // Disallow copying and assignment. + scoped_ptr(const scoped_ptr&); + scoped_ptr& operator=(const scoped_ptr&); + + T* p_; +}; + +} // namespace detail +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#endif // BOOST_ASIO_DETAIL_SCOPED_PTR_HPP diff --git a/3rdParty/Boost/src/boost/asio/detail/select_interrupter.hpp b/3rdParty/Boost/src/boost/asio/detail/select_interrupter.hpp index f0a1275..11a4967 100644 --- a/3rdParty/Boost/src/boost/asio/detail/select_interrupter.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/select_interrupter.hpp @@ -2,7 +2,7 @@ // detail/select_interrupter.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/select_reactor.hpp b/3rdParty/Boost/src/boost/asio/detail/select_reactor.hpp index f4f8bdf..a434546 100644 --- a/3rdParty/Boost/src/boost/asio/detail/select_reactor.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/select_reactor.hpp @@ -2,7 +2,7 @@ // detail/select_reactor.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -22,7 +22,9 @@ && !defined(BOOST_ASIO_HAS_EPOLL) \ && !defined(BOOST_ASIO_HAS_KQUEUE)) +#include <boost/limits.hpp> #include <cstddef> +#include <boost/asio/detail/fd_set_adapter.hpp> #include <boost/asio/detail/mutex.hpp> #include <boost/asio/detail/op_queue.hpp> #include <boost/asio/detail/reactor_op.hpp> @@ -30,10 +32,10 @@ #include <boost/asio/detail/select_interrupter.hpp> #include <boost/asio/detail/select_reactor_fwd.hpp> #include <boost/asio/detail/socket_types.hpp> -#include <boost/asio/detail/timer_op.hpp> #include <boost/asio/detail/timer_queue_base.hpp> #include <boost/asio/detail/timer_queue_fwd.hpp> #include <boost/asio/detail/timer_queue_set.hpp> +#include <boost/asio/detail/wait_op.hpp> #include <boost/asio/io_service.hpp> #if defined(BOOST_ASIO_HAS_IOCP) @@ -72,6 +74,10 @@ public: // Destroy all user-defined handler objects owned by the service. BOOST_ASIO_DECL void shutdown_service(); + // Recreate internal descriptors following a fork. + BOOST_ASIO_DECL void fork_service( + boost::asio::io_service::fork_event fork_ev); + // Initialise the task, but only if the reactor is not in its own thread. BOOST_ASIO_DECL void init_task(); @@ -79,6 +85,12 @@ public: // code on failure. BOOST_ASIO_DECL int register_descriptor(socket_type, per_descriptor_data&); + // Register a descriptor with an associated single operation. Returns 0 on + // success, system error code on failure. + BOOST_ASIO_DECL int register_internal_descriptor( + int op_type, socket_type descriptor, + per_descriptor_data& descriptor_data, reactor_op* op); + // Post a reactor operation for immediate completion. void post_immediate_completion(reactor_op* op) { @@ -97,8 +109,17 @@ public: // Cancel any operations that are running against the descriptor and remove // its registration from the reactor. - BOOST_ASIO_DECL void close_descriptor(socket_type descriptor, - per_descriptor_data&); + BOOST_ASIO_DECL void deregister_descriptor(socket_type descriptor, + per_descriptor_data&, bool closing); + + // Remote the descriptor's registration from the reactor. + BOOST_ASIO_DECL void deregister_internal_descriptor( + socket_type descriptor, per_descriptor_data& descriptor_data); + + // Move descriptor registration from one descriptor_data object to another. + BOOST_ASIO_DECL void move_descriptor(socket_type descriptor, + per_descriptor_data& target_descriptor_data, + per_descriptor_data& source_descriptor_data); // Add a new timer queue to the reactor. template <typename Time_Traits> @@ -113,13 +134,14 @@ public: template <typename Time_Traits> void schedule_timer(timer_queue<Time_Traits>& queue, const typename Time_Traits::time_type& time, - typename timer_queue<Time_Traits>::per_timer_data& timer, timer_op* op); + typename timer_queue<Time_Traits>::per_timer_data& timer, wait_op* op); // Cancel the timer operations associated with the given token. Returns the // number of operations that have been posted or dispatched. template <typename Time_Traits> std::size_t cancel_timer(timer_queue<Time_Traits>& queue, - typename timer_queue<Time_Traits>::per_timer_data& timer); + typename timer_queue<Time_Traits>::per_timer_data& timer, + std::size_t max_cancelled = (std::numeric_limits<std::size_t>::max)()); // Run select once until interrupted or events are ready to be dispatched. BOOST_ASIO_DECL void run(bool block, op_queue<operation>& ops); @@ -162,6 +184,9 @@ private: // The queues of read, write and except operations. reactor_op_queue<socket_type> op_queue_[max_ops]; + // The file descriptor sets to be passed to the select system call. + fd_set_adapter fd_sets_[max_select_ops]; + // The timer queues. timer_queue_set timer_queues_; diff --git a/3rdParty/Boost/src/boost/asio/detail/select_reactor_fwd.hpp b/3rdParty/Boost/src/boost/asio/detail/select_reactor_fwd.hpp index 78ff61b..1337969 100644 --- a/3rdParty/Boost/src/boost/asio/detail/select_reactor_fwd.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/select_reactor_fwd.hpp @@ -2,7 +2,7 @@ // detail/select_reactor_fwd.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/service_registry.hpp b/3rdParty/Boost/src/boost/asio/detail/service_registry.hpp index a247ea8..458f271 100644 --- a/3rdParty/Boost/src/boost/asio/detail/service_registry.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/service_registry.hpp @@ -2,7 +2,7 @@ // detail/service_registry.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -52,12 +52,22 @@ class service_registry : private noncopyable { public: - // Constructor. - BOOST_ASIO_DECL service_registry(boost::asio::io_service& o); + // Constructor. Adds the initial service. + template <typename Service, typename Arg> + service_registry(boost::asio::io_service& o, + Service* initial_service, Arg arg); // Destructor. BOOST_ASIO_DECL ~service_registry(); + // Notify all services of a fork event. + BOOST_ASIO_DECL void notify_fork(boost::asio::io_service::fork_event fork_ev); + + // Get the first service object cast to the specified type. Called during + // io_service construction and so performs no locking or type checking. + template <typename Service> + Service& first_service(); + // Get the service object corresponding to the specified service type. Will // create a new service object automatically if no such object already // exists. Ownership of the service object is not transferred to the caller. @@ -120,8 +130,8 @@ private: const boost::asio::io_service::service::key& key, factory_type factory); - // Add a service object. Returns false on error, in which case ownership of - // the object is retained by the caller. + // Add a service object. Throws on error, in which case ownership of the + // object is retained by the caller. BOOST_ASIO_DECL void do_add_service( const boost::asio::io_service::service::key& key, boost::asio::io_service::service* new_service); diff --git a/3rdParty/Boost/src/boost/asio/detail/service_registry_fwd.hpp b/3rdParty/Boost/src/boost/asio/detail/service_registry_fwd.hpp index a6bb25e..3157574 100644 --- a/3rdParty/Boost/src/boost/asio/detail/service_registry_fwd.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/service_registry_fwd.hpp @@ -2,7 +2,7 @@ // detail/service_registry_fwd.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/shared_ptr.hpp b/3rdParty/Boost/src/boost/asio/detail/shared_ptr.hpp index fe497b7..5f0da22 100644 --- a/3rdParty/Boost/src/boost/asio/detail/shared_ptr.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/shared_ptr.hpp @@ -2,7 +2,7 @@ // detail/shared_ptr.hpp // ~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -17,21 +17,21 @@ #include <boost/asio/detail/config.hpp> -#if defined(_MSC_VER) && (_MSC_VER >= 1600) +#if defined(BOOST_ASIO_HAS_STD_SHARED_PTR) # include <memory> -#else +#else // defined(BOOST_ASIO_HAS_STD_SHARED_PTR) # include <boost/shared_ptr.hpp> -#endif +#endif // defined(BOOST_ASIO_HAS_STD_SHARED_PTR) namespace boost { namespace asio { namespace detail { -#if defined(_MSC_VER) && (_MSC_VER >= 1600) +#if defined(BOOST_ASIO_HAS_STD_SHARED_PTR) using std::shared_ptr; -#else +#else // defined(BOOST_ASIO_HAS_STD_SHARED_PTR) using boost::shared_ptr; -#endif +#endif // defined(BOOST_ASIO_HAS_STD_SHARED_PTR) } // namespace detail } // namespace asio diff --git a/3rdParty/Boost/src/boost/asio/detail/signal_blocker.hpp b/3rdParty/Boost/src/boost/asio/detail/signal_blocker.hpp index cc00482..fe859b4 100644 --- a/3rdParty/Boost/src/boost/asio/detail/signal_blocker.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/signal_blocker.hpp @@ -2,7 +2,7 @@ // detail/signal_blocker.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/signal_handler.hpp b/3rdParty/Boost/src/boost/asio/detail/signal_handler.hpp new file mode 100644 index 0000000..bd1c727 --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/detail/signal_handler.hpp @@ -0,0 +1,83 @@ +// +// detail/signal_handler.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) +// + +#ifndef BOOST_ASIO_DETAIL_SIGNAL_HANDLER_HPP +#define BOOST_ASIO_DETAIL_SIGNAL_HANDLER_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> +#include <boost/asio/detail/fenced_block.hpp> +#include <boost/asio/detail/handler_alloc_helpers.hpp> +#include <boost/asio/detail/handler_invoke_helpers.hpp> +#include <boost/asio/detail/signal_op.hpp> + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { +namespace detail { + +template <typename Handler> +class signal_handler : public signal_op +{ +public: + BOOST_ASIO_DEFINE_HANDLER_PTR(signal_handler); + + signal_handler(Handler& h) + : signal_op(&signal_handler::do_complete), + handler_(BOOST_ASIO_MOVE_CAST(Handler)(h)) + { + } + + static void do_complete(io_service_impl* owner, operation* base, + const boost::system::error_code& /*ec*/, + std::size_t /*bytes_transferred*/) + { + // Take ownership of the handler object. + signal_handler* h(static_cast<signal_handler*>(base)); + ptr p = { boost::addressof(h->handler_), h, h }; + + BOOST_ASIO_HANDLER_COMPLETION((h)); + + // Make a copy of the handler so that the memory can be deallocated before + // the upcall is made. Even if we're not about to make an upcall, a + // sub-object of the handler may be the true owner of the memory associated + // with the handler. Consequently, a local copy of the handler is required + // to ensure that any owning sub-object remains valid until after we have + // deallocated the memory here. + detail::binder2<Handler, boost::system::error_code, int> + handler(h->handler_, h->ec_, h->signal_number_); + p.h = boost::addressof(handler.handler_); + p.reset(); + + // Make the upcall if required. + if (owner) + { + fenced_block b(fenced_block::half); + BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_)); + boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_); + BOOST_ASIO_HANDLER_INVOCATION_END; + } + } + +private: + Handler handler_; +}; + +} // namespace detail +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#endif // BOOST_ASIO_DETAIL_SIGNAL_HANDLER_HPP diff --git a/3rdParty/Boost/src/boost/asio/detail/signal_init.hpp b/3rdParty/Boost/src/boost/asio/detail/signal_init.hpp index f346956..e038a88 100644 --- a/3rdParty/Boost/src/boost/asio/detail/signal_init.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/signal_init.hpp @@ -2,7 +2,7 @@ // detail/signal_init.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/signal_op.hpp b/3rdParty/Boost/src/boost/asio/detail/signal_op.hpp new file mode 100644 index 0000000..706691b --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/detail/signal_op.hpp @@ -0,0 +1,51 @@ +// +// detail/signal_op.hpp +// ~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) +// + +#ifndef BOOST_ASIO_DETAIL_SIGNAL_OP_HPP +#define BOOST_ASIO_DETAIL_SIGNAL_OP_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> +#include <boost/asio/detail/operation.hpp> + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { +namespace detail { + +class signal_op + : public operation +{ +public: + // The error code to be passed to the completion handler. + boost::system::error_code ec_; + + // The signal number to be passed to the completion handler. + int signal_number_; + +protected: + signal_op(func_type func) + : operation(func), + signal_number_(0) + { + } +}; + +} // namespace detail +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#endif // BOOST_ASIO_DETAIL_SIGNAL_OP_HPP diff --git a/3rdParty/Boost/src/boost/asio/detail/signal_set_service.hpp b/3rdParty/Boost/src/boost/asio/detail/signal_set_service.hpp new file mode 100644 index 0000000..afa67fe --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/detail/signal_set_service.hpp @@ -0,0 +1,213 @@ +// +// detail/signal_set_service.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) +// + +#ifndef BOOST_ASIO_DETAIL_SIGNAL_SET_SERVICE_HPP +#define BOOST_ASIO_DETAIL_SIGNAL_SET_SERVICE_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> + +#include <cstddef> +#include <signal.h> +#include <boost/asio/error.hpp> +#include <boost/asio/io_service.hpp> +#include <boost/asio/detail/handler_alloc_helpers.hpp> +#include <boost/asio/detail/op_queue.hpp> +#include <boost/asio/detail/signal_handler.hpp> +#include <boost/asio/detail/signal_op.hpp> +#include <boost/asio/detail/socket_types.hpp> + +#if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) +# include <boost/asio/detail/reactor.hpp> +#endif // !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { +namespace detail { + +#if defined(NSIG) && (NSIG > 0) +enum { max_signal_number = NSIG }; +#else +enum { max_signal_number = 128 }; +#endif + +extern BOOST_ASIO_DECL struct signal_state* get_signal_state(); + +extern "C" BOOST_ASIO_DECL void asio_signal_handler(int signal_number); + +class signal_set_service +{ +public: + // Type used for tracking an individual signal registration. + class registration + { + public: + // Default constructor. + registration() + : signal_number_(0), + queue_(0), + undelivered_(0), + next_in_table_(0), + prev_in_table_(0), + next_in_set_(0) + { + } + + private: + // Only this service will have access to the internal values. + friend class signal_set_service; + + // The signal number that is registered. + int signal_number_; + + // The waiting signal handlers. + op_queue<signal_op>* queue_; + + // The number of undelivered signals. + std::size_t undelivered_; + + // Pointers to adjacent registrations in the registrations_ table. + registration* next_in_table_; + registration* prev_in_table_; + + // Link to next registration in the signal set. + registration* next_in_set_; + }; + + // The implementation type of the signal_set. + class implementation_type + { + public: + // Default constructor. + implementation_type() + : signals_(0) + { + } + + private: + // Only this service will have access to the internal values. + friend class signal_set_service; + + // The pending signal handlers. + op_queue<signal_op> queue_; + + // Linked list of registered signals. + registration* signals_; + }; + + // Constructor. + BOOST_ASIO_DECL signal_set_service(boost::asio::io_service& io_service); + + // Destructor. + BOOST_ASIO_DECL ~signal_set_service(); + + // Destroy all user-defined handler objects owned by the service. + BOOST_ASIO_DECL void shutdown_service(); + + // Perform fork-related housekeeping. + BOOST_ASIO_DECL void fork_service( + boost::asio::io_service::fork_event fork_ev); + + // Construct a new signal_set implementation. + BOOST_ASIO_DECL void construct(implementation_type& impl); + + // Destroy a signal_set implementation. + BOOST_ASIO_DECL void destroy(implementation_type& impl); + + // Add a signal to a signal_set. + BOOST_ASIO_DECL boost::system::error_code add(implementation_type& impl, + int signal_number, boost::system::error_code& ec); + + // Remove a signal to a signal_set. + BOOST_ASIO_DECL boost::system::error_code remove(implementation_type& impl, + int signal_number, boost::system::error_code& ec); + + // Remove all signals from a signal_set. + BOOST_ASIO_DECL boost::system::error_code clear(implementation_type& impl, + boost::system::error_code& ec); + + // Cancel all operations associated with the signal set. + BOOST_ASIO_DECL boost::system::error_code cancel(implementation_type& impl, + boost::system::error_code& ec); + + // Start an asynchronous operation to wait for a signal to be delivered. + template <typename Handler> + void async_wait(implementation_type& impl, Handler handler) + { + // Allocate and construct an operation to wrap the handler. + typedef signal_handler<Handler> op; + typename op::ptr p = { boost::addressof(handler), + boost_asio_handler_alloc_helpers::allocate( + sizeof(op), handler), 0 }; + p.p = new (p.v) op(handler); + + BOOST_ASIO_HANDLER_CREATION((p.p, "signal_set", &impl, "async_wait")); + + start_wait_op(impl, p.p); + p.v = p.p = 0; + } + + // Deliver notification that a particular signal occurred. + BOOST_ASIO_DECL static void deliver_signal(int signal_number); + +private: + // Helper function to add a service to the global signal state. + BOOST_ASIO_DECL static void add_service(signal_set_service* service); + + // Helper function to remove a service from the global signal state. + BOOST_ASIO_DECL static void remove_service(signal_set_service* service); + + // Helper function to create the pipe descriptors. + BOOST_ASIO_DECL static void open_descriptors(); + + // Helper function to close the pipe descriptors. + BOOST_ASIO_DECL static void close_descriptors(); + + // Helper function to start a wait operation. + BOOST_ASIO_DECL void start_wait_op(implementation_type& impl, signal_op* op); + + // The io_service instance used for dispatching handlers. + io_service_impl& io_service_; + +#if !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) + // The type used for registering for pipe reactor notifications. + class pipe_read_op; + + // The reactor used for waiting for pipe readiness. + reactor& reactor_; + + // The per-descriptor reactor data used for the pipe. + reactor::per_descriptor_data reactor_data_; +#endif // !defined(BOOST_WINDOWS) && !defined(__CYGWIN__) + + // A mapping from signal number to the registered signal sets. + registration* registrations_[max_signal_number]; + + // Pointers to adjacent services in linked list. + signal_set_service* next_; + signal_set_service* prev_; +}; + +} // namespace detail +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#if defined(BOOST_ASIO_HEADER_ONLY) +# include <boost/asio/detail/impl/signal_set_service.ipp> +#endif // defined(BOOST_ASIO_HEADER_ONLY) + +#endif // BOOST_ASIO_DETAIL_SIGNAL_SET_SERVICE_HPP diff --git a/3rdParty/Boost/src/boost/asio/detail/socket_holder.hpp b/3rdParty/Boost/src/boost/asio/detail/socket_holder.hpp index 52d2e4d..d299859 100644 --- a/3rdParty/Boost/src/boost/asio/detail/socket_holder.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/socket_holder.hpp @@ -2,7 +2,7 @@ // detail/socket_holder.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/socket_ops.hpp b/3rdParty/Boost/src/boost/asio/detail/socket_ops.hpp index 18a8131..b353316 100644 --- a/3rdParty/Boost/src/boost/asio/detail/socket_ops.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/socket_ops.hpp @@ -2,7 +2,7 @@ // detail/socket_ops.hpp // ~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -51,7 +51,10 @@ enum stream_oriented = 16, // The socket is datagram-oriented. - datagram_oriented = 32 + datagram_oriented = 32, + + // The socket may have been dup()-ed. + possible_dup = 64 }; typedef unsigned char state_type; @@ -88,8 +91,11 @@ BOOST_ASIO_DECL int bind(socket_type s, const socket_addr_type* addr, BOOST_ASIO_DECL int close(socket_type s, state_type& state, bool destruction, boost::system::error_code& ec); +BOOST_ASIO_DECL bool set_user_non_blocking(socket_type s, + state_type& state, bool value, boost::system::error_code& ec); + BOOST_ASIO_DECL bool set_internal_non_blocking(socket_type s, - state_type& state, boost::system::error_code& ec); + state_type& state, bool value, boost::system::error_code& ec); BOOST_ASIO_DECL int shutdown(socket_type s, int what, boost::system::error_code& ec); @@ -166,6 +172,27 @@ BOOST_ASIO_DECL bool non_blocking_recvfrom(socket_type s, #endif // defined(BOOST_ASIO_HAS_IOCP) +BOOST_ASIO_DECL int recvmsg(socket_type s, buf* bufs, size_t count, + int in_flags, int& out_flags, boost::system::error_code& ec); + +BOOST_ASIO_DECL size_t sync_recvmsg(socket_type s, state_type state, + buf* bufs, size_t count, int in_flags, int& out_flags, + boost::system::error_code& ec); + +#if defined(BOOST_ASIO_HAS_IOCP) + +BOOST_ASIO_DECL void complete_iocp_recvmsg( + const weak_cancel_token_type& cancel_token, + boost::system::error_code& ec); + +#else // defined(BOOST_ASIO_HAS_IOCP) + +BOOST_ASIO_DECL bool non_blocking_recvmsg(socket_type s, + buf* bufs, size_t count, int in_flags, int& out_flags, + boost::system::error_code& ec, size_t& bytes_transferred); + +#endif // defined(BOOST_ASIO_HAS_IOCP) + BOOST_ASIO_DECL int send(socket_type s, const buf* bufs, size_t count, int flags, boost::system::error_code& ec); @@ -227,9 +254,11 @@ BOOST_ASIO_DECL int ioctl(socket_type s, state_type& state, BOOST_ASIO_DECL int select(int nfds, fd_set* readfds, fd_set* writefds, fd_set* exceptfds, timeval* timeout, boost::system::error_code& ec); -BOOST_ASIO_DECL int poll_read(socket_type s, boost::system::error_code& ec); +BOOST_ASIO_DECL int poll_read(socket_type s, + state_type state, boost::system::error_code& ec); -BOOST_ASIO_DECL int poll_write(socket_type s, boost::system::error_code& ec); +BOOST_ASIO_DECL int poll_write(socket_type s, + state_type state, boost::system::error_code& ec); BOOST_ASIO_DECL int poll_connect(socket_type s, boost::system::error_code& ec); diff --git a/3rdParty/Boost/src/boost/asio/detail/socket_option.hpp b/3rdParty/Boost/src/boost/asio/detail/socket_option.hpp index c841033..5d3a514 100644 --- a/3rdParty/Boost/src/boost/asio/detail/socket_option.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/socket_option.hpp @@ -2,7 +2,7 @@ // detail/socket_option.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/socket_select_interrupter.hpp b/3rdParty/Boost/src/boost/asio/detail/socket_select_interrupter.hpp index 6d68d5a..eb8c7d0 100644 --- a/3rdParty/Boost/src/boost/asio/detail/socket_select_interrupter.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/socket_select_interrupter.hpp @@ -2,7 +2,7 @@ // detail/socket_select_interrupter.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -38,6 +38,9 @@ public: // Destructor. BOOST_ASIO_DECL ~socket_select_interrupter(); + // Recreate the interrupter's descriptors. Used after a fork. + BOOST_ASIO_DECL void recreate(); + // Interrupt the select call. BOOST_ASIO_DECL void interrupt(); @@ -51,6 +54,12 @@ public: } private: + // Open the descriptors. Throws on error. + BOOST_ASIO_DECL void open_descriptors(); + + // Close the descriptors. + BOOST_ASIO_DECL void close_descriptors(); + // The read end of a connection used to interrupt the select call. This file // descriptor is passed to select such that when it is time to stop, a single // byte will be written on the other end of the connection and this diff --git a/3rdParty/Boost/src/boost/asio/detail/socket_types.hpp b/3rdParty/Boost/src/boost/asio/detail/socket_types.hpp index f0679b6..3754592 100644 --- a/3rdParty/Boost/src/boost/asio/detail/socket_types.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/socket_types.hpp @@ -2,7 +2,7 @@ // detail/socket_types.hpp // ~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -113,6 +113,7 @@ const int shutdown_both = SD_BOTH; const int message_peek = MSG_PEEK; const int message_out_of_band = MSG_OOB; const int message_do_not_route = MSG_DONTROUTE; +const int message_end_of_record = 0; // Not supported on Windows. # if defined (_WIN32_WINNT) const int max_iov_len = 64; # else @@ -156,6 +157,7 @@ const int shutdown_both = SHUT_RDWR; const int message_peek = MSG_PEEK; const int message_out_of_band = MSG_OOB; const int message_do_not_route = MSG_DONTROUTE; +const int message_end_of_record = MSG_EOR; # if defined(IOV_MAX) const int max_iov_len = IOV_MAX; # else diff --git a/3rdParty/Boost/src/boost/asio/detail/solaris_fenced_block.hpp b/3rdParty/Boost/src/boost/asio/detail/solaris_fenced_block.hpp index 0b117ad..ab6f730 100644 --- a/3rdParty/Boost/src/boost/asio/detail/solaris_fenced_block.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/solaris_fenced_block.hpp @@ -2,7 +2,7 @@ // detail/solaris_fenced_block.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -31,8 +31,16 @@ class solaris_fenced_block : private noncopyable { public: - // Constructor. - solaris_fenced_block() + enum half_t { half }; + enum full_t { full }; + + // Constructor for a half fenced block. + explicit solaris_fenced_block(half_t) + { + } + + // Constructor for a full fenced block. + explicit solaris_fenced_block(full_t) { membar_consumer(); } diff --git a/3rdParty/Boost/src/boost/asio/detail/static_mutex.hpp b/3rdParty/Boost/src/boost/asio/detail/static_mutex.hpp new file mode 100644 index 0000000..fbac3ed --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/detail/static_mutex.hpp @@ -0,0 +1,49 @@ +// +// detail/static_mutex.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) +// + +#ifndef BOOST_ASIO_DETAIL_STATIC_MUTEX_HPP +#define BOOST_ASIO_DETAIL_STATIC_MUTEX_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> + +#if !defined(BOOST_HAS_THREADS) || defined(BOOST_ASIO_DISABLE_THREADS) +# include <boost/asio/detail/null_static_mutex.hpp> +#elif defined(BOOST_WINDOWS) +# include <boost/asio/detail/win_static_mutex.hpp> +#elif defined(BOOST_HAS_PTHREADS) +# include <boost/asio/detail/posix_static_mutex.hpp> +#else +# error Only Windows and POSIX are supported! +#endif + +namespace boost { +namespace asio { +namespace detail { + +#if !defined(BOOST_HAS_THREADS) || defined(BOOST_ASIO_DISABLE_THREADS) +typedef null_static_mutex static_mutex; +# define BOOST_ASIO_STATIC_MUTEX_INIT BOOST_ASIO_NULL_STATIC_MUTEX_INIT +#elif defined(BOOST_WINDOWS) +typedef win_static_mutex static_mutex; +# define BOOST_ASIO_STATIC_MUTEX_INIT BOOST_ASIO_WIN_STATIC_MUTEX_INIT +#elif defined(BOOST_HAS_PTHREADS) +typedef posix_static_mutex static_mutex; +# define BOOST_ASIO_STATIC_MUTEX_INIT BOOST_ASIO_POSIX_STATIC_MUTEX_INIT +#endif + +} // namespace detail +} // namespace asio +} // namespace boost + +#endif // BOOST_ASIO_DETAIL_STATIC_MUTEX_HPP diff --git a/3rdParty/Boost/src/boost/asio/detail/strand_service.hpp b/3rdParty/Boost/src/boost/asio/detail/strand_service.hpp index 0783ac4..3a271b5 100644 --- a/3rdParty/Boost/src/boost/asio/detail/strand_service.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/strand_service.hpp @@ -2,7 +2,7 @@ // detail/strand_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -16,11 +16,11 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> -#include <boost/scoped_ptr.hpp> #include <boost/asio/io_service.hpp> #include <boost/asio/detail/mutex.hpp> #include <boost/asio/detail/op_queue.hpp> #include <boost/asio/detail/operation.hpp> +#include <boost/asio/detail/scoped_ptr.hpp> #include <boost/asio/detail/push_options.hpp> @@ -57,11 +57,20 @@ public: // Mutex to protect access to internal data. boost::asio::detail::mutex mutex_; - // The count of handlers in the strand, including the upcall (if any). - std::size_t count_; + // Indicates whether the strand is currently "locked" by a handler. This + // means that there is a handler upcall in progress, or that the strand + // itself has been scheduled in order to invoke some pending handlers. + bool locked_; - // The handlers waiting on the strand. - op_queue<operation> queue_; + // The handlers that are waiting on the strand but should not be run until + // after the next time the strand is scheduled. This queue must only be + // modified while the mutex is locked. + op_queue<operation> waiting_queue_; + + // The handlers that are ready to be run. Logically speaking, these are the + // handlers that hold the strand's lock. The ready queue is only modified + // from within the strand and so may be accessed without locking the mutex. + op_queue<operation> ready_queue_; }; typedef strand_impl* implementation_type; @@ -75,9 +84,6 @@ public: // Construct a new strand implementation. BOOST_ASIO_DECL void construct(implementation_type& impl); - // Destroy a strand implementation. - void destroy(implementation_type& impl); - // Request the io_service to invoke the given handler. template <typename Handler> void dispatch(implementation_type& impl, Handler handler); @@ -87,8 +93,15 @@ public: void post(implementation_type& impl, Handler handler); private: + // Helper function to dispatch a handler. Returns true if the handler should + // be dispatched immediately. + BOOST_ASIO_DECL bool do_dispatch(implementation_type& impl, operation* op); + + // Helper fiunction to post a handler. + BOOST_ASIO_DECL void do_post(implementation_type& impl, operation* op); + BOOST_ASIO_DECL static void do_complete(io_service_impl* owner, - operation* base, boost::system::error_code ec, + operation* base, const boost::system::error_code& ec, std::size_t bytes_transferred); // The io_service implementation used to post completions. @@ -98,10 +111,14 @@ private: boost::asio::detail::mutex mutex_; // Number of implementations shared between all strand objects. +#if defined(BOOST_ASIO_STRAND_IMPLEMENTATIONS) + enum { num_implementations = BOOST_ASIO_STRAND_IMPLEMENTATIONS }; +#else // defined(BOOST_ASIO_STRAND_IMPLEMENTATIONS) enum { num_implementations = 193 }; +#endif // defined(BOOST_ASIO_STRAND_IMPLEMENTATIONS) - // The head of a linked list of all implementations. - boost::scoped_ptr<strand_impl> implementations_[num_implementations]; + // Pool of implementations. + scoped_ptr<strand_impl> implementations_[num_implementations]; // Extra value used when hashing to prevent recycled memory locations from // getting the same strand implementation. diff --git a/3rdParty/Boost/src/boost/asio/detail/task_io_service.hpp b/3rdParty/Boost/src/boost/asio/detail/task_io_service.hpp index c014855..e05c3a7 100644 --- a/3rdParty/Boost/src/boost/asio/detail/task_io_service.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/task_io_service.hpp @@ -2,7 +2,7 @@ // detail/task_io_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -19,9 +19,10 @@ #if !defined(BOOST_ASIO_HAS_IOCP) -#include <boost/detail/atomic_count.hpp> #include <boost/system/error_code.hpp> #include <boost/asio/io_service.hpp> +#include <boost/asio/detail/atomic_count.hpp> +#include <boost/asio/detail/call_stack.hpp> #include <boost/asio/detail/mutex.hpp> #include <boost/asio/detail/op_queue.hpp> #include <boost/asio/detail/reactor_fwd.hpp> @@ -40,11 +41,10 @@ class task_io_service public: typedef task_io_service_operation operation; - // Constructor. - BOOST_ASIO_DECL task_io_service(boost::asio::io_service& io_service); - - // How many concurrent threads are likely to run the io_service. - BOOST_ASIO_DECL void init(std::size_t concurrency_hint); + // Constructor. Specifies the number of concurrent threads that are likely to + // run the io_service. If set to 1 certain optimisation are performed. + BOOST_ASIO_DECL task_io_service(boost::asio::io_service& io_service, + std::size_t concurrency_hint = 0); // Destroy all user-defined handler objects owned by the service. BOOST_ASIO_DECL void shutdown_service(); @@ -67,6 +67,9 @@ public: // Interrupt the event processing loop. BOOST_ASIO_DECL void stop(); + // Determine whether the io_service is stopped. + BOOST_ASIO_DECL bool stopped() const; + // Reset in preparation for a subsequent run invocation. BOOST_ASIO_DECL void reset(); @@ -83,6 +86,12 @@ public: stop(); } + // Return whether a handler can be dispatched immediately. + bool can_dispatch() + { + return thread_call_stack::contains(this) != 0; + } + // Request invocation of the given handler. template <typename Handler> void dispatch(Handler handler); @@ -103,13 +112,41 @@ public: // that work_started() was previously called for each operation. BOOST_ASIO_DECL void post_deferred_completions(op_queue<operation>& ops); + // Request invocation of the given operation, preferring the thread-private + // queue if available, and return immediately. Assumes that work_started() + // has not yet been called for the operation. + BOOST_ASIO_DECL void post_private_immediate_completion(operation* op); + + // Request invocation of the given operation, preferring the thread-private + // queue if available, and return immediately. Assumes that work_started() + // was previously called for the operation. + BOOST_ASIO_DECL void post_private_deferred_completion(operation* op); + + // Process unfinished operations as part of a shutdown_service operation. + // Assumes that work_started() was previously called for the operations. + BOOST_ASIO_DECL void abandon_operations(op_queue<operation>& ops); + private: // Structure containing information about an idle thread. - struct idle_thread_info; + struct thread_info; + + // Request invocation of the given operation, avoiding the thread-private + // queue, and return immediately. Assumes that work_started() has not yet + // been called for the operation. + BOOST_ASIO_DECL void post_non_private_immediate_completion(operation* op); + + // Request invocation of the given operation, avoiding the thread-private + // queue, and return immediately. Assumes that work_started() was previously + // called for the operation. + BOOST_ASIO_DECL void post_non_private_deferred_completion(operation* op); - // Run at most one operation. Blocks only if this_idle_thread is non-null. - BOOST_ASIO_DECL std::size_t do_one(mutex::scoped_lock& lock, - idle_thread_info* this_idle_thread); + // Run at most one operation. May block. + BOOST_ASIO_DECL std::size_t do_run_one(mutex::scoped_lock& lock, + thread_info& this_thread, const boost::system::error_code& ec); + + // Poll for at most one operation. + BOOST_ASIO_DECL std::size_t do_poll_one(mutex::scoped_lock& lock, + thread_info& this_thread, const boost::system::error_code& ec); // Stop the task and all idle threads. BOOST_ASIO_DECL void stop_all_threads(mutex::scoped_lock& lock); @@ -128,11 +165,15 @@ private: struct task_cleanup; friend struct task_cleanup; - // Helper class to call work_finished() on block exit. - struct work_finished_on_block_exit; + // Helper class to call work-related operations on block exit. + struct work_cleanup; + friend struct work_cleanup; + + // Whether to optimise for single-threaded use cases. + const bool one_thread_; // Mutex to protect access to internal data. - mutex mutex_; + mutable mutex mutex_; // The task to be run by this service. reactor* task_; @@ -147,7 +188,7 @@ private: bool task_interrupted_; // The count of unfinished work. - boost::detail::atomic_count outstanding_work_; + atomic_count outstanding_work_; // The queue of handlers that are ready to be delivered. op_queue<operation> op_queue_; @@ -158,8 +199,11 @@ private: // Flag to indicate that the dispatcher has been shut down. bool shutdown_; + // Per-thread call stack to track the state of each thread in the io_service. + typedef call_stack<task_io_service, thread_info> thread_call_stack; + // The threads that are currently idle. - idle_thread_info* first_idle_thread_; + thread_info* first_idle_thread_; }; } // namespace detail diff --git a/3rdParty/Boost/src/boost/asio/detail/task_io_service_fwd.hpp b/3rdParty/Boost/src/boost/asio/detail/task_io_service_fwd.hpp index b3243b7..4aa0ec3 100644 --- a/3rdParty/Boost/src/boost/asio/detail/task_io_service_fwd.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/task_io_service_fwd.hpp @@ -2,7 +2,7 @@ // detail/task_io_service_fwd.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/task_io_service_operation.hpp b/3rdParty/Boost/src/boost/asio/detail/task_io_service_operation.hpp index 08164fa..1bf1301 100644 --- a/3rdParty/Boost/src/boost/asio/detail/task_io_service_operation.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/task_io_service_operation.hpp @@ -2,7 +2,7 @@ // detail/task_io_service_operation.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -16,6 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/system/error_code.hpp> +#include <boost/asio/detail/handler_tracking.hpp> #include <boost/asio/detail/op_queue.hpp> #include <boost/asio/detail/task_io_service_fwd.hpp> @@ -27,12 +28,13 @@ namespace detail { // Base class for all operations. A function pointer is used instead of virtual // functions to avoid the associated overhead. -class task_io_service_operation +class task_io_service_operation BOOST_ASIO_INHERIT_TRACKED_HANDLER { public: - void complete(task_io_service& owner) + void complete(task_io_service& owner, + const boost::system::error_code& ec, std::size_t bytes_transferred) { - func_(&owner, this, boost::system::error_code(), 0); + func_(&owner, this, ec, bytes_transferred); } void destroy() @@ -43,11 +45,12 @@ public: protected: typedef void (*func_type)(task_io_service*, task_io_service_operation*, - boost::system::error_code, std::size_t); + const boost::system::error_code&, std::size_t); task_io_service_operation(func_type func) : next_(0), - func_(func) + func_(func), + task_result_(0) { } @@ -60,6 +63,9 @@ private: friend class op_queue_access; task_io_service_operation* next_; func_type func_; +protected: + friend class task_io_service; + unsigned int task_result_; // Passed into bytes transferred. }; } // namespace detail diff --git a/3rdParty/Boost/src/boost/asio/detail/thread.hpp b/3rdParty/Boost/src/boost/asio/detail/thread.hpp index 48cffb1..5b452cf 100644 --- a/3rdParty/Boost/src/boost/asio/detail/thread.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/thread.hpp @@ -2,7 +2,7 @@ // detail/thread.hpp // ~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/throw_error.hpp b/3rdParty/Boost/src/boost/asio/detail/throw_error.hpp index 43bc9c3..bfb545a 100644 --- a/3rdParty/Boost/src/boost/asio/detail/throw_error.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/throw_error.hpp @@ -2,7 +2,7 @@ // detail/throw_error.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/timer_op.hpp b/3rdParty/Boost/src/boost/asio/detail/timer_op.hpp deleted file mode 100644 index 24a536c..0000000 --- a/3rdParty/Boost/src/boost/asio/detail/timer_op.hpp +++ /dev/null @@ -1,47 +0,0 @@ -// -// detail/timer_op.hpp -// ~~~~~~~~~~~~~~~~~~~ -// -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff 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) -// - -#ifndef BOOST_ASIO_DETAIL_TIMER_OP_HPP -#define BOOST_ASIO_DETAIL_TIMER_OP_HPP - -#if defined(_MSC_VER) && (_MSC_VER >= 1200) -# pragma once -#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) - -#include <boost/asio/detail/config.hpp> -#include <boost/asio/detail/operation.hpp> - -#include <boost/asio/detail/push_options.hpp> - -namespace boost { -namespace asio { -namespace detail { - -class timer_op - : public operation -{ -public: - // The error code to be passed to the completion handler. - boost::system::error_code ec_; - -protected: - timer_op(func_type func) - : operation(func) - { - } -}; - -} // namespace detail -} // namespace asio -} // namespace boost - -#include <boost/asio/detail/pop_options.hpp> - -#endif // BOOST_ASIO_DETAIL_TIMER_OP_HPP diff --git a/3rdParty/Boost/src/boost/asio/detail/timer_queue.hpp b/3rdParty/Boost/src/boost/asio/detail/timer_queue.hpp index 328a9ed..d14ba7c 100644 --- a/3rdParty/Boost/src/boost/asio/detail/timer_queue.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/timer_queue.hpp @@ -2,7 +2,7 @@ // detail/timer_queue.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -20,15 +20,12 @@ #include <vector> #include <boost/config.hpp> #include <boost/limits.hpp> +#include <boost/cstdint.hpp> +#include <boost/asio/detail/date_time_fwd.hpp> #include <boost/asio/detail/op_queue.hpp> -#include <boost/asio/detail/timer_op.hpp> #include <boost/asio/detail/timer_queue_base.hpp> +#include <boost/asio/detail/wait_op.hpp> #include <boost/asio/error.hpp> -#include <boost/asio/time_traits.hpp> - -#include <boost/asio/detail/push_options.hpp> -#include <boost/date_time/posix_time/posix_time_types.hpp> -#include <boost/asio/detail/pop_options.hpp> #include <boost/asio/detail/push_options.hpp> @@ -57,7 +54,7 @@ public: friend class timer_queue; // The operations waiting on the timer. - op_queue<timer_op> op_queue_; + op_queue<wait_op> op_queue_; // The index of the timer in the heap. std::size_t heap_index_; @@ -77,7 +74,7 @@ public: // Add a new timer to the queue. Returns true if this is the timer that is // earliest in the queue, in which case the reactor's event demultiplexing // function call may need to be interrupted and restarted. - bool enqueue_timer(const time_type& time, per_timer_data& timer, timer_op* op) + bool enqueue_timer(const time_type& time, per_timer_data& timer, wait_op* op) { // Enqueue the timer object. if (timer.prev_ == 0 && &timer != timers_) @@ -124,17 +121,10 @@ public: if (heap_.empty()) return max_duration; - boost::posix_time::time_duration duration = Time_Traits::to_posix_duration( - Time_Traits::subtract(heap_[0].time_, Time_Traits::now())); - - if (duration > boost::posix_time::milliseconds(max_duration)) - duration = boost::posix_time::milliseconds(max_duration); - else if (duration <= boost::posix_time::milliseconds(0)) - duration = boost::posix_time::milliseconds(0); - else if (duration < boost::posix_time::milliseconds(1)) - duration = boost::posix_time::milliseconds(1); - - return duration.total_milliseconds(); + return this->to_msec( + Time_Traits::to_posix_duration( + Time_Traits::subtract(heap_[0].time_, Time_Traits::now())), + max_duration); } // Get the time for the timer that is earliest in the queue. @@ -143,28 +133,24 @@ public: if (heap_.empty()) return max_duration; - boost::posix_time::time_duration duration = Time_Traits::to_posix_duration( - Time_Traits::subtract(heap_[0].time_, Time_Traits::now())); - - if (duration > boost::posix_time::microseconds(max_duration)) - duration = boost::posix_time::microseconds(max_duration); - else if (duration <= boost::posix_time::microseconds(0)) - duration = boost::posix_time::microseconds(0); - else if (duration < boost::posix_time::microseconds(1)) - duration = boost::posix_time::microseconds(1); - - return duration.total_microseconds(); + return this->to_usec( + Time_Traits::to_posix_duration( + Time_Traits::subtract(heap_[0].time_, Time_Traits::now())), + max_duration); } // Dequeue all timers not later than the current time. virtual void get_ready_timers(op_queue<operation>& ops) { - const time_type now = Time_Traits::now(); - while (!heap_.empty() && !Time_Traits::less_than(now, heap_[0].time_)) + if (!heap_.empty()) { - per_timer_data* timer = heap_[0].timer_; - ops.push(timer->op_queue_); - remove_timer(*timer); + const time_type now = Time_Traits::now(); + while (!heap_.empty() && !Time_Traits::less_than(now, heap_[0].time_)) + { + per_timer_data* timer = heap_[0].timer_; + ops.push(timer->op_queue_); + remove_timer(*timer); + } } } @@ -183,20 +169,23 @@ public: heap_.clear(); } - // Cancel and dequeue the timers with the given token. - std::size_t cancel_timer(per_timer_data& timer, op_queue<operation>& ops) + // Cancel and dequeue operations for the given timer. + std::size_t cancel_timer(per_timer_data& timer, op_queue<operation>& ops, + std::size_t max_cancelled = (std::numeric_limits<std::size_t>::max)()) { std::size_t num_cancelled = 0; if (timer.prev_ != 0 || &timer == timers_) { - while (timer_op* op = timer.op_queue_.front()) + while (wait_op* op = (num_cancelled != max_cancelled) + ? timer.op_queue_.front() : 0) { op->ec_ = boost::asio::error::operation_aborted; timer.op_queue_.pop(); ops.push(op); ++num_cancelled; } - remove_timer(timer); + if (timer.op_queue_.empty()) + remove_timer(timer); } return num_cancelled; } @@ -286,9 +275,39 @@ private: } // Determine if the specified absolute time is positive infinity. - static bool is_positive_infinity(const boost::posix_time::ptime& time) + template <typename T, typename TimeSystem> + static bool is_positive_infinity( + const boost::date_time::base_time<T, TimeSystem>& time) + { + return time.is_pos_infinity(); + } + + // Helper function to convert a duration into milliseconds. + template <typename Duration> + long to_msec(const Duration& d, long max_duration) const { - return time == boost::posix_time::pos_infin; + if (d.ticks() <= 0) + return 0; + boost::int64_t msec = d.total_milliseconds(); + if (msec == 0) + return 1; + if (msec > max_duration) + return max_duration; + return static_cast<long>(msec); + } + + // Helper function to convert a duration into microseconds. + template <typename Duration> + long to_usec(const Duration& d, long max_duration) const + { + if (d.ticks() <= 0) + return 0; + boost::int64_t usec = d.total_microseconds(); + if (usec == 0) + return 1; + if (usec > max_duration) + return max_duration; + return static_cast<long>(usec); } // The head of a linked list of all active timers. @@ -307,63 +326,6 @@ private: std::vector<heap_entry> heap_; }; -#if !defined(BOOST_ASIO_HEADER_ONLY) - -struct forwarding_posix_time_traits : time_traits<boost::posix_time::ptime> {}; - -// Template specialisation for the commonly used instantation. -template <> -class timer_queue<time_traits<boost::posix_time::ptime> > - : public timer_queue_base -{ -public: - // The time type. - typedef boost::posix_time::ptime time_type; - - // The duration type. - typedef boost::posix_time::time_duration duration_type; - - // Per-timer data. - typedef timer_queue<forwarding_posix_time_traits>::per_timer_data - per_timer_data; - - // Constructor. - BOOST_ASIO_DECL timer_queue(); - - // Destructor. - BOOST_ASIO_DECL virtual ~timer_queue(); - - // Add a new timer to the queue. Returns true if this is the timer that is - // earliest in the queue, in which case the reactor's event demultiplexing - // function call may need to be interrupted and restarted. - BOOST_ASIO_DECL bool enqueue_timer(const time_type& time, - per_timer_data& timer, timer_op* op); - - // Whether there are no timers in the queue. - BOOST_ASIO_DECL virtual bool empty() const; - - // Get the time for the timer that is earliest in the queue. - BOOST_ASIO_DECL virtual long wait_duration_msec(long max_duration) const; - - // Get the time for the timer that is earliest in the queue. - BOOST_ASIO_DECL virtual long wait_duration_usec(long max_duration) const; - - // Dequeue all timers not later than the current time. - BOOST_ASIO_DECL virtual void get_ready_timers(op_queue<operation>& ops); - - // Dequeue all timers. - BOOST_ASIO_DECL virtual void get_all_timers(op_queue<operation>& ops); - - // Cancel and dequeue the timers with the given token. - BOOST_ASIO_DECL std::size_t cancel_timer( - per_timer_data& timer, op_queue<operation>& ops); - -private: - timer_queue<forwarding_posix_time_traits> impl_; -}; - -#endif // !defined(BOOST_ASIO_HEADER_ONLY) - } // namespace detail } // namespace asio } // namespace boost diff --git a/3rdParty/Boost/src/boost/asio/detail/timer_queue_base.hpp b/3rdParty/Boost/src/boost/asio/detail/timer_queue_base.hpp index d493871..cc7ef34 100644 --- a/3rdParty/Boost/src/boost/asio/detail/timer_queue_base.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/timer_queue_base.hpp @@ -2,7 +2,7 @@ // detail/timer_queue_base.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/timer_queue_fwd.hpp b/3rdParty/Boost/src/boost/asio/detail/timer_queue_fwd.hpp index 14c6319..c97753f 100644 --- a/3rdParty/Boost/src/boost/asio/detail/timer_queue_fwd.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/timer_queue_fwd.hpp @@ -2,7 +2,7 @@ // detail/timer_queue_fwd.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/timer_queue_ptime.hpp b/3rdParty/Boost/src/boost/asio/detail/timer_queue_ptime.hpp new file mode 100644 index 0000000..4c32ece --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/detail/timer_queue_ptime.hpp @@ -0,0 +1,91 @@ +// +// detail/timer_queue_ptime.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) +// + +#ifndef BOOST_ASIO_DETAIL_TIMER_QUEUE_PTIME_HPP +#define BOOST_ASIO_DETAIL_TIMER_QUEUE_PTIME_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/time_traits.hpp> +#include <boost/asio/detail/timer_queue.hpp> + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { +namespace detail { + +struct forwarding_posix_time_traits : time_traits<boost::posix_time::ptime> {}; + +// Template specialisation for the commonly used instantation. +template <> +class timer_queue<time_traits<boost::posix_time::ptime> > + : public timer_queue_base +{ +public: + // The time type. + typedef boost::posix_time::ptime time_type; + + // The duration type. + typedef boost::posix_time::time_duration duration_type; + + // Per-timer data. + typedef timer_queue<forwarding_posix_time_traits>::per_timer_data + per_timer_data; + + // Constructor. + BOOST_ASIO_DECL timer_queue(); + + // Destructor. + BOOST_ASIO_DECL virtual ~timer_queue(); + + // Add a new timer to the queue. Returns true if this is the timer that is + // earliest in the queue, in which case the reactor's event demultiplexing + // function call may need to be interrupted and restarted. + BOOST_ASIO_DECL bool enqueue_timer(const time_type& time, + per_timer_data& timer, wait_op* op); + + // Whether there are no timers in the queue. + BOOST_ASIO_DECL virtual bool empty() const; + + // Get the time for the timer that is earliest in the queue. + BOOST_ASIO_DECL virtual long wait_duration_msec(long max_duration) const; + + // Get the time for the timer that is earliest in the queue. + BOOST_ASIO_DECL virtual long wait_duration_usec(long max_duration) const; + + // Dequeue all timers not later than the current time. + BOOST_ASIO_DECL virtual void get_ready_timers(op_queue<operation>& ops); + + // Dequeue all timers. + BOOST_ASIO_DECL virtual void get_all_timers(op_queue<operation>& ops); + + // Cancel and dequeue operations for the given timer. + BOOST_ASIO_DECL std::size_t cancel_timer( + per_timer_data& timer, op_queue<operation>& ops, + std::size_t max_cancelled = (std::numeric_limits<std::size_t>::max)()); + +private: + timer_queue<forwarding_posix_time_traits> impl_; +}; + +} // namespace detail +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#if defined(BOOST_ASIO_HEADER_ONLY) +# include <boost/asio/detail/impl/timer_queue_ptime.ipp> +#endif // defined(BOOST_ASIO_HEADER_ONLY) + +#endif // BOOST_ASIO_DETAIL_TIMER_QUEUE_PTIME_HPP diff --git a/3rdParty/Boost/src/boost/asio/detail/timer_queue_set.hpp b/3rdParty/Boost/src/boost/asio/detail/timer_queue_set.hpp index 549d7e6..0289259 100644 --- a/3rdParty/Boost/src/boost/asio/detail/timer_queue_set.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/timer_queue_set.hpp @@ -2,7 +2,7 @@ // detail/timer_queue_set.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/timer_scheduler.hpp b/3rdParty/Boost/src/boost/asio/detail/timer_scheduler.hpp index 2edc0c8..8feea78 100644 --- a/3rdParty/Boost/src/boost/asio/detail/timer_scheduler.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/timer_scheduler.hpp @@ -2,7 +2,7 @@ // detail/timer_scheduler.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/timer_scheduler_fwd.hpp b/3rdParty/Boost/src/boost/asio/detail/timer_scheduler_fwd.hpp index e01b657..a72e256 100644 --- a/3rdParty/Boost/src/boost/asio/detail/timer_scheduler_fwd.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/timer_scheduler_fwd.hpp @@ -2,7 +2,7 @@ // detail/timer_scheduler_fwd.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/tss_ptr.hpp b/3rdParty/Boost/src/boost/asio/detail/tss_ptr.hpp index 35ed8e2..d14a959 100644 --- a/3rdParty/Boost/src/boost/asio/detail/tss_ptr.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/tss_ptr.hpp @@ -2,7 +2,7 @@ // detail/tss_ptr.hpp // ~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -19,6 +19,8 @@ #if !defined(BOOST_HAS_THREADS) || defined(BOOST_ASIO_DISABLE_THREADS) # include <boost/asio/detail/null_tss_ptr.hpp> +#elif defined(BOOST_ASIO_HAS_THREAD_KEYWORD_EXTENSION) +# include <boost/asio/detail/keyword_tss_ptr.hpp> #elif defined(BOOST_WINDOWS) # include <boost/asio/detail/win_tss_ptr.hpp> #elif defined(BOOST_HAS_PTHREADS) @@ -37,6 +39,8 @@ template <typename T> class tss_ptr #if !defined(BOOST_HAS_THREADS) || defined(BOOST_ASIO_DISABLE_THREADS) : public null_tss_ptr<T> +#elif defined(BOOST_ASIO_HAS_THREAD_KEYWORD_EXTENSION) + : public keyword_tss_ptr<T> #elif defined(BOOST_WINDOWS) : public win_tss_ptr<T> #elif defined(BOOST_HAS_PTHREADS) @@ -48,6 +52,8 @@ public: { #if !defined(BOOST_HAS_THREADS) || defined(BOOST_ASIO_DISABLE_THREADS) null_tss_ptr<T>::operator=(value); +#elif defined(BOOST_ASIO_HAS_THREAD_KEYWORD_EXTENSION) + keyword_tss_ptr<T>::operator=(value); #elif defined(BOOST_WINDOWS) win_tss_ptr<T>::operator=(value); #elif defined(BOOST_HAS_PTHREADS) diff --git a/3rdParty/Boost/src/boost/asio/detail/wait_handler.hpp b/3rdParty/Boost/src/boost/asio/detail/wait_handler.hpp index 95be6bd..b511be8 100644 --- a/3rdParty/Boost/src/boost/asio/detail/wait_handler.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/wait_handler.hpp @@ -2,7 +2,7 @@ // detail/wait_handler.hpp // ~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -19,7 +19,8 @@ #include <boost/asio/detail/fenced_block.hpp> #include <boost/asio/detail/handler_alloc_helpers.hpp> #include <boost/asio/detail/handler_invoke_helpers.hpp> -#include <boost/asio/detail/timer_op.hpp> +#include <boost/asio/detail/wait_op.hpp> +#include <boost/asio/io_service.hpp> #include <boost/asio/detail/push_options.hpp> @@ -28,24 +29,27 @@ namespace asio { namespace detail { template <typename Handler> -class wait_handler : public timer_op +class wait_handler : public wait_op { public: BOOST_ASIO_DEFINE_HANDLER_PTR(wait_handler); - wait_handler(Handler h) - : timer_op(&wait_handler::do_complete), - handler_(h) + wait_handler(Handler& h) + : wait_op(&wait_handler::do_complete), + handler_(BOOST_ASIO_MOVE_CAST(Handler)(h)) { } static void do_complete(io_service_impl* owner, operation* base, - boost::system::error_code /*ec*/, std::size_t /*bytes_transferred*/) + const boost::system::error_code& /*ec*/, + std::size_t /*bytes_transferred*/) { // Take ownership of the handler object. wait_handler* h(static_cast<wait_handler*>(base)); ptr p = { boost::addressof(h->handler_), h, h }; + BOOST_ASIO_HANDLER_COMPLETION((h)); + // Make a copy of the handler so that the memory can be deallocated before // the upcall is made. Even if we're not about to make an upcall, a // sub-object of the handler may be the true owner of the memory associated @@ -60,8 +64,10 @@ public: // Make the upcall if required. if (owner) { - boost::asio::detail::fenced_block b; + fenced_block b(fenced_block::half); + BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_)); boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_); + BOOST_ASIO_HANDLER_INVOCATION_END; } } diff --git a/3rdParty/Boost/src/boost/asio/detail/wait_op.hpp b/3rdParty/Boost/src/boost/asio/detail/wait_op.hpp new file mode 100644 index 0000000..0209eb0 --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/detail/wait_op.hpp @@ -0,0 +1,47 @@ +// +// detail/wait_op.hpp +// ~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) +// + +#ifndef BOOST_ASIO_DETAIL_WAIT_OP_HPP +#define BOOST_ASIO_DETAIL_WAIT_OP_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> +#include <boost/asio/detail/operation.hpp> + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { +namespace detail { + +class wait_op + : public operation +{ +public: + // The error code to be passed to the completion handler. + boost::system::error_code ec_; + +protected: + wait_op(func_type func) + : operation(func) + { + } +}; + +} // namespace detail +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#endif // BOOST_ASIO_DETAIL_WAIT_OP_HPP diff --git a/3rdParty/Boost/src/boost/asio/detail/weak_ptr.hpp b/3rdParty/Boost/src/boost/asio/detail/weak_ptr.hpp index 81a8b06..af9a08d 100644 --- a/3rdParty/Boost/src/boost/asio/detail/weak_ptr.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/weak_ptr.hpp @@ -2,7 +2,7 @@ // detail/weak_ptr.hpp // ~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -16,23 +16,22 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> -#include <boost/version.hpp> -#if defined(_MSC_VER) && (_MSC_VER >= 1600) +#if defined(BOOST_ASIO_HAS_STD_SHARED_PTR) # include <memory> -#else +#else // defined(BOOST_ASIO_HAS_STD_SHARED_PTR) # include <boost/weak_ptr.hpp> -#endif +#endif // defined(BOOST_ASIO_HAS_STD_SHARED_PTR) namespace boost { namespace asio { namespace detail { -#if defined(_MSC_VER) && (_MSC_VER >= 1600) +#if defined(BOOST_ASIO_HAS_STD_SHARED_PTR) using std::weak_ptr; -#else +#else // defined(BOOST_ASIO_HAS_STD_SHARED_PTR) using boost::weak_ptr; -#endif +#endif // defined(BOOST_ASIO_HAS_STD_SHARED_PTR) } // namespace detail } // namespace asio diff --git a/3rdParty/Boost/src/boost/asio/detail/win_event.hpp b/3rdParty/Boost/src/boost/asio/detail/win_event.hpp index 63c25c4..6314048 100644 --- a/3rdParty/Boost/src/boost/asio/detail/win_event.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/win_event.hpp @@ -2,7 +2,7 @@ // detail/win_event.hpp // ~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/win_fd_set_adapter.hpp b/3rdParty/Boost/src/boost/asio/detail/win_fd_set_adapter.hpp index 8636a91..afb40d0 100644 --- a/3rdParty/Boost/src/boost/asio/detail/win_fd_set_adapter.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/win_fd_set_adapter.hpp @@ -2,7 +2,7 @@ // detail/win_fd_set_adapter.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -19,6 +19,7 @@ #if defined(BOOST_WINDOWS) || defined(__CYGWIN__) +#include <boost/asio/detail/noncopyable.hpp> #include <boost/asio/detail/socket_types.hpp> #include <boost/asio/detail/push_options.hpp> @@ -28,39 +29,67 @@ namespace asio { namespace detail { // Adapts the FD_SET type to meet the Descriptor_Set concept's requirements. -class win_fd_set_adapter +class win_fd_set_adapter : noncopyable { public: - enum { win_fd_set_size = 1024 }; + enum { default_fd_set_size = 1024 }; win_fd_set_adapter() - : max_descriptor_(invalid_socket) + : capacity_(default_fd_set_size), + max_descriptor_(invalid_socket) { - fd_set_.fd_count = 0; + fd_set_ = static_cast<win_fd_set*>(::operator new( + sizeof(win_fd_set) - sizeof(SOCKET) + + sizeof(SOCKET) * (capacity_))); + fd_set_->fd_count = 0; + } + + ~win_fd_set_adapter() + { + ::operator delete(fd_set_); + } + + void reset() + { + fd_set_->fd_count = 0; + max_descriptor_ = invalid_socket; } bool set(socket_type descriptor) { - for (u_int i = 0; i < fd_set_.fd_count; ++i) - if (fd_set_.fd_array[i] == descriptor) + for (u_int i = 0; i < fd_set_->fd_count; ++i) + if (fd_set_->fd_array[i] == descriptor) return true; - if (fd_set_.fd_count < win_fd_set_size) + + if (fd_set_->fd_count == capacity_) { - fd_set_.fd_array[fd_set_.fd_count++] = descriptor; - return true; + u_int new_capacity = capacity_ + capacity_ / 2; + win_fd_set* new_fd_set = static_cast<win_fd_set*>(::operator new( + sizeof(win_fd_set) - sizeof(SOCKET) + + sizeof(SOCKET) * (new_capacity))); + + new_fd_set->fd_count = fd_set_->fd_count; + for (u_int i = 0; i < fd_set_->fd_count; ++i) + new_fd_set->fd_array[i] = fd_set_->fd_array[i]; + + ::operator delete(fd_set_); + fd_set_ = new_fd_set; + capacity_ = new_capacity; } - return false; + + fd_set_->fd_array[fd_set_->fd_count++] = descriptor; + return true; } bool is_set(socket_type descriptor) const { return !!__WSAFDIsSet(descriptor, - const_cast<fd_set*>(reinterpret_cast<const fd_set*>(&fd_set_))); + const_cast<fd_set*>(reinterpret_cast<const fd_set*>(fd_set_))); } operator fd_set*() { - return reinterpret_cast<fd_set*>(&fd_set_); + return reinterpret_cast<fd_set*>(fd_set_); } socket_type max_descriptor() const @@ -69,15 +98,19 @@ public: } private: + // This structure is defined to be compatible with the Windows API fd_set - // structure, but without being dependent on the value of FD_SETSIZE. + // structure, but without being dependent on the value of FD_SETSIZE. We use + // the "struct hack" to allow the number of descriptors to be varied at + // runtime. struct win_fd_set { u_int fd_count; - SOCKET fd_array[win_fd_set_size]; + SOCKET fd_array[1]; }; - win_fd_set fd_set_; + win_fd_set* fd_set_; + u_int capacity_; socket_type max_descriptor_; }; diff --git a/3rdParty/Boost/src/boost/asio/detail/win_fenced_block.hpp b/3rdParty/Boost/src/boost/asio/detail/win_fenced_block.hpp index 769db2e..5e56aa3 100644 --- a/3rdParty/Boost/src/boost/asio/detail/win_fenced_block.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/win_fenced_block.hpp @@ -2,7 +2,7 @@ // detail/win_fenced_block.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -31,8 +31,16 @@ class win_fenced_block : private noncopyable { public: - // Constructor. - win_fenced_block() + enum half_t { half }; + enum full_t { full }; + + // Constructor for a half fenced block. + explicit win_fenced_block(half_t) + { + } + + // Constructor for a full fenced block. + explicit win_fenced_block(full_t) { #if defined(__BORLANDC__) LONG barrier = 0; diff --git a/3rdParty/Boost/src/boost/asio/detail/win_iocp_handle_read_op.hpp b/3rdParty/Boost/src/boost/asio/detail/win_iocp_handle_read_op.hpp index 5edffa3..8b41ab4 100644 --- a/3rdParty/Boost/src/boost/asio/detail/win_iocp_handle_read_op.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/win_iocp_handle_read_op.hpp @@ -2,7 +2,7 @@ // detail/win_iocp_handle_read_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) // Copyright (c) 2008 Rep Invariant Systems, Inc. (info@repinvariant.com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -41,20 +41,26 @@ class win_iocp_handle_read_op : public operation public: BOOST_ASIO_DEFINE_HANDLER_PTR(win_iocp_handle_read_op); - win_iocp_handle_read_op(const MutableBufferSequence& buffers, Handler handler) + win_iocp_handle_read_op( + const MutableBufferSequence& buffers, Handler& handler) : operation(&win_iocp_handle_read_op::do_complete), buffers_(buffers), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)) { } static void do_complete(io_service_impl* owner, operation* base, - boost::system::error_code ec, std::size_t bytes_transferred) + const boost::system::error_code& result_ec, + std::size_t bytes_transferred) { + boost::system::error_code ec(result_ec); + // Take ownership of the operation object. win_iocp_handle_read_op* o(static_cast<win_iocp_handle_read_op*>(base)); ptr p = { boost::addressof(o->handler_), o, o }; + BOOST_ASIO_HANDLER_COMPLETION((o)); + #if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING) if (owner) { @@ -82,8 +88,10 @@ public: // Make the upcall if required. if (owner) { - boost::asio::detail::fenced_block b; + fenced_block b(fenced_block::half); + BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_)); boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_); + BOOST_ASIO_HANDLER_INVOCATION_END; } } diff --git a/3rdParty/Boost/src/boost/asio/detail/win_iocp_handle_service.hpp b/3rdParty/Boost/src/boost/asio/detail/win_iocp_handle_service.hpp index 86c4391..68a9f90 100644 --- a/3rdParty/Boost/src/boost/asio/detail/win_iocp_handle_service.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/win_iocp_handle_service.hpp @@ -2,7 +2,7 @@ // detail/win_iocp_handle_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) // Copyright (c) 2008 Rep Invariant Systems, Inc. (info@repinvariant.com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -41,7 +41,7 @@ class win_iocp_handle_service { public: // The native type of a stream handle. - typedef HANDLE native_type; + typedef HANDLE native_handle_type; // The implementation type of the stream handle. class implementation_type @@ -61,7 +61,7 @@ public: friend class win_iocp_handle_service; // The native stream handle representation. - native_type handle_; + native_handle_type handle_; // The ID of the thread from which it is safe to cancel asynchronous // operations. 0 means no asynchronous operations have been started yet. @@ -82,12 +82,21 @@ public: // Construct a new handle implementation. BOOST_ASIO_DECL void construct(implementation_type& impl); + // Move-construct a new handle implementation. + BOOST_ASIO_DECL void move_construct(implementation_type& impl, + implementation_type& other_impl); + + // Move-assign from another handle implementation. + BOOST_ASIO_DECL void move_assign(implementation_type& impl, + win_iocp_handle_service& other_service, + implementation_type& other_impl); + // Destroy a handle implementation. BOOST_ASIO_DECL void destroy(implementation_type& impl); // Assign a native handle to a handle implementation. BOOST_ASIO_DECL boost::system::error_code assign(implementation_type& impl, - const native_type& native_handle, boost::system::error_code& ec); + const native_handle_type& handle, boost::system::error_code& ec); // Determine whether the handle is open. bool is_open(const implementation_type& impl) const @@ -100,7 +109,7 @@ public: boost::system::error_code& ec); // Get the native handle representation. - native_type native(const implementation_type& impl) const + native_handle_type native_handle(const implementation_type& impl) const { return impl.handle_; } @@ -136,7 +145,19 @@ public: void async_write_some(implementation_type& impl, const ConstBufferSequence& buffers, Handler handler) { - async_write_some_at(impl, 0, buffers, handler); + // Allocate and construct an operation to wrap the handler. + typedef win_iocp_handle_write_op<ConstBufferSequence, Handler> op; + typename op::ptr p = { boost::addressof(handler), + boost_asio_handler_alloc_helpers::allocate( + sizeof(op), handler), 0 }; + p.p = new (p.v) op(buffers, handler); + + BOOST_ASIO_HANDLER_CREATION((p.p, "handle", &impl, "async_write_some")); + + start_write_op(impl, 0, + buffer_sequence_adapter<boost::asio::const_buffer, + ConstBufferSequence>::first(buffers), p.p); + p.v = p.p = 0; } // Start an asynchronous write at a specified offset. The data being written @@ -152,6 +173,8 @@ public: sizeof(op), handler), 0 }; p.p = new (p.v) op(buffers, handler); + BOOST_ASIO_HANDLER_CREATION((p.p, "handle", &impl, "async_write_some_at")); + start_write_op(impl, offset, buffer_sequence_adapter<boost::asio::const_buffer, ConstBufferSequence>::first(buffers), p.p); @@ -184,7 +207,19 @@ public: void async_read_some(implementation_type& impl, const MutableBufferSequence& buffers, Handler handler) { - async_read_some_at(impl, 0, buffers, handler); + // Allocate and construct an operation to wrap the handler. + typedef win_iocp_handle_read_op<MutableBufferSequence, Handler> op; + typename op::ptr p = { boost::addressof(handler), + boost_asio_handler_alloc_helpers::allocate( + sizeof(op), handler), 0 }; + p.p = new (p.v) op(buffers, handler); + + BOOST_ASIO_HANDLER_CREATION((p.p, "handle", &impl, "async_read_some")); + + start_read_op(impl, 0, + buffer_sequence_adapter<boost::asio::mutable_buffer, + MutableBufferSequence>::first(buffers), p.p); + p.v = p.p = 0; } // Start an asynchronous read at a specified offset. The buffer for the data @@ -201,6 +236,8 @@ public: sizeof(op), handler), 0 }; p.p = new (p.v) op(buffers, handler); + BOOST_ASIO_HANDLER_CREATION((p.p, "handle", &impl, "async_read_some_at")); + start_read_op(impl, offset, buffer_sequence_adapter<boost::asio::mutable_buffer, MutableBufferSequence>::first(buffers), p.p); diff --git a/3rdParty/Boost/src/boost/asio/detail/win_iocp_handle_write_op.hpp b/3rdParty/Boost/src/boost/asio/detail/win_iocp_handle_write_op.hpp index 574dc22..c87cd60 100644 --- a/3rdParty/Boost/src/boost/asio/detail/win_iocp_handle_write_op.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/win_iocp_handle_write_op.hpp @@ -2,7 +2,7 @@ // detail/win_iocp_handle_write_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) // Copyright (c) 2008 Rep Invariant Systems, Inc. (info@repinvariant.com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -41,20 +41,22 @@ class win_iocp_handle_write_op : public operation public: BOOST_ASIO_DEFINE_HANDLER_PTR(win_iocp_handle_write_op); - win_iocp_handle_write_op(const ConstBufferSequence& buffers, Handler handler) + win_iocp_handle_write_op(const ConstBufferSequence& buffers, Handler& handler) : operation(&win_iocp_handle_write_op::do_complete), buffers_(buffers), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)) { } static void do_complete(io_service_impl* owner, operation* base, - boost::system::error_code ec, std::size_t bytes_transferred) + const boost::system::error_code& ec, std::size_t bytes_transferred) { // Take ownership of the operation object. win_iocp_handle_write_op* o(static_cast<win_iocp_handle_write_op*>(base)); ptr p = { boost::addressof(o->handler_), o, o }; + BOOST_ASIO_HANDLER_COMPLETION((o)); + #if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING) if (owner) { @@ -78,8 +80,10 @@ public: // Make the upcall if required. if (owner) { - boost::asio::detail::fenced_block b; + fenced_block b(fenced_block::half); + BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_)); boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_); + BOOST_ASIO_HANDLER_INVOCATION_END; } } diff --git a/3rdParty/Boost/src/boost/asio/detail/win_iocp_io_service.hpp b/3rdParty/Boost/src/boost/asio/detail/win_iocp_io_service.hpp index 4c88e7b..0e3bb0b 100644 --- a/3rdParty/Boost/src/boost/asio/detail/win_iocp_io_service.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/win_iocp_io_service.hpp @@ -2,7 +2,7 @@ // detail/win_iocp_io_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -19,18 +19,20 @@ #if defined(BOOST_ASIO_HAS_IOCP) -#include <boost/scoped_ptr.hpp> +#include <boost/limits.hpp> #include <boost/asio/io_service.hpp> +#include <boost/asio/detail/call_stack.hpp> #include <boost/asio/detail/mutex.hpp> #include <boost/asio/detail/op_queue.hpp> +#include <boost/asio/detail/scoped_ptr.hpp> #include <boost/asio/detail/socket_types.hpp> -#include <boost/asio/detail/timer_op.hpp> +#include <boost/asio/detail/thread.hpp> #include <boost/asio/detail/timer_queue_base.hpp> #include <boost/asio/detail/timer_queue_fwd.hpp> #include <boost/asio/detail/timer_queue_set.hpp> +#include <boost/asio/detail/wait_op.hpp> #include <boost/asio/detail/win_iocp_io_service_fwd.hpp> #include <boost/asio/detail/win_iocp_operation.hpp> -#include <boost/asio/detail/thread.hpp> #include <boost/asio/detail/push_options.hpp> @@ -38,16 +40,17 @@ namespace boost { namespace asio { namespace detail { -class timer_op; +class wait_op; class win_iocp_io_service : public boost::asio::detail::service_base<win_iocp_io_service> { public: - // Constructor. - BOOST_ASIO_DECL win_iocp_io_service(boost::asio::io_service& io_service); - BOOST_ASIO_DECL void init(size_t concurrency_hint); + // Constructor. Specifies a concurrency hint that is passed through to the + // underlying I/O completion port. + BOOST_ASIO_DECL win_iocp_io_service(boost::asio::io_service& io_service, + size_t concurrency_hint = 0); // Destroy all user-defined handler objects owned by the service. BOOST_ASIO_DECL void shutdown_service(); @@ -76,6 +79,12 @@ public: // Stop the event processing loop. BOOST_ASIO_DECL void stop(); + // Determine whether the io_service is stopped. + bool stopped() const + { + return ::InterlockedExchangeAdd(&stopped_, 0) != 0; + } + // Reset in preparation for a subsequent run invocation. void reset() { @@ -95,6 +104,12 @@ public: stop(); } + // Return whether a handler can be dispatched immediately. + bool can_dispatch() + { + return call_stack<win_iocp_io_service>::contains(this) != 0; + } + // Request invocation of the given handler. template <typename Handler> void dispatch(Handler handler); @@ -120,6 +135,26 @@ public: BOOST_ASIO_DECL void post_deferred_completions( op_queue<win_iocp_operation>& ops); + // Request invocation of the given operation using the thread-private queue + // and return immediately. Assumes that work_started() has not yet been + // called for the operation. + void post_private_immediate_completion(win_iocp_operation* op) + { + post_immediate_completion(op); + } + + // Request invocation of the given operation using the thread-private queue + // and return immediately. Assumes that work_started() was previously called + // for the operation. + void post_private_deferred_completion(win_iocp_operation* op) + { + post_deferred_completion(op); + } + + // Process unfinished operations as part of a shutdown_service operation. + // Assumes that work_started() was previously called for the operations. + BOOST_ASIO_DECL void abandon_operations(op_queue<operation>& ops); + // Called after starting an overlapped I/O operation that did not complete // immediately. The caller must have already called work_started() prior to // starting the operation. @@ -150,13 +185,14 @@ public: template <typename Time_Traits> void schedule_timer(timer_queue<Time_Traits>& queue, const typename Time_Traits::time_type& time, - typename timer_queue<Time_Traits>::per_timer_data& timer, timer_op* op); + typename timer_queue<Time_Traits>::per_timer_data& timer, wait_op* op); // Cancel the timer associated with the given token. Returns the number of // handlers that have been posted or dispatched. template <typename Time_Traits> std::size_t cancel_timer(timer_queue<Time_Traits>& queue, - typename timer_queue<Time_Traits>::per_timer_data& timer); + typename timer_queue<Time_Traits>::per_timer_data& timer, + std::size_t max_cancelled = (std::numeric_limits<std::size_t>::max)()); private: #if defined(WINVER) && (WINVER < 0x0500) @@ -199,7 +235,7 @@ private: long outstanding_work_; // Flag to indicate whether the event loop has been stopped. - long stopped_; + mutable long stopped_; // Flag to indicate whether the service has been shut down. long shutdown_; @@ -233,7 +269,7 @@ private: friend struct timer_thread_function; // Background thread used for processing timeouts. - boost::scoped_ptr<thread> timer_thread_; + scoped_ptr<thread> timer_thread_; // A waitable timer object used for waiting for timeouts. auto_handle waitable_timer_; diff --git a/3rdParty/Boost/src/boost/asio/detail/win_iocp_io_service_fwd.hpp b/3rdParty/Boost/src/boost/asio/detail/win_iocp_io_service_fwd.hpp index b6da9ec..ec31fa1 100644 --- a/3rdParty/Boost/src/boost/asio/detail/win_iocp_io_service_fwd.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/win_iocp_io_service_fwd.hpp @@ -2,7 +2,7 @@ // detail/win_iocp_io_service_fwd.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/win_iocp_null_buffers_op.hpp b/3rdParty/Boost/src/boost/asio/detail/win_iocp_null_buffers_op.hpp index b3ecbbd..021dfdb 100644 --- a/3rdParty/Boost/src/boost/asio/detail/win_iocp_null_buffers_op.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/win_iocp_null_buffers_op.hpp @@ -2,7 +2,7 @@ // detail/win_iocp_null_buffers_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -42,11 +42,11 @@ public: BOOST_ASIO_DEFINE_HANDLER_PTR(win_iocp_null_buffers_op); win_iocp_null_buffers_op(socket_ops::weak_cancel_token_type cancel_token, - Handler handler) + Handler& handler) : reactor_op(&win_iocp_null_buffers_op::do_perform, &win_iocp_null_buffers_op::do_complete), cancel_token_(cancel_token), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)) { } @@ -56,12 +56,17 @@ public: } static void do_complete(io_service_impl* owner, operation* base, - boost::system::error_code ec, std::size_t bytes_transferred) + const boost::system::error_code& result_ec, + std::size_t bytes_transferred) { + boost::system::error_code ec(result_ec); + // Take ownership of the operation object. win_iocp_null_buffers_op* o(static_cast<win_iocp_null_buffers_op*>(base)); ptr p = { boost::addressof(o->handler_), o, o }; + BOOST_ASIO_HANDLER_COMPLETION((o)); + // The reactor may have stored a result in the operation object. if (o->ec_) ec = o->ec_; @@ -93,8 +98,10 @@ public: // Make the upcall if required. if (owner) { - boost::asio::detail::fenced_block b; + fenced_block b(fenced_block::half); + BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_)); boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_); + BOOST_ASIO_HANDLER_INVOCATION_END; } } diff --git a/3rdParty/Boost/src/boost/asio/detail/win_iocp_operation.hpp b/3rdParty/Boost/src/boost/asio/detail/win_iocp_operation.hpp index 3963479..67b5466 100644 --- a/3rdParty/Boost/src/boost/asio/detail/win_iocp_operation.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/win_iocp_operation.hpp @@ -2,7 +2,7 @@ // detail/win_iocp_operation.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -19,7 +19,9 @@ #if defined(BOOST_ASIO_HAS_IOCP) +#include <boost/asio/detail/handler_tracking.hpp> #include <boost/asio/detail/op_queue.hpp> +#include <boost/asio/detail/socket_types.hpp> #include <boost/asio/detail/win_iocp_io_service_fwd.hpp> #include <boost/system/error_code.hpp> @@ -33,11 +35,12 @@ namespace detail { // functions to avoid the associated overhead. class win_iocp_operation : public OVERLAPPED + BOOST_ASIO_ALSO_INHERIT_TRACKED_HANDLER { public: void complete(win_iocp_io_service& owner, - const boost::system::error_code& ec = boost::system::error_code(), - std::size_t bytes_transferred = 0) + const boost::system::error_code& ec, + std::size_t bytes_transferred) { func_(&owner, this, ec, bytes_transferred); } @@ -48,8 +51,9 @@ public: } protected: - typedef void (*func_type)(win_iocp_io_service*, - win_iocp_operation*, boost::system::error_code, std::size_t); + typedef void (*func_type)( + win_iocp_io_service*, win_iocp_operation*, + const boost::system::error_code&, std::size_t); win_iocp_operation(func_type func) : next_(0), diff --git a/3rdParty/Boost/src/boost/asio/detail/win_iocp_overlapped_op.hpp b/3rdParty/Boost/src/boost/asio/detail/win_iocp_overlapped_op.hpp index 149eaa5..235f48e 100644 --- a/3rdParty/Boost/src/boost/asio/detail/win_iocp_overlapped_op.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/win_iocp_overlapped_op.hpp @@ -2,7 +2,7 @@ // detail/win_iocp_overlapped_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -39,19 +39,21 @@ class win_iocp_overlapped_op : public operation public: BOOST_ASIO_DEFINE_HANDLER_PTR(win_iocp_overlapped_op); - win_iocp_overlapped_op(Handler handler) + win_iocp_overlapped_op(Handler& handler) : operation(&win_iocp_overlapped_op::do_complete), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)) { } static void do_complete(io_service_impl* owner, operation* base, - boost::system::error_code ec, std::size_t bytes_transferred) + const boost::system::error_code& ec, std::size_t bytes_transferred) { // Take ownership of the operation object. win_iocp_overlapped_op* o(static_cast<win_iocp_overlapped_op*>(base)); ptr p = { boost::addressof(o->handler_), o, o }; + BOOST_ASIO_HANDLER_COMPLETION((o)); + // Make a copy of the handler so that the memory can be deallocated before // the upcall is made. Even if we're not about to make an upcall, a // sub-object of the handler may be the true owner of the memory associated @@ -66,8 +68,10 @@ public: // Make the upcall if required. if (owner) { - boost::asio::detail::fenced_block b; + fenced_block b(fenced_block::half); + BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_)); boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_); + BOOST_ASIO_HANDLER_INVOCATION_END; } } diff --git a/3rdParty/Boost/src/boost/asio/detail/win_iocp_overlapped_ptr.hpp b/3rdParty/Boost/src/boost/asio/detail/win_iocp_overlapped_ptr.hpp index c560bc3..a6df254 100644 --- a/3rdParty/Boost/src/boost/asio/detail/win_iocp_overlapped_ptr.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/win_iocp_overlapped_ptr.hpp @@ -2,7 +2,7 @@ // detail/win_iocp_overlapped_ptr.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -47,11 +47,11 @@ public: // Construct an win_iocp_overlapped_ptr to contain the specified handler. template <typename Handler> explicit win_iocp_overlapped_ptr( - boost::asio::io_service& io_service, Handler handler) + boost::asio::io_service& io_service, BOOST_ASIO_MOVE_ARG(Handler) handler) : ptr_(0), iocp_service_(0) { - this->reset(io_service, handler); + this->reset(io_service, BOOST_ASIO_MOVE_CAST(Handler)(handler)); } // Destructor automatically frees the OVERLAPPED object unless released. @@ -82,6 +82,10 @@ public: boost_asio_handler_alloc_helpers::allocate( sizeof(op), handler), 0 }; p.p = new (p.v) op(handler); + + BOOST_ASIO_HANDLER_CREATION((p.p, "io_service", + &io_service.impl_, "overlapped")); + io_service.impl_.work_started(); reset(); ptr_ = p.p; diff --git a/3rdParty/Boost/src/boost/asio/detail/win_iocp_serial_port_service.hpp b/3rdParty/Boost/src/boost/asio/detail/win_iocp_serial_port_service.hpp index 8b543d2..7d96f6d 100644 --- a/3rdParty/Boost/src/boost/asio/detail/win_iocp_serial_port_service.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/win_iocp_serial_port_service.hpp @@ -2,7 +2,7 @@ // detail/win_iocp_serial_port_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) // Copyright (c) 2008 Rep Invariant Systems, Inc. (info@repinvariant.com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -36,7 +36,7 @@ class win_iocp_serial_port_service { public: // The native type of a serial port. - typedef win_iocp_handle_service::native_type native_type; + typedef win_iocp_handle_service::native_handle_type native_handle_type; // The implementation type of the serial port. typedef win_iocp_handle_service::implementation_type implementation_type; @@ -54,6 +54,22 @@ public: handle_service_.construct(impl); } + // Move-construct a new serial port implementation. + void move_construct(implementation_type& impl, + implementation_type& other_impl) + { + handle_service_.move_construct(impl, other_impl); + } + + // Move-assign from another serial port implementation. + void move_assign(implementation_type& impl, + win_iocp_serial_port_service& other_service, + implementation_type& other_impl) + { + handle_service_.move_assign(impl, + other_service.handle_service_, other_impl); + } + // Destroy a serial port implementation. void destroy(implementation_type& impl) { @@ -66,9 +82,9 @@ public: // Assign a native handle to a serial port implementation. boost::system::error_code assign(implementation_type& impl, - const native_type& native_handle, boost::system::error_code& ec) + const native_handle_type& handle, boost::system::error_code& ec) { - return handle_service_.assign(impl, native_handle, ec); + return handle_service_.assign(impl, handle, ec); } // Determine whether the serial port is open. @@ -85,9 +101,9 @@ public: } // Get the native serial port representation. - native_type native(implementation_type& impl) + native_handle_type native_handle(implementation_type& impl) { - return handle_service_.native(impl); + return handle_service_.native_handle(impl); } // Cancel all operations associated with the handle. diff --git a/3rdParty/Boost/src/boost/asio/detail/win_iocp_socket_accept_op.hpp b/3rdParty/Boost/src/boost/asio/detail/win_iocp_socket_accept_op.hpp index ecc1f2d..18db3b4 100644 --- a/3rdParty/Boost/src/boost/asio/detail/win_iocp_socket_accept_op.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/win_iocp_socket_accept_op.hpp @@ -2,7 +2,7 @@ // detail/win_iocp_socket_accept_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -45,7 +45,7 @@ public: win_iocp_socket_accept_op(win_iocp_socket_service_base& socket_service, socket_type socket, Socket& peer, const Protocol& protocol, typename Protocol::endpoint* peer_endpoint, - bool enable_connection_aborted, Handler handler) + bool enable_connection_aborted, Handler& handler) : operation(&win_iocp_socket_accept_op::do_complete), socket_service_(socket_service), socket_(socket), @@ -53,7 +53,7 @@ public: protocol_(protocol), peer_endpoint_(peer_endpoint), enable_connection_aborted_(enable_connection_aborted), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)) { } @@ -73,8 +73,11 @@ public: } static void do_complete(io_service_impl* owner, operation* base, - boost::system::error_code ec, std::size_t /*bytes_transferred*/) + const boost::system::error_code& result_ec, + std::size_t /*bytes_transferred*/) { + boost::system::error_code ec(result_ec); + // Take ownership of the operation object. win_iocp_socket_accept_op* o(static_cast<win_iocp_socket_accept_op*>(base)); ptr p = { boost::addressof(o->handler_), o, o }; @@ -107,7 +110,7 @@ public: if (!ec) { o->peer_.assign(o->protocol_, - typename Socket::native_type( + typename Socket::native_handle_type( o->new_socket_.get(), peer_endpoint), ec); if (!ec) o->new_socket_.release(); @@ -118,6 +121,8 @@ public: *o->peer_endpoint_ = peer_endpoint; } + BOOST_ASIO_HANDLER_COMPLETION((o)); + // Make a copy of the handler so that the memory can be deallocated before // the upcall is made. Even if we're not about to make an upcall, a // sub-object of the handler may be the true owner of the memory associated @@ -132,8 +137,10 @@ public: // Make the upcall if required. if (owner) { - boost::asio::detail::fenced_block b; + fenced_block b(fenced_block::half); + BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_)); boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_); + BOOST_ASIO_HANDLER_INVOCATION_END; } } diff --git a/3rdParty/Boost/src/boost/asio/detail/win_iocp_socket_recv_op.hpp b/3rdParty/Boost/src/boost/asio/detail/win_iocp_socket_recv_op.hpp index 61d053c..b50b742 100644 --- a/3rdParty/Boost/src/boost/asio/detail/win_iocp_socket_recv_op.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/win_iocp_socket_recv_op.hpp @@ -2,7 +2,7 @@ // detail/win_iocp_socket_recv_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -43,22 +43,27 @@ public: win_iocp_socket_recv_op(socket_ops::state_type state, socket_ops::weak_cancel_token_type cancel_token, - const MutableBufferSequence& buffers, Handler handler) + const MutableBufferSequence& buffers, Handler& handler) : operation(&win_iocp_socket_recv_op::do_complete), state_(state), cancel_token_(cancel_token), buffers_(buffers), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)) { } static void do_complete(io_service_impl* owner, operation* base, - boost::system::error_code ec, std::size_t bytes_transferred) + const boost::system::error_code& result_ec, + std::size_t bytes_transferred) { + boost::system::error_code ec(result_ec); + // Take ownership of the operation object. win_iocp_socket_recv_op* o(static_cast<win_iocp_socket_recv_op*>(base)); ptr p = { boost::addressof(o->handler_), o, o }; + BOOST_ASIO_HANDLER_COMPLETION((o)); + #if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING) // Check whether buffers are still valid. if (owner) @@ -87,8 +92,10 @@ public: // Make the upcall if required. if (owner) { - boost::asio::detail::fenced_block b; + fenced_block b(fenced_block::half); + BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_)); boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_); + BOOST_ASIO_HANDLER_INVOCATION_END; } } diff --git a/3rdParty/Boost/src/boost/asio/detail/win_iocp_socket_recvfrom_op.hpp b/3rdParty/Boost/src/boost/asio/detail/win_iocp_socket_recvfrom_op.hpp index 6b364ee..798921d 100644 --- a/3rdParty/Boost/src/boost/asio/detail/win_iocp_socket_recvfrom_op.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/win_iocp_socket_recvfrom_op.hpp @@ -2,7 +2,7 @@ // detail/win_iocp_socket_recvfrom_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -43,13 +43,13 @@ public: win_iocp_socket_recvfrom_op(Endpoint& endpoint, socket_ops::weak_cancel_token_type cancel_token, - const MutableBufferSequence& buffers, Handler handler) + const MutableBufferSequence& buffers, Handler& handler) : operation(&win_iocp_socket_recvfrom_op::do_complete), endpoint_(endpoint), endpoint_size_(static_cast<int>(endpoint.capacity())), cancel_token_(cancel_token), buffers_(buffers), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)) { } @@ -59,13 +59,18 @@ public: } static void do_complete(io_service_impl* owner, operation* base, - boost::system::error_code ec, std::size_t bytes_transferred) + const boost::system::error_code& result_ec, + std::size_t bytes_transferred) { + boost::system::error_code ec(result_ec); + // Take ownership of the operation object. win_iocp_socket_recvfrom_op* o( static_cast<win_iocp_socket_recvfrom_op*>(base)); ptr p = { boost::addressof(o->handler_), o, o }; + BOOST_ASIO_HANDLER_COMPLETION((o)); + #if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING) // Check whether buffers are still valid. if (owner) @@ -94,8 +99,10 @@ public: // Make the upcall if required. if (owner) { - boost::asio::detail::fenced_block b; + fenced_block b(fenced_block::half); + BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_)); boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_); + BOOST_ASIO_HANDLER_INVOCATION_END; } } diff --git a/3rdParty/Boost/src/boost/asio/detail/win_iocp_socket_recvmsg_op.hpp b/3rdParty/Boost/src/boost/asio/detail/win_iocp_socket_recvmsg_op.hpp new file mode 100644 index 0000000..db13fb8 --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/detail/win_iocp_socket_recvmsg_op.hpp @@ -0,0 +1,118 @@ +// +// detail/win_iocp_socket_recvmsg_op.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) +// + +#ifndef BOOST_ASIO_DETAIL_WIN_IOCP_SOCKET_RECVMSG_OP_HPP +#define BOOST_ASIO_DETAIL_WIN_IOCP_SOCKET_RECVMSG_OP_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> + +#if defined(BOOST_ASIO_HAS_IOCP) + +#include <boost/utility/addressof.hpp> +#include <boost/asio/detail/bind_handler.hpp> +#include <boost/asio/detail/buffer_sequence_adapter.hpp> +#include <boost/asio/detail/fenced_block.hpp> +#include <boost/asio/detail/handler_alloc_helpers.hpp> +#include <boost/asio/detail/handler_invoke_helpers.hpp> +#include <boost/asio/detail/operation.hpp> +#include <boost/asio/detail/socket_ops.hpp> +#include <boost/asio/error.hpp> +#include <boost/asio/socket_base.hpp> + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { +namespace detail { + +template <typename MutableBufferSequence, typename Handler> +class win_iocp_socket_recvmsg_op : public operation +{ +public: + BOOST_ASIO_DEFINE_HANDLER_PTR(win_iocp_socket_recvmsg_op); + + win_iocp_socket_recvmsg_op( + socket_ops::weak_cancel_token_type cancel_token, + const MutableBufferSequence& buffers, + socket_base::message_flags& out_flags, Handler& handler) + : operation(&win_iocp_socket_recvmsg_op::do_complete), + cancel_token_(cancel_token), + buffers_(buffers), + out_flags_(out_flags), + handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)) + { + } + + static void do_complete(io_service_impl* owner, operation* base, + const boost::system::error_code& result_ec, + std::size_t bytes_transferred) + { + boost::system::error_code ec(result_ec); + + // Take ownership of the operation object. + win_iocp_socket_recvmsg_op* o( + static_cast<win_iocp_socket_recvmsg_op*>(base)); + ptr p = { boost::addressof(o->handler_), o, o }; + + BOOST_ASIO_HANDLER_COMPLETION((o)); + +#if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING) + // Check whether buffers are still valid. + if (owner) + { + buffer_sequence_adapter<boost::asio::mutable_buffer, + MutableBufferSequence>::validate(o->buffers_); + } +#endif // defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING) + + socket_ops::complete_iocp_recvmsg(o->cancel_token_, ec); + o->out_flags_ = 0; + + // Make a copy of the handler so that the memory can be deallocated before + // the upcall is made. Even if we're not about to make an upcall, a + // sub-object of the handler may be the true owner of the memory associated + // with the handler. Consequently, a local copy of the handler is required + // to ensure that any owning sub-object remains valid until after we have + // deallocated the memory here. + detail::binder2<Handler, boost::system::error_code, std::size_t> + handler(o->handler_, ec, bytes_transferred); + p.h = boost::addressof(handler.handler_); + p.reset(); + + // Make the upcall if required. + if (owner) + { + fenced_block b(fenced_block::half); + BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_)); + boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_); + BOOST_ASIO_HANDLER_INVOCATION_END; + } + } + +private: + socket_ops::weak_cancel_token_type cancel_token_; + MutableBufferSequence buffers_; + socket_base::message_flags& out_flags_; + Handler handler_; +}; + +} // namespace detail +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#endif // defined(BOOST_ASIO_HAS_IOCP) + +#endif // BOOST_ASIO_DETAIL_WIN_IOCP_SOCKET_RECVMSG_OP_HPP diff --git a/3rdParty/Boost/src/boost/asio/detail/win_iocp_socket_send_op.hpp b/3rdParty/Boost/src/boost/asio/detail/win_iocp_socket_send_op.hpp index 33bd380..fbd00ca 100644 --- a/3rdParty/Boost/src/boost/asio/detail/win_iocp_socket_send_op.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/win_iocp_socket_send_op.hpp @@ -2,7 +2,7 @@ // detail/win_iocp_socket_send_op.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -42,21 +42,26 @@ public: BOOST_ASIO_DEFINE_HANDLER_PTR(win_iocp_socket_send_op); win_iocp_socket_send_op(socket_ops::weak_cancel_token_type cancel_token, - const ConstBufferSequence& buffers, Handler handler) + const ConstBufferSequence& buffers, Handler& handler) : operation(&win_iocp_socket_send_op::do_complete), cancel_token_(cancel_token), buffers_(buffers), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)) { } static void do_complete(io_service_impl* owner, operation* base, - boost::system::error_code ec, std::size_t bytes_transferred) + const boost::system::error_code& result_ec, + std::size_t bytes_transferred) { + boost::system::error_code ec(result_ec); + // Take ownership of the operation object. win_iocp_socket_send_op* o(static_cast<win_iocp_socket_send_op*>(base)); ptr p = { boost::addressof(o->handler_), o, o }; + BOOST_ASIO_HANDLER_COMPLETION((o)); + #if defined(BOOST_ASIO_ENABLE_BUFFER_DEBUGGING) // Check whether buffers are still valid. if (owner) @@ -82,8 +87,10 @@ public: // Make the upcall if required. if (owner) { - boost::asio::detail::fenced_block b; + fenced_block b(fenced_block::half); + BOOST_ASIO_HANDLER_INVOCATION_BEGIN((handler.arg1_, handler.arg2_)); boost_asio_handler_invoke_helpers::invoke(handler, handler.handler_); + BOOST_ASIO_HANDLER_INVOCATION_END; } } diff --git a/3rdParty/Boost/src/boost/asio/detail/win_iocp_socket_service.hpp b/3rdParty/Boost/src/boost/asio/detail/win_iocp_socket_service.hpp index 183b74b..d6dc98b 100644 --- a/3rdParty/Boost/src/boost/asio/detail/win_iocp_socket_service.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/win_iocp_socket_service.hpp @@ -2,7 +2,7 @@ // detail/win_iocp_socket_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -61,16 +61,16 @@ public: typedef typename Protocol::endpoint endpoint_type; // The native type of a socket. - class native_type + class native_handle_type { public: - native_type(socket_type s) + native_handle_type(socket_type s) : socket_(s), have_remote_endpoint_(false) { } - native_type(socket_type s, const endpoint_type& ep) + native_handle_type(socket_type s, const endpoint_type& ep) : socket_(s), have_remote_endpoint_(true), remote_endpoint_(ep) @@ -133,6 +133,39 @@ public: { } + // Move-construct a new socket implementation. + void move_construct(implementation_type& impl, + implementation_type& other_impl) + { + this->base_move_construct(impl, other_impl); + + impl.protocol_ = other_impl.protocol_; + other_impl.protocol_ = endpoint_type().protocol(); + + impl.have_remote_endpoint_ = other_impl.have_remote_endpoint_; + other_impl.have_remote_endpoint_ = false; + + impl.remote_endpoint_ = other_impl.remote_endpoint_; + other_impl.remote_endpoint_ = endpoint_type(); + } + + // Move-assign from another socket implementation. + void move_assign(implementation_type& impl, + win_iocp_socket_service_base& other_service, + implementation_type& other_impl) + { + this->base_move_assign(impl, other_service, other_impl); + + impl.protocol_ = other_impl.protocol_; + other_impl.protocol_ = endpoint_type().protocol(); + + impl.have_remote_endpoint_ = other_impl.have_remote_endpoint_; + other_impl.have_remote_endpoint_ = false; + + impl.remote_endpoint_ = other_impl.remote_endpoint_; + other_impl.remote_endpoint_ = endpoint_type(); + } + // Open a new socket implementation. boost::system::error_code open(implementation_type& impl, const protocol_type& protocol, boost::system::error_code& ec) @@ -149,7 +182,7 @@ public: // Assign a native socket to a socket implementation. boost::system::error_code assign(implementation_type& impl, - const protocol_type& protocol, const native_type& native_socket, + const protocol_type& protocol, const native_handle_type& native_socket, boost::system::error_code& ec) { if (!do_assign(impl, protocol.type(), native_socket, ec)) @@ -162,11 +195,11 @@ public: } // Get the native socket representation. - native_type native(implementation_type& impl) + native_handle_type native_handle(implementation_type& impl) { if (impl.have_remote_endpoint_) - return native_type(impl.socket_, impl.remote_endpoint_); - return native_type(impl.socket_); + return native_handle_type(impl.socket_, impl.remote_endpoint_); + return native_handle_type(impl.socket_); } // Bind the socket to the specified local endpoint. @@ -248,7 +281,7 @@ public: boost::system::error_code& ec) { // Wait for socket to become ready. - socket_ops::poll_write(impl.socket_, ec); + socket_ops::poll_write(impl.socket_, impl.state_, ec); return 0; } @@ -267,6 +300,8 @@ public: sizeof(op), handler), 0 }; p.p = new (p.v) op(impl.cancel_token_, buffers, handler); + BOOST_ASIO_HANDLER_CREATION((p.p, "socket", &impl, "async_send_to")); + buffer_sequence_adapter<boost::asio::const_buffer, ConstBufferSequence> bufs(buffers); @@ -288,6 +323,9 @@ public: sizeof(op), handler), 0 }; p.p = new (p.v) op(impl.cancel_token_, handler); + BOOST_ASIO_HANDLER_CREATION((p.p, "socket", + &impl, "async_send_to(null_buffers)")); + start_reactor_op(impl, reactor::write_op, p.p); p.v = p.p = 0; } @@ -320,7 +358,7 @@ public: socket_base::message_flags, boost::system::error_code& ec) { // Wait for socket to become ready. - socket_ops::poll_read(impl.socket_, ec); + socket_ops::poll_read(impl.socket_, impl.state_, ec); // Reset endpoint since it can be given no sensible value at this time. sender_endpoint = endpoint_type(); @@ -344,6 +382,8 @@ public: sizeof(op), handler), 0 }; p.p = new (p.v) op(sender_endp, impl.cancel_token_, buffers, handler); + BOOST_ASIO_HANDLER_CREATION((p.p, "socket", &impl, "async_receive_from")); + buffer_sequence_adapter<boost::asio::mutable_buffer, MutableBufferSequence> bufs(buffers); @@ -365,6 +405,9 @@ public: sizeof(op), handler), 0 }; p.p = new (p.v) op(impl.cancel_token_, handler); + BOOST_ASIO_HANDLER_CREATION((p.p, "socket", &impl, + "async_receive_from(null_buffers)")); + // Reset endpoint since it can be given no sensible value at this time. sender_endpoint = endpoint_type(); @@ -417,6 +460,8 @@ public: p.p = new (p.v) op(*this, impl.socket_, peer, impl.protocol_, peer_endpoint, enable_connection_aborted, handler); + BOOST_ASIO_HANDLER_CREATION((p.p, "socket", &impl, "async_accept")); + start_accept_op(impl, peer.is_open(), p.p->new_socket(), impl.protocol_.family(), impl.protocol_.type(), impl.protocol_.protocol(), p.p->output_buffer(), @@ -445,6 +490,8 @@ public: sizeof(op), handler), 0 }; p.p = new (p.v) op(impl.socket_, handler); + BOOST_ASIO_HANDLER_CREATION((p.p, "socket", &impl, "async_connect")); + start_connect_op(impl, p.p, peer_endpoint.data(), static_cast<int>(peer_endpoint.size())); p.v = p.p = 0; diff --git a/3rdParty/Boost/src/boost/asio/detail/win_iocp_socket_service_base.hpp b/3rdParty/Boost/src/boost/asio/detail/win_iocp_socket_service_base.hpp index 32532f9..79580de 100644 --- a/3rdParty/Boost/src/boost/asio/detail/win_iocp_socket_service_base.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/win_iocp_socket_service_base.hpp @@ -2,7 +2,7 @@ // detail/win_iocp_socket_service_base.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -40,6 +40,7 @@ #include <boost/asio/detail/win_iocp_null_buffers_op.hpp> #include <boost/asio/detail/win_iocp_socket_send_op.hpp> #include <boost/asio/detail/win_iocp_socket_recv_op.hpp> +#include <boost/asio/detail/win_iocp_socket_recvmsg_op.hpp> #include <boost/asio/detail/push_options.hpp> @@ -93,6 +94,15 @@ public: // Construct a new socket implementation. BOOST_ASIO_DECL void construct(base_implementation_type& impl); + // Move-construct a new socket implementation. + BOOST_ASIO_DECL void base_move_construct(base_implementation_type& impl, + base_implementation_type& other_impl); + + // Move-assign from another socket implementation. + BOOST_ASIO_DECL void base_move_assign(base_implementation_type& impl, + win_iocp_socket_service_base& other_service, + base_implementation_type& other_impl); + // Destroy a socket implementation. BOOST_ASIO_DECL void destroy(base_implementation_type& impl); @@ -142,7 +152,35 @@ public: return ec; } - /// Disable sends or receives on the socket. + // Gets the non-blocking mode of the socket. + bool non_blocking(const base_implementation_type& impl) const + { + return (impl.state_ & socket_ops::user_set_non_blocking) != 0; + } + + // Sets the non-blocking mode of the socket. + boost::system::error_code non_blocking(base_implementation_type& impl, + bool mode, boost::system::error_code& ec) + { + socket_ops::set_user_non_blocking(impl.socket_, impl.state_, mode, ec); + return ec; + } + + // Gets the non-blocking mode of the native socket implementation. + bool native_non_blocking(const base_implementation_type& impl) const + { + return (impl.state_ & socket_ops::internal_non_blocking) != 0; + } + + // Sets the non-blocking mode of the native socket implementation. + boost::system::error_code native_non_blocking(base_implementation_type& impl, + bool mode, boost::system::error_code& ec) + { + socket_ops::set_internal_non_blocking(impl.socket_, impl.state_, mode, ec); + return ec; + } + + // Disable sends or receives on the socket. boost::system::error_code shutdown(base_implementation_type& impl, socket_base::shutdown_type what, boost::system::error_code& ec) { @@ -168,7 +206,7 @@ public: socket_base::message_flags, boost::system::error_code& ec) { // Wait for socket to become ready. - socket_ops::poll_write(impl.socket_, ec); + socket_ops::poll_write(impl.socket_, impl.state_, ec); return 0; } @@ -187,6 +225,8 @@ public: sizeof(op), handler), 0 }; p.p = new (p.v) op(impl.cancel_token_, buffers, handler); + BOOST_ASIO_HANDLER_CREATION((p.p, "socket", &impl, "async_send")); + buffer_sequence_adapter<boost::asio::const_buffer, ConstBufferSequence> bufs(buffers); @@ -208,6 +248,9 @@ public: sizeof(op), handler), 0 }; p.p = new (p.v) op(impl.cancel_token_, handler); + BOOST_ASIO_HANDLER_CREATION((p.p, "socket", + &impl, "async_send(null_buffers)")); + start_reactor_op(impl, reactor::write_op, p.p); p.v = p.p = 0; } @@ -230,7 +273,7 @@ public: socket_base::message_flags, boost::system::error_code& ec) { // Wait for socket to become ready. - socket_ops::poll_read(impl.socket_, ec); + socket_ops::poll_read(impl.socket_, impl.state_, ec); return 0; } @@ -249,6 +292,8 @@ public: sizeof(op), handler), 0 }; p.p = new (p.v) op(impl.state_, impl.cancel_token_, buffers, handler); + BOOST_ASIO_HANDLER_CREATION((p.p, "socket", &impl, "async_receive")); + buffer_sequence_adapter<boost::asio::mutable_buffer, MutableBufferSequence> bufs(buffers); @@ -270,10 +315,90 @@ public: sizeof(op), handler), 0 }; p.p = new (p.v) op(impl.cancel_token_, handler); + BOOST_ASIO_HANDLER_CREATION((p.p, "socket", + &impl, "async_receive(null_buffers)")); + start_null_buffers_receive_op(impl, flags, p.p); p.v = p.p = 0; } + // Receive some data with associated flags. Returns the number of bytes + // received. + template <typename MutableBufferSequence> + size_t receive_with_flags(base_implementation_type& impl, + const MutableBufferSequence& buffers, + socket_base::message_flags in_flags, + socket_base::message_flags& out_flags, boost::system::error_code& ec) + { + buffer_sequence_adapter<boost::asio::mutable_buffer, + MutableBufferSequence> bufs(buffers); + + return socket_ops::sync_recvmsg(impl.socket_, impl.state_, + bufs.buffers(), bufs.count(), in_flags, out_flags, ec); + } + + // Wait until data can be received without blocking. + size_t receive_with_flags(base_implementation_type& impl, + const null_buffers&, socket_base::message_flags, + socket_base::message_flags& out_flags, boost::system::error_code& ec) + { + // Wait for socket to become ready. + socket_ops::poll_read(impl.socket_, impl.state_, ec); + + // Clear out_flags, since we cannot give it any other sensible value when + // performing a null_buffers operation. + out_flags = 0; + + return 0; + } + + // Start an asynchronous receive. The buffer for the data being received + // must be valid for the lifetime of the asynchronous operation. + template <typename MutableBufferSequence, typename Handler> + void async_receive_with_flags(base_implementation_type& impl, + const MutableBufferSequence& buffers, socket_base::message_flags in_flags, + socket_base::message_flags& out_flags, Handler handler) + { + // Allocate and construct an operation to wrap the handler. + typedef win_iocp_socket_recvmsg_op<MutableBufferSequence, Handler> op; + typename op::ptr p = { boost::addressof(handler), + boost_asio_handler_alloc_helpers::allocate( + sizeof(op), handler), 0 }; + p.p = new (p.v) op(impl.cancel_token_, buffers, out_flags, handler); + + BOOST_ASIO_HANDLER_CREATION((p.p, "socket", + &impl, "async_receive_with_flags")); + + buffer_sequence_adapter<boost::asio::mutable_buffer, + MutableBufferSequence> bufs(buffers); + + start_receive_op(impl, bufs.buffers(), bufs.count(), in_flags, false, p.p); + p.v = p.p = 0; + } + + // Wait until data can be received without blocking. + template <typename Handler> + void async_receive_with_flags(base_implementation_type& impl, + const null_buffers&, socket_base::message_flags in_flags, + socket_base::message_flags& out_flags, Handler handler) + { + // Allocate and construct an operation to wrap the handler. + typedef win_iocp_null_buffers_op<Handler> op; + typename op::ptr p = { boost::addressof(handler), + boost_asio_handler_alloc_helpers::allocate( + sizeof(op), handler), 0 }; + p.p = new (p.v) op(impl.cancel_token_, handler); + + BOOST_ASIO_HANDLER_CREATION((p.p, "socket", &impl, + "async_receive_with_flags(null_buffers)")); + + // Reset out_flags since it can be given no sensible value at this time. + out_flags = 0; + + start_null_buffers_receive_op(impl, in_flags, p.p); + p.v = p.p = 0; + } + // Helper function to restart an asynchronous accept operation. BOOST_ASIO_DECL void restart_accept_op(socket_type s, socket_holder& new_socket, int family, int type, int protocol, diff --git a/3rdParty/Boost/src/boost/asio/detail/win_mutex.hpp b/3rdParty/Boost/src/boost/asio/detail/win_mutex.hpp index 0c5dc26..930d01f 100644 --- a/3rdParty/Boost/src/boost/asio/detail/win_mutex.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/win_mutex.hpp @@ -2,7 +2,7 @@ // detail/win_mutex.hpp // ~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/win_object_handle_service.hpp b/3rdParty/Boost/src/boost/asio/detail/win_object_handle_service.hpp new file mode 100644 index 0000000..52a972d --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/detail/win_object_handle_service.hpp @@ -0,0 +1,185 @@ +// +// detail/win_object_handle_service.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2011 Boris Schaeling (boris@highscore.de) +// +// 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_ASIO_DETAIL_WIN_OBJECT_HANDLE_SERVICE_HPP +#define BOOST_ASIO_DETAIL_WIN_OBJECT_HANDLE_SERVICE_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> + +#if defined(BOOST_ASIO_HAS_WINDOWS_OBJECT_HANDLE) + +#include <boost/utility/addressof.hpp> +#include <boost/asio/detail/handler_alloc_helpers.hpp> +#include <boost/asio/detail/wait_handler.hpp> +#include <boost/asio/error.hpp> +#include <boost/asio/io_service.hpp> + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { +namespace detail { + +class win_object_handle_service +{ +public: + // The native type of an object handle. + typedef HANDLE native_handle_type; + + // The implementation type of the object handle. + class implementation_type + { + public: + // Default constructor. + implementation_type() + : handle_(INVALID_HANDLE_VALUE), + wait_handle_(INVALID_HANDLE_VALUE), + owner_(0), + next_(0), + prev_(0) + { + } + + private: + // Only this service will have access to the internal values. + friend class win_object_handle_service; + + // The native object handle representation. May be accessed or modified + // without locking the mutex. + native_handle_type handle_; + + // The handle used to unregister the wait operation. The mutex must be + // locked when accessing or modifying this member. + HANDLE wait_handle_; + + // The operations waiting on the object handle. If there is a registered + // wait then the mutex must be locked when accessing or modifying this + // member + op_queue<wait_op> op_queue_; + + // The service instance that owns the object handle implementation. + win_object_handle_service* owner_; + + // Pointers to adjacent handle implementations in linked list. The mutex + // must be locked when accessing or modifying these members. + implementation_type* next_; + implementation_type* prev_; + }; + + // Constructor. + BOOST_ASIO_DECL win_object_handle_service( + boost::asio::io_service& io_service); + + // Destroy all user-defined handler objects owned by the service. + BOOST_ASIO_DECL void shutdown_service(); + + // Construct a new handle implementation. + BOOST_ASIO_DECL void construct(implementation_type& impl); + + // Move-construct a new handle implementation. + BOOST_ASIO_DECL void move_construct(implementation_type& impl, + implementation_type& other_impl); + + // Move-assign from another handle implementation. + BOOST_ASIO_DECL void move_assign(implementation_type& impl, + win_object_handle_service& other_service, + implementation_type& other_impl); + + // Destroy a handle implementation. + BOOST_ASIO_DECL void destroy(implementation_type& impl); + + // Assign a native handle to a handle implementation. + BOOST_ASIO_DECL boost::system::error_code assign(implementation_type& impl, + const native_handle_type& handle, boost::system::error_code& ec); + + // Determine whether the handle is open. + bool is_open(const implementation_type& impl) const + { + return impl.handle_ != INVALID_HANDLE_VALUE && impl.handle_ != 0; + } + + // Destroy a handle implementation. + BOOST_ASIO_DECL boost::system::error_code close(implementation_type& impl, + boost::system::error_code& ec); + + // Get the native handle representation. + native_handle_type native_handle(const implementation_type& impl) const + { + return impl.handle_; + } + + // Cancel all operations associated with the handle. + BOOST_ASIO_DECL boost::system::error_code cancel(implementation_type& impl, + boost::system::error_code& ec); + + // Perform a synchronous wait for the object to enter a signalled state. + BOOST_ASIO_DECL void wait(implementation_type& impl, + boost::system::error_code& ec); + + /// Start an asynchronous wait. + template <typename Handler> + void async_wait(implementation_type& impl, Handler handler) + { + // Allocate and construct an operation to wrap the handler. + typedef wait_handler<Handler> op; + typename op::ptr p = { boost::addressof(handler), + boost_asio_handler_alloc_helpers::allocate( + sizeof(op), handler), 0 }; + p.p = new (p.v) op(handler); + + BOOST_ASIO_HANDLER_CREATION((p.p, "object_handle", &impl, "async_wait")); + + start_wait_op(impl, p.p); + p.v = p.p = 0; + } + +private: + // Helper function to start an asynchronous wait operation. + BOOST_ASIO_DECL void start_wait_op(implementation_type& impl, wait_op* op); + + // Helper function to register a wait operation. + BOOST_ASIO_DECL void register_wait_callback( + implementation_type& impl, mutex::scoped_lock& lock); + + // Callback function invoked when the registered wait completes. + static BOOST_ASIO_DECL VOID CALLBACK wait_callback( + PVOID param, BOOLEAN timeout); + + // The io_service implementation used to post completions. + io_service_impl& io_service_; + + // Mutex to protect access to internal state. + mutex mutex_; + + // The head of a linked list of all implementations. + implementation_type* impl_list_; + + // Flag to indicate that the dispatcher has been shut down. + bool shutdown_; +}; + +} // namespace detail +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#if defined(BOOST_ASIO_HEADER_ONLY) +# include <boost/asio/detail/impl/win_object_handle_service.ipp> +#endif // defined(BOOST_ASIO_HEADER_ONLY) + +#endif // defined(BOOST_ASIO_HAS_WINDOWS_OBJECT_HANDLE) + +#endif // BOOST_ASIO_DETAIL_WIN_OBJECT_HANDLE_SERVICE_HPP diff --git a/3rdParty/Boost/src/boost/asio/detail/win_static_mutex.hpp b/3rdParty/Boost/src/boost/asio/detail/win_static_mutex.hpp new file mode 100644 index 0000000..a54b36b --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/detail/win_static_mutex.hpp @@ -0,0 +1,76 @@ +// +// detail/win_static_mutex.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) +// + +#ifndef BOOST_ASIO_DETAIL_WIN_STATIC_MUTEX_HPP +#define BOOST_ASIO_DETAIL_WIN_STATIC_MUTEX_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> + +#if defined(BOOST_WINDOWS) + +#include <boost/asio/detail/scoped_lock.hpp> + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { +namespace detail { + +struct win_static_mutex +{ + typedef boost::asio::detail::scoped_lock<win_static_mutex> scoped_lock; + + // Initialise the mutex. + BOOST_ASIO_DECL void init(); + + // Initialisation must be performed in a separate function to the "public" + // init() function since the compiler does not support the use of structured + // exceptions and C++ exceptions in the same function. + BOOST_ASIO_DECL int do_init(); + + // Lock the mutex. + void lock() + { + ::EnterCriticalSection(&crit_section_); + } + + // Unlock the mutex. + void unlock() + { + ::LeaveCriticalSection(&crit_section_); + } + + bool initialised_; + ::CRITICAL_SECTION crit_section_; +}; + +#if defined(UNDER_CE) +# define BOOST_ASIO_WIN_STATIC_MUTEX_INIT { false, { 0, 0, 0, 0, 0 } } +#else // defined(UNDER_CE) +# define BOOST_ASIO_WIN_STATIC_MUTEX_INIT { false, { 0, 0, 0, 0, 0, 0 } } +#endif // defined(UNDER_CE) + +} // namespace detail +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#if defined(BOOST_ASIO_HEADER_ONLY) +# include <boost/asio/detail/impl/win_static_mutex.ipp> +#endif // defined(BOOST_ASIO_HEADER_ONLY) + +#endif // defined(BOOST_WINDOWS) + +#endif // BOOST_ASIO_DETAIL_WIN_STATIC_MUTEX_HPP diff --git a/3rdParty/Boost/src/boost/asio/detail/win_thread.hpp b/3rdParty/Boost/src/boost/asio/detail/win_thread.hpp index 4e33bd9..754786e 100644 --- a/3rdParty/Boost/src/boost/asio/detail/win_thread.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/win_thread.hpp @@ -2,7 +2,7 @@ // detail/win_thread.hpp // ~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/win_tss_ptr.hpp b/3rdParty/Boost/src/boost/asio/detail/win_tss_ptr.hpp index 75811c1..44cacc6 100644 --- a/3rdParty/Boost/src/boost/asio/detail/win_tss_ptr.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/win_tss_ptr.hpp @@ -2,7 +2,7 @@ // detail/win_tss_ptr.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/wince_thread.hpp b/3rdParty/Boost/src/boost/asio/detail/wince_thread.hpp index 7f7b1e4..389cb9d 100644 --- a/3rdParty/Boost/src/boost/asio/detail/wince_thread.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/wince_thread.hpp @@ -2,7 +2,7 @@ // detail/wince_thread.hpp // ~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -39,7 +39,7 @@ class wince_thread public: // Constructor. template <typename Function> - wince_thread(Function f) + wince_thread(Function f, unsigned int = 0) { std::auto_ptr<func_base> arg(new func<Function>(f)); DWORD thread_id = 0; diff --git a/3rdParty/Boost/src/boost/asio/detail/winsock_init.hpp b/3rdParty/Boost/src/boost/asio/detail/winsock_init.hpp index dc50fbf..702ba71 100644 --- a/3rdParty/Boost/src/boost/asio/detail/winsock_init.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/winsock_init.hpp @@ -2,7 +2,7 @@ // detail/winsock_init.hpp // ~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/detail/wrapped_handler.hpp b/3rdParty/Boost/src/boost/asio/detail/wrapped_handler.hpp index b326847..d82da22 100644 --- a/3rdParty/Boost/src/boost/asio/detail/wrapped_handler.hpp +++ b/3rdParty/Boost/src/boost/asio/detail/wrapped_handler.hpp @@ -2,7 +2,7 @@ // detail/wrapped_handler.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -31,12 +31,26 @@ class wrapped_handler public: typedef void result_type; - wrapped_handler(Dispatcher dispatcher, Handler handler) + wrapped_handler(Dispatcher dispatcher, Handler& handler) : dispatcher_(dispatcher), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)) { } +#if defined(BOOST_ASIO_HAS_MOVE) + wrapped_handler(const wrapped_handler& other) + : dispatcher_(other.dispatcher_), + handler_(other.handler_) + { + } + + wrapped_handler(wrapped_handler&& other) + : dispatcher_(other.dispatcher_), + handler_(BOOST_ASIO_MOVE_CAST(Handler)(other.handler_)) + { + } +#endif // defined(BOOST_ASIO_HAS_MOVE) + void operator()() { dispatcher_.dispatch(handler_); @@ -126,11 +140,31 @@ template <typename Handler, typename Context> class rewrapped_handler { public: + explicit rewrapped_handler(Handler& handler, const Context& context) + : context_(context), + handler_(BOOST_ASIO_MOVE_CAST(Handler)(handler)) + { + } + explicit rewrapped_handler(const Handler& handler, const Context& context) - : handler_(handler), - context_(context) + : context_(context), + handler_(handler) + { + } + +#if defined(BOOST_ASIO_HAS_MOVE) + rewrapped_handler(const rewrapped_handler& other) + : context_(other.context_), + handler_(other.handler_) + { + } + + rewrapped_handler(rewrapped_handler&& other) + : context_(BOOST_ASIO_MOVE_CAST(Context)(other.context_)), + handler_(BOOST_ASIO_MOVE_CAST(Handler)(other.handler_)) { } +#endif // defined(BOOST_ASIO_HAS_MOVE) void operator()() { @@ -143,8 +177,8 @@ public: } //private: - Handler handler_; Context context_; + Handler handler_; }; template <typename Dispatcher, typename Handler> @@ -164,6 +198,15 @@ inline void asio_handler_deallocate(void* pointer, std::size_t size, } template <typename Function, typename Dispatcher, typename Handler> +inline void asio_handler_invoke(Function& function, + wrapped_handler<Dispatcher, Handler>* this_handler) +{ + this_handler->dispatcher_.dispatch( + rewrapped_handler<Function, Handler>( + function, this_handler->handler_)); +} + +template <typename Function, typename Dispatcher, typename Handler> inline void asio_handler_invoke(const Function& function, wrapped_handler<Dispatcher, Handler>* this_handler) { @@ -189,6 +232,14 @@ inline void asio_handler_deallocate(void* pointer, std::size_t size, } template <typename Function, typename Handler, typename Context> +inline void asio_handler_invoke(Function& function, + rewrapped_handler<Handler, Context>* this_handler) +{ + boost_asio_handler_invoke_helpers::invoke( + function, this_handler->context_); +} + +template <typename Function, typename Handler, typename Context> inline void asio_handler_invoke(const Function& function, rewrapped_handler<Handler, Context>* this_handler) { diff --git a/3rdParty/Boost/src/boost/asio/error.hpp b/3rdParty/Boost/src/boost/asio/error.hpp index d0287a0..331297b 100644 --- a/3rdParty/Boost/src/boost/asio/error.hpp +++ b/3rdParty/Boost/src/boost/asio/error.hpp @@ -2,7 +2,7 @@ // error.hpp // ~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -211,10 +211,6 @@ enum misc_errors fd_set_failure }; -enum ssl_errors -{ -}; - inline const boost::system::error_category& get_system_category() { return boost::system::system_category(); @@ -245,9 +241,6 @@ inline const boost::system::error_category& get_addrinfo_category() extern BOOST_ASIO_DECL const boost::system::error_category& get_misc_category(); -extern BOOST_ASIO_DECL -const boost::system::error_category& get_ssl_category(); - static const boost::system::error_category& system_category = boost::asio::error::get_system_category(); static const boost::system::error_category& netdb_category @@ -256,12 +249,12 @@ static const boost::system::error_category& addrinfo_category = boost::asio::error::get_addrinfo_category(); static const boost::system::error_category& misc_category = boost::asio::error::get_misc_category(); -static const boost::system::error_category& ssl_category - = boost::asio::error::get_ssl_category(); } // namespace error } // namespace asio +} // namespace boost +namespace boost { namespace system { template<> struct is_error_code_enum<boost::asio::error::basic_errors> @@ -284,13 +277,10 @@ template<> struct is_error_code_enum<boost::asio::error::misc_errors> static const bool value = true; }; -template<> struct is_error_code_enum<boost::asio::error::ssl_errors> -{ - static const bool value = true; -}; - } // namespace system +} // namespace boost +namespace boost { namespace asio { namespace error { @@ -318,12 +308,6 @@ inline boost::system::error_code make_error_code(misc_errors e) static_cast<int>(e), get_misc_category()); } -inline boost::system::error_code make_error_code(ssl_errors e) -{ - return boost::system::error_code( - static_cast<int>(e), get_ssl_category()); -} - } // namespace error } // namespace asio } // namespace boost diff --git a/3rdParty/Boost/src/boost/asio/handler_alloc_hook.hpp b/3rdParty/Boost/src/boost/asio/handler_alloc_hook.hpp index ca56871..6bef151 100644 --- a/3rdParty/Boost/src/boost/asio/handler_alloc_hook.hpp +++ b/3rdParty/Boost/src/boost/asio/handler_alloc_hook.hpp @@ -2,7 +2,7 @@ // handler_alloc_hook.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/handler_invoke_hook.hpp b/3rdParty/Boost/src/boost/asio/handler_invoke_hook.hpp index f4f6831..6f03888 100644 --- a/3rdParty/Boost/src/boost/asio/handler_invoke_hook.hpp +++ b/3rdParty/Boost/src/boost/asio/handler_invoke_hook.hpp @@ -2,7 +2,7 @@ // handler_invoke_hook.hpp // ~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/impl/connect.hpp b/3rdParty/Boost/src/boost/asio/impl/connect.hpp new file mode 100644 index 0000000..a21bb2d --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/impl/connect.hpp @@ -0,0 +1,391 @@ +// +// impl/connect.hpp +// ~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) +// + +#ifndef BOOST_ASIO_IMPL_CONNECT_HPP +#define BOOST_ASIO_IMPL_CONNECT_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/bind_handler.hpp> +#include <boost/asio/detail/consuming_buffers.hpp> +#include <boost/asio/detail/handler_alloc_helpers.hpp> +#include <boost/asio/detail/handler_invoke_helpers.hpp> +#include <boost/asio/detail/handler_type_requirements.hpp> +#include <boost/asio/detail/throw_error.hpp> +#include <boost/asio/error.hpp> + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { + +namespace detail +{ + struct default_connect_condition + { + template <typename Iterator> + Iterator operator()(const boost::system::error_code&, Iterator next) + { + return next; + } + }; +} + +template <typename Protocol, typename SocketService, typename Iterator> +Iterator connect(basic_socket<Protocol, SocketService>& s, Iterator begin) +{ + boost::system::error_code ec; + Iterator result = connect(s, begin, ec); + boost::asio::detail::throw_error(ec, "connect"); + return result; +} + +template <typename Protocol, typename SocketService, typename Iterator> +inline Iterator connect(basic_socket<Protocol, SocketService>& s, + Iterator begin, boost::system::error_code& ec) +{ + return connect(s, begin, Iterator(), detail::default_connect_condition(), ec); +} + +template <typename Protocol, typename SocketService, typename Iterator> +Iterator connect(basic_socket<Protocol, SocketService>& s, + Iterator begin, Iterator end) +{ + boost::system::error_code ec; + Iterator result = connect(s, begin, end, ec); + boost::asio::detail::throw_error(ec, "connect"); + return result; +} + +template <typename Protocol, typename SocketService, typename Iterator> +inline Iterator connect(basic_socket<Protocol, SocketService>& s, + Iterator begin, Iterator end, boost::system::error_code& ec) +{ + return connect(s, begin, end, detail::default_connect_condition(), ec); +} + +template <typename Protocol, typename SocketService, + typename Iterator, typename ConnectCondition> +Iterator connect(basic_socket<Protocol, SocketService>& s, + Iterator begin, ConnectCondition connect_condition) +{ + boost::system::error_code ec; + Iterator result = connect(s, begin, connect_condition, ec); + boost::asio::detail::throw_error(ec, "connect"); + return result; +} + +template <typename Protocol, typename SocketService, + typename Iterator, typename ConnectCondition> +inline Iterator connect(basic_socket<Protocol, SocketService>& s, + Iterator begin, ConnectCondition connect_condition, + boost::system::error_code& ec) +{ + return connect(s, begin, Iterator(), connect_condition, ec); +} + +template <typename Protocol, typename SocketService, + typename Iterator, typename ConnectCondition> +Iterator connect(basic_socket<Protocol, SocketService>& s, + Iterator begin, Iterator end, ConnectCondition connect_condition) +{ + boost::system::error_code ec; + Iterator result = connect(s, begin, end, connect_condition, ec); + boost::asio::detail::throw_error(ec, "connect"); + return result; +} + +template <typename Protocol, typename SocketService, + typename Iterator, typename ConnectCondition> +Iterator connect(basic_socket<Protocol, SocketService>& s, + Iterator begin, Iterator end, ConnectCondition connect_condition, + boost::system::error_code& ec) +{ + ec = boost::system::error_code(); + + for (Iterator iter = begin; iter != end; ++iter) + { + iter = connect_condition(ec, iter); + if (iter != end) + { + s.close(ec); + s.connect(*iter, ec); + if (!ec) + return iter; + } + } + + if (!ec) + ec = boost::asio::error::not_found; + + return end; +} + +namespace detail +{ + // Enable the empty base class optimisation for the connect condition. + template <typename ConnectCondition> + class base_from_connect_condition + { + protected: + explicit base_from_connect_condition( + const ConnectCondition& connect_condition) + : connect_condition_(connect_condition) + { + } + + template <typename Iterator> + void check_condition(const boost::system::error_code& ec, + Iterator& iter, Iterator& end) + { + if (iter != end) + iter = connect_condition_(ec, static_cast<const Iterator&>(iter)); + } + + private: + ConnectCondition connect_condition_; + }; + + // The default_connect_condition implementation is essentially a no-op. This + // template specialisation lets us eliminate all costs associated with it. + template <> + class base_from_connect_condition<default_connect_condition> + { + protected: + explicit base_from_connect_condition(const default_connect_condition&) + { + } + + template <typename Iterator> + void check_condition(const boost::system::error_code&, Iterator&, Iterator&) + { + } + }; + + template <typename Protocol, typename SocketService, typename Iterator, + typename ConnectCondition, typename ComposedConnectHandler> + class connect_op : base_from_connect_condition<ConnectCondition> + { + public: + connect_op(basic_socket<Protocol, SocketService>& sock, + const Iterator& begin, const Iterator& end, + const ConnectCondition& connect_condition, + ComposedConnectHandler& handler) + : base_from_connect_condition<ConnectCondition>(connect_condition), + socket_(sock), + iter_(begin), + end_(end), + handler_(BOOST_ASIO_MOVE_CAST(ComposedConnectHandler)(handler)) + { + } + +#if defined(BOOST_ASIO_HAS_MOVE) + connect_op(const connect_op& other) + : base_from_connect_condition<ConnectCondition>(other), + socket_(other.socket_), + iter_(other.iter_), + end_(other.end_), + handler_(other.handler_) + { + } + + connect_op(connect_op&& other) + : base_from_connect_condition<ConnectCondition>(other), + socket_(other.socket_), + iter_(other.iter_), + end_(other.end_), + handler_(BOOST_ASIO_MOVE_CAST(ComposedConnectHandler)(other.handler_)) + { + } +#endif // defined(BOOST_ASIO_HAS_MOVE) + + void operator()(boost::system::error_code ec, int start = 0) + { + switch (start) + { + case 1: + for (;;) + { + this->check_condition(ec, iter_, end_); + + if (iter_ != end_) + { + socket_.close(ec); + socket_.async_connect(*iter_, + BOOST_ASIO_MOVE_CAST(connect_op)(*this)); + return; + } + + if (start) + { + ec = boost::asio::error::not_found; + socket_.get_io_service().post(detail::bind_handler(*this, ec)); + return; + } + + default: + + if (iter_ == end_) + break; + + if (!socket_.is_open()) + { + ec = boost::asio::error::operation_aborted; + break; + } + + if (!ec) + break; + + ++iter_; + } + + handler_(static_cast<const boost::system::error_code&>(ec), + static_cast<const Iterator&>(iter_)); + } + } + + //private: + basic_socket<Protocol, SocketService>& socket_; + Iterator iter_; + Iterator end_; + ComposedConnectHandler handler_; + }; + + template <typename Protocol, typename SocketService, typename Iterator, + typename ConnectCondition, typename ComposedConnectHandler> + inline void* asio_handler_allocate(std::size_t size, + connect_op<Protocol, SocketService, Iterator, + ConnectCondition, ComposedConnectHandler>* this_handler) + { + return boost_asio_handler_alloc_helpers::allocate( + size, this_handler->handler_); + } + + template <typename Protocol, typename SocketService, typename Iterator, + typename ConnectCondition, typename ComposedConnectHandler> + inline void asio_handler_deallocate(void* pointer, std::size_t size, + connect_op<Protocol, SocketService, Iterator, + ConnectCondition, ComposedConnectHandler>* this_handler) + { + boost_asio_handler_alloc_helpers::deallocate( + pointer, size, this_handler->handler_); + } + + template <typename Function, typename Protocol, + typename SocketService, typename Iterator, + typename ConnectCondition, typename ComposedConnectHandler> + inline void asio_handler_invoke(Function& function, + connect_op<Protocol, SocketService, Iterator, + ConnectCondition, ComposedConnectHandler>* this_handler) + { + boost_asio_handler_invoke_helpers::invoke( + function, this_handler->handler_); + } + + template <typename Function, typename Protocol, + typename SocketService, typename Iterator, + typename ConnectCondition, typename ComposedConnectHandler> + inline void asio_handler_invoke(const Function& function, + connect_op<Protocol, SocketService, Iterator, + ConnectCondition, ComposedConnectHandler>* this_handler) + { + boost_asio_handler_invoke_helpers::invoke( + function, this_handler->handler_); + } + + template <typename Protocol, typename SocketService, typename Iterator, + typename ConnectCondition, typename ComposedConnectHandler> + inline connect_op<Protocol, SocketService, Iterator, + ConnectCondition, ComposedConnectHandler> + make_connect_op(basic_socket<Protocol, SocketService>& sock, + const Iterator& begin, const Iterator& end, + const ConnectCondition& connect_condition, + ComposedConnectHandler handler) + { + return connect_op<Protocol, SocketService, Iterator, + ConnectCondition, ComposedConnectHandler>( + sock, begin, end, connect_condition, handler); + } +} // namespace detail + +template <typename Protocol, typename SocketService, + typename Iterator, typename ComposedConnectHandler> +inline void async_connect(basic_socket<Protocol, SocketService>& s, + Iterator begin, BOOST_ASIO_MOVE_ARG(ComposedConnectHandler) handler) +{ + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a ComposedConnectHandler. + BOOST_ASIO_COMPOSED_CONNECT_HANDLER_CHECK( + ComposedConnectHandler, handler, Iterator) type_check; + + detail::make_connect_op(s, begin, Iterator(), + detail::default_connect_condition(), + BOOST_ASIO_MOVE_CAST(ComposedConnectHandler)(handler))( + boost::system::error_code(), 1); +} + +template <typename Protocol, typename SocketService, + typename Iterator, typename ComposedConnectHandler> +inline void async_connect(basic_socket<Protocol, SocketService>& s, + Iterator begin, Iterator end, + BOOST_ASIO_MOVE_ARG(ComposedConnectHandler) handler) +{ + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a ComposedConnectHandler. + BOOST_ASIO_COMPOSED_CONNECT_HANDLER_CHECK( + ComposedConnectHandler, handler, Iterator) type_check; + + detail::make_connect_op(s, begin, end, + detail::default_connect_condition(), + BOOST_ASIO_MOVE_CAST(ComposedConnectHandler)(handler))( + boost::system::error_code(), 1); +} + +template <typename Protocol, typename SocketService, typename Iterator, + typename ConnectCondition, typename ComposedConnectHandler> +inline void async_connect(basic_socket<Protocol, SocketService>& s, + Iterator begin, ConnectCondition connect_condition, + BOOST_ASIO_MOVE_ARG(ComposedConnectHandler) handler) +{ + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a ComposedConnectHandler. + BOOST_ASIO_COMPOSED_CONNECT_HANDLER_CHECK( + ComposedConnectHandler, handler, Iterator) type_check; + + detail::make_connect_op(s, begin, Iterator(), connect_condition, + BOOST_ASIO_MOVE_CAST(ComposedConnectHandler)(handler))( + boost::system::error_code(), 1); +} + +template <typename Protocol, typename SocketService, typename Iterator, + typename ConnectCondition, typename ComposedConnectHandler> +void async_connect(basic_socket<Protocol, SocketService>& s, + Iterator begin, Iterator end, ConnectCondition connect_condition, + BOOST_ASIO_MOVE_ARG(ComposedConnectHandler) handler) +{ + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a ComposedConnectHandler. + BOOST_ASIO_COMPOSED_CONNECT_HANDLER_CHECK( + ComposedConnectHandler, handler, Iterator) type_check; + + detail::make_connect_op(s, begin, end, connect_condition, + BOOST_ASIO_MOVE_CAST(ComposedConnectHandler)(handler))( + boost::system::error_code(), 1); +} + +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#endif // BOOST_ASIO_IMPL_CONNECT_HPP diff --git a/3rdParty/Boost/src/boost/asio/impl/error.ipp b/3rdParty/Boost/src/boost/asio/impl/error.ipp index 7c045c0..cfb7a99 100644 --- a/3rdParty/Boost/src/boost/asio/impl/error.ipp +++ b/3rdParty/Boost/src/boost/asio/impl/error.ipp @@ -2,7 +2,7 @@ // impl/error.ipp // ~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -16,8 +16,6 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> -#include <boost/cerrno.hpp> -#include <boost/system/error_code.hpp> #include <boost/asio/error.hpp> #include <boost/asio/detail/push_options.hpp> @@ -122,30 +120,6 @@ const boost::system::error_category& get_misc_category() return instance; } -namespace detail { - -class ssl_category : public boost::system::error_category -{ -public: - const char* name() const - { - return "asio.ssl"; - } - - std::string message(int) const - { - return "asio.ssl error"; - } -}; - -} // namespace detail - -const boost::system::error_category& get_ssl_category() -{ - static detail::ssl_category instance; - return instance; -} - } // namespace error } // namespace asio } // namespace boost diff --git a/3rdParty/Boost/src/boost/asio/impl/io_service.hpp b/3rdParty/Boost/src/boost/asio/impl/io_service.hpp index 152f983..510de0e 100644 --- a/3rdParty/Boost/src/boost/asio/impl/io_service.hpp +++ b/3rdParty/Boost/src/boost/asio/impl/io_service.hpp @@ -2,7 +2,7 @@ // impl/io_service.hpp // ~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -15,6 +15,7 @@ # pragma once #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) +#include <boost/asio/detail/handler_type_requirements.hpp> #include <boost/asio/detail/service_registry.hpp> #include <boost/asio/detail/push_options.hpp> @@ -32,6 +33,13 @@ inline Service& use_service(io_service& ios) return ios.service_registry_->template use_service<Service>(); } +template <> +inline detail::io_service_impl& use_service<detail::io_service_impl>( + io_service& ios) +{ + return ios.impl_; +} + template <typename Service> inline void add_service(io_service& ios, Service* svc) { @@ -68,16 +76,25 @@ inline bool has_service(io_service& ios) namespace boost { namespace asio { -template <typename Handler> -inline void io_service::dispatch(Handler handler) +template <typename CompletionHandler> +inline void io_service::dispatch( + BOOST_ASIO_MOVE_ARG(CompletionHandler) handler) { - impl_.dispatch(handler); + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a CompletionHandler. + BOOST_ASIO_COMPLETION_HANDLER_CHECK(CompletionHandler, handler) type_check; + + impl_.dispatch(BOOST_ASIO_MOVE_CAST(CompletionHandler)(handler)); } -template <typename Handler> -inline void io_service::post(Handler handler) +template <typename CompletionHandler> +inline void io_service::post(BOOST_ASIO_MOVE_ARG(CompletionHandler) handler) { - impl_.post(handler); + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a CompletionHandler. + BOOST_ASIO_COMPLETION_HANDLER_CHECK(CompletionHandler, handler) type_check; + + impl_.post(BOOST_ASIO_MOVE_CAST(CompletionHandler)(handler)); } template <typename Handler> @@ -92,35 +109,25 @@ io_service::wrap(Handler handler) } inline io_service::work::work(boost::asio::io_service& io_service) - : io_service_(io_service) + : io_service_impl_(io_service.impl_) { - io_service_.impl_.work_started(); + io_service_impl_.work_started(); } inline io_service::work::work(const work& other) - : io_service_(other.io_service_) + : io_service_impl_(other.io_service_impl_) { - io_service_.impl_.work_started(); + io_service_impl_.work_started(); } inline io_service::work::~work() { - io_service_.impl_.work_finished(); -} - -inline boost::asio::io_service& io_service::work::io_service() -{ - return io_service_; + io_service_impl_.work_finished(); } inline boost::asio::io_service& io_service::work::get_io_service() { - return io_service_; -} - -inline boost::asio::io_service& io_service::service::io_service() -{ - return owner_; + return io_service_impl_.get_io_service(); } inline boost::asio::io_service& io_service::service::get_io_service() diff --git a/3rdParty/Boost/src/boost/asio/impl/io_service.ipp b/3rdParty/Boost/src/boost/asio/impl/io_service.ipp index a0b34af..1e3af48 100644 --- a/3rdParty/Boost/src/boost/asio/impl/io_service.ipp +++ b/3rdParty/Boost/src/boost/asio/impl/io_service.ipp @@ -2,7 +2,7 @@ // impl/io_service.ipp // ~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -18,6 +18,7 @@ #include <boost/asio/detail/config.hpp> #include <boost/limits.hpp> #include <boost/asio/io_service.hpp> +#include <boost/asio/detail/scoped_ptr.hpp> #include <boost/asio/detail/service_registry.hpp> #include <boost/asio/detail/throw_error.hpp> @@ -33,17 +34,18 @@ namespace boost { namespace asio { io_service::io_service() - : service_registry_(new boost::asio::detail::service_registry(*this)), - impl_(service_registry_->use_service<impl_type>()) + : service_registry_(new boost::asio::detail::service_registry( + *this, static_cast<impl_type*>(0), + (std::numeric_limits<std::size_t>::max)())), + impl_(service_registry_->first_service<impl_type>()) { - impl_.init((std::numeric_limits<std::size_t>::max)()); } io_service::io_service(std::size_t concurrency_hint) - : service_registry_(new boost::asio::detail::service_registry(*this)), - impl_(service_registry_->use_service<impl_type>()) + : service_registry_(new boost::asio::detail::service_registry( + *this, static_cast<impl_type*>(0), concurrency_hint)), + impl_(service_registry_->first_service<impl_type>()) { - impl_.init(concurrency_hint); } io_service::~io_service() @@ -108,11 +110,21 @@ void io_service::stop() impl_.stop(); } +bool io_service::stopped() const +{ + return impl_.stopped(); +} + void io_service::reset() { impl_.reset(); } +void io_service::notify_fork(boost::asio::io_service::fork_event event) +{ + service_registry_->notify_fork(event); +} + io_service::service::service(boost::asio::io_service& owner) : owner_(owner), next_(0) @@ -123,6 +135,10 @@ io_service::service::~service() { } +void io_service::service::fork_service(boost::asio::io_service::fork_event) +{ +} + service_already_exists::service_already_exists() : std::logic_error("Service already exists.") { diff --git a/3rdParty/Boost/src/boost/asio/impl/read.hpp b/3rdParty/Boost/src/boost/asio/impl/read.hpp index 9fba190..9290cd4 100644 --- a/3rdParty/Boost/src/boost/asio/impl/read.hpp +++ b/3rdParty/Boost/src/boost/asio/impl/read.hpp @@ -2,7 +2,7 @@ // impl/read.hpp // ~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -18,11 +18,14 @@ #include <algorithm> #include <boost/asio/buffer.hpp> #include <boost/asio/completion_condition.hpp> +#include <boost/asio/detail/array_fwd.hpp> #include <boost/asio/detail/base_from_completion_cond.hpp> #include <boost/asio/detail/bind_handler.hpp> #include <boost/asio/detail/consuming_buffers.hpp> +#include <boost/asio/detail/dependent_type.hpp> #include <boost/asio/detail/handler_alloc_helpers.hpp> #include <boost/asio/detail/handler_invoke_helpers.hpp> +#include <boost/asio/detail/handler_type_requirements.hpp> #include <boost/asio/detail/throw_error.hpp> #include <boost/asio/error.hpp> @@ -58,10 +61,17 @@ inline std::size_t read(SyncReadStream& s, const MutableBufferSequence& buffers) { boost::system::error_code ec; std::size_t bytes_transferred = read(s, buffers, transfer_all(), ec); - boost::asio::detail::throw_error(ec); + boost::asio::detail::throw_error(ec, "read"); return bytes_transferred; } +template <typename SyncReadStream, typename MutableBufferSequence> +inline std::size_t read(SyncReadStream& s, const MutableBufferSequence& buffers, + boost::system::error_code& ec) +{ + return read(s, buffers, transfer_all(), ec); +} + template <typename SyncReadStream, typename MutableBufferSequence, typename CompletionCondition> inline std::size_t read(SyncReadStream& s, const MutableBufferSequence& buffers, @@ -69,7 +79,7 @@ inline std::size_t read(SyncReadStream& s, const MutableBufferSequence& buffers, { boost::system::error_code ec; std::size_t bytes_transferred = read(s, buffers, completion_condition, ec); - boost::asio::detail::throw_error(ec); + boost::asio::detail::throw_error(ec, "read"); return bytes_transferred; } @@ -104,10 +114,18 @@ inline std::size_t read(SyncReadStream& s, { boost::system::error_code ec; std::size_t bytes_transferred = read(s, b, transfer_all(), ec); - boost::asio::detail::throw_error(ec); + boost::asio::detail::throw_error(ec, "read"); return bytes_transferred; } +template <typename SyncReadStream, typename Allocator> +inline std::size_t read(SyncReadStream& s, + boost::asio::basic_streambuf<Allocator>& b, + boost::system::error_code& ec) +{ + return read(s, b, transfer_all(), ec); +} + template <typename SyncReadStream, typename Allocator, typename CompletionCondition> inline std::size_t read(SyncReadStream& s, @@ -116,7 +134,7 @@ inline std::size_t read(SyncReadStream& s, { boost::system::error_code ec; std::size_t bytes_transferred = read(s, b, completion_condition, ec); - boost::asio::detail::throw_error(ec); + boost::asio::detail::throw_error(ec, "read"); return bytes_transferred; } @@ -131,15 +149,35 @@ namespace detail { public: read_op(AsyncReadStream& stream, const MutableBufferSequence& buffers, - CompletionCondition completion_condition, ReadHandler handler) + CompletionCondition completion_condition, ReadHandler& handler) : detail::base_from_completion_cond< CompletionCondition>(completion_condition), stream_(stream), buffers_(buffers), total_transferred_(0), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)) + { + } + +#if defined(BOOST_ASIO_HAS_MOVE) + read_op(const read_op& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + stream_(other.stream_), + buffers_(other.buffers_), + total_transferred_(other.total_transferred_), + handler_(other.handler_) + { + } + + read_op(read_op&& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + stream_(other.stream_), + buffers_(other.buffers_), + total_transferred_(other.total_transferred_), + handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_)) { } +#endif // defined(BOOST_ASIO_HAS_MOVE) void operator()(const boost::system::error_code& ec, std::size_t bytes_transferred, int start = 0) @@ -150,7 +188,8 @@ namespace detail buffers_.prepare(this->check_for_completion(ec, total_transferred_)); for (;;) { - stream_.async_read_some(buffers_, *this); + stream_.async_read_some(buffers_, + BOOST_ASIO_MOVE_CAST(read_op)(*this)); return; default: total_transferred_ += bytes_transferred; buffers_.consume(bytes_transferred); @@ -181,17 +220,36 @@ namespace detail public: read_op(AsyncReadStream& stream, const boost::asio::mutable_buffers_1& buffers, - CompletionCondition completion_condition, - ReadHandler handler) + CompletionCondition completion_condition, ReadHandler& handler) : detail::base_from_completion_cond< CompletionCondition>(completion_condition), stream_(stream), buffer_(buffers), total_transferred_(0), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)) + { + } + +#if defined(BOOST_ASIO_HAS_MOVE) + read_op(const read_op& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + stream_(other.stream_), + buffer_(other.buffer_), + total_transferred_(other.total_transferred_), + handler_(other.handler_) { } + read_op(read_op&& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + stream_(other.stream_), + buffer_(other.buffer_), + total_transferred_(other.total_transferred_), + handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_)) + { + } +#endif // defined(BOOST_ASIO_HAS_MOVE) + void operator()(const boost::system::error_code& ec, std::size_t bytes_transferred, int start = 0) { @@ -202,8 +260,9 @@ namespace detail n = this->check_for_completion(ec, total_transferred_); for (;;) { - stream_.async_read_some(boost::asio::buffer( - buffer_ + total_transferred_, n), *this); + stream_.async_read_some( + boost::asio::buffer(buffer_ + total_transferred_, n), + BOOST_ASIO_MOVE_CAST(read_op)(*this)); return; default: total_transferred_ += bytes_transferred; if ((!ec && bytes_transferred == 0) @@ -223,6 +282,168 @@ namespace detail ReadHandler handler_; }; + template <typename AsyncReadStream, typename Elem, + typename CompletionCondition, typename ReadHandler> + class read_op<AsyncReadStream, boost::array<Elem, 2>, + CompletionCondition, ReadHandler> + : detail::base_from_completion_cond<CompletionCondition> + { + public: + read_op(AsyncReadStream& stream, const boost::array<Elem, 2>& buffers, + CompletionCondition completion_condition, ReadHandler& handler) + : detail::base_from_completion_cond< + CompletionCondition>(completion_condition), + stream_(stream), + buffers_(buffers), + total_transferred_(0), + handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)) + { + } + +#if defined(BOOST_ASIO_HAS_MOVE) + read_op(const read_op& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + stream_(other.stream_), + buffers_(other.buffers_), + total_transferred_(other.total_transferred_), + handler_(other.handler_) + { + } + + read_op(read_op&& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + stream_(other.stream_), + buffers_(other.buffers_), + total_transferred_(other.total_transferred_), + handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_)) + { + } +#endif // defined(BOOST_ASIO_HAS_MOVE) + + void operator()(const boost::system::error_code& ec, + std::size_t bytes_transferred, int start = 0) + { + typename boost::asio::detail::dependent_type<Elem, + boost::array<boost::asio::mutable_buffer, 2> >::type bufs = {{ + boost::asio::mutable_buffer(buffers_[0]), + boost::asio::mutable_buffer(buffers_[1]) }}; + std::size_t buffer_size0 = boost::asio::buffer_size(bufs[0]); + std::size_t buffer_size1 = boost::asio::buffer_size(bufs[1]); + std::size_t n = 0; + switch (start) + { + case 1: + n = this->check_for_completion(ec, total_transferred_); + for (;;) + { + bufs[0] = boost::asio::buffer(bufs[0] + total_transferred_, n); + bufs[1] = boost::asio::buffer( + bufs[1] + (total_transferred_ < buffer_size0 + ? 0 : total_transferred_ - buffer_size0), + n - boost::asio::buffer_size(bufs[0])); + stream_.async_read_some(bufs, BOOST_ASIO_MOVE_CAST(read_op)(*this)); + return; default: + total_transferred_ += bytes_transferred; + if ((!ec && bytes_transferred == 0) + || (n = this->check_for_completion(ec, total_transferred_)) == 0 + || total_transferred_ == buffer_size0 + buffer_size1) + break; + } + + handler_(ec, static_cast<const std::size_t&>(total_transferred_)); + } + } + + //private: + AsyncReadStream& stream_; + boost::array<Elem, 2> buffers_; + std::size_t total_transferred_; + ReadHandler handler_; + }; + +#if defined(BOOST_ASIO_HAS_STD_ARRAY) + + template <typename AsyncReadStream, typename Elem, + typename CompletionCondition, typename ReadHandler> + class read_op<AsyncReadStream, std::array<Elem, 2>, + CompletionCondition, ReadHandler> + : detail::base_from_completion_cond<CompletionCondition> + { + public: + read_op(AsyncReadStream& stream, const std::array<Elem, 2>& buffers, + CompletionCondition completion_condition, ReadHandler& handler) + : detail::base_from_completion_cond< + CompletionCondition>(completion_condition), + stream_(stream), + buffers_(buffers), + total_transferred_(0), + handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)) + { + } + +#if defined(BOOST_ASIO_HAS_MOVE) + read_op(const read_op& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + stream_(other.stream_), + buffers_(other.buffers_), + total_transferred_(other.total_transferred_), + handler_(other.handler_) + { + } + + read_op(read_op&& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + stream_(other.stream_), + buffers_(other.buffers_), + total_transferred_(other.total_transferred_), + handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_)) + { + } +#endif // defined(BOOST_ASIO_HAS_MOVE) + + void operator()(const boost::system::error_code& ec, + std::size_t bytes_transferred, int start = 0) + { + typename boost::asio::detail::dependent_type<Elem, + std::array<boost::asio::mutable_buffer, 2> >::type bufs = {{ + boost::asio::mutable_buffer(buffers_[0]), + boost::asio::mutable_buffer(buffers_[1]) }}; + std::size_t buffer_size0 = boost::asio::buffer_size(bufs[0]); + std::size_t buffer_size1 = boost::asio::buffer_size(bufs[1]); + std::size_t n = 0; + switch (start) + { + case 1: + n = this->check_for_completion(ec, total_transferred_); + for (;;) + { + bufs[0] = boost::asio::buffer(bufs[0] + total_transferred_, n); + bufs[1] = boost::asio::buffer( + bufs[1] + (total_transferred_ < buffer_size0 + ? 0 : total_transferred_ - buffer_size0), + n - boost::asio::buffer_size(bufs[0])); + stream_.async_read_some(bufs, BOOST_ASIO_MOVE_CAST(read_op)(*this)); + return; default: + total_transferred_ += bytes_transferred; + if ((!ec && bytes_transferred == 0) + || (n = this->check_for_completion(ec, total_transferred_)) == 0 + || total_transferred_ == buffer_size0 + buffer_size1) + break; + } + + handler_(ec, static_cast<const std::size_t&>(total_transferred_)); + } + } + + //private: + AsyncReadStream& stream_; + std::array<Elem, 2> buffers_; + std::size_t total_transferred_; + ReadHandler handler_; + }; + +#endif // defined(BOOST_ASIO_HAS_STD_ARRAY) + template <typename AsyncReadStream, typename MutableBufferSequence, typename CompletionCondition, typename ReadHandler> inline void* asio_handler_allocate(std::size_t size, @@ -246,6 +467,17 @@ namespace detail template <typename Function, typename AsyncReadStream, typename MutableBufferSequence, typename CompletionCondition, typename ReadHandler> + inline void asio_handler_invoke(Function& function, + read_op<AsyncReadStream, MutableBufferSequence, + CompletionCondition, ReadHandler>* this_handler) + { + boost_asio_handler_invoke_helpers::invoke( + function, this_handler->handler_); + } + + template <typename Function, typename AsyncReadStream, + typename MutableBufferSequence, typename CompletionCondition, + typename ReadHandler> inline void asio_handler_invoke(const Function& function, read_op<AsyncReadStream, MutableBufferSequence, CompletionCondition, ReadHandler>* this_handler) @@ -253,25 +485,47 @@ namespace detail boost_asio_handler_invoke_helpers::invoke( function, this_handler->handler_); } + + template <typename AsyncReadStream, typename MutableBufferSequence, + typename CompletionCondition, typename ReadHandler> + inline read_op<AsyncReadStream, MutableBufferSequence, + CompletionCondition, ReadHandler> + make_read_op(AsyncReadStream& s, const MutableBufferSequence& buffers, + CompletionCondition completion_condition, ReadHandler handler) + { + return read_op<AsyncReadStream, MutableBufferSequence, CompletionCondition, + ReadHandler>(s, buffers, completion_condition, handler); + } } // namespace detail template <typename AsyncReadStream, typename MutableBufferSequence, typename CompletionCondition, typename ReadHandler> inline void async_read(AsyncReadStream& s, const MutableBufferSequence& buffers, - CompletionCondition completion_condition, ReadHandler handler) + CompletionCondition completion_condition, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { - detail::read_op<AsyncReadStream, MutableBufferSequence, - CompletionCondition, ReadHandler>( - s, buffers, completion_condition, handler)( + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a ReadHandler. + BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; + + detail::make_read_op( + s, buffers, completion_condition, + BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))( boost::system::error_code(), 0, 1); } template <typename AsyncReadStream, typename MutableBufferSequence, typename ReadHandler> inline void async_read(AsyncReadStream& s, const MutableBufferSequence& buffers, - ReadHandler handler) + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { - async_read(s, buffers, transfer_all(), handler); + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a ReadHandler. + BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; + + detail::make_read_op( + s, buffers, transfer_all(), BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))( + boost::system::error_code(), 0, 1); } #if !defined(BOOST_NO_IOSTREAM) @@ -286,15 +540,35 @@ namespace detail public: read_streambuf_op(AsyncReadStream& stream, basic_streambuf<Allocator>& streambuf, - CompletionCondition completion_condition, ReadHandler handler) + CompletionCondition completion_condition, ReadHandler& handler) : detail::base_from_completion_cond< CompletionCondition>(completion_condition), stream_(stream), streambuf_(streambuf), total_transferred_(0), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)) + { + } + +#if defined(BOOST_ASIO_HAS_MOVE) + read_streambuf_op(const read_streambuf_op& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + stream_(other.stream_), + streambuf_(other.streambuf_), + total_transferred_(other.total_transferred_), + handler_(other.handler_) + { + } + + read_streambuf_op(read_streambuf_op&& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + stream_(other.stream_), + streambuf_(other.streambuf_), + total_transferred_(other.total_transferred_), + handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_)) { } +#endif // defined(BOOST_ASIO_HAS_MOVE) void operator()(const boost::system::error_code& ec, std::size_t bytes_transferred, int start = 0) @@ -307,7 +581,8 @@ namespace detail bytes_available = read_size_helper(streambuf_, max_size); for (;;) { - stream_.async_read_some(streambuf_.prepare(bytes_available), *this); + stream_.async_read_some(streambuf_.prepare(bytes_available), + BOOST_ASIO_MOVE_CAST(read_streambuf_op)(*this)); return; default: total_transferred_ += bytes_transferred; streambuf_.commit(bytes_transferred); @@ -350,6 +625,16 @@ namespace detail template <typename Function, typename AsyncReadStream, typename Allocator, typename CompletionCondition, typename ReadHandler> + inline void asio_handler_invoke(Function& function, + read_streambuf_op<AsyncReadStream, Allocator, + CompletionCondition, ReadHandler>* this_handler) + { + boost_asio_handler_invoke_helpers::invoke( + function, this_handler->handler_); + } + + template <typename Function, typename AsyncReadStream, + typename Allocator, typename CompletionCondition, typename ReadHandler> inline void asio_handler_invoke(const Function& function, read_streambuf_op<AsyncReadStream, Allocator, CompletionCondition, ReadHandler>* this_handler) @@ -357,25 +642,48 @@ namespace detail boost_asio_handler_invoke_helpers::invoke( function, this_handler->handler_); } + + template <typename AsyncReadStream, typename Allocator, + typename CompletionCondition, typename ReadHandler> + inline read_streambuf_op<AsyncReadStream, Allocator, + CompletionCondition, ReadHandler> + make_read_streambuf_op( + AsyncReadStream& s, boost::asio::basic_streambuf<Allocator>& b, + CompletionCondition completion_condition, ReadHandler handler) + { + return read_streambuf_op<AsyncReadStream, Allocator, CompletionCondition, + ReadHandler>(s, b, completion_condition, handler); + } } // namespace detail template <typename AsyncReadStream, typename Allocator, typename CompletionCondition, typename ReadHandler> inline void async_read(AsyncReadStream& s, boost::asio::basic_streambuf<Allocator>& b, - CompletionCondition completion_condition, ReadHandler handler) + CompletionCondition completion_condition, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { - detail::read_streambuf_op<AsyncReadStream, - Allocator, CompletionCondition, ReadHandler>( - s, b, completion_condition, handler)( - boost::system::error_code(), 0, 1); + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a ReadHandler. + BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; + + detail::make_read_streambuf_op( + s, b, completion_condition, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))( + boost::system::error_code(), 0, 1); } template <typename AsyncReadStream, typename Allocator, typename ReadHandler> inline void async_read(AsyncReadStream& s, - boost::asio::basic_streambuf<Allocator>& b, ReadHandler handler) + boost::asio::basic_streambuf<Allocator>& b, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { - async_read(s, b, transfer_all(), handler); + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a ReadHandler. + BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; + + detail::make_read_streambuf_op( + s, b, transfer_all(), BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))( + boost::system::error_code(), 0, 1); } #endif // !defined(BOOST_NO_IOSTREAM) diff --git a/3rdParty/Boost/src/boost/asio/impl/read_at.hpp b/3rdParty/Boost/src/boost/asio/impl/read_at.hpp index dcf2c33..08e37fe 100644 --- a/3rdParty/Boost/src/boost/asio/impl/read_at.hpp +++ b/3rdParty/Boost/src/boost/asio/impl/read_at.hpp @@ -2,7 +2,7 @@ // impl/read_at.hpp // ~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -18,11 +18,14 @@ #include <algorithm> #include <boost/asio/buffer.hpp> #include <boost/asio/completion_condition.hpp> +#include <boost/asio/detail/array_fwd.hpp> #include <boost/asio/detail/base_from_completion_cond.hpp> #include <boost/asio/detail/bind_handler.hpp> #include <boost/asio/detail/consuming_buffers.hpp> +#include <boost/asio/detail/dependent_type.hpp> #include <boost/asio/detail/handler_alloc_helpers.hpp> #include <boost/asio/detail/handler_invoke_helpers.hpp> +#include <boost/asio/detail/handler_type_requirements.hpp> #include <boost/asio/detail/throw_error.hpp> #include <boost/asio/error.hpp> @@ -62,10 +65,18 @@ inline std::size_t read_at(SyncRandomAccessReadDevice& d, boost::system::error_code ec; std::size_t bytes_transferred = read_at( d, offset, buffers, transfer_all(), ec); - boost::asio::detail::throw_error(ec); + boost::asio::detail::throw_error(ec, "read_at"); return bytes_transferred; } +template <typename SyncRandomAccessReadDevice, typename MutableBufferSequence> +inline std::size_t read_at(SyncRandomAccessReadDevice& d, + boost::uint64_t offset, const MutableBufferSequence& buffers, + boost::system::error_code& ec) +{ + return read_at(d, offset, buffers, transfer_all(), ec); +} + template <typename SyncRandomAccessReadDevice, typename MutableBufferSequence, typename CompletionCondition> inline std::size_t read_at(SyncRandomAccessReadDevice& d, @@ -75,7 +86,7 @@ inline std::size_t read_at(SyncRandomAccessReadDevice& d, boost::system::error_code ec; std::size_t bytes_transferred = read_at( d, offset, buffers, completion_condition, ec); - boost::asio::detail::throw_error(ec); + boost::asio::detail::throw_error(ec, "read_at"); return bytes_transferred; } @@ -112,10 +123,18 @@ inline std::size_t read_at(SyncRandomAccessReadDevice& d, boost::system::error_code ec; std::size_t bytes_transferred = read_at( d, offset, b, transfer_all(), ec); - boost::asio::detail::throw_error(ec); + boost::asio::detail::throw_error(ec, "read_at"); return bytes_transferred; } +template <typename SyncRandomAccessReadDevice, typename Allocator> +inline std::size_t read_at(SyncRandomAccessReadDevice& d, + boost::uint64_t offset, boost::asio::basic_streambuf<Allocator>& b, + boost::system::error_code& ec) +{ + return read_at(d, offset, b, transfer_all(), ec); +} + template <typename SyncRandomAccessReadDevice, typename Allocator, typename CompletionCondition> inline std::size_t read_at(SyncRandomAccessReadDevice& d, @@ -125,7 +144,7 @@ inline std::size_t read_at(SyncRandomAccessReadDevice& d, boost::system::error_code ec; std::size_t bytes_transferred = read_at( d, offset, b, completion_condition, ec); - boost::asio::detail::throw_error(ec); + boost::asio::detail::throw_error(ec, "read_at"); return bytes_transferred; } @@ -142,16 +161,38 @@ namespace detail public: read_at_op(AsyncRandomAccessReadDevice& device, boost::uint64_t offset, const MutableBufferSequence& buffers, - CompletionCondition completion_condition, ReadHandler handler) + CompletionCondition completion_condition, ReadHandler& handler) : detail::base_from_completion_cond< CompletionCondition>(completion_condition), device_(device), offset_(offset), buffers_(buffers), total_transferred_(0), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)) + { + } + +#if defined(BOOST_ASIO_HAS_MOVE) + read_at_op(const read_at_op& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + device_(other.device_), + offset_(other.offset_), + buffers_(other.buffers_), + total_transferred_(other.total_transferred_), + handler_(other.handler_) + { + } + + read_at_op(read_at_op&& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + device_(other.device_), + offset_(other.offset_), + buffers_(other.buffers_), + total_transferred_(other.total_transferred_), + handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_)) { } +#endif // defined(BOOST_ASIO_HAS_MOVE) void operator()(const boost::system::error_code& ec, std::size_t bytes_transferred, int start = 0) @@ -162,8 +203,8 @@ namespace detail buffers_.prepare(this->check_for_completion(ec, total_transferred_)); for (;;) { - device_.async_read_some_at( - offset_ + total_transferred_, buffers_, *this); + device_.async_read_some_at(offset_ + total_transferred_, + buffers_, BOOST_ASIO_MOVE_CAST(read_at_op)(*this)); return; default: total_transferred_ += bytes_transferred; buffers_.consume(bytes_transferred); @@ -195,16 +236,38 @@ namespace detail public: read_at_op(AsyncRandomAccessReadDevice& device, boost::uint64_t offset, const boost::asio::mutable_buffers_1& buffers, - CompletionCondition completion_condition, ReadHandler handler) + CompletionCondition completion_condition, ReadHandler& handler) : detail::base_from_completion_cond< CompletionCondition>(completion_condition), device_(device), offset_(offset), buffer_(buffers), total_transferred_(0), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)) + { + } + +#if defined(BOOST_ASIO_HAS_MOVE) + read_at_op(const read_at_op& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + device_(other.device_), + offset_(other.offset_), + buffer_(other.buffer_), + total_transferred_(other.total_transferred_), + handler_(other.handler_) + { + } + + read_at_op(read_at_op&& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + device_(other.device_), + offset_(other.offset_), + buffer_(other.buffer_), + total_transferred_(other.total_transferred_), + handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_)) { } +#endif // defined(BOOST_ASIO_HAS_MOVE) void operator()(const boost::system::error_code& ec, std::size_t bytes_transferred, int start = 0) @@ -217,7 +280,8 @@ namespace detail for (;;) { device_.async_read_some_at(offset_ + total_transferred_, - boost::asio::buffer(buffer_ + total_transferred_, n), *this); + boost::asio::buffer(buffer_ + total_transferred_, n), + BOOST_ASIO_MOVE_CAST(read_at_op)(*this)); return; default: total_transferred_ += bytes_transferred; if ((!ec && bytes_transferred == 0) @@ -238,6 +302,180 @@ namespace detail ReadHandler handler_; }; + template <typename AsyncRandomAccessReadDevice, typename Elem, + typename CompletionCondition, typename ReadHandler> + class read_at_op<AsyncRandomAccessReadDevice, boost::array<Elem, 2>, + CompletionCondition, ReadHandler> + : detail::base_from_completion_cond<CompletionCondition> + { + public: + read_at_op(AsyncRandomAccessReadDevice& device, + boost::uint64_t offset, const boost::array<Elem, 2>& buffers, + CompletionCondition completion_condition, ReadHandler& handler) + : detail::base_from_completion_cond< + CompletionCondition>(completion_condition), + device_(device), + offset_(offset), + buffers_(buffers), + total_transferred_(0), + handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)) + { + } + +#if defined(BOOST_ASIO_HAS_MOVE) + read_at_op(const read_at_op& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + device_(other.device_), + offset_(other.offset_), + buffers_(other.buffers_), + total_transferred_(other.total_transferred_), + handler_(other.handler_) + { + } + + read_at_op(read_at_op&& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + device_(other.device_), + offset_(other.offset_), + buffers_(other.buffers_), + total_transferred_(other.total_transferred_), + handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_)) + { + } +#endif // defined(BOOST_ASIO_HAS_MOVE) + + void operator()(const boost::system::error_code& ec, + std::size_t bytes_transferred, int start = 0) + { + typename boost::asio::detail::dependent_type<Elem, + boost::array<boost::asio::mutable_buffer, 2> >::type bufs = {{ + boost::asio::mutable_buffer(buffers_[0]), + boost::asio::mutable_buffer(buffers_[1]) }}; + std::size_t buffer_size0 = boost::asio::buffer_size(bufs[0]); + std::size_t buffer_size1 = boost::asio::buffer_size(bufs[1]); + std::size_t n = 0; + switch (start) + { + case 1: + n = this->check_for_completion(ec, total_transferred_); + for (;;) + { + bufs[0] = boost::asio::buffer(bufs[0] + total_transferred_, n); + bufs[1] = boost::asio::buffer( + bufs[1] + (total_transferred_ < buffer_size0 + ? 0 : total_transferred_ - buffer_size0), + n - boost::asio::buffer_size(bufs[0])); + device_.async_read_some_at(offset_ + total_transferred_, + bufs, BOOST_ASIO_MOVE_CAST(read_at_op)(*this)); + return; default: + total_transferred_ += bytes_transferred; + if ((!ec && bytes_transferred == 0) + || (n = this->check_for_completion(ec, total_transferred_)) == 0 + || total_transferred_ == buffer_size0 + buffer_size1) + break; + } + + handler_(ec, static_cast<const std::size_t&>(total_transferred_)); + } + } + + //private: + AsyncRandomAccessReadDevice& device_; + boost::uint64_t offset_; + boost::array<Elem, 2> buffers_; + std::size_t total_transferred_; + ReadHandler handler_; + }; + +#if defined(BOOST_ASIO_HAS_STD_ARRAY) + + template <typename AsyncRandomAccessReadDevice, typename Elem, + typename CompletionCondition, typename ReadHandler> + class read_at_op<AsyncRandomAccessReadDevice, std::array<Elem, 2>, + CompletionCondition, ReadHandler> + : detail::base_from_completion_cond<CompletionCondition> + { + public: + read_at_op(AsyncRandomAccessReadDevice& device, + boost::uint64_t offset, const std::array<Elem, 2>& buffers, + CompletionCondition completion_condition, ReadHandler& handler) + : detail::base_from_completion_cond< + CompletionCondition>(completion_condition), + device_(device), + offset_(offset), + buffers_(buffers), + total_transferred_(0), + handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)) + { + } + +#if defined(BOOST_ASIO_HAS_MOVE) + read_at_op(const read_at_op& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + device_(other.device_), + offset_(other.offset_), + buffers_(other.buffers_), + total_transferred_(other.total_transferred_), + handler_(other.handler_) + { + } + + read_at_op(read_at_op&& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + device_(other.device_), + offset_(other.offset_), + buffers_(other.buffers_), + total_transferred_(other.total_transferred_), + handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_)) + { + } +#endif // defined(BOOST_ASIO_HAS_MOVE) + + void operator()(const boost::system::error_code& ec, + std::size_t bytes_transferred, int start = 0) + { + typename boost::asio::detail::dependent_type<Elem, + std::array<boost::asio::mutable_buffer, 2> >::type bufs = {{ + boost::asio::mutable_buffer(buffers_[0]), + boost::asio::mutable_buffer(buffers_[1]) }}; + std::size_t buffer_size0 = boost::asio::buffer_size(bufs[0]); + std::size_t buffer_size1 = boost::asio::buffer_size(bufs[1]); + std::size_t n = 0; + switch (start) + { + case 1: + n = this->check_for_completion(ec, total_transferred_); + for (;;) + { + bufs[0] = boost::asio::buffer(bufs[0] + total_transferred_, n); + bufs[1] = boost::asio::buffer( + bufs[1] + (total_transferred_ < buffer_size0 + ? 0 : total_transferred_ - buffer_size0), + n - boost::asio::buffer_size(bufs[0])); + device_.async_read_some_at(offset_ + total_transferred_, + bufs, BOOST_ASIO_MOVE_CAST(read_at_op)(*this)); + return; default: + total_transferred_ += bytes_transferred; + if ((!ec && bytes_transferred == 0) + || (n = this->check_for_completion(ec, total_transferred_)) == 0 + || total_transferred_ == buffer_size0 + buffer_size1) + break; + } + + handler_(ec, static_cast<const std::size_t&>(total_transferred_)); + } + } + + //private: + AsyncRandomAccessReadDevice& device_; + boost::uint64_t offset_; + std::array<Elem, 2> buffers_; + std::size_t total_transferred_; + ReadHandler handler_; + }; + +#endif // defined(BOOST_ASIO_HAS_STD_ARRAY) + template <typename AsyncRandomAccessReadDevice, typename MutableBufferSequence, typename CompletionCondition, typename ReadHandler> @@ -263,6 +501,17 @@ namespace detail template <typename Function, typename AsyncRandomAccessReadDevice, typename MutableBufferSequence, typename CompletionCondition, typename ReadHandler> + inline void asio_handler_invoke(Function& function, + read_at_op<AsyncRandomAccessReadDevice, MutableBufferSequence, + CompletionCondition, ReadHandler>* this_handler) + { + boost_asio_handler_invoke_helpers::invoke( + function, this_handler->handler_); + } + + template <typename Function, typename AsyncRandomAccessReadDevice, + typename MutableBufferSequence, typename CompletionCondition, + typename ReadHandler> inline void asio_handler_invoke(const Function& function, read_at_op<AsyncRandomAccessReadDevice, MutableBufferSequence, CompletionCondition, ReadHandler>* this_handler) @@ -270,17 +519,36 @@ namespace detail boost_asio_handler_invoke_helpers::invoke( function, this_handler->handler_); } + + template <typename AsyncRandomAccessReadDevice, + typename MutableBufferSequence, typename CompletionCondition, + typename ReadHandler> + inline read_at_op<AsyncRandomAccessReadDevice, + MutableBufferSequence, CompletionCondition, ReadHandler> + make_read_at_op(AsyncRandomAccessReadDevice& d, + boost::uint64_t offset, const MutableBufferSequence& buffers, + CompletionCondition completion_condition, ReadHandler handler) + { + return read_at_op<AsyncRandomAccessReadDevice, + MutableBufferSequence, CompletionCondition, ReadHandler>( + d, offset, buffers, completion_condition, handler); + } } // namespace detail template <typename AsyncRandomAccessReadDevice, typename MutableBufferSequence, typename CompletionCondition, typename ReadHandler> inline void async_read_at(AsyncRandomAccessReadDevice& d, boost::uint64_t offset, const MutableBufferSequence& buffers, - CompletionCondition completion_condition, ReadHandler handler) + CompletionCondition completion_condition, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { - detail::read_at_op<AsyncRandomAccessReadDevice, - MutableBufferSequence, CompletionCondition, ReadHandler>( - d, offset, buffers, completion_condition, handler)( + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a ReadHandler. + BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; + + detail::make_read_at_op( + d, offset, buffers, completion_condition, + BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))( boost::system::error_code(), 0, 1); } @@ -288,9 +556,16 @@ template <typename AsyncRandomAccessReadDevice, typename MutableBufferSequence, typename ReadHandler> inline void async_read_at(AsyncRandomAccessReadDevice& d, boost::uint64_t offset, const MutableBufferSequence& buffers, - ReadHandler handler) + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { - async_read_at(d, offset, buffers, transfer_all(), handler); + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a ReadHandler. + BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; + + detail::make_read_at_op( + d, offset, buffers, transfer_all(), + BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))( + boost::system::error_code(), 0, 1); } #if !defined(BOOST_NO_IOSTREAM) @@ -305,17 +580,39 @@ namespace detail public: read_at_streambuf_op(AsyncRandomAccessReadDevice& device, boost::uint64_t offset, basic_streambuf<Allocator>& streambuf, - CompletionCondition completion_condition, ReadHandler handler) + CompletionCondition completion_condition, ReadHandler& handler) : detail::base_from_completion_cond< CompletionCondition>(completion_condition), device_(device), offset_(offset), streambuf_(streambuf), total_transferred_(0), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)) + { + } + +#if defined(BOOST_ASIO_HAS_MOVE) + read_at_streambuf_op(const read_at_streambuf_op& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + device_(other.device_), + offset_(other.offset_), + streambuf_(other.streambuf_), + total_transferred_(other.total_transferred_), + handler_(other.handler_) { } + read_at_streambuf_op(read_at_streambuf_op&& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + device_(other.device_), + offset_(other.offset_), + streambuf_(other.streambuf_), + total_transferred_(other.total_transferred_), + handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_)) + { + } +#endif // defined(BOOST_ASIO_HAS_MOVE) + void operator()(const boost::system::error_code& ec, std::size_t bytes_transferred, int start = 0) { @@ -328,7 +625,8 @@ namespace detail for (;;) { device_.async_read_some_at(offset_ + total_transferred_, - streambuf_.prepare(bytes_available), *this); + streambuf_.prepare(bytes_available), + BOOST_ASIO_MOVE_CAST(read_at_streambuf_op)(*this)); return; default: total_transferred_ += bytes_transferred; streambuf_.commit(bytes_transferred); @@ -372,6 +670,16 @@ namespace detail template <typename Function, typename AsyncRandomAccessReadDevice, typename Allocator, typename CompletionCondition, typename ReadHandler> + inline void asio_handler_invoke(Function& function, + read_at_streambuf_op<AsyncRandomAccessReadDevice, Allocator, + CompletionCondition, ReadHandler>* this_handler) + { + boost_asio_handler_invoke_helpers::invoke( + function, this_handler->handler_); + } + + template <typename Function, typename AsyncRandomAccessReadDevice, + typename Allocator, typename CompletionCondition, typename ReadHandler> inline void asio_handler_invoke(const Function& function, read_at_streambuf_op<AsyncRandomAccessReadDevice, Allocator, CompletionCondition, ReadHandler>* this_handler) @@ -379,17 +687,35 @@ namespace detail boost_asio_handler_invoke_helpers::invoke( function, this_handler->handler_); } + + template <typename AsyncRandomAccessReadDevice, typename Allocator, + typename CompletionCondition, typename ReadHandler> + inline read_at_streambuf_op<AsyncRandomAccessReadDevice, + Allocator, CompletionCondition, ReadHandler> + make_read_at_streambuf_op(AsyncRandomAccessReadDevice& d, + boost::uint64_t offset, boost::asio::basic_streambuf<Allocator>& b, + CompletionCondition completion_condition, ReadHandler handler) + { + return read_at_streambuf_op<AsyncRandomAccessReadDevice, + Allocator, CompletionCondition, ReadHandler>( + d, offset, b, completion_condition, handler); + } } // namespace detail template <typename AsyncRandomAccessReadDevice, typename Allocator, typename CompletionCondition, typename ReadHandler> inline void async_read_at(AsyncRandomAccessReadDevice& d, boost::uint64_t offset, boost::asio::basic_streambuf<Allocator>& b, - CompletionCondition completion_condition, ReadHandler handler) + CompletionCondition completion_condition, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { - detail::read_at_streambuf_op<AsyncRandomAccessReadDevice, - Allocator, CompletionCondition, ReadHandler>( - d, offset, b, completion_condition, handler)( + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a ReadHandler. + BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; + + detail::make_read_at_streambuf_op( + d, offset, b, completion_condition, + BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))( boost::system::error_code(), 0, 1); } @@ -397,9 +723,16 @@ template <typename AsyncRandomAccessReadDevice, typename Allocator, typename ReadHandler> inline void async_read_at(AsyncRandomAccessReadDevice& d, boost::uint64_t offset, boost::asio::basic_streambuf<Allocator>& b, - ReadHandler handler) + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { - async_read_at(d, offset, b, transfer_all(), handler); + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a ReadHandler. + BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; + + detail::make_read_at_streambuf_op( + d, offset, b, transfer_all(), + BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))( + boost::system::error_code(), 0, 1); } #endif // !defined(BOOST_NO_IOSTREAM) diff --git a/3rdParty/Boost/src/boost/asio/impl/read_until.hpp b/3rdParty/Boost/src/boost/asio/impl/read_until.hpp index 5eeb1bc..1b9a8f3 100644 --- a/3rdParty/Boost/src/boost/asio/impl/read_until.hpp +++ b/3rdParty/Boost/src/boost/asio/impl/read_until.hpp @@ -2,7 +2,7 @@ // impl/read_until.hpp // ~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -25,6 +25,7 @@ #include <boost/asio/detail/bind_handler.hpp> #include <boost/asio/detail/handler_alloc_helpers.hpp> #include <boost/asio/detail/handler_invoke_helpers.hpp> +#include <boost/asio/detail/handler_type_requirements.hpp> #include <boost/asio/detail/throw_error.hpp> #include <boost/asio/detail/push_options.hpp> @@ -38,7 +39,7 @@ inline std::size_t read_until(SyncReadStream& s, { boost::system::error_code ec; std::size_t bytes_transferred = read_until(s, b, delim, ec); - boost::asio::detail::throw_error(ec); + boost::asio::detail::throw_error(ec, "read_until"); return bytes_transferred; } @@ -56,11 +57,11 @@ std::size_t read_until(SyncReadStream& s, typedef boost::asio::buffers_iterator<const_buffers_type> iterator; const_buffers_type buffers = b.data(); iterator begin = iterator::begin(buffers); - iterator start = begin + search_position; + iterator start_pos = begin + search_position; iterator end = iterator::end(buffers); // Look for a match. - iterator iter = std::find(start, end, delim); + iterator iter = std::find(start_pos, end, delim); if (iter != end) { // Found a match. We're done. @@ -94,7 +95,7 @@ inline std::size_t read_until(SyncReadStream& s, { boost::system::error_code ec; std::size_t bytes_transferred = read_until(s, b, delim, ec); - boost::asio::detail::throw_error(ec); + boost::asio::detail::throw_error(ec, "read_until"); return bytes_transferred; } @@ -147,12 +148,12 @@ std::size_t read_until(SyncReadStream& s, typedef boost::asio::buffers_iterator<const_buffers_type> iterator; const_buffers_type buffers = b.data(); iterator begin = iterator::begin(buffers); - iterator start = begin + search_position; + iterator start_pos = begin + search_position; iterator end = iterator::end(buffers); // Look for a match. std::pair<iterator, bool> result = detail::partial_search( - start, end, delim.begin(), delim.end()); + start_pos, end, delim.begin(), delim.end()); if (result.first != end) { if (result.second) @@ -194,7 +195,7 @@ inline std::size_t read_until(SyncReadStream& s, { boost::system::error_code ec; std::size_t bytes_transferred = read_until(s, b, expr, ec); - boost::asio::detail::throw_error(ec); + boost::asio::detail::throw_error(ec, "read_until"); return bytes_transferred; } @@ -212,14 +213,14 @@ std::size_t read_until(SyncReadStream& s, typedef boost::asio::buffers_iterator<const_buffers_type> iterator; const_buffers_type buffers = b.data(); iterator begin = iterator::begin(buffers); - iterator start = begin + search_position; + iterator start_pos = begin + search_position; iterator end = iterator::end(buffers); // Look for a match. boost::match_results<iterator, typename std::vector<boost::sub_match<iterator> >::allocator_type> match_results; - if (regex_search(start, end, match_results, expr, + if (regex_search(start_pos, end, match_results, expr, boost::match_default | boost::match_partial)) { if (match_results[0].matched) @@ -270,11 +271,11 @@ std::size_t read_until(SyncReadStream& s, typedef boost::asio::buffers_iterator<const_buffers_type> iterator; const_buffers_type buffers = b.data(); iterator begin = iterator::begin(buffers); - iterator start = begin + search_position; + iterator start_pos = begin + search_position; iterator end = iterator::end(buffers); // Look for a match. - std::pair<iterator, bool> result = match_condition(start, end); + std::pair<iterator, bool> result = match_condition(start_pos, end); if (result.second) { // Full match. We're done. @@ -314,7 +315,7 @@ inline std::size_t read_until(SyncReadStream& s, { boost::system::error_code ec; std::size_t bytes_transferred = read_until(s, b, match_condition, ec); - boost::asio::detail::throw_error(ec); + boost::asio::detail::throw_error(ec, "read_until"); return bytes_transferred; } @@ -326,15 +327,35 @@ namespace detail public: read_until_delim_op(AsyncReadStream& stream, boost::asio::basic_streambuf<Allocator>& streambuf, - char delim, ReadHandler handler) + char delim, ReadHandler& handler) : stream_(stream), streambuf_(streambuf), delim_(delim), search_position_(0), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)) { } +#if defined(BOOST_ASIO_HAS_MOVE) + read_until_delim_op(const read_until_delim_op& other) + : stream_(other.stream_), + streambuf_(other.streambuf_), + delim_(other.delim_), + search_position_(other.search_position_), + handler_(other.handler_) + { + } + + read_until_delim_op(read_until_delim_op&& other) + : stream_(other.stream_), + streambuf_(other.streambuf_), + delim_(other.delim_), + search_position_(other.search_position_), + handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_)) + { + } +#endif // defined(BOOST_ASIO_HAS_MOVE) + void operator()(const boost::system::error_code& ec, std::size_t bytes_transferred, int start = 0) { @@ -352,11 +373,11 @@ namespace detail typedef boost::asio::buffers_iterator<const_buffers_type> iterator; const_buffers_type buffers = streambuf_.data(); iterator begin = iterator::begin(buffers); - iterator start = begin + search_position_; + iterator start_pos = begin + search_position_; iterator end = iterator::end(buffers); // Look for a match. - iterator iter = std::find(start, end, delim_); + iterator iter = std::find(start_pos, end, delim_); if (iter != end) { // Found a match. We're done. @@ -385,7 +406,8 @@ namespace detail break; // Start a new asynchronous read operation to obtain more data. - stream_.async_read_some(streambuf_.prepare(bytes_to_read), *this); + stream_.async_read_some(streambuf_.prepare(bytes_to_read), + BOOST_ASIO_MOVE_CAST(read_until_delim_op)(*this)); return; default: streambuf_.commit(bytes_transferred); if (ec || bytes_transferred == 0) @@ -432,6 +454,16 @@ namespace detail template <typename Function, typename AsyncReadStream, typename Allocator, typename ReadHandler> + inline void asio_handler_invoke(Function& function, + read_until_delim_op<AsyncReadStream, + Allocator, ReadHandler>* this_handler) + { + boost_asio_handler_invoke_helpers::invoke( + function, this_handler->handler_); + } + + template <typename Function, typename AsyncReadStream, typename Allocator, + typename ReadHandler> inline void asio_handler_invoke(const Function& function, read_until_delim_op<AsyncReadStream, Allocator, ReadHandler>* this_handler) @@ -439,16 +471,30 @@ namespace detail boost_asio_handler_invoke_helpers::invoke( function, this_handler->handler_); } + + template <typename AsyncReadStream, typename Allocator, typename ReadHandler> + inline read_until_delim_op<AsyncReadStream, Allocator, ReadHandler> + make_read_until_delim_op(AsyncReadStream& s, + boost::asio::basic_streambuf<Allocator>& b, + char delim, ReadHandler handler) + { + return read_until_delim_op<AsyncReadStream, Allocator, ReadHandler>( + s, b, delim, handler); + } } // namespace detail template <typename AsyncReadStream, typename Allocator, typename ReadHandler> void async_read_until(AsyncReadStream& s, - boost::asio::basic_streambuf<Allocator>& b, char delim, ReadHandler handler) + boost::asio::basic_streambuf<Allocator>& b, char delim, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { - detail::read_until_delim_op< - AsyncReadStream, Allocator, ReadHandler>( - s, b, delim, handler)( - boost::system::error_code(), 0, 1); + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a ReadHandler. + BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; + + detail::make_read_until_delim_op( + s, b, delim, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))( + boost::system::error_code(), 0, 1); } namespace detail @@ -459,15 +505,35 @@ namespace detail public: read_until_delim_string_op(AsyncReadStream& stream, boost::asio::basic_streambuf<Allocator>& streambuf, - const std::string& delim, ReadHandler handler) + const std::string& delim, ReadHandler& handler) : stream_(stream), streambuf_(streambuf), delim_(delim), search_position_(0), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)) { } +#if defined(BOOST_ASIO_HAS_MOVE) + read_until_delim_string_op(const read_until_delim_string_op& other) + : stream_(other.stream_), + streambuf_(other.streambuf_), + delim_(other.delim_), + search_position_(other.search_position_), + handler_(other.handler_) + { + } + + read_until_delim_string_op(read_until_delim_string_op&& other) + : stream_(other.stream_), + streambuf_(other.streambuf_), + delim_(BOOST_ASIO_MOVE_CAST(std::string)(other.delim_)), + search_position_(other.search_position_), + handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_)) + { + } +#endif // defined(BOOST_ASIO_HAS_MOVE) + void operator()(const boost::system::error_code& ec, std::size_t bytes_transferred, int start = 0) { @@ -485,12 +551,12 @@ namespace detail typedef boost::asio::buffers_iterator<const_buffers_type> iterator; const_buffers_type buffers = streambuf_.data(); iterator begin = iterator::begin(buffers); - iterator start = begin + search_position_; + iterator start_pos = begin + search_position_; iterator end = iterator::end(buffers); // Look for a match. std::pair<iterator, bool> result = detail::partial_search( - start, end, delim_.begin(), delim_.end()); + start_pos, end, delim_.begin(), delim_.end()); if (result.first != end && result.second) { // Full match. We're done. @@ -529,7 +595,8 @@ namespace detail break; // Start a new asynchronous read operation to obtain more data. - stream_.async_read_some(streambuf_.prepare(bytes_to_read), *this); + stream_.async_read_some(streambuf_.prepare(bytes_to_read), + BOOST_ASIO_MOVE_CAST(read_until_delim_string_op)(*this)); return; default: streambuf_.commit(bytes_transferred); if (ec || bytes_transferred == 0) @@ -576,6 +643,16 @@ namespace detail template <typename Function, typename AsyncReadStream, typename Allocator, typename ReadHandler> + inline void asio_handler_invoke(Function& function, + read_until_delim_string_op<AsyncReadStream, + Allocator, ReadHandler>* this_handler) + { + boost_asio_handler_invoke_helpers::invoke( + function, this_handler->handler_); + } + + template <typename Function, typename AsyncReadStream, + typename Allocator, typename ReadHandler> inline void asio_handler_invoke(const Function& function, read_until_delim_string_op<AsyncReadStream, Allocator, ReadHandler>* this_handler) @@ -583,17 +660,30 @@ namespace detail boost_asio_handler_invoke_helpers::invoke( function, this_handler->handler_); } + + template <typename AsyncReadStream, typename Allocator, typename ReadHandler> + inline read_until_delim_string_op<AsyncReadStream, Allocator, ReadHandler> + make_read_until_delim_string_op(AsyncReadStream& s, + boost::asio::basic_streambuf<Allocator>& b, + const std::string& delim, ReadHandler handler) + { + return read_until_delim_string_op<AsyncReadStream, Allocator, ReadHandler>( + s, b, delim, handler); + } } // namespace detail template <typename AsyncReadStream, typename Allocator, typename ReadHandler> void async_read_until(AsyncReadStream& s, boost::asio::basic_streambuf<Allocator>& b, const std::string& delim, - ReadHandler handler) + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { - detail::read_until_delim_string_op< - AsyncReadStream, Allocator, ReadHandler>( - s, b, delim, handler)( - boost::system::error_code(), 0, 1); + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a ReadHandler. + BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; + + detail::make_read_until_delim_string_op( + s, b, delim, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))( + boost::system::error_code(), 0, 1); } namespace detail @@ -605,15 +695,35 @@ namespace detail public: read_until_expr_op(AsyncReadStream& stream, boost::asio::basic_streambuf<Allocator>& streambuf, - const boost::regex& expr, ReadHandler handler) + const boost::regex& expr, ReadHandler& handler) : stream_(stream), streambuf_(streambuf), expr_(expr), search_position_(0), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)) { } +#if defined(BOOST_ASIO_HAS_MOVE) + read_until_expr_op(const read_until_expr_op& other) + : stream_(other.stream_), + streambuf_(other.streambuf_), + expr_(other.expr_), + search_position_(other.search_position_), + handler_(other.handler_) + { + } + + read_until_expr_op(read_until_expr_op&& other) + : stream_(other.stream_), + streambuf_(other.streambuf_), + expr_(other.expr_), + search_position_(other.search_position_), + handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_)) + { + } +#endif // defined(BOOST_ASIO_HAS_MOVE) + void operator()(const boost::system::error_code& ec, std::size_t bytes_transferred, int start = 0) { @@ -631,14 +741,14 @@ namespace detail typedef boost::asio::buffers_iterator<const_buffers_type> iterator; const_buffers_type buffers = streambuf_.data(); iterator begin = iterator::begin(buffers); - iterator start = begin + search_position_; + iterator start_pos = begin + search_position_; iterator end = iterator::end(buffers); // Look for a match. boost::match_results<iterator, typename std::vector<boost::sub_match<iterator> >::allocator_type> match_results; - bool match = regex_search(start, end, match_results, expr_, + bool match = regex_search(start_pos, end, match_results, expr_, boost::match_default | boost::match_partial); if (match && match_results[0].matched) { @@ -678,7 +788,8 @@ namespace detail break; // Start a new asynchronous read operation to obtain more data. - stream_.async_read_some(streambuf_.prepare(bytes_to_read), *this); + stream_.async_read_some(streambuf_.prepare(bytes_to_read), + BOOST_ASIO_MOVE_CAST(read_until_expr_op)(*this)); return; default: streambuf_.commit(bytes_transferred); if (ec || bytes_transferred == 0) @@ -727,6 +838,16 @@ namespace detail template <typename Function, typename AsyncReadStream, typename Allocator, typename RegEx, typename ReadHandler> + inline void asio_handler_invoke(Function& function, + read_until_expr_op<AsyncReadStream, + Allocator, RegEx, ReadHandler>* this_handler) + { + boost_asio_handler_invoke_helpers::invoke( + function, this_handler->handler_); + } + + template <typename Function, typename AsyncReadStream, typename Allocator, + typename RegEx, typename ReadHandler> inline void asio_handler_invoke(const Function& function, read_until_expr_op<AsyncReadStream, Allocator, RegEx, ReadHandler>* this_handler) @@ -734,17 +855,31 @@ namespace detail boost_asio_handler_invoke_helpers::invoke( function, this_handler->handler_); } + + template <typename AsyncReadStream, typename Allocator, + typename RegEx, typename ReadHandler> + inline read_until_expr_op<AsyncReadStream, Allocator, RegEx, ReadHandler> + make_read_until_expr_op(AsyncReadStream& s, + boost::asio::basic_streambuf<Allocator>& b, + const RegEx& expr, ReadHandler handler) + { + return read_until_expr_op<AsyncReadStream, Allocator, RegEx, ReadHandler>( + s, b, expr, handler); + } } // namespace detail template <typename AsyncReadStream, typename Allocator, typename ReadHandler> void async_read_until(AsyncReadStream& s, boost::asio::basic_streambuf<Allocator>& b, const boost::regex& expr, - ReadHandler handler) + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { - detail::read_until_expr_op<AsyncReadStream, - Allocator, boost::regex, ReadHandler>( - s, b, expr, handler)( - boost::system::error_code(), 0, 1); + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a ReadHandler. + BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; + + detail::make_read_until_expr_op( + s, b, expr, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))( + boost::system::error_code(), 0, 1); } namespace detail @@ -756,15 +891,35 @@ namespace detail public: read_until_match_op(AsyncReadStream& stream, boost::asio::basic_streambuf<Allocator>& streambuf, - MatchCondition match_condition, ReadHandler handler) + MatchCondition match_condition, ReadHandler& handler) : stream_(stream), streambuf_(streambuf), match_condition_(match_condition), search_position_(0), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)) { } +#if defined(BOOST_ASIO_HAS_MOVE) + read_until_match_op(const read_until_match_op& other) + : stream_(other.stream_), + streambuf_(other.streambuf_), + match_condition_(other.match_condition_), + search_position_(other.search_position_), + handler_(other.handler_) + { + } + + read_until_match_op(read_until_match_op&& other) + : stream_(other.stream_), + streambuf_(other.streambuf_), + match_condition_(other.match_condition_), + search_position_(other.search_position_), + handler_(BOOST_ASIO_MOVE_CAST(ReadHandler)(other.handler_)) + { + } +#endif // defined(BOOST_ASIO_HAS_MOVE) + void operator()(const boost::system::error_code& ec, std::size_t bytes_transferred, int start = 0) { @@ -782,11 +937,11 @@ namespace detail typedef boost::asio::buffers_iterator<const_buffers_type> iterator; const_buffers_type buffers = streambuf_.data(); iterator begin = iterator::begin(buffers); - iterator start = begin + search_position_; + iterator start_pos = begin + search_position_; iterator end = iterator::end(buffers); // Look for a match. - std::pair<iterator, bool> result = match_condition_(start, end); + std::pair<iterator, bool> result = match_condition_(start_pos, end); if (result.second) { // Full match. We're done. @@ -825,7 +980,8 @@ namespace detail break; // Start a new asynchronous read operation to obtain more data. - stream_.async_read_some(streambuf_.prepare(bytes_to_read), *this); + stream_.async_read_some(streambuf_.prepare(bytes_to_read), + BOOST_ASIO_MOVE_CAST(read_until_match_op)(*this)); return; default: streambuf_.commit(bytes_transferred); if (ec || bytes_transferred == 0) @@ -874,6 +1030,16 @@ namespace detail template <typename Function, typename AsyncReadStream, typename Allocator, typename MatchCondition, typename ReadHandler> + inline void asio_handler_invoke(Function& function, + read_until_match_op<AsyncReadStream, + Allocator, MatchCondition, ReadHandler>* this_handler) + { + boost_asio_handler_invoke_helpers::invoke( + function, this_handler->handler_); + } + + template <typename Function, typename AsyncReadStream, typename Allocator, + typename MatchCondition, typename ReadHandler> inline void asio_handler_invoke(const Function& function, read_until_match_op<AsyncReadStream, Allocator, MatchCondition, ReadHandler>* this_handler) @@ -881,19 +1047,35 @@ namespace detail boost_asio_handler_invoke_helpers::invoke( function, this_handler->handler_); } + + template <typename AsyncReadStream, typename Allocator, + typename MatchCondition, typename ReadHandler> + inline read_until_match_op<AsyncReadStream, Allocator, + MatchCondition, ReadHandler> + make_read_until_match_op(AsyncReadStream& s, + boost::asio::basic_streambuf<Allocator>& b, + MatchCondition match_condition, ReadHandler handler) + { + return read_until_match_op<AsyncReadStream, + Allocator, MatchCondition, ReadHandler>( + s, b, match_condition, handler); + } } // namespace detail template <typename AsyncReadStream, typename Allocator, typename MatchCondition, typename ReadHandler> void async_read_until(AsyncReadStream& s, boost::asio::basic_streambuf<Allocator>& b, - MatchCondition match_condition, ReadHandler handler, + MatchCondition match_condition, BOOST_ASIO_MOVE_ARG(ReadHandler) handler, typename boost::enable_if<is_match_condition<MatchCondition> >::type*) { - detail::read_until_match_op< - AsyncReadStream, Allocator, MatchCondition, ReadHandler>( - s, b, match_condition, handler)( - boost::system::error_code(), 0, 1); + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a ReadHandler. + BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; + + detail::make_read_until_match_op( + s, b, match_condition, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler))( + boost::system::error_code(), 0, 1); } } // namespace asio diff --git a/3rdParty/Boost/src/boost/asio/impl/serial_port_base.hpp b/3rdParty/Boost/src/boost/asio/impl/serial_port_base.hpp index c75f8c2..3066045 100644 --- a/3rdParty/Boost/src/boost/asio/impl/serial_port_base.hpp +++ b/3rdParty/Boost/src/boost/asio/impl/serial_port_base.hpp @@ -2,7 +2,7 @@ // impl/serial_port_base.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) // Copyright (c) 2008 Rep Invariant Systems, Inc. (info@repinvariant.com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying diff --git a/3rdParty/Boost/src/boost/asio/impl/serial_port_base.ipp b/3rdParty/Boost/src/boost/asio/impl/serial_port_base.ipp index c665ac8..0344fa5 100644 --- a/3rdParty/Boost/src/boost/asio/impl/serial_port_base.ipp +++ b/3rdParty/Boost/src/boost/asio/impl/serial_port_base.ipp @@ -2,7 +2,7 @@ // impl/serial_port_base.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) // Copyright (c) 2008 Rep Invariant Systems, Inc. (info@repinvariant.com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying diff --git a/3rdParty/Boost/src/boost/asio/impl/write.hpp b/3rdParty/Boost/src/boost/asio/impl/write.hpp index ae420bc..61422e4 100644 --- a/3rdParty/Boost/src/boost/asio/impl/write.hpp +++ b/3rdParty/Boost/src/boost/asio/impl/write.hpp @@ -2,7 +2,7 @@ // impl/write.hpp // ~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -17,11 +17,14 @@ #include <boost/asio/buffer.hpp> #include <boost/asio/completion_condition.hpp> +#include <boost/asio/detail/array_fwd.hpp> #include <boost/asio/detail/base_from_completion_cond.hpp> #include <boost/asio/detail/bind_handler.hpp> #include <boost/asio/detail/consuming_buffers.hpp> +#include <boost/asio/detail/dependent_type.hpp> #include <boost/asio/detail/handler_alloc_helpers.hpp> #include <boost/asio/detail/handler_invoke_helpers.hpp> +#include <boost/asio/detail/handler_type_requirements.hpp> #include <boost/asio/detail/throw_error.hpp> #include <boost/asio/detail/push_options.hpp> @@ -56,10 +59,17 @@ inline std::size_t write(SyncWriteStream& s, const ConstBufferSequence& buffers) { boost::system::error_code ec; std::size_t bytes_transferred = write(s, buffers, transfer_all(), ec); - boost::asio::detail::throw_error(ec); + boost::asio::detail::throw_error(ec, "write"); return bytes_transferred; } +template <typename SyncWriteStream, typename ConstBufferSequence> +inline std::size_t write(SyncWriteStream& s, const ConstBufferSequence& buffers, + boost::system::error_code& ec) +{ + return write(s, buffers, transfer_all(), ec); +} + template <typename SyncWriteStream, typename ConstBufferSequence, typename CompletionCondition> inline std::size_t write(SyncWriteStream& s, const ConstBufferSequence& buffers, @@ -67,7 +77,7 @@ inline std::size_t write(SyncWriteStream& s, const ConstBufferSequence& buffers, { boost::system::error_code ec; std::size_t bytes_transferred = write(s, buffers, completion_condition, ec); - boost::asio::detail::throw_error(ec); + boost::asio::detail::throw_error(ec, "write"); return bytes_transferred; } @@ -90,10 +100,18 @@ inline std::size_t write(SyncWriteStream& s, { boost::system::error_code ec; std::size_t bytes_transferred = write(s, b, transfer_all(), ec); - boost::asio::detail::throw_error(ec); + boost::asio::detail::throw_error(ec, "write"); return bytes_transferred; } +template <typename SyncWriteStream, typename Allocator> +inline std::size_t write(SyncWriteStream& s, + boost::asio::basic_streambuf<Allocator>& b, + boost::system::error_code& ec) +{ + return write(s, b, transfer_all(), ec); +} + template <typename SyncWriteStream, typename Allocator, typename CompletionCondition> inline std::size_t write(SyncWriteStream& s, @@ -102,7 +120,7 @@ inline std::size_t write(SyncWriteStream& s, { boost::system::error_code ec; std::size_t bytes_transferred = write(s, b, completion_condition, ec); - boost::asio::detail::throw_error(ec); + boost::asio::detail::throw_error(ec, "write"); return bytes_transferred; } @@ -117,16 +135,36 @@ namespace detail { public: write_op(AsyncWriteStream& stream, const ConstBufferSequence& buffers, - CompletionCondition completion_condition, WriteHandler handler) + CompletionCondition completion_condition, WriteHandler& handler) : detail::base_from_completion_cond< CompletionCondition>(completion_condition), stream_(stream), buffers_(buffers), total_transferred_(0), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)) { } +#if defined(BOOST_ASIO_HAS_MOVE) + write_op(const write_op& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + stream_(other.stream_), + buffers_(other.buffers_), + total_transferred_(other.total_transferred_), + handler_(other.handler_) + { + } + + write_op(write_op&& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + stream_(other.stream_), + buffers_(other.buffers_), + total_transferred_(other.total_transferred_), + handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(other.handler_)) + { + } +#endif // defined(BOOST_ASIO_HAS_MOVE) + void operator()(const boost::system::error_code& ec, std::size_t bytes_transferred, int start = 0) { @@ -136,7 +174,8 @@ namespace detail buffers_.prepare(this->check_for_completion(ec, total_transferred_)); for (;;) { - stream_.async_write_some(buffers_, *this); + stream_.async_write_some(buffers_, + BOOST_ASIO_MOVE_CAST(write_op)(*this)); return; default: total_transferred_ += bytes_transferred; buffers_.consume(bytes_transferred); @@ -168,16 +207,36 @@ namespace detail write_op(AsyncWriteStream& stream, const boost::asio::mutable_buffers_1& buffers, CompletionCondition completion_condition, - WriteHandler handler) + WriteHandler& handler) : detail::base_from_completion_cond< CompletionCondition>(completion_condition), stream_(stream), buffer_(buffers), total_transferred_(0), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)) { } +#if defined(BOOST_ASIO_HAS_MOVE) + write_op(const write_op& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + stream_(other.stream_), + buffer_(other.buffer_), + total_transferred_(other.total_transferred_), + handler_(other.handler_) + { + } + + write_op(write_op&& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + stream_(other.stream_), + buffer_(other.buffer_), + total_transferred_(other.total_transferred_), + handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(other.handler_)) + { + } +#endif // defined(BOOST_ASIO_HAS_MOVE) + void operator()(const boost::system::error_code& ec, std::size_t bytes_transferred, int start = 0) { @@ -188,8 +247,9 @@ namespace detail n = this->check_for_completion(ec, total_transferred_); for (;;) { - stream_.async_write_some(boost::asio::buffer( - buffer_ + total_transferred_, n), *this); + stream_.async_write_some( + boost::asio::buffer(buffer_ + total_transferred_, n), + BOOST_ASIO_MOVE_CAST(write_op)(*this)); return; default: total_transferred_ += bytes_transferred; if ((!ec && bytes_transferred == 0) @@ -219,16 +279,36 @@ namespace detail write_op(AsyncWriteStream& stream, const boost::asio::const_buffers_1& buffers, CompletionCondition completion_condition, - WriteHandler handler) + WriteHandler& handler) : detail::base_from_completion_cond< CompletionCondition>(completion_condition), stream_(stream), buffer_(buffers), total_transferred_(0), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)) + { + } + +#if defined(BOOST_ASIO_HAS_MOVE) + write_op(const write_op& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + stream_(other.stream_), + buffer_(other.buffer_), + total_transferred_(other.total_transferred_), + handler_(other.handler_) { } + write_op(write_op&& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + stream_(other.stream_), + buffer_(other.buffer_), + total_transferred_(other.total_transferred_), + handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(other.handler_)) + { + } +#endif // defined(BOOST_ASIO_HAS_MOVE) + void operator()(const boost::system::error_code& ec, std::size_t bytes_transferred, int start = 0) { @@ -239,8 +319,9 @@ namespace detail n = this->check_for_completion(ec, total_transferred_); for (;;) { - stream_.async_write_some(boost::asio::buffer( - buffer_ + total_transferred_, n), *this); + stream_.async_write_some( + boost::asio::buffer(buffer_ + total_transferred_, n), + BOOST_ASIO_MOVE_CAST(write_op)(*this)); return; default: total_transferred_ += bytes_transferred; if ((!ec && bytes_transferred == 0) @@ -260,6 +341,168 @@ namespace detail WriteHandler handler_; }; + template <typename AsyncWriteStream, typename Elem, + typename CompletionCondition, typename WriteHandler> + class write_op<AsyncWriteStream, boost::array<Elem, 2>, + CompletionCondition, WriteHandler> + : detail::base_from_completion_cond<CompletionCondition> + { + public: + write_op(AsyncWriteStream& stream, const boost::array<Elem, 2>& buffers, + CompletionCondition completion_condition, WriteHandler& handler) + : detail::base_from_completion_cond< + CompletionCondition>(completion_condition), + stream_(stream), + buffers_(buffers), + total_transferred_(0), + handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)) + { + } + +#if defined(BOOST_ASIO_HAS_MOVE) + write_op(const write_op& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + stream_(other.stream_), + buffers_(other.buffers_), + total_transferred_(other.total_transferred_), + handler_(other.handler_) + { + } + + write_op(write_op&& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + stream_(other.stream_), + buffers_(other.buffers_), + total_transferred_(other.total_transferred_), + handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(other.handler_)) + { + } +#endif // defined(BOOST_ASIO_HAS_MOVE) + + void operator()(const boost::system::error_code& ec, + std::size_t bytes_transferred, int start = 0) + { + typename boost::asio::detail::dependent_type<Elem, + boost::array<boost::asio::const_buffer, 2> >::type bufs = {{ + boost::asio::const_buffer(buffers_[0]), + boost::asio::const_buffer(buffers_[1]) }}; + std::size_t buffer_size0 = boost::asio::buffer_size(bufs[0]); + std::size_t buffer_size1 = boost::asio::buffer_size(bufs[1]); + std::size_t n = 0; + switch (start) + { + case 1: + n = this->check_for_completion(ec, total_transferred_); + for (;;) + { + bufs[0] = boost::asio::buffer(bufs[0] + total_transferred_, n); + bufs[1] = boost::asio::buffer( + bufs[1] + (total_transferred_ < buffer_size0 + ? 0 : total_transferred_ - buffer_size0), + n - boost::asio::buffer_size(bufs[0])); + stream_.async_write_some(bufs, BOOST_ASIO_MOVE_CAST(write_op)(*this)); + return; default: + total_transferred_ += bytes_transferred; + if ((!ec && bytes_transferred == 0) + || (n = this->check_for_completion(ec, total_transferred_)) == 0 + || total_transferred_ == buffer_size0 + buffer_size1) + break; + } + + handler_(ec, static_cast<const std::size_t&>(total_transferred_)); + } + } + + //private: + AsyncWriteStream& stream_; + boost::array<Elem, 2> buffers_; + std::size_t total_transferred_; + WriteHandler handler_; + }; + +#if defined(BOOST_ASIO_HAS_STD_ARRAY) + + template <typename AsyncWriteStream, typename Elem, + typename CompletionCondition, typename WriteHandler> + class write_op<AsyncWriteStream, std::array<Elem, 2>, + CompletionCondition, WriteHandler> + : detail::base_from_completion_cond<CompletionCondition> + { + public: + write_op(AsyncWriteStream& stream, const std::array<Elem, 2>& buffers, + CompletionCondition completion_condition, WriteHandler& handler) + : detail::base_from_completion_cond< + CompletionCondition>(completion_condition), + stream_(stream), + buffers_(buffers), + total_transferred_(0), + handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)) + { + } + +#if defined(BOOST_ASIO_HAS_MOVE) + write_op(const write_op& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + stream_(other.stream_), + buffers_(other.buffers_), + total_transferred_(other.total_transferred_), + handler_(other.handler_) + { + } + + write_op(write_op&& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + stream_(other.stream_), + buffers_(other.buffers_), + total_transferred_(other.total_transferred_), + handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(other.handler_)) + { + } +#endif // defined(BOOST_ASIO_HAS_MOVE) + + void operator()(const boost::system::error_code& ec, + std::size_t bytes_transferred, int start = 0) + { + typename boost::asio::detail::dependent_type<Elem, + std::array<boost::asio::const_buffer, 2> >::type bufs = {{ + boost::asio::const_buffer(buffers_[0]), + boost::asio::const_buffer(buffers_[1]) }}; + std::size_t buffer_size0 = boost::asio::buffer_size(bufs[0]); + std::size_t buffer_size1 = boost::asio::buffer_size(bufs[1]); + std::size_t n = 0; + switch (start) + { + case 1: + n = this->check_for_completion(ec, total_transferred_); + for (;;) + { + bufs[0] = boost::asio::buffer(bufs[0] + total_transferred_, n); + bufs[1] = boost::asio::buffer( + bufs[1] + (total_transferred_ < buffer_size0 + ? 0 : total_transferred_ - buffer_size0), + n - boost::asio::buffer_size(bufs[0])); + stream_.async_write_some(bufs, BOOST_ASIO_MOVE_CAST(write_op)(*this)); + return; default: + total_transferred_ += bytes_transferred; + if ((!ec && bytes_transferred == 0) + || (n = this->check_for_completion(ec, total_transferred_)) == 0 + || total_transferred_ == buffer_size0 + buffer_size1) + break; + } + + handler_(ec, static_cast<const std::size_t&>(total_transferred_)); + } + } + + //private: + AsyncWriteStream& stream_; + std::array<Elem, 2> buffers_; + std::size_t total_transferred_; + WriteHandler handler_; + }; + +#endif // defined(BOOST_ASIO_HAS_STD_ARRAY) + template <typename AsyncWriteStream, typename ConstBufferSequence, typename CompletionCondition, typename WriteHandler> inline void* asio_handler_allocate(std::size_t size, @@ -283,6 +526,17 @@ namespace detail template <typename Function, typename AsyncWriteStream, typename ConstBufferSequence, typename CompletionCondition, typename WriteHandler> + inline void asio_handler_invoke(Function& function, + write_op<AsyncWriteStream, ConstBufferSequence, + CompletionCondition, WriteHandler>* this_handler) + { + boost_asio_handler_invoke_helpers::invoke( + function, this_handler->handler_); + } + + template <typename Function, typename AsyncWriteStream, + typename ConstBufferSequence, typename CompletionCondition, + typename WriteHandler> inline void asio_handler_invoke(const Function& function, write_op<AsyncWriteStream, ConstBufferSequence, CompletionCondition, WriteHandler>* this_handler) @@ -290,43 +544,78 @@ namespace detail boost_asio_handler_invoke_helpers::invoke( function, this_handler->handler_); } + + template <typename AsyncWriteStream, typename ConstBufferSequence, + typename CompletionCondition, typename WriteHandler> + inline write_op<AsyncWriteStream, ConstBufferSequence, + CompletionCondition, WriteHandler> + make_write_op(AsyncWriteStream& s, const ConstBufferSequence& buffers, + CompletionCondition completion_condition, WriteHandler handler) + { + return write_op<AsyncWriteStream, ConstBufferSequence, CompletionCondition, + WriteHandler>(s, buffers, completion_condition, handler); + } } // namespace detail template <typename AsyncWriteStream, typename ConstBufferSequence, typename CompletionCondition, typename WriteHandler> inline void async_write(AsyncWriteStream& s, const ConstBufferSequence& buffers, - CompletionCondition completion_condition, WriteHandler handler) + CompletionCondition completion_condition, + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { - detail::write_op<AsyncWriteStream, ConstBufferSequence, - CompletionCondition, WriteHandler>( - s, buffers, completion_condition, handler)( + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a WriteHandler. + BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; + + detail::make_write_op( + s, buffers, completion_condition, + BOOST_ASIO_MOVE_CAST(WriteHandler)(handler))( boost::system::error_code(), 0, 1); } template <typename AsyncWriteStream, typename ConstBufferSequence, typename WriteHandler> inline void async_write(AsyncWriteStream& s, const ConstBufferSequence& buffers, - WriteHandler handler) + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { - async_write(s, buffers, transfer_all(), handler); + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a WriteHandler. + BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; + + detail::make_write_op( + s, buffers, transfer_all(), BOOST_ASIO_MOVE_CAST(WriteHandler)(handler))( + boost::system::error_code(), 0, 1); } #if !defined(BOOST_NO_IOSTREAM) namespace detail { - template <typename AsyncWriteStream, typename Allocator, - typename WriteHandler> + template <typename Allocator, typename WriteHandler> class write_streambuf_handler { public: write_streambuf_handler(boost::asio::basic_streambuf<Allocator>& streambuf, - WriteHandler handler) + WriteHandler& handler) : streambuf_(streambuf), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)) { } +#if defined(BOOST_ASIO_HAS_MOVE) + write_streambuf_handler(const write_streambuf_handler& other) + : streambuf_(other.streambuf_), + handler_(other.handler_) + { + } + + write_streambuf_handler(write_streambuf_handler&& other) + : streambuf_(other.streambuf_), + handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(other.handler_)) + { + } +#endif // defined(BOOST_ASIO_HAS_MOVE) + void operator()(const boost::system::error_code& ec, const std::size_t bytes_transferred) { @@ -339,53 +628,75 @@ namespace detail WriteHandler handler_; }; - template <typename AsyncWriteStream, typename Allocator, - typename WriteHandler> + template <typename Allocator, typename WriteHandler> inline void* asio_handler_allocate(std::size_t size, - write_streambuf_handler<AsyncWriteStream, - Allocator, WriteHandler>* this_handler) + write_streambuf_handler<Allocator, WriteHandler>* this_handler) { return boost_asio_handler_alloc_helpers::allocate( size, this_handler->handler_); } - template <typename AsyncWriteStream, typename Allocator, - typename WriteHandler> + template <typename Allocator, typename WriteHandler> inline void asio_handler_deallocate(void* pointer, std::size_t size, - write_streambuf_handler<AsyncWriteStream, - Allocator, WriteHandler>* this_handler) + write_streambuf_handler<Allocator, WriteHandler>* this_handler) { boost_asio_handler_alloc_helpers::deallocate( pointer, size, this_handler->handler_); } - template <typename Function, typename AsyncWriteStream, typename Allocator, - typename WriteHandler> + template <typename Function, typename Allocator, typename WriteHandler> + inline void asio_handler_invoke(Function& function, + write_streambuf_handler<Allocator, WriteHandler>* this_handler) + { + boost_asio_handler_invoke_helpers::invoke( + function, this_handler->handler_); + } + + template <typename Function, typename Allocator, typename WriteHandler> inline void asio_handler_invoke(const Function& function, - write_streambuf_handler<AsyncWriteStream, - Allocator, WriteHandler>* this_handler) + write_streambuf_handler<Allocator, WriteHandler>* this_handler) { boost_asio_handler_invoke_helpers::invoke( function, this_handler->handler_); } + + template <typename Allocator, typename WriteHandler> + inline write_streambuf_handler<Allocator, WriteHandler> + make_write_streambuf_handler( + boost::asio::basic_streambuf<Allocator>& b, WriteHandler handler) + { + return write_streambuf_handler<Allocator, WriteHandler>(b, handler); + } } // namespace detail template <typename AsyncWriteStream, typename Allocator, typename CompletionCondition, typename WriteHandler> inline void async_write(AsyncWriteStream& s, boost::asio::basic_streambuf<Allocator>& b, - CompletionCondition completion_condition, WriteHandler handler) + CompletionCondition completion_condition, + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a WriteHandler. + BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; + async_write(s, b.data(), completion_condition, - detail::write_streambuf_handler< - AsyncWriteStream, Allocator, WriteHandler>(b, handler)); + detail::make_write_streambuf_handler( + b, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler))); } template <typename AsyncWriteStream, typename Allocator, typename WriteHandler> inline void async_write(AsyncWriteStream& s, - boost::asio::basic_streambuf<Allocator>& b, WriteHandler handler) + boost::asio::basic_streambuf<Allocator>& b, + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { - async_write(s, b, transfer_all(), handler); + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a WriteHandler. + BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; + + async_write(s, b.data(), transfer_all(), + detail::make_write_streambuf_handler( + b, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler))); } #endif // !defined(BOOST_NO_IOSTREAM) diff --git a/3rdParty/Boost/src/boost/asio/impl/write_at.hpp b/3rdParty/Boost/src/boost/asio/impl/write_at.hpp index 39dc1af..acba02f 100644 --- a/3rdParty/Boost/src/boost/asio/impl/write_at.hpp +++ b/3rdParty/Boost/src/boost/asio/impl/write_at.hpp @@ -2,7 +2,7 @@ // impl/write_at.hpp // ~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -17,11 +17,14 @@ #include <boost/asio/buffer.hpp> #include <boost/asio/completion_condition.hpp> +#include <boost/asio/detail/array_fwd.hpp> #include <boost/asio/detail/base_from_completion_cond.hpp> #include <boost/asio/detail/bind_handler.hpp> #include <boost/asio/detail/consuming_buffers.hpp> +#include <boost/asio/detail/dependent_type.hpp> #include <boost/asio/detail/handler_alloc_helpers.hpp> #include <boost/asio/detail/handler_invoke_helpers.hpp> +#include <boost/asio/detail/handler_type_requirements.hpp> #include <boost/asio/detail/throw_error.hpp> #include <boost/asio/detail/push_options.hpp> @@ -60,10 +63,18 @@ inline std::size_t write_at(SyncRandomAccessWriteDevice& d, boost::system::error_code ec; std::size_t bytes_transferred = write_at( d, offset, buffers, transfer_all(), ec); - boost::asio::detail::throw_error(ec); + boost::asio::detail::throw_error(ec, "write_at"); return bytes_transferred; } +template <typename SyncRandomAccessWriteDevice, typename ConstBufferSequence> +inline std::size_t write_at(SyncRandomAccessWriteDevice& d, + boost::uint64_t offset, const ConstBufferSequence& buffers, + boost::system::error_code& ec) +{ + return write_at(d, offset, buffers, transfer_all(), ec); +} + template <typename SyncRandomAccessWriteDevice, typename ConstBufferSequence, typename CompletionCondition> inline std::size_t write_at(SyncRandomAccessWriteDevice& d, @@ -73,7 +84,7 @@ inline std::size_t write_at(SyncRandomAccessWriteDevice& d, boost::system::error_code ec; std::size_t bytes_transferred = write_at( d, offset, buffers, completion_condition, ec); - boost::asio::detail::throw_error(ec); + boost::asio::detail::throw_error(ec, "write_at"); return bytes_transferred; } @@ -97,10 +108,18 @@ inline std::size_t write_at(SyncRandomAccessWriteDevice& d, { boost::system::error_code ec; std::size_t bytes_transferred = write_at(d, offset, b, transfer_all(), ec); - boost::asio::detail::throw_error(ec); + boost::asio::detail::throw_error(ec, "write_at"); return bytes_transferred; } +template <typename SyncRandomAccessWriteDevice, typename Allocator> +inline std::size_t write_at(SyncRandomAccessWriteDevice& d, + boost::uint64_t offset, boost::asio::basic_streambuf<Allocator>& b, + boost::system::error_code& ec) +{ + return write_at(d, offset, b, transfer_all(), ec); +} + template <typename SyncRandomAccessWriteDevice, typename Allocator, typename CompletionCondition> inline std::size_t write_at(SyncRandomAccessWriteDevice& d, @@ -110,7 +129,7 @@ inline std::size_t write_at(SyncRandomAccessWriteDevice& d, boost::system::error_code ec; std::size_t bytes_transferred = write_at( d, offset, b, completion_condition, ec); - boost::asio::detail::throw_error(ec); + boost::asio::detail::throw_error(ec, "write_at"); return bytes_transferred; } @@ -126,17 +145,39 @@ namespace detail public: write_at_op(AsyncRandomAccessWriteDevice& device, boost::uint64_t offset, const ConstBufferSequence& buffers, - CompletionCondition completion_condition, WriteHandler handler) + CompletionCondition completion_condition, WriteHandler& handler) : detail::base_from_completion_cond< CompletionCondition>(completion_condition), device_(device), offset_(offset), buffers_(buffers), total_transferred_(0), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)) + { + } + +#if defined(BOOST_ASIO_HAS_MOVE) + write_at_op(const write_at_op& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + device_(other.device_), + offset_(other.offset_), + buffers_(other.buffers_), + total_transferred_(other.total_transferred_), + handler_(other.handler_) { } + write_at_op(write_at_op&& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + device_(other.device_), + offset_(other.offset_), + buffers_(other.buffers_), + total_transferred_(other.total_transferred_), + handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(other.handler_)) + { + } +#endif // defined(BOOST_ASIO_HAS_MOVE) + void operator()(const boost::system::error_code& ec, std::size_t bytes_transferred, int start = 0) { @@ -147,7 +188,8 @@ namespace detail for (;;) { device_.async_write_some_at( - offset_ + total_transferred_, buffers_, *this); + offset_ + total_transferred_, buffers_, + BOOST_ASIO_MOVE_CAST(write_at_op)(*this)); return; default: total_transferred_ += bytes_transferred; buffers_.consume(bytes_transferred); @@ -180,17 +222,39 @@ namespace detail write_at_op(AsyncRandomAccessWriteDevice& device, boost::uint64_t offset, const boost::asio::mutable_buffers_1& buffers, CompletionCondition completion_condition, - WriteHandler handler) + WriteHandler& handler) : detail::base_from_completion_cond< CompletionCondition>(completion_condition), device_(device), offset_(offset), buffer_(buffers), total_transferred_(0), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)) { } +#if defined(BOOST_ASIO_HAS_MOVE) + write_at_op(const write_at_op& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + device_(other.device_), + offset_(other.offset_), + buffer_(other.buffer_), + total_transferred_(other.total_transferred_), + handler_(other.handler_) + { + } + + write_at_op(write_at_op&& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + device_(other.device_), + offset_(other.offset_), + buffer_(other.buffer_), + total_transferred_(other.total_transferred_), + handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(other.handler_)) + { + } +#endif // defined(BOOST_ASIO_HAS_MOVE) + void operator()(const boost::system::error_code& ec, std::size_t bytes_transferred, int start = 0) { @@ -202,7 +266,8 @@ namespace detail for (;;) { device_.async_write_some_at(offset_ + total_transferred_, - boost::asio::buffer(buffer_ + total_transferred_, n), *this); + boost::asio::buffer(buffer_ + total_transferred_, n), + BOOST_ASIO_MOVE_CAST(write_at_op)(*this)); return; default: total_transferred_ += bytes_transferred; if ((!ec && bytes_transferred == 0) @@ -233,17 +298,39 @@ namespace detail write_at_op(AsyncRandomAccessWriteDevice& device, boost::uint64_t offset, const boost::asio::const_buffers_1& buffers, CompletionCondition completion_condition, - WriteHandler handler) + WriteHandler& handler) : detail::base_from_completion_cond< CompletionCondition>(completion_condition), device_(device), offset_(offset), buffer_(buffers), total_transferred_(0), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)) + { + } + +#if defined(BOOST_ASIO_HAS_MOVE) + write_at_op(const write_at_op& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + device_(other.device_), + offset_(other.offset_), + buffer_(other.buffer_), + total_transferred_(other.total_transferred_), + handler_(other.handler_) { } + write_at_op(write_at_op&& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + device_(other.device_), + offset_(other.offset_), + buffer_(other.buffer_), + total_transferred_(other.total_transferred_), + handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(other.handler_)) + { + } +#endif // defined(BOOST_ASIO_HAS_MOVE) + void operator()(const boost::system::error_code& ec, std::size_t bytes_transferred, int start = 0) { @@ -255,7 +342,8 @@ namespace detail for (;;) { device_.async_write_some_at(offset_ + total_transferred_, - boost::asio::buffer(buffer_ + total_transferred_, n), *this); + boost::asio::buffer(buffer_ + total_transferred_, n), + BOOST_ASIO_MOVE_CAST(write_at_op)(*this)); return; default: total_transferred_ += bytes_transferred; if ((!ec && bytes_transferred == 0) @@ -276,6 +364,180 @@ namespace detail WriteHandler handler_; }; + template <typename AsyncRandomAccessWriteDevice, typename Elem, + typename CompletionCondition, typename WriteHandler> + class write_at_op<AsyncRandomAccessWriteDevice, boost::array<Elem, 2>, + CompletionCondition, WriteHandler> + : detail::base_from_completion_cond<CompletionCondition> + { + public: + write_at_op(AsyncRandomAccessWriteDevice& device, + boost::uint64_t offset, const boost::array<Elem, 2>& buffers, + CompletionCondition completion_condition, WriteHandler& handler) + : detail::base_from_completion_cond< + CompletionCondition>(completion_condition), + device_(device), + offset_(offset), + buffers_(buffers), + total_transferred_(0), + handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)) + { + } + +#if defined(BOOST_ASIO_HAS_MOVE) + write_at_op(const write_at_op& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + device_(other.device_), + offset_(other.offset_), + buffers_(other.buffers_), + total_transferred_(other.total_transferred_), + handler_(other.handler_) + { + } + + write_at_op(write_at_op&& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + device_(other.device_), + offset_(other.offset_), + buffers_(other.buffers_), + total_transferred_(other.total_transferred_), + handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(other.handler_)) + { + } +#endif // defined(BOOST_ASIO_HAS_MOVE) + + void operator()(const boost::system::error_code& ec, + std::size_t bytes_transferred, int start = 0) + { + typename boost::asio::detail::dependent_type<Elem, + boost::array<boost::asio::const_buffer, 2> >::type bufs = {{ + boost::asio::const_buffer(buffers_[0]), + boost::asio::const_buffer(buffers_[1]) }}; + std::size_t buffer_size0 = boost::asio::buffer_size(bufs[0]); + std::size_t buffer_size1 = boost::asio::buffer_size(bufs[1]); + std::size_t n = 0; + switch (start) + { + case 1: + n = this->check_for_completion(ec, total_transferred_); + for (;;) + { + bufs[0] = boost::asio::buffer(bufs[0] + total_transferred_, n); + bufs[1] = boost::asio::buffer( + bufs[1] + (total_transferred_ < buffer_size0 + ? 0 : total_transferred_ - buffer_size0), + n - boost::asio::buffer_size(bufs[0])); + device_.async_write_some_at(offset_ + total_transferred_, + bufs, BOOST_ASIO_MOVE_CAST(write_at_op)(*this)); + return; default: + total_transferred_ += bytes_transferred; + if ((!ec && bytes_transferred == 0) + || (n = this->check_for_completion(ec, total_transferred_)) == 0 + || total_transferred_ == buffer_size0 + buffer_size1) + break; + } + + handler_(ec, static_cast<const std::size_t&>(total_transferred_)); + } + } + + //private: + AsyncRandomAccessWriteDevice& device_; + boost::uint64_t offset_; + boost::array<Elem, 2> buffers_; + std::size_t total_transferred_; + WriteHandler handler_; + }; + +#if defined(BOOST_ASIO_HAS_STD_ARRAY) + + template <typename AsyncRandomAccessWriteDevice, typename Elem, + typename CompletionCondition, typename WriteHandler> + class write_at_op<AsyncRandomAccessWriteDevice, std::array<Elem, 2>, + CompletionCondition, WriteHandler> + : detail::base_from_completion_cond<CompletionCondition> + { + public: + write_at_op(AsyncRandomAccessWriteDevice& device, + boost::uint64_t offset, const std::array<Elem, 2>& buffers, + CompletionCondition completion_condition, WriteHandler& handler) + : detail::base_from_completion_cond< + CompletionCondition>(completion_condition), + device_(device), + offset_(offset), + buffers_(buffers), + total_transferred_(0), + handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)) + { + } + +#if defined(BOOST_ASIO_HAS_MOVE) + write_at_op(const write_at_op& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + device_(other.device_), + offset_(other.offset_), + buffers_(other.buffers_), + total_transferred_(other.total_transferred_), + handler_(other.handler_) + { + } + + write_at_op(write_at_op&& other) + : detail::base_from_completion_cond<CompletionCondition>(other), + device_(other.device_), + offset_(other.offset_), + buffers_(other.buffers_), + total_transferred_(other.total_transferred_), + handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(other.handler_)) + { + } +#endif // defined(BOOST_ASIO_HAS_MOVE) + + void operator()(const boost::system::error_code& ec, + std::size_t bytes_transferred, int start = 0) + { + typename boost::asio::detail::dependent_type<Elem, + std::array<boost::asio::const_buffer, 2> >::type bufs = {{ + boost::asio::const_buffer(buffers_[0]), + boost::asio::const_buffer(buffers_[1]) }}; + std::size_t buffer_size0 = boost::asio::buffer_size(bufs[0]); + std::size_t buffer_size1 = boost::asio::buffer_size(bufs[1]); + std::size_t n = 0; + switch (start) + { + case 1: + n = this->check_for_completion(ec, total_transferred_); + for (;;) + { + bufs[0] = boost::asio::buffer(bufs[0] + total_transferred_, n); + bufs[1] = boost::asio::buffer( + bufs[1] + (total_transferred_ < buffer_size0 + ? 0 : total_transferred_ - buffer_size0), + n - boost::asio::buffer_size(bufs[0])); + device_.async_write_some_at(offset_ + total_transferred_, + bufs, BOOST_ASIO_MOVE_CAST(write_at_op)(*this)); + return; default: + total_transferred_ += bytes_transferred; + if ((!ec && bytes_transferred == 0) + || (n = this->check_for_completion(ec, total_transferred_)) == 0 + || total_transferred_ == buffer_size0 + buffer_size1) + break; + } + + handler_(ec, static_cast<const std::size_t&>(total_transferred_)); + } + } + + //private: + AsyncRandomAccessWriteDevice& device_; + boost::uint64_t offset_; + std::array<Elem, 2> buffers_; + std::size_t total_transferred_; + WriteHandler handler_; + }; + +#endif // defined(BOOST_ASIO_HAS_STD_ARRAY) + template <typename AsyncRandomAccessWriteDevice, typename ConstBufferSequence, typename CompletionCondition, typename WriteHandler> inline void* asio_handler_allocate(std::size_t size, @@ -299,6 +561,17 @@ namespace detail template <typename Function, typename AsyncRandomAccessWriteDevice, typename ConstBufferSequence, typename CompletionCondition, typename WriteHandler> + inline void asio_handler_invoke(Function& function, + write_at_op<AsyncRandomAccessWriteDevice, ConstBufferSequence, + CompletionCondition, WriteHandler>* this_handler) + { + boost_asio_handler_invoke_helpers::invoke( + function, this_handler->handler_); + } + + template <typename Function, typename AsyncRandomAccessWriteDevice, + typename ConstBufferSequence, typename CompletionCondition, + typename WriteHandler> inline void asio_handler_invoke(const Function& function, write_at_op<AsyncRandomAccessWriteDevice, ConstBufferSequence, CompletionCondition, WriteHandler>* this_handler) @@ -306,17 +579,35 @@ namespace detail boost_asio_handler_invoke_helpers::invoke( function, this_handler->handler_); } + + template <typename AsyncRandomAccessWriteDevice, typename ConstBufferSequence, + typename CompletionCondition, typename WriteHandler> + inline write_at_op<AsyncRandomAccessWriteDevice, + ConstBufferSequence, CompletionCondition, WriteHandler> + make_write_at_op(AsyncRandomAccessWriteDevice& d, + boost::uint64_t offset, const ConstBufferSequence& buffers, + CompletionCondition completion_condition, WriteHandler handler) + { + return write_at_op<AsyncRandomAccessWriteDevice, + ConstBufferSequence, CompletionCondition, WriteHandler>( + d, offset, buffers, completion_condition, handler); + } } // namespace detail template <typename AsyncRandomAccessWriteDevice, typename ConstBufferSequence, typename CompletionCondition, typename WriteHandler> inline void async_write_at(AsyncRandomAccessWriteDevice& d, boost::uint64_t offset, const ConstBufferSequence& buffers, - CompletionCondition completion_condition, WriteHandler handler) + CompletionCondition completion_condition, + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { - detail::write_at_op<AsyncRandomAccessWriteDevice, - ConstBufferSequence, CompletionCondition, WriteHandler>( - d, offset, buffers, completion_condition, handler)( + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a WriteHandler. + BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; + + detail::make_write_at_op( + d, offset, buffers, completion_condition, + BOOST_ASIO_MOVE_CAST(WriteHandler)(handler))( boost::system::error_code(), 0, 1); } @@ -324,28 +615,48 @@ template <typename AsyncRandomAccessWriteDevice, typename ConstBufferSequence, typename WriteHandler> inline void async_write_at(AsyncRandomAccessWriteDevice& d, boost::uint64_t offset, const ConstBufferSequence& buffers, - WriteHandler handler) + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { - async_write_at(d, offset, buffers, transfer_all(), handler); + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a WriteHandler. + BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; + + detail::make_write_at_op( + d, offset, buffers, transfer_all(), + BOOST_ASIO_MOVE_CAST(WriteHandler)(handler))( + boost::system::error_code(), 0, 1); } #if !defined(BOOST_NO_IOSTREAM) namespace detail { - template <typename AsyncRandomAccessWriteDevice, - typename Allocator, typename WriteHandler> + template <typename Allocator, typename WriteHandler> class write_at_streambuf_op { public: write_at_streambuf_op( boost::asio::basic_streambuf<Allocator>& streambuf, - WriteHandler handler) + WriteHandler& handler) : streambuf_(streambuf), - handler_(handler) + handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)) + { + } + +#if defined(BOOST_ASIO_HAS_MOVE) + write_at_streambuf_op(const write_at_streambuf_op& other) + : streambuf_(other.streambuf_), + handler_(other.handler_) { } + write_at_streambuf_op(write_at_streambuf_op&& other) + : streambuf_(other.streambuf_), + handler_(BOOST_ASIO_MOVE_CAST(WriteHandler)(other.handler_)) + { + } +#endif // defined(BOOST_ASIO_HAS_MOVE) + void operator()(const boost::system::error_code& ec, const std::size_t bytes_transferred) { @@ -358,55 +669,76 @@ namespace detail WriteHandler handler_; }; - template <typename AsyncRandomAccessWriteDevice, typename Allocator, - typename WriteHandler> + template <typename Allocator, typename WriteHandler> inline void* asio_handler_allocate(std::size_t size, - write_at_streambuf_op<AsyncRandomAccessWriteDevice, - Allocator, WriteHandler>* this_handler) + write_at_streambuf_op<Allocator, WriteHandler>* this_handler) { return boost_asio_handler_alloc_helpers::allocate( size, this_handler->handler_); } - template <typename AsyncRandomAccessWriteDevice, typename Allocator, - typename WriteHandler> + template <typename Allocator, typename WriteHandler> inline void asio_handler_deallocate(void* pointer, std::size_t size, - write_at_streambuf_op<AsyncRandomAccessWriteDevice, - Allocator, WriteHandler>* this_handler) + write_at_streambuf_op<Allocator, WriteHandler>* this_handler) { boost_asio_handler_alloc_helpers::deallocate( pointer, size, this_handler->handler_); } - template <typename Function, typename AsyncRandomAccessWriteDevice, - typename Allocator, typename WriteHandler> + template <typename Function, typename Allocator, typename WriteHandler> + inline void asio_handler_invoke(Function& function, + write_at_streambuf_op<Allocator, WriteHandler>* this_handler) + { + boost_asio_handler_invoke_helpers::invoke( + function, this_handler->handler_); + } + + template <typename Function, typename Allocator, typename WriteHandler> inline void asio_handler_invoke(const Function& function, - write_at_streambuf_op<AsyncRandomAccessWriteDevice, - Allocator, WriteHandler>* this_handler) + write_at_streambuf_op<Allocator, WriteHandler>* this_handler) { boost_asio_handler_invoke_helpers::invoke( function, this_handler->handler_); } + + template <typename Allocator, typename WriteHandler> + inline write_at_streambuf_op<Allocator, WriteHandler> + make_write_at_streambuf_op( + boost::asio::basic_streambuf<Allocator>& b, WriteHandler handler) + { + return write_at_streambuf_op<Allocator, WriteHandler>(b, handler); + } } // namespace detail template <typename AsyncRandomAccessWriteDevice, typename Allocator, typename CompletionCondition, typename WriteHandler> inline void async_write_at(AsyncRandomAccessWriteDevice& d, boost::uint64_t offset, boost::asio::basic_streambuf<Allocator>& b, - CompletionCondition completion_condition, WriteHandler handler) + CompletionCondition completion_condition, + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a WriteHandler. + BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; + async_write_at(d, offset, b.data(), completion_condition, - detail::write_at_streambuf_op< - AsyncRandomAccessWriteDevice, Allocator, WriteHandler>(b, handler)); + detail::make_write_at_streambuf_op( + b, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler))); } template <typename AsyncRandomAccessWriteDevice, typename Allocator, typename WriteHandler> inline void async_write_at(AsyncRandomAccessWriteDevice& d, boost::uint64_t offset, boost::asio::basic_streambuf<Allocator>& b, - WriteHandler handler) + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { - async_write_at(d, offset, b, transfer_all(), handler); + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a WriteHandler. + BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; + + async_write_at(d, offset, b.data(), transfer_all(), + detail::make_write_at_streambuf_op( + b, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler))); } #endif // !defined(BOOST_NO_IOSTREAM) diff --git a/3rdParty/Boost/src/boost/asio/io_service.hpp b/3rdParty/Boost/src/boost/asio/io_service.hpp index a6a27fa..43b94e4 100644 --- a/3rdParty/Boost/src/boost/asio/io_service.hpp +++ b/3rdParty/Boost/src/boost/asio/io_service.hpp @@ -2,7 +2,7 @@ // io_service.hpp // ~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -68,9 +68,12 @@ namespace detail { typedef task_io_service io_service_impl; } * * @par Thread Safety * @e Distinct @e objects: Safe.@n - * @e Shared @e objects: Safe, with the exception that calling reset() while - * there are unfinished run(), run_one(), poll() or poll_one() calls results in - * undefined behaviour. + * @e Shared @e objects: Safe, with the specific exceptions of the reset() and + * notify_fork() functions. Calling reset() while there are unfinished run(), + * run_one(), poll() or poll_one() calls results in undefined behaviour. The + * notify_fork() function should not be called while any io_service function, + * or any function on an I/O object that is associated with the io_service, is + * being called in another thread. * * @par Concepts: * Dispatcher. @@ -256,8 +259,10 @@ public: * waiting in the pool are equivalent and the io_service may choose any one * of them to invoke a handler. * - * The run() function may be safely called again once it has completed only - * after a call to reset(). + * A normal exit from the run() function implies that the io_service object + * is stopped (the stopped() function returns @c true). Subsequent calls to + * run(), run_one(), poll() or poll_one() will return immediately unless there + * is a prior call to reset(). * * @return The number of handlers that were executed. * @@ -282,8 +287,10 @@ public: * waiting in the pool are equivalent and the io_service may choose any one * of them to invoke a handler. * - * The run() function may be safely called again once it has completed only - * after a call to reset(). + * A normal exit from the run() function implies that the io_service object + * is stopped (the stopped() function returns @c true). Subsequent calls to + * run(), run_one(), poll() or poll_one() will return immediately unless there + * is a prior call to reset(). * * @param ec Set to indicate what error occurred, if any. * @@ -304,7 +311,11 @@ public: * The run_one() function blocks until one handler has been dispatched, or * until the io_service has been stopped. * - * @return The number of handlers that were executed. + * @return The number of handlers that were executed. A zero return value + * implies that the io_service object is stopped (the stopped() function + * returns @c true). Subsequent calls to run(), run_one(), poll() or + * poll_one() will return immediately unless there is a prior call to + * reset(). * * @throws boost::system::system_error Thrown on failure. */ @@ -316,7 +327,11 @@ public: * The run_one() function blocks until one handler has been dispatched, or * until the io_service has been stopped. * - * @param ec Set to indicate what error occurred, if any. + * @return The number of handlers that were executed. A zero return value + * implies that the io_service object is stopped (the stopped() function + * returns @c true). Subsequent calls to run(), run_one(), poll() or + * poll_one() will return immediately unless there is a prior call to + * reset(). * * @return The number of handlers that were executed. */ @@ -379,13 +394,25 @@ public: */ BOOST_ASIO_DECL void stop(); + /// Determine whether the io_service object has been stopped. + /** + * This function is used to determine whether an io_service object has been + * stopped, either through an explicit call to stop(), or due to running out + * of work. When an io_service object is stopped, calls to run(), run_one(), + * poll() or poll_one() will return immediately without invoking any + * handlers. + * + * @return @c true if the io_service object is stopped, otherwise @c false. + */ + BOOST_ASIO_DECL bool stopped() const; + /// Reset the io_service in preparation for a subsequent run() invocation. /** * This function must be called prior to any second or later set of * invocations of the run(), run_one(), poll() or poll_one() functions when a * previous invocation of these functions returned due to the io_service - * being stopped or running out of work. This function allows the io_service - * to reset any internal state, such as a "stopped" flag. + * being stopped or running out of work. After a call to reset(), the + * io_service object's stopped() function will return @c false. * * This function must not be called while there are any unfinished calls to * the run(), run_one(), poll() or poll_one() functions. @@ -414,7 +441,7 @@ public: * throws an exception. */ template <typename CompletionHandler> - void dispatch(CompletionHandler handler); + void dispatch(BOOST_ASIO_MOVE_ARG(CompletionHandler) handler); /// Request the io_service to invoke the given handler and return immediately. /** @@ -439,7 +466,7 @@ public: * throws an exception. */ template <typename CompletionHandler> - void post(CompletionHandler handler); + void post(BOOST_ASIO_MOVE_ARG(CompletionHandler) handler); /// Create a new handler that automatically dispatches the wrapped handler /// on the io_service. @@ -471,6 +498,61 @@ public: #endif wrap(Handler handler); + /// Fork-related event notifications. + enum fork_event + { + /// Notify the io_service that the process is about to fork. + fork_prepare, + + /// Notify the io_service that the process has forked and is the parent. + fork_parent, + + /// Notify the io_service that the process has forked and is the child. + fork_child + }; + + /// Notify the io_service of a fork-related event. + /** + * This function is used to inform the io_service that the process is about + * to fork, or has just forked. This allows the io_service, and the services + * it contains, to perform any necessary housekeeping to ensure correct + * operation following a fork. + * + * This function must not be called while any other io_service function, or + * any function on an I/O object associated with the io_service, is being + * called in another thread. It is, however, safe to call this function from + * within a completion handler, provided no other thread is accessing the + * io_service. + * + * @param event A fork-related event. + * + * @throws boost::system::system_error Thrown on failure. If the notification + * fails the io_service object should no longer be used and should be + * destroyed. + * + * @par Example + * The following code illustrates how to incorporate the notify_fork() + * function: + * @code my_io_service.notify_fork(boost::asio::io_service::fork_prepare); + * if (fork() == 0) + * { + * // This is the child process. + * my_io_service.notify_fork(boost::asio::io_service::fork_child); + * } + * else + * { + * // This is the parent process. + * my_io_service.notify_fork(boost::asio::io_service::fork_parent); + * } @endcode + * + * @note For each service object @c svc in the io_service set, performs + * <tt>svc->fork_service();</tt>. When processing the fork_prepare event, + * services are visited in reverse order of the beginning of service object + * lifetime. Otherwise, services are visited in order of the beginning of + * service object lifetime. + */ + BOOST_ASIO_DECL void notify_fork(boost::asio::io_service::fork_event event); + /// Obtain the service object corresponding to the given type. /** * This function is used to locate a service object that corresponds to @@ -569,10 +651,6 @@ public: */ ~work(); - /// (Deprecated: use get_io_service().) Get the io_service associated with the - /// work. - boost::asio::io_service& io_service(); - /// Get the io_service associated with the work. boost::asio::io_service& get_io_service(); @@ -580,8 +658,8 @@ private: // Prevent assignment. void operator=(const work& other); - // The io_service. - boost::asio::io_service& io_service_; + // The io_service implementation. + detail::io_service_impl& io_service_impl_; }; /// Class used to uniquely identify a service. @@ -598,10 +676,6 @@ class io_service::service : private noncopyable { public: - /// (Deprecated: use get_io_service().) Get the io_service object that owns - /// the service. - boost::asio::io_service& io_service(); - /// Get the io_service object that owns the service. boost::asio::io_service& get_io_service(); @@ -619,6 +693,15 @@ private: /// Destroy all user-defined handler objects owned by the service. virtual void shutdown_service() = 0; + /// Handle notification of a fork-related event to perform any necessary + /// housekeeping. + /** + * This function is not a pure virtual so that services only have to + * implement it if necessary. The default implementation does nothing. + */ + BOOST_ASIO_DECL virtual void fork_service( + boost::asio::io_service::fork_event event); + friend class boost::asio::detail::service_registry; struct key { diff --git a/3rdParty/Boost/src/boost/asio/ip/address.hpp b/3rdParty/Boost/src/boost/asio/ip/address.hpp index 4ecae7a..9e62c04 100644 --- a/3rdParty/Boost/src/boost/asio/ip/address.hpp +++ b/3rdParty/Boost/src/boost/asio/ip/address.hpp @@ -2,7 +2,7 @@ // ip/address.hpp // ~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -55,9 +55,19 @@ public: /// Copy constructor. BOOST_ASIO_DECL address(const address& other); +#if defined(BOOST_ASIO_HAS_MOVE) + /// Move constructor. + BOOST_ASIO_DECL address(address&& other); +#endif // defined(BOOST_ASIO_HAS_MOVE) + /// Assign from another address. BOOST_ASIO_DECL address& operator=(const address& other); +#if defined(BOOST_ASIO_HAS_MOVE) + /// Move-assign from another address. + BOOST_ASIO_DECL address& operator=(address&& other); +#endif // defined(BOOST_ASIO_HAS_MOVE) + /// Assign from an IPv4 address. BOOST_ASIO_DECL address& operator=( const boost::asio::ip::address_v4& ipv4_address); @@ -108,6 +118,15 @@ public: BOOST_ASIO_DECL static address from_string( const std::string& str, boost::system::error_code& ec); + /// Determine whether the address is a loopback address. + BOOST_ASIO_DECL bool is_loopback() const; + + /// Determine whether the address is unspecified. + BOOST_ASIO_DECL bool is_unspecified() const; + + /// Determine whether the address is a multicast address. + BOOST_ASIO_DECL bool is_multicast() const; + /// Compare two addresses for equality. BOOST_ASIO_DECL friend bool operator==(const address& a1, const address& a2); diff --git a/3rdParty/Boost/src/boost/asio/ip/address_v4.hpp b/3rdParty/Boost/src/boost/asio/ip/address_v4.hpp index 5728a17..8d11921 100644 --- a/3rdParty/Boost/src/boost/asio/ip/address_v4.hpp +++ b/3rdParty/Boost/src/boost/asio/ip/address_v4.hpp @@ -2,7 +2,7 @@ // ip/address_v4.hpp // ~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -17,7 +17,7 @@ #include <boost/asio/detail/config.hpp> #include <string> -#include <boost/array.hpp> +#include <boost/asio/detail/array.hpp> #include <boost/asio/detail/socket_types.hpp> #include <boost/asio/detail/winsock_init.hpp> #include <boost/system/error_code.hpp> @@ -45,7 +45,15 @@ class address_v4 { public: /// The type used to represent an address as an array of bytes. - typedef boost::array<unsigned char, 4> bytes_type; + /** + * @note This type is defined in terms of the C++0x template @c std::array + * when it is available. Otherwise, it uses @c boost:array. + */ +#if defined(GENERATING_DOCUMENTATION) + typedef array<unsigned char, 4> bytes_type; +#else + typedef boost::asio::detail::array<unsigned char, 4> bytes_type; +#endif /// Default constructor. address_v4() @@ -65,6 +73,14 @@ public: { } +#if defined(BOOST_ASIO_HAS_MOVE) + /// Move constructor. + address_v4(address_v4&& other) + : addr_(other.addr_) + { + } +#endif // defined(BOOST_ASIO_HAS_MOVE) + /// Assign from another address. address_v4& operator=(const address_v4& other) { @@ -72,6 +88,15 @@ public: return *this; } +#if defined(BOOST_ASIO_HAS_MOVE) + /// Move-assign from another address. + address_v4& operator=(address_v4&& other) + { + addr_ = other.addr_; + return *this; + } +#endif // defined(BOOST_ASIO_HAS_MOVE) + /// Get the address in bytes, in network byte order. BOOST_ASIO_DECL bytes_type to_bytes() const; @@ -98,6 +123,12 @@ public: BOOST_ASIO_DECL static address_v4 from_string( const std::string& str, boost::system::error_code& ec); + /// Determine whether the address is a loopback address. + BOOST_ASIO_DECL bool is_loopback() const; + + /// Determine whether the address is unspecified. + BOOST_ASIO_DECL bool is_unspecified() const; + /// Determine whether the address is a class A address. BOOST_ASIO_DECL bool is_class_a() const; @@ -149,19 +180,19 @@ public: /// Obtain an address object that represents any address. static address_v4 any() { - return address_v4(static_cast<unsigned long>(INADDR_ANY)); + return address_v4(); } /// Obtain an address object that represents the loopback address. static address_v4 loopback() { - return address_v4(static_cast<unsigned long>(INADDR_LOOPBACK)); + return address_v4(0x7F000001); } /// Obtain an address object that represents the broadcast address. static address_v4 broadcast() { - return address_v4(static_cast<unsigned long>(INADDR_BROADCAST)); + return address_v4(0xFFFFFFFF); } /// Obtain an address object that represents the broadcast address that diff --git a/3rdParty/Boost/src/boost/asio/ip/address_v6.hpp b/3rdParty/Boost/src/boost/asio/ip/address_v6.hpp index 9155bea..e35a176 100644 --- a/3rdParty/Boost/src/boost/asio/ip/address_v6.hpp +++ b/3rdParty/Boost/src/boost/asio/ip/address_v6.hpp @@ -2,7 +2,7 @@ // ip/address_v6.hpp // ~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -17,7 +17,7 @@ #include <boost/asio/detail/config.hpp> #include <string> -#include <boost/array.hpp> +#include <boost/asio/detail/array.hpp> #include <boost/asio/detail/socket_types.hpp> #include <boost/asio/detail/winsock_init.hpp> #include <boost/system/error_code.hpp> @@ -46,7 +46,15 @@ class address_v6 { public: /// The type used to represent an address as an array of bytes. - typedef boost::array<unsigned char, 16> bytes_type; + /** + * @note This type is defined in terms of the C++0x template @c std::array + * when it is available. Otherwise, it uses @c boost:array. + */ +#if defined(GENERATING_DOCUMENTATION) + typedef array<unsigned char, 16> bytes_type; +#else + typedef boost::asio::detail::array<unsigned char, 16> bytes_type; +#endif /// Default constructor. BOOST_ASIO_DECL address_v6(); @@ -58,9 +66,19 @@ public: /// Copy constructor. BOOST_ASIO_DECL address_v6(const address_v6& other); +#if defined(BOOST_ASIO_HAS_MOVE) + /// Move constructor. + BOOST_ASIO_DECL address_v6(address_v6&& other); +#endif // defined(BOOST_ASIO_HAS_MOVE) + /// Assign from another address. BOOST_ASIO_DECL address_v6& operator=(const address_v6& other); +#if defined(BOOST_ASIO_HAS_MOVE) + /// Move-assign from another address. + BOOST_ASIO_DECL address_v6& operator=(address_v6&& other); +#endif // defined(BOOST_ASIO_HAS_MOVE) + /// The scope ID of the address. /** * Returns the scope ID associated with the IPv6 address. diff --git a/3rdParty/Boost/src/boost/asio/ip/basic_endpoint.hpp b/3rdParty/Boost/src/boost/asio/ip/basic_endpoint.hpp index 0047adc..9eefe4c 100644 --- a/3rdParty/Boost/src/boost/asio/ip/basic_endpoint.hpp +++ b/3rdParty/Boost/src/boost/asio/ip/basic_endpoint.hpp @@ -2,7 +2,7 @@ // ip/basic_endpoint.hpp // ~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -78,8 +78,9 @@ public: * boost::asio::ip::udp::endpoint ep(boost::asio::ip::udp::v6(), 9876); * @endcode */ - basic_endpoint(const InternetProtocol& protocol, unsigned short port_num) - : impl_(protocol.family(), port_num) + basic_endpoint(const InternetProtocol& internet_protocol, + unsigned short port_num) + : impl_(internet_protocol.family(), port_num) { } @@ -97,6 +98,14 @@ public: { } +#if defined(BOOST_ASIO_HAS_MOVE) + /// Move constructor. + basic_endpoint(basic_endpoint&& other) + : impl_(other.impl_) + { + } +#endif // defined(BOOST_ASIO_HAS_MOVE) + /// Assign from another endpoint. basic_endpoint& operator=(const basic_endpoint& other) { @@ -104,6 +113,15 @@ public: return *this; } +#if defined(BOOST_ASIO_HAS_MOVE) + /// Move-assign from another endpoint. + basic_endpoint& operator=(basic_endpoint&& other) + { + impl_ = other.impl_; + return *this; + } +#endif // defined(BOOST_ASIO_HAS_MOVE) + /// The protocol associated with the endpoint. protocol_type protocol() const { @@ -131,9 +149,9 @@ public: } /// Set the underlying size of the endpoint in the native type. - void resize(std::size_t size) + void resize(std::size_t new_size) { - impl_.resize(size); + impl_.resize(new_size); } /// Get the capacity of the endpoint in the native type. diff --git a/3rdParty/Boost/src/boost/asio/ip/basic_resolver.hpp b/3rdParty/Boost/src/boost/asio/ip/basic_resolver.hpp index f27515a..6265890 100644 --- a/3rdParty/Boost/src/boost/asio/ip/basic_resolver.hpp +++ b/3rdParty/Boost/src/boost/asio/ip/basic_resolver.hpp @@ -2,7 +2,7 @@ // ip/basic_resolver.hpp // ~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -17,6 +17,7 @@ #include <boost/asio/detail/config.hpp> #include <boost/asio/basic_io_object.hpp> +#include <boost/asio/detail/handler_type_requirements.hpp> #include <boost/asio/detail/throw_error.hpp> #include <boost/asio/error.hpp> #include <boost/asio/ip/basic_resolver_iterator.hpp> @@ -99,7 +100,7 @@ public: { boost::system::error_code ec; iterator i = this->service.resolve(this->implementation, q, ec); - boost::asio::detail::throw_error(ec); + boost::asio::detail::throw_error(ec, "resolve"); return i; } @@ -152,9 +153,16 @@ public: * the handler. */ template <typename ResolveHandler> - void async_resolve(const query& q, ResolveHandler handler) + void async_resolve(const query& q, + BOOST_ASIO_MOVE_ARG(ResolveHandler) handler) { - return this->service.async_resolve(this->implementation, q, handler); + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a ResolveHandler. + BOOST_ASIO_RESOLVE_HANDLER_CHECK( + ResolveHandler, handler, iterator) type_check; + + return this->service.async_resolve(this->implementation, q, + BOOST_ASIO_MOVE_CAST(ResolveHandler)(handler)); } /// Perform reverse resolution of an endpoint to a list of entries. @@ -179,7 +187,7 @@ public: { boost::system::error_code ec; iterator i = this->service.resolve(this->implementation, e, ec); - boost::asio::detail::throw_error(ec); + boost::asio::detail::throw_error(ec, "resolve"); return i; } @@ -236,9 +244,16 @@ public: * the handler. */ template <typename ResolveHandler> - void async_resolve(const endpoint_type& e, ResolveHandler handler) + void async_resolve(const endpoint_type& e, + BOOST_ASIO_MOVE_ARG(ResolveHandler) handler) { - return this->service.async_resolve(this->implementation, e, handler); + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a ResolveHandler. + BOOST_ASIO_RESOLVE_HANDLER_CHECK( + ResolveHandler, handler, iterator) type_check; + + return this->service.async_resolve(this->implementation, e, + BOOST_ASIO_MOVE_CAST(ResolveHandler)(handler)); } }; diff --git a/3rdParty/Boost/src/boost/asio/ip/basic_resolver_entry.hpp b/3rdParty/Boost/src/boost/asio/ip/basic_resolver_entry.hpp index 980b488..d170ab0 100644 --- a/3rdParty/Boost/src/boost/asio/ip/basic_resolver_entry.hpp +++ b/3rdParty/Boost/src/boost/asio/ip/basic_resolver_entry.hpp @@ -2,7 +2,7 @@ // ip/basic_resolver_entry.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -49,11 +49,11 @@ public: } /// Construct with specified endpoint, host name and service name. - basic_resolver_entry(const endpoint_type& endpoint, - const std::string& host_name, const std::string& service_name) - : endpoint_(endpoint), - host_name_(host_name), - service_name_(service_name) + basic_resolver_entry(const endpoint_type& ep, + const std::string& host, const std::string& service) + : endpoint_(ep), + host_name_(host), + service_name_(service) { } diff --git a/3rdParty/Boost/src/boost/asio/ip/basic_resolver_iterator.hpp b/3rdParty/Boost/src/boost/asio/ip/basic_resolver_iterator.hpp index 465c278..6e52a85 100644 --- a/3rdParty/Boost/src/boost/asio/ip/basic_resolver_iterator.hpp +++ b/3rdParty/Boost/src/boost/asio/ip/basic_resolver_iterator.hpp @@ -2,7 +2,7 @@ // ip/basic_resolver_iterator.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -16,8 +16,9 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> -#include <boost/iterator.hpp> +#include <cstddef> #include <cstring> +#include <iterator> #include <string> #include <vector> #include <boost/asio/detail/shared_ptr.hpp> @@ -45,15 +46,23 @@ namespace ip { */ template <typename InternetProtocol> class basic_resolver_iterator -#if defined(GENERATING_DOCUMENTATION) - : public std::iterator< -#else // defined(GENERATING_DOCUMENTATION) - : public boost::iterator< -#endif // defined(GENERATING_DOCUMENTATION) - std::forward_iterator_tag, - const basic_resolver_entry<InternetProtocol> > { public: + /// The type used for the distance between two iterators. + typedef std::ptrdiff_t difference_type; + + /// The type of the value pointed to by the iterator. + typedef basic_resolver_entry<InternetProtocol> value_type; + + /// The type of the result of applying operator->() to the iterator. + typedef const basic_resolver_entry<InternetProtocol>* pointer; + + /// The type of the result of applying operator*() to the iterator. + typedef const basic_resolver_entry<InternetProtocol>& reference; + + /// The iterator category. + typedef std::forward_iterator_tag iterator_category; + /// Default constructor creates an end iterator. basic_resolver_iterator() : index_(0) diff --git a/3rdParty/Boost/src/boost/asio/ip/basic_resolver_query.hpp b/3rdParty/Boost/src/boost/asio/ip/basic_resolver_query.hpp index 8fd63bc..0f7a54d 100644 --- a/3rdParty/Boost/src/boost/asio/ip/basic_resolver_query.hpp +++ b/3rdParty/Boost/src/boost/asio/ip/basic_resolver_query.hpp @@ -2,7 +2,7 @@ // ip/basic_resolver_query.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -48,8 +48,8 @@ public: * This constructor is typically used to perform name resolution for local * service binding. * - * @param service_name A string identifying the requested service. This may - * be a descriptive name or a numeric string corresponding to a port number. + * @param service A string identifying the requested service. This may be a + * descriptive name or a numeric string corresponding to a port number. * * @param resolve_flags A set of flags that determine how name resolution * should be performed. The default flags are suitable for local service @@ -60,11 +60,11 @@ public: * <tt>c:\\windows\\system32\\drivers\\etc\\services</tt>. Operating systems * may use additional locations when resolving service names. */ - basic_resolver_query(const std::string& service_name, + basic_resolver_query(const std::string& service, resolver_query_base::flags resolve_flags = passive | address_configured) : hints_(), host_name_(), - service_name_(service_name) + service_name_(service) { typename InternetProtocol::endpoint endpoint; hints_.ai_flags = static_cast<int>(resolve_flags); @@ -85,8 +85,8 @@ public: * @param protocol A protocol object, normally representing either the IPv4 or * IPv6 version of an internet protocol. * - * @param service_name A string identifying the requested service. This may - * be a descriptive name or a numeric string corresponding to a port number. + * @param service A string identifying the requested service. This may be a + * descriptive name or a numeric string corresponding to a port number. * * @param resolve_flags A set of flags that determine how name resolution * should be performed. The default flags are suitable for local service @@ -98,11 +98,11 @@ public: * may use additional locations when resolving service names. */ basic_resolver_query(const protocol_type& protocol, - const std::string& service_name, + const std::string& service, resolver_query_base::flags resolve_flags = passive | address_configured) : hints_(), host_name_(), - service_name_(service_name) + service_name_(service) { hints_.ai_flags = static_cast<int>(resolve_flags); hints_.ai_family = protocol.family(); @@ -119,16 +119,16 @@ public: * This constructor is typically used to perform name resolution for * communication with remote hosts. * - * @param host_name A string identifying a location. May be a descriptive name - * or a numeric address string. If an empty string and the passive flag has - * been specified, the resolved endpoints are suitable for local service - * binding. If an empty string and passive is not specified, the resolved - * endpoints will use the loopback address. + * @param host A string identifying a location. May be a descriptive name or + * a numeric address string. If an empty string and the passive flag has been + * specified, the resolved endpoints are suitable for local service binding. + * If an empty string and passive is not specified, the resolved endpoints + * will use the loopback address. * - * @param service_name A string identifying the requested service. This may - * be a descriptive name or a numeric string corresponding to a port number. - * May be an empty string, in which case all resolved endpoints will have a - * port number of 0. + * @param service A string identifying the requested service. This may be a + * descriptive name or a numeric string corresponding to a port number. May + * be an empty string, in which case all resolved endpoints will have a port + * number of 0. * * @param resolve_flags A set of flags that determine how name resolution * should be performed. The default flags are suitable for communication with @@ -145,12 +145,11 @@ public: * <tt>c:\\windows\\system32\\drivers\\etc\\services</tt>. Operating systems * may use additional locations when resolving service names. */ - basic_resolver_query(const std::string& host_name, - const std::string& service_name, + basic_resolver_query(const std::string& host, const std::string& service, resolver_query_base::flags resolve_flags = address_configured) : hints_(), - host_name_(host_name), - service_name_(service_name) + host_name_(host), + service_name_(service) { typename InternetProtocol::endpoint endpoint; hints_.ai_flags = static_cast<int>(resolve_flags); @@ -171,16 +170,16 @@ public: * @param protocol A protocol object, normally representing either the IPv4 or * IPv6 version of an internet protocol. * - * @param host_name A string identifying a location. May be a descriptive name - * or a numeric address string. If an empty string and the passive flag has - * been specified, the resolved endpoints are suitable for local service - * binding. If an empty string and passive is not specified, the resolved - * endpoints will use the loopback address. + * @param host A string identifying a location. May be a descriptive name or + * a numeric address string. If an empty string and the passive flag has been + * specified, the resolved endpoints are suitable for local service binding. + * If an empty string and passive is not specified, the resolved endpoints + * will use the loopback address. * - * @param service_name A string identifying the requested service. This may - * be a descriptive name or a numeric string corresponding to a port number. - * May be an empty string, in which case all resolved endpoints will have a - * port number of 0. + * @param service A string identifying the requested service. This may be a + * descriptive name or a numeric string corresponding to a port number. May + * be an empty string, in which case all resolved endpoints will have a port + * number of 0. * * @param resolve_flags A set of flags that determine how name resolution * should be performed. The default flags are suitable for communication with @@ -198,11 +197,11 @@ public: * may use additional locations when resolving service names. */ basic_resolver_query(const protocol_type& protocol, - const std::string& host_name, const std::string& service_name, + const std::string& host, const std::string& service, resolver_query_base::flags resolve_flags = address_configured) : hints_(), - host_name_(host_name), - service_name_(service_name) + host_name_(host), + service_name_(service) { hints_.ai_flags = static_cast<int>(resolve_flags); hints_.ai_family = protocol.family(); diff --git a/3rdParty/Boost/src/boost/asio/ip/detail/endpoint.hpp b/3rdParty/Boost/src/boost/asio/ip/detail/endpoint.hpp index fe95a00..04335ef 100644 --- a/3rdParty/Boost/src/boost/asio/ip/detail/endpoint.hpp +++ b/3rdParty/Boost/src/boost/asio/ip/detail/endpoint.hpp @@ -2,7 +2,7 @@ // ip/detail/endpoint.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -78,12 +78,12 @@ public: } // Set the underlying size of the endpoint in the native type. - BOOST_ASIO_DECL void resize(std::size_t size); + BOOST_ASIO_DECL void resize(std::size_t new_size); // Get the capacity of the endpoint in the native type. std::size_t capacity() const { - return sizeof(boost::asio::detail::sockaddr_storage_type); + return sizeof(data_); } // Get the port associated with the endpoint. @@ -122,7 +122,6 @@ private: union data_union { boost::asio::detail::socket_addr_type base; - boost::asio::detail::sockaddr_storage_type storage; boost::asio::detail::sockaddr_in4_type v4; boost::asio::detail::sockaddr_in6_type v6; } data_; diff --git a/3rdParty/Boost/src/boost/asio/ip/detail/impl/endpoint.ipp b/3rdParty/Boost/src/boost/asio/ip/detail/impl/endpoint.ipp index 0443d38..24bfce2 100644 --- a/3rdParty/Boost/src/boost/asio/ip/detail/impl/endpoint.ipp +++ b/3rdParty/Boost/src/boost/asio/ip/detail/impl/endpoint.ipp @@ -2,7 +2,7 @@ // ip/detail/impl/endpoint.ipp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -57,8 +57,14 @@ endpoint::endpoint(int family, unsigned short port_num) data_.v6.sin6_port = boost::asio::detail::socket_ops::host_to_network_short(port_num); data_.v6.sin6_flowinfo = 0; - boost::asio::detail::in6_addr_type tmp_addr = IN6ADDR_ANY_INIT; - data_.v6.sin6_addr = tmp_addr; + data_.v6.sin6_addr.s6_addr[0] = 0; data_.v6.sin6_addr.s6_addr[1] = 0; + data_.v6.sin6_addr.s6_addr[2] = 0, data_.v6.sin6_addr.s6_addr[3] = 0; + data_.v6.sin6_addr.s6_addr[4] = 0, data_.v6.sin6_addr.s6_addr[5] = 0; + data_.v6.sin6_addr.s6_addr[6] = 0, data_.v6.sin6_addr.s6_addr[7] = 0; + data_.v6.sin6_addr.s6_addr[8] = 0, data_.v6.sin6_addr.s6_addr[9] = 0; + data_.v6.sin6_addr.s6_addr[10] = 0, data_.v6.sin6_addr.s6_addr[11] = 0; + data_.v6.sin6_addr.s6_addr[12] = 0, data_.v6.sin6_addr.s6_addr[13] = 0; + data_.v6.sin6_addr.s6_addr[14] = 0, data_.v6.sin6_addr.s6_addr[15] = 0; data_.v6.sin6_scope_id = 0; } } @@ -85,14 +91,14 @@ endpoint::endpoint(const boost::asio::ip::address& addr, data_.v6.sin6_flowinfo = 0; boost::asio::ip::address_v6 v6_addr = addr.to_v6(); boost::asio::ip::address_v6::bytes_type bytes = v6_addr.to_bytes(); - memcpy(data_.v6.sin6_addr.s6_addr, bytes.elems, 16); + memcpy(data_.v6.sin6_addr.s6_addr, bytes.data(), 16); data_.v6.sin6_scope_id = v6_addr.scope_id(); } } -void endpoint::resize(std::size_t size) +void endpoint::resize(std::size_t new_size) { - if (size > sizeof(boost::asio::detail::sockaddr_storage_type)) + if (new_size > sizeof(boost::asio::detail::sockaddr_storage_type)) { boost::system::error_code ec(boost::asio::error::invalid_argument); boost::asio::detail::throw_error(ec); @@ -139,7 +145,11 @@ boost::asio::ip::address endpoint::address() const else { boost::asio::ip::address_v6::bytes_type bytes; +#if defined(BOOST_ASIO_HAS_STD_ARRAY) + memcpy(bytes.data(), data_.v6.sin6_addr.s6_addr, 16); +#else // defined(BOOST_ASIO_HAS_STD_ARRAY) memcpy(bytes.elems, data_.v6.sin6_addr.s6_addr, 16); +#endif // defined(BOOST_ASIO_HAS_STD_ARRAY) return boost::asio::ip::address_v6(bytes, data_.v6.sin6_scope_id); } } diff --git a/3rdParty/Boost/src/boost/asio/ip/detail/socket_option.hpp b/3rdParty/Boost/src/boost/asio/ip/detail/socket_option.hpp index 6fde8c3..041a9f8 100644 --- a/3rdParty/Boost/src/boost/asio/ip/detail/socket_option.hpp +++ b/3rdParty/Boost/src/boost/asio/ip/detail/socket_option.hpp @@ -2,7 +2,7 @@ // detail/socket_option.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -18,6 +18,7 @@ #include <boost/asio/detail/config.hpp> #include <cstddef> #include <cstring> +#include <stdexcept> #include <boost/throw_exception.hpp> #include <boost/asio/detail/socket_ops.hpp> #include <boost/asio/detail/socket_types.hpp> @@ -385,35 +386,22 @@ class multicast_request public: // Default constructor. multicast_request() + : ipv4_value_(), // Zero-initialisation gives the "any" address. + ipv6_value_() // Zero-initialisation gives the "any" address. { - ipv4_value_.imr_multiaddr.s_addr = - boost::asio::detail::socket_ops::host_to_network_long( - boost::asio::ip::address_v4::any().to_ulong()); - ipv4_value_.imr_interface.s_addr = - boost::asio::detail::socket_ops::host_to_network_long( - boost::asio::ip::address_v4::any().to_ulong()); - - boost::asio::detail::in6_addr_type tmp_addr = IN6ADDR_ANY_INIT; - ipv6_value_.ipv6mr_multiaddr = tmp_addr; - ipv6_value_.ipv6mr_interface = 0; } // Construct with multicast address only. explicit multicast_request(const boost::asio::ip::address& multicast_address) + : ipv4_value_(), // Zero-initialisation gives the "any" address. + ipv6_value_() // Zero-initialisation gives the "any" address. { if (multicast_address.is_v6()) { - ipv4_value_.imr_multiaddr.s_addr = - boost::asio::detail::socket_ops::host_to_network_long( - boost::asio::ip::address_v4::any().to_ulong()); - ipv4_value_.imr_interface.s_addr = - boost::asio::detail::socket_ops::host_to_network_long( - boost::asio::ip::address_v4::any().to_ulong()); - using namespace std; // For memcpy. boost::asio::ip::address_v6 ipv6_address = multicast_address.to_v6(); boost::asio::ip::address_v6::bytes_type bytes = ipv6_address.to_bytes(); - memcpy(ipv6_value_.ipv6mr_multiaddr.s6_addr, bytes.elems, 16); + memcpy(ipv6_value_.ipv6mr_multiaddr.s6_addr, bytes.data(), 16); ipv6_value_.ipv6mr_interface = 0; } else @@ -424,10 +412,6 @@ public: ipv4_value_.imr_interface.s_addr = boost::asio::detail::socket_ops::host_to_network_long( boost::asio::ip::address_v4::any().to_ulong()); - - boost::asio::detail::in6_addr_type tmp_addr = IN6ADDR_ANY_INIT; - ipv6_value_.ipv6mr_multiaddr = tmp_addr; - ipv6_value_.ipv6mr_interface = 0; } } @@ -436,6 +420,7 @@ public: const boost::asio::ip::address_v4& multicast_address, const boost::asio::ip::address_v4& network_interface = boost::asio::ip::address_v4::any()) + : ipv6_value_() // Zero-initialisation gives the "any" address. { ipv4_value_.imr_multiaddr.s_addr = boost::asio::detail::socket_ops::host_to_network_long( @@ -443,28 +428,18 @@ public: ipv4_value_.imr_interface.s_addr = boost::asio::detail::socket_ops::host_to_network_long( network_interface.to_ulong()); - - boost::asio::detail::in6_addr_type tmp_addr = IN6ADDR_ANY_INIT; - ipv6_value_.ipv6mr_multiaddr = tmp_addr; - ipv6_value_.ipv6mr_interface = 0; } // Construct with multicast address and IPv6 network interface index. explicit multicast_request( const boost::asio::ip::address_v6& multicast_address, unsigned long network_interface = 0) + : ipv4_value_() // Zero-initialisation gives the "any" address. { - ipv4_value_.imr_multiaddr.s_addr = - boost::asio::detail::socket_ops::host_to_network_long( - boost::asio::ip::address_v4::any().to_ulong()); - ipv4_value_.imr_interface.s_addr = - boost::asio::detail::socket_ops::host_to_network_long( - boost::asio::ip::address_v4::any().to_ulong()); - using namespace std; // For memcpy. boost::asio::ip::address_v6::bytes_type bytes = multicast_address.to_bytes(); - memcpy(ipv6_value_.ipv6mr_multiaddr.s6_addr, bytes.elems, 16); + memcpy(ipv6_value_.ipv6mr_multiaddr.s6_addr, bytes.data(), 16); ipv6_value_.ipv6mr_interface = network_interface; } diff --git a/3rdParty/Boost/src/boost/asio/ip/host_name.hpp b/3rdParty/Boost/src/boost/asio/ip/host_name.hpp index 33860c9..9e024e1 100644 --- a/3rdParty/Boost/src/boost/asio/ip/host_name.hpp +++ b/3rdParty/Boost/src/boost/asio/ip/host_name.hpp @@ -2,7 +2,7 @@ // ip/host_name.hpp // ~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/ip/icmp.hpp b/3rdParty/Boost/src/boost/asio/ip/icmp.hpp index 14bb944..62748b6 100644 --- a/3rdParty/Boost/src/boost/asio/ip/icmp.hpp +++ b/3rdParty/Boost/src/boost/asio/ip/icmp.hpp @@ -2,7 +2,7 @@ // ip/icmp.hpp // ~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -46,12 +46,6 @@ public: /// The type of a ICMP endpoint. typedef basic_endpoint<icmp> endpoint; - /// (Deprecated: use resolver::query.) The type of a resolver query. - typedef basic_resolver_query<icmp> resolver_query; - - /// (Deprecated: use resolver::iterator.) The type of a resolver iterator. - typedef basic_resolver_iterator<icmp> resolver_iterator; - /// Construct to represent the IPv4 ICMP protocol. static icmp v4() { @@ -102,9 +96,9 @@ public: private: // Construct with a specific family. - explicit icmp(int protocol, int family) - : protocol_(protocol), - family_(family) + explicit icmp(int protocol_id, int protocol_family) + : protocol_(protocol_id), + family_(protocol_family) { } diff --git a/3rdParty/Boost/src/boost/asio/ip/impl/address.hpp b/3rdParty/Boost/src/boost/asio/ip/impl/address.hpp index 94dfb17..a875e1b 100644 --- a/3rdParty/Boost/src/boost/asio/ip/impl/address.hpp +++ b/3rdParty/Boost/src/boost/asio/ip/impl/address.hpp @@ -2,7 +2,7 @@ // ip/impl/address.hpp // ~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/ip/impl/address.ipp b/3rdParty/Boost/src/boost/asio/ip/impl/address.ipp index 11f06fc..5353758 100644 --- a/3rdParty/Boost/src/boost/asio/ip/impl/address.ipp +++ b/3rdParty/Boost/src/boost/asio/ip/impl/address.ipp @@ -2,7 +2,7 @@ // ip/impl/address.ipp // ~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -57,6 +57,15 @@ address::address(const address& other) { } +#if defined(BOOST_ASIO_HAS_MOVE) +address::address(address&& other) + : type_(other.type_), + ipv4_address_(other.ipv4_address_), + ipv6_address_(other.ipv6_address_) +{ +} +#endif // defined(BOOST_ASIO_HAS_MOVE) + address& address::operator=(const address& other) { type_ = other.type_; @@ -65,6 +74,16 @@ address& address::operator=(const address& other) return *this; } +#if defined(BOOST_ASIO_HAS_MOVE) +address& address::operator=(address&& other) +{ + type_ = other.type_; + ipv4_address_ = other.ipv4_address_; + ipv6_address_ = other.ipv6_address_; + return *this; +} +#endif // defined(BOOST_ASIO_HAS_MOVE) + address& address::operator=(const boost::asio::ip::address_v4& ipv4_address) { type_ = ipv4; @@ -159,6 +178,27 @@ address address::from_string(const std::string& str, return from_string(str.c_str(), ec); } +bool address::is_loopback() const +{ + return (type_ == ipv4) + ? ipv4_address_.is_loopback() + : ipv6_address_.is_loopback(); +} + +bool address::is_unspecified() const +{ + return (type_ == ipv4) + ? ipv4_address_.is_unspecified() + : ipv6_address_.is_unspecified(); +} + +bool address::is_multicast() const +{ + return (type_ == ipv4) + ? ipv4_address_.is_multicast() + : ipv6_address_.is_multicast(); +} + bool operator==(const address& a1, const address& a2) { if (a1.type_ != a2.type_) diff --git a/3rdParty/Boost/src/boost/asio/ip/impl/address_v4.hpp b/3rdParty/Boost/src/boost/asio/ip/impl/address_v4.hpp index d27d48d..87b0e19 100644 --- a/3rdParty/Boost/src/boost/asio/ip/impl/address_v4.hpp +++ b/3rdParty/Boost/src/boost/asio/ip/impl/address_v4.hpp @@ -2,7 +2,7 @@ // ip/impl/address_v4.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/ip/impl/address_v4.ipp b/3rdParty/Boost/src/boost/asio/ip/impl/address_v4.ipp index 8bdef19..31f6e27 100644 --- a/3rdParty/Boost/src/boost/asio/ip/impl/address_v4.ipp +++ b/3rdParty/Boost/src/boost/asio/ip/impl/address_v4.ipp @@ -2,7 +2,7 @@ // ip/impl/address_v4.ipp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -42,7 +42,7 @@ address_v4::address_v4(const address_v4::bytes_type& bytes) #endif // UCHAR_MAX > 0xFF using namespace std; // For memcpy. - memcpy(&addr_.s_addr, bytes.elems, 4); + memcpy(&addr_.s_addr, bytes.data(), 4); } address_v4::address_v4(unsigned long addr) @@ -62,7 +62,11 @@ address_v4::bytes_type address_v4::to_bytes() const { using namespace std; // For memcpy. bytes_type bytes; +#if defined(BOOST_ASIO_HAS_STD_ARRAY) + memcpy(bytes.data(), &addr_.s_addr, 4); +#else // defined(BOOST_ASIO_HAS_STD_ARRAY) memcpy(bytes.elems, &addr_.s_addr, 4); +#endif // defined(BOOST_ASIO_HAS_STD_ARRAY) return bytes; } @@ -119,24 +123,34 @@ address_v4 address_v4::from_string( return from_string(str.c_str(), ec); } +bool address_v4::is_loopback() const +{ + return (to_ulong() & 0xFF000000) == 0x7F000000; +} + +bool address_v4::is_unspecified() const +{ + return to_ulong() == 0; +} + bool address_v4::is_class_a() const { - return IN_CLASSA(to_ulong()); + return (to_ulong() & 0x80000000) == 0; } bool address_v4::is_class_b() const { - return IN_CLASSB(to_ulong()); + return (to_ulong() & 0xC0000000) == 0x80000000; } bool address_v4::is_class_c() const { - return IN_CLASSC(to_ulong()); + return (to_ulong() & 0xE0000000) == 0xC0000000; } bool address_v4::is_multicast() const { - return IN_MULTICAST(to_ulong()); + return (to_ulong() & 0xF0000000) == 0xE0000000; } address_v4 address_v4::broadcast(const address_v4& addr, const address_v4& mask) diff --git a/3rdParty/Boost/src/boost/asio/ip/impl/address_v6.hpp b/3rdParty/Boost/src/boost/asio/ip/impl/address_v6.hpp index 11e1797..6993ef0 100644 --- a/3rdParty/Boost/src/boost/asio/ip/impl/address_v6.hpp +++ b/3rdParty/Boost/src/boost/asio/ip/impl/address_v6.hpp @@ -2,7 +2,7 @@ // ip/impl/address_v6.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/ip/impl/address_v6.ipp b/3rdParty/Boost/src/boost/asio/ip/impl/address_v6.ipp index 5a3dddd..9bf9e96 100644 --- a/3rdParty/Boost/src/boost/asio/ip/impl/address_v6.ipp +++ b/3rdParty/Boost/src/boost/asio/ip/impl/address_v6.ipp @@ -2,7 +2,7 @@ // ip/impl/address_v6.ipp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -32,15 +32,14 @@ namespace asio { namespace ip { address_v6::address_v6() - : scope_id_(0) + : addr_(), + scope_id_(0) { - boost::asio::detail::in6_addr_type tmp_addr = IN6ADDR_ANY_INIT; - addr_ = tmp_addr; } address_v6::address_v6(const address_v6::bytes_type& bytes, - unsigned long scope_id) - : scope_id_(scope_id) + unsigned long scope) + : scope_id_(scope) { #if UCHAR_MAX > 0xFF for (std::size_t i = 0; i < bytes.size(); ++i) @@ -54,7 +53,7 @@ address_v6::address_v6(const address_v6::bytes_type& bytes, #endif // UCHAR_MAX > 0xFF using namespace std; // For memcpy. - memcpy(addr_.s6_addr, bytes.elems, 16); + memcpy(addr_.s6_addr, bytes.data(), 16); } address_v6::address_v6(const address_v6& other) @@ -63,6 +62,14 @@ address_v6::address_v6(const address_v6& other) { } +#if defined(BOOST_ASIO_HAS_MOVE) +address_v6::address_v6(address_v6&& other) + : addr_(other.addr_), + scope_id_(other.scope_id_) +{ +} +#endif // defined(BOOST_ASIO_HAS_MOVE) + address_v6& address_v6::operator=(const address_v6& other) { addr_ = other.addr_; @@ -70,11 +77,24 @@ address_v6& address_v6::operator=(const address_v6& other) return *this; } +#if defined(BOOST_ASIO_HAS_MOVE) +address_v6& address_v6::operator=(address_v6&& other) +{ + addr_ = other.addr_; + scope_id_ = other.scope_id_; + return *this; +} +#endif // defined(BOOST_ASIO_HAS_MOVE) + address_v6::bytes_type address_v6::to_bytes() const { using namespace std; // For memcpy. bytes_type bytes; +#if defined(BOOST_ASIO_HAS_STD_ARRAY) + memcpy(bytes.data(), addr_.s6_addr, 16); +#else // defined(BOOST_ASIO_HAS_STD_ARRAY) memcpy(bytes.elems, addr_.s6_addr, 16); +#endif // defined(BOOST_ASIO_HAS_STD_ARRAY) return bytes; } @@ -141,7 +161,6 @@ address_v4 address_v6::to_v4() const bool address_v6::is_loopback() const { -#if defined(__BORLANDC__) return ((addr_.s6_addr[0] == 0) && (addr_.s6_addr[1] == 0) && (addr_.s6_addr[2] == 0) && (addr_.s6_addr[3] == 0) && (addr_.s6_addr[4] == 0) && (addr_.s6_addr[5] == 0) @@ -150,15 +169,10 @@ bool address_v6::is_loopback() const && (addr_.s6_addr[10] == 0) && (addr_.s6_addr[11] == 0) && (addr_.s6_addr[12] == 0) && (addr_.s6_addr[13] == 0) && (addr_.s6_addr[14] == 0) && (addr_.s6_addr[15] == 1)); -#else - using namespace boost::asio::detail; - return IN6_IS_ADDR_LOOPBACK(&addr_) != 0; -#endif } bool address_v6::is_unspecified() const { -#if defined(__BORLANDC__) return ((addr_.s6_addr[0] == 0) && (addr_.s6_addr[1] == 0) && (addr_.s6_addr[2] == 0) && (addr_.s6_addr[3] == 0) && (addr_.s6_addr[4] == 0) && (addr_.s6_addr[5] == 0) @@ -167,70 +181,70 @@ bool address_v6::is_unspecified() const && (addr_.s6_addr[10] == 0) && (addr_.s6_addr[11] == 0) && (addr_.s6_addr[12] == 0) && (addr_.s6_addr[13] == 0) && (addr_.s6_addr[14] == 0) && (addr_.s6_addr[15] == 0)); -#else - using namespace boost::asio::detail; - return IN6_IS_ADDR_UNSPECIFIED(&addr_) != 0; -#endif } bool address_v6::is_link_local() const { - using namespace boost::asio::detail; - return IN6_IS_ADDR_LINKLOCAL(&addr_) != 0; + return ((addr_.s6_addr[0] == 0xfe) && ((addr_.s6_addr[1] & 0xc0) == 0x80)); } bool address_v6::is_site_local() const { - using namespace boost::asio::detail; - return IN6_IS_ADDR_SITELOCAL(&addr_) != 0; + return ((addr_.s6_addr[0] == 0xfe) && ((addr_.s6_addr[1] & 0xc0) == 0xc0)); } bool address_v6::is_v4_mapped() const { - using namespace boost::asio::detail; - return IN6_IS_ADDR_V4MAPPED(&addr_) != 0; + return ((addr_.s6_addr[0] == 0) && (addr_.s6_addr[1] == 0) + && (addr_.s6_addr[2] == 0) && (addr_.s6_addr[3] == 0) + && (addr_.s6_addr[4] == 0) && (addr_.s6_addr[5] == 0) + && (addr_.s6_addr[6] == 0) && (addr_.s6_addr[7] == 0) + && (addr_.s6_addr[8] == 0) && (addr_.s6_addr[9] == 0) + && (addr_.s6_addr[10] == 0xff) && (addr_.s6_addr[11] == 0xff)); } bool address_v6::is_v4_compatible() const { - using namespace boost::asio::detail; - return IN6_IS_ADDR_V4COMPAT(&addr_) != 0; + return ((addr_.s6_addr[0] == 0) && (addr_.s6_addr[1] == 0) + && (addr_.s6_addr[2] == 0) && (addr_.s6_addr[3] == 0) + && (addr_.s6_addr[4] == 0) && (addr_.s6_addr[5] == 0) + && (addr_.s6_addr[6] == 0) && (addr_.s6_addr[7] == 0) + && (addr_.s6_addr[8] == 0) && (addr_.s6_addr[9] == 0) + && (addr_.s6_addr[10] == 0) && (addr_.s6_addr[11] == 0) + && !((addr_.s6_addr[12] == 0) + && (addr_.s6_addr[13] == 0) + && (addr_.s6_addr[14] == 0) + && ((addr_.s6_addr[15] == 0) || (addr_.s6_addr[15] == 1)))); } bool address_v6::is_multicast() const { - using namespace boost::asio::detail; - return IN6_IS_ADDR_MULTICAST(&addr_) != 0; + return (addr_.s6_addr[0] == 0xff); } bool address_v6::is_multicast_global() const { - using namespace boost::asio::detail; - return IN6_IS_ADDR_MC_GLOBAL(&addr_) != 0; + return ((addr_.s6_addr[0] == 0xff) && ((addr_.s6_addr[1] & 0x0f) == 0x0e)); } bool address_v6::is_multicast_link_local() const { - using namespace boost::asio::detail; - return IN6_IS_ADDR_MC_LINKLOCAL(&addr_) != 0; + return ((addr_.s6_addr[0] == 0xff) && ((addr_.s6_addr[1] & 0x0f) == 0x02)); } bool address_v6::is_multicast_node_local() const { - using namespace boost::asio::detail; - return IN6_IS_ADDR_MC_NODELOCAL(&addr_) != 0; + return ((addr_.s6_addr[0] == 0xff) && ((addr_.s6_addr[1] & 0x0f) == 0x01)); } bool address_v6::is_multicast_org_local() const { - using namespace boost::asio::detail; - return IN6_IS_ADDR_MC_ORGLOCAL(&addr_) != 0; + return ((addr_.s6_addr[0] == 0xff) && ((addr_.s6_addr[1] & 0x0f) == 0x08)); } bool address_v6::is_multicast_site_local() const { - using namespace boost::asio::detail; - return IN6_IS_ADDR_MC_SITELOCAL(&addr_) != 0; + return ((addr_.s6_addr[0] == 0xff) && ((addr_.s6_addr[1] & 0x0f) == 0x05)); } bool operator==(const address_v6& a1, const address_v6& a2) @@ -256,8 +270,7 @@ bool operator<(const address_v6& a1, const address_v6& a2) address_v6 address_v6::loopback() { address_v6 tmp; - boost::asio::detail::in6_addr_type tmp_addr = IN6ADDR_LOOPBACK_INIT; - tmp.addr_ = tmp_addr; + tmp.addr_.s6_addr[15] = 1; return tmp; } diff --git a/3rdParty/Boost/src/boost/asio/ip/impl/basic_endpoint.hpp b/3rdParty/Boost/src/boost/asio/ip/impl/basic_endpoint.hpp index 9d39c87..681d76e 100644 --- a/3rdParty/Boost/src/boost/asio/ip/impl/basic_endpoint.hpp +++ b/3rdParty/Boost/src/boost/asio/ip/impl/basic_endpoint.hpp @@ -2,7 +2,7 @@ // ip/impl/basic_endpoint.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/ip/impl/host_name.ipp b/3rdParty/Boost/src/boost/asio/ip/impl/host_name.ipp index 734341e..cbac039 100644 --- a/3rdParty/Boost/src/boost/asio/ip/impl/host_name.ipp +++ b/3rdParty/Boost/src/boost/asio/ip/impl/host_name.ipp @@ -2,7 +2,7 @@ // ip/impl/host_name.ipp // ~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/ip/multicast.hpp b/3rdParty/Boost/src/boost/asio/ip/multicast.hpp index 2a02627..a0a3c41 100644 --- a/3rdParty/Boost/src/boost/asio/ip/multicast.hpp +++ b/3rdParty/Boost/src/boost/asio/ip/multicast.hpp @@ -2,7 +2,7 @@ // ip/multicast.hpp // ~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/ip/resolver_query_base.hpp b/3rdParty/Boost/src/boost/asio/ip/resolver_query_base.hpp index 96ad512..4e281a6 100644 --- a/3rdParty/Boost/src/boost/asio/ip/resolver_query_base.hpp +++ b/3rdParty/Boost/src/boost/asio/ip/resolver_query_base.hpp @@ -2,7 +2,7 @@ // ip/resolver_query_base.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/ip/resolver_service.hpp b/3rdParty/Boost/src/boost/asio/ip/resolver_service.hpp index db0554b..74915d2 100644 --- a/3rdParty/Boost/src/boost/asio/ip/resolver_service.hpp +++ b/3rdParty/Boost/src/boost/asio/ip/resolver_service.hpp @@ -2,7 +2,7 @@ // ip/resolver_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -77,12 +77,6 @@ public: { } - /// Destroy all user-defined handler objects owned by the service. - void shutdown_service() - { - service_impl_.shutdown_service(); - } - /// Construct a new resolver implementation. void construct(implementation_type& impl) { @@ -109,11 +103,12 @@ public: } /// Asynchronously resolve a query to a list of entries. - template <typename Handler> + template <typename ResolveHandler> void async_resolve(implementation_type& impl, const query_type& query, - Handler handler) + BOOST_ASIO_MOVE_ARG(ResolveHandler) handler) { - service_impl_.async_resolve(impl, query, handler); + service_impl_.async_resolve(impl, query, + BOOST_ASIO_MOVE_CAST(ResolveHandler)(handler)); } /// Resolve an endpoint to a list of entries. @@ -126,12 +121,25 @@ public: /// Asynchronously resolve an endpoint to a list of entries. template <typename ResolveHandler> void async_resolve(implementation_type& impl, const endpoint_type& endpoint, - ResolveHandler handler) + BOOST_ASIO_MOVE_ARG(ResolveHandler) handler) { - return service_impl_.async_resolve(impl, endpoint, handler); + return service_impl_.async_resolve(impl, endpoint, + BOOST_ASIO_MOVE_CAST(ResolveHandler)(handler)); } private: + // Destroy all user-defined handler objects owned by the service. + void shutdown_service() + { + service_impl_.shutdown_service(); + } + + // Perform any fork-related housekeeping. + void fork_service(boost::asio::io_service::fork_event event) + { + service_impl_.fork_service(event); + } + // The platform-specific implementation. service_impl_type service_impl_; }; diff --git a/3rdParty/Boost/src/boost/asio/ip/tcp.hpp b/3rdParty/Boost/src/boost/asio/ip/tcp.hpp index 4163a8d..0256e6f 100644 --- a/3rdParty/Boost/src/boost/asio/ip/tcp.hpp +++ b/3rdParty/Boost/src/boost/asio/ip/tcp.hpp @@ -2,7 +2,7 @@ // ip/tcp.hpp // ~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -49,12 +49,6 @@ public: /// The type of a TCP endpoint. typedef basic_endpoint<tcp> endpoint; - /// (Deprecated: use resolver::query.) The type of a resolver query. - typedef basic_resolver_query<tcp> resolver_query; - - /// (Deprecated: use resolver::iterator.) The type of a resolver iterator. - typedef basic_resolver_iterator<tcp> resolver_iterator; - /// Construct to represent the IPv4 TCP protocol. static tcp v4() { @@ -146,8 +140,8 @@ public: private: // Construct with a specific family. - explicit tcp(int family) - : family_(family) + explicit tcp(int protocol_family) + : family_(protocol_family) { } diff --git a/3rdParty/Boost/src/boost/asio/ip/udp.hpp b/3rdParty/Boost/src/boost/asio/ip/udp.hpp index 40f5d3a..acf61ef 100644 --- a/3rdParty/Boost/src/boost/asio/ip/udp.hpp +++ b/3rdParty/Boost/src/boost/asio/ip/udp.hpp @@ -2,7 +2,7 @@ // ip/udp.hpp // ~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -46,12 +46,6 @@ public: /// The type of a UDP endpoint. typedef basic_endpoint<udp> endpoint; - /// (Deprecated: use resolver::query.) The type of a resolver query. - typedef basic_resolver_query<udp> resolver_query; - - /// (Deprecated: use resolver::iterator.) The type of a resolver iterator. - typedef basic_resolver_iterator<udp> resolver_iterator; - /// Construct to represent the IPv4 UDP protocol. static udp v4() { @@ -102,8 +96,8 @@ public: private: // Construct with a specific family. - explicit udp(int family) - : family_(family) + explicit udp(int protocol_family) + : family_(protocol_family) { } diff --git a/3rdParty/Boost/src/boost/asio/ip/unicast.hpp b/3rdParty/Boost/src/boost/asio/ip/unicast.hpp index dc7d8e9..5ff0dc8 100644 --- a/3rdParty/Boost/src/boost/asio/ip/unicast.hpp +++ b/3rdParty/Boost/src/boost/asio/ip/unicast.hpp @@ -2,7 +2,7 @@ // ip/unicast.hpp // ~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/ip/v6_only.hpp b/3rdParty/Boost/src/boost/asio/ip/v6_only.hpp index e67a548..0441991 100644 --- a/3rdParty/Boost/src/boost/asio/ip/v6_only.hpp +++ b/3rdParty/Boost/src/boost/asio/ip/v6_only.hpp @@ -2,7 +2,7 @@ // ip/v6_only.hpp // ~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/is_read_buffered.hpp b/3rdParty/Boost/src/boost/asio/is_read_buffered.hpp index 1aac50f..8ad32e4 100644 --- a/3rdParty/Boost/src/boost/asio/is_read_buffered.hpp +++ b/3rdParty/Boost/src/boost/asio/is_read_buffered.hpp @@ -2,7 +2,7 @@ // is_read_buffered.hpp // ~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/is_write_buffered.hpp b/3rdParty/Boost/src/boost/asio/is_write_buffered.hpp index 03de0f1..bbc2e22 100644 --- a/3rdParty/Boost/src/boost/asio/is_write_buffered.hpp +++ b/3rdParty/Boost/src/boost/asio/is_write_buffered.hpp @@ -2,7 +2,7 @@ // is_write_buffered.hpp // ~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/local/basic_endpoint.hpp b/3rdParty/Boost/src/boost/asio/local/basic_endpoint.hpp index fcb53a0..f191dd6 100644 --- a/3rdParty/Boost/src/boost/asio/local/basic_endpoint.hpp +++ b/3rdParty/Boost/src/boost/asio/local/basic_endpoint.hpp @@ -2,7 +2,7 @@ // local/basic_endpoint.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) // Derived from a public domain implementation written by Daniel Casimiro. // // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -66,14 +66,14 @@ public: } /// Construct an endpoint using the specified path name. - basic_endpoint(const char* path) - : impl_(path) + basic_endpoint(const char* path_name) + : impl_(path_name) { } /// Construct an endpoint using the specified path name. - basic_endpoint(const std::string& path) - : impl_(path) + basic_endpoint(const std::string& path_name) + : impl_(path_name) { } @@ -83,6 +83,14 @@ public: { } +#if defined(BOOST_ASIO_HAS_MOVE) + /// Move constructor. + basic_endpoint(basic_endpoint&& other) + : impl_(other.impl_) + { + } +#endif // defined(BOOST_ASIO_HAS_MOVE) + /// Assign from another endpoint. basic_endpoint& operator=(const basic_endpoint& other) { @@ -90,6 +98,15 @@ public: return *this; } +#if defined(BOOST_ASIO_HAS_MOVE) + /// Move-assign from another endpoint. + basic_endpoint& operator=(basic_endpoint&& other) + { + impl_ = other.impl_; + return *this; + } +#endif // defined(BOOST_ASIO_HAS_MOVE) + /// The protocol associated with the endpoint. protocol_type protocol() const { @@ -115,9 +132,9 @@ public: } /// Set the underlying size of the endpoint in the native type. - void resize(std::size_t size) + void resize(std::size_t new_size) { - impl_.resize(size); + impl_.resize(new_size); } /// Get the capacity of the endpoint in the native type. diff --git a/3rdParty/Boost/src/boost/asio/local/connect_pair.hpp b/3rdParty/Boost/src/boost/asio/local/connect_pair.hpp index 9ef6cd3..e691398 100644 --- a/3rdParty/Boost/src/boost/asio/local/connect_pair.hpp +++ b/3rdParty/Boost/src/boost/asio/local/connect_pair.hpp @@ -2,7 +2,7 @@ // local/connect_pair.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -52,7 +52,7 @@ inline void connect_pair( { boost::system::error_code ec; connect_pair(socket1, socket2, ec); - boost::asio::detail::throw_error(ec); + boost::asio::detail::throw_error(ec, "connect_pair"); } template <typename Protocol, typename SocketService1, typename SocketService2> diff --git a/3rdParty/Boost/src/boost/asio/local/datagram_protocol.hpp b/3rdParty/Boost/src/boost/asio/local/datagram_protocol.hpp index eaa0241..6fa6323 100644 --- a/3rdParty/Boost/src/boost/asio/local/datagram_protocol.hpp +++ b/3rdParty/Boost/src/boost/asio/local/datagram_protocol.hpp @@ -2,7 +2,7 @@ // local/datagram_protocol.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/local/detail/endpoint.hpp b/3rdParty/Boost/src/boost/asio/local/detail/endpoint.hpp index c527793..998d371 100644 --- a/3rdParty/Boost/src/boost/asio/local/detail/endpoint.hpp +++ b/3rdParty/Boost/src/boost/asio/local/detail/endpoint.hpp @@ -2,7 +2,7 @@ // local/detail/endpoint.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) // Derived from a public domain implementation written by Daniel Casimiro. // // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -39,10 +39,10 @@ public: BOOST_ASIO_DECL endpoint(); // Construct an endpoint using the specified path name. - BOOST_ASIO_DECL endpoint(const char* path); + BOOST_ASIO_DECL endpoint(const char* path_name); // Construct an endpoint using the specified path name. - BOOST_ASIO_DECL endpoint(const std::string& path); + BOOST_ASIO_DECL endpoint(const std::string& path_name); // Copy constructor. endpoint(const endpoint& other) diff --git a/3rdParty/Boost/src/boost/asio/local/detail/impl/endpoint.ipp b/3rdParty/Boost/src/boost/asio/local/detail/impl/endpoint.ipp index a4c1e56..8e3d06a 100644 --- a/3rdParty/Boost/src/boost/asio/local/detail/impl/endpoint.ipp +++ b/3rdParty/Boost/src/boost/asio/local/detail/impl/endpoint.ipp @@ -2,7 +2,7 @@ // local/detail/impl/endpoint.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) // Derived from a public domain implementation written by Daniel Casimiro. // // Distributed under the Boost Software License, Version 1.0. (See accompanying @@ -38,31 +38,31 @@ endpoint::endpoint() init("", 0); } -endpoint::endpoint(const char* path) +endpoint::endpoint(const char* path_name) { using namespace std; // For strlen. - init(path, strlen(path)); + init(path_name, strlen(path_name)); } -endpoint::endpoint(const std::string& path) +endpoint::endpoint(const std::string& path_name) { - init(path.data(), path.length()); + init(path_name.data(), path_name.length()); } -void endpoint::resize(std::size_t size) +void endpoint::resize(std::size_t new_size) { - if (size > sizeof(boost::asio::detail::sockaddr_un_type)) + if (new_size > sizeof(boost::asio::detail::sockaddr_un_type)) { boost::system::error_code ec(boost::asio::error::invalid_argument); boost::asio::detail::throw_error(ec); } - else if (size == 0) + else if (new_size == 0) { path_length_ = 0; } else { - path_length_ = size + path_length_ = new_size - offsetof(boost::asio::detail::sockaddr_un_type, sun_path); // The path returned by the operating system may be NUL-terminated. @@ -97,7 +97,7 @@ bool operator<(const endpoint& e1, const endpoint& e2) return e1.path() < e2.path(); } -void endpoint::init(const char* path, std::size_t path_length) +void endpoint::init(const char* path_name, std::size_t path_length) { if (path_length > sizeof(data_.local.sun_path) - 1) { @@ -109,7 +109,7 @@ void endpoint::init(const char* path, std::size_t path_length) using namespace std; // For memcpy. data_.local = boost::asio::detail::sockaddr_un_type(); data_.local.sun_family = AF_UNIX; - memcpy(data_.local.sun_path, path, path_length); + memcpy(data_.local.sun_path, path_name, path_length); path_length_ = path_length; // NUL-terminate normal path names. Names that start with a NUL are in the diff --git a/3rdParty/Boost/src/boost/asio/local/stream_protocol.hpp b/3rdParty/Boost/src/boost/asio/local/stream_protocol.hpp index e8692c5..c747666 100644 --- a/3rdParty/Boost/src/boost/asio/local/stream_protocol.hpp +++ b/3rdParty/Boost/src/boost/asio/local/stream_protocol.hpp @@ -2,7 +2,7 @@ // local/stream_protocol.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/placeholders.hpp b/3rdParty/Boost/src/boost/asio/placeholders.hpp index 19ddb66..d4bf743 100644 --- a/3rdParty/Boost/src/boost/asio/placeholders.hpp +++ b/3rdParty/Boost/src/boost/asio/placeholders.hpp @@ -2,7 +2,7 @@ // placeholders.hpp // ~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -42,6 +42,11 @@ unspecified bytes_transferred; /// boost::asio::basic_resolver::async_resolve. unspecified iterator; +/// An argument placeholder, for use with boost::bind(), that corresponds to +/// the signal_number argument of a handler for asynchronous functions such as +/// boost::asio::signal_set::async_wait. +unspecified signal_number; + #elif defined(__BORLANDC__) || defined(__GNUC__) inline boost::arg<1> error() @@ -59,6 +64,11 @@ inline boost::arg<2> iterator() return boost::arg<2>(); } +inline boost::arg<2> signal_number() +{ + return boost::arg<2>(); +} + #else namespace detail @@ -82,6 +92,8 @@ static boost::arg<2>& bytes_transferred = boost::asio::placeholders::detail::placeholder<2>::get(); static boost::arg<2>& iterator = boost::asio::placeholders::detail::placeholder<2>::get(); +static boost::arg<2>& signal_number + = boost::asio::placeholders::detail::placeholder<2>::get(); #else @@ -93,6 +105,8 @@ namespace = boost::asio::placeholders::detail::placeholder<2>::get(); boost::arg<2>& iterator = boost::asio::placeholders::detail::placeholder<2>::get(); + boost::arg<2>& signal_number + = boost::asio::placeholders::detail::placeholder<2>::get(); } // namespace #endif diff --git a/3rdParty/Boost/src/boost/asio/posix/basic_descriptor.hpp b/3rdParty/Boost/src/boost/asio/posix/basic_descriptor.hpp index cf953db..d4af5a4 100644 --- a/3rdParty/Boost/src/boost/asio/posix/basic_descriptor.hpp +++ b/3rdParty/Boost/src/boost/asio/posix/basic_descriptor.hpp @@ -2,7 +2,7 @@ // posix/basic_descriptor.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -46,8 +46,12 @@ class basic_descriptor public descriptor_base { public: + /// (Deprecated: Use native_handle_type.) The native representation of a + /// descriptor. + typedef typename DescriptorService::native_handle_type native_type; + /// The native representation of a descriptor. - typedef typename DescriptorService::native_type native_type; + typedef typename DescriptorService::native_handle_type native_handle_type; /// A basic_descriptor is always the lowest layer. typedef basic_descriptor<DescriptorService> lowest_layer_type; @@ -79,14 +83,50 @@ public: * @throws boost::system::system_error Thrown on failure. */ basic_descriptor(boost::asio::io_service& io_service, - const native_type& native_descriptor) + const native_handle_type& native_descriptor) : basic_io_object<DescriptorService>(io_service) { boost::system::error_code ec; - this->service.assign(this->implementation, native_descriptor, ec); - boost::asio::detail::throw_error(ec); + this->get_service().assign(this->get_implementation(), + native_descriptor, ec); + boost::asio::detail::throw_error(ec, "assign"); } +#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Move-construct a basic_descriptor from another. + /** + * This constructor moves a descriptor from one object to another. + * + * @param other The other basic_descriptor object from which the move will + * occur. + * + * @note Following the move, the moved-from object is in the same state as if + * constructed using the @c basic_descriptor(io_service&) constructor. + */ + basic_descriptor(basic_descriptor&& other) + : basic_io_object<DescriptorService>( + BOOST_ASIO_MOVE_CAST(basic_descriptor)(other)) + { + } + + /// Move-assign a basic_descriptor from another. + /** + * This assignment operator moves a descriptor from one object to another. + * + * @param other The other basic_descriptor object from which the move will + * occur. + * + * @note Following the move, the moved-from object is in the same state as if + * constructed using the @c basic_descriptor(io_service&) constructor. + */ + basic_descriptor& operator=(basic_descriptor&& other) + { + basic_io_object<DescriptorService>::operator=( + BOOST_ASIO_MOVE_CAST(basic_descriptor)(other)); + return *this; + } +#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Get a reference to the lowest layer. /** * This function returns a reference to the lowest layer in a stack of @@ -123,11 +163,12 @@ public: * * @throws boost::system::system_error Thrown on failure. */ - void assign(const native_type& native_descriptor) + void assign(const native_handle_type& native_descriptor) { boost::system::error_code ec; - this->service.assign(this->implementation, native_descriptor, ec); - boost::asio::detail::throw_error(ec); + this->get_service().assign(this->get_implementation(), + native_descriptor, ec); + boost::asio::detail::throw_error(ec, "assign"); } /// Assign an existing native descriptor to the descriptor. @@ -138,16 +179,17 @@ public: * * @param ec Set to indicate what error occurred, if any. */ - boost::system::error_code assign(const native_type& native_descriptor, + boost::system::error_code assign(const native_handle_type& native_descriptor, boost::system::error_code& ec) { - return this->service.assign(this->implementation, native_descriptor, ec); + return this->get_service().assign( + this->get_implementation(), native_descriptor, ec); } /// Determine whether the descriptor is open. bool is_open() const { - return this->service.is_open(this->implementation); + return this->get_service().is_open(this->implementation); } /// Close the descriptor. @@ -156,13 +198,14 @@ public: * write operations will be cancelled immediately, and will complete with the * boost::asio::error::operation_aborted error. * - * @throws boost::system::system_error Thrown on failure. + * @throws boost::system::system_error Thrown on failure. Note that, even if + * the function indicates an error, the underlying descriptor is closed. */ void close() { boost::system::error_code ec; - this->service.close(this->implementation, ec); - boost::asio::detail::throw_error(ec); + this->get_service().close(this->get_implementation(), ec); + boost::asio::detail::throw_error(ec, "close"); } /// Close the descriptor. @@ -171,14 +214,16 @@ public: * write operations will be cancelled immediately, and will complete with the * boost::asio::error::operation_aborted error. * - * @param ec Set to indicate what error occurred, if any. + * @param ec Set to indicate what error occurred, if any. Note that, even if + * the function indicates an error, the underlying descriptor is closed. */ boost::system::error_code close(boost::system::error_code& ec) { - return this->service.close(this->implementation, ec); + return this->get_service().close(this->get_implementation(), ec); } - /// Get the native descriptor representation. + /// (Deprecated: Use native_handle().) Get the native descriptor + /// representation. /** * This function may be used to obtain the underlying representation of the * descriptor. This is intended to allow access to native descriptor @@ -186,7 +231,33 @@ public: */ native_type native() { - return this->service.native(this->implementation); + return this->get_service().native_handle(this->implementation); + } + + /// Get the native descriptor representation. + /** + * This function may be used to obtain the underlying representation of the + * descriptor. This is intended to allow access to native descriptor + * functionality that is not otherwise provided. + */ + native_handle_type native_handle() + { + return this->get_service().native_handle(this->implementation); + } + + /// Release ownership of the native descriptor implementation. + /** + * This function may be used to obtain the underlying representation of the + * descriptor. After calling this function, @c is_open() returns false. The + * caller is responsible for closing the descriptor. + * + * All outstanding asynchronous read or write operations will finish + * immediately, and the handlers for cancelled operations will be passed the + * boost::asio::error::operation_aborted error. + */ + native_handle_type release() + { + return this->get_service().release(this->implementation); } /// Cancel all asynchronous operations associated with the descriptor. @@ -200,8 +271,8 @@ public: void cancel() { boost::system::error_code ec; - this->service.cancel(this->implementation, ec); - boost::asio::detail::throw_error(ec); + this->get_service().cancel(this->get_implementation(), ec); + boost::asio::detail::throw_error(ec, "cancel"); } /// Cancel all asynchronous operations associated with the descriptor. @@ -214,7 +285,7 @@ public: */ boost::system::error_code cancel(boost::system::error_code& ec) { - return this->service.cancel(this->implementation, ec); + return this->get_service().cancel(this->get_implementation(), ec); } /// Perform an IO control command on the descriptor. @@ -243,8 +314,8 @@ public: void io_control(IoControlCommand& command) { boost::system::error_code ec; - this->service.io_control(this->implementation, command, ec); - boost::asio::detail::throw_error(ec); + this->get_service().io_control(this->get_implementation(), command, ec); + boost::asio::detail::throw_error(ec, "io_control"); } /// Perform an IO control command on the descriptor. @@ -278,7 +349,128 @@ public: boost::system::error_code io_control(IoControlCommand& command, boost::system::error_code& ec) { - return this->service.io_control(this->implementation, command, ec); + return this->get_service().io_control( + this->get_implementation(), command, ec); + } + + /// Gets the non-blocking mode of the descriptor. + /** + * @returns @c true if the descriptor's synchronous operations will fail with + * boost::asio::error::would_block if they are unable to perform the requested + * operation immediately. If @c false, synchronous operations will block + * until complete. + * + * @note The non-blocking mode has no effect on the behaviour of asynchronous + * operations. Asynchronous operations will never fail with the error + * boost::asio::error::would_block. + */ + bool non_blocking() const + { + return this->get_service().non_blocking(this->implementation); + } + + /// Sets the non-blocking mode of the descriptor. + /** + * @param mode If @c true, the descriptor's synchronous operations will fail + * with boost::asio::error::would_block if they are unable to perform the + * requested operation immediately. If @c false, synchronous operations will + * block until complete. + * + * @throws boost::system::system_error Thrown on failure. + * + * @note The non-blocking mode has no effect on the behaviour of asynchronous + * operations. Asynchronous operations will never fail with the error + * boost::asio::error::would_block. + */ + void non_blocking(bool mode) + { + boost::system::error_code ec; + this->get_service().non_blocking(this->get_implementation(), mode, ec); + boost::asio::detail::throw_error(ec, "non_blocking"); + } + + /// Sets the non-blocking mode of the descriptor. + /** + * @param mode If @c true, the descriptor's synchronous operations will fail + * with boost::asio::error::would_block if they are unable to perform the + * requested operation immediately. If @c false, synchronous operations will + * block until complete. + * + * @param ec Set to indicate what error occurred, if any. + * + * @note The non-blocking mode has no effect on the behaviour of asynchronous + * operations. Asynchronous operations will never fail with the error + * boost::asio::error::would_block. + */ + boost::system::error_code non_blocking( + bool mode, boost::system::error_code& ec) + { + return this->get_service().non_blocking( + this->get_implementation(), mode, ec); + } + + /// Gets the non-blocking mode of the native descriptor implementation. + /** + * This function is used to retrieve the non-blocking mode of the underlying + * native descriptor. This mode has no effect on the behaviour of the + * descriptor object's synchronous operations. + * + * @returns @c true if the underlying descriptor is in non-blocking mode and + * direct system calls may fail with boost::asio::error::would_block (or the + * equivalent system error). + * + * @note The current non-blocking mode is cached by the descriptor object. + * Consequently, the return value may be incorrect if the non-blocking mode + * was set directly on the native descriptor. + */ + bool native_non_blocking() const + { + return this->get_service().native_non_blocking(this->implementation); + } + + /// Sets the non-blocking mode of the native descriptor implementation. + /** + * This function is used to modify the non-blocking mode of the underlying + * native descriptor. It has no effect on the behaviour of the descriptor + * object's synchronous operations. + * + * @param mode If @c true, the underlying descriptor is put into non-blocking + * mode and direct system calls may fail with boost::asio::error::would_block + * (or the equivalent system error). + * + * @throws boost::system::system_error Thrown on failure. If the @c mode is + * @c false, but the current value of @c non_blocking() is @c true, this + * function fails with boost::asio::error::invalid_argument, as the + * combination does not make sense. + */ + void native_non_blocking(bool mode) + { + boost::system::error_code ec; + this->get_service().native_non_blocking( + this->get_implementation(), mode, ec); + boost::asio::detail::throw_error(ec, "native_non_blocking"); + } + + /// Sets the non-blocking mode of the native descriptor implementation. + /** + * This function is used to modify the non-blocking mode of the underlying + * native descriptor. It has no effect on the behaviour of the descriptor + * object's synchronous operations. + * + * @param mode If @c true, the underlying descriptor is put into non-blocking + * mode and direct system calls may fail with boost::asio::error::would_block + * (or the equivalent system error). + * + * @param ec Set to indicate what error occurred, if any. If the @c mode is + * @c false, but the current value of @c non_blocking() is @c true, this + * function fails with boost::asio::error::invalid_argument, as the + * combination does not make sense. + */ + boost::system::error_code native_non_blocking( + bool mode, boost::system::error_code& ec) + { + return this->get_service().native_non_blocking( + this->get_implementation(), mode, ec); } protected: diff --git a/3rdParty/Boost/src/boost/asio/posix/basic_stream_descriptor.hpp b/3rdParty/Boost/src/boost/asio/posix/basic_stream_descriptor.hpp index ee08567..2e8ed4b 100644 --- a/3rdParty/Boost/src/boost/asio/posix/basic_stream_descriptor.hpp +++ b/3rdParty/Boost/src/boost/asio/posix/basic_stream_descriptor.hpp @@ -2,7 +2,7 @@ // posix/basic_stream_descriptor.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -21,6 +21,7 @@ || defined(GENERATING_DOCUMENTATION) #include <cstddef> +#include <boost/asio/detail/handler_type_requirements.hpp> #include <boost/asio/detail/throw_error.hpp> #include <boost/asio/error.hpp> #include <boost/asio/posix/basic_descriptor.hpp> @@ -49,8 +50,13 @@ class basic_stream_descriptor : public basic_descriptor<StreamDescriptorService> { public: + /// (Deprecated: Use native_handle_type.) The native representation of a + /// descriptor. + typedef typename StreamDescriptorService::native_handle_type native_type; + /// The native representation of a descriptor. - typedef typename StreamDescriptorService::native_type native_type; + typedef typename StreamDescriptorService::native_handle_type + native_handle_type; /// Construct a basic_stream_descriptor without opening it. /** @@ -81,11 +87,47 @@ public: * @throws boost::system::system_error Thrown on failure. */ basic_stream_descriptor(boost::asio::io_service& io_service, - const native_type& native_descriptor) + const native_handle_type& native_descriptor) : basic_descriptor<StreamDescriptorService>(io_service, native_descriptor) { } +#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Move-construct a basic_stream_descriptor from another. + /** + * This constructor moves a stream descriptor from one object to another. + * + * @param other The other basic_stream_descriptor object from which the move + * will occur. + * + * @note Following the move, the moved-from object is in the same state as if + * constructed using the @c basic_stream_descriptor(io_service&) constructor. + */ + basic_stream_descriptor(basic_stream_descriptor&& other) + : basic_descriptor<StreamDescriptorService>( + BOOST_ASIO_MOVE_CAST(basic_stream_descriptor)(other)) + { + } + + /// Move-assign a basic_stream_descriptor from another. + /** + * This assignment operator moves a stream descriptor from one object to + * another. + * + * @param other The other basic_stream_descriptor object from which the move + * will occur. + * + * @note Following the move, the moved-from object is in the same state as if + * constructed using the @c basic_stream_descriptor(io_service&) constructor. + */ + basic_stream_descriptor& operator=(basic_stream_descriptor&& other) + { + basic_descriptor<StreamDescriptorService>::operator=( + BOOST_ASIO_MOVE_CAST(basic_stream_descriptor)(other)); + return *this; + } +#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Write some data to the descriptor. /** * This function is used to write data to the stream descriptor. The function @@ -117,8 +159,9 @@ public: std::size_t write_some(const ConstBufferSequence& buffers) { boost::system::error_code ec; - std::size_t s = this->service.write_some(this->implementation, buffers, ec); - boost::asio::detail::throw_error(ec); + std::size_t s = this->get_service().write_some( + this->get_implementation(), buffers, ec); + boost::asio::detail::throw_error(ec, "write_some"); return s; } @@ -142,7 +185,8 @@ public: std::size_t write_some(const ConstBufferSequence& buffers, boost::system::error_code& ec) { - return this->service.write_some(this->implementation, buffers, ec); + return this->get_service().write_some( + this->get_implementation(), buffers, ec); } /// Start an asynchronous write. @@ -182,9 +226,14 @@ public: */ template <typename ConstBufferSequence, typename WriteHandler> void async_write_some(const ConstBufferSequence& buffers, - WriteHandler handler) + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { - this->service.async_write_some(this->implementation, buffers, handler); + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a WriteHandler. + BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; + + this->get_service().async_write_some(this->get_implementation(), + buffers, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); } /// Read some data from the descriptor. @@ -219,8 +268,9 @@ public: std::size_t read_some(const MutableBufferSequence& buffers) { boost::system::error_code ec; - std::size_t s = this->service.read_some(this->implementation, buffers, ec); - boost::asio::detail::throw_error(ec); + std::size_t s = this->get_service().read_some( + this->get_implementation(), buffers, ec); + boost::asio::detail::throw_error(ec, "read_some"); return s; } @@ -245,7 +295,8 @@ public: std::size_t read_some(const MutableBufferSequence& buffers, boost::system::error_code& ec) { - return this->service.read_some(this->implementation, buffers, ec); + return this->get_service().read_some( + this->get_implementation(), buffers, ec); } /// Start an asynchronous read. @@ -286,9 +337,14 @@ public: */ template <typename MutableBufferSequence, typename ReadHandler> void async_read_some(const MutableBufferSequence& buffers, - ReadHandler handler) + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { - this->service.async_read_some(this->implementation, buffers, handler); + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a ReadHandler. + BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; + + this->get_service().async_read_some(this->get_implementation(), + buffers, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); } }; diff --git a/3rdParty/Boost/src/boost/asio/posix/descriptor_base.hpp b/3rdParty/Boost/src/boost/asio/posix/descriptor_base.hpp index 2e5cb47..c75b85a 100644 --- a/3rdParty/Boost/src/boost/asio/posix/descriptor_base.hpp +++ b/3rdParty/Boost/src/boost/asio/posix/descriptor_base.hpp @@ -2,7 +2,7 @@ // posix/descriptor_base.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -35,7 +35,8 @@ namespace posix { class descriptor_base { public: - /// IO control command to set the blocking mode of the descriptor. + /// (Deprecated: Use non_blocking().) IO control command to set the blocking + /// mode of the descriptor. /** * Implements the FIONBIO IO control command. * diff --git a/3rdParty/Boost/src/boost/asio/posix/stream_descriptor.hpp b/3rdParty/Boost/src/boost/asio/posix/stream_descriptor.hpp index 22551ab..9078107 100644 --- a/3rdParty/Boost/src/boost/asio/posix/stream_descriptor.hpp +++ b/3rdParty/Boost/src/boost/asio/posix/stream_descriptor.hpp @@ -2,7 +2,7 @@ // posix/stream_descriptor.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/posix/stream_descriptor_service.hpp b/3rdParty/Boost/src/boost/asio/posix/stream_descriptor_service.hpp index c582b8e..0daa21a 100644 --- a/3rdParty/Boost/src/boost/asio/posix/stream_descriptor_service.hpp +++ b/3rdParty/Boost/src/boost/asio/posix/stream_descriptor_service.hpp @@ -2,7 +2,7 @@ // posix/stream_descriptor_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -57,11 +57,18 @@ public: typedef service_impl_type::implementation_type implementation_type; #endif - /// The native descriptor type. + /// (Deprecated: Use native_handle_type.) The native descriptor type. #if defined(GENERATING_DOCUMENTATION) typedef implementation_defined native_type; #else - typedef service_impl_type::native_type native_type; + typedef service_impl_type::native_handle_type native_type; +#endif + + /// The native descriptor type. +#if defined(GENERATING_DOCUMENTATION) + typedef implementation_defined native_handle_type; +#else + typedef service_impl_type::native_handle_type native_handle_type; #endif /// Construct a new stream descriptor service for the specified io_service. @@ -71,18 +78,29 @@ public: { } - /// Destroy all user-defined descriptorr objects owned by the service. - void shutdown_service() - { - service_impl_.shutdown_service(); - } - /// Construct a new stream descriptor implementation. void construct(implementation_type& impl) { service_impl_.construct(impl); } +#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Move-construct a new stream descriptor implementation. + void move_construct(implementation_type& impl, + implementation_type& other_impl) + { + service_impl_.move_construct(impl, other_impl); + } + + /// Move-assign from another stream descriptor implementation. + void move_assign(implementation_type& impl, + stream_descriptor_service& other_service, + implementation_type& other_impl) + { + service_impl_.move_assign(impl, other_service.service_impl_, other_impl); + } +#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Destroy a stream descriptor implementation. void destroy(implementation_type& impl) { @@ -91,7 +109,8 @@ public: /// Assign an existing native descriptor to a stream descriptor. boost::system::error_code assign(implementation_type& impl, - const native_type& native_descriptor, boost::system::error_code& ec) + const native_handle_type& native_descriptor, + boost::system::error_code& ec) { return service_impl_.assign(impl, native_descriptor, ec); } @@ -109,10 +128,23 @@ public: return service_impl_.close(impl, ec); } - /// Get the native descriptor implementation. + /// (Deprecated: Use native_handle().) Get the native descriptor + /// implementation. native_type native(implementation_type& impl) { - return service_impl_.native(impl); + return service_impl_.native_handle(impl); + } + + /// Get the native descriptor implementation. + native_handle_type native_handle(implementation_type& impl) + { + return service_impl_.native_handle(impl); + } + + /// Release ownership of the native descriptor implementation. + native_handle_type release(implementation_type& impl) + { + return service_impl_.release(impl); } /// Cancel all asynchronous operations associated with the descriptor. @@ -130,6 +162,32 @@ public: return service_impl_.io_control(impl, command, ec); } + /// Gets the non-blocking mode of the descriptor. + bool non_blocking(const implementation_type& impl) const + { + return service_impl_.non_blocking(impl); + } + + /// Sets the non-blocking mode of the descriptor. + boost::system::error_code non_blocking(implementation_type& impl, + bool mode, boost::system::error_code& ec) + { + return service_impl_.non_blocking(impl, mode, ec); + } + + /// Gets the non-blocking mode of the native descriptor implementation. + bool native_non_blocking(const implementation_type& impl) const + { + return service_impl_.native_non_blocking(impl); + } + + /// Sets the non-blocking mode of the native descriptor implementation. + boost::system::error_code native_non_blocking(implementation_type& impl, + bool mode, boost::system::error_code& ec) + { + return service_impl_.native_non_blocking(impl, mode, ec); + } + /// Write the given data to the stream. template <typename ConstBufferSequence> std::size_t write_some(implementation_type& impl, @@ -141,9 +199,11 @@ public: /// Start an asynchronous write. template <typename ConstBufferSequence, typename WriteHandler> void async_write_some(implementation_type& impl, - const ConstBufferSequence& buffers, WriteHandler descriptorr) + const ConstBufferSequence& buffers, + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { - service_impl_.async_write_some(impl, buffers, descriptorr); + service_impl_.async_write_some(impl, buffers, + BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); } /// Read some data from the stream. @@ -157,12 +217,20 @@ public: /// Start an asynchronous read. template <typename MutableBufferSequence, typename ReadHandler> void async_read_some(implementation_type& impl, - const MutableBufferSequence& buffers, ReadHandler descriptorr) + const MutableBufferSequence& buffers, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { - service_impl_.async_read_some(impl, buffers, descriptorr); + service_impl_.async_read_some(impl, buffers, + BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); } private: + // Destroy all user-defined handler objects owned by the service. + void shutdown_service() + { + service_impl_.shutdown_service(); + } + // The platform-specific implementation. service_impl_type service_impl_; }; diff --git a/3rdParty/Boost/src/boost/asio/raw_socket_service.hpp b/3rdParty/Boost/src/boost/asio/raw_socket_service.hpp index 783c4c2..cd8aa04 100644 --- a/3rdParty/Boost/src/boost/asio/raw_socket_service.hpp +++ b/3rdParty/Boost/src/boost/asio/raw_socket_service.hpp @@ -2,7 +2,7 @@ // raw_socket_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -68,11 +68,18 @@ public: typedef typename service_impl_type::implementation_type implementation_type; #endif - /// The native socket type. + /// (Deprecated: Use native_handle_type.) The native socket type. #if defined(GENERATING_DOCUMENTATION) typedef implementation_defined native_type; #else - typedef typename service_impl_type::native_type native_type; + typedef typename service_impl_type::native_handle_type native_type; +#endif + + /// The native socket type. +#if defined(GENERATING_DOCUMENTATION) + typedef implementation_defined native_handle_type; +#else + typedef typename service_impl_type::native_handle_type native_handle_type; #endif /// Construct a new raw socket service for the specified io_service. @@ -83,18 +90,29 @@ public: { } - /// Destroy all user-defined handler objects owned by the service. - void shutdown_service() - { - service_impl_.shutdown_service(); - } - /// Construct a new raw socket implementation. void construct(implementation_type& impl) { service_impl_.construct(impl); } +#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Move-construct a new raw socket implementation. + void move_construct(implementation_type& impl, + implementation_type& other_impl) + { + service_impl_.move_construct(impl, other_impl); + } + + /// Move-assign from another raw socket implementation. + void move_assign(implementation_type& impl, + raw_socket_service& other_service, + implementation_type& other_impl) + { + service_impl_.move_assign(impl, other_service.service_impl_, other_impl); + } +#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Destroy a raw socket implementation. void destroy(implementation_type& impl) { @@ -114,7 +132,7 @@ public: /// Assign an existing native socket to a raw socket. boost::system::error_code assign(implementation_type& impl, - const protocol_type& protocol, const native_type& native_socket, + const protocol_type& protocol, const native_handle_type& native_socket, boost::system::error_code& ec) { return service_impl_.assign(impl, protocol, native_socket, ec); @@ -133,10 +151,16 @@ public: return service_impl_.close(impl, ec); } - /// Get the native socket implementation. + /// (Deprecated: Use native_handle().) Get the native socket implementation. native_type native(implementation_type& impl) { - return service_impl_.native(impl); + return service_impl_.native_handle(impl); + } + + /// Get the native socket implementation. + native_handle_type native_handle(implementation_type& impl) + { + return service_impl_.native_handle(impl); } /// Cancel all asynchronous operations associated with the socket. @@ -177,9 +201,11 @@ public: /// Start an asynchronous connect. template <typename ConnectHandler> void async_connect(implementation_type& impl, - const endpoint_type& peer_endpoint, ConnectHandler handler) + const endpoint_type& peer_endpoint, + BOOST_ASIO_MOVE_ARG(ConnectHandler) handler) { - service_impl_.async_connect(impl, peer_endpoint, handler); + service_impl_.async_connect(impl, peer_endpoint, + BOOST_ASIO_MOVE_CAST(ConnectHandler)(handler)); } /// Set a socket option. @@ -206,6 +232,32 @@ public: return service_impl_.io_control(impl, command, ec); } + /// Gets the non-blocking mode of the socket. + bool non_blocking(const implementation_type& impl) const + { + return service_impl_.non_blocking(impl); + } + + /// Sets the non-blocking mode of the socket. + boost::system::error_code non_blocking(implementation_type& impl, + bool mode, boost::system::error_code& ec) + { + return service_impl_.non_blocking(impl, mode, ec); + } + + /// Gets the non-blocking mode of the native socket implementation. + bool native_non_blocking(const implementation_type& impl) const + { + return service_impl_.native_non_blocking(impl); + } + + /// Sets the non-blocking mode of the native socket implementation. + boost::system::error_code native_non_blocking(implementation_type& impl, + bool mode, boost::system::error_code& ec) + { + return service_impl_.native_non_blocking(impl, mode, ec); + } + /// Get the local endpoint. endpoint_type local_endpoint(const implementation_type& impl, boost::system::error_code& ec) const @@ -239,9 +291,11 @@ public: /// Start an asynchronous send. template <typename ConstBufferSequence, typename WriteHandler> void async_send(implementation_type& impl, const ConstBufferSequence& buffers, - socket_base::message_flags flags, WriteHandler handler) + socket_base::message_flags flags, + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { - service_impl_.async_send(impl, buffers, flags, handler); + service_impl_.async_send(impl, buffers, flags, + BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); } /// Send raw data to the specified endpoint. @@ -257,9 +311,11 @@ public: template <typename ConstBufferSequence, typename WriteHandler> void async_send_to(implementation_type& impl, const ConstBufferSequence& buffers, const endpoint_type& destination, - socket_base::message_flags flags, WriteHandler handler) + socket_base::message_flags flags, + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { - service_impl_.async_send_to(impl, buffers, destination, flags, handler); + service_impl_.async_send_to(impl, buffers, destination, flags, + BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); } /// Receive some data from the peer. @@ -275,9 +331,11 @@ public: template <typename MutableBufferSequence, typename ReadHandler> void async_receive(implementation_type& impl, const MutableBufferSequence& buffers, - socket_base::message_flags flags, ReadHandler handler) + socket_base::message_flags flags, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { - service_impl_.async_receive(impl, buffers, flags, handler); + service_impl_.async_receive(impl, buffers, flags, + BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); } /// Receive raw data with the endpoint of the sender. @@ -294,13 +352,20 @@ public: template <typename MutableBufferSequence, typename ReadHandler> void async_receive_from(implementation_type& impl, const MutableBufferSequence& buffers, endpoint_type& sender_endpoint, - socket_base::message_flags flags, ReadHandler handler) + socket_base::message_flags flags, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { service_impl_.async_receive_from(impl, buffers, sender_endpoint, flags, - handler); + BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); } private: + // Destroy all user-defined handler objects owned by the service. + void shutdown_service() + { + service_impl_.shutdown_service(); + } + // The platform-specific implementation. service_impl_type service_impl_; }; diff --git a/3rdParty/Boost/src/boost/asio/read.hpp b/3rdParty/Boost/src/boost/asio/read.hpp index fd13e75..937dccd 100644 --- a/3rdParty/Boost/src/boost/asio/read.hpp +++ b/3rdParty/Boost/src/boost/asio/read.hpp @@ -2,7 +2,7 @@ // read.hpp // ~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -80,6 +80,46 @@ std::size_t read(SyncReadStream& s, const MutableBufferSequence& buffers); * @li The supplied buffers are full. That is, the bytes transferred is equal to * the sum of the buffer sizes. * + * @li An error occurred. + * + * This operation is implemented in terms of zero or more calls to the stream's + * read_some function. + * + * @param s The stream from which the data is to be read. The type must support + * the SyncReadStream concept. + * + * @param buffers One or more buffers into which the data will be read. The sum + * of the buffer sizes indicates the maximum number of bytes to read from the + * stream. + * + * @param ec Set to indicate what error occurred, if any. + * + * @returns The number of bytes transferred. + * + * @par Example + * To read into a single data buffer use the @ref buffer function as follows: + * @code boost::asio::read(s, boost::asio::buffer(data, size), ec); @endcode + * See the @ref buffer documentation for information on reading into multiple + * buffers in one go, and how to use it with arrays, boost::array or + * std::vector. + * + * @note This overload is equivalent to calling: + * @code boost::asio::read( + * s, buffers, + * boost::asio::transfer_all(), ec); @endcode + */ +template <typename SyncReadStream, typename MutableBufferSequence> +std::size_t read(SyncReadStream& s, const MutableBufferSequence& buffers, + boost::system::error_code& ec); + +/// Attempt to read a certain amount of data from a stream before returning. +/** + * This function is used to read a certain number of bytes of data from a + * stream. The call will block until one of the following conditions is true: + * + * @li The supplied buffers are full. That is, the bytes transferred is equal to + * the sum of the buffer sizes. + * * @li The completion_condition function object returns 0. * * This operation is implemented in terms of zero or more calls to the stream's @@ -174,6 +214,8 @@ std::size_t read(SyncReadStream& s, const MutableBufferSequence& buffers, * This function is used to read a certain number of bytes of data from a * stream. The call will block until one of the following conditions is true: * + * @li The supplied buffer is full (that is, it has reached maximum size). + * * @li An error occurred. * * This operation is implemented in terms of zero or more calls to the stream's @@ -201,6 +243,38 @@ std::size_t read(SyncReadStream& s, basic_streambuf<Allocator>& b); * This function is used to read a certain number of bytes of data from a * stream. The call will block until one of the following conditions is true: * + * @li The supplied buffer is full (that is, it has reached maximum size). + * + * @li An error occurred. + * + * This operation is implemented in terms of zero or more calls to the stream's + * read_some function. + * + * @param s The stream from which the data is to be read. The type must support + * the SyncReadStream concept. + * + * @param b The basic_streambuf object into which the data will be read. + * + * @param ec Set to indicate what error occurred, if any. + * + * @returns The number of bytes transferred. + * + * @note This overload is equivalent to calling: + * @code boost::asio::read( + * s, b, + * boost::asio::transfer_all(), ec); @endcode + */ +template <typename SyncReadStream, typename Allocator> +std::size_t read(SyncReadStream& s, basic_streambuf<Allocator>& b, + boost::system::error_code& ec); + +/// Attempt to read a certain amount of data from a stream before returning. +/** + * This function is used to read a certain number of bytes of data from a + * stream. The call will block until one of the following conditions is true: + * + * @li The supplied buffer is full (that is, it has reached maximum size). + * * @li The completion_condition function object returns 0. * * This operation is implemented in terms of zero or more calls to the stream's @@ -239,6 +313,8 @@ std::size_t read(SyncReadStream& s, basic_streambuf<Allocator>& b, * This function is used to read a certain number of bytes of data from a * stream. The call will block until one of the following conditions is true: * + * @li The supplied buffer is full (that is, it has reached maximum size). + * * @li The completion_condition function object returns 0. * * This operation is implemented in terms of zero or more calls to the stream's @@ -347,7 +423,7 @@ std::size_t read(SyncReadStream& s, basic_streambuf<Allocator>& b, template <typename AsyncReadStream, typename MutableBufferSequence, typename ReadHandler> void async_read(AsyncReadStream& s, const MutableBufferSequence& buffers, - ReadHandler handler); + BOOST_ASIO_MOVE_ARG(ReadHandler) handler); /// Start an asynchronous operation to read a certain amount of data from a /// stream. @@ -415,7 +491,8 @@ void async_read(AsyncReadStream& s, const MutableBufferSequence& buffers, template <typename AsyncReadStream, typename MutableBufferSequence, typename CompletionCondition, typename ReadHandler> void async_read(AsyncReadStream& s, const MutableBufferSequence& buffers, - CompletionCondition completion_condition, ReadHandler handler); + CompletionCondition completion_condition, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler); #if !defined(BOOST_NO_IOSTREAM) @@ -427,6 +504,8 @@ void async_read(AsyncReadStream& s, const MutableBufferSequence& buffers, * asynchronous operation will continue until one of the following conditions is * true: * + * @li The supplied buffer is full (that is, it has reached maximum size). + * * @li An error occurred. * * This operation is implemented in terms of zero or more calls to the stream's @@ -467,7 +546,7 @@ void async_read(AsyncReadStream& s, const MutableBufferSequence& buffers, */ template <typename AsyncReadStream, typename Allocator, typename ReadHandler> void async_read(AsyncReadStream& s, basic_streambuf<Allocator>& b, - ReadHandler handler); + BOOST_ASIO_MOVE_ARG(ReadHandler) handler); /// Start an asynchronous operation to read a certain amount of data from a /// stream. @@ -477,6 +556,8 @@ void async_read(AsyncReadStream& s, basic_streambuf<Allocator>& b, * asynchronous operation will continue until one of the following conditions is * true: * + * @li The supplied buffer is full (that is, it has reached maximum size). + * * @li The completion_condition function object returns 0. * * This operation is implemented in terms of zero or more calls to the stream's @@ -526,7 +607,8 @@ void async_read(AsyncReadStream& s, basic_streambuf<Allocator>& b, template <typename AsyncReadStream, typename Allocator, typename CompletionCondition, typename ReadHandler> void async_read(AsyncReadStream& s, basic_streambuf<Allocator>& b, - CompletionCondition completion_condition, ReadHandler handler); + CompletionCondition completion_condition, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler); #endif // !defined(BOOST_NO_IOSTREAM) diff --git a/3rdParty/Boost/src/boost/asio/read_at.hpp b/3rdParty/Boost/src/boost/asio/read_at.hpp index 1feba6c..7eb30e0 100644 --- a/3rdParty/Boost/src/boost/asio/read_at.hpp +++ b/3rdParty/Boost/src/boost/asio/read_at.hpp @@ -2,7 +2,7 @@ // read_at.hpp // ~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -88,6 +88,52 @@ std::size_t read_at(SyncRandomAccessReadDevice& d, * @li The supplied buffers are full. That is, the bytes transferred is equal to * the sum of the buffer sizes. * + * @li An error occurred. + * + * This operation is implemented in terms of zero or more calls to the device's + * read_some_at function. + * + * @param d The device from which the data is to be read. The type must support + * the SyncRandomAccessReadDevice concept. + * + * @param offset The offset at which the data will be read. + * + * @param buffers One or more buffers into which the data will be read. The sum + * of the buffer sizes indicates the maximum number of bytes to read from the + * device. + * + * @param ec Set to indicate what error occurred, if any. + * + * @returns The number of bytes transferred. + * + * @par Example + * To read into a single data buffer use the @ref buffer function as follows: + * @code boost::asio::read_at(d, 42, + * boost::asio::buffer(data, size), ec); @endcode + * See the @ref buffer documentation for information on reading into multiple + * buffers in one go, and how to use it with arrays, boost::array or + * std::vector. + * + * @note This overload is equivalent to calling: + * @code boost::asio::read_at( + * d, 42, buffers, + * boost::asio::transfer_all(), ec); @endcode + */ +template <typename SyncRandomAccessReadDevice, typename MutableBufferSequence> +std::size_t read_at(SyncRandomAccessReadDevice& d, + boost::uint64_t offset, const MutableBufferSequence& buffers, + boost::system::error_code& ec); + +/// Attempt to read a certain amount of data at the specified offset before +/// returning. +/** + * This function is used to read a certain number of bytes of data from a + * random access device at the specified offset. The call will block until one + * of the following conditions is true: + * + * @li The supplied buffers are full. That is, the bytes transferred is equal to + * the sum of the buffer sizes. + * * @li The completion_condition function object returns 0. * * This operation is implemented in terms of zero or more calls to the device's @@ -224,6 +270,39 @@ std::size_t read_at(SyncRandomAccessReadDevice& d, * random access device at the specified offset. The call will block until one * of the following conditions is true: * + * @li An error occurred. + * + * This operation is implemented in terms of zero or more calls to the device's + * read_some_at function. + * + * @param d The device from which the data is to be read. The type must support + * the SyncRandomAccessReadDevice concept. + * + * @param offset The offset at which the data will be read. + * + * @param b The basic_streambuf object into which the data will be read. + * + * @param ec Set to indicate what error occurred, if any. + * + * @returns The number of bytes transferred. + * + * @note This overload is equivalent to calling: + * @code boost::asio::read_at( + * d, 42, b, + * boost::asio::transfer_all(), ec); @endcode + */ +template <typename SyncRandomAccessReadDevice, typename Allocator> +std::size_t read_at(SyncRandomAccessReadDevice& d, + boost::uint64_t offset, basic_streambuf<Allocator>& b, + boost::system::error_code& ec); + +/// Attempt to read a certain amount of data at the specified offset before +/// returning. +/** + * This function is used to read a certain number of bytes of data from a + * random access device at the specified offset. The call will block until one + * of the following conditions is true: + * * @li The completion_condition function object returns 0. * * This operation is implemented in terms of zero or more calls to the device's @@ -377,7 +456,8 @@ std::size_t read_at(SyncRandomAccessReadDevice& d, template <typename AsyncRandomAccessReadDevice, typename MutableBufferSequence, typename ReadHandler> void async_read_at(AsyncRandomAccessReadDevice& d, boost::uint64_t offset, - const MutableBufferSequence& buffers, ReadHandler handler); + const MutableBufferSequence& buffers, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler); /// Start an asynchronous operation to read a certain amount of data at the /// specified offset. @@ -448,7 +528,8 @@ template <typename AsyncRandomAccessReadDevice, typename MutableBufferSequence, typename CompletionCondition, typename ReadHandler> void async_read_at(AsyncRandomAccessReadDevice& d, boost::uint64_t offset, const MutableBufferSequence& buffers, - CompletionCondition completion_condition, ReadHandler handler); + CompletionCondition completion_condition, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler); #if !defined(BOOST_NO_IOSTREAM) @@ -500,7 +581,7 @@ void async_read_at(AsyncRandomAccessReadDevice& d, template <typename AsyncRandomAccessReadDevice, typename Allocator, typename ReadHandler> void async_read_at(AsyncRandomAccessReadDevice& d, boost::uint64_t offset, - basic_streambuf<Allocator>& b, ReadHandler handler); + basic_streambuf<Allocator>& b, BOOST_ASIO_MOVE_ARG(ReadHandler) handler); /// Start an asynchronous operation to read a certain amount of data at the /// specified offset. @@ -559,7 +640,8 @@ template <typename AsyncRandomAccessReadDevice, typename Allocator, typename CompletionCondition, typename ReadHandler> void async_read_at(AsyncRandomAccessReadDevice& d, boost::uint64_t offset, basic_streambuf<Allocator>& b, - CompletionCondition completion_condition, ReadHandler handler); + CompletionCondition completion_condition, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler); #endif // !defined(BOOST_NO_IOSTREAM) diff --git a/3rdParty/Boost/src/boost/asio/read_until.hpp b/3rdParty/Boost/src/boost/asio/read_until.hpp index 546537b..1f1bddb 100644 --- a/3rdParty/Boost/src/boost/asio/read_until.hpp +++ b/3rdParty/Boost/src/boost/asio/read_until.hpp @@ -2,7 +2,7 @@ // read_until.hpp // ~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -36,30 +36,16 @@ namespace asio { namespace detail { -#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x610)) + char (&has_result_type_helper(...))[2]; + template <typename T> - struct has_result_type - { - template <typename U> struct inner - { - struct big { char a[100]; }; - static big helper(U, ...); - static char helper(U, typename U::result_type* = 0); - }; - static const T& ref(); - enum { value = (sizeof((inner<const T&>::helper)((ref)())) == 1) }; - }; -#else // BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x610)) + char has_result_type_helper(T*, typename T::result_type* = 0); + template <typename T> struct has_result_type { - struct big { char a[100]; }; - template <typename U> static big helper(U, ...); - template <typename U> static char helper(U, typename U::result_type* = 0); - static const T& ref(); - enum { value = (sizeof((helper)((ref)())) == 1) }; + enum { value = (sizeof((has_result_type_helper)((T*)(0))) == 1) }; }; -#endif // BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x610)) } // namespace detail /// Type trait used to determine whether a type can be used as a match condition @@ -604,7 +590,7 @@ std::size_t read_until(SyncReadStream& s, template <typename AsyncReadStream, typename Allocator, typename ReadHandler> void async_read_until(AsyncReadStream& s, boost::asio::basic_streambuf<Allocator>& b, - char delim, ReadHandler handler); + char delim, BOOST_ASIO_MOVE_ARG(ReadHandler) handler); /// Start an asynchronous operation to read data into a streambuf until it /// contains a specified delimiter. @@ -687,7 +673,7 @@ void async_read_until(AsyncReadStream& s, template <typename AsyncReadStream, typename Allocator, typename ReadHandler> void async_read_until(AsyncReadStream& s, boost::asio::basic_streambuf<Allocator>& b, const std::string& delim, - ReadHandler handler); + BOOST_ASIO_MOVE_ARG(ReadHandler) handler); /// Start an asynchronous operation to read data into a streambuf until some /// part of its data matches a regular expression. @@ -774,7 +760,7 @@ void async_read_until(AsyncReadStream& s, template <typename AsyncReadStream, typename Allocator, typename ReadHandler> void async_read_until(AsyncReadStream& s, boost::asio::basic_streambuf<Allocator>& b, const boost::regex& expr, - ReadHandler handler); + BOOST_ASIO_MOVE_ARG(ReadHandler) handler); /// Start an asynchronous operation to read data into a streambuf until a /// function object indicates a match. @@ -903,7 +889,7 @@ template <typename AsyncReadStream, typename Allocator, typename MatchCondition, typename ReadHandler> void async_read_until(AsyncReadStream& s, boost::asio::basic_streambuf<Allocator>& b, - MatchCondition match_condition, ReadHandler handler, + MatchCondition match_condition, BOOST_ASIO_MOVE_ARG(ReadHandler) handler, typename boost::enable_if<is_match_condition<MatchCondition> >::type* = 0); /*@}*/ diff --git a/3rdParty/Boost/src/boost/asio/seq_packet_socket_service.hpp b/3rdParty/Boost/src/boost/asio/seq_packet_socket_service.hpp new file mode 100644 index 0000000..edd1593 --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/seq_packet_socket_service.hpp @@ -0,0 +1,341 @@ +// +// seq_packet_socket_service.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) +// + +#ifndef BOOST_ASIO_SEQ_PACKET_SOCKET_SERVICE_HPP +#define BOOST_ASIO_SEQ_PACKET_SOCKET_SERVICE_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> +#include <cstddef> +#include <boost/asio/error.hpp> +#include <boost/asio/io_service.hpp> + +#if defined(BOOST_ASIO_HAS_IOCP) +# include <boost/asio/detail/win_iocp_socket_service.hpp> +#else +# include <boost/asio/detail/reactive_socket_service.hpp> +#endif + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { + +/// Default service implementation for a sequenced packet socket. +template <typename Protocol> +class seq_packet_socket_service +#if defined(GENERATING_DOCUMENTATION) + : public boost::asio::io_service::service +#else + : public boost::asio::detail::service_base< + seq_packet_socket_service<Protocol> > +#endif +{ +public: +#if defined(GENERATING_DOCUMENTATION) + /// The unique service identifier. + static boost::asio::io_service::id id; +#endif + + /// The protocol type. + typedef Protocol protocol_type; + + /// The endpoint type. + typedef typename Protocol::endpoint endpoint_type; + +private: + // The type of the platform-specific implementation. +#if defined(BOOST_ASIO_HAS_IOCP) + typedef detail::win_iocp_socket_service<Protocol> service_impl_type; +#else + typedef detail::reactive_socket_service<Protocol> service_impl_type; +#endif + +public: + /// The type of a sequenced packet socket implementation. +#if defined(GENERATING_DOCUMENTATION) + typedef implementation_defined implementation_type; +#else + typedef typename service_impl_type::implementation_type implementation_type; +#endif + + /// (Deprecated: Use native_handle_type.) The native socket type. +#if defined(GENERATING_DOCUMENTATION) + typedef implementation_defined native_type; +#else + typedef typename service_impl_type::native_handle_type native_type; +#endif + + /// The native socket type. +#if defined(GENERATING_DOCUMENTATION) + typedef implementation_defined native_handle_type; +#else + typedef typename service_impl_type::native_handle_type native_handle_type; +#endif + + /// Construct a new sequenced packet socket service for the specified + /// io_service. + explicit seq_packet_socket_service(boost::asio::io_service& io_service) + : boost::asio::detail::service_base< + seq_packet_socket_service<Protocol> >(io_service), + service_impl_(io_service) + { + } + + /// Construct a new sequenced packet socket implementation. + void construct(implementation_type& impl) + { + service_impl_.construct(impl); + } + +#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Move-construct a new sequenced packet socket implementation. + void move_construct(implementation_type& impl, + implementation_type& other_impl) + { + service_impl_.move_construct(impl, other_impl); + } + + /// Move-assign from another sequenced packet socket implementation. + void move_assign(implementation_type& impl, + seq_packet_socket_service& other_service, + implementation_type& other_impl) + { + service_impl_.move_assign(impl, other_service.service_impl_, other_impl); + } +#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + + /// Destroy a sequenced packet socket implementation. + void destroy(implementation_type& impl) + { + service_impl_.destroy(impl); + } + + /// Open a sequenced packet socket. + boost::system::error_code open(implementation_type& impl, + const protocol_type& protocol, boost::system::error_code& ec) + { + if (protocol.type() == SOCK_SEQPACKET) + service_impl_.open(impl, protocol, ec); + else + ec = boost::asio::error::invalid_argument; + return ec; + } + + /// Assign an existing native socket to a sequenced packet socket. + boost::system::error_code assign(implementation_type& impl, + const protocol_type& protocol, const native_handle_type& native_socket, + boost::system::error_code& ec) + { + return service_impl_.assign(impl, protocol, native_socket, ec); + } + + /// Determine whether the socket is open. + bool is_open(const implementation_type& impl) const + { + return service_impl_.is_open(impl); + } + + /// Close a sequenced packet socket implementation. + boost::system::error_code close(implementation_type& impl, + boost::system::error_code& ec) + { + return service_impl_.close(impl, ec); + } + + /// (Deprecated: Use native_handle().) Get the native socket implementation. + native_type native(implementation_type& impl) + { + return service_impl_.native_handle(impl); + } + + /// Get the native socket implementation. + native_handle_type native_handle(implementation_type& impl) + { + return service_impl_.native_handle(impl); + } + + /// Cancel all asynchronous operations associated with the socket. + boost::system::error_code cancel(implementation_type& impl, + boost::system::error_code& ec) + { + return service_impl_.cancel(impl, ec); + } + + /// Determine whether the socket is at the out-of-band data mark. + bool at_mark(const implementation_type& impl, + boost::system::error_code& ec) const + { + return service_impl_.at_mark(impl, ec); + } + + /// Determine the number of bytes available for reading. + std::size_t available(const implementation_type& impl, + boost::system::error_code& ec) const + { + return service_impl_.available(impl, ec); + } + + /// Bind the sequenced packet socket to the specified local endpoint. + boost::system::error_code bind(implementation_type& impl, + const endpoint_type& endpoint, boost::system::error_code& ec) + { + return service_impl_.bind(impl, endpoint, ec); + } + + /// Connect the sequenced packet socket to the specified endpoint. + boost::system::error_code connect(implementation_type& impl, + const endpoint_type& peer_endpoint, boost::system::error_code& ec) + { + return service_impl_.connect(impl, peer_endpoint, ec); + } + + /// Start an asynchronous connect. + template <typename ConnectHandler> + void async_connect(implementation_type& impl, + const endpoint_type& peer_endpoint, + BOOST_ASIO_MOVE_ARG(ConnectHandler) handler) + { + service_impl_.async_connect(impl, peer_endpoint, + BOOST_ASIO_MOVE_CAST(ConnectHandler)(handler)); + } + + /// Set a socket option. + template <typename SettableSocketOption> + boost::system::error_code set_option(implementation_type& impl, + const SettableSocketOption& option, boost::system::error_code& ec) + { + return service_impl_.set_option(impl, option, ec); + } + + /// Get a socket option. + template <typename GettableSocketOption> + boost::system::error_code get_option(const implementation_type& impl, + GettableSocketOption& option, boost::system::error_code& ec) const + { + return service_impl_.get_option(impl, option, ec); + } + + /// Perform an IO control command on the socket. + template <typename IoControlCommand> + boost::system::error_code io_control(implementation_type& impl, + IoControlCommand& command, boost::system::error_code& ec) + { + return service_impl_.io_control(impl, command, ec); + } + + /// Gets the non-blocking mode of the socket. + bool non_blocking(const implementation_type& impl) const + { + return service_impl_.non_blocking(impl); + } + + /// Sets the non-blocking mode of the socket. + boost::system::error_code non_blocking(implementation_type& impl, + bool mode, boost::system::error_code& ec) + { + return service_impl_.non_blocking(impl, mode, ec); + } + + /// Gets the non-blocking mode of the native socket implementation. + bool native_non_blocking(const implementation_type& impl) const + { + return service_impl_.native_non_blocking(impl); + } + + /// Sets the non-blocking mode of the native socket implementation. + boost::system::error_code native_non_blocking(implementation_type& impl, + bool mode, boost::system::error_code& ec) + { + return service_impl_.native_non_blocking(impl, mode, ec); + } + + /// Get the local endpoint. + endpoint_type local_endpoint(const implementation_type& impl, + boost::system::error_code& ec) const + { + return service_impl_.local_endpoint(impl, ec); + } + + /// Get the remote endpoint. + endpoint_type remote_endpoint(const implementation_type& impl, + boost::system::error_code& ec) const + { + return service_impl_.remote_endpoint(impl, ec); + } + + /// Disable sends or receives on the socket. + boost::system::error_code shutdown(implementation_type& impl, + socket_base::shutdown_type what, boost::system::error_code& ec) + { + return service_impl_.shutdown(impl, what, ec); + } + + /// Send the given data to the peer. + template <typename ConstBufferSequence> + std::size_t send(implementation_type& impl, + const ConstBufferSequence& buffers, + socket_base::message_flags flags, boost::system::error_code& ec) + { + return service_impl_.send(impl, buffers, flags, ec); + } + + /// Start an asynchronous send. + template <typename ConstBufferSequence, typename WriteHandler> + void async_send(implementation_type& impl, + const ConstBufferSequence& buffers, + socket_base::message_flags flags, + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) + { + service_impl_.async_send(impl, buffers, flags, + BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); + } + + /// Receive some data from the peer. + template <typename MutableBufferSequence> + std::size_t receive(implementation_type& impl, + const MutableBufferSequence& buffers, socket_base::message_flags in_flags, + socket_base::message_flags& out_flags, boost::system::error_code& ec) + { + return service_impl_.receive_with_flags(impl, + buffers, in_flags, out_flags, ec); + } + + /// Start an asynchronous receive. + template <typename MutableBufferSequence, typename ReadHandler> + void async_receive(implementation_type& impl, + const MutableBufferSequence& buffers, socket_base::message_flags in_flags, + socket_base::message_flags& out_flags, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) + { + service_impl_.async_receive_with_flags(impl, buffers, in_flags, + out_flags, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); + } + +private: + // Destroy all user-defined handler objects owned by the service. + void shutdown_service() + { + service_impl_.shutdown_service(); + } + + // The platform-specific implementation. + service_impl_type service_impl_; +}; + +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#endif // BOOST_ASIO_SEQ_PACKET_SOCKET_SERVICE_HPP diff --git a/3rdParty/Boost/src/boost/asio/serial_port.hpp b/3rdParty/Boost/src/boost/asio/serial_port.hpp index a2f1721..58d6b78 100644 --- a/3rdParty/Boost/src/boost/asio/serial_port.hpp +++ b/3rdParty/Boost/src/boost/asio/serial_port.hpp @@ -2,7 +2,7 @@ // serial_port.hpp // ~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) // Copyright (c) 2008 Rep Invariant Systems, Inc. (info@repinvariant.com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying diff --git a/3rdParty/Boost/src/boost/asio/serial_port_base.hpp b/3rdParty/Boost/src/boost/asio/serial_port_base.hpp index 083d006..f14ba02 100644 --- a/3rdParty/Boost/src/boost/asio/serial_port_base.hpp +++ b/3rdParty/Boost/src/boost/asio/serial_port_base.hpp @@ -2,7 +2,7 @@ // serial_port_base.hpp // ~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) // Copyright (c) 2008 Rep Invariant Systems, Inc. (info@repinvariant.com) // // Distributed under the Boost Software License, Version 1.0. (See accompanying diff --git a/3rdParty/Boost/src/boost/asio/serial_port_service.hpp b/3rdParty/Boost/src/boost/asio/serial_port_service.hpp index 1a8a11b..ed7306c 100644 --- a/3rdParty/Boost/src/boost/asio/serial_port_service.hpp +++ b/3rdParty/Boost/src/boost/asio/serial_port_service.hpp @@ -2,7 +2,7 @@ // serial_port_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -63,11 +63,18 @@ public: typedef service_impl_type::implementation_type implementation_type; #endif - /// The native handle type. + /// (Deprecated: Use native_handle_type.) The native handle type. #if defined(GENERATING_DOCUMENTATION) typedef implementation_defined native_type; #else - typedef service_impl_type::native_type native_type; + typedef service_impl_type::native_handle_type native_type; +#endif + + /// The native handle type. +#if defined(GENERATING_DOCUMENTATION) + typedef implementation_defined native_handle_type; +#else + typedef service_impl_type::native_handle_type native_handle_type; #endif /// Construct a new serial port service for the specified io_service. @@ -77,18 +84,29 @@ public: { } - /// Destroy all user-defined handler objects owned by the service. - void shutdown_service() - { - service_impl_.shutdown_service(); - } - /// Construct a new serial port implementation. void construct(implementation_type& impl) { service_impl_.construct(impl); } +#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Move-construct a new serial port implementation. + void move_construct(implementation_type& impl, + implementation_type& other_impl) + { + service_impl_.move_construct(impl, other_impl); + } + + /// Move-assign from another serial port implementation. + void move_assign(implementation_type& impl, + serial_port_service& other_service, + implementation_type& other_impl) + { + service_impl_.move_assign(impl, other_service.service_impl_, other_impl); + } +#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Destroy a serial port implementation. void destroy(implementation_type& impl) { @@ -104,9 +122,9 @@ public: /// Assign an existing native handle to a serial port. boost::system::error_code assign(implementation_type& impl, - const native_type& native_handle, boost::system::error_code& ec) + const native_handle_type& handle, boost::system::error_code& ec) { - return service_impl_.assign(impl, native_handle, ec); + return service_impl_.assign(impl, handle, ec); } /// Determine whether the handle is open. @@ -122,10 +140,16 @@ public: return service_impl_.close(impl, ec); } - /// Get the native handle implementation. + /// (Deprecated: Use native_handle().) Get the native handle implementation. native_type native(implementation_type& impl) { - return service_impl_.native(impl); + return service_impl_.native_handle(impl); + } + + /// Get the native handle implementation. + native_handle_type native_handle(implementation_type& impl) + { + return service_impl_.native_handle(impl); } /// Cancel all asynchronous operations associated with the handle. @@ -169,9 +193,11 @@ public: /// Start an asynchronous write. template <typename ConstBufferSequence, typename WriteHandler> void async_write_some(implementation_type& impl, - const ConstBufferSequence& buffers, WriteHandler handler) + const ConstBufferSequence& buffers, + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { - service_impl_.async_write_some(impl, buffers, handler); + service_impl_.async_write_some(impl, buffers, + BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); } /// Read some data from the stream. @@ -185,12 +211,20 @@ public: /// Start an asynchronous read. template <typename MutableBufferSequence, typename ReadHandler> void async_read_some(implementation_type& impl, - const MutableBufferSequence& buffers, ReadHandler handler) + const MutableBufferSequence& buffers, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { - service_impl_.async_read_some(impl, buffers, handler); + service_impl_.async_read_some(impl, buffers, + BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); } private: + // Destroy all user-defined handler objects owned by the service. + void shutdown_service() + { + service_impl_.shutdown_service(); + } + // The platform-specific implementation. service_impl_type service_impl_; }; diff --git a/3rdParty/Boost/src/boost/asio/signal_set.hpp b/3rdParty/Boost/src/boost/asio/signal_set.hpp new file mode 100644 index 0000000..3427a03 --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/signal_set.hpp @@ -0,0 +1,30 @@ +// +// signal_set.hpp +// ~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) +// + +#ifndef BOOST_ASIO_SIGNAL_SET_HPP +#define BOOST_ASIO_SIGNAL_SET_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> +#include <boost/asio/basic_signal_set.hpp> + +namespace boost { +namespace asio { + +/// Typedef for the typical usage of a signal set. +typedef basic_signal_set<> signal_set; + +} // namespace asio +} // namespace boost + +#endif // BOOST_ASIO_SIGNAL_SET_HPP diff --git a/3rdParty/Boost/src/boost/asio/signal_set_service.hpp b/3rdParty/Boost/src/boost/asio/signal_set_service.hpp new file mode 100644 index 0000000..48896f2 --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/signal_set_service.hpp @@ -0,0 +1,128 @@ +// +// signal_set_service.hpp +// ~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) +// + +#ifndef BOOST_ASIO_SIGNAL_SET_SERVICE_HPP +#define BOOST_ASIO_SIGNAL_SET_SERVICE_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> +#include <boost/asio/detail/signal_set_service.hpp> +#include <boost/asio/error.hpp> +#include <boost/asio/io_service.hpp> + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { + +/// Default service implementation for a signal set. +class signal_set_service +#if defined(GENERATING_DOCUMENTATION) + : public boost::asio::io_service::service +#else + : public boost::asio::detail::service_base<signal_set_service> +#endif +{ +public: +#if defined(GENERATING_DOCUMENTATION) + /// The unique service identifier. + static boost::asio::io_service::id id; +#endif + +public: + /// The type of a signal set implementation. +#if defined(GENERATING_DOCUMENTATION) + typedef implementation_defined implementation_type; +#else + typedef detail::signal_set_service::implementation_type implementation_type; +#endif + + /// Construct a new signal set service for the specified io_service. + explicit signal_set_service(boost::asio::io_service& io_service) + : boost::asio::detail::service_base<signal_set_service>(io_service), + service_impl_(io_service) + { + } + + /// Construct a new signal set implementation. + void construct(implementation_type& impl) + { + service_impl_.construct(impl); + } + + /// Destroy a signal set implementation. + void destroy(implementation_type& impl) + { + service_impl_.destroy(impl); + } + + /// Add a signal to a signal_set. + boost::system::error_code add(implementation_type& impl, + int signal_number, boost::system::error_code& ec) + { + return service_impl_.add(impl, signal_number, ec); + } + + /// Remove a signal to a signal_set. + boost::system::error_code remove(implementation_type& impl, + int signal_number, boost::system::error_code& ec) + { + return service_impl_.remove(impl, signal_number, ec); + } + + /// Remove all signals from a signal_set. + boost::system::error_code clear(implementation_type& impl, + boost::system::error_code& ec) + { + return service_impl_.clear(impl, ec); + } + + /// Cancel all operations associated with the signal set. + boost::system::error_code cancel(implementation_type& impl, + boost::system::error_code& ec) + { + return service_impl_.cancel(impl, ec); + } + + // Start an asynchronous operation to wait for a signal to be delivered. + template <typename SignalHandler> + void async_wait(implementation_type& impl, + BOOST_ASIO_MOVE_ARG(SignalHandler) handler) + { + service_impl_.async_wait(impl, + BOOST_ASIO_MOVE_CAST(SignalHandler)(handler)); + } + +private: + // Destroy all user-defined handler objects owned by the service. + void shutdown_service() + { + service_impl_.shutdown_service(); + } + + // Perform any fork-related housekeeping. + void fork_service(boost::asio::io_service::fork_event event) + { + service_impl_.fork_service(event); + } + + // The platform-specific implementation. + detail::signal_set_service service_impl_; +}; + +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#endif // BOOST_ASIO_SIGNAL_SET_SERVICE_HPP diff --git a/3rdParty/Boost/src/boost/asio/socket_acceptor_service.hpp b/3rdParty/Boost/src/boost/asio/socket_acceptor_service.hpp index f287c65..54aaf7a 100644 --- a/3rdParty/Boost/src/boost/asio/socket_acceptor_service.hpp +++ b/3rdParty/Boost/src/boost/asio/socket_acceptor_service.hpp @@ -2,7 +2,7 @@ // socket_acceptor_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -68,11 +68,18 @@ public: typedef typename service_impl_type::implementation_type implementation_type; #endif - /// The native acceptor type. + /// (Deprecated: Use native_handle_type.) The native acceptor type. #if defined(GENERATING_DOCUMENTATION) typedef implementation_defined native_type; #else - typedef typename service_impl_type::native_type native_type; + typedef typename service_impl_type::native_handle_type native_type; +#endif + + /// The native acceptor type. +#if defined(GENERATING_DOCUMENTATION) + typedef implementation_defined native_handle_type; +#else + typedef typename service_impl_type::native_handle_type native_handle_type; #endif /// Construct a new socket acceptor service for the specified io_service. @@ -83,18 +90,29 @@ public: { } - /// Destroy all user-defined handler objects owned by the service. - void shutdown_service() - { - service_impl_.shutdown_service(); - } - /// Construct a new socket acceptor implementation. void construct(implementation_type& impl) { service_impl_.construct(impl); } +#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Move-construct a new socket acceptor implementation. + void move_construct(implementation_type& impl, + implementation_type& other_impl) + { + service_impl_.move_construct(impl, other_impl); + } + + /// Move-assign from another socket acceptor implementation. + void move_assign(implementation_type& impl, + socket_acceptor_service& other_service, + implementation_type& other_impl) + { + service_impl_.move_assign(impl, other_service.service_impl_, other_impl); + } +#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Destroy a socket acceptor implementation. void destroy(implementation_type& impl) { @@ -110,7 +128,7 @@ public: /// Assign an existing native acceptor to a socket acceptor. boost::system::error_code assign(implementation_type& impl, - const protocol_type& protocol, const native_type& native_acceptor, + const protocol_type& protocol, const native_handle_type& native_acceptor, boost::system::error_code& ec) { return service_impl_.assign(impl, protocol, native_acceptor, ec); @@ -151,10 +169,16 @@ public: return service_impl_.close(impl, ec); } - /// Get the native acceptor implementation. + /// (Deprecated: Use native_handle().) Get the native acceptor implementation. native_type native(implementation_type& impl) { - return service_impl_.native(impl); + return service_impl_.native_handle(impl); + } + + /// Get the native acceptor implementation. + native_handle_type native_handle(implementation_type& impl) + { + return service_impl_.native_handle(impl); } /// Set a socket option. @@ -181,6 +205,32 @@ public: return service_impl_.io_control(impl, command, ec); } + /// Gets the non-blocking mode of the acceptor. + bool non_blocking(const implementation_type& impl) const + { + return service_impl_.non_blocking(impl); + } + + /// Sets the non-blocking mode of the acceptor. + boost::system::error_code non_blocking(implementation_type& impl, + bool mode, boost::system::error_code& ec) + { + return service_impl_.non_blocking(impl, mode, ec); + } + + /// Gets the non-blocking mode of the native acceptor implementation. + bool native_non_blocking(const implementation_type& impl) const + { + return service_impl_.native_non_blocking(impl); + } + + /// Sets the non-blocking mode of the native acceptor implementation. + boost::system::error_code native_non_blocking(implementation_type& impl, + bool mode, boost::system::error_code& ec) + { + return service_impl_.native_non_blocking(impl, mode, ec); + } + /// Get the local endpoint. endpoint_type local_endpoint(const implementation_type& impl, boost::system::error_code& ec) const @@ -201,12 +251,20 @@ public: template <typename SocketService, typename AcceptHandler> void async_accept(implementation_type& impl, basic_socket<protocol_type, SocketService>& peer, - endpoint_type* peer_endpoint, AcceptHandler handler) + endpoint_type* peer_endpoint, + BOOST_ASIO_MOVE_ARG(AcceptHandler) handler) { - service_impl_.async_accept(impl, peer, peer_endpoint, handler); + service_impl_.async_accept(impl, peer, peer_endpoint, + BOOST_ASIO_MOVE_CAST(AcceptHandler)(handler)); } private: + // Destroy all user-defined handler objects owned by the service. + void shutdown_service() + { + service_impl_.shutdown_service(); + } + // The platform-specific implementation. service_impl_type service_impl_; }; diff --git a/3rdParty/Boost/src/boost/asio/socket_base.hpp b/3rdParty/Boost/src/boost/asio/socket_base.hpp index f5bac91..f964d00 100644 --- a/3rdParty/Boost/src/boost/asio/socket_base.hpp +++ b/3rdParty/Boost/src/boost/asio/socket_base.hpp @@ -2,7 +2,7 @@ // socket_base.hpp // ~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -63,6 +63,9 @@ public: /// Specify that the data should not be subject to routing. static const int message_do_not_route = implementation_defined; + + /// Specifies that the data marks the end of a record. + static const int message_end_of_record = implementation_defined; #else BOOST_STATIC_CONSTANT(int, message_peek = boost::asio::detail::message_peek); @@ -70,6 +73,8 @@ public: message_out_of_band = boost::asio::detail::message_out_of_band); BOOST_STATIC_CONSTANT(int, message_do_not_route = boost::asio::detail::message_do_not_route); + BOOST_STATIC_CONSTANT(int, + message_end_of_record = boost::asio::detail::message_end_of_record); #endif /// Socket option to permit sending of broadcast messages. @@ -442,7 +447,8 @@ public: enable_connection_aborted; #endif - /// IO control command to set the blocking mode of the socket. + /// (Deprecated: Use non_blocking().) IO control command to + /// set the blocking mode of the socket. /** * Implements the FIONBIO IO control command. * diff --git a/3rdParty/Boost/src/boost/asio/strand.hpp b/3rdParty/Boost/src/boost/asio/strand.hpp index 2928167..6a1033f 100644 --- a/3rdParty/Boost/src/boost/asio/strand.hpp +++ b/3rdParty/Boost/src/boost/asio/strand.hpp @@ -2,7 +2,7 @@ // strand.hpp // ~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -16,6 +16,7 @@ #endif // defined(_MSC_VER) && (_MSC_VER >= 1200) #include <boost/asio/detail/config.hpp> +#include <boost/asio/detail/handler_type_requirements.hpp> #include <boost/asio/detail/strand_service.hpp> #include <boost/asio/detail/wrapped_handler.hpp> #include <boost/asio/io_service.hpp> @@ -104,21 +105,6 @@ public: */ ~strand() { - service_.destroy(impl_); - } - - /// (Deprecated: use get_io_service().) Get the io_service associated with - /// the strand. - /** - * This function may be used to obtain the io_service object that the strand - * uses to dispatch handlers for asynchronous operations. - * - * @return A reference to the io_service object that the strand will use to - * dispatch handlers. Ownership is not transferred to the caller. - */ - boost::asio::io_service& io_service() - { - return service_.get_io_service(); } /// Get the io_service associated with the strand. @@ -153,10 +139,14 @@ public: * handler object as required. The function signature of the handler must be: * @code void handler(); @endcode */ - template <typename Handler> - void dispatch(Handler handler) + template <typename CompletionHandler> + void dispatch(BOOST_ASIO_MOVE_ARG(CompletionHandler) handler) { - service_.dispatch(impl_, handler); + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a CompletionHandler. + BOOST_ASIO_COMPLETION_HANDLER_CHECK(CompletionHandler, handler) type_check; + + service_.dispatch(impl_, BOOST_ASIO_MOVE_CAST(CompletionHandler)(handler)); } /// Request the strand to invoke the given handler and return @@ -175,10 +165,14 @@ public: * handler object as required. The function signature of the handler must be: * @code void handler(); @endcode */ - template <typename Handler> - void post(Handler handler) + template <typename CompletionHandler> + void post(BOOST_ASIO_MOVE_ARG(CompletionHandler) handler) { - service_.post(impl_, handler); + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a CompletionHandler. + BOOST_ASIO_COMPLETION_HANDLER_CHECK(CompletionHandler, handler) type_check; + + service_.post(impl_, BOOST_ASIO_MOVE_CAST(CompletionHandler)(handler)); } /// Create a new handler that automatically dispatches the wrapped handler diff --git a/3rdParty/Boost/src/boost/asio/stream_socket_service.hpp b/3rdParty/Boost/src/boost/asio/stream_socket_service.hpp index 40d5e18..afc9406 100644 --- a/3rdParty/Boost/src/boost/asio/stream_socket_service.hpp +++ b/3rdParty/Boost/src/boost/asio/stream_socket_service.hpp @@ -2,7 +2,7 @@ // stream_socket_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -68,11 +68,18 @@ public: typedef typename service_impl_type::implementation_type implementation_type; #endif - /// The native socket type. + /// (Deprecated: Use native_handle_type.) The native socket type. #if defined(GENERATING_DOCUMENTATION) typedef implementation_defined native_type; #else - typedef typename service_impl_type::native_type native_type; + typedef typename service_impl_type::native_handle_type native_type; +#endif + + /// The native socket type. +#if defined(GENERATING_DOCUMENTATION) + typedef implementation_defined native_handle_type; +#else + typedef typename service_impl_type::native_handle_type native_handle_type; #endif /// Construct a new stream socket service for the specified io_service. @@ -83,18 +90,29 @@ public: { } - /// Destroy all user-defined handler objects owned by the service. - void shutdown_service() - { - service_impl_.shutdown_service(); - } - /// Construct a new stream socket implementation. void construct(implementation_type& impl) { service_impl_.construct(impl); } +#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Move-construct a new stream socket implementation. + void move_construct(implementation_type& impl, + implementation_type& other_impl) + { + service_impl_.move_construct(impl, other_impl); + } + + /// Move-assign from another stream socket implementation. + void move_assign(implementation_type& impl, + stream_socket_service& other_service, + implementation_type& other_impl) + { + service_impl_.move_assign(impl, other_service.service_impl_, other_impl); + } +#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Destroy a stream socket implementation. void destroy(implementation_type& impl) { @@ -114,7 +132,7 @@ public: /// Assign an existing native socket to a stream socket. boost::system::error_code assign(implementation_type& impl, - const protocol_type& protocol, const native_type& native_socket, + const protocol_type& protocol, const native_handle_type& native_socket, boost::system::error_code& ec) { return service_impl_.assign(impl, protocol, native_socket, ec); @@ -133,10 +151,16 @@ public: return service_impl_.close(impl, ec); } - /// Get the native socket implementation. + /// (Deprecated: Use native_handle().) Get the native socket implementation. native_type native(implementation_type& impl) { - return service_impl_.native(impl); + return service_impl_.native_handle(impl); + } + + /// Get the native socket implementation. + native_handle_type native_handle(implementation_type& impl) + { + return service_impl_.native_handle(impl); } /// Cancel all asynchronous operations associated with the socket. @@ -177,9 +201,11 @@ public: /// Start an asynchronous connect. template <typename ConnectHandler> void async_connect(implementation_type& impl, - const endpoint_type& peer_endpoint, ConnectHandler handler) + const endpoint_type& peer_endpoint, + BOOST_ASIO_MOVE_ARG(ConnectHandler) handler) { - service_impl_.async_connect(impl, peer_endpoint, handler); + service_impl_.async_connect(impl, peer_endpoint, + BOOST_ASIO_MOVE_CAST(ConnectHandler)(handler)); } /// Set a socket option. @@ -206,6 +232,32 @@ public: return service_impl_.io_control(impl, command, ec); } + /// Gets the non-blocking mode of the socket. + bool non_blocking(const implementation_type& impl) const + { + return service_impl_.non_blocking(impl); + } + + /// Sets the non-blocking mode of the socket. + boost::system::error_code non_blocking(implementation_type& impl, + bool mode, boost::system::error_code& ec) + { + return service_impl_.non_blocking(impl, mode, ec); + } + + /// Gets the non-blocking mode of the native socket implementation. + bool native_non_blocking(const implementation_type& impl) const + { + return service_impl_.native_non_blocking(impl); + } + + /// Sets the non-blocking mode of the native socket implementation. + boost::system::error_code native_non_blocking(implementation_type& impl, + bool mode, boost::system::error_code& ec) + { + return service_impl_.native_non_blocking(impl, mode, ec); + } + /// Get the local endpoint. endpoint_type local_endpoint(const implementation_type& impl, boost::system::error_code& ec) const @@ -240,9 +292,11 @@ public: template <typename ConstBufferSequence, typename WriteHandler> void async_send(implementation_type& impl, const ConstBufferSequence& buffers, - socket_base::message_flags flags, WriteHandler handler) + socket_base::message_flags flags, + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { - service_impl_.async_send(impl, buffers, flags, handler); + service_impl_.async_send(impl, buffers, flags, + BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); } /// Receive some data from the peer. @@ -258,12 +312,20 @@ public: template <typename MutableBufferSequence, typename ReadHandler> void async_receive(implementation_type& impl, const MutableBufferSequence& buffers, - socket_base::message_flags flags, ReadHandler handler) + socket_base::message_flags flags, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { - service_impl_.async_receive(impl, buffers, flags, handler); + service_impl_.async_receive(impl, buffers, flags, + BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); } private: + // Destroy all user-defined handler objects owned by the service. + void shutdown_service() + { + service_impl_.shutdown_service(); + } + // The platform-specific implementation. service_impl_type service_impl_; }; diff --git a/3rdParty/Boost/src/boost/asio/streambuf.hpp b/3rdParty/Boost/src/boost/asio/streambuf.hpp index 8f724c3..004de8d 100644 --- a/3rdParty/Boost/src/boost/asio/streambuf.hpp +++ b/3rdParty/Boost/src/boost/asio/streambuf.hpp @@ -2,7 +2,7 @@ // streambuf.hpp // ~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/time_traits.hpp b/3rdParty/Boost/src/boost/asio/time_traits.hpp index 0da7e6b..8f48d47 100644 --- a/3rdParty/Boost/src/boost/asio/time_traits.hpp +++ b/3rdParty/Boost/src/boost/asio/time_traits.hpp @@ -2,7 +2,7 @@ // time_traits.hpp // ~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/version.hpp b/3rdParty/Boost/src/boost/asio/version.hpp index 9ef5ab5..4fc894b 100644 --- a/3rdParty/Boost/src/boost/asio/version.hpp +++ b/3rdParty/Boost/src/boost/asio/version.hpp @@ -2,7 +2,7 @@ // version.hpp // ~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -18,6 +18,6 @@ // BOOST_ASIO_VERSION % 100 is the sub-minor version // BOOST_ASIO_VERSION / 100 % 1000 is the minor version // BOOST_ASIO_VERSION / 100000 is the major version -#define BOOST_ASIO_VERSION 100409 // 1.4.9 +#define BOOST_ASIO_VERSION 100802 // 1.8.2 #endif // BOOST_ASIO_VERSION_HPP diff --git a/3rdParty/Boost/src/boost/asio/wait_traits.hpp b/3rdParty/Boost/src/boost/asio/wait_traits.hpp new file mode 100644 index 0000000..c4eef20 --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/wait_traits.hpp @@ -0,0 +1,43 @@ +// +// wait_traits.hpp +// ~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) +// + +#ifndef BOOST_ASIO_WAIT_TRAITS_HPP +#define BOOST_ASIO_WAIT_TRAITS_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { + +/// Wait traits suitable for use with the basic_waitable_timer class template. +template <typename Clock> +struct wait_traits +{ + /// Convert a clock duration into a duration used for waiting. + /** + * @returns @c d. + */ + static typename Clock::duration to_wait_duration( + const typename Clock::duration& d) + { + return d; + } +}; + +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#endif // BOOST_ASIO_WAIT_TRAITS_HPP diff --git a/3rdParty/Boost/src/boost/asio/waitable_timer_service.hpp b/3rdParty/Boost/src/boost/asio/waitable_timer_service.hpp new file mode 100644 index 0000000..69a9580 --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/waitable_timer_service.hpp @@ -0,0 +1,161 @@ +// +// waitable_timer_service.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) +// + +#ifndef BOOST_ASIO_WAITABLE_TIMER_SERVICE_HPP +#define BOOST_ASIO_WAITABLE_TIMER_SERVICE_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> +#include <cstddef> +#include <boost/asio/detail/chrono_time_traits.hpp> +#include <boost/asio/detail/deadline_timer_service.hpp> +#include <boost/asio/io_service.hpp> +#include <boost/asio/wait_traits.hpp> + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { + +/// Default service implementation for a timer. +template <typename Clock, + typename WaitTraits = boost::asio::wait_traits<Clock> > +class waitable_timer_service +#if defined(GENERATING_DOCUMENTATION) + : public boost::asio::io_service::service +#else + : public boost::asio::detail::service_base< + waitable_timer_service<Clock, WaitTraits> > +#endif +{ +public: +#if defined(GENERATING_DOCUMENTATION) + /// The unique service identifier. + static boost::asio::io_service::id id; +#endif + + /// The clock type. + typedef Clock clock_type; + + /// The duration type of the clock. + typedef typename clock_type::duration duration; + + /// The time point type of the clock. + typedef typename clock_type::time_point time_point; + + /// The wait traits type. + typedef WaitTraits traits_type; + +private: + // The type of the platform-specific implementation. + typedef detail::deadline_timer_service< + detail::chrono_time_traits<Clock, WaitTraits> > service_impl_type; + +public: + /// The implementation type of the waitable timer. +#if defined(GENERATING_DOCUMENTATION) + typedef implementation_defined implementation_type; +#else + typedef typename service_impl_type::implementation_type implementation_type; +#endif + + /// Construct a new timer service for the specified io_service. + explicit waitable_timer_service(boost::asio::io_service& io_service) + : boost::asio::detail::service_base< + waitable_timer_service<Clock, WaitTraits> >(io_service), + service_impl_(io_service) + { + } + + /// Construct a new timer implementation. + void construct(implementation_type& impl) + { + service_impl_.construct(impl); + } + + /// Destroy a timer implementation. + void destroy(implementation_type& impl) + { + service_impl_.destroy(impl); + } + + /// Cancel any asynchronous wait operations associated with the timer. + std::size_t cancel(implementation_type& impl, boost::system::error_code& ec) + { + return service_impl_.cancel(impl, ec); + } + + /// Cancels one asynchronous wait operation associated with the timer. + std::size_t cancel_one(implementation_type& impl, + boost::system::error_code& ec) + { + return service_impl_.cancel_one(impl, ec); + } + + /// Get the expiry time for the timer as an absolute time. + time_point expires_at(const implementation_type& impl) const + { + return service_impl_.expires_at(impl); + } + + /// Set the expiry time for the timer as an absolute time. + std::size_t expires_at(implementation_type& impl, + const time_point& expiry_time, boost::system::error_code& ec) + { + return service_impl_.expires_at(impl, expiry_time, ec); + } + + /// Get the expiry time for the timer relative to now. + duration expires_from_now(const implementation_type& impl) const + { + return service_impl_.expires_from_now(impl); + } + + /// Set the expiry time for the timer relative to now. + std::size_t expires_from_now(implementation_type& impl, + const duration& expiry_time, boost::system::error_code& ec) + { + return service_impl_.expires_from_now(impl, expiry_time, ec); + } + + // Perform a blocking wait on the timer. + void wait(implementation_type& impl, boost::system::error_code& ec) + { + service_impl_.wait(impl, ec); + } + + // Start an asynchronous wait on the timer. + template <typename WaitHandler> + void async_wait(implementation_type& impl, + BOOST_ASIO_MOVE_ARG(WaitHandler) handler) + { + service_impl_.async_wait(impl, BOOST_ASIO_MOVE_CAST(WaitHandler)(handler)); + } + +private: + // Destroy all user-defined handler objects owned by the service. + void shutdown_service() + { + service_impl_.shutdown_service(); + } + + // The platform-specific implementation. + service_impl_type service_impl_; +}; + +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#endif // BOOST_ASIO_WAITABLE_TIMER_SERVICE_HPP diff --git a/3rdParty/Boost/src/boost/asio/windows/basic_handle.hpp b/3rdParty/Boost/src/boost/asio/windows/basic_handle.hpp index aedd79a..5169cae 100644 --- a/3rdParty/Boost/src/boost/asio/windows/basic_handle.hpp +++ b/3rdParty/Boost/src/boost/asio/windows/basic_handle.hpp @@ -2,7 +2,7 @@ // windows/basic_handle.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -19,6 +19,7 @@ #if defined(BOOST_ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE) \ || defined(BOOST_ASIO_HAS_WINDOWS_STREAM_HANDLE) \ + || defined(BOOST_ASIO_HAS_WINDOWS_OBJECT_HANDLE) \ || defined(GENERATING_DOCUMENTATION) #include <boost/asio/basic_io_object.hpp> @@ -45,8 +46,12 @@ class basic_handle : public basic_io_object<HandleService> { public: + /// (Deprecated: Use native_handle_type.) The native representation of a + /// handle. + typedef typename HandleService::native_handle_type native_type; + /// The native representation of a handle. - typedef typename HandleService::native_type native_type; + typedef typename HandleService::native_handle_type native_handle_type; /// A basic_handle is always the lowest layer. typedef basic_handle<HandleService> lowest_layer_type; @@ -70,18 +75,51 @@ public: * @param io_service The io_service object that the handle will use to * dispatch handlers for any asynchronous operations performed on the handle. * - * @param native_handle A native handle. + * @param handle A native handle. * * @throws boost::system::system_error Thrown on failure. */ basic_handle(boost::asio::io_service& io_service, - const native_type& native_handle) + const native_handle_type& handle) : basic_io_object<HandleService>(io_service) { boost::system::error_code ec; - this->service.assign(this->implementation, native_handle, ec); - boost::asio::detail::throw_error(ec); + this->get_service().assign(this->get_implementation(), handle, ec); + boost::asio::detail::throw_error(ec, "assign"); + } + +#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Move-construct a basic_handle from another. + /** + * This constructor moves a handle from one object to another. + * + * @param other The other basic_handle object from which the move will occur. + * + * @note Following the move, the moved-from object is in the same state as if + * constructed using the @c basic_handle(io_service&) constructor. + */ + basic_handle(basic_handle&& other) + : basic_io_object<HandleService>( + BOOST_ASIO_MOVE_CAST(basic_handle)(other)) + { + } + + /// Move-assign a basic_handle from another. + /** + * This assignment operator moves a handle from one object to another. + * + * @param other The other basic_handle object from which the move will occur. + * + * @note Following the move, the moved-from object is in the same state as if + * constructed using the @c basic_handle(io_service&) constructor. + */ + basic_handle& operator=(basic_handle&& other) + { + basic_io_object<HandleService>::operator=( + BOOST_ASIO_MOVE_CAST(basic_handle)(other)); + return *this; } +#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) /// Get a reference to the lowest layer. /** @@ -115,35 +153,35 @@ public: /* * This function opens the handle to hold an existing native handle. * - * @param native_handle A native handle. + * @param handle A native handle. * * @throws boost::system::system_error Thrown on failure. */ - void assign(const native_type& native_handle) + void assign(const native_handle_type& handle) { boost::system::error_code ec; - this->service.assign(this->implementation, native_handle, ec); - boost::asio::detail::throw_error(ec); + this->get_service().assign(this->get_implementation(), handle, ec); + boost::asio::detail::throw_error(ec, "assign"); } /// Assign an existing native handle to the handle. /* * This function opens the handle to hold an existing native handle. * - * @param native_handle A native handle. + * @param handle A native handle. * * @param ec Set to indicate what error occurred, if any. */ - boost::system::error_code assign(const native_type& native_handle, + boost::system::error_code assign(const native_handle_type& handle, boost::system::error_code& ec) { - return this->service.assign(this->implementation, native_handle, ec); + return this->get_service().assign(this->get_implementation(), handle, ec); } /// Determine whether the handle is open. bool is_open() const { - return this->service.is_open(this->implementation); + return this->get_service().is_open(this->get_implementation()); } /// Close the handle. @@ -157,8 +195,8 @@ public: void close() { boost::system::error_code ec; - this->service.close(this->implementation, ec); - boost::asio::detail::throw_error(ec); + this->get_service().close(this->get_implementation(), ec); + boost::asio::detail::throw_error(ec, "close"); } /// Close the handle. @@ -171,10 +209,10 @@ public: */ boost::system::error_code close(boost::system::error_code& ec) { - return this->service.close(this->implementation, ec); + return this->get_service().close(this->get_implementation(), ec); } - /// Get the native handle representation. + /// (Deprecated: Use native_handle().) Get the native handle representation. /** * This function may be used to obtain the underlying representation of the * handle. This is intended to allow access to native handle functionality @@ -182,7 +220,18 @@ public: */ native_type native() { - return this->service.native(this->implementation); + return this->get_service().native_handle(this->get_implementation()); + } + + /// Get the native handle representation. + /** + * This function may be used to obtain the underlying representation of the + * handle. This is intended to allow access to native handle functionality + * that is not otherwise provided. + */ + native_handle_type native_handle() + { + return this->get_service().native_handle(this->get_implementation()); } /// Cancel all asynchronous operations associated with the handle. @@ -196,8 +245,8 @@ public: void cancel() { boost::system::error_code ec; - this->service.cancel(this->implementation, ec); - boost::asio::detail::throw_error(ec); + this->get_service().cancel(this->get_implementation(), ec); + boost::asio::detail::throw_error(ec, "cancel"); } /// Cancel all asynchronous operations associated with the handle. @@ -210,7 +259,7 @@ public: */ boost::system::error_code cancel(boost::system::error_code& ec) { - return this->service.cancel(this->implementation, ec); + return this->get_service().cancel(this->get_implementation(), ec); } protected: @@ -228,6 +277,7 @@ protected: #endif // defined(BOOST_ASIO_HAS_WINDOWS_RANDOM_ACCESS_HANDLE) // || defined(BOOST_ASIO_HAS_WINDOWS_STREAM_HANDLE) + // || defined(BOOST_ASIO_HAS_WINDOWS_OBJECT_HANDLE) // || defined(GENERATING_DOCUMENTATION) #endif // BOOST_ASIO_WINDOWS_BASIC_HANDLE_HPP diff --git a/3rdParty/Boost/src/boost/asio/windows/basic_object_handle.hpp b/3rdParty/Boost/src/boost/asio/windows/basic_object_handle.hpp new file mode 100644 index 0000000..a94bb57 --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/windows/basic_object_handle.hpp @@ -0,0 +1,177 @@ +// +// windows/basic_object_handle.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2011 Boris Schaeling (boris@highscore.de) +// +// 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_ASIO_WINDOWS_BASIC_OBJECT_HANDLE_HPP +#define BOOST_ASIO_WINDOWS_BASIC_OBJECT_HANDLE_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> + +#if defined(BOOST_ASIO_HAS_WINDOWS_OBJECT_HANDLE) \ + || defined(GENERATING_DOCUMENTATION) + +#include <boost/asio/detail/throw_error.hpp> +#include <boost/asio/error.hpp> +#include <boost/asio/windows/basic_handle.hpp> +#include <boost/asio/windows/object_handle_service.hpp> + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { +namespace windows { + +/// Provides object-oriented handle functionality. +/** + * The windows::basic_object_handle class template provides asynchronous and + * blocking object-oriented handle functionality. + * + * @par Thread Safety + * @e Distinct @e objects: Safe.@n + * @e Shared @e objects: Unsafe. + */ +template <typename ObjectHandleService = object_handle_service> +class basic_object_handle + : public basic_handle<ObjectHandleService> +{ +public: + /// The native representation of a handle. + typedef typename ObjectHandleService::native_handle_type native_handle_type; + + /// Construct a basic_object_handle without opening it. + /** + * This constructor creates an object handle without opening it. + * + * @param io_service The io_service object that the object handle will use to + * dispatch handlers for any asynchronous operations performed on the handle. + */ + explicit basic_object_handle(boost::asio::io_service& io_service) + : basic_handle<ObjectHandleService>(io_service) + { + } + + /// Construct a basic_object_handle on an existing native handle. + /** + * This constructor creates an object handle object to hold an existing native + * handle. + * + * @param io_service The io_service object that the object handle will use to + * dispatch handlers for any asynchronous operations performed on the handle. + * + * @param native_handle The new underlying handle implementation. + * + * @throws boost::system::system_error Thrown on failure. + */ + basic_object_handle(boost::asio::io_service& io_service, + const native_handle_type& native_handle) + : basic_handle<ObjectHandleService>(io_service, native_handle) + { + } + +#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Move-construct a basic_object_handle from another. + /** + * This constructor moves an object handle from one object to another. + * + * @param other The other basic_object_handle object from which the move will + * occur. + * + * @note Following the move, the moved-from object is in the same state as if + * constructed using the @c basic_object_handle(io_service&) constructor. + */ + basic_object_handle(basic_object_handle&& other) + : basic_handle<ObjectHandleService>( + BOOST_ASIO_MOVE_CAST(basic_object_handle)(other)) + { + } + + /// Move-assign a basic_object_handle from another. + /** + * This assignment operator moves an object handle from one object to another. + * + * @param other The other basic_object_handle object from which the move will + * occur. + * + * @note Following the move, the moved-from object is in the same state as if + * constructed using the @c basic_object_handle(io_service&) constructor. + */ + basic_object_handle& operator=(basic_object_handle&& other) + { + basic_handle<ObjectHandleService>::operator=( + BOOST_ASIO_MOVE_CAST(basic_object_handle)(other)); + return *this; + } +#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + + /// Perform a blocking wait on the object handle. + /** + * This function is used to wait for the object handle to be set to the + * signalled state. This function blocks and does not return until the object + * handle has been set to the signalled state. + * + * @throws boost::system::system_error Thrown on failure. + */ + void wait() + { + boost::system::error_code ec; + this->get_service().wait(this->get_implementation(), ec); + boost::asio::detail::throw_error(ec, "wait"); + } + + /// Perform a blocking wait on the object handle. + /** + * This function is used to wait for the object handle to be set to the + * signalled state. This function blocks and does not return until the object + * handle has been set to the signalled state. + * + * @param ec Set to indicate what error occurred, if any. + */ + void wait(boost::system::error_code& ec) + { + this->get_service().wait(this->get_implementation(), ec); + } + + /// Start an asynchronous wait on the object handle. + /** + * This function is be used to initiate an asynchronous wait against the + * object handle. It always returns immediately. + * + * @param handler The handler to be called when the object handle is set to + * the signalled state. Copies will be made of the handler as required. The + * function signature of the handler must be: + * @code void handler( + * const boost::system::error_code& error // Result of operation. + * ); @endcode + * Regardless of whether the asynchronous operation completes immediately or + * not, the handler will not be invoked from within this function. Invocation + * of the handler will be performed in a manner equivalent to using + * boost::asio::io_service::post(). + */ + template <typename WaitHandler> + void async_wait(WaitHandler handler) + { + this->get_service().async_wait(this->get_implementation(), handler); + } +}; + +} // namespace windows +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#endif // defined(BOOST_ASIO_HAS_WINDOWS_OBJECT_HANDLE) + // || defined(GENERATING_DOCUMENTATION) + +#endif // BOOST_ASIO_WINDOWS_BASIC_OBJECT_HANDLE_HPP diff --git a/3rdParty/Boost/src/boost/asio/windows/basic_random_access_handle.hpp b/3rdParty/Boost/src/boost/asio/windows/basic_random_access_handle.hpp index 207e414..0d57141 100644 --- a/3rdParty/Boost/src/boost/asio/windows/basic_random_access_handle.hpp +++ b/3rdParty/Boost/src/boost/asio/windows/basic_random_access_handle.hpp @@ -2,7 +2,7 @@ // windows/basic_random_access_handle.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -21,6 +21,7 @@ || defined(GENERATING_DOCUMENTATION) #include <cstddef> +#include <boost/asio/detail/handler_type_requirements.hpp> #include <boost/asio/detail/throw_error.hpp> #include <boost/asio/error.hpp> #include <boost/asio/windows/basic_handle.hpp> @@ -46,8 +47,13 @@ class basic_random_access_handle : public basic_handle<RandomAccessHandleService> { public: + /// (Deprecated: Use native_handle_type.) The native representation of a + /// handle. + typedef typename RandomAccessHandleService::native_handle_type native_type; + /// The native representation of a handle. - typedef typename RandomAccessHandleService::native_type native_type; + typedef typename RandomAccessHandleService::native_handle_type + native_handle_type; /// Construct a basic_random_access_handle without opening it. /** @@ -72,16 +78,54 @@ public: * use to dispatch handlers for any asynchronous operations performed on the * handle. * - * @param native_handle The new underlying handle implementation. + * @param handle The new underlying handle implementation. * * @throws boost::system::system_error Thrown on failure. */ basic_random_access_handle(boost::asio::io_service& io_service, - const native_type& native_handle) - : basic_handle<RandomAccessHandleService>(io_service, native_handle) + const native_handle_type& handle) + : basic_handle<RandomAccessHandleService>(io_service, handle) { } +#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Move-construct a basic_random_access_handle from another. + /** + * This constructor moves a random-access handle from one object to another. + * + * @param other The other basic_random_access_handle object from which the + * move will occur. + * + * @note Following the move, the moved-from object is in the same state as if + * constructed using the @c basic_random_access_handle(io_service&) + * constructor. + */ + basic_random_access_handle(basic_random_access_handle&& other) + : basic_handle<RandomAccessHandleService>( + BOOST_ASIO_MOVE_CAST(basic_random_access_handle)(other)) + { + } + + /// Move-assign a basic_random_access_handle from another. + /** + * This assignment operator moves a random-access handle from one object to + * another. + * + * @param other The other basic_random_access_handle object from which the + * move will occur. + * + * @note Following the move, the moved-from object is in the same state as if + * constructed using the @c basic_random_access_handle(io_service&) + * constructor. + */ + basic_random_access_handle& operator=(basic_random_access_handle&& other) + { + basic_handle<RandomAccessHandleService>::operator=( + BOOST_ASIO_MOVE_CAST(basic_random_access_handle)(other)); + return *this; + } +#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Write some data to the handle at the specified offset. /** * This function is used to write data to the random-access handle. The @@ -116,9 +160,9 @@ public: const ConstBufferSequence& buffers) { boost::system::error_code ec; - std::size_t s = this->service.write_some_at( - this->implementation, offset, buffers, ec); - boost::asio::detail::throw_error(ec); + std::size_t s = this->get_service().write_some_at( + this->get_implementation(), offset, buffers, ec); + boost::asio::detail::throw_error(ec, "write_some_at"); return s; } @@ -144,8 +188,8 @@ public: std::size_t write_some_at(boost::uint64_t offset, const ConstBufferSequence& buffers, boost::system::error_code& ec) { - return this->service.write_some_at( - this->implementation, offset, buffers, ec); + return this->get_service().write_some_at( + this->get_implementation(), offset, buffers, ec); } /// Start an asynchronous write at the specified offset. @@ -187,10 +231,15 @@ public: */ template <typename ConstBufferSequence, typename WriteHandler> void async_write_some_at(boost::uint64_t offset, - const ConstBufferSequence& buffers, WriteHandler handler) + const ConstBufferSequence& buffers, + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { - this->service.async_write_some_at( - this->implementation, offset, buffers, handler); + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a WriteHandler. + BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; + + this->get_service().async_write_some_at(this->get_implementation(), + offset, buffers, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); } /// Read some data from the handle at the specified offset. @@ -228,9 +277,9 @@ public: const MutableBufferSequence& buffers) { boost::system::error_code ec; - std::size_t s = this->service.read_some_at( - this->implementation, offset, buffers, ec); - boost::asio::detail::throw_error(ec); + std::size_t s = this->get_service().read_some_at( + this->get_implementation(), offset, buffers, ec); + boost::asio::detail::throw_error(ec, "read_some_at"); return s; } @@ -257,8 +306,8 @@ public: std::size_t read_some_at(boost::uint64_t offset, const MutableBufferSequence& buffers, boost::system::error_code& ec) { - return this->service.read_some_at( - this->implementation, offset, buffers, ec); + return this->get_service().read_some_at( + this->get_implementation(), offset, buffers, ec); } /// Start an asynchronous read at the specified offset. @@ -301,10 +350,15 @@ public: */ template <typename MutableBufferSequence, typename ReadHandler> void async_read_some_at(boost::uint64_t offset, - const MutableBufferSequence& buffers, ReadHandler handler) + const MutableBufferSequence& buffers, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { - this->service.async_read_some_at( - this->implementation, offset, buffers, handler); + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a ReadHandler. + BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; + + this->get_service().async_read_some_at(this->get_implementation(), + offset, buffers, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); } }; diff --git a/3rdParty/Boost/src/boost/asio/windows/basic_stream_handle.hpp b/3rdParty/Boost/src/boost/asio/windows/basic_stream_handle.hpp index 105b041..ccc8f09 100644 --- a/3rdParty/Boost/src/boost/asio/windows/basic_stream_handle.hpp +++ b/3rdParty/Boost/src/boost/asio/windows/basic_stream_handle.hpp @@ -2,7 +2,7 @@ // windows/basic_stream_handle.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -21,10 +21,11 @@ || defined(GENERATING_DOCUMENTATION) #include <cstddef> +#include <boost/asio/detail/handler_type_requirements.hpp> +#include <boost/asio/detail/throw_error.hpp> #include <boost/asio/error.hpp> #include <boost/asio/windows/basic_handle.hpp> #include <boost/asio/windows/stream_handle_service.hpp> -#include <boost/asio/detail/throw_error.hpp> #include <boost/asio/detail/push_options.hpp> @@ -49,8 +50,12 @@ class basic_stream_handle : public basic_handle<StreamHandleService> { public: + /// (Deprecated: Use native_handle_type.) The native representation of a + /// handle. + typedef typename StreamHandleService::native_handle_type native_type; + /// The native representation of a handle. - typedef typename StreamHandleService::native_type native_type; + typedef typename StreamHandleService::native_handle_type native_handle_type; /// Construct a basic_stream_handle without opening it. /** @@ -74,16 +79,52 @@ public: * @param io_service The io_service object that the stream handle will use to * dispatch handlers for any asynchronous operations performed on the handle. * - * @param native_handle The new underlying handle implementation. + * @param handle The new underlying handle implementation. * * @throws boost::system::system_error Thrown on failure. */ basic_stream_handle(boost::asio::io_service& io_service, - const native_type& native_handle) - : basic_handle<StreamHandleService>(io_service, native_handle) + const native_handle_type& handle) + : basic_handle<StreamHandleService>(io_service, handle) + { + } + +#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Move-construct a basic_stream_handle from another. + /** + * This constructor moves a stream handle from one object to another. + * + * @param other The other basic_stream_handle object from which the move + * will occur. + * + * @note Following the move, the moved-from object is in the same state as if + * constructed using the @c basic_stream_handle(io_service&) constructor. + */ + basic_stream_handle(basic_stream_handle&& other) + : basic_handle<StreamHandleService>( + BOOST_ASIO_MOVE_CAST(basic_stream_handle)(other)) { } + /// Move-assign a basic_stream_handle from another. + /** + * This assignment operator moves a stream handle from one object to + * another. + * + * @param other The other basic_stream_handle object from which the move + * will occur. + * + * @note Following the move, the moved-from object is in the same state as if + * constructed using the @c basic_stream_handle(io_service&) constructor. + */ + basic_stream_handle& operator=(basic_stream_handle&& other) + { + basic_handle<StreamHandleService>::operator=( + BOOST_ASIO_MOVE_CAST(basic_stream_handle)(other)); + return *this; + } +#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Write some data to the handle. /** * This function is used to write data to the stream handle. The function call @@ -115,8 +156,9 @@ public: std::size_t write_some(const ConstBufferSequence& buffers) { boost::system::error_code ec; - std::size_t s = this->service.write_some(this->implementation, buffers, ec); - boost::asio::detail::throw_error(ec); + std::size_t s = this->get_service().write_some( + this->get_implementation(), buffers, ec); + boost::asio::detail::throw_error(ec, "write_some"); return s; } @@ -140,7 +182,8 @@ public: std::size_t write_some(const ConstBufferSequence& buffers, boost::system::error_code& ec) { - return this->service.write_some(this->implementation, buffers, ec); + return this->get_service().write_some( + this->get_implementation(), buffers, ec); } /// Start an asynchronous write. @@ -180,9 +223,14 @@ public: */ template <typename ConstBufferSequence, typename WriteHandler> void async_write_some(const ConstBufferSequence& buffers, - WriteHandler handler) + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { - this->service.async_write_some(this->implementation, buffers, handler); + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a WriteHandler. + BOOST_ASIO_WRITE_HANDLER_CHECK(WriteHandler, handler) type_check; + + this->get_service().async_write_some(this->get_implementation(), + buffers, BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); } /// Read some data from the handle. @@ -217,8 +265,9 @@ public: std::size_t read_some(const MutableBufferSequence& buffers) { boost::system::error_code ec; - std::size_t s = this->service.read_some(this->implementation, buffers, ec); - boost::asio::detail::throw_error(ec); + std::size_t s = this->get_service().read_some( + this->get_implementation(), buffers, ec); + boost::asio::detail::throw_error(ec, "read_some"); return s; } @@ -243,7 +292,8 @@ public: std::size_t read_some(const MutableBufferSequence& buffers, boost::system::error_code& ec) { - return this->service.read_some(this->implementation, buffers, ec); + return this->get_service().read_some( + this->get_implementation(), buffers, ec); } /// Start an asynchronous read. @@ -284,9 +334,14 @@ public: */ template <typename MutableBufferSequence, typename ReadHandler> void async_read_some(const MutableBufferSequence& buffers, - ReadHandler handler) + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { - this->service.async_read_some(this->implementation, buffers, handler); + // If you get an error on the following line it means that your handler does + // not meet the documented type requirements for a ReadHandler. + BOOST_ASIO_READ_HANDLER_CHECK(ReadHandler, handler) type_check; + + this->get_service().async_read_some(this->get_implementation(), + buffers, BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); } }; diff --git a/3rdParty/Boost/src/boost/asio/windows/object_handle.hpp b/3rdParty/Boost/src/boost/asio/windows/object_handle.hpp new file mode 100644 index 0000000..7bf0654 --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/windows/object_handle.hpp @@ -0,0 +1,40 @@ +// +// windows/object_handle.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2011 Boris Schaeling (boris@highscore.de) +// +// 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_ASIO_WINDOWS_OBJECT_HANDLE_HPP +#define BOOST_ASIO_WINDOWS_OBJECT_HANDLE_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> + +#if defined(BOOST_ASIO_HAS_WINDOWS_OBJECT_HANDLE) \ + || defined(GENERATING_DOCUMENTATION) + +#include <boost/asio/windows/basic_object_handle.hpp> + +namespace boost { +namespace asio { +namespace windows { + +/// Typedef for the typical usage of an object handle. +typedef basic_object_handle<> object_handle; + +} // namespace windows +} // namespace asio +} // namespace boost + +#endif // defined(BOOST_ASIO_HAS_WINDOWS_OBJECT_HANDLE) + // || defined(GENERATING_DOCUMENTATION) + +#endif // BOOST_ASIO_WINDOWS_OBJECT_HANDLE_HPP diff --git a/3rdParty/Boost/src/boost/asio/windows/object_handle_service.hpp b/3rdParty/Boost/src/boost/asio/windows/object_handle_service.hpp new file mode 100644 index 0000000..ffc89e6 --- /dev/null +++ b/3rdParty/Boost/src/boost/asio/windows/object_handle_service.hpp @@ -0,0 +1,170 @@ +// +// windows/object_handle_service.hpp +// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +// +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2011 Boris Schaeling (boris@highscore.de) +// +// 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_ASIO_WINDOWS_OBJECT_HANDLE_SERVICE_HPP +#define BOOST_ASIO_WINDOWS_OBJECT_HANDLE_SERVICE_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif // defined(_MSC_VER) && (_MSC_VER >= 1200) + +#include <boost/asio/detail/config.hpp> + +#if defined(BOOST_ASIO_HAS_WINDOWS_OBJECT_HANDLE) \ + || defined(GENERATING_DOCUMENTATION) + +#include <boost/asio/detail/win_object_handle_service.hpp> +#include <boost/asio/error.hpp> +#include <boost/asio/io_service.hpp> + +#include <boost/asio/detail/push_options.hpp> + +namespace boost { +namespace asio { +namespace windows { + +/// Default service implementation for an object handle. +class object_handle_service +#if defined(GENERATING_DOCUMENTATION) + : public boost::asio::io_service::service +#else + : public boost::asio::detail::service_base<object_handle_service> +#endif +{ +public: +#if defined(GENERATING_DOCUMENTATION) + /// The unique service identifier. + static boost::asio::io_service::id id; +#endif + +private: + // The type of the platform-specific implementation. + typedef detail::win_object_handle_service service_impl_type; + +public: + /// The type of an object handle implementation. +#if defined(GENERATING_DOCUMENTATION) + typedef implementation_defined implementation_type; +#else + typedef service_impl_type::implementation_type implementation_type; +#endif + + /// The native handle type. +#if defined(GENERATING_DOCUMENTATION) + typedef implementation_defined native_handle_type; +#else + typedef service_impl_type::native_handle_type native_handle_type; +#endif + + /// Construct a new object handle service for the specified io_service. + explicit object_handle_service(boost::asio::io_service& io_service) + : boost::asio::detail::service_base<object_handle_service>(io_service), + service_impl_(io_service) + { + } + + /// Construct a new object handle implementation. + void construct(implementation_type& impl) + { + service_impl_.construct(impl); + } + +#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Move-construct a new object handle implementation. + void move_construct(implementation_type& impl, + implementation_type& other_impl) + { + service_impl_.move_construct(impl, other_impl); + } + + /// Move-assign from another object handle implementation. + void move_assign(implementation_type& impl, + object_handle_service& other_service, + implementation_type& other_impl) + { + service_impl_.move_assign(impl, other_service.service_impl_, other_impl); + } +#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + + /// Destroy an object handle implementation. + void destroy(implementation_type& impl) + { + service_impl_.destroy(impl); + } + + /// Assign an existing native handle to an object handle. + boost::system::error_code assign(implementation_type& impl, + const native_handle_type& handle, boost::system::error_code& ec) + { + return service_impl_.assign(impl, handle, ec); + } + + /// Determine whether the handle is open. + bool is_open(const implementation_type& impl) const + { + return service_impl_.is_open(impl); + } + + /// Close an object handle implementation. + boost::system::error_code close(implementation_type& impl, + boost::system::error_code& ec) + { + return service_impl_.close(impl, ec); + } + + /// Get the native handle implementation. + native_handle_type native_handle(implementation_type& impl) + { + return service_impl_.native_handle(impl); + } + + /// Cancel all asynchronous operations associated with the handle. + boost::system::error_code cancel(implementation_type& impl, + boost::system::error_code& ec) + { + return service_impl_.cancel(impl, ec); + } + + // Wait for a signaled state. + void wait(implementation_type& impl, boost::system::error_code& ec) + { + service_impl_.wait(impl, ec); + } + + /// Start an asynchronous wait. + template <typename WaitHandler> + void async_wait(implementation_type& impl, + BOOST_ASIO_MOVE_ARG(WaitHandler) handler) + { + service_impl_.async_wait(impl, BOOST_ASIO_MOVE_CAST(WaitHandler)(handler)); + } + +private: + // Destroy all user-defined handler objects owned by the service. + void shutdown_service() + { + service_impl_.shutdown_service(); + } + + // The platform-specific implementation. + service_impl_type service_impl_; +}; + +} // namespace windows +} // namespace asio +} // namespace boost + +#include <boost/asio/detail/pop_options.hpp> + +#endif // defined(BOOST_ASIO_HAS_WINDOWS_OBJECT_HANDLE) + // || defined(GENERATING_DOCUMENTATION) + +#endif // BOOST_ASIO_WINDOWS_OBJECT_HANDLE_SERVICE_HPP diff --git a/3rdParty/Boost/src/boost/asio/windows/overlapped_ptr.hpp b/3rdParty/Boost/src/boost/asio/windows/overlapped_ptr.hpp index c9b1889..94f9842 100644 --- a/3rdParty/Boost/src/boost/asio/windows/overlapped_ptr.hpp +++ b/3rdParty/Boost/src/boost/asio/windows/overlapped_ptr.hpp @@ -2,7 +2,7 @@ // windows/overlapped_ptr.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -51,8 +51,9 @@ public: /// Construct an overlapped_ptr to contain the specified handler. template <typename Handler> - explicit overlapped_ptr(boost::asio::io_service& io_service, Handler handler) - : impl_(io_service, handler) + explicit overlapped_ptr(boost::asio::io_service& io_service, + BOOST_ASIO_MOVE_ARG(Handler) handler) + : impl_(io_service, BOOST_ASIO_MOVE_CAST(Handler)(handler)) { } @@ -70,9 +71,10 @@ public: /// Reset to contain the specified handler, freeing any current OVERLAPPED /// object. template <typename Handler> - void reset(boost::asio::io_service& io_service, Handler handler) + void reset(boost::asio::io_service& io_service, + BOOST_ASIO_MOVE_ARG(Handler) handler) { - impl_.reset(io_service, handler); + impl_.reset(io_service, BOOST_ASIO_MOVE_CAST(Handler)(handler)); } /// Get the contained OVERLAPPED object. diff --git a/3rdParty/Boost/src/boost/asio/windows/random_access_handle.hpp b/3rdParty/Boost/src/boost/asio/windows/random_access_handle.hpp index 183ad0d..61fe1aa 100644 --- a/3rdParty/Boost/src/boost/asio/windows/random_access_handle.hpp +++ b/3rdParty/Boost/src/boost/asio/windows/random_access_handle.hpp @@ -2,7 +2,7 @@ // windows/random_access_handle.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/windows/random_access_handle_service.hpp b/3rdParty/Boost/src/boost/asio/windows/random_access_handle_service.hpp index 08cb561..9b5e456 100644 --- a/3rdParty/Boost/src/boost/asio/windows/random_access_handle_service.hpp +++ b/3rdParty/Boost/src/boost/asio/windows/random_access_handle_service.hpp @@ -2,7 +2,7 @@ // windows/random_access_handle_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -59,11 +59,18 @@ public: typedef service_impl_type::implementation_type implementation_type; #endif - /// The native handle type. + /// (Deprecated: Use native_handle_type.) The native handle type. #if defined(GENERATING_DOCUMENTATION) typedef implementation_defined native_type; #else - typedef service_impl_type::native_type native_type; + typedef service_impl_type::native_handle_type native_type; +#endif + + /// The native handle type. +#if defined(GENERATING_DOCUMENTATION) + typedef implementation_defined native_handle_type; +#else + typedef service_impl_type::native_handle_type native_handle_type; #endif /// Construct a new random-access handle service for the specified io_service. @@ -74,18 +81,29 @@ public: { } - /// Destroy all user-defined handler objects owned by the service. - void shutdown_service() - { - service_impl_.shutdown_service(); - } - /// Construct a new random-access handle implementation. void construct(implementation_type& impl) { service_impl_.construct(impl); } +#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Move-construct a new random-access handle implementation. + void move_construct(implementation_type& impl, + implementation_type& other_impl) + { + service_impl_.move_construct(impl, other_impl); + } + + /// Move-assign from another random-access handle implementation. + void move_assign(implementation_type& impl, + random_access_handle_service& other_service, + implementation_type& other_impl) + { + service_impl_.move_assign(impl, other_service.service_impl_, other_impl); + } +#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Destroy a random-access handle implementation. void destroy(implementation_type& impl) { @@ -94,9 +112,9 @@ public: /// Assign an existing native handle to a random-access handle. boost::system::error_code assign(implementation_type& impl, - const native_type& native_handle, boost::system::error_code& ec) + const native_handle_type& handle, boost::system::error_code& ec) { - return service_impl_.assign(impl, native_handle, ec); + return service_impl_.assign(impl, handle, ec); } /// Determine whether the handle is open. @@ -112,10 +130,16 @@ public: return service_impl_.close(impl, ec); } - /// Get the native handle implementation. + /// (Deprecated: Use native_handle().) Get the native handle implementation. native_type native(implementation_type& impl) { - return service_impl_.native(impl); + return service_impl_.native_handle(impl); + } + + /// Get the native handle implementation. + native_handle_type native_handle(implementation_type& impl) + { + return service_impl_.native_handle(impl); } /// Cancel all asynchronous operations associated with the handle. @@ -135,10 +159,12 @@ public: /// Start an asynchronous write at the specified offset. template <typename ConstBufferSequence, typename WriteHandler> - void async_write_some_at(implementation_type& impl, boost::uint64_t offset, - const ConstBufferSequence& buffers, WriteHandler handler) + void async_write_some_at(implementation_type& impl, + boost::uint64_t offset, const ConstBufferSequence& buffers, + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { - service_impl_.async_write_some_at(impl, offset, buffers, handler); + service_impl_.async_write_some_at(impl, offset, buffers, + BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); } /// Read some data from the specified offset. @@ -151,13 +177,21 @@ public: /// Start an asynchronous read at the specified offset. template <typename MutableBufferSequence, typename ReadHandler> - void async_read_some_at(implementation_type& impl, boost::uint64_t offset, - const MutableBufferSequence& buffers, ReadHandler handler) + void async_read_some_at(implementation_type& impl, + boost::uint64_t offset, const MutableBufferSequence& buffers, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { - service_impl_.async_read_some_at(impl, offset, buffers, handler); + service_impl_.async_read_some_at(impl, offset, buffers, + BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); } private: + // Destroy all user-defined handler objects owned by the service. + void shutdown_service() + { + service_impl_.shutdown_service(); + } + // The platform-specific implementation. service_impl_type service_impl_; }; diff --git a/3rdParty/Boost/src/boost/asio/windows/stream_handle.hpp b/3rdParty/Boost/src/boost/asio/windows/stream_handle.hpp index 67f6452..7d829db 100644 --- a/3rdParty/Boost/src/boost/asio/windows/stream_handle.hpp +++ b/3rdParty/Boost/src/boost/asio/windows/stream_handle.hpp @@ -2,7 +2,7 @@ // windows/stream_handle.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) diff --git a/3rdParty/Boost/src/boost/asio/windows/stream_handle_service.hpp b/3rdParty/Boost/src/boost/asio/windows/stream_handle_service.hpp index 418ea1e..7d0ec9c 100644 --- a/3rdParty/Boost/src/boost/asio/windows/stream_handle_service.hpp +++ b/3rdParty/Boost/src/boost/asio/windows/stream_handle_service.hpp @@ -2,7 +2,7 @@ // windows/stream_handle_service.hpp // ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -57,11 +57,18 @@ public: typedef service_impl_type::implementation_type implementation_type; #endif - /// The native handle type. + /// (Deprecated: Use native_handle_type.) The native handle type. #if defined(GENERATING_DOCUMENTATION) typedef implementation_defined native_type; #else - typedef service_impl_type::native_type native_type; + typedef service_impl_type::native_handle_type native_type; +#endif + + /// The native handle type. +#if defined(GENERATING_DOCUMENTATION) + typedef implementation_defined native_handle_type; +#else + typedef service_impl_type::native_handle_type native_handle_type; #endif /// Construct a new stream handle service for the specified io_service. @@ -71,18 +78,29 @@ public: { } - /// Destroy all user-defined handler objects owned by the service. - void shutdown_service() - { - service_impl_.shutdown_service(); - } - /// Construct a new stream handle implementation. void construct(implementation_type& impl) { service_impl_.construct(impl); } +#if defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Move-construct a new stream handle implementation. + void move_construct(implementation_type& impl, + implementation_type& other_impl) + { + service_impl_.move_construct(impl, other_impl); + } + + /// Move-assign from another stream handle implementation. + void move_assign(implementation_type& impl, + stream_handle_service& other_service, + implementation_type& other_impl) + { + service_impl_.move_assign(impl, other_service.service_impl_, other_impl); + } +#endif // defined(BOOST_ASIO_HAS_MOVE) || defined(GENERATING_DOCUMENTATION) + /// Destroy a stream handle implementation. void destroy(implementation_type& impl) { @@ -91,9 +109,9 @@ public: /// Assign an existing native handle to a stream handle. boost::system::error_code assign(implementation_type& impl, - const native_type& native_handle, boost::system::error_code& ec) + const native_handle_type& handle, boost::system::error_code& ec) { - return service_impl_.assign(impl, native_handle, ec); + return service_impl_.assign(impl, handle, ec); } /// Determine whether the handle is open. @@ -109,10 +127,16 @@ public: return service_impl_.close(impl, ec); } - /// Get the native handle implementation. + /// (Deprecated: Use native_handle().) Get the native handle implementation. native_type native(implementation_type& impl) { - return service_impl_.native(impl); + return service_impl_.native_handle(impl); + } + + /// Get the native handle implementation. + native_handle_type native_handle(implementation_type& impl) + { + return service_impl_.native_handle(impl); } /// Cancel all asynchronous operations associated with the handle. @@ -133,9 +157,11 @@ public: /// Start an asynchronous write. template <typename ConstBufferSequence, typename WriteHandler> void async_write_some(implementation_type& impl, - const ConstBufferSequence& buffers, WriteHandler handler) + const ConstBufferSequence& buffers, + BOOST_ASIO_MOVE_ARG(WriteHandler) handler) { - service_impl_.async_write_some(impl, buffers, handler); + service_impl_.async_write_some(impl, buffers, + BOOST_ASIO_MOVE_CAST(WriteHandler)(handler)); } /// Read some data from the stream. @@ -149,12 +175,20 @@ public: /// Start an asynchronous read. template <typename MutableBufferSequence, typename ReadHandler> void async_read_some(implementation_type& impl, - const MutableBufferSequence& buffers, ReadHandler handler) + const MutableBufferSequence& buffers, + BOOST_ASIO_MOVE_ARG(ReadHandler) handler) { - service_impl_.async_read_some(impl, buffers, handler); + service_impl_.async_read_some(impl, buffers, + BOOST_ASIO_MOVE_CAST(ReadHandler)(handler)); } private: + // Destroy all user-defined handler objects owned by the service. + void shutdown_service() + { + service_impl_.shutdown_service(); + } + // The platform-specific implementation. service_impl_type service_impl_; }; diff --git a/3rdParty/Boost/src/boost/asio/write.hpp b/3rdParty/Boost/src/boost/asio/write.hpp index 537a8d6..dd6cb34 100644 --- a/3rdParty/Boost/src/boost/asio/write.hpp +++ b/3rdParty/Boost/src/boost/asio/write.hpp @@ -2,7 +2,7 @@ // write.hpp // ~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -71,6 +71,46 @@ namespace asio { template <typename SyncWriteStream, typename ConstBufferSequence> std::size_t write(SyncWriteStream& s, const ConstBufferSequence& buffers); +/// Write all of the supplied data to a stream before returning. +/** + * This function is used to write a certain number of bytes of data to a stream. + * The call will block until one of the following conditions is true: + * + * @li All of the data in the supplied buffers has been written. That is, the + * bytes transferred is equal to the sum of the buffer sizes. + * + * @li An error occurred. + * + * This operation is implemented in terms of zero or more calls to the stream's + * write_some function. + * + * @param s The stream to which the data is to be written. The type must support + * the SyncWriteStream concept. + * + * @param buffers One or more buffers containing the data to be written. The sum + * of the buffer sizes indicates the maximum number of bytes to write to the + * stream. + * + * @param ec Set to indicate what error occurred, if any. + * + * @returns The number of bytes transferred. + * + * @par Example + * To write a single data buffer use the @ref buffer function as follows: + * @code boost::asio::write(s, boost::asio::buffer(data, size), ec); @endcode + * See the @ref buffer documentation for information on writing multiple + * buffers in one go, and how to use it with arrays, boost::array or + * std::vector. + * + * @note This overload is equivalent to calling: + * @code boost::asio::write( + * s, buffers, + * boost::asio::transfer_all(), ec); @endcode + */ +template <typename SyncWriteStream, typename ConstBufferSequence> +std::size_t write(SyncWriteStream& s, const ConstBufferSequence& buffers, + boost::system::error_code& ec); + /// Write a certain amount of data to a stream before returning. /** * This function is used to write a certain number of bytes of data to a stream. @@ -197,6 +237,36 @@ std::size_t write(SyncWriteStream& s, const ConstBufferSequence& buffers, template <typename SyncWriteStream, typename Allocator> std::size_t write(SyncWriteStream& s, basic_streambuf<Allocator>& b); +/// Write all of the supplied data to a stream before returning. +/** + * This function is used to write a certain number of bytes of data to a stream. + * The call will block until one of the following conditions is true: + * + * @li All of the data in the supplied basic_streambuf has been written. + * + * @li An error occurred. + * + * This operation is implemented in terms of zero or more calls to the stream's + * write_some function. + * + * @param s The stream to which the data is to be written. The type must support + * the SyncWriteStream concept. + * + * @param b The basic_streambuf object from which data will be written. + * + * @param ec Set to indicate what error occurred, if any. + * + * @returns The number of bytes transferred. + * + * @note This overload is equivalent to calling: + * @code boost::asio::write( + * s, b, + * boost::asio::transfer_all(), ec); @endcode + */ +template <typename SyncWriteStream, typename Allocator> +std::size_t write(SyncWriteStream& s, basic_streambuf<Allocator>& b, + boost::system::error_code& ec); + /// Write a certain amount of data to a stream before returning. /** * This function is used to write a certain number of bytes of data to a stream. @@ -344,7 +414,7 @@ std::size_t write(SyncWriteStream& s, basic_streambuf<Allocator>& b, template <typename AsyncWriteStream, typename ConstBufferSequence, typename WriteHandler> void async_write(AsyncWriteStream& s, const ConstBufferSequence& buffers, - WriteHandler handler); + BOOST_ASIO_MOVE_ARG(WriteHandler) handler); /// Start an asynchronous operation to write a certain amount of data to a /// stream. @@ -416,7 +486,8 @@ void async_write(AsyncWriteStream& s, const ConstBufferSequence& buffers, template <typename AsyncWriteStream, typename ConstBufferSequence, typename CompletionCondition, typename WriteHandler> void async_write(AsyncWriteStream& s, const ConstBufferSequence& buffers, - CompletionCondition completion_condition, WriteHandler handler); + CompletionCondition completion_condition, + BOOST_ASIO_MOVE_ARG(WriteHandler) handler); #if !defined(BOOST_NO_IOSTREAM) @@ -463,7 +534,7 @@ void async_write(AsyncWriteStream& s, const ConstBufferSequence& buffers, */ template <typename AsyncWriteStream, typename Allocator, typename WriteHandler> void async_write(AsyncWriteStream& s, basic_streambuf<Allocator>& b, - WriteHandler handler); + BOOST_ASIO_MOVE_ARG(WriteHandler) handler); /// Start an asynchronous operation to write a certain amount of data to a /// stream. @@ -523,7 +594,8 @@ void async_write(AsyncWriteStream& s, basic_streambuf<Allocator>& b, template <typename AsyncWriteStream, typename Allocator, typename CompletionCondition, typename WriteHandler> void async_write(AsyncWriteStream& s, basic_streambuf<Allocator>& b, - CompletionCondition completion_condition, WriteHandler handler); + CompletionCondition completion_condition, + BOOST_ASIO_MOVE_ARG(WriteHandler) handler); #endif // !defined(BOOST_NO_IOSTREAM) diff --git a/3rdParty/Boost/src/boost/asio/write_at.hpp b/3rdParty/Boost/src/boost/asio/write_at.hpp index 9c0c575..9535a55 100644 --- a/3rdParty/Boost/src/boost/asio/write_at.hpp +++ b/3rdParty/Boost/src/boost/asio/write_at.hpp @@ -2,7 +2,7 @@ // write_at.hpp // ~~~~~~~~~~~~ // -// Copyright (c) 2003-2011 Christopher M. Kohlhoff (chris at kohlhoff dot com) +// Copyright (c) 2003-2012 Christopher M. Kohlhoff (chris at kohlhoff 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) @@ -76,6 +76,51 @@ template <typename SyncRandomAccessWriteDevice, typename ConstBufferSequence> std::size_t write_at(SyncRandomAccessWriteDevice& d, boost::uint64_t offset, const ConstBufferSequence& buffers); +/// Write all of the supplied data at the specified offset before returning. +/** + * This function is used to write a certain number of bytes of data to a random + * access device at a specified offset. The call will block until one of the + * following conditions is true: + * + * @li All of the data in the supplied buffers has been written. That is, the + * bytes transferred is equal to the sum of the buffer sizes. + * + * @li An error occurred. + * + * This operation is implemented in terms of zero or more calls to the device's + * write_some_at function. + * + * @param d The device to which the data is to be written. The type must support + * the SyncRandomAccessWriteDevice concept. + * + * @param offset The offset at which the data will be written. + * + * @param buffers One or more buffers containing the data to be written. The sum + * of the buffer sizes indicates the maximum number of bytes to write to the + * device. + * + * @param ec Set to indicate what error occurred, if any. + * + * @returns The number of bytes transferred. + * + * @par Example + * To write a single data buffer use the @ref buffer function as follows: + * @code boost::asio::write_at(d, 42, + * boost::asio::buffer(data, size), ec); @endcode + * See the @ref buffer documentation for information on writing multiple + * buffers in one go, and how to use it with arrays, boost::array or + * std::vector. + * + * @note This overload is equivalent to calling: + * @code boost::asio::write_at( + * d, offset, buffers, + * boost::asio::transfer_all(), ec); @endcode + */ +template <typename SyncRandomAccessWriteDevice, typename ConstBufferSequence> +std::size_t write_at(SyncRandomAccessWriteDevice& d, + boost::uint64_t offset, const ConstBufferSequence& buffers, + boost::system::error_code& ec); + /// Write a certain amount of data at a specified offset before returning. /** * This function is used to write a certain number of bytes of data to a random @@ -214,6 +259,40 @@ template <typename SyncRandomAccessWriteDevice, typename Allocator> std::size_t write_at(SyncRandomAccessWriteDevice& d, boost::uint64_t offset, basic_streambuf<Allocator>& b); +/// Write all of the supplied data at the specified offset before returning. +/** + * This function is used to write a certain number of bytes of data to a random + * access device at a specified offset. The call will block until one of the + * following conditions is true: + * + * @li All of the data in the supplied basic_streambuf has been written. + * + * @li An error occurred. + * + * This operation is implemented in terms of zero or more calls to the device's + * write_some_at function. + * + * @param d The device to which the data is to be written. The type must support + * the SyncRandomAccessWriteDevice concept. + * + * @param offset The offset at which the data will be written. + * + * @param b The basic_streambuf object from which data will be written. + * + * @param ec Set to indicate what error occurred, if any. + * + * @returns The number of bytes transferred. + * + * @note This overload is equivalent to calling: + * @code boost::asio::write_at( + * d, 42, b, + * boost::asio::transfer_all(), ec); @endcode + */ +template <typename SyncRandomAccessWriteDevice, typename Allocator> +std::size_t write_at(SyncRandomAccessWriteDevice& d, + boost::uint64_t offset, basic_streambuf<Allocator>& b, + boost::system::error_code& ec); + /// Write a certain amount of data at a specified offset before returning. /** * This function is used to write a certain number of bytes of data to a random @@ -367,7 +446,8 @@ std::size_t write_at(SyncRandomAccessWriteDevice& d, boost::uint64_t offset, template <typename AsyncRandomAccessWriteDevice, typename ConstBufferSequence, typename WriteHandler> void async_write_at(AsyncRandomAccessWriteDevice& d, boost::uint64_t offset, - const ConstBufferSequence& buffers, WriteHandler handler); + const ConstBufferSequence& buffers, + BOOST_ASIO_MOVE_ARG(WriteHandler) handler); /// Start an asynchronous operation to write a certain amount of data at the /// specified offset. @@ -439,7 +519,8 @@ template <typename AsyncRandomAccessWriteDevice, typename ConstBufferSequence, typename CompletionCondition, typename WriteHandler> void async_write_at(AsyncRandomAccessWriteDevice& d, boost::uint64_t offset, const ConstBufferSequence& buffers, - CompletionCondition completion_condition, WriteHandler handler); + CompletionCondition completion_condition, + BOOST_ASIO_MOVE_ARG(WriteHandler) handler); #if !defined(BOOST_NO_IOSTREAM) @@ -486,7 +567,7 @@ void async_write_at(AsyncRandomAccessWriteDevice& d, template <typename AsyncRandomAccessWriteDevice, typename Allocator, typename WriteHandler> void async_write_at(AsyncRandomAccessWriteDevice& d, boost::uint64_t offset, - basic_streambuf<Allocator>& b, WriteHandler handler); + basic_streambuf<Allocator>& b, BOOST_ASIO_MOVE_ARG(WriteHandler) handler); /// Start an asynchronous operation to write a certain amount of data at the /// specified offset. @@ -546,7 +627,7 @@ template <typename AsyncRandomAccessWriteDevice, typename Allocator, typename CompletionCondition, typename WriteHandler> void async_write_at(AsyncRandomAccessWriteDevice& d, boost::uint64_t offset, basic_streambuf<Allocator>& b, CompletionCondition completion_condition, - WriteHandler handler); + BOOST_ASIO_MOVE_ARG(WriteHandler) handler); #endif // !defined(BOOST_NO_IOSTREAM) diff --git a/3rdParty/Boost/src/boost/bind/bind.hpp b/3rdParty/Boost/src/boost/bind/bind.hpp index a63d2a0..fb67097 100644 --- a/3rdParty/Boost/src/boost/bind/bind.hpp +++ b/3rdParty/Boost/src/boost/bind/bind.hpp @@ -1680,7 +1680,7 @@ template< class R, class T > struct add_cref< R (T::*) (), 1 > typedef void type; }; -#if !( defined(__IBMCPP__) && BOOST_WORKAROUND( __IBMCPP__, BOOST_TESTED_AT(600) ) ) +#if !defined(__IBMCPP__) || __IBMCPP_FUNC_CV_TMPL_ARG_DEDUCTION template< class R, class T > struct add_cref< R (T::*) () const, 1 > { diff --git a/3rdParty/Boost/src/boost/chrono/ceil.hpp b/3rdParty/Boost/src/boost/chrono/ceil.hpp new file mode 100644 index 0000000..7fbf9dd --- /dev/null +++ b/3rdParty/Boost/src/boost/chrono/ceil.hpp @@ -0,0 +1,36 @@ +// boost/chrono/round.hpp ------------------------------------------------------------// + +// (C) Copyright Howard Hinnant +// Copyright 2011 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) + +// See http://www.boost.org/libs/chrono for documentation. + +#ifndef BOOST_CHRONO_CEIL_HPP +#define BOOST_CHRONO_CEIL_HPP + +#include <boost/chrono/duration.hpp> + +namespace boost +{ + namespace chrono + { + + /** + * rounds up + */ + template <class To, class Rep, class Period> + To ceil(const duration<Rep, Period>& d) + { + To t = duration_cast<To>(d); + if (t < d) + ++t; + return t; + } + + } // namespace chrono +} // namespace boost + +#endif diff --git a/3rdParty/Boost/src/boost/chrono/chrono.hpp b/3rdParty/Boost/src/boost/chrono/chrono.hpp new file mode 100644 index 0000000..ebc29d8 --- /dev/null +++ b/3rdParty/Boost/src/boost/chrono/chrono.hpp @@ -0,0 +1,15 @@ +// chrono.hpp --------------------------------------------------------------// + +// Copyright 2009-2011 Vicente J. Botet Escriba + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +#ifndef BOOST_CHRONO_CHRONO_HPP +#define BOOST_CHRONO_CHRONO_HPP + +#include <boost/chrono/duration.hpp> +#include <boost/chrono/time_point.hpp> +#include <boost/chrono/system_clocks.hpp> + +#endif // BOOST_CHRONO_CHRONO_HPP diff --git a/3rdParty/Boost/src/boost/chrono/clock_string.hpp b/3rdParty/Boost/src/boost/chrono/clock_string.hpp new file mode 100644 index 0000000..af025f2 --- /dev/null +++ b/3rdParty/Boost/src/boost/chrono/clock_string.hpp @@ -0,0 +1,25 @@ +// +// (C) Copyright 2010-2011 Vicente J. Botet Escriba +// 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). +// + +#ifndef BOOST_CHRONO_CLOCK_STRING_HPP +#define BOOST_CHRONO_CLOCK_STRING_HPP + +#include <string> + +namespace boost +{ + namespace chrono + { + + template<class Clock, class CharT> + struct clock_string; + + } // chrono + +} // boost + +#endif // BOOST_CHRONO_CLOCK_STRING_HPP diff --git a/3rdParty/Boost/src/boost/chrono/config.hpp b/3rdParty/Boost/src/boost/chrono/config.hpp new file mode 100644 index 0000000..7812dad --- /dev/null +++ b/3rdParty/Boost/src/boost/chrono/config.hpp @@ -0,0 +1,215 @@ +// boost/chrono/config.hpp -------------------------------------------------// + +// Copyright Beman Dawes 2003, 2006, 2008 +// Copyright 2009-2011 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) + +// See http://www.boost.org/libs/chrono for documentation. + +#ifndef BOOST_CHRONO_CONFIG_HPP +#define BOOST_CHRONO_CONFIG_HPP + +#include <boost/config.hpp> + +#if !defined BOOST_CHRONO_VERSION +#define BOOST_CHRONO_VERSION 1 +#else +#if BOOST_CHRONO_VERSION!=1 && BOOST_CHRONO_VERSION!=2 +#error "BOOST_CHRONO_VERSION must be 1 or 2" +#endif +#endif + +#if defined(BOOST_CHRONO_SOURCE) && !defined(BOOST_USE_WINDOWS_H) +#define BOOST_USE_WINDOWS_H +#endif + +#if ! defined BOOST_CHRONO_PROVIDES_DATE_IO_FOR_SYSTEM_CLOCK_TIME_POINT \ + && ! defined BOOST_CHRONO_DONT_PROVIDE_DATE_IO_FOR_SYSTEM_CLOCK_TIME_POINT + +# define BOOST_CHRONO_DONT_PROVIDE_DATE_IO_FOR_SYSTEM_CLOCK_TIME_POINT + +#endif + +// BOOST_CHRONO_POSIX_API, BOOST_CHRONO_MAC_API, or BOOST_CHRONO_WINDOWS_API +// can be defined by the user to specify which API should be used + +#if defined(BOOST_CHRONO_WINDOWS_API) +# warning Boost.Chrono will use the Windows API +#elif defined(BOOST_CHRONO_MAC_API) +# warning Boost.Chrono will use the Mac API +#elif defined(BOOST_CHRONO_POSIX_API) +# warning Boost.Chrono will use the POSIX API +#endif + +# if defined( BOOST_CHRONO_WINDOWS_API ) && defined( BOOST_CHRONO_POSIX_API ) +# error both BOOST_CHRONO_WINDOWS_API and BOOST_CHRONO_POSIX_API are defined +# elif defined( BOOST_CHRONO_WINDOWS_API ) && defined( BOOST_CHRONO_MAC_API ) +# error both BOOST_CHRONO_WINDOWS_API and BOOST_CHRONO_MAC_API are defined +# elif defined( BOOST_CHRONO_MAC_API ) && defined( BOOST_CHRONO_POSIX_API ) +# error both BOOST_CHRONO_MAC_API and BOOST_CHRONO_POSIX_API are defined +# elif !defined( BOOST_CHRONO_WINDOWS_API ) && !defined( BOOST_CHRONO_MAC_API ) && !defined( BOOST_CHRONO_POSIX_API ) +# if (defined(_WIN32) || defined(__WIN32__) || defined(WIN32)) +# define BOOST_CHRONO_WINDOWS_API +# elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__) +# define BOOST_CHRONO_MAC_API +# else +# define BOOST_CHRONO_POSIX_API +# endif +# endif + +# if defined( BOOST_CHRONO_WINDOWS_API ) +# ifndef UNDER_CE +# define BOOST_CHRONO_HAS_PROCESS_CLOCKS +# endif +# define BOOST_CHRONO_HAS_CLOCK_STEADY +# define BOOST_CHRONO_HAS_THREAD_CLOCK +# define BOOST_CHRONO_THREAD_CLOCK_IS_STEADY true +# endif + +# if defined( BOOST_CHRONO_MAC_API ) +# define BOOST_CHRONO_HAS_PROCESS_CLOCKS +# define BOOST_CHRONO_HAS_CLOCK_STEADY +# define BOOST_CHRONO_THREAD_CLOCK_IS_STEADY true +# endif + +# if defined( BOOST_CHRONO_POSIX_API ) +# define BOOST_CHRONO_HAS_PROCESS_CLOCKS +# include <time.h> //to check for CLOCK_REALTIME and CLOCK_MONOTONIC and _POSIX_THREAD_CPUTIME +# if defined(CLOCK_MONOTONIC) +# define BOOST_CHRONO_HAS_CLOCK_STEADY +# endif +# if defined(_POSIX_THREAD_CPUTIME) && !defined(BOOST_DISABLE_THREADS) +# define BOOST_CHRONO_HAS_THREAD_CLOCK +# define BOOST_CHRONO_THREAD_CLOCK_IS_STEADY true +# endif +# if defined(CLOCK_THREAD_CPUTIME_ID) && !defined(BOOST_DISABLE_THREADS) +# define BOOST_CHRONO_HAS_THREAD_CLOCK +# define BOOST_CHRONO_THREAD_CLOCK_IS_STEADY true +# endif +# if defined(sun) || defined(__sun) +# undef BOOST_CHRONO_HAS_THREAD_CLOCK +# undef BOOST_CHRONO_THREAD_CLOCK_IS_STEADY +# endif +# if defined(__HP_aCC) && defined(__hpux) +# undef BOOST_CHRONO_HAS_THREAD_CLOCK +# undef BOOST_CHRONO_THREAD_CLOCK_IS_STEADY +# endif +# endif + +#if defined(BOOST_CHRONO_THREAD_DISABLED) && defined(BOOST_CHRONO_HAS_THREAD_CLOCK) +#undef BOOST_CHRONO_HAS_THREAD_CLOCK +#undef BOOST_CHRONO_THREAD_CLOCK_IS_STEADY +#endif + +//#undef BOOST_CHRONO_HAS_PROCESS_CLOCKS + +// unicode support ------------------------------// + +#if defined(BOOST_NO_CXX11_UNICODE_LITERALS) || defined(BOOST_NO_CXX11_CHAR16_T) || defined(BOOST_NO_CXX11_CHAR32_T) +//~ #define BOOST_CHRONO_HAS_UNICODE_SUPPORT +#else +#define BOOST_CHRONO_HAS_UNICODE_SUPPORT 1 +#endif + +#if ! defined BOOST_NOEXCEPT +#if defined(BOOST_NO_CXX11_NOEXCEPT) +#define BOOST_NOEXCEPT +#else +#define BOOST_NOEXCEPT noexcept +#endif +#endif + +#if defined( BOOST_NO_CXX11_NUMERIC_LIMITS ) +#define BOOST_CHRONO_LIB_CONSTEXPR +#else +#define BOOST_CHRONO_LIB_CONSTEXPR BOOST_CONSTEXPR +#endif + +#if defined( BOOST_NO_CXX11_NUMERIC_LIMITS ) +# define BOOST_CHRONO_LIB_NOEXCEPT_OR_THROW throw() +#else +#ifdef BOOST_NO_NOEXCEPT +# define BOOST_CHRONO_LIB_NOEXCEPT_OR_THROW throw() +#else +# define BOOST_CHRONO_LIB_NOEXCEPT_OR_THROW noexcept +#endif +#endif + + +#if defined BOOST_CHRONO_PROVIDE_HYBRID_ERROR_HANDLING \ + && defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING +#error "BOOST_CHRONO_PROVIDE_HYBRID_ERROR_HANDLING && BOOST_CHRONO_PROVIDE_HYBRID_ERROR_HANDLING defined" +#endif + +#if defined BOOST_CHRONO_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 \ + && defined BOOST_CHRONO_DONT_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 +#error "BOOST_CHRONO_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 && BOOST_CHRONO_DONT_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 defined" +#endif + +#if ! defined BOOST_CHRONO_PROVIDE_HYBRID_ERROR_HANDLING \ + && ! defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING +#define BOOST_CHRONO_PROVIDE_HYBRID_ERROR_HANDLING +#endif + +#if (BOOST_CHRONO_VERSION == 2) +#if ! defined BOOST_CHRONO_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 \ + && ! defined BOOST_CHRONO_DONT_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 +#define BOOST_CHRONO_DONT_PROVIDES_DEPRECATED_IO_SINCE_V2_0_0 +#endif +#endif + +#ifdef BOOST_CHRONO_HEADER_ONLY +#define BOOST_CHRONO_INLINE inline +#define BOOST_CHRONO_STATIC inline +#define BOOST_CHRONO_DECL + +#else +#define BOOST_CHRONO_INLINE +#define BOOST_CHRONO_STATIC static + +// enable dynamic linking on Windows ---------------------------------------// + +// we need to import/export our code only if the user has specifically +// asked for it by defining either BOOST_ALL_DYN_LINK if they want all boost +// libraries to be dynamically linked, or BOOST_CHRONO_DYN_LINK +// if they want just this one to be dynamically liked: +#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_CHRONO_DYN_LINK) +// export if this is our own source, otherwise import: +#ifdef BOOST_CHRONO_SOURCE +# define BOOST_CHRONO_DECL BOOST_SYMBOL_EXPORT +#else +# define BOOST_CHRONO_DECL BOOST_SYMBOL_IMPORT +#endif // BOOST_CHRONO_SOURCE +#endif // DYN_LINK +// +// if BOOST_CHRONO_DECL isn't defined yet define it now: +#ifndef BOOST_CHRONO_DECL +#define BOOST_CHRONO_DECL +#endif + + + +// enable automatic library variant selection ------------------------------// + +#if !defined(BOOST_CHRONO_SOURCE) && !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_CHRONO_NO_LIB) +// +// Set the name of our library; this will get undef'ed by auto_link.hpp +// once it's done with it: +// +#define BOOST_LIB_NAME boost_chrono +// +// If we're importing code from a dll, then tell auto_link.hpp about it: +// +#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_CHRONO_DYN_LINK) +# define BOOST_DYN_LINK +#endif +// +// And include the header that does the work: +// +#include <boost/config/auto_link.hpp> +#endif // auto-linking disabled +#endif // BOOST_CHRONO_HEADER_ONLY +#endif // BOOST_CHRONO_CONFIG_HPP + diff --git a/3rdParty/Boost/src/boost/chrono/detail/inlined/chrono.hpp b/3rdParty/Boost/src/boost/chrono/detail/inlined/chrono.hpp new file mode 100644 index 0000000..0278843 --- /dev/null +++ b/3rdParty/Boost/src/boost/chrono/detail/inlined/chrono.hpp @@ -0,0 +1,44 @@ +// chrono.cpp --------------------------------------------------------------// + +// Copyright Beman Dawes 2008 +// Copyright Vicente J. Botet Escriba 2009 + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +#ifndef BOOST_CHRONO_DETAIL_INLINED_CHRONO_HPP +#define BOOST_CHRONO_DETAIL_INLINED_CHRONO_HPP + +#include <boost/version.hpp> +#include <boost/chrono/chrono.hpp> +#include <boost/system/system_error.hpp> +#include <boost/throw_exception.hpp> +#include <boost/chrono/detail/system.hpp> + +//----------------------------------------------------------------------------// +// // +// Platform-specific Implementations // +// // +//----------------------------------------------------------------------------// + +//----------------------------------------------------------------------------// +// Windows // +//----------------------------------------------------------------------------// +#if defined(BOOST_CHRONO_WINDOWS_API) +#include <boost/chrono/detail/inlined/win/chrono.hpp> + +//----------------------------------------------------------------------------// +// Mac // +//----------------------------------------------------------------------------// +#elif defined(BOOST_CHRONO_MAC_API) +#include <boost/chrono/detail/inlined/mac/chrono.hpp> + +//----------------------------------------------------------------------------// +// POSIX // +//----------------------------------------------------------------------------// +#elif defined(BOOST_CHRONO_POSIX_API) +#include <boost/chrono/detail/inlined/posix/chrono.hpp> + +#endif // POSIX + +#endif diff --git a/3rdParty/Boost/src/boost/chrono/detail/inlined/mac/chrono.hpp b/3rdParty/Boost/src/boost/chrono/detail/inlined/mac/chrono.hpp new file mode 100644 index 0000000..bf20ae9 --- /dev/null +++ b/3rdParty/Boost/src/boost/chrono/detail/inlined/mac/chrono.hpp @@ -0,0 +1,241 @@ +// mac/chrono.cpp --------------------------------------------------------------// + +// Copyright Beman Dawes 2008 +// Copyright 2009-2010 Vicente J. Botet Escriba + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + + +//----------------------------------------------------------------------------// +// Mac // +//----------------------------------------------------------------------------// + +#include <sys/time.h> //for gettimeofday and timeval +#include <mach/mach_time.h> // mach_absolute_time, mach_timebase_info_data_t + +namespace boost +{ +namespace chrono +{ + +// system_clock + +// gettimeofday is the most precise "system time" available on this platform. +// It returns the number of microseconds since New Years 1970 in a struct called timeval +// which has a field for seconds and a field for microseconds. +// Fill in the timeval and then convert that to the time_point +system_clock::time_point +system_clock::now() BOOST_NOEXCEPT +{ + timeval tv; + gettimeofday(&tv, 0); + return time_point(seconds(tv.tv_sec) + microseconds(tv.tv_usec)); +} + +#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING +system_clock::time_point +system_clock::now(system::error_code & ec) +{ + timeval tv; + gettimeofday(&tv, 0); + if (!BOOST_CHRONO_IS_THROWS(ec)) + { + ec.clear(); + } + return time_point(seconds(tv.tv_sec) + microseconds(tv.tv_usec)); +} +#endif +// Take advantage of the fact that on this platform time_t is nothing but +// an integral count of seconds since New Years 1970 (same epoch as timeval). +// Just get the duration out of the time_point and truncate it to seconds. +time_t +system_clock::to_time_t(const time_point& t) BOOST_NOEXCEPT +{ + return time_t(duration_cast<seconds>(t.time_since_epoch()).count()); +} + +// Just turn the time_t into a count of seconds and construct a time_point with it. +system_clock::time_point +system_clock::from_time_t(time_t t) BOOST_NOEXCEPT +{ + return system_clock::time_point(seconds(t)); +} + +namespace chrono_detail +{ + +// steady_clock + +// Note, in this implementation steady_clock and high_resolution_clock +// are the same clock. They are both based on mach_absolute_time(). +// mach_absolute_time() * MachInfo.numer / MachInfo.denom is the number of +// nanoseconds since the computer booted up. MachInfo.numer and MachInfo.denom +// are run time constants supplied by the OS. This clock has no relationship +// to the Gregorian calendar. It's main use is as a high resolution timer. + +// MachInfo.numer / MachInfo.denom is often 1 on the latest equipment. Specialize +// for that case as an optimization. +BOOST_CHRONO_STATIC +steady_clock::rep +steady_simplified() +{ + return mach_absolute_time(); +} + +#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING +BOOST_CHRONO_STATIC +steady_clock::rep +steady_simplified_ec(system::error_code & ec) +{ + if (!BOOST_CHRONO_IS_THROWS(ec)) + { + ec.clear(); + } + return mach_absolute_time(); +} +#endif + +BOOST_CHRONO_STATIC +double +compute_steady_factor(kern_return_t& err) +{ + mach_timebase_info_data_t MachInfo; + err = mach_timebase_info(&MachInfo); + if ( err != 0 ) { + return 0; + } + return static_cast<double>(MachInfo.numer) / MachInfo.denom; +} + +BOOST_CHRONO_STATIC +steady_clock::rep +steady_full() +{ + static kern_return_t err; + static const double factor = chrono_detail::compute_steady_factor(err); + if (err != 0) + { + BOOST_ASSERT(0 && "Boost::Chrono - Internal Error"); + } + return static_cast<steady_clock::rep>(mach_absolute_time() * factor); +} + +#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING +BOOST_CHRONO_STATIC +steady_clock::rep +steady_full_ec(system::error_code & ec) +{ + static kern_return_t err; + static const double factor = chrono_detail::compute_steady_factor(err); + if (err != 0) + { + if (BOOST_CHRONO_IS_THROWS(ec)) + { + boost::throw_exception( + system::system_error( + err, + BOOST_CHRONO_SYSTEM_CATEGORY, + "chrono::steady_clock" )); + } + else + { + ec.assign( errno, BOOST_CHRONO_SYSTEM_CATEGORY ); + return steady_clock::rep(); + } + } + if (!BOOST_CHRONO_IS_THROWS(ec)) + { + ec.clear(); + } + return static_cast<steady_clock::rep>(mach_absolute_time() * factor); +} +#endif + +typedef steady_clock::rep (*FP)(); +#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING +typedef steady_clock::rep (*FP_ec)(system::error_code &); +#endif + +BOOST_CHRONO_STATIC +FP +init_steady_clock(kern_return_t & err) +{ + mach_timebase_info_data_t MachInfo; + err = mach_timebase_info(&MachInfo); + if ( err != 0 ) + { + return 0; + } + + if (MachInfo.numer == MachInfo.denom) + { + return &chrono_detail::steady_simplified; + } + return &chrono_detail::steady_full; +} + +#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING +BOOST_CHRONO_STATIC +FP_ec +init_steady_clock_ec(kern_return_t & err) +{ + mach_timebase_info_data_t MachInfo; + err = mach_timebase_info(&MachInfo); + if ( err != 0 ) + { + return 0; + } + + if (MachInfo.numer == MachInfo.denom) + { + return &chrono_detail::steady_simplified_ec; + } + return &chrono_detail::steady_full_ec; +} +#endif +} + +steady_clock::time_point +steady_clock::now() BOOST_NOEXCEPT +{ + static kern_return_t err; + static chrono_detail::FP fp = chrono_detail::init_steady_clock(err); + if ( err != 0 ) + { + BOOST_ASSERT(0 && "Boost::Chrono - Internal Error"); + } + return time_point(duration(fp())); +} + +#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING +steady_clock::time_point +steady_clock::now(system::error_code & ec) +{ + static kern_return_t err; + static chrono_detail::FP_ec fp = chrono_detail::init_steady_clock_ec(err); + if ( err != 0 ) + { + if (BOOST_CHRONO_IS_THROWS(ec)) + { + boost::throw_exception( + system::system_error( + err, + BOOST_CHRONO_SYSTEM_CATEGORY, + "chrono::steady_clock" )); + } + else + { + ec.assign( err, BOOST_CHRONO_SYSTEM_CATEGORY ); + return time_point(); + } + } + if (!BOOST_CHRONO_IS_THROWS(ec)) + { + ec.clear(); + } + return time_point(duration(fp(ec))); +} +#endif +} // namespace chrono +} // namespace boost diff --git a/3rdParty/Boost/src/boost/chrono/detail/inlined/posix/chrono.hpp b/3rdParty/Boost/src/boost/chrono/detail/inlined/posix/chrono.hpp new file mode 100644 index 0000000..e35a7ce --- /dev/null +++ b/3rdParty/Boost/src/boost/chrono/detail/inlined/posix/chrono.hpp @@ -0,0 +1,120 @@ +// posix/chrono.cpp --------------------------------------------------------------// + +// Copyright Beman Dawes 2008 +// Copyright Vicente J. Botet Escriba 2009 + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +//----------------------------------------------------------------------------// +// POSIX // +//----------------------------------------------------------------------------// + +#include <time.h> // for clock_gettime + +namespace boost +{ +namespace chrono +{ + + system_clock::time_point system_clock::now() BOOST_NOEXCEPT + { + timespec ts; + if ( ::clock_gettime( CLOCK_REALTIME, &ts ) ) + { + BOOST_ASSERT(0 && "Boost::Chrono - Internal Error"); + } + + return time_point(duration( + static_cast<system_clock::rep>( ts.tv_sec ) * 1000000000 + ts.tv_nsec)); + } + +#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING + system_clock::time_point system_clock::now(system::error_code & ec) + { + timespec ts; + if ( ::clock_gettime( CLOCK_REALTIME, &ts ) ) + { + if (BOOST_CHRONO_IS_THROWS(ec)) + { + boost::throw_exception( + system::system_error( + errno, + BOOST_CHRONO_SYSTEM_CATEGORY, + "chrono::system_clock" )); + } + else + { + ec.assign( errno, BOOST_CHRONO_SYSTEM_CATEGORY ); + return time_point(); + } + } + + if (!BOOST_CHRONO_IS_THROWS(ec)) + { + ec.clear(); + } + return time_point(duration( + static_cast<system_clock::rep>( ts.tv_sec ) * 1000000000 + ts.tv_nsec)); + } +#endif + + std::time_t system_clock::to_time_t(const system_clock::time_point& t) BOOST_NOEXCEPT + { + return static_cast<std::time_t>( t.time_since_epoch().count() / 1000000000 ); + } + + system_clock::time_point system_clock::from_time_t(std::time_t t) BOOST_NOEXCEPT + { + return time_point(duration(static_cast<system_clock::rep>(t) * 1000000000)); + } + +#ifdef BOOST_CHRONO_HAS_CLOCK_STEADY + + steady_clock::time_point steady_clock::now() BOOST_NOEXCEPT + { + timespec ts; + if ( ::clock_gettime( CLOCK_MONOTONIC, &ts ) ) + { + BOOST_ASSERT(0 && "Boost::Chrono - Internal Error"); + } + + return time_point(duration( + static_cast<steady_clock::rep>( ts.tv_sec ) * 1000000000 + ts.tv_nsec)); + } + +#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING + steady_clock::time_point steady_clock::now(system::error_code & ec) + { + timespec ts; + if ( ::clock_gettime( CLOCK_MONOTONIC, &ts ) ) + { + if (BOOST_CHRONO_IS_THROWS(ec)) + { + boost::throw_exception( + system::system_error( + errno, + BOOST_CHRONO_SYSTEM_CATEGORY, + "chrono::steady_clock" )); + } + else + { + ec.assign( errno, BOOST_CHRONO_SYSTEM_CATEGORY ); + return time_point(); + } + } + + if (!BOOST_CHRONO_IS_THROWS(ec)) + { + ec.clear(); + } + return time_point(duration( + static_cast<steady_clock::rep>( ts.tv_sec ) * 1000000000 + ts.tv_nsec)); + } +#endif +#endif + +} // namespace chrono +} // namespace boost + + diff --git a/3rdParty/Boost/src/boost/chrono/detail/inlined/win/chrono.hpp b/3rdParty/Boost/src/boost/chrono/detail/inlined/win/chrono.hpp new file mode 100644 index 0000000..75160db --- /dev/null +++ b/3rdParty/Boost/src/boost/chrono/detail/inlined/win/chrono.hpp @@ -0,0 +1,160 @@ +// win/chrono.cpp --------------------------------------------------------------// + +// Copyright Beman Dawes 2008 +// Copyright 2009-2010 Vicente J. Botet Escriba + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +//----------------------------------------------------------------------------// +// Windows // +//----------------------------------------------------------------------------// +#ifndef BOOST_CHRONO_DETAIL_INLINED_WIN_CHRONO_HPP +#define BOOST_CHRONO_DETAIL_INLINED_WIN_CHRONO_HPP + +#include <boost/detail/win/time.hpp> +#include <boost/detail/win/timers.hpp> +#include <boost/detail/win/GetLastError.hpp> + +namespace boost +{ +namespace chrono +{ +namespace chrono_detail +{ + + BOOST_CHRONO_INLINE double get_nanosecs_per_tic() BOOST_NOEXCEPT + { + boost::detail::win32::LARGE_INTEGER_ freq; + if ( !boost::detail::win32::QueryPerformanceFrequency( &freq ) ) + return 0.0L; + return double(1000000000.0L / freq.QuadPart); + } + +} + + steady_clock::time_point steady_clock::now() BOOST_NOEXCEPT + { + static double nanosecs_per_tic = chrono_detail::get_nanosecs_per_tic(); + + boost::detail::win32::LARGE_INTEGER_ pcount; + if ( (nanosecs_per_tic <= 0.0L) || + (!boost::detail::win32::QueryPerformanceCounter( &pcount )) ) + { + BOOST_ASSERT(0 && "Boost::Chrono - Internal Error"); + return steady_clock::time_point(); + } + + return steady_clock::time_point(steady_clock::duration( + static_cast<steady_clock::rep>((nanosecs_per_tic) * pcount.QuadPart))); + } + + +#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING + steady_clock::time_point steady_clock::now( system::error_code & ec ) + { + static double nanosecs_per_tic = chrono_detail::get_nanosecs_per_tic(); + + boost::detail::win32::LARGE_INTEGER_ pcount; + if ( (nanosecs_per_tic <= 0.0L) + || (!boost::detail::win32::QueryPerformanceCounter( &pcount )) ) + { + boost::detail::win32::DWORD_ cause = + ((nanosecs_per_tic <= 0.0L) + ? ERROR_NOT_SUPPORTED + : boost::detail::win32::GetLastError()); + if (BOOST_CHRONO_IS_THROWS(ec)) { + boost::throw_exception( + system::system_error( + cause, + BOOST_CHRONO_SYSTEM_CATEGORY, + "chrono::steady_clock" )); + } + else + { + ec.assign( cause, BOOST_CHRONO_SYSTEM_CATEGORY ); + return steady_clock::time_point(duration(0)); + } + } + + if (!BOOST_CHRONO_IS_THROWS(ec)) + { + ec.clear(); + } + return time_point(duration( + static_cast<steady_clock::rep>(nanosecs_per_tic * pcount.QuadPart))); + } +#endif + + BOOST_CHRONO_INLINE + system_clock::time_point system_clock::now() BOOST_NOEXCEPT + { + boost::detail::win32::FILETIME_ ft; + #if defined(UNDER_CE) + // Windows CE does not define GetSystemTimeAsFileTime so we do it in two steps. + boost::detail::win32::SYSTEMTIME_ st; + boost::detail::win32::GetSystemTime( &st ); + boost::detail::win32::SystemTimeToFileTime( &st, &ft ); + #else + boost::detail::win32::GetSystemTimeAsFileTime( &ft ); // never fails + #endif + return system_clock::time_point(system_clock::duration( + (static_cast<__int64>( ft.dwHighDateTime ) << 32) | ft.dwLowDateTime)); + } + +#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING + BOOST_CHRONO_INLINE + system_clock::time_point system_clock::now( system::error_code & ec ) + { + boost::detail::win32::FILETIME_ ft; + #if defined(UNDER_CE) + // Windows CE does not define GetSystemTimeAsFileTime so we do it in two steps. + boost::detail::win32::SYSTEMTIME_ st; + boost::detail::win32::GetSystemTime( &st ); + boost::detail::win32::SystemTimeToFileTime( &st, &ft ); + #else + boost::detail::win32::GetSystemTimeAsFileTime( &ft ); // never fails + #endif + if (!BOOST_CHRONO_IS_THROWS(ec)) + { + ec.clear(); + } + return time_point(duration( + (static_cast<__int64>( ft.dwHighDateTime ) << 32) | ft.dwLowDateTime)); + } +#endif + + BOOST_CHRONO_INLINE + std::time_t system_clock::to_time_t(const system_clock::time_point& t) BOOST_NOEXCEPT + { + __int64 temp = t.time_since_epoch().count(); + + # if (!defined( BOOST_MSVC )) || (BOOST_MSVC > 1300) // > VC++ 7.0 + temp -= 116444736000000000LL; // delta from epoch in microseconds + # else + temp -= 116444736000000000; + # endif + + temp /= 10000000; + return static_cast<std::time_t>( temp ); + } + + BOOST_CHRONO_INLINE + system_clock::time_point system_clock::from_time_t(std::time_t t) BOOST_NOEXCEPT + { + __int64 temp = t; + temp *= 10000000; + + # if (!defined( BOOST_MSVC )) || (BOOST_MSVC > 1300) // > VC++ 7.0 + temp += 116444736000000000LL; + # else + temp += 116444736000000000; + # endif + + return time_point(duration(temp)); + } + +} // namespace chrono +} // namespace boost + +#endif diff --git a/3rdParty/Boost/src/boost/chrono/detail/is_evenly_divisible_by.hpp b/3rdParty/Boost/src/boost/chrono/detail/is_evenly_divisible_by.hpp new file mode 100644 index 0000000..960a208 --- /dev/null +++ b/3rdParty/Boost/src/boost/chrono/detail/is_evenly_divisible_by.hpp @@ -0,0 +1,31 @@ +// is_evenly_divisible_by.hpp --------------------------------------------------------------// + +// Copyright 2009-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_CHRONO_DETAIL_IS_EVENLY_DIVISIBLE_BY_HPP +#define BOOST_CHRONO_DETAIL_IS_EVENLY_DIVISIBLE_BY_HPP + +#include <boost/chrono/config.hpp> + +#include <boost/mpl/logical.hpp> +#include <boost/ratio/detail/overflow_helpers.hpp> + +namespace boost { +namespace chrono { +namespace chrono_detail { + +// template <class R1, class R2> +// struct is_evenly_divisible_by : public boost::mpl::bool_ < ratio_divide<R1, R2>::type::den == 1 > +// {}; + template <class R1, class R2> + struct is_evenly_divisible_by : public boost::ratio_detail::is_evenly_divisible_by<R1, R2> + {}; + +} // namespace chrono_detail +} // namespace detail +} // namespace chrono + +#endif // BOOST_CHRONO_DETAIL_IS_EVENLY_DIVISIBLE_BY_HPP diff --git a/3rdParty/Boost/src/boost/chrono/detail/static_assert.hpp b/3rdParty/Boost/src/boost/chrono/detail/static_assert.hpp new file mode 100644 index 0000000..8615194 --- /dev/null +++ b/3rdParty/Boost/src/boost/chrono/detail/static_assert.hpp @@ -0,0 +1,30 @@ +// static_assert.hpp --------------------------------------------------------------// + +// Copyright 2009-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_CHRONO_DETAIL_STATIC_ASSERT_HPP +#define BOOST_CHRONO_DETAIL_STATIC_ASSERT_HPP + +#include <boost/chrono/config.hpp> + +#ifndef BOOST_NO_CXX11_STATIC_ASSERT +#define BOOST_CHRONO_STATIC_ASSERT(CND, MSG, TYPES) static_assert(CND,MSG) +#elif defined(BOOST_CHRONO_USES_STATIC_ASSERT) +#include <boost/static_assert.hpp> +#define BOOST_CHRONO_STATIC_ASSERT(CND, MSG, TYPES) BOOST_STATIC_ASSERT(CND) +#elif defined(BOOST_CHRONO_USES_MPL_ASSERT) +#include <boost/mpl/assert.hpp> +#include <boost/mpl/bool.hpp> +#define BOOST_CHRONO_STATIC_ASSERT(CND, MSG, TYPES) \ + BOOST_MPL_ASSERT_MSG(boost::mpl::bool_< (CND) >::type::value, MSG, TYPES) +#else +//~ #elif defined(BOOST_CHRONO_USES_ARRAY_ASSERT) +#define BOOST_CHRONO_STATIC_ASSERT(CND, MSG, TYPES) static char BOOST_JOIN(boost_chrono_test_,__LINE__)[(CND)?1:-1] +//~ #define BOOST_CHRONO_STATIC_ASSERT(CND, MSG, TYPES) +#endif + +#endif // BOOST_CHRONO_DETAIL_STATIC_ASSERT_HPP diff --git a/3rdParty/Boost/src/boost/chrono/detail/system.hpp b/3rdParty/Boost/src/boost/chrono/detail/system.hpp new file mode 100644 index 0000000..0dcffe8 --- /dev/null +++ b/3rdParty/Boost/src/boost/chrono/detail/system.hpp @@ -0,0 +1,29 @@ +// Copyright 2009-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_CHRONO_DETAIL_SYSTEM_HPP +#define BOOST_CHRONO_DETAIL_SYSTEM_HPP + +#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING + +#include <boost/version.hpp> +#include <boost/system/error_code.hpp> + +#if ((BOOST_VERSION / 100000) < 2) && ((BOOST_VERSION / 100 % 1000) < 44) +#define BOOST_CHRONO_SYSTEM_CATEGORY boost::system::system_category +#else +#define BOOST_CHRONO_SYSTEM_CATEGORY boost::system::system_category() +#endif + +#ifdef BOOST_SYSTEM_NO_DEPRECATED +#define BOOST_CHRONO_THROWS boost::throws() +#define BOOST_CHRONO_IS_THROWS(EC) (&EC==&boost::throws()) +#else +#define BOOST_CHRONO_THROWS boost::system::throws +#define BOOST_CHRONO_IS_THROWS(EC) (&EC==&boost::system::throws) +#endif + +#endif +#endif diff --git a/3rdParty/Boost/src/boost/chrono/duration.hpp b/3rdParty/Boost/src/boost/chrono/duration.hpp new file mode 100644 index 0000000..97fe3d7 --- /dev/null +++ b/3rdParty/Boost/src/boost/chrono/duration.hpp @@ -0,0 +1,795 @@ +// duration.hpp --------------------------------------------------------------// + +// Copyright 2008 Howard Hinnant +// Copyright 2008 Beman Dawes +// Copyright 2009-2011 Vicente J. Botet Escriba + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +/* + +This code was derived by Beman Dawes from Howard Hinnant's time2_demo prototype. +Many thanks to Howard for making his code available under the Boost license. +The original code was modified to conform to Boost conventions and to section +20.9 Time utilities [time] of the C++ committee's working paper N2798. +See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2798.pdf. + +time2_demo contained this comment: + + Much thanks to Andrei Alexandrescu, + Walter Brown, + Peter Dimov, + Jeff Garland, + Terry Golubiewski, + Daniel Krugler, + Anthony Williams. +*/ + + +#ifndef BOOST_CHRONO_DURATION_HPP +#define BOOST_CHRONO_DURATION_HPP + +#include <boost/chrono/config.hpp> +#include <boost/chrono/detail/static_assert.hpp> + +#include <climits> +#include <limits> + + +#include <boost/mpl/logical.hpp> +#include <boost/ratio/ratio.hpp> +#include <boost/type_traits/common_type.hpp> +#include <boost/type_traits/is_arithmetic.hpp> +#include <boost/type_traits/is_convertible.hpp> +#include <boost/type_traits/is_floating_point.hpp> +#include <boost/type_traits/is_unsigned.hpp> +#include <boost/chrono/detail/is_evenly_divisible_by.hpp> + +#include <boost/cstdint.hpp> +#include <boost/utility/enable_if.hpp> +#include <boost/detail/workaround.hpp> +#include <boost/integer_traits.hpp> + +#if !defined(BOOST_NO_CXX11_STATIC_ASSERT) || !defined(BOOST_CHRONO_USES_MPL_ASSERT) +#define BOOST_CHRONO_A_DURATION_REPRESENTATION_CAN_NOT_BE_A_DURATION "A duration representation can not be a duration" +#define BOOST_CHRONO_SECOND_TEMPLATE_PARAMETER_OF_DURATION_MUST_BE_A_STD_RATIO "Second template parameter of duration must be a boost::ratio" +#define BOOST_CHRONO_DURATION_PERIOD_MUST_BE_POSITIVE "duration period must be positive" +#define BOOST_CHRONO_SECOND_TEMPLATE_PARAMETER_OF_TIME_POINT_MUST_BE_A_BOOST_CHRONO_DURATION "Second template parameter of time_point must be a boost::chrono::duration" +#endif + +#ifndef BOOST_CHRONO_HEADER_ONLY +// this must occur after all of the includes and before any code appears: +#include <boost/config/abi_prefix.hpp> // must be the last #include +#endif + +//----------------------------------------------------------------------------// +// // +// 20.9 Time utilities [time] // +// synopsis // +// // +//----------------------------------------------------------------------------// + +namespace boost { +namespace chrono { + + template <class Rep, class Period = ratio<1> > + class duration; + + namespace detail + { + template <class T> + struct is_duration + : boost::false_type {}; + + template <class Rep, class Period> + struct is_duration<duration<Rep, Period> > + : boost::true_type {}; + + template <class Duration, class Rep, bool = is_duration<Rep>::value> + struct duration_divide_result + { + }; + + template <class Duration, class Rep2, + bool = ( + ((boost::is_convertible<typename Duration::rep, + typename common_type<typename Duration::rep, Rep2>::type>::value)) + && ((boost::is_convertible<Rep2, + typename common_type<typename Duration::rep, Rep2>::type>::value)) + ) + > + struct duration_divide_imp + { + }; + + template <class Rep1, class Period, class Rep2> + struct duration_divide_imp<duration<Rep1, Period>, Rep2, true> + { + typedef duration<typename common_type<Rep1, Rep2>::type, Period> type; + }; + + template <class Rep1, class Period, class Rep2> + struct duration_divide_result<duration<Rep1, Period>, Rep2, false> + : duration_divide_imp<duration<Rep1, Period>, Rep2> + { + }; + +/// + template <class Rep, class Duration, bool = is_duration<Rep>::value> + struct duration_divide_result2 + { + }; + + template <class Rep, class Duration, + bool = ( + ((boost::is_convertible<typename Duration::rep, + typename common_type<typename Duration::rep, Rep>::type>::value)) + && ((boost::is_convertible<Rep, + typename common_type<typename Duration::rep, Rep>::type>::value)) + ) + > + struct duration_divide_imp2 + { + }; + + template <class Rep1, class Rep2, class Period > + struct duration_divide_imp2<Rep1, duration<Rep2, Period>, true> + { + //typedef typename common_type<Rep1, Rep2>::type type; + typedef double type; + }; + + template <class Rep1, class Rep2, class Period > + struct duration_divide_result2<Rep1, duration<Rep2, Period>, false> + : duration_divide_imp2<Rep1, duration<Rep2, Period> > + { + }; + +/// + template <class Duration, class Rep, bool = is_duration<Rep>::value> + struct duration_modulo_result + { + }; + + template <class Duration, class Rep2, + bool = ( + //boost::is_convertible<typename Duration::rep, + //typename common_type<typename Duration::rep, Rep2>::type>::value + //&& + boost::is_convertible<Rep2, + typename common_type<typename Duration::rep, Rep2>::type>::value + ) + > + struct duration_modulo_imp + { + }; + + template <class Rep1, class Period, class Rep2> + struct duration_modulo_imp<duration<Rep1, Period>, Rep2, true> + { + typedef duration<typename common_type<Rep1, Rep2>::type, Period> type; + }; + + template <class Rep1, class Period, class Rep2> + struct duration_modulo_result<duration<Rep1, Period>, Rep2, false> + : duration_modulo_imp<duration<Rep1, Period>, Rep2> + { + }; + +} // namespace detail +} // namespace chrono + + +// common_type trait specializations + +template <class Rep1, class Period1, class Rep2, class Period2> +struct common_type<chrono::duration<Rep1, Period1>, + chrono::duration<Rep2, Period2> >; + + +namespace chrono { + + // customization traits + template <class Rep> struct treat_as_floating_point; + template <class Rep> struct duration_values; + + // convenience typedefs + typedef duration<boost::int_least64_t, nano> nanoseconds; // at least 64 bits needed + typedef duration<boost::int_least64_t, micro> microseconds; // at least 55 bits needed + typedef duration<boost::int_least64_t, milli> milliseconds; // at least 45 bits needed + typedef duration<boost::int_least64_t> seconds; // at least 35 bits needed + typedef duration<boost::int_least32_t, ratio< 60> > minutes; // at least 29 bits needed + typedef duration<boost::int_least32_t, ratio<3600> > hours; // at least 23 bits needed + +//----------------------------------------------------------------------------// +// duration helpers // +//----------------------------------------------------------------------------// + +namespace detail +{ + + // duration_cast + + // duration_cast is the heart of this whole prototype. It can convert any + // duration to any other. It is also (implicitly) used in converting + // time_points. The conversion is always exact if possible. And it is + // always as efficient as hand written code. If different representations + // are involved, care is taken to never require implicit conversions. + // Instead static_cast is used explicitly for every required conversion. + // If there are a mixture of integral and floating point representations, + // the use of common_type ensures that the most logical "intermediate" + // representation is used. + template <class FromDuration, class ToDuration, + class Period, + bool PeriodNumEq1, + bool PeriodDenEq1> + struct duration_cast_aux; + + // When the two periods are the same, all that is left to do is static_cast from + // the source representation to the target representation (which may be a no-op). + // This conversion is always exact as long as the static_cast from the source + // representation to the destination representation is exact. + template <class FromDuration, class ToDuration, class Period> + struct duration_cast_aux<FromDuration, ToDuration, Period, true, true> + { + BOOST_CONSTEXPR ToDuration operator()(const FromDuration& fd) const + { + return ToDuration(static_cast<typename ToDuration::rep>(fd.count())); + } + }; + + // When the numerator of FromPeriod / ToPeriod is 1, then all we need to do is + // divide by the denominator of FromPeriod / ToPeriod. The common_type of + // the two representations is used for the intermediate computation before + // static_cast'ing to the destination. + // This conversion is generally not exact because of the division (but could be + // if you get lucky on the run time value of fd.count()). + template <class FromDuration, class ToDuration, class Period> + struct duration_cast_aux<FromDuration, ToDuration, Period, true, false> + { + BOOST_CONSTEXPR ToDuration operator()(const FromDuration& fd) const + { + typedef typename common_type< + typename ToDuration::rep, + typename FromDuration::rep, + boost::intmax_t>::type C; + return ToDuration(static_cast<typename ToDuration::rep>( + static_cast<C>(fd.count()) / static_cast<C>(Period::den))); + } + }; + + // When the denominator of FromPeriod / ToPeriod is 1, then all we need to do is + // multiply by the numerator of FromPeriod / ToPeriod. The common_type of + // the two representations is used for the intermediate computation before + // static_cast'ing to the destination. + // This conversion is always exact as long as the static_cast's involved are exact. + template <class FromDuration, class ToDuration, class Period> + struct duration_cast_aux<FromDuration, ToDuration, Period, false, true> + { + BOOST_CONSTEXPR ToDuration operator()(const FromDuration& fd) const + { + typedef typename common_type< + typename ToDuration::rep, + typename FromDuration::rep, + boost::intmax_t>::type C; + return ToDuration(static_cast<typename ToDuration::rep>( + static_cast<C>(fd.count()) * static_cast<C>(Period::num))); + } + }; + + // When neither the numerator or denominator of FromPeriod / ToPeriod is 1, then we need to + // multiply by the numerator and divide by the denominator of FromPeriod / ToPeriod. The + // common_type of the two representations is used for the intermediate computation before + // static_cast'ing to the destination. + // This conversion is generally not exact because of the division (but could be + // if you get lucky on the run time value of fd.count()). + template <class FromDuration, class ToDuration, class Period> + struct duration_cast_aux<FromDuration, ToDuration, Period, false, false> + { + BOOST_CONSTEXPR ToDuration operator()(const FromDuration& fd) const + { + typedef typename common_type< + typename ToDuration::rep, + typename FromDuration::rep, + boost::intmax_t>::type C; + return ToDuration(static_cast<typename ToDuration::rep>( + static_cast<C>(fd.count()) * static_cast<C>(Period::num) + / static_cast<C>(Period::den))); + } + }; + + template <class FromDuration, class ToDuration> + struct duration_cast { + typedef typename ratio_divide<typename FromDuration::period, + typename ToDuration::period>::type Period; + typedef duration_cast_aux< + FromDuration, + ToDuration, + Period, + Period::num == 1, + Period::den == 1 + > Aux; + BOOST_CONSTEXPR ToDuration operator()(const FromDuration& fd) const + { + return Aux()(fd); + } + }; + +} // namespace detail + +//----------------------------------------------------------------------------// +// // +// 20.9.2 Time-related traits [time.traits] // +// // +//----------------------------------------------------------------------------// +//----------------------------------------------------------------------------// +// 20.9.2.1 treat_as_floating_point [time.traits.is_fp] // +// Probably should have been treat_as_floating_point. Editor notifed. // +//----------------------------------------------------------------------------// + + // Support bidirectional (non-exact) conversions for floating point rep types + // (or user defined rep types which specialize treat_as_floating_point). + template <class Rep> + struct treat_as_floating_point : boost::is_floating_point<Rep> {}; + +//----------------------------------------------------------------------------// +// 20.9.2.2 duration_values [time.traits.duration_values] // +//----------------------------------------------------------------------------// + +namespace detail { + template <class T, bool = is_arithmetic<T>::value> + struct chrono_numeric_limits { + static BOOST_CHRONO_LIB_CONSTEXPR T lowest() BOOST_CHRONO_LIB_NOEXCEPT_OR_THROW {return (std::numeric_limits<T>::min) ();} + }; + + template <class T> + struct chrono_numeric_limits<T,true> { + static BOOST_CHRONO_LIB_CONSTEXPR T lowest() BOOST_CHRONO_LIB_NOEXCEPT_OR_THROW {return (std::numeric_limits<T>::min) ();} + }; + + template <> + struct chrono_numeric_limits<float,true> { + static BOOST_CHRONO_LIB_CONSTEXPR float lowest() BOOST_CHRONO_LIB_NOEXCEPT_OR_THROW + { + return -(std::numeric_limits<float>::max) (); + } + }; + + template <> + struct chrono_numeric_limits<double,true> { + static BOOST_CHRONO_LIB_CONSTEXPR double lowest() BOOST_CHRONO_LIB_NOEXCEPT_OR_THROW + { + return -(std::numeric_limits<double>::max) (); + } + }; + + template <> + struct chrono_numeric_limits<long double,true> { + static BOOST_CHRONO_LIB_CONSTEXPR long double lowest() BOOST_CHRONO_LIB_NOEXCEPT_OR_THROW + { + return -(std::numeric_limits<long double>::max)(); + } + }; + + template <class T> + struct numeric_limits : chrono_numeric_limits<typename remove_cv<T>::type> + {}; + +} +template <class Rep> +struct duration_values +{ + static BOOST_CONSTEXPR Rep zero() {return Rep(0);} + static BOOST_CHRONO_LIB_CONSTEXPR Rep max BOOST_PREVENT_MACRO_SUBSTITUTION () + { + return (std::numeric_limits<Rep>::max)(); + } + + static BOOST_CHRONO_LIB_CONSTEXPR Rep min BOOST_PREVENT_MACRO_SUBSTITUTION () + { + return detail::numeric_limits<Rep>::lowest(); + } +}; + +} // namespace chrono + +//----------------------------------------------------------------------------// +// 20.9.2.3 Specializations of common_type [time.traits.specializations] // +//----------------------------------------------------------------------------// + +template <class Rep1, class Period1, class Rep2, class Period2> +struct common_type<chrono::duration<Rep1, Period1>, + chrono::duration<Rep2, Period2> > +{ + typedef chrono::duration<typename common_type<Rep1, Rep2>::type, + typename boost::ratio_gcd<Period1, Period2>::type> type; +}; + + +//----------------------------------------------------------------------------// +// // +// 20.9.3 Class template duration [time.duration] // +// // +//----------------------------------------------------------------------------// + + +namespace chrono { + + template <class Rep, class Period> + class duration + { + //BOOST_CHRONO_STATIC_ASSERT(boost::is_integral<Rep>::value, BOOST_CHRONO_A_DURATION_REPRESENTATION_MUST_BE_INTEGRAL, ()); + BOOST_CHRONO_STATIC_ASSERT(!boost::chrono::detail::is_duration<Rep>::value, + BOOST_CHRONO_A_DURATION_REPRESENTATION_CAN_NOT_BE_A_DURATION, ()); + BOOST_CHRONO_STATIC_ASSERT(boost::ratio_detail::is_ratio<typename Period::type>::value, + BOOST_CHRONO_SECOND_TEMPLATE_PARAMETER_OF_DURATION_MUST_BE_A_STD_RATIO, ()); + BOOST_CHRONO_STATIC_ASSERT(Period::num>0, + BOOST_CHRONO_DURATION_PERIOD_MUST_BE_POSITIVE, ()); + public: + typedef Rep rep; + typedef Period period; + private: + rep rep_; + public: + + BOOST_CONSTEXPR + duration() : rep_(duration_values<rep>::zero()) { } + template <class Rep2> + BOOST_CONSTEXPR + explicit duration(const Rep2& r + , typename boost::enable_if < + mpl::and_ < + boost::is_convertible<Rep2, rep>, + mpl::or_ < + treat_as_floating_point<rep>, + mpl::and_ < + mpl::not_ < treat_as_floating_point<rep> >, + mpl::not_ < treat_as_floating_point<Rep2> > + > + > + > + >::type* = 0 + ) : rep_(r) { } + //~duration() {} //= default; + //BOOST_CONSTEXPR + //duration(const duration& rhs) : rep_(rhs.rep_) {} // = default; + duration& operator=(const duration& rhs) // = default; + { + if (&rhs != this) rep_= rhs.rep_; + return *this; + } + + // conversions + template <class Rep2, class Period2> + BOOST_CONSTEXPR + duration(const duration<Rep2, Period2>& d + , typename boost::enable_if < + mpl::or_ < + treat_as_floating_point<rep>, + mpl::and_ < + chrono_detail::is_evenly_divisible_by<Period2, period>, + mpl::not_ < treat_as_floating_point<Rep2> > + > + > + >::type* = 0 + ) + : rep_(chrono::detail::duration_cast<duration<Rep2, Period2>, duration>()(d).count()) {} + + // observer + + BOOST_CONSTEXPR + rep count() const {return rep_;} + + // arithmetic + + BOOST_CONSTEXPR + duration operator+() const {return duration(rep_);;} + BOOST_CONSTEXPR + duration operator-() const {return duration(-rep_);} + duration& operator++() {++rep_; return *this;} + duration operator++(int) {return duration(rep_++);} + duration& operator--() {--rep_; return *this;} + duration operator--(int) {return duration(rep_--);} + + duration& operator+=(const duration& d) + { + rep_ += d.count(); return *this; + } + duration& operator-=(const duration& d) + { + rep_ -= d.count(); return *this; + } + + duration& operator*=(const rep& rhs) {rep_ *= rhs; return *this;} + duration& operator/=(const rep& rhs) {rep_ /= rhs; return *this;} + duration& operator%=(const rep& rhs) {rep_ %= rhs; return *this;} + duration& operator%=(const duration& rhs) + { + rep_ %= rhs.count(); return *this; + } + // 20.9.3.4 duration special values [time.duration.special] + + static BOOST_CONSTEXPR duration zero() + { + return duration(duration_values<rep>::zero()); + } + static BOOST_CHRONO_LIB_CONSTEXPR duration min BOOST_PREVENT_MACRO_SUBSTITUTION () + { + return duration((duration_values<rep>::min)()); + } + static BOOST_CHRONO_LIB_CONSTEXPR duration max BOOST_PREVENT_MACRO_SUBSTITUTION () + { + return duration((duration_values<rep>::max)()); + } + }; + +//----------------------------------------------------------------------------// +// 20.9.3.5 duration non-member arithmetic [time.duration.nonmember] // +//----------------------------------------------------------------------------// + + // Duration + + + template <class Rep1, class Period1, class Rep2, class Period2> + inline BOOST_CONSTEXPR + typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2> >::type + operator+(const duration<Rep1, Period1>& lhs, + const duration<Rep2, Period2>& rhs) + { + typedef typename common_type<duration<Rep1, Period1>, + duration<Rep2, Period2> >::type CD; + return CD(CD(lhs).count()+CD(rhs).count()); + } + + // Duration - + + template <class Rep1, class Period1, class Rep2, class Period2> + inline BOOST_CONSTEXPR + typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2> >::type + operator-(const duration<Rep1, Period1>& lhs, + const duration<Rep2, Period2>& rhs) + { + typedef typename common_type<duration<Rep1, Period1>, + duration<Rep2, Period2> >::type CD; + return CD(CD(lhs).count()-CD(rhs).count()); + } + + // Duration * + + template <class Rep1, class Period, class Rep2> + inline BOOST_CONSTEXPR + typename boost::enable_if < + mpl::and_ < + boost::is_convertible<Rep1, typename common_type<Rep1, Rep2>::type>, + boost::is_convertible<Rep2, typename common_type<Rep1, Rep2>::type> + >, + duration<typename common_type<Rep1, Rep2>::type, Period> + >::type + operator*(const duration<Rep1, Period>& d, const Rep2& s) + { + typedef typename common_type<Rep1, Rep2>::type CR; + typedef duration<CR, Period> CD; + return CD(CD(d).count()*static_cast<CR>(s)); + } + + template <class Rep1, class Period, class Rep2> + inline BOOST_CONSTEXPR + typename boost::enable_if < + mpl::and_ < + boost::is_convertible<Rep1, typename common_type<Rep1, Rep2>::type>, + boost::is_convertible<Rep2, typename common_type<Rep1, Rep2>::type> + >, + duration<typename common_type<Rep1, Rep2>::type, Period> + >::type + operator*(const Rep1& s, const duration<Rep2, Period>& d) + { + return d * s; + } + + // Duration / + + template <class Rep1, class Period, class Rep2> + inline BOOST_CONSTEXPR + typename boost::disable_if <boost::chrono::detail::is_duration<Rep2>, + typename boost::chrono::detail::duration_divide_result< + duration<Rep1, Period>, Rep2>::type + >::type + operator/(const duration<Rep1, Period>& d, const Rep2& s) + { + typedef typename common_type<Rep1, Rep2>::type CR; + typedef duration<CR, Period> CD; + + return CD(CD(d).count()/static_cast<CR>(s)); + } + + template <class Rep1, class Period1, class Rep2, class Period2> + inline BOOST_CONSTEXPR + typename common_type<Rep1, Rep2>::type + operator/(const duration<Rep1, Period1>& lhs, const duration<Rep2, Period2>& rhs) + { + typedef typename common_type<duration<Rep1, Period1>, + duration<Rep2, Period2> >::type CD; + return CD(lhs).count() / CD(rhs).count(); + } + + #ifdef BOOST_CHRONO_EXTENSIONS + template <class Rep1, class Rep2, class Period> + inline BOOST_CONSTEXPR + typename boost::disable_if <boost::chrono::detail::is_duration<Rep1>, + typename boost::chrono::detail::duration_divide_result2< + Rep1, duration<Rep2, Period> >::type + >::type + operator/(const Rep1& s, const duration<Rep2, Period>& d) + { + typedef typename common_type<Rep1, Rep2>::type CR; + typedef duration<CR, Period> CD; + + return static_cast<CR>(s)/CD(d).count(); + } + #endif + // Duration % + + template <class Rep1, class Period, class Rep2> + inline BOOST_CONSTEXPR + typename boost::disable_if <boost::chrono::detail::is_duration<Rep2>, + typename boost::chrono::detail::duration_modulo_result< + duration<Rep1, Period>, Rep2>::type + >::type + operator%(const duration<Rep1, Period>& d, const Rep2& s) + { + typedef typename common_type<Rep1, Rep2>::type CR; + typedef duration<CR, Period> CD; + + return CD(CD(d).count()%static_cast<CR>(s)); + } + + template <class Rep1, class Period1, class Rep2, class Period2> + inline BOOST_CONSTEXPR + typename common_type<duration<Rep1, Period1>, duration<Rep2, Period2> >::type + operator%(const duration<Rep1, Period1>& lhs, + const duration<Rep2, Period2>& rhs) { + typedef typename common_type<duration<Rep1, Period1>, + duration<Rep2, Period2> >::type CD; + + return CD(CD(lhs).count()%CD(rhs).count()); + } + + +//----------------------------------------------------------------------------// +// 20.9.3.6 duration comparisons [time.duration.comparisons] // +//----------------------------------------------------------------------------// + +namespace detail +{ + template <class LhsDuration, class RhsDuration> + struct duration_eq + { + BOOST_CONSTEXPR bool operator()(const LhsDuration& lhs, const RhsDuration& rhs) + { + typedef typename common_type<LhsDuration, RhsDuration>::type CD; + return CD(lhs).count() == CD(rhs).count(); + } + }; + + template <class LhsDuration> + struct duration_eq<LhsDuration, LhsDuration> + { + BOOST_CONSTEXPR bool operator()(const LhsDuration& lhs, const LhsDuration& rhs) + { + return lhs.count() == rhs.count(); + } + }; + + template <class LhsDuration, class RhsDuration> + struct duration_lt + { + BOOST_CONSTEXPR bool operator()(const LhsDuration& lhs, const RhsDuration& rhs) + { + typedef typename common_type<LhsDuration, RhsDuration>::type CD; + return CD(lhs).count() < CD(rhs).count(); + } + }; + + template <class LhsDuration> + struct duration_lt<LhsDuration, LhsDuration> + { + BOOST_CONSTEXPR bool operator()(const LhsDuration& lhs, const LhsDuration& rhs) + { + return lhs.count() < rhs.count(); + } + }; + +} // namespace detail + + // Duration == + + template <class Rep1, class Period1, class Rep2, class Period2> + inline BOOST_CONSTEXPR + bool + operator==(const duration<Rep1, Period1>& lhs, + const duration<Rep2, Period2>& rhs) + { + return boost::chrono::detail::duration_eq< + duration<Rep1, Period1>, duration<Rep2, Period2> >()(lhs, rhs); + } + + // Duration != + + template <class Rep1, class Period1, class Rep2, class Period2> + inline BOOST_CONSTEXPR + bool + operator!=(const duration<Rep1, Period1>& lhs, + const duration<Rep2, Period2>& rhs) + { + return !(lhs == rhs); + } + + // Duration < + + template <class Rep1, class Period1, class Rep2, class Period2> + inline BOOST_CONSTEXPR + bool + operator< (const duration<Rep1, Period1>& lhs, + const duration<Rep2, Period2>& rhs) + { + return boost::chrono::detail::duration_lt< + duration<Rep1, Period1>, duration<Rep2, Period2> >()(lhs, rhs); + } + + // Duration > + + template <class Rep1, class Period1, class Rep2, class Period2> + inline BOOST_CONSTEXPR + bool + operator> (const duration<Rep1, Period1>& lhs, + const duration<Rep2, Period2>& rhs) + { + return rhs < lhs; + } + + // Duration <= + + template <class Rep1, class Period1, class Rep2, class Period2> + inline BOOST_CONSTEXPR + bool + operator<=(const duration<Rep1, Period1>& lhs, + const duration<Rep2, Period2>& rhs) + { + return !(rhs < lhs); + } + + // Duration >= + + template <class Rep1, class Period1, class Rep2, class Period2> + inline BOOST_CONSTEXPR + bool + operator>=(const duration<Rep1, Period1>& lhs, + const duration<Rep2, Period2>& rhs) + { + return !(lhs < rhs); + } + +//----------------------------------------------------------------------------// +// 20.9.3.7 duration_cast [time.duration.cast] // +//----------------------------------------------------------------------------// + + // Compile-time select the most efficient algorithm for the conversion... + template <class ToDuration, class Rep, class Period> + inline BOOST_CONSTEXPR + typename boost::enable_if < + boost::chrono::detail::is_duration<ToDuration>, ToDuration>::type + duration_cast(const duration<Rep, Period>& fd) + { + return boost::chrono::detail::duration_cast< + duration<Rep, Period>, ToDuration>()(fd); + } + +} // namespace chrono +} // namespace boost + +#ifndef BOOST_CHRONO_HEADER_ONLY +// the suffix header occurs after all of our code: +#include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas +#endif + +#endif // BOOST_CHRONO_DURATION_HPP diff --git a/3rdParty/Boost/src/boost/chrono/system_clocks.hpp b/3rdParty/Boost/src/boost/chrono/system_clocks.hpp new file mode 100644 index 0000000..df8b79e --- /dev/null +++ b/3rdParty/Boost/src/boost/chrono/system_clocks.hpp @@ -0,0 +1,233 @@ +// boost/chrono/system_clocks.hpp --------------------------------------------------------------// + +// Copyright 2008 Howard Hinnant +// Copyright 2008 Beman Dawes +// Copyright 2009-2011 Vicente J. Botet Escriba + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +/* + +This code was derived by Beman Dawes from Howard Hinnant's time2_demo prototype. +Many thanks to Howard for making his code available under the Boost license. +The original code was modified to conform to Boost conventions and to section +20.9 Time utilities [time] of the C++ committee's working paper N2798. +See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2798.pdf. + +time2_demo contained this comment: + + Much thanks to Andrei Alexandrescu, + Walter Brown, + Peter Dimov, + Jeff Garland, + Terry Golubiewski, + Daniel Krugler, + Anthony Williams. +*/ + +/* + +TODO: + + * Fully implement error handling, with test cases. + * Consider issues raised by Michael Marcin: + + > In the past I've seen QueryPerformanceCounter give incorrect results, + > especially with SpeedStep processors on laptops. This was many years ago and + > might have been fixed by service packs and drivers. + > + > Typically you check the results of QPC against GetTickCount to see if the + > results are reasonable. + > http://support.microsoft.com/kb/274323 + > + > I've also heard of problems with QueryPerformanceCounter in multi-processor + > systems. + > + > I know some people SetThreadAffinityMask to 1 for the current thread call + > their QueryPerformance* functions then restore SetThreadAffinityMask. This + > seems horrible to me because it forces your program to jump to another + > physical processor if it isn't already on cpu0 but they claim it worked well + > in practice because they called the timing functions infrequently. + > + > In the past I have chosen to use timeGetTime with timeBeginPeriod(1) for + > high resolution timers to avoid these issues. + +*/ + +#ifndef BOOST_CHRONO_SYSTEM_CLOCKS_HPP +#define BOOST_CHRONO_SYSTEM_CLOCKS_HPP + +#include <boost/chrono/config.hpp> +#include <boost/chrono/duration.hpp> +#include <boost/chrono/time_point.hpp> +#include <boost/chrono/detail/system.hpp> +#include <boost/chrono/clock_string.hpp> + +#include <ctime> + +# if defined( BOOST_CHRONO_POSIX_API ) +# if ! defined(CLOCK_REALTIME) +# error <time.h> does not supply CLOCK_REALTIME +# endif +# endif + +#ifdef BOOST_CHRONO_WINDOWS_API +// The system_clock tick is 100 nanoseconds +# define BOOST_SYSTEM_CLOCK_DURATION boost::chrono::duration<boost::int_least64_t, ratio<BOOST_RATIO_INTMAX_C(1), BOOST_RATIO_INTMAX_C(10000000)> > +#else +# define BOOST_SYSTEM_CLOCK_DURATION boost::chrono::nanoseconds +#endif + +// this must occur after all of the includes and before any code appears: +#ifndef BOOST_CHRONO_HEADER_ONLY +#include <boost/config/abi_prefix.hpp> // must be the last #include +#endif + + +//----------------------------------------------------------------------------// +// // +// 20.9 Time utilities [time] // +// synopsis // +// // +//----------------------------------------------------------------------------// + +namespace boost { +namespace chrono { + + // Clocks + class BOOST_CHRONO_DECL system_clock; +#ifdef BOOST_CHRONO_HAS_CLOCK_STEADY + class BOOST_CHRONO_DECL steady_clock; +#endif + +#ifdef BOOST_CHRONO_HAS_CLOCK_STEADY + typedef steady_clock high_resolution_clock; // as permitted by [time.clock.hires] +#else + typedef system_clock high_resolution_clock; // as permitted by [time.clock.hires] +#endif + +//----------------------------------------------------------------------------// +// // +// 20.9.5 Clocks [time.clock] // +// // +//----------------------------------------------------------------------------// + +// If you're porting, clocks are the system-specific (non-portable) part. +// You'll need to know how to get the current time and implement that under now(). +// You'll need to know what units (tick period) and representation makes the most +// sense for your clock and set those accordingly. +// If you know how to map this clock to time_t (perhaps your clock is std::time, which +// makes that trivial), then you can fill out system_clock's to_time_t() and from_time_t(). + +//----------------------------------------------------------------------------// +// 20.9.5.1 Class system_clock [time.clock.system] // +//----------------------------------------------------------------------------// + + class BOOST_CHRONO_DECL system_clock + { + public: + typedef BOOST_SYSTEM_CLOCK_DURATION duration; + typedef duration::rep rep; + typedef duration::period period; + typedef chrono::time_point<system_clock> time_point; + BOOST_STATIC_CONSTEXPR bool is_steady = false; + + static BOOST_CHRONO_INLINE time_point now() BOOST_NOEXCEPT; +#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING + static BOOST_CHRONO_INLINE time_point now(system::error_code & ec); +#endif + + static BOOST_CHRONO_INLINE std::time_t to_time_t(const time_point& t) BOOST_NOEXCEPT; + static BOOST_CHRONO_INLINE time_point from_time_t(std::time_t t) BOOST_NOEXCEPT; + }; + +//----------------------------------------------------------------------------// +// 20.9.5.2 Class steady_clock [time.clock.steady] // +//----------------------------------------------------------------------------// + +// As permitted by [time.clock.steady] +// The class steady_clock is conditionally supported. + +#ifdef BOOST_CHRONO_HAS_CLOCK_STEADY + class BOOST_CHRONO_DECL steady_clock + { + public: + typedef nanoseconds duration; + typedef duration::rep rep; + typedef duration::period period; + typedef chrono::time_point<steady_clock> time_point; + BOOST_STATIC_CONSTEXPR bool is_steady = true; + + static BOOST_CHRONO_INLINE time_point now() BOOST_NOEXCEPT; +#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING + static BOOST_CHRONO_INLINE time_point now(system::error_code & ec); +#endif + }; +#endif +//----------------------------------------------------------------------------// +// 20.9.5.3 Class high_resolution_clock [time.clock.hires] // +//----------------------------------------------------------------------------// + +// As permitted, steady_clock or system_clock is a typedef for high_resolution_clock. +// See synopsis. + + + template<class CharT> + struct clock_string<system_clock, CharT> + { + static std::basic_string<CharT> name() + { + static const CharT u[] = + { 's', 'y', 's', 't', 'e', 'm', '_', 'c', 'l', 'o', 'c', 'k' }; + static const std::basic_string<CharT> str(u, u + sizeof(u) + / sizeof(u[0])); + return str; + } + static std::basic_string<CharT> since() + { + static const CharT + u[] = + { ' ', 's', 'i', 'n', 'c', 'e', ' ', 'J', 'a', 'n', ' ', '1', ',', ' ', '1', '9', '7', '0' }; + static const std::basic_string<CharT> str(u, u + sizeof(u) + / sizeof(u[0])); + return str; + } + }; + +#ifdef BOOST_CHRONO_HAS_CLOCK_STEADY + + template<class CharT> + struct clock_string<steady_clock, CharT> + { + static std::basic_string<CharT> name() + { + static const CharT + u[] = + { 's', 't', 'e', 'a', 'd', 'y', '_', 'c', 'l', 'o', 'c', 'k' }; + static const std::basic_string<CharT> str(u, u + sizeof(u) + / sizeof(u[0])); + return str; + } + static std::basic_string<CharT> since() + { + const CharT u[] = + { ' ', 's', 'i', 'n', 'c', 'e', ' ', 'b', 'o', 'o', 't' }; + const std::basic_string<CharT> str(u, u + sizeof(u) / sizeof(u[0])); + return str; + } + }; + +#endif + +} // namespace chrono +} // namespace boost + +#ifndef BOOST_CHRONO_HEADER_ONLY +// the suffix header occurs after all of our code: +#include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas +#else +#include <boost/chrono/detail/inlined/chrono.hpp> +#endif + +#endif // BOOST_CHRONO_SYSTEM_CLOCKS_HPP diff --git a/3rdParty/Boost/src/boost/chrono/time_point.hpp b/3rdParty/Boost/src/boost/chrono/time_point.hpp new file mode 100644 index 0000000..7e80b59 --- /dev/null +++ b/3rdParty/Boost/src/boost/chrono/time_point.hpp @@ -0,0 +1,379 @@ +// duration.hpp --------------------------------------------------------------// + +// Copyright 2008 Howard Hinnant +// Copyright 2008 Beman Dawes +// Copyright 2009-2012 Vicente J. Botet Escriba + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +/* + +This code was derived by Beman Dawes from Howard Hinnant's time2_demo prototype. +Many thanks to Howard for making his code available under the Boost license. +The original code was modified to conform to Boost conventions and to section +20.9 Time utilities [time] of the C++ committee's working paper N2798. +See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2798.pdf. + +time2_demo contained this comment: + + Much thanks to Andrei Alexandrescu, + Walter Brown, + Peter Dimov, + Jeff Garland, + Terry Golubiewski, + Daniel Krugler, + Anthony Williams. +*/ + + +#ifndef BOOST_CHRONO_TIME_POINT_HPP +#define BOOST_CHRONO_TIME_POINT_HPP + +#include <boost/chrono/duration.hpp> +#include <iostream> + +#ifndef BOOST_CHRONO_HEADER_ONLY +// this must occur after all of the includes and before any code appears: +#include <boost/config/abi_prefix.hpp> // must be the last #include +#endif + +//----------------------------------------------------------------------------// +// // +// 20.9 Time utilities [time] // +// synopsis // +// // +//----------------------------------------------------------------------------// + +namespace boost { +namespace chrono { + + template <class Clock, class Duration = typename Clock::duration> + class time_point; + + +} // namespace chrono + + +// common_type trait specializations + +template <class Clock, class Duration1, class Duration2> + struct common_type<chrono::time_point<Clock, Duration1>, + chrono::time_point<Clock, Duration2> >; + + +//----------------------------------------------------------------------------// +// 20.9.2.3 Specializations of common_type [time.traits.specializations] // +//----------------------------------------------------------------------------// + + +template <class Clock, class Duration1, class Duration2> +struct common_type<chrono::time_point<Clock, Duration1>, + chrono::time_point<Clock, Duration2> > +{ + typedef chrono::time_point<Clock, + typename common_type<Duration1, Duration2>::type> type; +}; + + + +namespace chrono { + + // time_point arithmetic + template <class Clock, class Duration1, class Rep2, class Period2> + inline BOOST_CONSTEXPR + time_point<Clock, + typename common_type<Duration1, duration<Rep2, Period2> >::type> + operator+( + const time_point<Clock, Duration1>& lhs, + const duration<Rep2, Period2>& rhs); + template <class Rep1, class Period1, class Clock, class Duration2> + inline BOOST_CONSTEXPR + time_point<Clock, + typename common_type<duration<Rep1, Period1>, Duration2>::type> + operator+( + const duration<Rep1, Period1>& lhs, + const time_point<Clock, Duration2>& rhs); + template <class Clock, class Duration1, class Rep2, class Period2> + inline BOOST_CONSTEXPR + time_point<Clock, + typename common_type<Duration1, duration<Rep2, Period2> >::type> + operator-( + const time_point<Clock, Duration1>& lhs, + const duration<Rep2, Period2>& rhs); + template <class Clock, class Duration1, class Duration2> + inline BOOST_CONSTEXPR + typename common_type<Duration1, Duration2>::type + operator-( + const time_point<Clock, Duration1>& lhs, + const time_point<Clock, + Duration2>& rhs); + + // time_point comparisons + template <class Clock, class Duration1, class Duration2> + inline BOOST_CONSTEXPR + bool operator==( + const time_point<Clock, Duration1>& lhs, + const time_point<Clock, Duration2>& rhs); + template <class Clock, class Duration1, class Duration2> + inline BOOST_CONSTEXPR + bool operator!=( + const time_point<Clock, Duration1>& lhs, + const time_point<Clock, Duration2>& rhs); + template <class Clock, class Duration1, class Duration2> + inline BOOST_CONSTEXPR + bool operator< ( + const time_point<Clock, Duration1>& lhs, + const time_point<Clock, Duration2>& rhs); + template <class Clock, class Duration1, class Duration2> + inline BOOST_CONSTEXPR + bool operator<=( + const time_point<Clock, Duration1>& lhs, + const time_point<Clock, Duration2>& rhs); + template <class Clock, class Duration1, class Duration2> + inline BOOST_CONSTEXPR + bool operator> ( + const time_point<Clock, Duration1>& lhs, + const time_point<Clock, Duration2>& rhs); + template <class Clock, class Duration1, class Duration2> + inline BOOST_CONSTEXPR + bool operator>=( + const time_point<Clock, Duration1>& lhs, + const time_point<Clock, Duration2>& rhs); + + // time_point_cast + template <class ToDuration, class Clock, class Duration> + inline BOOST_CONSTEXPR + time_point<Clock, ToDuration> time_point_cast(const time_point<Clock, Duration>& t); + +//----------------------------------------------------------------------------// +// // +// 20.9.4 Class template time_point [time.point] // +// // +//----------------------------------------------------------------------------// + + template <class Clock, class Duration> + class time_point + { + BOOST_CHRONO_STATIC_ASSERT(boost::chrono::detail::is_duration<Duration>::value, + BOOST_CHRONO_SECOND_TEMPLATE_PARAMETER_OF_TIME_POINT_MUST_BE_A_BOOST_CHRONO_DURATION, (Duration)); + public: + typedef Clock clock; + typedef Duration duration; + typedef typename duration::rep rep; + typedef typename duration::period period; + typedef Duration difference_type; + + private: + duration d_; + + public: + BOOST_CONSTEXPR + time_point() : d_(duration::zero()) + {} + BOOST_CONSTEXPR explicit time_point(const duration& d) + : d_(d) + {} + + // conversions + template <class Duration2> + BOOST_CONSTEXPR + time_point(const time_point<clock, Duration2>& t + , typename boost::enable_if + < + boost::is_convertible<Duration2, duration> + >::type* = 0 + ) + : d_(t.time_since_epoch()) + { + } + // observer + + BOOST_CONSTEXPR + duration time_since_epoch() const + { + return d_; + } + + // arithmetic + +#ifdef BOOST_CHRONO_EXTENSIONS + BOOST_CONSTEXPR + time_point operator+() const {return *this;} + BOOST_CONSTEXPR + time_point operator-() const {return time_point(-d_);} + time_point& operator++() {++d_; return *this;} + time_point operator++(int) {return time_point(d_++);} + time_point& operator--() {--d_; return *this;} + time_point operator--(int) {return time_point(d_--);} + + time_point& operator+=(const rep& r) {d_ += duration(r); return *this;} + time_point& operator-=(const rep& r) {d_ -= duration(r); return *this;} + +#endif + + time_point& operator+=(const duration& d) {d_ += d; return *this;} + time_point& operator-=(const duration& d) {d_ -= d; return *this;} + + // special values + + static BOOST_CHRONO_LIB_CONSTEXPR time_point + min BOOST_PREVENT_MACRO_SUBSTITUTION () + { + return time_point((duration::min)()); + } + static BOOST_CHRONO_LIB_CONSTEXPR time_point + max BOOST_PREVENT_MACRO_SUBSTITUTION () + { + return time_point((duration::max)()); + } + }; + +//----------------------------------------------------------------------------// +// 20.9.4.5 time_point non-member arithmetic [time.point.nonmember] // +//----------------------------------------------------------------------------// + + // time_point operator+(time_point x, duration y); + + template <class Clock, class Duration1, class Rep2, class Period2> + inline BOOST_CONSTEXPR + time_point<Clock, + typename common_type<Duration1, duration<Rep2, Period2> >::type> + operator+(const time_point<Clock, Duration1>& lhs, + const duration<Rep2, Period2>& rhs) + { + typedef typename common_type<Duration1, duration<Rep2, Period2> >::type CDuration; + typedef time_point< + Clock, + CDuration + > TimeResult; + return TimeResult(lhs.time_since_epoch() + CDuration(rhs)); + } + + // time_point operator+(duration x, time_point y); + + template <class Rep1, class Period1, class Clock, class Duration2> + inline BOOST_CONSTEXPR + time_point<Clock, + typename common_type<duration<Rep1, Period1>, Duration2>::type> + operator+(const duration<Rep1, Period1>& lhs, + const time_point<Clock, Duration2>& rhs) + { + return rhs + lhs; + } + + // time_point operator-(time_point x, duration y); + + template <class Clock, class Duration1, class Rep2, class Period2> + inline BOOST_CONSTEXPR + time_point<Clock, + typename common_type<Duration1, duration<Rep2, Period2> >::type> + operator-(const time_point<Clock, Duration1>& lhs, + const duration<Rep2, Period2>& rhs) + { + return lhs + (-rhs); + } + + // duration operator-(time_point x, time_point y); + + template <class Clock, class Duration1, class Duration2> + inline BOOST_CONSTEXPR + typename common_type<Duration1, Duration2>::type + operator-(const time_point<Clock, Duration1>& lhs, + const time_point<Clock, Duration2>& rhs) + { + return lhs.time_since_epoch() - rhs.time_since_epoch(); + } + +//----------------------------------------------------------------------------// +// 20.9.4.6 time_point comparisons [time.point.comparisons] // +//----------------------------------------------------------------------------// + + // time_point == + + template <class Clock, class Duration1, class Duration2> + inline BOOST_CONSTEXPR + bool + operator==(const time_point<Clock, Duration1>& lhs, + const time_point<Clock, Duration2>& rhs) + { + return lhs.time_since_epoch() == rhs.time_since_epoch(); + } + + // time_point != + + template <class Clock, class Duration1, class Duration2> + inline BOOST_CONSTEXPR + bool + operator!=(const time_point<Clock, Duration1>& lhs, + const time_point<Clock, Duration2>& rhs) + { + return !(lhs == rhs); + } + + // time_point < + + template <class Clock, class Duration1, class Duration2> + inline BOOST_CONSTEXPR + bool + operator<(const time_point<Clock, Duration1>& lhs, + const time_point<Clock, Duration2>& rhs) + { + return lhs.time_since_epoch() < rhs.time_since_epoch(); + } + + // time_point > + + template <class Clock, class Duration1, class Duration2> + inline BOOST_CONSTEXPR + bool + operator>(const time_point<Clock, Duration1>& lhs, + const time_point<Clock, Duration2>& rhs) + { + return rhs < lhs; + } + + // time_point <= + + template <class Clock, class Duration1, class Duration2> + inline BOOST_CONSTEXPR + bool + operator<=(const time_point<Clock, Duration1>& lhs, + const time_point<Clock, Duration2>& rhs) + { + return !(rhs < lhs); + } + + // time_point >= + + template <class Clock, class Duration1, class Duration2> + inline BOOST_CONSTEXPR + bool + operator>=(const time_point<Clock, Duration1>& lhs, + const time_point<Clock, Duration2>& rhs) + { + return !(lhs < rhs); + } + +//----------------------------------------------------------------------------// +// 20.9.4.7 time_point_cast [time.point.cast] // +//----------------------------------------------------------------------------// + + template <class ToDuration, class Clock, class Duration> + inline BOOST_CONSTEXPR + time_point<Clock, ToDuration> + time_point_cast(const time_point<Clock, Duration>& t) + { + return time_point<Clock, ToDuration>( + duration_cast<ToDuration>(t.time_since_epoch())); + } + +} // namespace chrono +} // namespace boost + +#ifndef BOOST_CHRONO_HEADER_ONLY +// the suffix header occurs after all of our code: +#include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas +#endif + +#endif // BOOST_CHRONO_TIME_POINT_HPP diff --git a/3rdParty/Boost/src/boost/compressed_pair.hpp b/3rdParty/Boost/src/boost/compressed_pair.hpp deleted file mode 100644 index e6cd6a0..0000000 --- a/3rdParty/Boost/src/boost/compressed_pair.hpp +++ /dev/null @@ -1,24 +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. - -// See boost/detail/compressed_pair.hpp and boost/detail/ob_compressed_pair.hpp -// for full copyright notices. - -#ifndef BOOST_COMPRESSED_PAIR_HPP -#define BOOST_COMPRESSED_PAIR_HPP - -#ifndef BOOST_CONFIG_HPP -#include <boost/config.hpp> -#endif - -#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -#include <boost/detail/ob_compressed_pair.hpp> -#else -#include <boost/detail/compressed_pair.hpp> -#endif - -#endif // BOOST_COMPRESSED_PAIR_HPP diff --git a/3rdParty/Boost/src/boost/concept/detail/backward_compatibility.hpp b/3rdParty/Boost/src/boost/concept/detail/backward_compatibility.hpp index 88d5921..66d573e 100644 --- a/3rdParty/Boost/src/boost/concept/detail/backward_compatibility.hpp +++ b/3rdParty/Boost/src/boost/concept/detail/backward_compatibility.hpp @@ -8,7 +8,7 @@ namespace boost { namespace concepts {} -# if !defined(BOOST_NO_CONCEPTS) && !defined(BOOST_CONCEPT_NO_BACKWARD_KEYWORD) +# if defined(BOOST_HAS_CONCEPTS) && !defined(BOOST_CONCEPT_NO_BACKWARD_KEYWORD) namespace concept = concepts; # endif } // namespace boost::concept diff --git a/3rdParty/Boost/src/boost/concept_check.hpp b/3rdParty/Boost/src/boost/concept_check.hpp index 01b2f4e..bf5a2af 100644 --- a/3rdParty/Boost/src/boost/concept_check.hpp +++ b/3rdParty/Boost/src/boost/concept_check.hpp @@ -1052,11 +1052,11 @@ namespace boost c.swap(c); } - void const_constraints(const C& c) { - ci = c.begin(); - ci = c.end(); - n = c.size(); - b = c.empty(); + void const_constraints(const C& cc) { + ci = cc.begin(); + ci = cc.end(); + n = cc.size(); + b = cc.empty(); } private: diff --git a/3rdParty/Boost/src/boost/config.hpp b/3rdParty/Boost/src/boost/config.hpp index 055a278..f37585e 100644 --- a/3rdParty/Boost/src/boost/config.hpp +++ b/3rdParty/Boost/src/boost/config.hpp @@ -36,7 +36,7 @@ #endif // if we don't have a std library config set, try and find one: -#if !defined(BOOST_STDLIB_CONFIG) && !defined(BOOST_NO_STDLIB_CONFIG) && !defined(BOOST_NO_CONFIG) +#if !defined(BOOST_STDLIB_CONFIG) && !defined(BOOST_NO_STDLIB_CONFIG) && !defined(BOOST_NO_CONFIG) && defined(__cplusplus) # include <boost/config/select_stdlib_config.hpp> #endif // if we have a std library config, include it now: diff --git a/3rdParty/Boost/src/boost/config/auto_link.hpp b/3rdParty/Boost/src/boost/config/auto_link.hpp index f5a0a00..ad021f4 100644 --- a/3rdParty/Boost/src/boost/config/auto_link.hpp +++ b/3rdParty/Boost/src/boost/config/auto_link.hpp @@ -145,11 +145,16 @@ BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y. // vc90: # define BOOST_LIB_TOOLSET "vc90" -#elif defined(BOOST_MSVC) && (BOOST_MSVC >= 1600) +#elif defined(BOOST_MSVC) && (BOOST_MSVC == 1600) // vc10: # define BOOST_LIB_TOOLSET "vc100" +#elif defined(BOOST_MSVC) && (BOOST_MSVC >= 1700) + + // vc11: +# define BOOST_LIB_TOOLSET "vc110" + #elif defined(__BORLANDC__) // CBuilder 6: @@ -364,7 +369,7 @@ BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y. #ifdef BOOST_AUTO_LINK_TAGGED # pragma comment(lib, BOOST_LIB_PREFIX BOOST_STRINGIZE(BOOST_LIB_NAME) BOOST_LIB_THREAD_OPT BOOST_LIB_RT_OPT ".lib") # ifdef BOOST_LIB_DIAGNOSTIC -# pragma message ("Linking to lib file: " BOOST_LIB_PREFIX BOOST_STRINGIZE(BOOST_LIB_NAME) "-" BOOST_LIB_TOOLSET BOOST_LIB_THREAD_OPT BOOST_LIB_RT_OPT "-" BOOST_LIB_VERSION ".lib") +# pragma message ("Linking to lib file: " BOOST_LIB_PREFIX BOOST_STRINGIZE(BOOST_LIB_NAME) BOOST_LIB_THREAD_OPT BOOST_LIB_RT_OPT ".lib") # endif #elif defined(BOOST_AUTO_LINK_NOMANGLE) # pragma comment(lib, BOOST_STRINGIZE(BOOST_LIB_NAME) ".lib") diff --git a/3rdParty/Boost/src/boost/config/compiler/borland.hpp b/3rdParty/Boost/src/boost/config/compiler/borland.hpp index a989fd6..cffa8ea 100644 --- a/3rdParty/Boost/src/boost/config/compiler/borland.hpp +++ b/3rdParty/Boost/src/boost/config/compiler/borland.hpp @@ -47,7 +47,7 @@ # define BOOST_NO_OPERATORS_IN_NAMESPACE # endif // Variadic macros do not exist for C++ Builder versions 5 and below -#define BOOST_NO_VARIADIC_MACROS +#define BOOST_NO_CXX11_VARIADIC_MACROS # endif // Version 5.51 and below: @@ -56,8 +56,13 @@ # define BOOST_NO_CV_VOID_SPECIALIZATIONS # define BOOST_NO_DEDUCED_TYPENAME // workaround for missing WCHAR_MAX/WCHAR_MIN: +#ifdef __cplusplus #include <climits> #include <cwchar> +#else +#include <limits.h> +#include <wchar.h> +#endif // __cplusplus #ifndef WCHAR_MAX # define WCHAR_MAX 0xffff #endif @@ -69,7 +74,7 @@ // Borland C++ Builder 6 and below: #if (__BORLANDC__ <= 0x564) -# ifdef NDEBUG +# if defined(NDEBUG) && defined(__cplusplus) // fix broken <cstring> so that Boost.test works: # include <cstring> # undef strcmp @@ -145,14 +150,14 @@ // C++0x Macros: // #if !defined( BOOST_CODEGEAR_0X_SUPPORT ) || (__BORLANDC__ < 0x610) -# define BOOST_NO_CHAR16_T -# define BOOST_NO_CHAR32_T -# define BOOST_NO_DECLTYPE -# define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS -# define BOOST_NO_EXTERN_TEMPLATE -# define BOOST_NO_RVALUE_REFERENCES -# define BOOST_NO_SCOPED_ENUMS -# define BOOST_NO_STATIC_ASSERT +# define BOOST_NO_CXX11_CHAR16_T +# define BOOST_NO_CXX11_CHAR32_T +# define BOOST_NO_CXX11_DECLTYPE +# define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS +# define BOOST_NO_CXX11_EXTERN_TEMPLATE +# define BOOST_NO_CXX11_RVALUE_REFERENCES +# define BOOST_NO_CXX11_SCOPED_ENUMS +# define BOOST_NO_CXX11_STATIC_ASSERT #else # define BOOST_HAS_ALIGNOF # define BOOST_HAS_CHAR16_T @@ -164,23 +169,27 @@ # define BOOST_HAS_STATIC_ASSERT #endif -#define BOOST_NO_AUTO_DECLARATIONS -#define BOOST_NO_AUTO_MULTIDECLARATIONS -#define BOOST_NO_CONCEPTS -#define BOOST_NO_CONSTEXPR -#define BOOST_NO_DEFAULTED_FUNCTIONS -#define BOOST_NO_DELETED_FUNCTIONS -#define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS -#define BOOST_NO_INITIALIZER_LISTS -#define BOOST_NO_LAMBDAS -#define BOOST_NO_NULLPTR -#define BOOST_NO_RAW_LITERALS -#define BOOST_NO_RVALUE_REFERENCES -#define BOOST_NO_SCOPED_ENUMS +#define BOOST_NO_CXX11_AUTO_DECLARATIONS +#define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS +#define BOOST_NO_CXX11_CONSTEXPR +#define BOOST_NO_CXX11_DECLTYPE_N3276 +#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +#define BOOST_NO_CXX11_DELETED_FUNCTIONS +#define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS +#define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +#define BOOST_NO_CXX11_LAMBDAS +#define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS +#define BOOST_NO_CXX11_NULLPTR +#define BOOST_NO_CXX11_RANGE_BASED_FOR +#define BOOST_NO_CXX11_RAW_LITERALS +#define BOOST_NO_CXX11_RVALUE_REFERENCES +#define BOOST_NO_CXX11_SCOPED_ENUMS #define BOOST_NO_SFINAE_EXPR -#define BOOST_NO_TEMPLATE_ALIASES -#define BOOST_NO_UNICODE_LITERALS // UTF-8 still not supported -#define BOOST_NO_VARIADIC_TEMPLATES +#define BOOST_NO_CXX11_TEMPLATE_ALIASES +#define BOOST_NO_CXX11_UNICODE_LITERALS // UTF-8 still not supported +#define BOOST_NO_CXX11_VARIADIC_TEMPLATES +#define BOOST_NO_CXX11_NOEXCEPT +#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX #if __BORLANDC__ >= 0x590 # define BOOST_HAS_TR1_HASH @@ -275,3 +284,4 @@ + diff --git a/3rdParty/Boost/src/boost/config/compiler/clang.hpp b/3rdParty/Boost/src/boost/config/compiler/clang.hpp index 0893033..aab3c61 100644 --- a/3rdParty/Boost/src/boost/config/compiler/clang.hpp +++ b/3rdParty/Boost/src/boost/config/compiler/clang.hpp @@ -8,15 +8,18 @@ // Clang compiler setup. -#if __has_feature(cxx_exceptions) && !defined(BOOST_NO_EXCEPTIONS) -#else +#if !__has_feature(cxx_exceptions) && !defined(BOOST_NO_EXCEPTIONS) # define BOOST_NO_EXCEPTIONS #endif -#if !__has_feature(cxx_rtti) +#if !__has_feature(cxx_rtti) && !defined(BOOST_NO_RTTI) # define BOOST_NO_RTTI #endif +#if !__has_feature(cxx_rtti) && !defined(BOOST_NO_TYPEID) +# define BOOST_NO_TYPEID +#endif + #if defined(__int64) # define BOOST_HAS_MS_INT64 #endif @@ -24,52 +27,100 @@ #define BOOST_HAS_NRVO // Clang supports "long long" in all compilation modes. +#define BOOST_HAS_LONG_LONG + +#if !__has_feature(cxx_auto_type) +# define BOOST_NO_CXX11_AUTO_DECLARATIONS +# define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS +#endif -#define BOOST_NO_AUTO_DECLARATIONS -#define BOOST_NO_AUTO_MULTIDECLARATIONS -#define BOOST_NO_CHAR16_T -#define BOOST_NO_CHAR32_T -#define BOOST_NO_CONCEPTS -#define BOOST_NO_CONSTEXPR +#if !(defined(__GXX_EXPERIMENTAL_CXX0X__) || __cplusplus >= 201103L) +# define BOOST_NO_CXX11_CHAR16_T +# define BOOST_NO_CXX11_CHAR32_T +#endif + +#if !__has_feature(cxx_constexpr) +# define BOOST_NO_CXX11_CONSTEXPR +#endif #if !__has_feature(cxx_decltype) -# define BOOST_NO_DECLTYPE +# define BOOST_NO_CXX11_DECLTYPE #endif -#define BOOST_NO_DEFAULTED_FUNCTIONS +#if !__has_feature(cxx_decltype_incomplete_return_types) +# define BOOST_NO_CXX11_DECLTYPE_N3276 +#endif + +#if !__has_feature(cxx_defaulted_functions) +# define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +#endif #if !__has_feature(cxx_deleted_functions) -# define BOOST_NO_DELETED_FUNCTIONS +# define BOOST_NO_CXX11_DELETED_FUNCTIONS #endif -#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS +#if !__has_feature(cxx_explicit_conversions) +# define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS +#endif #if !__has_feature(cxx_default_function_template_args) - #define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS +# define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS #endif -#define BOOST_NO_INITIALIZER_LISTS -#define BOOST_NO_LAMBDAS -#define BOOST_NO_NULLPTR -#define BOOST_NO_RAW_LITERALS +#if !__has_feature(cxx_generalized_initializers) +# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +#endif + +#if !__has_feature(cxx_lambdas) +# define BOOST_NO_CXX11_LAMBDAS +#endif + +#if !__has_feature(cxx_local_type_template_args) +# define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS +#endif + +#if !__has_feature(cxx_noexcept) +# define BOOST_NO_CXX11_NOEXCEPT +#endif + +#if !__has_feature(cxx_nullptr) +# define BOOST_NO_CXX11_NULLPTR +#endif + +#if !__has_feature(cxx_range_for) +# define BOOST_NO_CXX11_RANGE_BASED_FOR +#endif + +#if !__has_feature(cxx_raw_string_literals) +# define BOOST_NO_CXX11_RAW_LITERALS +#endif + +#if !__has_feature(cxx_generalized_initializers) +# define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX +#endif #if !__has_feature(cxx_rvalue_references) -# define BOOST_NO_RVALUE_REFERENCES +# define BOOST_NO_CXX11_RVALUE_REFERENCES #endif #if !__has_feature(cxx_strong_enums) -# define BOOST_NO_SCOPED_ENUMS +# define BOOST_NO_CXX11_SCOPED_ENUMS #endif #if !__has_feature(cxx_static_assert) -# define BOOST_NO_STATIC_ASSERT +# define BOOST_NO_CXX11_STATIC_ASSERT #endif -#define BOOST_NO_TEMPLATE_ALIASES -#define BOOST_NO_UNICODE_LITERALS +#if !__has_feature(cxx_alias_templates) +# define BOOST_NO_CXX11_TEMPLATE_ALIASES +#endif + +#if !__has_feature(cxx_unicode_literals) +# define BOOST_NO_CXX11_UNICODE_LITERALS +#endif #if !__has_feature(cxx_variadic_templates) -# define BOOST_NO_VARIADIC_TEMPLATES +# define BOOST_NO_CXX11_VARIADIC_TEMPLATES #endif // Clang always supports variadic macros diff --git a/3rdParty/Boost/src/boost/config/compiler/codegear.hpp b/3rdParty/Boost/src/boost/config/compiler/codegear.hpp index f6dc4c0..1a6df33 100644 --- a/3rdParty/Boost/src/boost/config/compiler/codegear.hpp +++ b/3rdParty/Boost/src/boost/config/compiler/codegear.hpp @@ -60,7 +60,7 @@ // (Niels Dekker, LKEB, April 2010) # define BOOST_NO_COMPLETE_VALUE_INITIALIZATION -# ifdef NDEBUG +# if defined(NDEBUG) && defined(__cplusplus) // fix broken <cstring> so that Boost.test works: # include <cstring> # undef strcmp @@ -76,7 +76,7 @@ // C++0x macros: // #if (__CODEGEARC__ <= 0x620) -#define BOOST_NO_STATIC_ASSERT +#define BOOST_NO_CXX11_STATIC_ASSERT #else #define BOOST_HAS_STATIC_ASSERT #endif @@ -91,23 +91,25 @@ // #define BOOST_HAS_STATIC_ASSERT #define BOOST_HAS_STD_TYPE_TRAITS -#define BOOST_NO_AUTO_DECLARATIONS -#define BOOST_NO_AUTO_MULTIDECLARATIONS -#define BOOST_NO_CONCEPTS -#define BOOST_NO_CONSTEXPR -#define BOOST_NO_DEFAULTED_FUNCTIONS -#define BOOST_NO_DELETED_FUNCTIONS -#define BOOST_NO_EXTERN_TEMPLATE -#define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS -#define BOOST_NO_INITIALIZER_LISTS -#define BOOST_NO_LAMBDAS -#define BOOST_NO_NULLPTR -#define BOOST_NO_RAW_LITERALS -#define BOOST_NO_RVALUE_REFERENCES +#define BOOST_NO_CXX11_AUTO_DECLARATIONS +#define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS +#define BOOST_NO_CXX11_CONSTEXPR +#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +#define BOOST_NO_CXX11_DELETED_FUNCTIONS +#define BOOST_NO_CXX11_EXTERN_TEMPLATE +#define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS +#define BOOST_NO_CXX11_LAMBDAS +#define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS +#define BOOST_NO_CXX11_NOEXCEPT +#define BOOST_NO_CXX11_NULLPTR +#define BOOST_NO_CXX11_RANGE_BASED_FOR +#define BOOST_NO_CXX11_RAW_LITERALS +#define BOOST_NO_CXX11_RVALUE_REFERENCES #define BOOST_NO_SFINAE_EXPR -#define BOOST_NO_TEMPLATE_ALIASES -#define BOOST_NO_UNICODE_LITERALS -#define BOOST_NO_VARIADIC_TEMPLATES +#define BOOST_NO_CXX11_TEMPLATE_ALIASES +#define BOOST_NO_CXX11_UNICODE_LITERALS +#define BOOST_NO_CXX11_VARIADIC_TEMPLATES +#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX // // TR1 macros: @@ -119,7 +121,7 @@ #define BOOST_HAS_MACRO_USE_FACET -#define BOOST_NO_INITIALIZER_LISTS +#define BOOST_NO_CXX11_HDR_INITIALIZER_LIST // On non-Win32 platforms let the platform config figure this out: #ifdef _WIN32 diff --git a/3rdParty/Boost/src/boost/config/compiler/common_edg.hpp b/3rdParty/Boost/src/boost/config/compiler/common_edg.hpp index 9042578..441a055 100644 --- a/3rdParty/Boost/src/boost/config/compiler/common_edg.hpp +++ b/3rdParty/Boost/src/boost/config/compiler/common_edg.hpp @@ -60,37 +60,41 @@ // See above for BOOST_NO_LONG_LONG // #if (__EDG_VERSION__ < 310) -# define BOOST_NO_EXTERN_TEMPLATE +# define BOOST_NO_CXX11_EXTERN_TEMPLATE #endif #if (__EDG_VERSION__ <= 310) // No support for initializer lists -# define BOOST_NO_INITIALIZER_LISTS +# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST #endif #if (__EDG_VERSION__ < 400) -# define BOOST_NO_VARIADIC_MACROS +# define BOOST_NO_CXX11_VARIADIC_MACROS #endif -#define BOOST_NO_AUTO_DECLARATIONS -#define BOOST_NO_AUTO_MULTIDECLARATIONS -#define BOOST_NO_CHAR16_T -#define BOOST_NO_CHAR32_T -#define BOOST_NO_CONCEPTS -#define BOOST_NO_CONSTEXPR -#define BOOST_NO_DECLTYPE -#define BOOST_NO_DEFAULTED_FUNCTIONS -#define BOOST_NO_DELETED_FUNCTIONS -#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS -#define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS -#define BOOST_NO_LAMBDAS -#define BOOST_NO_NULLPTR -#define BOOST_NO_RAW_LITERALS -#define BOOST_NO_RVALUE_REFERENCES -#define BOOST_NO_SCOPED_ENUMS +#define BOOST_NO_CXX11_AUTO_DECLARATIONS +#define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS +#define BOOST_NO_CXX11_CHAR16_T +#define BOOST_NO_CXX11_CHAR32_T +#define BOOST_NO_CXX11_CONSTEXPR +#define BOOST_NO_CXX11_DECLTYPE +#define BOOST_NO_CXX11_DECLTYPE_N3276 +#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +#define BOOST_NO_CXX11_DELETED_FUNCTIONS +#define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS +#define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS +#define BOOST_NO_CXX11_LAMBDAS +#define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS +#define BOOST_NO_CXX11_NOEXCEPT +#define BOOST_NO_CXX11_NULLPTR +#define BOOST_NO_CXX11_RANGE_BASED_FOR +#define BOOST_NO_CXX11_RAW_LITERALS +#define BOOST_NO_CXX11_RVALUE_REFERENCES +#define BOOST_NO_CXX11_SCOPED_ENUMS #define BOOST_NO_SFINAE_EXPR -#define BOOST_NO_STATIC_ASSERT -#define BOOST_NO_TEMPLATE_ALIASES -#define BOOST_NO_UNICODE_LITERALS -#define BOOST_NO_VARIADIC_TEMPLATES +#define BOOST_NO_CXX11_STATIC_ASSERT +#define BOOST_NO_CXX11_TEMPLATE_ALIASES +#define BOOST_NO_CXX11_UNICODE_LITERALS +#define BOOST_NO_CXX11_VARIADIC_TEMPLATES +#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX #ifdef c_plusplus // EDG has "long long" in non-strict mode diff --git a/3rdParty/Boost/src/boost/config/compiler/cray.hpp b/3rdParty/Boost/src/boost/config/compiler/cray.hpp new file mode 100644 index 0000000..5463ea0 --- /dev/null +++ b/3rdParty/Boost/src/boost/config/compiler/cray.hpp @@ -0,0 +1,63 @@ +// (C) Copyright John Maddock 2011. +// 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 for most recent version. + +// Greenhills C compiler setup: + +#define BOOST_COMPILER "Cray C version " BOOST_STRINGIZE(_RELEASE) + +#if _RELEASE < 7 +# error "Boost is not configured for Cray compilers prior to version 7, please try the configure script." +#endif + +// +// Check this is a recent EDG based compiler, otherwise we don't support it here: +// +#ifndef __EDG_VERSION__ +# error "Unsupported Cray compiler, please try running the configure script." +#endif + +#include "boost/config/compiler/common_edg.hpp" + +// +// Cray peculiarities, probably version 7 specific: +// +#undef BOOST_NO_CXX11_AUTO_DECLARATIONS +#undef BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS +#define BOOST_HAS_NRVO +#define BOOST_NO_CXX11_VARIADIC_TEMPLATES +#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX +#define BOOST_NO_CXX11_UNICODE_LITERALS +#define BOOST_NO_TWO_PHASE_NAME_LOOKUP +#define BOOST_HAS_NRVO +#define BOOST_NO_CXX11_TEMPLATE_ALIASES +#define BOOST_NO_CXX11_STATIC_ASSERT +#define BOOST_NO_SFINAE_EXPR +#define BOOST_NO_CXX11_SCOPED_ENUMS +#define BOOST_NO_CXX11_RVALUE_REFERENCES +#define BOOST_NO_CXX11_RANGE_BASED_FOR +#define BOOST_NO_CXX11_RAW_LITERALS +#define BOOST_NO_CXX11_NULLPTR +#define BOOST_NO_CXX11_NOEXCEPT +#define BOOST_NO_CXX11_LAMBDAS +#define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS +#define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS +#define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS +#define BOOST_NO_CXX11_DELETED_FUNCTIONS +#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +#define BOOST_NO_CXX11_DECLTYPE_N3276 +#define BOOST_NO_CXX11_DECLTYPE +#define BOOST_NO_CXX11_CONSTEXPR +#define BOOST_NO_COMPLETE_VALUE_INITIALIZATION +#define BOOST_NO_CXX11_CHAR32_T +#define BOOST_NO_CXX11_CHAR16_T +//#define BOOST_BCB_PARTIAL_SPECIALIZATION_BUG +#define BOOST_MATH_DISABLE_STD_FPCLASSIFY +//#define BOOST_HAS_FPCLASSIFY + +#define BOOST_SP_USE_PTHREADS +#define BOOST_AC_USE_PTHREADS + diff --git a/3rdParty/Boost/src/boost/config/compiler/digitalmars.hpp b/3rdParty/Boost/src/boost/config/compiler/digitalmars.hpp index 31c11bf..15cc209 100644 --- a/3rdParty/Boost/src/boost/config/compiler/digitalmars.hpp +++ b/3rdParty/Boost/src/boost/config/compiler/digitalmars.hpp @@ -44,7 +44,9 @@ // // Is this really the best way to detect whether the std lib is in namespace std? // +#ifdef __cplusplus #include <cstddef> +#endif #if !defined(__STL_IMPORT_VENDOR_CSTD) && !defined(_STLP_IMPORT_VENDOR_CSTD) # define BOOST_NO_STDC_NAMESPACE #endif @@ -58,30 +60,35 @@ // // C++0x features // -#define BOOST_NO_AUTO_DECLARATIONS -#define BOOST_NO_AUTO_MULTIDECLARATIONS -#define BOOST_NO_CHAR16_T -#define BOOST_NO_CHAR32_T -#define BOOST_NO_CONCEPTS -#define BOOST_NO_CONSTEXPR -#define BOOST_NO_DECLTYPE -#define BOOST_NO_DEFAULTED_FUNCTIONS -#define BOOST_NO_DELETED_FUNCTIONS -#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS -#define BOOST_NO_EXTERN_TEMPLATE -#define BOOST_NO_INITIALIZER_LISTS -#define BOOST_NO_LAMBDAS -#define BOOST_NO_NULLPTR -#define BOOST_NO_RAW_LITERALS -#define BOOST_NO_RVALUE_REFERENCES -#define BOOST_NO_SCOPED_ENUMS +#define BOOST_NO_CXX11_AUTO_DECLARATIONS +#define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS +#define BOOST_NO_CXX11_CHAR16_T +#define BOOST_NO_CXX11_CHAR32_T +#define BOOST_NO_CXX11_CONSTEXPR +#define BOOST_NO_CXX11_DECLTYPE +#define BOOST_NO_CXX11_DECLTYPE_N3276 +#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +#define BOOST_NO_CXX11_DELETED_FUNCTIONS +#define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS +#define BOOST_NO_CXX11_EXTERN_TEMPLATE +#define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +#define BOOST_NO_CXX11_LAMBDAS +#define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS +#define BOOST_NO_CXX11_NOEXCEPT +#define BOOST_NO_CXX11_NULLPTR +#define BOOST_NO_CXX11_RANGE_BASED_FOR +#define BOOST_NO_CXX11_RAW_LITERALS +#define BOOST_NO_CXX11_RVALUE_REFERENCES +#define BOOST_NO_CXX11_SCOPED_ENUMS #define BOOST_NO_SFINAE_EXPR -#define BOOST_NO_STATIC_ASSERT -#define BOOST_NO_TEMPLATE_ALIASES -#define BOOST_NO_UNICODE_LITERALS -#define BOOST_NO_VARIADIC_TEMPLATES +#define BOOST_NO_CXX11_STATIC_ASSERT +#define BOOST_NO_CXX11_TEMPLATE_ALIASES +#define BOOST_NO_CXX11_UNICODE_LITERALS +#define BOOST_NO_CXX11_VARIADIC_TEMPLATES +#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX + #if (__DMC__ < 0x812) -#define BOOST_NO_VARIADIC_MACROS +#define BOOST_NO_CXX11_VARIADIC_MACROS #endif #if __DMC__ < 0x800 diff --git a/3rdParty/Boost/src/boost/config/compiler/gcc.hpp b/3rdParty/Boost/src/boost/config/compiler/gcc.hpp index f633647..de8875c 100644 --- a/3rdParty/Boost/src/boost/config/compiler/gcc.hpp +++ b/3rdParty/Boost/src/boost/config/compiler/gcc.hpp @@ -42,9 +42,9 @@ # define BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE # define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL # define BOOST_NO_IS_ABSTRACT -# define BOOST_NO_EXTERN_TEMPLATE +# define BOOST_NO_CXX11_EXTERN_TEMPLATE // Variadic macros do not exist for gcc versions before 3.0 -# define BOOST_NO_VARIADIC_MACROS +# define BOOST_NO_CXX11_VARIADIC_MACROS #elif __GNUC__ == 3 # if defined (__PATHSCALE__) # define BOOST_NO_TWO_PHASE_NAME_LOOKUP @@ -61,7 +61,7 @@ # if __GNUC_MINOR__ < 4 # define BOOST_NO_IS_ABSTRACT # endif -# define BOOST_NO_EXTERN_TEMPLATE +# define BOOST_NO_CXX11_EXTERN_TEMPLATE #endif #if __GNUC__ < 4 // @@ -146,9 +146,6 @@ # endif #endif -// C++0x features not implemented in any GCC version -// -#define BOOST_NO_TEMPLATE_ALIASES // C++0x features in 4.3.n and later // @@ -161,59 +158,73 @@ # define BOOST_HAS_STATIC_ASSERT # define BOOST_HAS_VARIADIC_TMPL #else -# define BOOST_NO_DECLTYPE -# define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS -# define BOOST_NO_RVALUE_REFERENCES -# define BOOST_NO_STATIC_ASSERT +# define BOOST_NO_CXX11_DECLTYPE +# define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS +# define BOOST_NO_CXX11_RVALUE_REFERENCES +# define BOOST_NO_CXX11_STATIC_ASSERT // Variadic templates compiler: // http://www.generic-programming.org/~dgregor/cpp/variadic-templates.html -# ifdef __VARIADIC_TEMPLATES +# if defined(__VARIADIC_TEMPLATES) || (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4) && defined(__GXX_EXPERIMENTAL_CXX0X__)) # define BOOST_HAS_VARIADIC_TMPL # else -# define BOOST_NO_VARIADIC_TEMPLATES +# define BOOST_NO_CXX11_VARIADIC_TEMPLATES # endif #endif // C++0x features in 4.4.n and later // #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 4) || !defined(__GXX_EXPERIMENTAL_CXX0X__) -# define BOOST_NO_AUTO_DECLARATIONS -# define BOOST_NO_AUTO_MULTIDECLARATIONS -# define BOOST_NO_CHAR16_T -# define BOOST_NO_CHAR32_T -# define BOOST_NO_DEFAULTED_FUNCTIONS -# define BOOST_NO_DELETED_FUNCTIONS -# define BOOST_NO_INITIALIZER_LISTS -# define BOOST_NO_SCOPED_ENUMS +# define BOOST_NO_CXX11_AUTO_DECLARATIONS +# define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS +# define BOOST_NO_CXX11_CHAR16_T +# define BOOST_NO_CXX11_CHAR32_T +# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +# define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +# define BOOST_NO_CXX11_DELETED_FUNCTIONS #endif -#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 4) +#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5) # define BOOST_NO_SFINAE_EXPR #endif -// C++0x features in 4.4.1 and later +// C++0x features in 4.5.0 and later // -#if (__GNUC__*10000 + __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__ < 40401) || !defined(__GXX_EXPERIMENTAL_CXX0X__) -// scoped enums have a serious bug in 4.4.0, so define BOOST_NO_SCOPED_ENUMS before 4.4.1 -// See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38064 -# define BOOST_NO_SCOPED_ENUMS +#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5) || !defined(__GXX_EXPERIMENTAL_CXX0X__) +# define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS +# define BOOST_NO_CXX11_LAMBDAS +# define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS +# define BOOST_NO_CXX11_RAW_LITERALS +# define BOOST_NO_CXX11_UNICODE_LITERALS #endif -// C++0x features in 4.5.n and later +// C++0x features in 4.5.1 and later // -#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5) || !defined(__GXX_EXPERIMENTAL_CXX0X__) -# define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS -# define BOOST_NO_LAMBDAS -# define BOOST_NO_RAW_LITERALS -# define BOOST_NO_UNICODE_LITERALS +#if (__GNUC__*10000 + __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__ < 40501) || !defined(__GXX_EXPERIMENTAL_CXX0X__) +// scoped enums have a serious bug in 4.4.0, so define BOOST_NO_CXX11_SCOPED_ENUMS before 4.5.1 +// See http://gcc.gnu.org/bugzilla/show_bug.cgi?id=38064 +# define BOOST_NO_CXX11_SCOPED_ENUMS #endif -// C++0x features in 4.5.n and later +// C++0x features in 4.6.n and later // #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 6) || !defined(__GXX_EXPERIMENTAL_CXX0X__) -#define BOOST_NO_CONSTEXPR -#define BOOST_NO_NULLPTR +#define BOOST_NO_CXX11_CONSTEXPR +#define BOOST_NO_CXX11_NOEXCEPT +#define BOOST_NO_CXX11_NULLPTR +#define BOOST_NO_CXX11_RANGE_BASED_FOR +#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX +#endif + +#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 7) || !defined(__GXX_EXPERIMENTAL_CXX0X__) +# define BOOST_NO_CXX11_TEMPLATE_ALIASES +#endif +// C++0x features not supported at all yet +// +#define BOOST_NO_CXX11_DECLTYPE_N3276 + +#ifndef BOOST_COMPILER +# define BOOST_COMPILER "GNU C++ version " __VERSION__ #endif // ConceptGCC compiler: @@ -221,15 +232,8 @@ #ifdef __GXX_CONCEPTS__ # define BOOST_HAS_CONCEPTS # define BOOST_COMPILER "ConceptGCC version " __VERSION__ -#else -# define BOOST_NO_CONCEPTS #endif -#ifndef BOOST_COMPILER -# define BOOST_COMPILER "GNU C++ version " __VERSION__ -#endif - -// // versions check: // we don't know gcc prior to version 2.90: #if (__GNUC__ == 2) && (__GNUC_MINOR__ < 90) diff --git a/3rdParty/Boost/src/boost/config/compiler/gcc_xml.hpp b/3rdParty/Boost/src/boost/config/compiler/gcc_xml.hpp index a456463..eaed4b5 100644 --- a/3rdParty/Boost/src/boost/config/compiler/gcc_xml.hpp +++ b/3rdParty/Boost/src/boost/config/compiler/gcc_xml.hpp @@ -27,29 +27,33 @@ // C++0x features: // -# define BOOST_NO_CONSTEXPR -# define BOOST_NO_NULLPTR -# define BOOST_NO_TEMPLATE_ALIASES -# define BOOST_NO_DECLTYPE -# define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS -# define BOOST_NO_RVALUE_REFERENCES -# define BOOST_NO_STATIC_ASSERT -# define BOOST_NO_VARIADIC_TEMPLATES -# define BOOST_NO_VARIADIC_MACROS -# define BOOST_NO_AUTO_DECLARATIONS -# define BOOST_NO_AUTO_MULTIDECLARATIONS -# define BOOST_NO_CHAR16_T -# define BOOST_NO_CHAR32_T -# define BOOST_NO_DEFAULTED_FUNCTIONS -# define BOOST_NO_DELETED_FUNCTIONS -# define BOOST_NO_INITIALIZER_LISTS -# define BOOST_NO_SCOPED_ENUMS +# define BOOST_NO_CXX11_CONSTEXPR +# define BOOST_NO_CXX11_NULLPTR +# define BOOST_NO_CXX11_TEMPLATE_ALIASES +# define BOOST_NO_CXX11_DECLTYPE +# define BOOST_NO_CXX11_DECLTYPE_N3276 +# define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS +# define BOOST_NO_CXX11_RVALUE_REFERENCES +# define BOOST_NO_CXX11_STATIC_ASSERT +# define BOOST_NO_CXX11_VARIADIC_TEMPLATES +# define BOOST_NO_CXX11_VARIADIC_MACROS +# define BOOST_NO_CXX11_AUTO_DECLARATIONS +# define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS +# define BOOST_NO_CXX11_CHAR16_T +# define BOOST_NO_CXX11_CHAR32_T +# define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +# define BOOST_NO_CXX11_DELETED_FUNCTIONS +# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +# define BOOST_NO_CXX11_SCOPED_ENUMS # define BOOST_NO_SFINAE_EXPR -# define BOOST_NO_SCOPED_ENUMS -# define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS -# define BOOST_NO_LAMBDAS -# define BOOST_NO_RAW_LITERALS -# define BOOST_NO_UNICODE_LITERALS +# define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS +# define BOOST_NO_CXX11_LAMBDAS +# define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS +# define BOOST_NO_CXX11_RANGE_BASED_FOR +# define BOOST_NO_CXX11_RAW_LITERALS +# define BOOST_NO_CXX11_UNICODE_LITERALS +# define BOOST_NO_CXX11_NOEXCEPT +#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX #define BOOST_COMPILER "GCC-XML C++ version " __GCCXML__ diff --git a/3rdParty/Boost/src/boost/config/compiler/hp_acc.hpp b/3rdParty/Boost/src/boost/config/compiler/hp_acc.hpp index d0b672e..4f5f81b 100644 --- a/3rdParty/Boost/src/boost/config/compiler/hp_acc.hpp +++ b/3rdParty/Boost/src/boost/config/compiler/hp_acc.hpp @@ -92,29 +92,32 @@ // #if !defined(__EDG__) -#define BOOST_NO_AUTO_DECLARATIONS -#define BOOST_NO_AUTO_MULTIDECLARATIONS -#define BOOST_NO_CHAR16_T -#define BOOST_NO_CHAR32_T -#define BOOST_NO_CONCEPTS -#define BOOST_NO_CONSTEXPR -#define BOOST_NO_DECLTYPE -#define BOOST_NO_DEFAULTED_FUNCTIONS -#define BOOST_NO_DELETED_FUNCTIONS -#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS -#define BOOST_NO_EXTERN_TEMPLATE -#define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS -#define BOOST_NO_INITIALIZER_LISTS -#define BOOST_NO_LAMBDAS -#define BOOST_NO_NULLPTR -#define BOOST_NO_RAW_LITERALS -#define BOOST_NO_RVALUE_REFERENCES -#define BOOST_NO_SCOPED_ENUMS +#define BOOST_NO_CXX11_AUTO_DECLARATIONS +#define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS +#define BOOST_NO_CXX11_CHAR16_T +#define BOOST_NO_CXX11_CHAR32_T +#define BOOST_NO_CXX11_CONSTEXPR +#define BOOST_NO_CXX11_DECLTYPE +#define BOOST_NO_CXX11_DECLTYPE_N3276 +#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +#define BOOST_NO_CXX11_DELETED_FUNCTIONS +#define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS +#define BOOST_NO_CXX11_EXTERN_TEMPLATE +#define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS +#define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +#define BOOST_NO_CXX11_LAMBDAS +#define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS +#define BOOST_NO_CXX11_NOEXCEPT +#define BOOST_NO_CXX11_NULLPTR +#define BOOST_NO_CXX11_RANGE_BASED_FOR +#define BOOST_NO_CXX11_RAW_LITERALS +#define BOOST_NO_CXX11_RVALUE_REFERENCES +#define BOOST_NO_CXX11_SCOPED_ENUMS #define BOOST_NO_SFINAE_EXPR -#define BOOST_NO_STATIC_ASSERT -#define BOOST_NO_TEMPLATE_ALIASES -#define BOOST_NO_UNICODE_LITERALS -#define BOOST_NO_VARIADIC_TEMPLATES +#define BOOST_NO_CXX11_STATIC_ASSERT +#define BOOST_NO_CXX11_TEMPLATE_ALIASES +#define BOOST_NO_CXX11_UNICODE_LITERALS +#define BOOST_NO_CXX11_VARIADIC_TEMPLATES /* See https://forums13.itrc.hp.com/service/forums/questionanswer.do?threadId=1443331 and @@ -122,7 +125,7 @@ */ #if (__HP_aCC < 62500) || !defined(HP_CXX0x_SOURCE) - #define BOOST_NO_VARIADIC_MACROS + #define BOOST_NO_CXX11_VARIADIC_MACROS #endif #endif diff --git a/3rdParty/Boost/src/boost/config/compiler/intel.hpp b/3rdParty/Boost/src/boost/config/compiler/intel.hpp index f209ae7..8c746c1 100644 --- a/3rdParty/Boost/src/boost/config/compiler/intel.hpp +++ b/3rdParty/Boost/src/boost/config/compiler/intel.hpp @@ -27,7 +27,7 @@ #endif // Flags determined by comparing output of 'icpc -dM -E' with and without '-std=c++0x' -#if (!(defined(_WIN32) || defined(_WIN64)) && defined(__STDC_HOSTED__) && __STDC_HOSTED__) || defined(__GXX_EXPERIMENTAL_CPP0X__) +#if (!(defined(_WIN32) || defined(_WIN64)) && defined(__STDC_HOSTED__) && (__STDC_HOSTED__ && (BOOST_INTEL_CXX_VERSION <= 1200))) || defined(__GXX_EXPERIMENTAL_CPP0X__) # define BOOST_INTEL_STDCXX0X #endif #if defined(_MSC_VER) && (_MSC_VER >= 1600) @@ -121,6 +121,7 @@ // in type_traits code among other things, getting this correct // for the Intel compiler is actually remarkably fragile and tricky: // +#ifdef __cplusplus #if defined(BOOST_NO_INTRINSIC_WCHAR_T) #include <cwchar> template< typename T > struct assert_no_intrinsic_wchar_t; @@ -134,8 +135,9 @@ template<> struct assert_intrinsic_wchar_t<wchar_t> {}; // if you see an error here then define BOOST_NO_INTRINSIC_WCHAR_T on the command line: template<> struct assert_intrinsic_wchar_t<unsigned short> {}; #endif +#endif -#if _MSC_VER+0 >= 1000 +#if defined(_MSC_VER) && (_MSC_VER+0 >= 1000) # if _MSC_VER >= 1200 # define BOOST_HAS_MS_INT64 # endif @@ -177,8 +179,9 @@ template<> struct assert_intrinsic_wchar_t<unsigned short> {}; // intel-vc9-win-11.1 may leave a non-POD array uninitialized, in some // cases when it should be value-initialized. // (Niels Dekker, LKEB, May 2010) +// Apparently Intel 12.1 (compiler version number 9999 !!) has the same issue (compiler regression). #if defined(__INTEL_COMPILER) -# if __INTEL_COMPILER <= 1110 +# if (__INTEL_COMPILER <= 1110) || (__INTEL_COMPILER == 9999) # define BOOST_NO_COMPLETE_VALUE_INITIALIZATION # endif #endif @@ -196,31 +199,66 @@ template<> struct assert_intrinsic_wchar_t<unsigned short> {}; // - ICC added static_assert in 11.0 (first version with C++0x support) // #if defined(BOOST_INTEL_STDCXX0X) -# undef BOOST_NO_STATIC_ASSERT +# undef BOOST_NO_CXX11_STATIC_ASSERT // // These pass our test cases, but aren't officially supported according to: // http://software.intel.com/en-us/articles/c0x-features-supported-by-intel-c-compiler/ // -//# undef BOOST_NO_LAMBDAS -//# undef BOOST_NO_DECLTYPE -//# undef BOOST_NO_AUTO_DECLARATIONS -//# undef BOOST_NO_AUTO_MULTIDECLARATIONS +//# undef BOOST_NO_CXX11_LAMBDAS +//# undef BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS +//# undef BOOST_NO_CXX11_DECLTYPE +//# undef BOOST_NO_CXX11_AUTO_DECLARATIONS +//# undef BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS #endif #if defined(BOOST_INTEL_STDCXX0X) && (BOOST_INTEL_CXX_VERSION >= 1200) -# undef BOOST_NO_RVALUE_REFERENCES -# undef BOOST_NO_SCOPED_ENUMS -# undef BOOST_NO_DELETED_FUNCTIONS -# undef BOOST_NO_DEFAULTED_FUNCTIONS -# undef BOOST_NO_LAMBDAS -# undef BOOST_NO_DECLTYPE -# undef BOOST_NO_AUTO_DECLARATIONS -# undef BOOST_NO_AUTO_MULTIDECLARATIONS +//# undef BOOST_NO_CXX11_RVALUE_REFERENCES // Enabling this breaks Filesystem and Exception libraries +//# undef BOOST_NO_CXX11_SCOPED_ENUMS // doesn't really work!! +# undef BOOST_NO_CXX11_DELETED_FUNCTIONS +# undef BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +# undef BOOST_NO_CXX11_LAMBDAS +# undef BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS +# undef BOOST_NO_CXX11_DECLTYPE +# undef BOOST_NO_CXX11_AUTO_DECLARATIONS +# undef BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS +#endif + +// icl Version 12.1.0.233 Build 20110811 and possibly some other builds +// had an incorrect __INTEL_COMPILER value of 9999. Intel say this has been fixed. +#if defined(BOOST_INTEL_STDCXX0X) && (BOOST_INTEL_CXX_VERSION > 1200) +# undef BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS +# undef BOOST_NO_CXX11_NULLPTR +# undef BOOST_NO_CXX11_RVALUE_REFERENCES +# undef BOOST_NO_SFINAE_EXPR +# undef BOOST_NO_CXX11_TEMPLATE_ALIASES +# undef BOOST_NO_CXX11_VARIADIC_TEMPLATES + +// http://software.intel.com/en-us/articles/c0x-features-supported-by-intel-c-compiler/ +// continues to list scoped enum support as "Partial" +//# undef BOOST_NO_CXX11_SCOPED_ENUMS +#endif + +#if defined(_MSC_VER) && (_MSC_VER <= 1700) +// +// Although the Intel compiler is capable of supporting these, it appears not to in MSVC compatibility mode: +// +# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +# define BOOST_NO_CXX11_VARIADIC_TEMPLATES +# define BOOST_NO_CXX11_DELETED_FUNCTIONS +# define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +# define BOOST_NO_CXX11_TEMPLATE_ALIASES +#endif + +#if (BOOST_INTEL_CXX_VERSION < 1200) +// +// fenv.h appears not to work with Intel prior to 12.0: +// +# define BOOST_NO_FENV_H #endif // // last known and checked version: -#if (BOOST_INTEL_CXX_VERSION > 1110) +#if (BOOST_INTEL_CXX_VERSION > 1200) # if defined(BOOST_ASSERT_CONFIG) # error "Unknown compiler version - please run the configure tests and report the results" # elif defined(_MSC_VER) diff --git a/3rdParty/Boost/src/boost/config/compiler/metrowerks.hpp b/3rdParty/Boost/src/boost/config/compiler/metrowerks.hpp index 21083b7..184cb71 100644 --- a/3rdParty/Boost/src/boost/config/compiler/metrowerks.hpp +++ b/3rdParty/Boost/src/boost/config/compiler/metrowerks.hpp @@ -90,31 +90,35 @@ #if __MWERKS__ > 0x3206 && __option(rvalue_refs) # define BOOST_HAS_RVALUE_REFS #else -# define BOOST_NO_RVALUE_REFERENCES +# define BOOST_NO_CXX11_RVALUE_REFERENCES #endif -#define BOOST_NO_AUTO_DECLARATIONS -#define BOOST_NO_AUTO_MULTIDECLARATIONS -#define BOOST_NO_CHAR16_T -#define BOOST_NO_CHAR32_T -#define BOOST_NO_CONCEPTS -#define BOOST_NO_CONSTEXPR -#define BOOST_NO_DECLTYPE -#define BOOST_NO_DEFAULTED_FUNCTIONS -#define BOOST_NO_DELETED_FUNCTIONS -#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS -#define BOOST_NO_EXTERN_TEMPLATE -#define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS -#define BOOST_NO_INITIALIZER_LISTS -#define BOOST_NO_LAMBDAS -#define BOOST_NO_NULLPTR -#define BOOST_NO_RAW_LITERALS -#define BOOST_NO_SCOPED_ENUMS +#define BOOST_NO_CXX11_AUTO_DECLARATIONS +#define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS +#define BOOST_NO_CXX11_CHAR16_T +#define BOOST_NO_CXX11_CHAR32_T +#define BOOST_NO_CXX11_CONSTEXPR +#define BOOST_NO_CXX11_DECLTYPE +#define BOOST_NO_CXX11_DECLTYPE_N3276 +#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +#define BOOST_NO_CXX11_DELETED_FUNCTIONS +#define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS +#define BOOST_NO_CXX11_EXTERN_TEMPLATE +#define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS +#define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +#define BOOST_NO_CXX11_LAMBDAS +#define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS +#define BOOST_NO_CXX11_NOEXCEPT +#define BOOST_NO_CXX11_NULLPTR +#define BOOST_NO_CXX11_RANGE_BASED_FOR +#define BOOST_NO_CXX11_RAW_LITERALS +#define BOOST_NO_CXX11_SCOPED_ENUMS #define BOOST_NO_SFINAE_EXPR -#define BOOST_NO_STATIC_ASSERT -#define BOOST_NO_TEMPLATE_ALIASES -#define BOOST_NO_UNICODE_LITERALS -#define BOOST_NO_VARIADIC_TEMPLATES -#define BOOST_NO_VARIADIC_MACROS +#define BOOST_NO_CXX11_STATIC_ASSERT +#define BOOST_NO_CXX11_TEMPLATE_ALIASES +#define BOOST_NO_CXX11_UNICODE_LITERALS +#define BOOST_NO_CXX11_VARIADIC_TEMPLATES +#define BOOST_NO_CXX11_VARIADIC_MACROS +#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX #define BOOST_COMPILER "Metrowerks CodeWarrior C++ version " BOOST_STRINGIZE(BOOST_COMPILER_VERSION) diff --git a/3rdParty/Boost/src/boost/config/compiler/mpw.hpp b/3rdParty/Boost/src/boost/config/compiler/mpw.hpp index ae12f80..14adee0 100644 --- a/3rdParty/Boost/src/boost/config/compiler/mpw.hpp +++ b/3rdParty/Boost/src/boost/config/compiler/mpw.hpp @@ -40,30 +40,34 @@ // // See boost\config\suffix.hpp for BOOST_NO_LONG_LONG // -#define BOOST_NO_AUTO_DECLARATIONS -#define BOOST_NO_AUTO_MULTIDECLARATIONS -#define BOOST_NO_CHAR16_T -#define BOOST_NO_CHAR32_T -#define BOOST_NO_CONCEPTS -#define BOOST_NO_CONSTEXPR -#define BOOST_NO_DECLTYPE -#define BOOST_NO_DEFAULTED_FUNCTIONS -#define BOOST_NO_DELETED_FUNCTIONS -#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS -#define BOOST_NO_EXTERN_TEMPLATE -#define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS -#define BOOST_NO_INITIALIZER_LISTS -#define BOOST_NO_LAMBDAS -#define BOOST_NO_NULLPTR -#define BOOST_NO_RAW_LITERALS -#define BOOST_NO_RVALUE_REFERENCES -#define BOOST_NO_SCOPED_ENUMS +#define BOOST_NO_CXX11_AUTO_DECLARATIONS +#define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS +#define BOOST_NO_CXX11_CHAR16_T +#define BOOST_NO_CXX11_CHAR32_T +#define BOOST_NO_CXX11_CONSTEXPR +#define BOOST_NO_CXX11_DECLTYPE +#define BOOST_NO_CXX11_DECLTYPE_N3276 +#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +#define BOOST_NO_CXX11_DELETED_FUNCTIONS +#define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS +#define BOOST_NO_CXX11_EXTERN_TEMPLATE +#define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS +#define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +#define BOOST_NO_CXX11_LAMBDAS +#define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS +#define BOOST_NO_CXX11_NOEXCEPT +#define BOOST_NO_CXX11_NULLPTR +#define BOOST_NO_CXX11_RANGE_BASED_FOR +#define BOOST_NO_CXX11_RAW_LITERALS +#define BOOST_NO_CXX11_RVALUE_REFERENCES +#define BOOST_NO_CXX11_SCOPED_ENUMS #define BOOST_NO_SFINAE_EXPR -#define BOOST_NO_STATIC_ASSERT -#define BOOST_NO_TEMPLATE_ALIASES -#define BOOST_NO_UNICODE_LITERALS -#define BOOST_NO_VARIADIC_TEMPLATES -#define BOOST_NO_VARIADIC_MACROS +#define BOOST_NO_CXX11_STATIC_ASSERT +#define BOOST_NO_CXX11_TEMPLATE_ALIASES +#define BOOST_NO_CXX11_UNICODE_LITERALS +#define BOOST_NO_CXX11_VARIADIC_TEMPLATES +#define BOOST_NO_CXX11_VARIADIC_MACROS +#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX // // versions check: diff --git a/3rdParty/Boost/src/boost/config/compiler/pathscale.hpp b/3rdParty/Boost/src/boost/config/compiler/pathscale.hpp index 13ede88..3041126 100644 --- a/3rdParty/Boost/src/boost/config/compiler/pathscale.hpp +++ b/3rdParty/Boost/src/boost/config/compiler/pathscale.hpp @@ -32,51 +32,49 @@ # define BOOST_HAS_EXPM1 # define BOOST_HAS_DIRENT_H # define BOOST_HAS_CLOCK_GETTIME -# define BOOST_NO_VARIADIC_TEMPLATES -# define BOOST_NO_UNICODE_LITERALS -# define BOOST_NO_TEMPLATE_ALIASES -# define BOOST_NO_STD_UNORDERED -# define BOOST_NO_STATIC_ASSERT +# define BOOST_NO_CXX11_VARIADIC_TEMPLATES +# define BOOST_NO_CXX11_UNICODE_LITERALS +# define BOOST_NO_CXX11_TEMPLATE_ALIASES +# define BOOST_NO_CXX11_STATIC_ASSERT # define BOOST_NO_SFINAE_EXPR -# define BOOST_NO_SCOPED_ENUMS -# define BOOST_NO_RVALUE_REFERENCES -# define BOOST_NO_RAW_LITERALS -# define BOOST_NO_NULLPTR -# define BOOST_NO_NUMERIC_LIMITS_LOWEST -# define BOOST_NO_LAMBDAS -# define BOOST_NO_INITIALIZER_LISTS +# define BOOST_NO_CXX11_SCOPED_ENUMS +# define BOOST_NO_CXX11_RVALUE_REFERENCES +# define BOOST_NO_CXX11_RANGE_BASED_FOR +# define BOOST_NO_CXX11_RAW_LITERALS +# define BOOST_NO_CXX11_NULLPTR +# define BOOST_NO_CXX11_NUMERIC_LIMITS +# define BOOST_NO_CXX11_NOEXCEPT +# define BOOST_NO_CXX11_LAMBDAS +# define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS # define BOOST_NO_MS_INT64_NUMERIC_LIMITS -# define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS -# define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS -# define BOOST_NO_DELETED_FUNCTIONS -# define BOOST_NO_DEFAULTED_FUNCTIONS -# define BOOST_NO_DECLTYPE -# define BOOST_NO_CONSTEXPR -# define BOOST_NO_CONCEPTS +# define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS +# define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS +# define BOOST_NO_CXX11_DELETED_FUNCTIONS +# define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +# define BOOST_NO_CXX11_DECLTYPE +# define BOOST_NO_CXX11_DECLTYPE_N3276 +# define BOOST_NO_CXX11_CONSTEXPR # define BOOST_NO_COMPLETE_VALUE_INITIALIZATION -# define BOOST_NO_CHAR32_T -# define BOOST_NO_CHAR16_T -# define BOOST_NO_AUTO_MULTIDECLARATIONS -# define BOOST_NO_AUTO_DECLARATIONS -# define BOOST_NO_0X_HDR_UNORDERED_SET -# define BOOST_NO_0X_HDR_UNORDERED_MAP -# define BOOST_NO_0X_HDR_TYPEINDEX -# define BOOST_NO_0X_HDR_TUPLE -# define BOOST_NO_0X_HDR_THREAD -# define BOOST_NO_0X_HDR_SYSTEM_ERROR -# define BOOST_NO_0X_HDR_REGEX -# define BOOST_NO_0X_HDR_RATIO -# define BOOST_NO_0X_HDR_RANDOM -# define BOOST_NO_0X_HDR_MUTEX -# define BOOST_NO_0X_HDR_MEMORY_CONCEPTS -# define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS -# define BOOST_NO_0X_HDR_INITIALIZER_LIST -# define BOOST_NO_0X_HDR_FUTURE -# define BOOST_NO_0X_HDR_FORWARD_LIST -# define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS -# define BOOST_NO_0X_HDR_CONDITION_VARIABLE -# define BOOST_NO_0X_HDR_CONCEPTS -# define BOOST_NO_0X_HDR_CODECVT -# define BOOST_NO_0X_HDR_CHRONO +# define BOOST_NO_CXX11_CHAR32_T +# define BOOST_NO_CXX11_CHAR16_T +# define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS +# define BOOST_NO_CXX11_AUTO_DECLARATIONS +# define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX +# define BOOST_NO_CXX11_HDR_UNORDERED_SET +# define BOOST_NO_CXX11_HDR_UNORDERED_MAP +# define BOOST_NO_CXX11_HDR_TYPEINDEX +# define BOOST_NO_CXX11_HDR_TUPLE +# define BOOST_NO_CXX11_HDR_THREAD +# define BOOST_NO_CXX11_HDR_SYSTEM_ERROR +# define BOOST_NO_CXX11_HDR_REGEX +# define BOOST_NO_CXX11_HDR_RATIO +# define BOOST_NO_CXX11_HDR_RANDOM +# define BOOST_NO_CXX11_HDR_MUTEX +# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +# define BOOST_NO_CXX11_HDR_FUTURE +# define BOOST_NO_CXX11_HDR_FORWARD_LIST +# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE +# define BOOST_NO_CXX11_HDR_CODECVT +# define BOOST_NO_CXX11_HDR_CHRONO #endif diff --git a/3rdParty/Boost/src/boost/config/compiler/pgi.hpp b/3rdParty/Boost/src/boost/config/compiler/pgi.hpp index fb3a6c0..fa32fef 100644 --- a/3rdParty/Boost/src/boost/config/compiler/pgi.hpp +++ b/3rdParty/Boost/src/boost/config/compiler/pgi.hpp @@ -1,6 +1,6 @@ // (C) Copyright Noel Belcourt 2007. -// Use, modification and distribution are subject to the -// Boost Software License, Version 1.0. (See accompanying file +// 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 for most recent version. @@ -8,7 +8,7 @@ // PGI C++ compiler setup: #define BOOST_COMPILER_VERSION __PGIC__##__PGIC_MINOR__ -#define BOOST_COMPILER "PGI compiler version " BOOST_STRINGIZE(_COMPILER_VERSION) +#define BOOST_COMPILER "PGI compiler version " BOOST_STRINGIZE(BOOST_COMPILER_VERSION) // // Threading support: @@ -16,13 +16,29 @@ // if no threading API is detected. // -// PGI 10.x doesn't seem to define __PGIC__ - -// versions earlier than 10.x do define __PGIC__ -#if __PGIC__ >= 10 +#if __PGIC__ >= 11 // options requested by configure --enable-test #define BOOST_HAS_PTHREADS +#define BOOST_HAS_THREADS +#define BOOST_HAS_PTHREAD_YIELD +#define BOOST_HAS_NRVO +#define BOOST_HAS_LONG_LONG + +// options --enable-test wants undefined +#undef BOOST_NO_STDC_NAMESPACE +#undef BOOST_NO_EXCEPTION_STD_NAMESPACE +#undef BOOST_DEDUCED_TYPENAME + +#define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL +#define BOOST_NO_TWO_PHASE_NAME_LOOKUP +#define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS +#define BOOST_NO_CXX11_AUTO_DECLARATIONS + +#elif __PGIC__ >= 10 + +// options requested by configure --enable-test +#define BOOST_HAS_THREADS #define BOOST_HAS_NRVO #define BOOST_HAS_LONG_LONG @@ -33,11 +49,11 @@ #elif __PGIC__ >= 7 -#define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL +#define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL #define BOOST_NO_TWO_PHASE_NAME_LOOKUP #define BOOST_NO_SWPRINTF -#define BOOST_NO_AUTO_MULTIDECLARATIONS -#define BOOST_NO_AUTO_DECLARATIONS +#define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS +#define BOOST_NO_CXX11_AUTO_DECLARATIONS #else @@ -49,28 +65,52 @@ // // See boost\config\suffix.hpp for BOOST_NO_LONG_LONG // -#define BOOST_NO_CHAR16_T -#define BOOST_NO_CHAR32_T -#define BOOST_NO_CONCEPTS -#define BOOST_NO_CONSTEXPR -#define BOOST_NO_DECLTYPE -#define BOOST_NO_DEFAULTED_FUNCTIONS -#define BOOST_NO_DELETED_FUNCTIONS -#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS -#define BOOST_NO_EXTERN_TEMPLATE -#define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS -#define BOOST_NO_INITIALIZER_LISTS -#define BOOST_NO_LAMBDAS -#define BOOST_NO_NULLPTR -#define BOOST_NO_RAW_LITERALS -#define BOOST_NO_RVALUE_REFERENCES -#define BOOST_NO_SCOPED_ENUMS +#define BOOST_NO_CXX11_CHAR16_T +#define BOOST_NO_CXX11_CHAR32_T +#define BOOST_NO_CXX11_CONSTEXPR +#define BOOST_NO_CXX11_DECLTYPE +#define BOOST_NO_CXX11_DECLTYPE_N3276 +#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +#define BOOST_NO_CXX11_DELETED_FUNCTIONS +#define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS +#define BOOST_NO_CXX11_EXTERN_TEMPLATE +#define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS +#define BOOST_NO_CXX11_LAMBDAS +#define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS +#define BOOST_NO_CXX11_NOEXCEPT +#define BOOST_NO_CXX11_NULLPTR +#define BOOST_NO_CXX11_NUMERIC_LIMITS +#define BOOST_NO_CXX11_RANGE_BASED_FOR +#define BOOST_NO_CXX11_RAW_LITERALS +#define BOOST_NO_CXX11_RVALUE_REFERENCES +#define BOOST_NO_CXX11_SCOPED_ENUMS #define BOOST_NO_SFINAE_EXPR -#define BOOST_NO_STATIC_ASSERT -#define BOOST_NO_TEMPLATE_ALIASES -#define BOOST_NO_UNICODE_LITERALS -#define BOOST_NO_VARIADIC_TEMPLATES -#define BOOST_NO_VARIADIC_MACROS +#define BOOST_NO_CXX11_STATIC_ASSERT +#define BOOST_NO_SWPRINTF +#define BOOST_NO_CXX11_TEMPLATE_ALIASES +#define BOOST_NO_CXX11_UNICODE_LITERALS +#define BOOST_NO_CXX11_VARIADIC_TEMPLATES +#define BOOST_NO_CXX11_VARIADIC_MACROS +#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX + +#define BOOST_NO_CXX11_HDR_UNORDERED_SET +#define BOOST_NO_CXX11_HDR_UNORDERED_MAP +#define BOOST_NO_CXX11_HDR_TYPEINDEX +#define BOOST_NO_CXX11_HDR_TYPE_TRAITS +#define BOOST_NO_CXX11_HDR_TUPLE +#define BOOST_NO_CXX11_HDR_THREAD +#define BOOST_NO_CXX11_HDR_SYSTEM_ERROR +#define BOOST_NO_CXX11_HDR_REGEX +#define BOOST_NO_CXX11_HDR_RATIO +#define BOOST_NO_CXX11_HDR_RANDOM +#define BOOST_NO_CXX11_HDR_MUTEX +#define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +#define BOOST_NO_CXX11_HDR_FUTURE +#define BOOST_NO_CXX11_HDR_FORWARD_LIST +#define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE +#define BOOST_NO_CXX11_HDR_CODECVT +#define BOOST_NO_CXX11_HDR_CHRONO +#define BOOST_NO_CXX11_HDR_ARRAY // // version check: diff --git a/3rdParty/Boost/src/boost/config/compiler/sunpro_cc.hpp b/3rdParty/Boost/src/boost/config/compiler/sunpro_cc.hpp index 85fa462..65beb50 100644 --- a/3rdParty/Boost/src/boost/config/compiler/sunpro_cc.hpp +++ b/3rdParty/Boost/src/boost/config/compiler/sunpro_cc.hpp @@ -99,30 +99,34 @@ // # define BOOST_HAS_LONG_LONG -#define BOOST_NO_AUTO_DECLARATIONS -#define BOOST_NO_AUTO_MULTIDECLARATIONS -#define BOOST_NO_CHAR16_T -#define BOOST_NO_CHAR32_T -#define BOOST_NO_CONCEPTS -#define BOOST_NO_CONSTEXPR -#define BOOST_NO_DECLTYPE -#define BOOST_NO_DEFAULTED_FUNCTIONS -#define BOOST_NO_DELETED_FUNCTIONS -#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS -#define BOOST_NO_EXTERN_TEMPLATE -#define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS -#define BOOST_NO_INITIALIZER_LISTS -#define BOOST_NO_LAMBDAS -#define BOOST_NO_NULLPTR -#define BOOST_NO_RAW_LITERALS -#define BOOST_NO_RVALUE_REFERENCES -#define BOOST_NO_SCOPED_ENUMS +#define BOOST_NO_CXX11_AUTO_DECLARATIONS +#define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS +#define BOOST_NO_CXX11_CHAR16_T +#define BOOST_NO_CXX11_CHAR32_T +#define BOOST_NO_CXX11_CONSTEXPR +#define BOOST_NO_CXX11_DECLTYPE +#define BOOST_NO_CXX11_DECLTYPE_N3276 +#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +#define BOOST_NO_CXX11_DELETED_FUNCTIONS +#define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS +#define BOOST_NO_CXX11_EXTERN_TEMPLATE +#define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS +#define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +#define BOOST_NO_CXX11_LAMBDAS +#define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS +#define BOOST_NO_CXX11_NOEXCEPT +#define BOOST_NO_CXX11_NULLPTR +#define BOOST_NO_CXX11_RANGE_BASED_FOR +#define BOOST_NO_CXX11_RAW_LITERALS +#define BOOST_NO_CXX11_RVALUE_REFERENCES +#define BOOST_NO_CXX11_SCOPED_ENUMS #define BOOST_NO_SFINAE_EXPR -#define BOOST_NO_STATIC_ASSERT -#define BOOST_NO_TEMPLATE_ALIASES -#define BOOST_NO_UNICODE_LITERALS -#define BOOST_NO_VARIADIC_TEMPLATES -#define BOOST_NO_VARIADIC_MACROS +#define BOOST_NO_CXX11_STATIC_ASSERT +#define BOOST_NO_CXX11_TEMPLATE_ALIASES +#define BOOST_NO_CXX11_UNICODE_LITERALS +#define BOOST_NO_CXX11_VARIADIC_TEMPLATES +#define BOOST_NO_CXX11_VARIADIC_MACROS +#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX // // Version diff --git a/3rdParty/Boost/src/boost/config/compiler/vacpp.hpp b/3rdParty/Boost/src/boost/config/compiler/vacpp.hpp index 7ad616e..2410d5a 100644 --- a/3rdParty/Boost/src/boost/config/compiler/vacpp.hpp +++ b/3rdParty/Boost/src/boost/config/compiler/vacpp.hpp @@ -71,47 +71,59 @@ // See boost\config\suffix.hpp for BOOST_NO_LONG_LONG // #if ! __IBMCPP_AUTO_TYPEDEDUCTION -# define BOOST_NO_AUTO_DECLARATIONS -# define BOOST_NO_AUTO_MULTIDECLARATIONS +# define BOOST_NO_CXX11_AUTO_DECLARATIONS +# define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS #endif #if ! __IBMCPP_UTF_LITERAL__ -# define BOOST_NO_CHAR16_T -# define BOOST_NO_CHAR32_T +# define BOOST_NO_CXX11_CHAR16_T +# define BOOST_NO_CXX11_CHAR32_T +#endif +#if ! __IBMCPP_CONSTEXPR +# define BOOST_NO_CXX11_CONSTEXPR #endif -#define BOOST_NO_CONCEPTS -#define BOOST_NO_CONSTEXPR #if ! __IBMCPP_DECLTYPE -# define BOOST_NO_DECLTYPE +# define BOOST_NO_CXX11_DECLTYPE #else # define BOOST_HAS_DECLTYPE #endif -#define BOOST_NO_DEFAULTED_FUNCTIONS -#define BOOST_NO_DELETED_FUNCTIONS -#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS +#define BOOST_NO_CXX11_DECLTYPE_N3276 +#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +#define BOOST_NO_CXX11_DELETED_FUNCTIONS +#if ! __IBMCPP_EXPLICIT_CONVERSION_OPERATORS +# define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS +#endif #if ! __IBMCPP_EXTERN_TEMPLATE -# define BOOST_NO_EXTERN_TEMPLATE +# define BOOST_NO_CXX11_EXTERN_TEMPLATE #endif #if ! __IBMCPP_VARIADIC_TEMPLATES // not enabled separately at this time -# define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS -#endif -#define BOOST_NO_INITIALIZER_LISTS -#define BOOST_NO_LAMBDAS -#define BOOST_NO_NULLPTR -#define BOOST_NO_RAW_LITERALS -#define BOOST_NO_RVALUE_REFERENCES -#define BOOST_NO_SCOPED_ENUMS +# define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS +#endif +#define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +#define BOOST_NO_CXX11_LAMBDAS +#define BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS +#define BOOST_NO_CXX11_NOEXCEPT +#define BOOST_NO_CXX11_NULLPTR +#define BOOST_NO_CXX11_RANGE_BASED_FOR +#define BOOST_NO_CXX11_RAW_LITERALS +#if ! __IBMCPP_RVALUE_REFERENCES +# define BOOST_NO_CXX11_RVALUE_REFERENCES +#endif +#if ! __IBMCPP_SCOPED_ENUM +# define BOOST_NO_CXX11_SCOPED_ENUMS +#endif #define BOOST_NO_SFINAE_EXPR +#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX #if ! __IBMCPP_STATIC_ASSERT -# define BOOST_NO_STATIC_ASSERT +# define BOOST_NO_CXX11_STATIC_ASSERT #endif -#define BOOST_NO_TEMPLATE_ALIASES -#define BOOST_NO_UNICODE_LITERALS +#define BOOST_NO_CXX11_TEMPLATE_ALIASES +#define BOOST_NO_CXX11_UNICODE_LITERALS #if ! __IBMCPP_VARIADIC_TEMPLATES -# define BOOST_NO_VARIADIC_TEMPLATES +# define BOOST_NO_CXX11_VARIADIC_TEMPLATES #endif #if ! __C99_MACRO_WITH_VA_ARGS -# define BOOST_NO_VARIADIC_MACROS +# define BOOST_NO_CXX11_VARIADIC_MACROS #endif diff --git a/3rdParty/Boost/src/boost/config/compiler/visualc.hpp b/3rdParty/Boost/src/boost/config/compiler/visualc.hpp index 3878936..0b11faa 100644 --- a/3rdParty/Boost/src/boost/config/compiler/visualc.hpp +++ b/3rdParty/Boost/src/boost/config/compiler/visualc.hpp @@ -9,38 +9,54 @@ // LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) // See http://www.boost.org for most recent version. - +// // Microsoft Visual C++ compiler setup: +// +// We need to be careful with the checks in this file, as contrary +// to popular belief there are versions with _MSC_VER with the final +// digit non-zero (mainly the MIPS cross compiler). +// +// So we either test _MSC_VER >= XXXX or else _MSC_VER < XXXX. +// No other comparisons (==, >, or <=) are safe. +// #define BOOST_MSVC _MSC_VER +// +// Helper macro BOOST_MSVC_FULL_VER for use in Boost code: +// #if _MSC_FULL_VER > 100000000 # define BOOST_MSVC_FULL_VER _MSC_FULL_VER #else # define BOOST_MSVC_FULL_VER (_MSC_FULL_VER * 10) #endif -// turn off the warnings before we #include anything +// Attempt to suppress VC6 warnings about the length of decorated names (obsolete): #pragma warning( disable : 4503 ) // warning: decorated name length exceeded +// +// versions check: +// we don't support Visual C++ prior to version 6: +#if _MSC_VER < 1200 +# error "Compiler not supported or configured - please reconfigure" +#endif + #if _MSC_VER < 1300 // 1200 == VC++ 6.0, 1200-1202 == eVC++4 # pragma warning( disable : 4786 ) // ident trunc to '255' chars in debug info # define BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS # define BOOST_NO_VOID_RETURNS # define BOOST_NO_EXCEPTION_STD_NAMESPACE -# if BOOST_MSVC == 1202 +# if _MSC_VER == 1202 # define BOOST_NO_STD_TYPEINFO # endif - // disable min/max macro defines on vc6: - // #endif /// Visual Studio has no fenv.h #define BOOST_NO_FENV_H -#if (_MSC_VER <= 1300) // 1300 == VC++ 7.0 +#if (_MSC_VER < 1310) // 130X == VC++ 7.0 # if !defined(_MSC_EXTENSIONS) && !defined(BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS) // VC7 bug with /Za # define BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS @@ -72,7 +88,7 @@ # define BOOST_NO_IS_ABSTRACT # define BOOST_NO_FUNCTION_TYPE_SPECIALIZATIONS // TODO: what version is meant here? Have there really been any fixes in cl 12.01 (as e.g. shipped with eVC4)? -# if (_MSC_VER > 1200) +# if (_MSC_VER >= 1300) # define BOOST_NO_MEMBER_FUNCTION_SPECIALIZATIONS # endif @@ -83,9 +99,9 @@ // it appears not to actually work: # define BOOST_NO_SWPRINTF // Our extern template tests also fail for this compiler: -# define BOOST_NO_EXTERN_TEMPLATE +# define BOOST_NO_CXX11_EXTERN_TEMPLATE // Variadic macros do not exist for VC7.1 and lower -# define BOOST_NO_VARIADIC_MACROS +# define BOOST_NO_CXX11_VARIADIC_MACROS #endif #if defined(UNDER_CE) @@ -93,17 +109,16 @@ # define BOOST_NO_SWPRINTF #endif -#if _MSC_VER <= 1400 // 1400 == VC++ 8.0 +#if _MSC_VER < 1500 // 140X == VC++ 8.0 # define BOOST_NO_MEMBER_TEMPLATE_FRIENDS #endif -#if _MSC_VER == 1500 // 1500 == VC++ 9.0 +#if _MSC_VER < 1600 // 150X == VC++ 9.0 // A bug in VC9: # define BOOST_NO_ADL_BARRIER #endif -#if (_MSC_VER <= 1600) // MSVC (including the latest checked version) has not yet completely // implemented value-initialization, as is reported: // "VC++ does not value-initialize members of derived classes without @@ -117,11 +132,10 @@ // https://connect.microsoft.com/VisualStudio/feedback/details/100744 // See also: http://www.boost.org/libs/utility/value_init.htm#compiler_issues // (Niels Dekker, LKEB, May 2010) -#define BOOST_NO_COMPLETE_VALUE_INITIALIZATION -#endif +# define BOOST_NO_COMPLETE_VALUE_INITIALIZATION -#if _MSC_VER <= 1500 || !defined(BOOST_STRICT_CONFIG) // 1500 == VC++ 9.0 -# define BOOST_NO_INITIALIZER_LISTS +#if _MSC_VER < 1600 || !defined(BOOST_STRICT_CONFIG) // 150X == VC++ 9.0 +# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST #endif #ifndef _NATIVE_WCHAR_T_DEFINED @@ -129,11 +143,15 @@ #endif #if defined(_WIN32_WCE) || defined(UNDER_CE) -# define BOOST_NO_THREADEX -# define BOOST_NO_GETSYSTEMTIMEASFILETIME # define BOOST_NO_SWPRINTF #endif +// we have ThreadEx or GetSystemTimeAsFileTime unless we're running WindowsCE +#if !defined(_WIN32_WCE) && !defined(UNDER_CE) +# define BOOST_HAS_THREADEX +# define BOOST_HAS_GETSYSTEMTIMEASFILETIME +#endif + // // check for exception handling support: #if !defined(_CPPUNWIND) && !defined(BOOST_NO_EXCEPTIONS) @@ -173,36 +191,44 @@ // C++ features supported by VC++ 10 (aka 2010) // #if _MSC_VER < 1600 -#define BOOST_NO_AUTO_DECLARATIONS -#define BOOST_NO_AUTO_MULTIDECLARATIONS -#define BOOST_NO_LAMBDAS -#define BOOST_NO_RVALUE_REFERENCES -#define BOOST_NO_STATIC_ASSERT -#define BOOST_NO_NULLPTR +# define BOOST_NO_CXX11_AUTO_DECLARATIONS +# define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS +# define BOOST_NO_CXX11_LAMBDAS +# define BOOST_NO_CXX11_RVALUE_REFERENCES +# define BOOST_NO_CXX11_STATIC_ASSERT +# define BOOST_NO_CXX11_NULLPTR +# define BOOST_NO_CXX11_DECLTYPE #endif // _MSC_VER < 1600 #if _MSC_VER >= 1600 -#define BOOST_HAS_STDINT_H +# define BOOST_HAS_STDINT_H #endif +// C++ features supported by VC++ 11 (aka 2012) +// +#if _MSC_VER < 1700 +# define BOOST_NO_CXX11_RANGE_BASED_FOR +# define BOOST_NO_CXX11_SCOPED_ENUMS +#endif // _MSC_VER < 1700 + // C++0x features not supported by any versions -#define BOOST_NO_CHAR16_T -#define BOOST_NO_CHAR32_T -#define BOOST_NO_CONCEPTS -#define BOOST_NO_CONSTEXPR -#define BOOST_NO_DEFAULTED_FUNCTIONS -#define BOOST_NO_DECLTYPE -#define BOOST_NO_DELETED_FUNCTIONS -#define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS -#define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS -#define BOOST_NO_INITIALIZER_LISTS -#define BOOST_NO_RAW_LITERALS -#define BOOST_NO_SCOPED_ENUMS -#define BOOST_NO_TEMPLATE_ALIASES -#define BOOST_NO_UNICODE_LITERALS -#define BOOST_NO_VARIADIC_TEMPLATES +#define BOOST_NO_CXX11_CHAR16_T +#define BOOST_NO_CXX11_CHAR32_T +#define BOOST_NO_CXX11_CONSTEXPR +#define BOOST_NO_CXX11_DECLTYPE_N3276 +#define BOOST_NO_CXX11_DEFAULTED_FUNCTIONS +#define BOOST_NO_CXX11_DELETED_FUNCTIONS +#define BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS +#define BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS +#define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +#define BOOST_NO_CXX11_NOEXCEPT +#define BOOST_NO_CXX11_RAW_LITERALS +#define BOOST_NO_CXX11_TEMPLATE_ALIASES +#define BOOST_NO_CXX11_UNICODE_LITERALS +#define BOOST_NO_CXX11_VARIADIC_TEMPLATES #define BOOST_NO_SFINAE_EXPR #define BOOST_NO_TWO_PHASE_NAME_LOOKUP +#define BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX // // prefix and suffix headers: // @@ -213,6 +239,7 @@ # define BOOST_ABI_SUFFIX "boost/config/abi/msvc_suffix.hpp" #endif +#ifndef BOOST_COMPILER // TODO: // these things are mostly bogus. 1200 means version 12.0 of the compiler. The // artificial versions assigned to them only refer to the versions of some IDE @@ -224,12 +251,21 @@ // Note: these are so far off, they are not really supported # elif _MSC_VER < 1300 // eVC++ 4 comes with 1200-1202 # define BOOST_COMPILER_VERSION evc4.0 -# elif _MSC_VER == 1400 +# elif _MSC_VER < 1400 + // Note: I'm not aware of any CE compiler with version 13xx +# if defined(BOOST_ASSERT_CONFIG) +# error "Unknown EVC++ compiler version - please run the configure tests and report the results" +# else +# pragma message("Unknown EVC++ compiler version - please run the configure tests and report the results") +# endif +# elif _MSC_VER < 1500 # define BOOST_COMPILER_VERSION evc8 -# elif _MSC_VER == 1500 +# elif _MSC_VER < 1600 # define BOOST_COMPILER_VERSION evc9 -# elif _MSC_VER == 1600 +# elif _MSC_VER < 1700 # define BOOST_COMPILER_VERSION evc10 +# elif _MSC_VER < 1800 +# define BOOST_COMPILER_VERSION evc11 # else # if defined(BOOST_ASSERT_CONFIG) # error "Unknown EVC++ compiler version - please run the configure tests and report the results" @@ -243,32 +279,29 @@ # define BOOST_COMPILER_VERSION 5.0 # elif _MSC_VER < 1300 # define BOOST_COMPILER_VERSION 6.0 -# elif _MSC_VER == 1300 +# elif _MSC_VER < 1310 # define BOOST_COMPILER_VERSION 7.0 -# elif _MSC_VER == 1310 +# elif _MSC_VER < 1400 # define BOOST_COMPILER_VERSION 7.1 -# elif _MSC_VER == 1400 +# elif _MSC_VER < 1500 # define BOOST_COMPILER_VERSION 8.0 -# elif _MSC_VER == 1500 +# elif _MSC_VER < 1600 # define BOOST_COMPILER_VERSION 9.0 -# elif _MSC_VER == 1600 +# elif _MSC_VER < 1700 # define BOOST_COMPILER_VERSION 10.0 +# elif _MSC_VER < 1800 +# define BOOST_COMPILER_VERSION 11.0 # else # define BOOST_COMPILER_VERSION _MSC_VER # endif # endif -#define BOOST_COMPILER "Microsoft Visual C++ version " BOOST_STRINGIZE(BOOST_COMPILER_VERSION) - -// -// versions check: -// we don't support Visual C++ prior to version 6: -#if _MSC_VER < 1200 -#error "Compiler not supported or configured - please reconfigure" +# define BOOST_COMPILER "Microsoft Visual C++ version " BOOST_STRINGIZE(BOOST_COMPILER_VERSION) #endif + // -// last known and checked version is 1600 (VC10, aka 2010): -#if (_MSC_VER > 1600) +// last known and checked version is 1700 (VC11, aka 2011): +#if (_MSC_VER > 1700) # if defined(BOOST_ASSERT_CONFIG) # error "Unknown compiler version - please run the configure tests and report the results" # else diff --git a/3rdParty/Boost/src/boost/config/platform/cray.hpp b/3rdParty/Boost/src/boost/config/platform/cray.hpp new file mode 100644 index 0000000..5c476e4 --- /dev/null +++ b/3rdParty/Boost/src/boost/config/platform/cray.hpp @@ -0,0 +1,18 @@ +// (C) Copyright John Maddock 2011. +// 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 for most recent version. + +// SGI Irix specific config options: + +#define BOOST_PLATFORM "Cray" + +// boilerplate code: +#define BOOST_HAS_UNISTD_H +#include <boost/config/posix_features.hpp> + + + diff --git a/3rdParty/Boost/src/boost/config/platform/linux.hpp b/3rdParty/Boost/src/boost/config/platform/linux.hpp index 51ae133..a02aff7 100644 --- a/3rdParty/Boost/src/boost/config/platform/linux.hpp +++ b/3rdParty/Boost/src/boost/config/platform/linux.hpp @@ -11,7 +11,11 @@ #define BOOST_PLATFORM "linux" // make sure we have __GLIBC_PREREQ if available at all +#ifdef __cplusplus #include <cstdlib> +#else +#include <stdlib.h> +#endif // // <stdint.h> added to glibc 2.1.1 @@ -68,6 +72,7 @@ // boilerplate code: #define BOOST_HAS_UNISTD_H #include <boost/config/posix_features.hpp> +#define BOOST_HAS_PTHREAD_YIELD #ifndef __GNUC__ // diff --git a/3rdParty/Boost/src/boost/config/platform/macos.hpp b/3rdParty/Boost/src/boost/config/platform/macos.hpp index 2780ef9..6d876b1 100644 --- a/3rdParty/Boost/src/boost/config/platform/macos.hpp +++ b/3rdParty/Boost/src/boost/config/platform/macos.hpp @@ -64,16 +64,17 @@ # if ( defined(TARGET_API_MAC_CARBON) && TARGET_API_MAC_CARBON ) || ( defined(TARGET_CARBON) && TARGET_CARBON ) # if !defined(BOOST_HAS_PTHREADS) -# define BOOST_HAS_MPTASKS +// MPTasks support is deprecated/removed from Boost: +//# define BOOST_HAS_MPTASKS # elif ( __dest_os == __mac_os_x ) // We are doing a Carbon/Mach-O/MSL build which has pthreads, but only the // gettimeofday and no posix. # define BOOST_HAS_GETTIMEOFDAY # endif -// The MP task implementation of Boost Threads aims to replace MP-unsafe -// parts of the MSL, so we turn on threads unconditionally. -# define BOOST_HAS_THREADS +#ifdef BOOST_HAS_PTHREADS +# define BOOST_HAS_THREADS +#endif // The remote call manager depends on this. # define BOOST_BIND_ENABLE_PASCAL diff --git a/3rdParty/Boost/src/boost/config/platform/symbian.hpp b/3rdParty/Boost/src/boost/config/platform/symbian.hpp index ad37943..e02a778 100644 --- a/3rdParty/Boost/src/boost/config/platform/symbian.hpp +++ b/3rdParty/Boost/src/boost/config/platform/symbian.hpp @@ -18,8 +18,11 @@ // Open C / C++ plugin was introdused in this SDK, earlier versions don't have CRT / STL # define BOOST_S60_3rd_EDITION_FP2_OR_LATER_SDK // make sure we have __GLIBC_PREREQ if available at all -# include <cstdlib> -// boilerplate code: +#ifdef __cplusplus +#include <cstdlib> +#else +#include <stdlib.h> +#endif// boilerplate code: # define BOOST_HAS_UNISTD_H # include <boost/config/posix_features.hpp> // S60 SDK defines _POSIX_VERSION as POSIX.1 diff --git a/3rdParty/Boost/src/boost/config/platform/win32.hpp b/3rdParty/Boost/src/boost/config/platform/win32.hpp index 72c3dce..3922012 100644 --- a/3rdParty/Boost/src/boost/config/platform/win32.hpp +++ b/3rdParty/Boost/src/boost/config/platform/win32.hpp @@ -55,6 +55,8 @@ #ifdef _WIN32_WCE # define BOOST_NO_ANSI_APIS +#else +# define BOOST_HAS_GETSYSTEMTIMEASFILETIME #endif #ifndef BOOST_HAS_PTHREADS diff --git a/3rdParty/Boost/src/boost/config/select_compiler_config.hpp b/3rdParty/Boost/src/boost/config/select_compiler_config.hpp index e19469a..0d47b25 100644 --- a/3rdParty/Boost/src/boost/config/select_compiler_config.hpp +++ b/3rdParty/Boost/src/boost/config/select_compiler_config.hpp @@ -10,33 +10,6 @@ // See http://www.boost.org/ for most recent version. - -// one identification macro for each of the -// compilers we support: - -# define BOOST_CXX_GCCXML 0 -# define BOOST_CXX_NVCC 0 -# define BOOST_CXX_COMO 0 -# define BOOST_CXX_PATHSCALE 0 -# define BOOST_CXX_CLANG 0 -# define BOOST_CXX_DMC 0 -# define BOOST_CXX_INTEL 0 -# define BOOST_CXX_GNUC 0 -# define BOOST_CXX_KCC 0 -# define BOOST_CXX_SGI 0 -# define BOOST_CXX_TRU64 0 -# define BOOST_CXX_GHS 0 -# define BOOST_CXX_BORLAND 0 -# define BOOST_CXX_CW 0 -# define BOOST_CXX_SUNPRO 0 -# define BOOST_CXX_HPACC 0 -# define BOOST_CXX_MPW 0 -# define BOOST_CXX_IBMCPP 0 -# define BOOST_CXX_MSVC 0 -# define BOOST_CXX_PGI 0 -# define BOOST_CXX_NVCC 0 - - // locate which compiler we are using and define // BOOST_COMPILER_CONFIG as needed: @@ -44,6 +17,10 @@ // GCC-XML emulates other compilers, it has to appear first here! # define BOOST_COMPILER_CONFIG "boost/config/compiler/gcc_xml.hpp" +#elif defined(_CRAYC) +// EDG based Cray compiler: +# define BOOST_COMPILER_CONFIG "boost/config/compiler/cray.hpp" + #elif defined __CUDACC__ // NVIDIA CUDA C++ compiler for GPU # define BOOST_COMPILER_CONFIG "boost/config/compiler/nvcc.hpp" diff --git a/3rdParty/Boost/src/boost/config/select_platform_config.hpp b/3rdParty/Boost/src/boost/config/select_platform_config.hpp index bc1ffaf..2af61d2 100644 --- a/3rdParty/Boost/src/boost/config/select_platform_config.hpp +++ b/3rdParty/Boost/src/boost/config/select_platform_config.hpp @@ -13,7 +13,7 @@ // <header_name> in order to prevent macro expansion within the header // name (for example "linux" is a macro on linux systems). -#if defined(linux) || defined(__linux) || defined(__linux__) || defined(__GNU__) || defined(__GLIBC__) +#if (defined(linux) || defined(__linux) || defined(__linux__) || defined(__GNU__) || defined(__GLIBC__)) && !defined(_CRAYC) // linux, also other platforms (Hurd etc) that use GLIBC, should these really have their own config headers though? # define BOOST_PLATFORM_CONFIG "boost/config/platform/linux.hpp" @@ -69,6 +69,10 @@ // Symbian: # define BOOST_PLATFORM_CONFIG "boost/config/platform/symbian.hpp" +#elif defined(_CRAYC) +// Cray: +# define BOOST_PLATFORM_CONFIG "boost/config/platform/cray.hpp" + #elif defined(__VMS) // VMS: # define BOOST_PLATFORM_CONFIG "boost/config/platform/vms.hpp" diff --git a/3rdParty/Boost/src/boost/config/select_stdlib_config.hpp b/3rdParty/Boost/src/boost/config/select_stdlib_config.hpp index f020482..96ede00 100644 --- a/3rdParty/Boost/src/boost/config/select_stdlib_config.hpp +++ b/3rdParty/Boost/src/boost/config/select_stdlib_config.hpp @@ -14,7 +14,11 @@ // First include <cstddef> to determine if some version of STLport is in use as the std lib // (do not rely on this header being included since users can short-circuit this header // if they know whose std lib they are using.) -#include <cstddef> +#ifdef __cplusplus +# include <cstddef> +#else +# include <stddef.h> +#endif #if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION) // STLPort library; this _must_ come first, otherwise since diff --git a/3rdParty/Boost/src/boost/config/stdlib/dinkumware.hpp b/3rdParty/Boost/src/boost/config/stdlib/dinkumware.hpp index a7579da..e0032b9 100644 --- a/3rdParty/Boost/src/boost/config/stdlib/dinkumware.hpp +++ b/3rdParty/Boost/src/boost/config/stdlib/dinkumware.hpp @@ -87,45 +87,44 @@ #endif #include <typeinfo> -#if !_HAS_EXCEPTIONS +#if ( (!_HAS_EXCEPTIONS && !defined(__ghs__)) || (!_HAS_NAMESPACE && defined(__ghs__)) ) # define BOOST_NO_STD_TYPEINFO #endif // C++0x headers implemented in 520 (as shipped by Microsoft) // #if !defined(_CPPLIB_VER) || _CPPLIB_VER < 520 -# define BOOST_NO_0X_HDR_ARRAY -# define BOOST_NO_0X_HDR_CODECVT -# define BOOST_NO_0X_HDR_FORWARD_LIST -# define BOOST_NO_0X_HDR_INITIALIZER_LIST -# define BOOST_NO_0X_HDR_RANDOM -# define BOOST_NO_0X_HDR_REGEX -# define BOOST_NO_0X_HDR_SYSTEM_ERROR -# define BOOST_NO_0X_HDR_TYPE_TRAITS -# define BOOST_NO_STD_UNORDERED // deprecated; see following -# define BOOST_NO_0X_HDR_UNORDERED_MAP -# define BOOST_NO_0X_HDR_UNORDERED_SET -# define BOOST_NO_0X_HDR_TUPLE -# define BOOST_NO_0X_HDR_TYPEINDEX -# define BOOST_NO_NUMERIC_LIMITS_LOWEST +# define BOOST_NO_CXX11_HDR_ARRAY +# define BOOST_NO_CXX11_HDR_CODECVT +# define BOOST_NO_CXX11_HDR_FORWARD_LIST +# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +# define BOOST_NO_CXX11_HDR_RANDOM +# define BOOST_NO_CXX11_HDR_REGEX +# define BOOST_NO_CXX11_HDR_SYSTEM_ERROR +# define BOOST_NO_CXX11_HDR_UNORDERED_MAP +# define BOOST_NO_CXX11_HDR_UNORDERED_SET +# define BOOST_NO_CXX11_HDR_TUPLE +# define BOOST_NO_CXX11_HDR_TYPEINDEX +# define BOOST_NO_CXX11_HDR_FUNCTIONAL +# define BOOST_NO_CXX11_NUMERIC_LIMITS +# define BOOST_NO_CXX11_SMART_PTR #endif -#if !defined(_HAS_TR1_IMPORTS) && !defined(BOOST_NO_0X_HDR_TUPLE) -# define BOOST_NO_0X_HDR_TUPLE +#if (!defined(_HAS_TR1_IMPORTS) || (_HAS_TR1_IMPORTS+0 == 0)) && !defined(BOOST_NO_CXX11_HDR_TUPLE) +# define BOOST_NO_CXX11_HDR_TUPLE #endif - -// C++0x headers not yet implemented // -# define BOOST_NO_0X_HDR_CHRONO -# define BOOST_NO_0X_HDR_CONCEPTS -# define BOOST_NO_0X_HDR_CONDITION_VARIABLE -# define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS -# define BOOST_NO_0X_HDR_FUTURE -# define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS -# define BOOST_NO_0X_HDR_MEMORY_CONCEPTS -# define BOOST_NO_0X_HDR_MUTEX -# define BOOST_NO_0X_HDR_RATIO -# define BOOST_NO_0X_HDR_THREAD +// C++0x headers not yet (fully) implemented: +// +# define BOOST_NO_CXX11_HDR_TYPE_TRAITS +# define BOOST_NO_CXX11_HDR_CHRONO +# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE +# define BOOST_NO_CXX11_HDR_FUTURE +# define BOOST_NO_CXX11_HDR_MUTEX +# define BOOST_NO_CXX11_HDR_RATIO +# define BOOST_NO_CXX11_HDR_THREAD +# define BOOST_NO_CXX11_ALLOCATOR +# define BOOST_NO_CXX11_ATOMIC_SMART_PTR #ifdef _CPPLIB_VER # define BOOST_DINKUMWARE_STDLIB _CPPLIB_VER diff --git a/3rdParty/Boost/src/boost/config/stdlib/libcomo.hpp b/3rdParty/Boost/src/boost/config/stdlib/libcomo.hpp index 16a842a..29490f1 100644 --- a/3rdParty/Boost/src/boost/config/stdlib/libcomo.hpp +++ b/3rdParty/Boost/src/boost/config/stdlib/libcomo.hpp @@ -35,30 +35,29 @@ // C++0x headers not yet implemented // -# define BOOST_NO_0X_HDR_ARRAY -# define BOOST_NO_0X_HDR_CHRONO -# define BOOST_NO_0X_HDR_CODECVT -# define BOOST_NO_0X_HDR_CONCEPTS -# define BOOST_NO_0X_HDR_CONDITION_VARIABLE -# define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS -# define BOOST_NO_0X_HDR_FORWARD_LIST -# define BOOST_NO_0X_HDR_FUTURE -# define BOOST_NO_0X_HDR_INITIALIZER_LIST -# define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS -# define BOOST_NO_0X_HDR_MEMORY_CONCEPTS -# define BOOST_NO_0X_HDR_MUTEX -# define BOOST_NO_0X_HDR_RANDOM -# define BOOST_NO_0X_HDR_RATIO -# define BOOST_NO_0X_HDR_REGEX -# define BOOST_NO_0X_HDR_SYSTEM_ERROR -# define BOOST_NO_0X_HDR_THREAD -# define BOOST_NO_0X_HDR_TUPLE -# define BOOST_NO_0X_HDR_TYPE_TRAITS -# define BOOST_NO_0X_HDR_TYPEINDEX -# define BOOST_NO_STD_UNORDERED // deprecated; see following -# define BOOST_NO_0X_HDR_UNORDERED_MAP -# define BOOST_NO_0X_HDR_UNORDERED_SET -# define BOOST_NO_NUMERIC_LIMITS_LOWEST +# define BOOST_NO_CXX11_HDR_ARRAY +# define BOOST_NO_CXX11_HDR_CHRONO +# define BOOST_NO_CXX11_HDR_CODECVT +# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE +# define BOOST_NO_CXX11_HDR_FORWARD_LIST +# define BOOST_NO_CXX11_HDR_FUTURE +# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +# define BOOST_NO_CXX11_HDR_MUTEX +# define BOOST_NO_CXX11_HDR_RANDOM +# define BOOST_NO_CXX11_HDR_RATIO +# define BOOST_NO_CXX11_HDR_REGEX +# define BOOST_NO_CXX11_HDR_SYSTEM_ERROR +# define BOOST_NO_CXX11_HDR_THREAD +# define BOOST_NO_CXX11_HDR_TUPLE +# define BOOST_NO_CXX11_HDR_TYPE_TRAITS +# define BOOST_NO_CXX11_HDR_TYPEINDEX +# define BOOST_NO_CXX11_HDR_UNORDERED_MAP +# define BOOST_NO_CXX11_HDR_UNORDERED_SET +# define BOOST_NO_CXX11_NUMERIC_LIMITS +# define BOOST_NO_CXX11_ALLOCATOR +# define BOOST_NO_CXX11_ATOMIC_SMART_PTR +# define BOOST_NO_CXX11_SMART_PTR +# define BOOST_NO_CXX11_HDR_FUNCTIONAL // // Intrinsic type_traits support. diff --git a/3rdParty/Boost/src/boost/config/stdlib/libcpp.hpp b/3rdParty/Boost/src/boost/config/stdlib/libcpp.hpp index db7f6f1..3d57440 100644 --- a/3rdParty/Boost/src/boost/config/stdlib/libcpp.hpp +++ b/3rdParty/Boost/src/boost/config/stdlib/libcpp.hpp @@ -19,15 +19,18 @@ #define BOOST_HAS_THREADS -#define BOOST_NO_0X_HDR_CONCEPTS -#define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS -#define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS -#define BOOST_NO_0X_HDR_MEMORY_CONCEPTS - #ifdef _LIBCPP_HAS_NO_VARIADICS -# define BOOST_NO_0X_HDR_TUPLE +# define BOOST_NO_CXX11_HDR_TUPLE #endif +// +// These appear to be unusable/incomplete so far: +// +# define BOOST_NO_CXX11_HDR_CHRONO +# define BOOST_NO_CXX11_HDR_FUTURE +# define BOOST_NO_CXX11_HDR_TYPE_TRAITS +# define BOOST_NO_CXX11_ATOMIC_SMART_PTR + // libc++ uses a non-standard messages_base #define BOOST_NO_STD_MESSAGES diff --git a/3rdParty/Boost/src/boost/config/stdlib/libstdcpp3.hpp b/3rdParty/Boost/src/boost/config/stdlib/libstdcpp3.hpp index c048b89..c56dff2 100644 --- a/3rdParty/Boost/src/boost/config/stdlib/libstdcpp3.hpp +++ b/3rdParty/Boost/src/boost/config/stdlib/libstdcpp3.hpp @@ -33,7 +33,9 @@ #ifdef __GLIBCXX__ // gcc 3.4 and greater: # if defined(_GLIBCXX_HAVE_GTHR_DEFAULT) \ - || defined(_GLIBCXX__PTHREADS) + || defined(_GLIBCXX__PTHREADS) \ + || defined(_GLIBCXX_HAS_GTHREADS) \ + || defined(_WIN32) // // If the std lib has thread support turned on, then turn it on in Boost // as well. We do this because some gcc-3.4 std lib headers define _REENTANT @@ -103,43 +105,61 @@ // C++0x headers in GCC 4.3.0 and later // #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 3) || !defined(__GXX_EXPERIMENTAL_CXX0X__) -# define BOOST_NO_0X_HDR_ARRAY -# define BOOST_NO_0X_HDR_RANDOM -# define BOOST_NO_0X_HDR_REGEX -# define BOOST_NO_0X_HDR_TUPLE -# define BOOST_NO_0X_HDR_TYPE_TRAITS -# define BOOST_NO_STD_UNORDERED // deprecated; see following -# define BOOST_NO_0X_HDR_UNORDERED_MAP -# define BOOST_NO_0X_HDR_UNORDERED_SET +# define BOOST_NO_CXX11_HDR_ARRAY +# define BOOST_NO_CXX11_HDR_REGEX +# define BOOST_NO_CXX11_HDR_TUPLE +# define BOOST_NO_CXX11_HDR_UNORDERED_MAP +# define BOOST_NO_CXX11_HDR_UNORDERED_SET +# define BOOST_NO_CXX11_HDR_FUNCTIONAL #endif // C++0x headers in GCC 4.4.0 and later // #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 4) || !defined(__GXX_EXPERIMENTAL_CXX0X__) -# define BOOST_NO_0X_HDR_CHRONO -# define BOOST_NO_0X_HDR_CONDITION_VARIABLE -# define BOOST_NO_0X_HDR_FORWARD_LIST -# define BOOST_NO_0X_HDR_INITIALIZER_LIST -# define BOOST_NO_0X_HDR_MUTEX -# define BOOST_NO_0X_HDR_RATIO -# define BOOST_NO_0X_HDR_SYSTEM_ERROR -# define BOOST_NO_0X_HDR_THREAD +# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE +# define BOOST_NO_CXX11_HDR_FORWARD_LIST +# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +# define BOOST_NO_CXX11_HDR_MUTEX +# define BOOST_NO_CXX11_HDR_RATIO +# define BOOST_NO_CXX11_HDR_SYSTEM_ERROR +# define BOOST_NO_CXX11_SMART_PTR +#else +# define BOOST_HAS_TR1_COMPLEX_INVERSE_TRIG +# define BOOST_HAS_TR1_COMPLEX_OVERLOADS +#endif + +#if (!defined(_GLIBCXX_HAS_GTHREADS) || !defined(_GLIBCXX_USE_C99_STDINT_TR1)) && (!defined(BOOST_NO_CXX11_HDR_CONDITION_VARIABLE) || !defined(BOOST_NO_CXX11_HDR_MUTEX)) +# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE +# define BOOST_NO_CXX11_HDR_MUTEX #endif // C++0x features in GCC 4.5.0 and later // #if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5) || !defined(__GXX_EXPERIMENTAL_CXX0X__) -# define BOOST_NO_NUMERIC_LIMITS_LOWEST +# define BOOST_NO_CXX11_NUMERIC_LIMITS +# define BOOST_NO_CXX11_HDR_FUTURE +# define BOOST_NO_CXX11_HDR_RANDOM +#endif + +// C++0x features in GCC 4.6.0 and later +// +#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 6) || !defined(__GXX_EXPERIMENTAL_CXX0X__) +# define BOOST_NO_CXX11_HDR_TYPEINDEX #endif -// C++0x headers not yet implemented +// C++0x features in GCC 4.7.0 and later +// +#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 7) || !defined(__GXX_EXPERIMENTAL_CXX0X__) +// Note that although <chrono> existed prior to 4.7, "stead_clock" is spelled "monotonic_clock" +// so 4.7.0 is the first truely conforming one. +# define BOOST_NO_CXX11_HDR_CHRONO +# define BOOST_NO_CXX11_ALLOCATOR +#endif +// C++0x headers not yet (fully!) implemented // -# define BOOST_NO_0X_HDR_CODECVT -# define BOOST_NO_0X_HDR_CONCEPTS -# define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS -# define BOOST_NO_0X_HDR_FUTURE -# define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS -# define BOOST_NO_0X_HDR_MEMORY_CONCEPTS -# define BOOST_NO_0X_HDR_TYPEINDEX +# define BOOST_NO_CXX11_HDR_THREAD +# define BOOST_NO_CXX11_HDR_TYPE_TRAITS +# define BOOST_NO_CXX11_HDR_CODECVT +# define BOOST_NO_CXX11_ATOMIC_SMART_PTR // --- end --- diff --git a/3rdParty/Boost/src/boost/config/stdlib/modena.hpp b/3rdParty/Boost/src/boost/config/stdlib/modena.hpp index 147060d..b483b6e 100644 --- a/3rdParty/Boost/src/boost/config/stdlib/modena.hpp +++ b/3rdParty/Boost/src/boost/config/stdlib/modena.hpp @@ -24,30 +24,29 @@ // C++0x headers not yet implemented // -# define BOOST_NO_0X_HDR_ARRAY -# define BOOST_NO_0X_HDR_CHRONO -# define BOOST_NO_0X_HDR_CODECVT -# define BOOST_NO_0X_HDR_CONCEPTS -# define BOOST_NO_0X_HDR_CONDITION_VARIABLE -# define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS -# define BOOST_NO_0X_HDR_FORWARD_LIST -# define BOOST_NO_0X_HDR_FUTURE -# define BOOST_NO_0X_HDR_INITIALIZER_LIST -# define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS -# define BOOST_NO_0X_HDR_MEMORY_CONCEPTS -# define BOOST_NO_0X_HDR_MUTEX -# define BOOST_NO_0X_HDR_RANDOM -# define BOOST_NO_0X_HDR_RATIO -# define BOOST_NO_0X_HDR_REGEX -# define BOOST_NO_0X_HDR_SYSTEM_ERROR -# define BOOST_NO_0X_HDR_THREAD -# define BOOST_NO_0X_HDR_TUPLE -# define BOOST_NO_0X_HDR_TYPE_TRAITS -# define BOOST_NO_0X_HDR_TYPEINDEX -# define BOOST_NO_STD_UNORDERED // deprecated; see following -# define BOOST_NO_0X_HDR_UNORDERED_MAP -# define BOOST_NO_0X_HDR_UNORDERED_SET -# define BOOST_NO_NUMERIC_LIMITS_LOWEST +# define BOOST_NO_CXX11_HDR_ARRAY +# define BOOST_NO_CXX11_HDR_CHRONO +# define BOOST_NO_CXX11_HDR_CODECVT +# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE +# define BOOST_NO_CXX11_HDR_FORWARD_LIST +# define BOOST_NO_CXX11_HDR_FUTURE +# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +# define BOOST_NO_CXX11_HDR_MUTEX +# define BOOST_NO_CXX11_HDR_RANDOM +# define BOOST_NO_CXX11_HDR_RATIO +# define BOOST_NO_CXX11_HDR_REGEX +# define BOOST_NO_CXX11_HDR_SYSTEM_ERROR +# define BOOST_NO_CXX11_HDR_THREAD +# define BOOST_NO_CXX11_HDR_TUPLE +# define BOOST_NO_CXX11_HDR_TYPE_TRAITS +# define BOOST_NO_CXX11_HDR_TYPEINDEX +# define BOOST_NO_CXX11_HDR_UNORDERED_MAP +# define BOOST_NO_CXX11_HDR_UNORDERED_SET +# define BOOST_NO_CXX11_NUMERIC_LIMITS +# define BOOST_NO_CXX11_ALLOCATOR +# define BOOST_NO_CXX11_ATOMIC_SMART_PTR +# define BOOST_NO_CXX11_SMART_PTR +# define BOOST_NO_CXX11_HDR_FUNCTIONAL #define BOOST_STDLIB "Modena C++ standard library" diff --git a/3rdParty/Boost/src/boost/config/stdlib/msl.hpp b/3rdParty/Boost/src/boost/config/stdlib/msl.hpp index 8185e35..4f9a2da 100644 --- a/3rdParty/Boost/src/boost/config/stdlib/msl.hpp +++ b/3rdParty/Boost/src/boost/config/stdlib/msl.hpp @@ -48,30 +48,29 @@ // C++0x headers not yet implemented // -# define BOOST_NO_0X_HDR_ARRAY -# define BOOST_NO_0X_HDR_CHRONO -# define BOOST_NO_0X_HDR_CODECVT -# define BOOST_NO_0X_HDR_CONCEPTS -# define BOOST_NO_0X_HDR_CONDITION_VARIABLE -# define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS -# define BOOST_NO_0X_HDR_FORWARD_LIST -# define BOOST_NO_0X_HDR_FUTURE -# define BOOST_NO_0X_HDR_INITIALIZER_LIST -# define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS -# define BOOST_NO_0X_HDR_MEMORY_CONCEPTS -# define BOOST_NO_0X_HDR_MUTEX -# define BOOST_NO_0X_HDR_RANDOM -# define BOOST_NO_0X_HDR_RATIO -# define BOOST_NO_0X_HDR_REGEX -# define BOOST_NO_0X_HDR_SYSTEM_ERROR -# define BOOST_NO_0X_HDR_THREAD -# define BOOST_NO_0X_HDR_TUPLE -# define BOOST_NO_0X_HDR_TYPE_TRAITS -# define BOOST_NO_0X_HDR_TYPEINDEX -# define BOOST_NO_STD_UNORDERED // deprecated; see following -# define BOOST_NO_0X_HDR_UNORDERED_MAP -# define BOOST_NO_0X_HDR_UNORDERED_SET -# define BOOST_NO_NUMERIC_LIMITS_LOWEST +# define BOOST_NO_CXX11_HDR_ARRAY +# define BOOST_NO_CXX11_HDR_CHRONO +# define BOOST_NO_CXX11_HDR_CODECVT +# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE +# define BOOST_NO_CXX11_HDR_FORWARD_LIST +# define BOOST_NO_CXX11_HDR_FUTURE +# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +# define BOOST_NO_CXX11_HDR_MUTEX +# define BOOST_NO_CXX11_HDR_RANDOM +# define BOOST_NO_CXX11_HDR_RATIO +# define BOOST_NO_CXX11_HDR_REGEX +# define BOOST_NO_CXX11_HDR_SYSTEM_ERROR +# define BOOST_NO_CXX11_HDR_THREAD +# define BOOST_NO_CXX11_HDR_TUPLE +# define BOOST_NO_CXX11_HDR_TYPE_TRAITS +# define BOOST_NO_CXX11_HDR_TYPEINDEX +# define BOOST_NO_CXX11_HDR_UNORDERED_MAP +# define BOOST_NO_CXX11_HDR_UNORDERED_SET +# define BOOST_NO_CXX11_NUMERIC_LIMITS +# define BOOST_NO_CXX11_ALLOCATOR +# define BOOST_NO_CXX11_ATOMIC_SMART_PTR +# define BOOST_NO_CXX11_SMART_PTR +# define BOOST_NO_CXX11_HDR_FUNCTIONAL #define BOOST_STDLIB "Metrowerks Standard Library version " BOOST_STRINGIZE(__MSL_CPP__) diff --git a/3rdParty/Boost/src/boost/config/stdlib/roguewave.hpp b/3rdParty/Boost/src/boost/config/stdlib/roguewave.hpp index b43623b..cb80f57 100644 --- a/3rdParty/Boost/src/boost/config/stdlib/roguewave.hpp +++ b/3rdParty/Boost/src/boost/config/stdlib/roguewave.hpp @@ -154,32 +154,33 @@ # endif #endif +#if _RWSTD_VER < 0x05000000 +# define BOOST_NO_CXX11_HDR_ARRAY +#endif +// type_traits header is incomplete: +# define BOOST_NO_CXX11_HDR_TYPE_TRAITS +// // C++0x headers not yet implemented // -#if _RWSTD_VER < 0x05000000 -# define BOOST_NO_0X_HDR_ARRAY -# define BOOST_NO_0X_HDR_TYPE_TRAITS -#endif -# define BOOST_NO_0X_HDR_CHRONO -# define BOOST_NO_0X_HDR_CODECVT -# define BOOST_NO_0X_HDR_CONCEPTS -# define BOOST_NO_0X_HDR_CONDITION_VARIABLE -# define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS -# define BOOST_NO_0X_HDR_FORWARD_LIST -# define BOOST_NO_0X_HDR_FUTURE -# define BOOST_NO_0X_HDR_INITIALIZER_LIST -# define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS -# define BOOST_NO_0X_HDR_MEMORY_CONCEPTS -# define BOOST_NO_0X_HDR_MUTEX -# define BOOST_NO_0X_HDR_RANDOM -# define BOOST_NO_0X_HDR_RATIO -# define BOOST_NO_0X_HDR_REGEX -# define BOOST_NO_0X_HDR_SYSTEM_ERROR -# define BOOST_NO_0X_HDR_THREAD -# define BOOST_NO_0X_HDR_TUPLE -# define BOOST_NO_0X_HDR_TYPEINDEX -# define BOOST_NO_STD_UNORDERED // deprecated; see following -# define BOOST_NO_0X_HDR_UNORDERED_MAP -# define BOOST_NO_0X_HDR_UNORDERED_SET -# define BOOST_NO_NUMERIC_LIMITS_LOWEST +# define BOOST_NO_CXX11_HDR_CHRONO +# define BOOST_NO_CXX11_HDR_CODECVT +# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE +# define BOOST_NO_CXX11_HDR_FORWARD_LIST +# define BOOST_NO_CXX11_HDR_FUTURE +# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +# define BOOST_NO_CXX11_HDR_MUTEX +# define BOOST_NO_CXX11_HDR_RANDOM +# define BOOST_NO_CXX11_HDR_RATIO +# define BOOST_NO_CXX11_HDR_REGEX +# define BOOST_NO_CXX11_HDR_SYSTEM_ERROR +# define BOOST_NO_CXX11_HDR_THREAD +# define BOOST_NO_CXX11_HDR_TUPLE +# define BOOST_NO_CXX11_HDR_TYPEINDEX +# define BOOST_NO_CXX11_HDR_UNORDERED_MAP +# define BOOST_NO_CXX11_HDR_UNORDERED_SET +# define BOOST_NO_CXX11_NUMERIC_LIMITS +# define BOOST_NO_CXX11_ALLOCATOR +# define BOOST_NO_CXX11_ATOMIC_SMART_PTR +# define BOOST_NO_CXX11_SMART_PTR +# define BOOST_NO_CXX11_HDR_FUNCTIONAL diff --git a/3rdParty/Boost/src/boost/config/stdlib/sgi.hpp b/3rdParty/Boost/src/boost/config/stdlib/sgi.hpp index 5731fe5..ae9b6ad 100644 --- a/3rdParty/Boost/src/boost/config/stdlib/sgi.hpp +++ b/3rdParty/Boost/src/boost/config/stdlib/sgi.hpp @@ -118,30 +118,29 @@ // C++0x headers not yet implemented // -# define BOOST_NO_0X_HDR_ARRAY -# define BOOST_NO_0X_HDR_CHRONO -# define BOOST_NO_0X_HDR_CODECVT -# define BOOST_NO_0X_HDR_CONCEPTS -# define BOOST_NO_0X_HDR_CONDITION_VARIABLE -# define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS -# define BOOST_NO_0X_HDR_FORWARD_LIST -# define BOOST_NO_0X_HDR_FUTURE -# define BOOST_NO_0X_HDR_INITIALIZER_LIST -# define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS -# define BOOST_NO_0X_HDR_MEMORY_CONCEPTS -# define BOOST_NO_0X_HDR_MUTEX -# define BOOST_NO_0X_HDR_RANDOM -# define BOOST_NO_0X_HDR_RATIO -# define BOOST_NO_0X_HDR_REGEX -# define BOOST_NO_0X_HDR_SYSTEM_ERROR -# define BOOST_NO_0X_HDR_THREAD -# define BOOST_NO_0X_HDR_TUPLE -# define BOOST_NO_0X_HDR_TYPE_TRAITS -# define BOOST_NO_0X_HDR_TYPEINDEX -# define BOOST_NO_STD_UNORDERED // deprecated; see following -# define BOOST_NO_0X_HDR_UNORDERED_MAP -# define BOOST_NO_0X_HDR_UNORDERED_SET -# define BOOST_NO_NUMERIC_LIMITS_LOWEST +# define BOOST_NO_CXX11_HDR_ARRAY +# define BOOST_NO_CXX11_HDR_CHRONO +# define BOOST_NO_CXX11_HDR_CODECVT +# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE +# define BOOST_NO_CXX11_HDR_FORWARD_LIST +# define BOOST_NO_CXX11_HDR_FUTURE +# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +# define BOOST_NO_CXX11_HDR_MUTEX +# define BOOST_NO_CXX11_HDR_RANDOM +# define BOOST_NO_CXX11_HDR_RATIO +# define BOOST_NO_CXX11_HDR_REGEX +# define BOOST_NO_CXX11_HDR_SYSTEM_ERROR +# define BOOST_NO_CXX11_HDR_THREAD +# define BOOST_NO_CXX11_HDR_TUPLE +# define BOOST_NO_CXX11_HDR_TYPE_TRAITS +# define BOOST_NO_CXX11_HDR_TYPEINDEX +# define BOOST_NO_CXX11_HDR_UNORDERED_MAP +# define BOOST_NO_CXX11_HDR_UNORDERED_SET +# define BOOST_NO_CXX11_NUMERIC_LIMITS +# define BOOST_NO_CXX11_ALLOCATOR +# define BOOST_NO_CXX11_ATOMIC_SMART_PTR +# define BOOST_NO_CXX11_SMART_PTR +# define BOOST_NO_CXX11_HDR_FUNCTIONAL #define BOOST_STDLIB "SGI standard library" diff --git a/3rdParty/Boost/src/boost/config/stdlib/stlport.hpp b/3rdParty/Boost/src/boost/config/stdlib/stlport.hpp index 85176a4..bcc30b9 100644 --- a/3rdParty/Boost/src/boost/config/stdlib/stlport.hpp +++ b/3rdParty/Boost/src/boost/config/stdlib/stlport.hpp @@ -71,10 +71,6 @@ # endif #endif -#if defined(_STLPORT_VERSION) && ((_STLPORT_VERSION < 0x500) || (_STLPORT_VERSION >= 0x520)) -# define BOOST_NO_STD_UNORDERED -#endif - #if defined(_STLPORT_VERSION) && (_STLPORT_VERSION >= 0x520) # define BOOST_HAS_TR1_UNORDERED_SET # define BOOST_HAS_TR1_UNORDERED_MAP @@ -212,30 +208,29 @@ namespace boost { using std::min; using std::max; } // C++0x headers not yet implemented // -# define BOOST_NO_0X_HDR_ARRAY -# define BOOST_NO_0X_HDR_CHRONO -# define BOOST_NO_0X_HDR_CODECVT -# define BOOST_NO_0X_HDR_CONCEPTS -# define BOOST_NO_0X_HDR_CONDITION_VARIABLE -# define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS -# define BOOST_NO_0X_HDR_FORWARD_LIST -# define BOOST_NO_0X_HDR_FUTURE -# define BOOST_NO_0X_HDR_INITIALIZER_LIST -# define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS -# define BOOST_NO_0X_HDR_MEMORY_CONCEPTS -# define BOOST_NO_0X_HDR_MUTEX -# define BOOST_NO_0X_HDR_RANDOM -# define BOOST_NO_0X_HDR_RATIO -# define BOOST_NO_0X_HDR_REGEX -# define BOOST_NO_0X_HDR_SYSTEM_ERROR -# define BOOST_NO_0X_HDR_THREAD -# define BOOST_NO_0X_HDR_TUPLE -# define BOOST_NO_0X_HDR_TYPE_TRAITS -# define BOOST_NO_0X_HDR_TYPEINDEX -# define BOOST_NO_STD_UNORDERED // deprecated; see following -# define BOOST_NO_0X_HDR_UNORDERED_MAP -# define BOOST_NO_0X_HDR_UNORDERED_SET -# define BOOST_NO_NUMERIC_LIMITS_LOWEST +# define BOOST_NO_CXX11_HDR_ARRAY +# define BOOST_NO_CXX11_HDR_CHRONO +# define BOOST_NO_CXX11_HDR_CODECVT +# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE +# define BOOST_NO_CXX11_HDR_FORWARD_LIST +# define BOOST_NO_CXX11_HDR_FUTURE +# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +# define BOOST_NO_CXX11_HDR_MUTEX +# define BOOST_NO_CXX11_HDR_RANDOM +# define BOOST_NO_CXX11_HDR_RATIO +# define BOOST_NO_CXX11_HDR_REGEX +# define BOOST_NO_CXX11_HDR_SYSTEM_ERROR +# define BOOST_NO_CXX11_HDR_THREAD +# define BOOST_NO_CXX11_HDR_TUPLE +# define BOOST_NO_CXX11_HDR_TYPE_TRAITS +# define BOOST_NO_CXX11_HDR_TYPEINDEX +# define BOOST_NO_CXX11_HDR_UNORDERED_MAP +# define BOOST_NO_CXX11_HDR_UNORDERED_SET +# define BOOST_NO_CXX11_NUMERIC_LIMITS +# define BOOST_NO_CXX11_ALLOCATOR +# define BOOST_NO_CXX11_ATOMIC_SMART_PTR +# define BOOST_NO_CXX11_SMART_PTR +# define BOOST_NO_CXX11_HDR_FUNCTIONAL #define BOOST_STDLIB "STLPort standard library version " BOOST_STRINGIZE(__SGI_STL_PORT) diff --git a/3rdParty/Boost/src/boost/config/stdlib/vacpp.hpp b/3rdParty/Boost/src/boost/config/stdlib/vacpp.hpp index 3fcf6e0..9d16946 100644 --- a/3rdParty/Boost/src/boost/config/stdlib/vacpp.hpp +++ b/3rdParty/Boost/src/boost/config/stdlib/vacpp.hpp @@ -24,30 +24,29 @@ // C++0x headers not yet implemented // -# define BOOST_NO_0X_HDR_ARRAY -# define BOOST_NO_0X_HDR_CHRONO -# define BOOST_NO_0X_HDR_CODECVT -# define BOOST_NO_0X_HDR_CONCEPTS -# define BOOST_NO_0X_HDR_CONDITION_VARIABLE -# define BOOST_NO_0X_HDR_CONTAINER_CONCEPTS -# define BOOST_NO_0X_HDR_FORWARD_LIST -# define BOOST_NO_0X_HDR_FUTURE -# define BOOST_NO_0X_HDR_INITIALIZER_LIST -# define BOOST_NO_0X_HDR_ITERATOR_CONCEPTS -# define BOOST_NO_0X_HDR_MEMORY_CONCEPTS -# define BOOST_NO_0X_HDR_MUTEX -# define BOOST_NO_0X_HDR_RANDOM -# define BOOST_NO_0X_HDR_RATIO -# define BOOST_NO_0X_HDR_REGEX -# define BOOST_NO_0X_HDR_SYSTEM_ERROR -# define BOOST_NO_0X_HDR_THREAD -# define BOOST_NO_0X_HDR_TUPLE -# define BOOST_NO_0X_HDR_TYPE_TRAITS -# define BOOST_NO_0X_HDR_TYPEINDEX -# define BOOST_NO_STD_UNORDERED // deprecated; see following -# define BOOST_NO_0X_HDR_UNORDERED_MAP -# define BOOST_NO_0X_HDR_UNORDERED_SET -# define BOOST_NO_NUMERIC_LIMITS_LOWEST +# define BOOST_NO_CXX11_HDR_ARRAY +# define BOOST_NO_CXX11_HDR_CHRONO +# define BOOST_NO_CXX11_HDR_CODECVT +# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE +# define BOOST_NO_CXX11_HDR_FORWARD_LIST +# define BOOST_NO_CXX11_HDR_FUTURE +# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST +# define BOOST_NO_CXX11_HDR_MUTEX +# define BOOST_NO_CXX11_HDR_RANDOM +# define BOOST_NO_CXX11_HDR_RATIO +# define BOOST_NO_CXX11_HDR_REGEX +# define BOOST_NO_CXX11_HDR_SYSTEM_ERROR +# define BOOST_NO_CXX11_HDR_THREAD +# define BOOST_NO_CXX11_HDR_TUPLE +# define BOOST_NO_CXX11_HDR_TYPE_TRAITS +# define BOOST_NO_CXX11_HDR_TYPEINDEX +# define BOOST_NO_CXX11_HDR_UNORDERED_MAP +# define BOOST_NO_CXX11_HDR_UNORDERED_SET +# define BOOST_NO_CXX11_NUMERIC_LIMITS +# define BOOST_NO_CXX11_ALLOCATOR +# define BOOST_NO_CXX11_ATOMIC_SMART_PTR +# define BOOST_NO_CXX11_SMART_PTR +# define BOOST_NO_CXX11_HDR_FUNCTIONAL #define BOOST_STDLIB "Visual Age default standard library" diff --git a/3rdParty/Boost/src/boost/config/suffix.hpp b/3rdParty/Boost/src/boost/config/suffix.hpp index 9cce6fd..2d24813 100644 --- a/3rdParty/Boost/src/boost/config/suffix.hpp +++ b/3rdParty/Boost/src/boost/config/suffix.hpp @@ -104,13 +104,6 @@ #endif // -// Normalize BOOST_NO_STATIC_ASSERT and (depricated) BOOST_HAS_STATIC_ASSERT: -// -#if !defined(BOOST_NO_STATIC_ASSERT) && !defined(BOOST_HAS_STATIC_ASSERT) -# define BOOST_HAS_STATIC_ASSERT -#endif - -// // if there is no __int64 then there is no specialisation // for numeric_limits<__int64> either: // @@ -334,28 +327,6 @@ # define BOOST_HASH_MAP_HEADER <hash_map> #endif -// -// Set BOOST_NO_INITIALIZER_LISTS if there is no library support. -// - -#if defined(BOOST_NO_0X_HDR_INITIALIZER_LIST) && !defined(BOOST_NO_INITIALIZER_LISTS) -# define BOOST_NO_INITIALIZER_LISTS -#endif - -// -// Set BOOST_HAS_RVALUE_REFS when BOOST_NO_RVALUE_REFERENCES is not defined -// -#if !defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_HAS_RVALUE_REFS) -#define BOOST_HAS_RVALUE_REFS -#endif - -// -// Set BOOST_HAS_VARIADIC_TMPL when BOOST_NO_VARIADIC_TEMPLATES is not defined -// -#if !defined(BOOST_NO_VARIADIC_TEMPLATES) && !defined(BOOST_HAS_VARIADIC_TMPL) -#define BOOST_HAS_VARIADIC_TMPL -#endif - // BOOST_HAS_ABI_HEADERS // This macro gets set if we have headers that fix the ABI, // and prevent ODR violations when linking to external libraries: @@ -376,7 +347,7 @@ // works as expected with standard conforming compilers. The resulting // double inclusion of <cstddef> is harmless. -# ifdef BOOST_NO_STDC_NAMESPACE +# if defined(BOOST_NO_STDC_NAMESPACE) && defined(__cplusplus) # include <cstddef> namespace std { using ::ptrdiff_t; using ::size_t; } # endif @@ -395,7 +366,7 @@ // BOOST_NO_STD_MIN_MAX workaround -----------------------------------------// -# ifdef BOOST_NO_STD_MIN_MAX +# if defined(BOOST_NO_STD_MIN_MAX) && defined(__cplusplus) namespace std { template <class _Tp> @@ -506,7 +477,7 @@ namespace std { // but it's use may generate either warnings (with -ansi), or errors // (with -pedantic -ansi) unless it's use is prefixed by __extension__ // -#if defined(BOOST_HAS_LONG_LONG) +#if defined(BOOST_HAS_LONG_LONG) && defined(__cplusplus) namespace boost{ # ifdef __GNUC__ __extension__ typedef long long long_long_type; @@ -560,7 +531,7 @@ namespace boost{ // -#if defined BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS +#if defined(BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS) && defined(__cplusplus) # include "boost/type.hpp" # include "boost/non_type.hpp" @@ -598,7 +569,7 @@ namespace boost{ // When BOOST_NO_STD_TYPEINFO is defined, we can just import // the global definition into std namespace: -#ifdef BOOST_NO_STD_TYPEINFO +#if defined(BOOST_NO_STD_TYPEINFO) && defined(__cplusplus) #include <typeinfo> namespace std{ using ::type_info; } #endif @@ -651,6 +622,260 @@ namespace std{ using ::type_info; } # define BOOST_GPU_ENABLED # endif +// BOOST_FORCEINLINE ---------------------------------------------// +// Macro to use in place of 'inline' to force a function to be inline +#if !defined(BOOST_FORCEINLINE) +# if defined(_MSC_VER) +# define BOOST_FORCEINLINE __forceinline +# elif defined(__GNUC__) && __GNUC__ > 3 +# define BOOST_FORCEINLINE inline __attribute__ ((always_inline)) +# else +# define BOOST_FORCEINLINE inline +# endif +#endif + +// +// Set BOOST_NO_DECLTYPE_N3276 when BOOST_NO_DECLTYPE is defined +// +#if defined(BOOST_NO_CXX11_DECLTYPE) && !defined(BOOST_NO_CXX11_DECLTYPE_N3276) +#define BOOST_NO_CXX11_DECLTYPE_N3276 BOOST_NO_CXX11_DECLTYPE +#endif + +// -------------------- Deprecated macros for 1.50 --------------------------- +// These will go away in a future release + +// Use BOOST_NO_CXX11_HDR_UNORDERED_SET or BOOST_NO_CXX11_HDR_UNORDERED_MAP +// instead of BOOST_NO_STD_UNORDERED +#if defined(BOOST_NO_CXX11_HDR_UNORDERED_MAP) || defined (BOOST_NO_CXX11_HDR_UNORDERED_SET) +# ifndef BOOST_NO_STD_UNORDERED +# define BOOST_NO_STD_UNORDERED +# endif +#endif + +// Use BOOST_NO_CXX11_HDR_INITIALIZER_LIST instead of BOOST_NO_INITIALIZER_LISTS +#if defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) && !defined(BOOST_NO_INITIALIZER_LISTS) +# define BOOST_NO_INITIALIZER_LISTS +#endif + +// Use BOOST_NO_CXX11_HDR_ARRAY instead of BOOST_NO_0X_HDR_ARRAY +#if defined(BOOST_NO_CXX11_HDR_ARRAY) && !defined(BOOST_NO_BOOST_NO_0X_HDR_ARRAY) +# define BOOST_NO_0X_HDR_ARRAY +#endif +// Use BOOST_NO_CXX11_HDR_CHRONO instead of BOOST_NO_0X_HDR_CHRONO +#if defined(BOOST_NO_CXX11_HDR_CHRONO) && !defined(BOOST_NO_0X_HDR_CHRONO) +# define BOOST_NO_0X_HDR_CHRONO +#endif +// Use BOOST_NO_CXX11_HDR_CODECVT instead of BOOST_NO_0X_HDR_CODECVT +#if defined(BOOST_NO_CXX11_HDR_CODECVT) && !defined(BOOST_NO_0X_HDR_CODECVT) +# define BOOST_NO_0X_HDR_CODECVT +#endif +// Use BOOST_NO_CXX11_HDR_CONDITION_VARIABLE instead of BOOST_NO_0X_HDR_CONDITION_VARIABLE +#if defined(BOOST_NO_CXX11_HDR_CONDITION_VARIABLE) && !defined(BOOST_NO_0X_HDR_CONDITION_VARIABLE) +# define BOOST_NO_0X_HDR_CONDITION_VARIABLE +#endif +// Use BOOST_NO_CXX11_HDR_FORWARD_LIST instead of BOOST_NO_0X_HDR_FORWARD_LIST +#if defined(BOOST_NO_CXX11_HDR_FORWARD_LIST) && !defined(BOOST_NO_0X_HDR_FORWARD_LIST) +# define BOOST_NO_0X_HDR_FORWARD_LIST +#endif +// Use BOOST_NO_CXX11_HDR_FUTURE instead of BOOST_NO_0X_HDR_FUTURE +#if defined(BOOST_NO_CXX11_HDR_FUTURE) && !defined(BOOST_NO_0X_HDR_FUTURE) +# define BOOST_NO_0X_HDR_FUTURE +#endif + +// Use BOOST_NO_CXX11_HDR_INITIALIZER_LIST +// instead of BOOST_NO_0X_HDR_INITIALIZER_LIST or BOOST_NO_INITIALIZER_LISTS +#ifdef BOOST_NO_CXX11_HDR_INITIALIZER_LIST +# ifndef BOOST_NO_0X_HDR_INITIALIZER_LIST +# define BOOST_NO_0X_HDR_INITIALIZER_LIST +# endif +# ifndef BOOST_NO_INITIALIZER_LISTS +# define BOOST_NO_INITIALIZER_LISTS +# endif +#endif + +// Use BOOST_NO_CXX11_HDR_MUTEX instead of BOOST_NO_0X_HDR_MUTEX +#if defined(BOOST_NO_CXX11_HDR_MUTEX) && !defined(BOOST_NO_0X_HDR_MUTEX) +# define BOOST_NO_0X_HDR_MUTEX +#endif +// Use BOOST_NO_CXX11_HDR_RANDOM instead of BOOST_NO_0X_HDR_RANDOM +#if defined(BOOST_NO_CXX11_HDR_RANDOM) && !defined(BOOST_NO_0X_HDR_RANDOM) +# define BOOST_NO_0X_HDR_RANDOM +#endif +// Use BOOST_NO_CXX11_HDR_RATIO instead of BOOST_NO_0X_HDR_RATIO +#if defined(BOOST_NO_CXX11_HDR_RATIO) && !defined(BOOST_NO_0X_HDR_RATIO) +# define BOOST_NO_0X_HDR_RATIO +#endif +// Use BOOST_NO_CXX11_HDR_REGEX instead of BOOST_NO_0X_HDR_REGEX +#if defined(BOOST_NO_CXX11_HDR_REGEX) && !defined(BOOST_NO_0X_HDR_REGEX) +# define BOOST_NO_0X_HDR_REGEX +#endif +// Use BOOST_NO_CXX11_HDR_SYSTEM_ERROR instead of BOOST_NO_0X_HDR_SYSTEM_ERROR +#if defined(BOOST_NO_CXX11_HDR_SYSTEM_ERROR) && !defined(BOOST_NO_0X_HDR_SYSTEM_ERROR) +# define BOOST_NO_0X_HDR_SYSTEM_ERROR +#endif +// Use BOOST_NO_CXX11_HDR_THREAD instead of BOOST_NO_0X_HDR_THREAD +#if defined(BOOST_NO_CXX11_HDR_THREAD) && !defined(BOOST_NO_0X_HDR_THREAD) +# define BOOST_NO_0X_HDR_THREAD +#endif +// Use BOOST_NO_CXX11_HDR_TUPLE instead of BOOST_NO_0X_HDR_TUPLE +#if defined(BOOST_NO_CXX11_HDR_TUPLE) && !defined(BOOST_NO_0X_HDR_TUPLE) +# define BOOST_NO_0X_HDR_TUPLE +#endif +// Use BOOST_NO_CXX11_HDR_TYPE_TRAITS instead of BOOST_NO_0X_HDR_TYPE_TRAITS +#if defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS) && !defined(BOOST_NO_0X_HDR_TYPE_TRAITS) +# define BOOST_NO_0X_HDR_TYPE_TRAITS +#endif +// Use BOOST_NO_CXX11_HDR_TYPEINDEX instead of BOOST_NO_0X_HDR_TYPEINDEX +#if defined(BOOST_NO_CXX11_HDR_TYPEINDEX) && !defined(BOOST_NO_0X_HDR_TYPEINDEX) +# define BOOST_NO_0X_HDR_TYPEINDEX +#endif +// Use BOOST_NO_CXX11_HDR_UNORDERED_MAP instead of BOOST_NO_0X_HDR_UNORDERED_MAP +#if defined(BOOST_NO_CXX11_HDR_UNORDERED_MAP) && !defined(BOOST_NO_0X_HDR_UNORDERED_MAP) +# define BOOST_NO_0X_HDR_UNORDERED_MAP +#endif +// Use BOOST_NO_CXX11_HDR_UNORDERED_SET instead of BOOST_NO_0X_HDR_UNORDERED_SET +#if defined(BOOST_NO_CXX11_HDR_UNORDERED_SET) && !defined(BOOST_NO_0X_HDR_UNORDERED_SET) +# define BOOST_NO_0X_HDR_UNORDERED_SET +#endif + +// ------------------ End of deprecated macros for 1.50 --------------------------- + +// -------------------- Deprecated macros for 1.51 --------------------------- +// These will go away in a future release + +// Use BOOST_NO_CXX11_AUTO_DECLARATIONS instead of BOOST_NO_AUTO_DECLARATIONS +#if defined(BOOST_NO_CXX11_AUTO_DECLARATIONS) && !defined(BOOST_NO_AUTO_DECLARATIONS) +# define BOOST_NO_AUTO_DECLARATIONS +#endif +// Use BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS instead of BOOST_NO_AUTO_MULTIDECLARATIONS +#if defined(BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS) && !defined(BOOST_NO_AUTO_MULTIDECLARATIONS) +# define BOOST_NO_AUTO_MULTIDECLARATIONS +#endif +// Use BOOST_NO_CXX11_CHAR16_T instead of BOOST_NO_CHAR16_T +#if defined(BOOST_NO_CXX11_CHAR16_T) && !defined(BOOST_NO_CHAR16_T) +# define BOOST_NO_CHAR16_T +#endif +// Use BOOST_NO_CXX11_CHAR32_T instead of BOOST_NO_CHAR32_T +#if defined(BOOST_NO_CXX11_CHAR32_T) && !defined(BOOST_NO_CHAR32_T) +# define BOOST_NO_CHAR32_T +#endif +// Use BOOST_NO_CXX11_TEMPLATE_ALIASES instead of BOOST_NO_TEMPLATE_ALIASES +#if defined(BOOST_NO_CXX11_TEMPLATE_ALIASES) && !defined(BOOST_NO_TEMPLATE_ALIASES) +# define BOOST_NO_TEMPLATE_ALIASES +#endif +// Use BOOST_NO_CXX11_CONSTEXPR instead of BOOST_NO_CONSTEXPR +#if defined(BOOST_NO_CXX11_CONSTEXPR) && !defined(BOOST_NO_CONSTEXPR) +# define BOOST_NO_CONSTEXPR +#endif +// Use BOOST_NO_CXX11_DECLTYPE_N3276 instead of BOOST_NO_DECLTYPE_N3276 +#if defined(BOOST_NO_CXX11_DECLTYPE_N3276) && !defined(BOOST_NO_DECLTYPE_N3276) +# define BOOST_NO_DECLTYPE_N3276 +#endif +// Use BOOST_NO_CXX11_DECLTYPE instead of BOOST_NO_DECLTYPE +#if defined(BOOST_NO_CXX11_DECLTYPE) && !defined(BOOST_NO_DECLTYPE) +# define BOOST_NO_DECLTYPE +#endif +// Use BOOST_NO_CXX11_DEFAULTED_FUNCTIONS instead of BOOST_NO_DEFAULTED_FUNCTIONS +#if defined(BOOST_NO_CXX11_DEFAULTED_FUNCTIONS) && !defined(BOOST_NO_DEFAULTED_FUNCTIONS) +# define BOOST_NO_DEFAULTED_FUNCTIONS +#endif +// Use BOOST_NO_CXX11_DELETED_FUNCTIONS instead of BOOST_NO_DELETED_FUNCTIONS +#if defined(BOOST_NO_CXX11_DELETED_FUNCTIONS) && !defined(BOOST_NO_DELETED_FUNCTIONS) +# define BOOST_NO_DELETED_FUNCTIONS +#endif +// Use BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS instead of BOOST_NO_EXPLICIT_CONVERSION_OPERATORS +#if defined(BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS) && !defined(BOOST_NO_EXPLICIT_CONVERSION_OPERATORS) +# define BOOST_NO_EXPLICIT_CONVERSION_OPERATORS +#endif +// Use BOOST_NO_CXX11_EXTERN_TEMPLATE instead of BOOST_NO_EXTERN_TEMPLATE +#if defined(BOOST_NO_CXX11_EXTERN_TEMPLATE) && !defined(BOOST_NO_EXTERN_TEMPLATE) +# define BOOST_NO_EXTERN_TEMPLATE +#endif +// Use BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS instead of BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS +#if defined(BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS) && !defined(BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS) +# define BOOST_NO_FUNCTION_TEMPLATE_DEFAULT_ARGS +#endif +// Use BOOST_NO_CXX11_LAMBDAS instead of BOOST_NO_LAMBDAS +#if defined(BOOST_NO_CXX11_LAMBDAS) && !defined(BOOST_NO_LAMBDAS) +# define BOOST_NO_LAMBDAS +#endif +// Use BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS instead of BOOST_NO_LOCAL_CLASS_TEMPLATE_PARAMETERS +#if defined(BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS) && !defined(BOOST_NO_LOCAL_CLASS_TEMPLATE_PARAMETERS) +# define BOOST_NO_LOCAL_CLASS_TEMPLATE_PARAMETERS +#endif +// Use BOOST_NO_CXX11_NOEXCEPT instead of BOOST_NO_NOEXCEPT +#if defined(BOOST_NO_CXX11_NOEXCEPT) && !defined(BOOST_NO_NOEXCEPT) +# define BOOST_NO_NOEXCEPT +#endif +// Use BOOST_NO_CXX11_NULLPTR instead of BOOST_NO_NULLPTR +#if defined(BOOST_NO_CXX11_NULLPTR) && !defined(BOOST_NO_NULLPTR) +# define BOOST_NO_NULLPTR +#endif +// Use BOOST_NO_CXX11_RAW_LITERALS instead of BOOST_NO_RAW_LITERALS +#if defined(BOOST_NO_CXX11_RAW_LITERALS) && !defined(BOOST_NO_RAW_LITERALS) +# define BOOST_NO_RAW_LITERALS +#endif +// Use BOOST_NO_CXX11_RVALUE_REFERENCES instead of BOOST_NO_RVALUE_REFERENCES +#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_RVALUE_REFERENCES) +# define BOOST_NO_RVALUE_REFERENCES +#endif +// Use BOOST_NO_CXX11_SCOPED_ENUMS instead of BOOST_NO_SCOPED_ENUMS +#if defined(BOOST_NO_CXX11_SCOPED_ENUMS) && !defined(BOOST_NO_SCOPED_ENUMS) +# define BOOST_NO_SCOPED_ENUMS +#endif +// Use BOOST_NO_CXX11_STATIC_ASSERT instead of BOOST_NO_STATIC_ASSERT +#if defined(BOOST_NO_CXX11_STATIC_ASSERT) && !defined(BOOST_NO_STATIC_ASSERT) +# define BOOST_NO_STATIC_ASSERT +#endif +// Use BOOST_NO_CXX11_STD_UNORDERD instead of BOOST_NO_STD_UNORDERD +#if defined(BOOST_NO_CXX11_STD_UNORDERD) && !defined(BOOST_NO_STD_UNORDERD) +# define BOOST_NO_STD_UNORDERD +#endif +// Use BOOST_NO_CXX11_UNICODE_LITERALS instead of BOOST_NO_UNICODE_LITERALS +#if defined(BOOST_NO_CXX11_UNICODE_LITERALS) && !defined(BOOST_NO_UNICODE_LITERALS) +# define BOOST_NO_UNICODE_LITERALS +#endif +// Use BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX instead of BOOST_NO_UNIFIED_INITIALIZATION_SYNTAX +#if defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX) && !defined(BOOST_NO_UNIFIED_INITIALIZATION_SYNTAX) +# define BOOST_NO_UNIFIED_INITIALIZATION_SYNTAX +#endif +// Use BOOST_NO_CXX11_VARIADIC_TEMPLATES instead of BOOST_NO_VARIADIC_TEMPLATES +#if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_NO_VARIADIC_TEMPLATES) +# define BOOST_NO_VARIADIC_TEMPLATES +#endif +// Use BOOST_NO_CXX11_VARIADIC_MACROS instead of BOOST_NO_VARIADIC_MACROS +#if defined(BOOST_NO_CXX11_VARIADIC_MACROS) && !defined(BOOST_NO_VARIADIC_MACROS) +# define BOOST_NO_VARIADIC_MACROS +#endif +// Use BOOST_NO_CXX11_NUMERIC_LIMITS instead of BOOST_NO_NUMERIC_LIMITS_LOWEST +#if defined(BOOST_NO_CXX11_NUMERIC_LIMITS) && !defined(BOOST_NO_NUMERIC_LIMITS_LOWEST) +# define BOOST_NO_NUMERIC_LIMITS_LOWEST +#endif +// ------------------ End of deprecated macros for 1.51 --------------------------- + + + +// +// Helper macros BOOST_NOEXCEPT, BOOST_NOEXCEPT_IF, BOOST_NOEXCEPT_EXPR +// These aid the transition to C++11 while still supporting C++03 compilers +// +#ifdef BOOST_NO_NOEXCEPT +# define BOOST_NOEXCEPT +# define BOOST_NOEXCEPT_IF(Predicate) +# define BOOST_NOEXCEPT_EXPR(Expression) false +#else +# define BOOST_NOEXCEPT noexcept +# define BOOST_NOEXCEPT_IF(Predicate) noexcept((Predicate)) +# define BOOST_NOEXCEPT_EXPR(Expression) noexcept((Expression)) +#endif + +// +// Normalize BOOST_NO_STATIC_ASSERT and (depricated) BOOST_HAS_STATIC_ASSERT: +// +#if !defined(BOOST_NO_STATIC_ASSERT) && !defined(BOOST_HAS_STATIC_ASSERT) +# define BOOST_HAS_STATIC_ASSERT +#endif + // // constexpr workarounds // @@ -664,5 +889,19 @@ namespace std{ using ::type_info; } #define BOOST_STATIC_CONSTEXPR static BOOST_CONSTEXPR_OR_CONST +// +// Set BOOST_HAS_RVALUE_REFS when BOOST_NO_RVALUE_REFERENCES is not defined +// +#if !defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_HAS_RVALUE_REFS) +#define BOOST_HAS_RVALUE_REFS #endif +// +// Set BOOST_HAS_VARIADIC_TMPL when BOOST_NO_VARIADIC_TEMPLATES is not defined +// +#if !defined(BOOST_NO_VARIADIC_TEMPLATES) && !defined(BOOST_HAS_VARIADIC_TMPL) +#define BOOST_HAS_VARIADIC_TMPL +#endif + + +#endif diff --git a/3rdParty/Boost/src/boost/config/warning_disable.hpp b/3rdParty/Boost/src/boost/config/warning_disable.hpp index 26ff132..fea8e82 100644 --- a/3rdParty/Boost/src/boost/config/warning_disable.hpp +++ b/3rdParty/Boost/src/boost/config/warning_disable.hpp @@ -23,7 +23,7 @@ // Note that THIS HEADER MUST NOT INCLUDE ANY OTHER HEADERS: // not even std library ones! Doing so may turn the warning // off too late to be of any use. For example the VC++ C4996 -// warning can be omitted from <iosfwd> if that header is included +// warning can be emitted from <iosfwd> if that header is included // before or by this one :-( // diff --git a/3rdParty/Boost/src/boost/container/allocator_traits.hpp b/3rdParty/Boost/src/boost/container/allocator_traits.hpp new file mode 100644 index 0000000..11d948b --- /dev/null +++ b/3rdParty/Boost/src/boost/container/allocator_traits.hpp @@ -0,0 +1,385 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Pablo Halpern 2009. 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) +// +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2011-2012. 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) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_ALLOCATOR_ALLOCATOR_TRAITS_HPP +#define BOOST_CONTAINER_ALLOCATOR_ALLOCATOR_TRAITS_HPP + +#if (defined _MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include <boost/container/detail/config_begin.hpp> +#include <boost/container/detail/workaround.hpp> +#include <boost/intrusive/pointer_traits.hpp> +#include <boost/intrusive/detail/memory_util.hpp> +#include <boost/container/detail/memory_util.hpp> +#include <boost/type_traits/integral_constant.hpp> +#include <boost/container/detail/mpl.hpp> +#include <boost/move/move.hpp> +#include <limits> //numeric_limits<>::max() +#include <new> //placement new +#include <memory> //std::allocator +#include <boost/container/detail/preprocessor.hpp> + +///@cond + +namespace boost { +namespace container { +namespace container_detail { + +//workaround needed for C++03 compilers with no construct() +//supporting rvalue references +template<class A> +struct is_std_allocator +{ static const bool value = false; }; + +template<class T> +struct is_std_allocator< std::allocator<T> > +{ static const bool value = true; }; + +} //namespace container_detail { + +///@endcond + +//! The class template allocator_traits supplies a uniform interface to all allocator types. +//! This class is a C++03-compatible implementation of std::allocator_traits +template <typename Alloc> +struct allocator_traits +{ + //allocator_type + typedef Alloc allocator_type; + //value_type + typedef typename Alloc::value_type value_type; + + #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + //! Alloc::pointer if such a type exists; otherwise, value_type* + //! + typedef unspecified pointer; + //! Alloc::const_pointer if such a type exists ; otherwise, pointer_traits<pointer>::rebind<const + //! + typedef see_documentation const_pointer; + //! Non-standard extension + //! Alloc::reference if such a type exists; otherwise, value_type& + typedef see_documentation reference; + //! Non-standard extension + //! Alloc::const_reference if such a type exists ; otherwise, const value_type& + typedef see_documentation const_reference; + //! Alloc::void_pointer if such a type exists ; otherwise, pointer_traits<pointer>::rebind<void>. + //! + typedef see_documentation void_pointer; + //! Alloc::const_void_pointer if such a type exists ; otherwis e, pointer_traits<pointer>::rebind<const + //! + typedef see_documentation const_void_pointer; + //! Alloc::difference_type if such a type exists ; otherwise, pointer_traits<pointer>::difference_type. + //! + typedef see_documentation difference_type; + //! Alloc::size_type if such a type exists ; otherwise, make_unsigned<difference_type>::type + //! + typedef see_documentation size_type; + //! Alloc::propagate_on_container_copy_assignment if such a type exists, otherwise an integral_constant + //! type with internal constant static member `value` == false. + typedef see_documentation propagate_on_container_copy_assignment; + //! Alloc::propagate_on_container_move_assignment if such a type exists, otherwise an integral_constant + //! type with internal constant static member `value` == false. + typedef see_documentation propagate_on_container_move_assignment; + //! Alloc::propagate_on_container_swap if such a type exists, otherwise an integral_constant + //! type with internal constant static member `value` == false. + typedef see_documentation propagate_on_container_swap; + //! Defines an allocator: Alloc::rebind<T>::other if such a type exists; otherwise, Alloc<T, Args> + //! if Alloc is a class template instantiation of the form Alloc<U, Args>, where Args is zero or + //! more type arguments ; otherwise, the instantiation of rebind_alloc is ill-formed. + //! + //! In C++03 compilers `rebind_alloc` is a struct derived from an allocator + //! deduced by previously detailed rules. + template <class T> using rebind_alloc = see_documentation; + + //! In C++03 compilers `rebind_traits` is a struct derived from + //! `allocator_traits<OtherAlloc>`, where `OtherAlloc` is + //! the allocator deduced by rules explained in `rebind_alloc`. + template <class T> using rebind_traits = allocator_traits<rebind_alloc<T> >; + + //! Non-standard extension: Portable allocator rebind for C++03 and C++11 compilers. + //! `type` is an allocator related to Alloc deduced deduced by rules explained in `rebind_alloc`. + template <class T> + struct portable_rebind_alloc + { typedef see_documentation type; }; + #else + //pointer + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc, + pointer, value_type*) + pointer; + //const_pointer + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_EVAL_DEFAULT(boost::container::container_detail::, Alloc, + const_pointer, typename boost::intrusive::pointer_traits<pointer>::template + rebind_pointer<const value_type>) + const_pointer; + //reference + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc, + reference, typename container_detail::unvoid<value_type>::type&) + reference; + //const_reference + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc, + const_reference, const typename container_detail::unvoid<value_type>::type&) + const_reference; + //void_pointer + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_EVAL_DEFAULT(boost::container::container_detail::, Alloc, + void_pointer, typename boost::intrusive::pointer_traits<pointer>::template + rebind_pointer<void>) + void_pointer; + //const_void_pointer + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_EVAL_DEFAULT(boost::container::container_detail::, Alloc, + const_void_pointer, typename boost::intrusive::pointer_traits<pointer>::template + rebind_pointer<const void>) + const_void_pointer; + //difference_type + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc, + difference_type, std::ptrdiff_t) + difference_type; + //size_type + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc, + size_type, std::size_t) + size_type; + //propagate_on_container_copy_assignment + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc, + propagate_on_container_copy_assignment, boost::false_type) + propagate_on_container_copy_assignment; + //propagate_on_container_move_assignment + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc, + propagate_on_container_move_assignment, boost::false_type) + propagate_on_container_move_assignment; + //propagate_on_container_swap + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(boost::container::container_detail::, Alloc, + propagate_on_container_swap, boost::false_type) + propagate_on_container_swap; + + #if !defined(BOOST_NO_TEMPLATE_ALIASES) + //C++11 + template <typename T> using rebind_alloc = typename boost::intrusive::detail::type_rebinder<Alloc, T>::type; + template <typename T> using rebind_traits = allocator_traits< rebind_alloc<T> >; + #else // #if !defined(BOOST_NO_TEMPLATE_ALIASES) + //Some workaround for C++03 or C++11 compilers with no template aliases + template <typename T> + struct rebind_alloc : boost::intrusive::detail::type_rebinder<Alloc,T>::type + { + typedef typename boost::intrusive::detail::type_rebinder<Alloc,T>::type Base; + #if !defined(BOOST_NO_VARIADIC_TEMPLATES) + template <typename... Args> + rebind_alloc(BOOST_FWD_REF(Args)... args) + : Base(boost::forward<Args>(args)...) + {} + #else // #if !defined(BOOST_NO_VARIADIC_TEMPLATES) + #define BOOST_PP_LOCAL_MACRO(n) \ + BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \ + rebind_alloc(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \ + : Base(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)) \ + {} \ + // + #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS) + #include BOOST_PP_LOCAL_ITERATE() + #endif // #if !defined(BOOST_NO_VARIADIC_TEMPLATES) + }; + + template <typename T> + struct rebind_traits + : allocator_traits<typename boost::intrusive::detail::type_rebinder<Alloc, T>::type> + {}; + #endif // #if !defined(BOOST_NO_TEMPLATE_ALIASES) + template <class T> + struct portable_rebind_alloc + { typedef typename boost::intrusive::detail::type_rebinder<Alloc, T>::type type; }; + #endif //BOOST_CONTAINER_DOXYGEN_INVOKED + + //! <b>Returns</b>: `a.allocate(n)` + //! + static pointer allocate(Alloc &a, size_type n) + { return a.allocate(n); } + + //! <b>Returns</b>: `a.deallocate(p, n)` + //! + //! <b>Throws</b>: Nothing + static void deallocate(Alloc &a, pointer p, size_type n) + { return a.deallocate(p, n); } + + //! <b>Effects</b>: calls `a.allocate(n, p)` if that call is well-formed; + //! otherwise, invokes `a.allocate(n)` + static pointer allocate(Alloc &a, size_type n, const_void_pointer p) + { + const bool value = boost::container::container_detail:: + has_member_function_callable_with_allocate + <Alloc, const size_type, const const_void_pointer>::value; + ::boost::integral_constant<bool, value> flag; + return allocator_traits::priv_allocate(flag, a, n, p); + } + + //! <b>Effects</b>: calls `a.destroy(p)` if that call is well-formed; + //! otherwise, invokes `p->~T()`. + template<class T> + static void destroy(Alloc &a, T*p) + { + typedef T* destroy_pointer; + const bool value = boost::container::container_detail:: + has_member_function_callable_with_destroy + <Alloc, const destroy_pointer>::value; + ::boost::integral_constant<bool, value> flag; + allocator_traits::priv_destroy(flag, a, p); + } + + //! <b>Returns</b>: `a.max_size()` if that expression is well-formed; otherwise, + //! `numeric_limits<size_type>::max()`. + static size_type max_size(const Alloc &a) + { + const bool value = boost::container::container_detail:: + has_member_function_callable_with_max_size + <const Alloc>::value; + ::boost::integral_constant<bool, value> flag; + return allocator_traits::priv_max_size(flag, a); + } + + //! <b>Returns</b>: `a.select_on_container_copy_construction()` if that expression is well-formed; + //! otherwise, a. + static Alloc select_on_container_copy_construction(const Alloc &a) + { + const bool value = boost::container::container_detail:: + has_member_function_callable_with_select_on_container_copy_construction + <const Alloc>::value; + ::boost::integral_constant<bool, value> flag; + return allocator_traits::priv_select_on_container_copy_construction(flag, a); + } + + #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + //! <b>Effects</b>: calls `a.construct(p, std::forward<Args>(args)...)` if that call is well-formed; + //! otherwise, invokes `::new (static_cast<void*>(p)) T(std::forward<Args>(args)...)` + template <class T, class ...Args> + static void construct(Alloc & a, T* p, BOOST_FWD_REF(Args)... args) + { + ::boost::integral_constant<bool, container_detail::is_std_allocator<Alloc>::value> flag; + allocator_traits::priv_construct(flag, a, p, ::boost::forward<Args>(args)...); + } + #endif + ///@cond + #if !defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + private: + static pointer priv_allocate(boost::true_type, Alloc &a, size_type n, const_void_pointer p) + { return a.allocate(n, p); } + + static pointer priv_allocate(boost::false_type, Alloc &a, size_type n, const_void_pointer) + { return allocator_traits::allocate(a, n); } + + template<class T> + static void priv_destroy(boost::true_type, Alloc &a, T* p) + { a.destroy(p); } + + template<class T> + static void priv_destroy(boost::false_type, Alloc &, T* p) + { p->~T(); (void)p; } + + static size_type priv_max_size(boost::true_type, const Alloc &a) + { return a.max_size(); } + + static size_type priv_max_size(boost::false_type, const Alloc &) + { return (std::numeric_limits<size_type>::max)(); } + + static Alloc priv_select_on_container_copy_construction(boost::true_type, const Alloc &a) + { return a.select_on_container_copy_construction(); } + + static Alloc priv_select_on_container_copy_construction(boost::false_type, const Alloc &a) + { return a; } + + #if !defined(BOOST_NO_VARIADIC_TEMPLATES) + template<class T, class ...Args> + static void priv_construct(boost::false_type, Alloc &a, T *p, BOOST_FWD_REF(Args) ...args) + { + const bool value = boost::container::container_detail:: + has_member_function_callable_with_construct + < Alloc, T*, Args... >::value; + ::boost::integral_constant<bool, value> flag; + priv_construct_dispatch2(flag, a, p, ::boost::forward<Args>(args)...); + } + + template<class T, class ...Args> + static void priv_construct(boost::true_type, Alloc &a, T *p, BOOST_FWD_REF(Args) ...args) + { + priv_construct_dispatch2(boost::false_type(), a, p, ::boost::forward<Args>(args)...); + } + + template<class T, class ...Args> + static void priv_construct_dispatch2(boost::true_type, Alloc &a, T *p, BOOST_FWD_REF(Args) ...args) + { a.construct( p, ::boost::forward<Args>(args)...); } + + template<class T, class ...Args> + static void priv_construct_dispatch2(boost::false_type, Alloc &, T *p, BOOST_FWD_REF(Args) ...args) + { ::new((void*)p) T(::boost::forward<Args>(args)...); } + #else // #if !defined(BOOST_NO_VARIADIC_TEMPLATES) + public: + #define BOOST_PP_LOCAL_MACRO(n) \ + template<class T BOOST_PP_ENUM_TRAILING_PARAMS(n, class P) > \ + static void construct(Alloc &a, T *p \ + BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \ + { \ + ::boost::integral_constant<bool, container_detail::is_std_allocator<Alloc>::value> flag; \ + allocator_traits::priv_construct(flag, a, p \ + BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); \ + } \ + // + #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS) + #include BOOST_PP_LOCAL_ITERATE() + + private: + #define BOOST_PP_LOCAL_MACRO(n) \ + template<class T BOOST_PP_ENUM_TRAILING_PARAMS(n, class P) > \ + static void priv_construct(boost::false_type, Alloc &a, T *p \ + BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST,_)) \ + { \ + const bool value = \ + boost::container::container_detail::has_member_function_callable_with_construct \ + < Alloc, T* BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_FWD_TYPE, _) >::value; \ + ::boost::integral_constant<bool, value> flag; \ + priv_construct_dispatch2(flag, a, p \ + BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) ); \ + } \ + \ + template<class T BOOST_PP_ENUM_TRAILING_PARAMS(n, class P) > \ + static void priv_construct(boost::true_type, Alloc &a, T *p \ + BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST,_)) \ + { \ + priv_construct_dispatch2(boost::false_type(), a, p \ + BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) ); \ + } \ + \ + template<class T BOOST_PP_ENUM_TRAILING_PARAMS(n, class P) > \ + static void priv_construct_dispatch2(boost::true_type, Alloc &a, T *p \ + BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST,_)) \ + { a.construct( p BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) ); } \ + \ + template<class T BOOST_PP_ENUM_TRAILING_PARAMS(n, class P) > \ + static void priv_construct_dispatch2(boost::false_type, Alloc &, T *p \ + BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _) ) \ + { ::new((void*)p) T(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); } \ + // + #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS) + #include BOOST_PP_LOCAL_ITERATE() + #endif // #if !defined(BOOST_NO_VARIADIC_TEMPLATES) + #endif //#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + + ///@endcond +}; + +} //namespace container { +} //namespace boost { + +#include <boost/container/detail/config_end.hpp> + +#endif // ! defined(BOOST_CONTAINER_ALLOCATOR_ALLOCATOR_TRAITS_HPP) diff --git a/3rdParty/Boost/src/boost/container/container_fwd.hpp b/3rdParty/Boost/src/boost/container/container_fwd.hpp new file mode 100644 index 0000000..bdefd81 --- /dev/null +++ b/3rdParty/Boost/src/boost/container/container_fwd.hpp @@ -0,0 +1,173 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2005-2012. 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) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_CONTAINER_FWD_HPP +#define BOOST_CONTAINER_CONTAINER_FWD_HPP + +#if (defined _MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +////////////////////////////////////////////////////////////////////////////// +// Standard predeclarations +////////////////////////////////////////////////////////////////////////////// + +/// @cond + +namespace boost{ +namespace intrusive{ + //Create namespace to avoid compilation errors +}} + +namespace boost{ namespace container{ namespace container_detail{ + +namespace bi = boost::intrusive; + +}}} + +#include <utility> +#include <memory> +#include <functional> +#include <iosfwd> +#include <string> + +/// @endcond + +////////////////////////////////////////////////////////////////////////////// +// Containers +////////////////////////////////////////////////////////////////////////////// + +namespace boost { +namespace container { + +//vector class +template <class T + ,class Allocator = std::allocator<T> > +class vector; + +//vector class +template <class T + ,class Allocator = std::allocator<T> > +class stable_vector; + +//vector class +template <class T + ,class Allocator = std::allocator<T> > +class deque; + +//list class +template <class T + ,class Allocator = std::allocator<T> > +class list; + +//slist class +template <class T + ,class Allocator = std::allocator<T> > +class slist; + +//set class +template <class Key + ,class Compare = std::less<Key> + ,class Allocator = std::allocator<Key> > +class set; + +//multiset class +template <class Key + ,class Compare = std::less<Key> + ,class Allocator = std::allocator<Key> > +class multiset; + +//map class +template <class Key + ,class T + ,class Compare = std::less<Key> + ,class Allocator = std::allocator<std::pair<const Key, T> > > +class map; + +//multimap class +template <class Key + ,class T + ,class Compare = std::less<Key> + ,class Allocator = std::allocator<std::pair<const Key, T> > > +class multimap; + +//flat_set class +template <class Key + ,class Compare = std::less<Key> + ,class Allocator = std::allocator<Key> > +class flat_set; + +//flat_multiset class +template <class Key + ,class Compare = std::less<Key> + ,class Allocator = std::allocator<Key> > +class flat_multiset; + +//flat_map class +template <class Key + ,class T + ,class Compare = std::less<Key> + ,class Allocator = std::allocator<std::pair<Key, T> > > +class flat_map; + +//flat_multimap class +template <class Key + ,class T + ,class Compare = std::less<Key> + ,class Allocator = std::allocator<std::pair<Key, T> > > +class flat_multimap; + +//basic_string class +template <class CharT + ,class Traits = std::char_traits<CharT> + ,class Allocator = std::allocator<CharT> > +class basic_string; + +//! Type used to tag that the input range is +//! guaranteed to be ordered +struct ordered_range_t +{}; + +//! Type used to tag that the input range is +//! guaranteed to be ordered and unique +struct ordered_unique_range_t + : public ordered_range_t +{}; + +//! Value used to tag that the input range is +//! guaranteed to be ordered +static const ordered_range_t ordered_range = ordered_range_t(); + +//! Value used to tag that the input range is +//! guaranteed to be ordered and unique +static const ordered_unique_range_t ordered_unique_range = ordered_unique_range_t(); + +/// @cond + +namespace detail_really_deep_namespace { + +//Otherwise, gcc issues a warning of previously defined +//anonymous_instance and unique_instance +struct dummy +{ + dummy() + { + (void)ordered_range; + (void)ordered_unique_range; + } +}; + +} //detail_really_deep_namespace { + +/// @endcond + +}} //namespace boost { namespace container { + +#endif //#ifndef BOOST_CONTAINER_CONTAINER_FWD_HPP diff --git a/3rdParty/Boost/src/boost/container/detail/config_begin.hpp b/3rdParty/Boost/src/boost/container/detail/config_begin.hpp new file mode 100644 index 0000000..83c2cfe --- /dev/null +++ b/3rdParty/Boost/src/boost/container/detail/config_begin.hpp @@ -0,0 +1,49 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2005-2012. 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) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// +#ifndef BOOST_CONTAINER_CONTAINER_DETAIL_CONFIG_INCLUDED +#define BOOST_CONTAINER_CONTAINER_DETAIL_CONFIG_INCLUDED +#include <boost/config.hpp> + +#endif //BOOST_CONTAINER_CONTAINER_DETAIL_CONFIG_INCLUDED + +#ifdef BOOST_MSVC + #ifndef _CRT_SECURE_NO_DEPRECATE + #define BOOST_CONTAINER_DETAIL_CRT_SECURE_NO_DEPRECATE + #define _CRT_SECURE_NO_DEPRECATE + #endif + #pragma warning (push) + #pragma warning (disable : 4702) // unreachable code + #pragma warning (disable : 4706) // assignment within conditional expression + #pragma warning (disable : 4127) // conditional expression is constant + #pragma warning (disable : 4146) // unary minus operator applied to unsigned type, result still unsigned + #pragma warning (disable : 4284) // odd return type for operator-> + #pragma warning (disable : 4244) // possible loss of data + #pragma warning (disable : 4251) // "identifier" : class "type" needs to have dll-interface to be used by clients of class "type2" + #pragma warning (disable : 4267) // conversion from "X" to "Y", possible loss of data + #pragma warning (disable : 4275) // non DLL-interface classkey "identifier" used as base for DLL-interface classkey "identifier" + #pragma warning (disable : 4355) // "this" : used in base member initializer list + #pragma warning (disable : 4503) // "identifier" : decorated name length exceeded, name was truncated + #pragma warning (disable : 4511) // copy constructor could not be generated + #pragma warning (disable : 4512) // assignment operator could not be generated + #pragma warning (disable : 4514) // unreferenced inline removed + #pragma warning (disable : 4521) // Disable "multiple copy constructors specified" + #pragma warning (disable : 4522) // "class" : multiple assignment operators specified + #pragma warning (disable : 4675) // "method" should be declared "static" and have exactly one parameter + #pragma warning (disable : 4710) // function not inlined + #pragma warning (disable : 4711) // function selected for automatic inline expansion + #pragma warning (disable : 4786) // identifier truncated in debug info + #pragma warning (disable : 4996) // "function": was declared deprecated + #pragma warning (disable : 4197) // top-level volatile in cast is ignored + #pragma warning (disable : 4541) // 'typeid' used on polymorphic type 'boost::exception' + // with /GR-; unpredictable behavior may result + #pragma warning (disable : 4673) // throwing '' the following types will not be considered at the catch site + #pragma warning (disable : 4671) // the copy constructor is inaccessible + #pragma warning (disable : 4584) // X is already a base-class of Y +#endif //BOOST_MSVC diff --git a/3rdParty/Boost/src/boost/container/detail/config_end.hpp b/3rdParty/Boost/src/boost/container/detail/config_end.hpp new file mode 100644 index 0000000..3451371 --- /dev/null +++ b/3rdParty/Boost/src/boost/container/detail/config_end.hpp @@ -0,0 +1,17 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2005-2012. 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) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// +#if defined BOOST_MSVC + #pragma warning (pop) + #ifdef BOOST_CONTAINER_DETAIL_CRT_SECURE_NO_DEPRECATE + #undef BOOST_CONTAINER_DETAIL_CRT_SECURE_NO_DEPRECATE + #undef _CRT_SECURE_NO_DEPRECATE + #endif +#endif + diff --git a/3rdParty/Boost/src/boost/container/detail/memory_util.hpp b/3rdParty/Boost/src/boost/container/detail/memory_util.hpp new file mode 100644 index 0000000..c00172c --- /dev/null +++ b/3rdParty/Boost/src/boost/container/detail/memory_util.hpp @@ -0,0 +1,77 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2011-2012. 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) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_ALLOCATOR_MEMORY_UTIL_HPP +#define BOOST_CONTAINER_ALLOCATOR_MEMORY_UTIL_HPP + +#if (defined _MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include <boost/container/detail/config_begin.hpp> +#include <boost/container/detail/workaround.hpp> +#include <boost/container/detail/preprocessor.hpp> +#include <boost/intrusive/detail/has_member_function_callable_with.hpp> + + +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME allocate +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN namespace boost { namespace container { namespace container_detail { +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}} +#define BOOST_PP_ITERATION_PARAMS_1 (3, (0, 2, <boost/intrusive/detail/has_member_function_callable_with.hpp>)) +#include BOOST_PP_ITERATE() + +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME destroy +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN namespace boost { namespace container { namespace container_detail { +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}} +#define BOOST_PP_ITERATION_PARAMS_1 (3, (0, 3, <boost/intrusive/detail/has_member_function_callable_with.hpp>)) +#include BOOST_PP_ITERATE() + +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME max_size +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN namespace boost { namespace container { namespace container_detail { +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}} +#define BOOST_PP_ITERATION_PARAMS_1 (3, (0, 0, <boost/intrusive/detail/has_member_function_callable_with.hpp>)) +#include BOOST_PP_ITERATE() + +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME select_on_container_copy_construction +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN namespace boost { namespace container { namespace container_detail { +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}} +#define BOOST_PP_ITERATION_PARAMS_1 (3, (0, 0, <boost/intrusive/detail/has_member_function_callable_with.hpp>)) +#include BOOST_PP_ITERATE() + +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME construct +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN namespace boost { namespace container { namespace container_detail { +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}} +#define BOOST_PP_ITERATION_PARAMS_1 (3, (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS+1, <boost/intrusive/detail/has_member_function_callable_with.hpp>)) +#include BOOST_PP_ITERATE() + +namespace boost { +namespace container { +namespace container_detail { + + +BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(pointer) +BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(const_pointer) +BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(reference) +BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(const_reference) +BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(void_pointer) +BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(const_void_pointer) +BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(size_type) +BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(propagate_on_container_copy_assignment) +BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(propagate_on_container_move_assignment) +BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(propagate_on_container_swap) +BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(difference_type) + +} //namespace container_detail { +} //namespace container { +} //namespace boost { + +#include <boost/container/detail/config_end.hpp> + +#endif // ! defined(BOOST_CONTAINER_ALLOCATOR_MEMORY_UTIL_HPP) diff --git a/3rdParty/Boost/src/boost/container/detail/mpl.hpp b/3rdParty/Boost/src/boost/container/detail/mpl.hpp new file mode 100644 index 0000000..74a1ce0 --- /dev/null +++ b/3rdParty/Boost/src/boost/container/detail/mpl.hpp @@ -0,0 +1,160 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2005-2012. +// +// 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) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_CONTAINER_DETAIL_MPL_HPP +#define BOOST_CONTAINER_CONTAINER_DETAIL_MPL_HPP + +#if (defined _MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include <cstddef> + +namespace boost { +namespace container { +namespace container_detail { + +template <class T, T val> +struct integral_constant +{ + static const T value = val; + typedef integral_constant<T,val> type; +}; + +template< bool C_ > +struct bool_ : integral_constant<bool, C_> +{ + static const bool value = C_; + operator bool() const { return bool_::value; } +}; + +typedef bool_<true> true_; +typedef bool_<false> false_; + +typedef true_ true_type; +typedef false_ false_type; + +typedef char yes_type; +struct no_type +{ + char padding[8]; +}; + +template <bool B, class T = void> +struct enable_if_c { + typedef T type; +}; + +template <class T> +struct enable_if_c<false, T> {}; + +template <class Cond, class T = void> +struct enable_if : public enable_if_c<Cond::value, T> {}; + +template <class Cond, class T = void> +struct disable_if : public enable_if_c<!Cond::value, T> {}; + +template <bool B, class T = void> +struct disable_if_c : public enable_if_c<!B, T> {}; + +template <class T, class U> +class is_convertible +{ + typedef char true_t; + class false_t { char dummy[2]; }; + static true_t dispatch(U); + static false_t dispatch(...); + static T trigger(); + public: + enum { value = sizeof(dispatch(trigger())) == sizeof(true_t) }; +}; + +template< + bool C + , typename T1 + , typename T2 + > +struct if_c +{ + typedef T1 type; +}; + +template< + typename T1 + , typename T2 + > +struct if_c<false,T1,T2> +{ + typedef T2 type; +}; + +template< + typename T1 + , typename T2 + , typename T3 + > +struct if_ +{ + typedef typename if_c<0 != T1::value, T2, T3>::type type; +}; + + +template <class Pair> +struct select1st +// : public std::unary_function<Pair, typename Pair::first_type> +{ + template<class OtherPair> + const typename Pair::first_type& operator()(const OtherPair& x) const + { return x.first; } + + const typename Pair::first_type& operator()(const typename Pair::first_type& x) const + { return x; } +}; + +// identity is an extension: it is not part of the standard. +template <class T> +struct identity +// : public std::unary_function<T,T> +{ + typedef T type; + const T& operator()(const T& x) const + { return x; } +}; + +template<std::size_t S> +struct ls_zeros +{ + static const std::size_t value = (S & std::size_t(1)) ? 0 : (1u + ls_zeros<(S >> 1u)>::value); +}; + +template<> +struct ls_zeros<0> +{ + static const std::size_t value = 0; +}; + +template<> +struct ls_zeros<1> +{ + static const std::size_t value = 0; +}; + +template <typename T> struct unvoid { typedef T type; }; +template <> struct unvoid<void> { struct type { }; }; +template <> struct unvoid<const void> { struct type { }; }; + +} //namespace container_detail { +} //namespace container { +} //namespace boost { + +#endif //#ifndef BOOST_CONTAINER_CONTAINER_DETAIL_MPL_HPP + diff --git a/3rdParty/Boost/src/boost/container/detail/pair.hpp b/3rdParty/Boost/src/boost/container/detail/pair.hpp new file mode 100644 index 0000000..2a20ed1 --- /dev/null +++ b/3rdParty/Boost/src/boost/container/detail/pair.hpp @@ -0,0 +1,353 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2005-2012. +// +// 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) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_CONTAINER_DETAIL_PAIR_HPP +#define BOOST_CONTAINER_CONTAINER_DETAIL_PAIR_HPP + +#if (defined _MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include "config_begin.hpp" +#include <boost/container/detail/workaround.hpp> + +#include <boost/container/detail/mpl.hpp> +#include <boost/container/detail/type_traits.hpp> +#include <boost/container/detail/mpl.hpp> +#include <boost/container/detail/type_traits.hpp> + +#include <utility> //std::pair + +#include <boost/move/move.hpp> +#include <boost/type_traits/is_class.hpp> + +#ifndef BOOST_CONTAINER_PERFECT_FORWARDING +#include <boost/container/detail/preprocessor.hpp> +#endif + +namespace boost { +namespace container { +namespace container_detail { + +template <class T1, class T2> +struct pair; + +template <class T> +struct is_pair +{ + static const bool value = false; +}; + +template <class T1, class T2> +struct is_pair< pair<T1, T2> > +{ + static const bool value = true; +}; + +template <class T1, class T2> +struct is_pair< std::pair<T1, T2> > +{ + static const bool value = true; +}; + +struct pair_nat; + +struct piecewise_construct_t { }; +static const piecewise_construct_t piecewise_construct = piecewise_construct_t(); + +/* +template <class T1, class T2> +struct pair +{ + template <class U, class V> pair(pair<U, V>&& p); + template <class... Args1, class... Args2> + pair(piecewise_construct_t, tuple<Args1...> first_args, + tuple<Args2...> second_args); + + template <class U, class V> pair& operator=(const pair<U, V>& p); + pair& operator=(pair&& p) noexcept(is_nothrow_move_assignable<T1>::value && + is_nothrow_move_assignable<T2>::value); + template <class U, class V> pair& operator=(pair<U, V>&& p); + + void swap(pair& p) noexcept(noexcept(swap(first, p.first)) && + noexcept(swap(second, p.second))); +}; + +template <class T1, class T2> bool operator==(const pair<T1,T2>&, const pair<T1,T2>&); +template <class T1, class T2> bool operator!=(const pair<T1,T2>&, const pair<T1,T2>&); +template <class T1, class T2> bool operator< (const pair<T1,T2>&, const pair<T1,T2>&); +template <class T1, class T2> bool operator> (const pair<T1,T2>&, const pair<T1,T2>&); +template <class T1, class T2> bool operator>=(const pair<T1,T2>&, const pair<T1,T2>&); +template <class T1, class T2> bool operator<=(const pair<T1,T2>&, const pair<T1,T2>&); +*/ + + +template <class T1, class T2> +struct pair +{ + private: + BOOST_COPYABLE_AND_MOVABLE(pair) + + public: + typedef T1 first_type; + typedef T2 second_type; + + T1 first; + T2 second; + + //Default constructor + pair() + : first(), second() + {} + + //pair copy assignment + pair(const pair& x) + : first(x.first), second(x.second) + {} + + //pair move constructor + pair(BOOST_RV_REF(pair) p) + : first(::boost::move(p.first)), second(::boost::move(p.second)) + {} + + template <class D, class S> + pair(const pair<D, S> &p) + : first(p.first), second(p.second) + {} + + template <class D, class S> + pair(BOOST_RV_REF_BEG pair<D, S> BOOST_RV_REF_END p) + : first(::boost::move(p.first)), second(::boost::move(p.second)) + {} + + //pair from two values + pair(const T1 &t1, const T2 &t2) + : first(t1) + , second(t2) + {} + + template<class U, class V> + pair(BOOST_FWD_REF(U) u, BOOST_FWD_REF(V) v) + : first(::boost::forward<U>(u)) + , second(::boost::forward<V>(v)) + {} + + //And now compatibility with std::pair + pair(const std::pair<T1, T2>& x) + : first(x.first), second(x.second) + {} + + template <class D, class S> + pair(const std::pair<D, S>& p) + : first(p.first), second(p.second) + {} + + pair(BOOST_RV_REF_BEG std::pair<T1, T2> BOOST_RV_REF_END p) + : first(::boost::move(p.first)), second(::boost::move(p.second)) + {} + + template <class D, class S> + pair(BOOST_RV_REF_BEG std::pair<D, S> BOOST_RV_REF_END p) + : first(::boost::move(p.first)), second(::boost::move(p.second)) + {} + + //piecewise_construct missing + //template <class U, class V> pair(pair<U, V>&& p); + //template <class... Args1, class... Args2> + // pair(piecewise_construct_t, tuple<Args1...> first_args, + // tuple<Args2...> second_args); +/* + //Variadic versions + template<class U> + pair(BOOST_CONTAINER_PP_PARAM(U, u), typename container_detail::disable_if + < container_detail::is_pair< typename container_detail::remove_ref_const<U>::type >, pair_nat>::type* = 0) + : first(::boost::forward<U>(u)) + , second() + {} + + #ifdef BOOST_CONTAINER_PERFECT_FORWARDING + + template<class U, class V, class ...Args> + pair(U &&u, V &&v) + : first(::boost::forward<U>(u)) + , second(::boost::forward<V>(v), ::boost::forward<Args>(args)...) + {} + + #else + + #define BOOST_PP_LOCAL_MACRO(n) \ + template<class U, BOOST_PP_ENUM_PARAMS(n, class P)> \ + pair(BOOST_CONTAINER_PP_PARAM(U, u) \ + ,BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \ + : first(::boost::forward<U>(u)) \ + , second(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)) \ + {} \ + //! + #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS) + #include BOOST_PP_LOCAL_ITERATE() + #endif +*/ + //pair copy assignment + pair& operator=(BOOST_COPY_ASSIGN_REF(pair) p) + { + first = p.first; + second = p.second; + return *this; + } + + //pair move assignment + pair& operator=(BOOST_RV_REF(pair) p) + { + first = ::boost::move(p.first); + second = ::boost::move(p.second); + return *this; + } + + template <class D, class S> + typename ::boost::container::container_detail::enable_if_c + < !(::boost::container::container_detail::is_same<T1, D>::value && + ::boost::container::container_detail::is_same<T2, S>::value) + , pair &>::type + operator=(const pair<D, S>&p) + { + first = p.first; + second = p.second; + return *this; + } + + template <class D, class S> + typename ::boost::container::container_detail::enable_if_c + < !(::boost::container::container_detail::is_same<T1, D>::value && + ::boost::container::container_detail::is_same<T2, S>::value) + , pair &>::type + operator=(BOOST_RV_REF_BEG pair<D, S> BOOST_RV_REF_END p) + { + first = ::boost::move(p.first); + second = ::boost::move(p.second); + return *this; + } + + //std::pair copy assignment + pair& operator=(const std::pair<T1, T2> &p) + { + first = p.first; + second = p.second; + return *this; + } + + template <class D, class S> + pair& operator=(const std::pair<D, S> &p) + { + first = ::boost::move(p.first); + second = ::boost::move(p.second); + return *this; + } + + //std::pair move assignment + pair& operator=(BOOST_RV_REF_BEG std::pair<T1, T2> BOOST_RV_REF_END p) + { + first = ::boost::move(p.first); + second = ::boost::move(p.second); + return *this; + } + + template <class D, class S> + pair& operator=(BOOST_RV_REF_BEG std::pair<D, S> BOOST_RV_REF_END p) + { + first = ::boost::move(p.first); + second = ::boost::move(p.second); + return *this; + } + + //swap + void swap(pair& p) + { + using std::swap; + swap(this->first, p.first); + swap(this->second, p.second); + } +}; + +template <class T1, class T2> +inline bool operator==(const pair<T1,T2>& x, const pair<T1,T2>& y) +{ return static_cast<bool>(x.first == y.first && x.second == y.second); } + +template <class T1, class T2> +inline bool operator< (const pair<T1,T2>& x, const pair<T1,T2>& y) +{ return static_cast<bool>(x.first < y.first || + (!(y.first < x.first) && x.second < y.second)); } + +template <class T1, class T2> +inline bool operator!=(const pair<T1,T2>& x, const pair<T1,T2>& y) +{ return static_cast<bool>(!(x == y)); } + +template <class T1, class T2> +inline bool operator> (const pair<T1,T2>& x, const pair<T1,T2>& y) +{ return y < x; } + +template <class T1, class T2> +inline bool operator>=(const pair<T1,T2>& x, const pair<T1,T2>& y) +{ return static_cast<bool>(!(x < y)); } + +template <class T1, class T2> +inline bool operator<=(const pair<T1,T2>& x, const pair<T1,T2>& y) +{ return static_cast<bool>(!(y < x)); } + +template <class T1, class T2> +inline pair<T1, T2> make_pair(T1 x, T2 y) +{ return pair<T1, T2>(x, y); } + +template <class T1, class T2> +inline void swap(pair<T1, T2>& x, pair<T1, T2>& y) +{ + swap(x.first, y.first); + swap(x.second, y.second); +} + +} //namespace container_detail { +} //namespace container { + + +//Without this specialization recursive flat_(multi)map instantiation fails +//because is_enum needs to instantiate the recursive pair, leading to a compilation error). +//This breaks the cycle clearly stating that pair is not an enum avoiding any instantiation. +template<class T> +struct is_enum; + +template<class T, class U> +struct is_enum< ::boost::container::container_detail::pair<T, U> > +{ + static const bool value = false; +}; + +//This specialization is needed to avoid instantiation of pair in +//is_class, and allow recursive maps. +template <class T1, class T2> +struct is_class< ::boost::container::container_detail::pair<T1, T2> > + : public ::boost::true_type +{}; + +#ifdef BOOST_NO_RVALUE_REFERENCES + +template<class T1, class T2> +struct has_move_emulation_enabled< ::boost::container::container_detail::pair<T1, T2> > + : ::boost::true_type +{}; + +#endif + + +} //namespace boost { + +#include <boost/container/detail/config_end.hpp> + +#endif //#ifndef BOOST_CONTAINER_DETAIL_PAIR_HPP diff --git a/3rdParty/Boost/src/boost/container/detail/preprocessor.hpp b/3rdParty/Boost/src/boost/container/detail/preprocessor.hpp new file mode 100644 index 0000000..5129ea1 --- /dev/null +++ b/3rdParty/Boost/src/boost/container/detail/preprocessor.hpp @@ -0,0 +1,230 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2008-2012. 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) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_DETAIL_PREPROCESSOR_HPP +#define BOOST_CONTAINER_DETAIL_PREPROCESSOR_HPP + +#if (defined _MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include <boost/container/detail/config_begin.hpp> +#include <boost/container/detail/workaround.hpp> + +#ifdef BOOST_CONTAINER_PERFECT_FORWARDING +//#error "This file is not needed when perfect forwarding is available" +#endif //BOOST_CONTAINER_PERFECT_FORWARDING + +#include <boost/preprocessor/iteration/local.hpp> +#include <boost/preprocessor/punctuation/paren_if.hpp> +#include <boost/preprocessor/punctuation/comma_if.hpp> +#include <boost/preprocessor/control/expr_if.hpp> +#include <boost/preprocessor/cat.hpp> +#include <boost/preprocessor/repetition/enum.hpp> +#include <boost/preprocessor/repetition/enum_params.hpp> +#include <boost/preprocessor/repetition/enum_trailing_params.hpp> +#include <boost/preprocessor/repetition/enum_trailing.hpp> +#include <boost/preprocessor/repetition/enum_shifted_params.hpp> +#include <boost/preprocessor/repetition/enum_shifted.hpp> +#include <boost/preprocessor/repetition/repeat.hpp> +#include <boost/preprocessor/logical/not.hpp> +#include <boost/preprocessor/arithmetic/sub.hpp> +#include <boost/preprocessor/arithmetic/add.hpp> +#include <boost/preprocessor/iteration/iterate.hpp> + +#define BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS 10 + +//Note: +//We define template parameters as const references to +//be able to bind temporaries. After that we will un-const them. +//This cast is ugly but it is necessary until "perfect forwarding" +//is achieved in C++0x. Meanwhile, if we want to be able to +//bind rvalues with non-const references, we have to be ugly +#ifndef BOOST_NO_RVALUE_REFERENCES + #define BOOST_CONTAINER_PP_PARAM_LIST(z, n, data) \ + BOOST_PP_CAT(P, n) && BOOST_PP_CAT(p, n) \ + //! +#else + #define BOOST_CONTAINER_PP_PARAM_LIST(z, n, data) \ + const BOOST_PP_CAT(P, n) & BOOST_PP_CAT(p, n) \ + //! +#endif //#ifndef BOOST_NO_RVALUE_REFERENCES + +#define BOOST_CONTAINER_PP_CONST_REF_PARAM_LIST_Q(z, n, Data) \ +const BOOST_PP_CAT(Q, n) & BOOST_PP_CAT(q, n) \ +//! + +#ifndef BOOST_NO_RVALUE_REFERENCES + #define BOOST_CONTAINER_PP_PARAM(U, u) \ + U && u \ + //! +#else + #define BOOST_CONTAINER_PP_PARAM(U, u) \ + const U & u \ + //! +#endif //#ifndef BOOST_NO_RVALUE_REFERENCES + +#ifndef BOOST_NO_RVALUE_REFERENCES + + #define BOOST_CONTAINER_PP_PARAM_INIT(z, n, data) \ + BOOST_PP_CAT(m_p, n) (::boost::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(p, n) )) \ + //! + +#else //BOOST_NO_RVALUE_REFERENCES + + #define BOOST_CONTAINER_PP_PARAM_INIT(z, n, data) \ + BOOST_PP_CAT(m_p, n) (const_cast<BOOST_PP_CAT(P, n) &>(BOOST_PP_CAT(p, n))) \ + //! +#endif //#ifndef BOOST_NO_RVALUE_REFERENCES + +#ifndef BOOST_NO_RVALUE_REFERENCES + + #if defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG) + + namespace boost { + namespace container { + namespace container_detail { + template<class T> + struct ref_holder; + + template<class T> + struct ref_holder<T &> + { + ref_holder(T &t) + : t_(t) + {} + T &t_; + T & get() { return t_; } + }; + + template<class T> + struct ref_holder<const T> + { + ref_holder(const T &t) + : t_(t) + {} + const T &t_; + const T & get() { return t_; } + }; + + template<class T> + struct ref_holder<const T &&> + { + ref_holder(const T &t) + : t_(t) + {} + const T &t_; + const T & get() { return t_; } + }; + + template<class T> + struct ref_holder + { + ref_holder(T &&t) + : t_(t) + {} + T &t_; + T && get() { return ::boost::move(t_); } + }; + + template<class T> + struct ref_holder<T &&> + { + ref_holder(T &&t) + : t(t) + {} + T &t; + T && get() { return ::boost::move(t_); } + }; + + } //namespace container_detail { + } //namespace container { + } //namespace boost { + + #define BOOST_CONTAINER_PP_PARAM_DEFINE(z, n, data) \ + ::boost::container::container_detail::ref_holder<BOOST_PP_CAT(P, n)> BOOST_PP_CAT(m_p, n); \ + //! + + #else //BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG + + #define BOOST_CONTAINER_PP_PARAM_DEFINE(z, n, data) \ + BOOST_PP_CAT(P, n) && BOOST_PP_CAT(m_p, n); \ + //! + + #endif //defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG) + +#else //BOOST_NO_RVALUE_REFERENCES + + #define BOOST_CONTAINER_PP_PARAM_DEFINE(z, n, data) \ + BOOST_PP_CAT(P, n) & BOOST_PP_CAT(m_p, n); \ + //! +#endif //#ifndef BOOST_NO_RVALUE_REFERENCES + +#if !defined(BOOST_NO_RVALUE_REFERENCES) && defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG) + + #define BOOST_CONTAINER_PP_MEMBER_FORWARD(z, n, data) BOOST_PP_CAT(this->m_p, n).get() \ + //! + +#else //!defined(BOOST_NO_RVALUE_REFERENCES) && defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG) + + #define BOOST_CONTAINER_PP_MEMBER_FORWARD(z, n, data) \ + ::boost::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(this->m_p, n) ) \ + //! + +#endif //!defined(BOOST_NO_RVALUE_REFERENCES) && defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG) + +#define BOOST_CONTAINER_PP_PARAM_INC(z, n, data) \ + BOOST_PP_CAT(++this->m_p, n) \ +//! + +#define BOOST_CONTAINER_PP_IDENTITY(z, n, data) data + + +#define BOOST_CONTAINER_PP_PARAM_FORWARD(z, n, data) \ +::boost::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(p, n) ) \ +//! + +#define BOOST_CONTAINER_PP_DECLVAL(z, n, data) \ +::boost::move_detail::declval< BOOST_PP_CAT(P, n) >() \ +//! + +#define BOOST_CONTAINER_PP_MEMBER_IT_FORWARD(z, n, data) \ +BOOST_PP_CAT(*this->m_p, n) \ +//! + +#define BOOST_CONTAINER_PP_TEMPLATE_PARAM_VOID_DEFAULT(z, n, data) \ + BOOST_PP_CAT(class P, n) = void \ +//! + +#define BOOST_CONTAINER_PP_TEMPLATE_PARAM_WITH_DEFAULT(z, n, default_type) \ + BOOST_PP_CAT(class P, n) = default_type \ +//! + +#define BOOST_CONTAINER_PP_STATIC_PARAM_REF_DECLARE(z, n, data) \ + static BOOST_PP_CAT(P, n) & BOOST_PP_CAT(p, n); \ +//! + +#define BOOST_CONTAINER_PP_PARAM_PASS(z, n, data) \ + BOOST_PP_CAT(p, n) \ +//! + +#define BOOST_CONTAINER_PP_FWD_TYPE(z, n, data) \ + typename ::boost::move_detail::forward_type< BOOST_PP_CAT(P, n) >::type \ +//! + +#include <boost/container/detail/config_end.hpp> + +//#else + +//#ifdef BOOST_CONTAINER_PERFECT_FORWARDING +//#error "This file is not needed when perfect forwarding is available" +//#endif //BOOST_CONTAINER_PERFECT_FORWARDING + +#endif //#ifndef BOOST_CONTAINER_DETAIL_PREPROCESSOR_HPP diff --git a/3rdParty/Boost/src/boost/container/detail/type_traits.hpp b/3rdParty/Boost/src/boost/container/detail/type_traits.hpp new file mode 100644 index 0000000..0e096e5 --- /dev/null +++ b/3rdParty/Boost/src/boost/container/detail/type_traits.hpp @@ -0,0 +1,210 @@ +////////////////////////////////////////////////////////////////////////////// +// (C) Copyright John Maddock 2000. +// (C) Copyright Ion Gaztanaga 2005-2012. +// +// 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) +// +// See http://www.boost.org/libs/container for documentation. +// +// The alignment_of implementation comes from John Maddock's boost::alignment_of code +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_CONTAINER_DETAIL_TYPE_TRAITS_HPP +#define BOOST_CONTAINER_CONTAINER_DETAIL_TYPE_TRAITS_HPP + +#if (defined _MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include "config_begin.hpp" + +#include <boost/move/move.hpp> + +namespace boost { +namespace container { +namespace container_detail { + +struct nat{}; + +template <typename U> +struct LowPriorityConversion +{ + // Convertible from T with user-defined-conversion rank. + LowPriorityConversion(const U&) { } +}; + +//boost::alignment_of yields to 10K lines of preprocessed code, so we +//need an alternative +template <typename T> struct alignment_of; + +template <typename T> +struct alignment_of_hack +{ + char c; + T t; + alignment_of_hack(); +}; + +template <unsigned A, unsigned S> +struct alignment_logic +{ + enum{ value = A < S ? A : S }; +}; + +template< typename T > +struct alignment_of +{ + enum{ value = alignment_logic + < sizeof(alignment_of_hack<T>) - sizeof(T) + , sizeof(T)>::value }; +}; + +//This is not standard, but should work with all compilers +union max_align +{ + char char_; + short short_; + int int_; + long long_; + #ifdef BOOST_HAS_LONG_LONG + long long long_long_; + #endif + float float_; + double double_; + long double long_double_; + void * void_ptr_; +}; + +template<class T> +struct remove_reference +{ + typedef T type; +}; + +template<class T> +struct remove_reference<T&> +{ + typedef T type; +}; + +#ifndef BOOST_NO_RVALUE_REFERENCES + +template<class T> +struct remove_reference<T&&> +{ + typedef T type; +}; + +#else + +template<class T> +struct remove_reference< ::boost::rv<T> > +{ + typedef T type; +}; + +#endif + +template<class T> +struct is_reference +{ + enum { value = false }; +}; + +template<class T> +struct is_reference<T&> +{ + enum { value = true }; +}; + +template<class T> +struct is_pointer +{ + enum { value = false }; +}; + +template<class T> +struct is_pointer<T*> +{ + enum { value = true }; +}; + +template <typename T> +struct add_reference +{ + typedef T& type; +}; + +template<class T> +struct add_reference<T&> +{ + typedef T& type; +}; + +template<> +struct add_reference<void> +{ + typedef nat &type; +}; + +template<> +struct add_reference<const void> +{ + typedef const nat &type; +}; + +template <class T> +struct add_const_reference +{ typedef const T &type; }; + +template <class T> +struct add_const_reference<T&> +{ typedef T& type; }; + +template <typename T, typename U> +struct is_same +{ + typedef char yes_type; + struct no_type + { + char padding[8]; + }; + + template <typename V> + static yes_type is_same_tester(V*, V*); + static no_type is_same_tester(...); + + static T *t; + static U *u; + + static const bool value = sizeof(yes_type) == sizeof(is_same_tester(t,u)); +}; + +template<class T> +struct remove_const +{ + typedef T type; +}; + +template<class T> +struct remove_const< const T> +{ + typedef T type; +}; + +template<class T> +struct remove_ref_const +{ + typedef typename remove_const< typename remove_reference<T>::type >::type type; +}; + +} // namespace container_detail +} //namespace container { +} //namespace boost { + +#include <boost/container/detail/config_end.hpp> + +#endif //#ifndef BOOST_CONTAINER_CONTAINER_DETAIL_TYPE_TRAITS_HPP diff --git a/3rdParty/Boost/src/boost/container/detail/utilities.hpp b/3rdParty/Boost/src/boost/container/detail/utilities.hpp new file mode 100644 index 0000000..ece9a2e --- /dev/null +++ b/3rdParty/Boost/src/boost/container/detail/utilities.hpp @@ -0,0 +1,252 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2005-2012. 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) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_DETAIL_UTILITIES_HPP +#define BOOST_CONTAINER_DETAIL_UTILITIES_HPP + +#include "config_begin.hpp" +#include <cstdio> +#include <boost/type_traits/is_fundamental.hpp> +#include <boost/type_traits/is_pointer.hpp> +#include <boost/type_traits/is_enum.hpp> +#include <boost/type_traits/is_member_pointer.hpp> +#include <boost/type_traits/is_class.hpp> +#include <boost/move/move.hpp> +#include <boost/container/detail/mpl.hpp> +#include <boost/container/detail/type_traits.hpp> +#include <boost/container/allocator_traits.hpp> +#include <algorithm> + +namespace boost { +namespace container { +namespace container_detail { + +template <typename T> +inline T* addressof(T& obj) +{ + return static_cast<T*>( + static_cast<void*>( + const_cast<char*>( + &reinterpret_cast<const char&>(obj) + ))); +} + +template<class T> +const T &max_value(const T &a, const T &b) +{ return a > b ? a : b; } + +template<class T> +const T &min_value(const T &a, const T &b) +{ return a < b ? a : b; } + +template <class SizeType> +SizeType + get_next_capacity(const SizeType max_size + ,const SizeType capacity + ,const SizeType n) +{ +// if (n > max_size - capacity) +// throw std::length_error("get_next_capacity"); + + const SizeType m3 = max_size/3; + + if (capacity < m3) + return capacity + max_value(3*(capacity+1)/5, n); + + if (capacity < m3*2) + return capacity + max_value((capacity+1)/2, n); + + return max_size; +} + +template <class T> +inline T* to_raw_pointer(T* p) +{ return p; } + +template <class Pointer> +inline typename Pointer::element_type* + to_raw_pointer(const Pointer &p) +{ return boost::container::container_detail::to_raw_pointer(p.operator->()); } + +//!To avoid ADL problems with swap +template <class T> +inline void do_swap(T& x, T& y) +{ + using std::swap; + swap(x, y); +} + +template<class AllocatorType> +inline void swap_alloc(AllocatorType &, AllocatorType &, container_detail::false_type) + BOOST_CONTAINER_NOEXCEPT +{} + +template<class AllocatorType> +inline void swap_alloc(AllocatorType &l, AllocatorType &r, container_detail::true_type) +{ container_detail::do_swap(l, r); } + +template<class AllocatorType> +inline void assign_alloc(AllocatorType &, const AllocatorType &, container_detail::false_type) + BOOST_CONTAINER_NOEXCEPT +{} + +template<class AllocatorType> +inline void assign_alloc(AllocatorType &l, const AllocatorType &r, container_detail::true_type) +{ l = r; } + +template<class AllocatorType> +inline void move_alloc(AllocatorType &, AllocatorType &, container_detail::false_type) + BOOST_CONTAINER_NOEXCEPT +{} + +template<class AllocatorType> +inline void move_alloc(AllocatorType &l, AllocatorType &r, container_detail::true_type) +{ l = ::boost::move(r); } + +//Rounds "orig_size" by excess to round_to bytes +template<class SizeType> +inline SizeType get_rounded_size(SizeType orig_size, SizeType round_to) +{ + return ((orig_size-1)/round_to+1)*round_to; +} + +template <std::size_t OrigSize, std::size_t RoundTo> +struct ct_rounded_size +{ + enum { value = ((OrigSize-1)/RoundTo+1)*RoundTo }; +}; + +template<class T> +struct move_const_ref_type + : if_c +// < ::boost::is_fundamental<T>::value || ::boost::is_pointer<T>::value || ::boost::is_member_pointer<T>::value || ::boost::is_enum<T>::value + < !::boost::is_class<T>::value + ,const T & + ,BOOST_CATCH_CONST_RLVALUE(T) + > +{}; + +} //namespace container_detail { + +////////////////////////////////////////////////////////////////////////////// +// +// uninitialized_move_alloc +// +////////////////////////////////////////////////////////////////////////////// + +//! <b>Effects</b>: +//! \code +//! for (; first != last; ++result, ++first) +//! allocator_traits::construct(a, &*result, boost::move(*first)); +//! \endcode +//! +//! <b>Returns</b>: result +template + <typename A, + typename I, // I models InputIterator + typename F> // F models ForwardIterator +F uninitialized_move_alloc(A &a, I f, I l, F r) +{ + while (f != l) { + allocator_traits<A>::construct(a, container_detail::to_raw_pointer(&*r), boost::move(*f)); + ++f; ++r; + } + return r; +} + +////////////////////////////////////////////////////////////////////////////// +// +// uninitialized_copy_alloc +// +////////////////////////////////////////////////////////////////////////////// + +//! <b>Effects</b>: +//! \code +//! for (; first != last; ++result, ++first) +//! allocator_traits::construct(a, &*result, *first); +//! \endcode +//! +//! <b>Returns</b>: result +template + <typename A, + typename I, // I models InputIterator + typename F> // F models ForwardIterator +F uninitialized_copy_alloc(A &a, I f, I l, F r) +{ + while (f != l) { + allocator_traits<A>::construct(a, container_detail::to_raw_pointer(&*r), *f); + ++f; ++r; + } + return r; +} + +////////////////////////////////////////////////////////////////////////////// +// +// uninitialized_copy_alloc +// +////////////////////////////////////////////////////////////////////////////// + +//! <b>Effects</b>: +//! \code +//! for (; first != last; ++result, ++first) +//! allocator_traits::construct(a, &*result, *first); +//! \endcode +//! +//! <b>Returns</b>: result +template + <typename A, + typename F, // F models ForwardIterator + typename T> +void uninitialized_fill_alloc(A &a, F f, F l, const T &t) +{ + while (f != l) { + allocator_traits<A>::construct(a, container_detail::to_raw_pointer(&*f), t); + ++f; + } +} + +////////////////////////////////////////////////////////////////////////////// +// +// uninitialized_copy_or_move_alloc +// +////////////////////////////////////////////////////////////////////////////// + +template +<typename A +,typename I // I models InputIterator +,typename F> // F models ForwardIterator +F uninitialized_copy_or_move_alloc + (A &a, I f, I l, F r + ,typename boost::container::container_detail::enable_if + < boost::move_detail::is_move_iterator<I> >::type* = 0) +{ + return ::boost::container::uninitialized_move_alloc(a, f, l, r); +} + +template +<typename A +,typename I // I models InputIterator +,typename F> // F models ForwardIterator +F uninitialized_copy_or_move_alloc + (A &a, I f, I l, F r + ,typename boost::container::container_detail::disable_if + < boost::move_detail::is_move_iterator<I> >::type* = 0) +{ + return ::boost::container::uninitialized_copy_alloc(a, f, l, r); +} + + +} //namespace container { +} //namespace boost { + + +#include <boost/container/detail/config_end.hpp> + +#endif //#ifndef BOOST_CONTAINER_DETAIL_UTILITIES_HPP diff --git a/3rdParty/Boost/src/boost/container/detail/workaround.hpp b/3rdParty/Boost/src/boost/container/detail/workaround.hpp new file mode 100644 index 0000000..7838a5d --- /dev/null +++ b/3rdParty/Boost/src/boost/container/detail/workaround.hpp @@ -0,0 +1,40 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2005-2012. 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) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_DETAIL_WORKAROUND_HPP +#define BOOST_CONTAINER_DETAIL_WORKAROUND_HPP + +#include <boost/container/detail/config_begin.hpp> + +#if !defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_NO_VARIADIC_TEMPLATES)\ + && !defined(BOOST_INTERPROCESS_DISABLE_VARIADIC_TMPL) + #define BOOST_CONTAINER_PERFECT_FORWARDING +#endif + +#if defined(BOOST_NO_NOEXCEPT) + #define BOOST_CONTAINER_NOEXCEPT + #define BOOST_CONTAINER_NOEXCEPT_IF(x) +#else + #define BOOST_CONTAINER_NOEXCEPT noexcept + #define BOOST_CONTAINER_NOEXCEPT_IF(x) noexcept(x) +#endif + +#if !defined(BOOST_NO_VARIADIC_TEMPLATES) && defined(__GXX_EXPERIMENTAL_CXX0X__)\ + && (__GNUC__*10000 + __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__ < 40700) + #define BOOST_CONTAINER_UNIMPLEMENTED_PACK_EXPANSION_TO_FIXED_LIST +#endif + +//Macros for documentation purposes. For code, expands to the argument +#define BOOST_CONTAINER_IMPDEF(TYPE) TYPE +#define BOOST_CONTAINER_SEEDOC(TYPE) TYPE + +#include <boost/container/detail/config_end.hpp> + +#endif //#ifndef BOOST_CONTAINER_DETAIL_WORKAROUND_HPP diff --git a/3rdParty/Boost/src/boost/container/scoped_allocator.hpp b/3rdParty/Boost/src/boost/container/scoped_allocator.hpp new file mode 100644 index 0000000..5111d37 --- /dev/null +++ b/3rdParty/Boost/src/boost/container/scoped_allocator.hpp @@ -0,0 +1,1466 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Pablo Halpern 2009. 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) +// +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2011-2012. 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) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_ALLOCATOR_SCOPED_ALLOCATOR_HPP +#define BOOST_CONTAINER_ALLOCATOR_SCOPED_ALLOCATOR_HPP + +#if (defined MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include <boost/container/detail/config_begin.hpp> +#include <boost/container/detail/workaround.hpp> +#include <boost/container/scoped_allocator_fwd.hpp> +#include <boost/type_traits/integral_constant.hpp> +#include <boost/container/allocator_traits.hpp> +#include <boost/container/detail/type_traits.hpp> +#include <boost/container/detail/utilities.hpp> +#include <utility> +#include <boost/container/detail/pair.hpp> +#include <boost/move/move.hpp> + + +namespace boost { namespace container { + +//! <b>Remark</b>: if a specialization is derived from true_type, indicates that T may be constructed +//! with an allocator as its last constructor argument. Ideally, all constructors of T (including the +//! copy and move constructors) should have a variant that accepts a final argument of +//! allocator_type. +//! +//! <b>Requires</b>: if a specialization is derived from true_type, T must have a nested type, +//! allocator_type and at least one constructor for which allocator_type is the last +//! parameter. If not all constructors of T can be called with a final allocator_type argument, +//! and if T is used in a context where a container must call such a constructor, then the program is +//! ill-formed. +//! +//! [Example: +//! template <class T, class Allocator = allocator<T> > +//! class Z { +//! public: +//! typedef Allocator allocator_type; +//! +//! // Default constructor with optional allocator suffix +//! Z(const allocator_type& a = allocator_type()); +//! +//! // Copy constructor and allocator-extended copy constructor +//! Z(const Z& zz); +//! Z(const Z& zz, const allocator_type& a); +//! }; +//! +//! // Specialize trait for class template Z +//! template <class T, class Allocator = allocator<T> > +//! struct constructible_with_allocator_suffix<Z<T,Allocator> > +//! : ::boost::true_type { }; +//! -- end example] +//! +//! <b>Note</b>: This trait is a workaround inspired by "N2554: The Scoped Allocator Model (Rev 2)" +//! (Pablo Halpern, 2008-02-29) to backport the scoped allocator model to C++03, as +//! in C++03 there is no mechanism to detect if a type can be constructed from arbitrary arguments. +//! Applications aiming portability with several compilers should always define this trait. +//! +//! In conforming C++11 compilers or compilers supporting SFINAE expressions +//! (when BOOST_NO_SFINAE_EXPR is NOT defined), this trait is ignored and C++11 rules will be used +//! to detect if a type should be constructed with suffix or prefix allocator arguments. +template <class T> +struct constructible_with_allocator_suffix + : ::boost::false_type +{}; + +//! <b>Remark</b>: if a specialization is derived from true_type, indicates that T may be constructed +//! with allocator_arg and T::allocator_type as its first two constructor arguments. +//! Ideally, all constructors of T (including the copy and move constructors) should have a variant +//! that accepts these two initial arguments. +//! +//! <b>Requires</b>: if a specialization is derived from true_type, T must have a nested type, +//! allocator_type and at least one constructor for which allocator_arg_t is the first +//! parameter and allocator_type is the second parameter. If not all constructors of T can be +//! called with these initial arguments, and if T is used in a context where a container must call such +//! a constructor, then the program is ill-formed. +//! +//! [Example: +//! template <class T, class Allocator = allocator<T> > +//! class Y { +//! public: +//! typedef Allocator allocator_type; +//! +//! // Default constructor with and allocator-extended default constructor +//! Y(); +//! Y(allocator_arg_t, const allocator_type& a); +//! +//! // Copy constructor and allocator-extended copy constructor +//! Y(const Y& yy); +//! Y(allocator_arg_t, const allocator_type& a, const Y& yy); +//! +//! // Variadic constructor and allocator-extended variadic constructor +//! template<class ...Args> Y(Args&& args...); +//! template<class ...Args> +//! Y(allocator_arg_t, const allocator_type& a, Args&&... args); +//! }; +//! +//! // Specialize trait for class template Y +//! template <class T, class Allocator = allocator<T> > +//! struct constructible_with_allocator_prefix<Y<T,Allocator> > +//! : ::boost::true_type { }; +//! +//! -- end example] +//! +//! <b>Note</b>: This trait is a workaround inspired by "N2554: The Scoped Allocator Model (Rev 2)" +//! (Pablo Halpern, 2008-02-29) to backport the scoped allocator model to C++03, as +//! in C++03 there is no mechanism to detect if a type can be constructed from arbitrary arguments. +//! Applications aiming portability with several compilers should always define this trait. +//! +//! In conforming C++11 compilers or compilers supporting SFINAE expressions +//! (when BOOST_NO_SFINAE_EXPR is NOT defined), this trait is ignored and C++11 rules will be used +//! to detect if a type should be constructed with suffix or prefix allocator arguments. +template <class T> +struct constructible_with_allocator_prefix + : ::boost::false_type +{}; + +///@cond + +namespace container_detail { + +template<typename T, typename Alloc> +struct uses_allocator_imp +{ + // Use SFINAE (Substitution Failure Is Not An Error) to detect the + // presence of an 'allocator_type' nested type convertilble from Alloc. + + private: + // Match this function if TypeT::allocator_type exists and is + // implicitly convertible from Alloc + template <typename U> + static char test(int, typename U::allocator_type); + + // Match this function if TypeT::allocator_type does not exist or is + // not convertible from Alloc. + template <typename U> + static int test(LowPriorityConversion<int>, LowPriorityConversion<Alloc>); + + static Alloc alloc; // Declared but not defined + + public: + enum { value = sizeof(test<T>(0, alloc)) == sizeof(char) }; +}; + +} //namespace container_detail { + +///@endcond + +//! <b>Remark</b>: Automatically detects if T has a nested allocator_type that is convertible from +//! Alloc. Meets the BinaryTypeTrait requirements ([meta.rqmts] 20.4.1). A program may +//! specialize this type to derive from true_type for a T of user-defined type if T does not +//! have a nested allocator_type but is nonetheless constructible using the specified Alloc. +//! +//! <b>Result</b>: derived from true_type if Convertible<Alloc,T::allocator_type> and +//! derived from false_type otherwise. +template <typename T, typename Alloc> +struct uses_allocator + : boost::integral_constant<bool, container_detail::uses_allocator_imp<T, Alloc>::value> +{}; + +///@cond + +namespace container_detail { + +template <typename Alloc> +struct is_scoped_allocator_imp +{ + template <typename T> + static char test(int, typename T::outer_allocator_type*); + + template <typename T> + static int test(LowPriorityConversion<int>, void*); + + static const bool value = (sizeof(char) == sizeof(test<Alloc>(0, 0))); +}; + +template<class MaybeScopedAlloc, bool = is_scoped_allocator_imp<MaybeScopedAlloc>::value > +struct outermost_allocator_type_impl +{ + typedef typename MaybeScopedAlloc::outer_allocator_type outer_type; + typedef typename outermost_allocator_type_impl<outer_type>::type type; +}; + +template<class MaybeScopedAlloc> +struct outermost_allocator_type_impl<MaybeScopedAlloc, false> +{ + typedef MaybeScopedAlloc type; +}; + +template<class MaybeScopedAlloc, bool = is_scoped_allocator_imp<MaybeScopedAlloc>::value > +struct outermost_allocator_imp +{ + typedef MaybeScopedAlloc type; + + static type &get(MaybeScopedAlloc &a) + { return a; } + + static const type &get(const MaybeScopedAlloc &a) + { return a; } +}; + +template<class MaybeScopedAlloc> +struct outermost_allocator_imp<MaybeScopedAlloc, true> +{ + typedef typename MaybeScopedAlloc::outer_allocator_type outer_type; + typedef typename outermost_allocator_type_impl<outer_type>::type type; + + static type &get(MaybeScopedAlloc &a) + { return outermost_allocator_imp<outer_type>::get(a.outer_allocator()); } + + static const type &get(const MaybeScopedAlloc &a) + { return outermost_allocator_imp<outer_type>::get(a.outer_allocator()); } +}; + +} //namespace container_detail { + +template <typename Alloc> +struct is_scoped_allocator + : boost::integral_constant<bool, container_detail::is_scoped_allocator_imp<Alloc>::value> +{}; + +template <typename Alloc> +struct outermost_allocator + : container_detail::outermost_allocator_imp<Alloc> +{}; + +template <typename Alloc> +typename container_detail::outermost_allocator_imp<Alloc>::type & + get_outermost_allocator(Alloc &a) +{ return container_detail::outermost_allocator_imp<Alloc>::get(a); } + +template <typename Alloc> +const typename container_detail::outermost_allocator_imp<Alloc>::type & + get_outermost_allocator(const Alloc &a) +{ return container_detail::outermost_allocator_imp<Alloc>::get(a); } + +namespace container_detail { + +// Check if we can detect is_convertible using advanced SFINAE expressions +#if !defined(BOOST_NO_SFINAE_EXPR) + + //! Code inspired by Mathias Gaunard's is_convertible.cpp found in the Boost mailing list + //! http://boost.2283326.n4.nabble.com/type-traits-is-constructible-when-decltype-is-supported-td3575452.html + //! Thanks Mathias! + + //With variadic templates, we need a single class to implement the trait + #if !defined(BOOST_NO_VARIADIC_TEMPLATES) + + template<class T, class ...Args> + struct is_constructible_impl + { + typedef char yes_type; + struct no_type + { char padding[2]; }; + + template<std::size_t N> + struct dummy; + + template<class X> + static yes_type test(dummy<sizeof(X(boost::move_detail::declval<Args>()...))>*); + + template<class X> + static no_type test(...); + + static const bool value = sizeof(test<T>(0)) == sizeof(yes_type); + }; + + template<class T, class ...Args> + struct is_constructible + : boost::integral_constant<bool, is_constructible_impl<T, Args...>::value> + {}; + + template <class T, class InnerAlloc, class ...Args> + struct is_constructible_with_allocator_prefix + : is_constructible<T, allocator_arg_t, InnerAlloc, Args...> + {}; + + #else // #if !defined(BOOST_NO_VARIADIC_TEMPLATES) + + //Without variadic templates, we need to use de preprocessor to generate + //some specializations. + + #define BOOST_CONTAINER_MAX_IS_CONSTRUCTIBLE_PARAMETERS \ + BOOST_PP_ADD(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, 3) + //! + + //Generate N+1 template parameters so that we can specialize N + template<class T + BOOST_PP_ENUM_TRAILING( BOOST_PP_ADD(BOOST_CONTAINER_MAX_IS_CONSTRUCTIBLE_PARAMETERS, 1) + , BOOST_CONTAINER_PP_TEMPLATE_PARAM_WITH_DEFAULT + , void) + > + struct is_constructible_impl; + + //Generate N specializations, from 0 to + //BOOST_CONTAINER_MAX_IS_CONSTRUCTIBLE_PARAMETERS parameters + #define BOOST_PP_LOCAL_MACRO(n) \ + template<class T BOOST_PP_ENUM_TRAILING_PARAMS(n, class P)> \ + struct is_constructible_impl \ + <T BOOST_PP_ENUM_TRAILING_PARAMS(n, P) \ + BOOST_PP_ENUM_TRAILING \ + ( BOOST_PP_SUB(BOOST_CONTAINER_MAX_IS_CONSTRUCTIBLE_PARAMETERS, n) \ + , BOOST_CONTAINER_PP_IDENTITY, void) \ + , void> \ + { \ + typedef char yes_type; \ + struct no_type \ + { char padding[2]; }; \ + \ + template<std::size_t N> \ + struct dummy; \ + \ + template<class X> \ + static yes_type test(dummy<sizeof(X(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_DECLVAL, ~)))>*); \ + \ + template<class X> \ + static no_type test(...); \ + \ + static const bool value = sizeof(test<T>(0)) == sizeof(yes_type); \ + }; \ + //! + + #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_IS_CONSTRUCTIBLE_PARAMETERS) + #include BOOST_PP_LOCAL_ITERATE() + + //Finally just inherit from the implementation to define he trait + template< class T + BOOST_PP_ENUM_TRAILING( BOOST_CONTAINER_MAX_IS_CONSTRUCTIBLE_PARAMETERS + , BOOST_CONTAINER_PP_TEMPLATE_PARAM_WITH_DEFAULT + , void) + > + struct is_constructible + : boost::integral_constant + < bool + , is_constructible_impl + < T + BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_IS_CONSTRUCTIBLE_PARAMETERS, P) + , void>::value + > + {}; + + //Finally just inherit from the implementation to define he trait + template <class T + ,class InnerAlloc + BOOST_PP_ENUM_TRAILING( BOOST_PP_SUB(BOOST_CONTAINER_MAX_IS_CONSTRUCTIBLE_PARAMETERS, 2) + , BOOST_CONTAINER_PP_TEMPLATE_PARAM_WITH_DEFAULT + , void) + > + struct is_constructible_with_allocator_prefix + : is_constructible + < T, allocator_arg_t, InnerAlloc + BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_SUB(BOOST_CONTAINER_MAX_IS_CONSTRUCTIBLE_PARAMETERS, 2), P) + > + {}; +/* + template <class T + ,class InnerAlloc + BOOST_PP_ENUM_TRAILING( BOOST_PP_SUB(BOOST_CONTAINER_MAX_IS_CONSTRUCTIBLE_PARAMETERS, 1) + , BOOST_CONTAINER_PP_TEMPLATE_PARAM_WITH_DEFAULT + , void) + > + struct is_constructible_with_allocator_suffix + : is_constructible + < T + BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_SUB(BOOST_CONTAINER_MAX_IS_CONSTRUCTIBLE_PARAMETERS, 1), P) + , InnerAlloc + > + {};*/ + + #endif // #if !defined(BOOST_NO_VARIADIC_TEMPLATES) + +#else // #if !defined(BOOST_NO_SFINAE_EXPR) + + //Without advanced SFINAE expressions, we can't use is_constructible + //so backup to constructible_with_allocator_xxx + + #if !defined(BOOST_NO_VARIADIC_TEMPLATES) + + template < class T, class InnerAlloc, class ...Args> + struct is_constructible_with_allocator_prefix + : constructible_with_allocator_prefix<T> + {}; +/* + template < class T, class InnerAlloc, class ...Args> + struct is_constructible_with_allocator_suffix + : constructible_with_allocator_suffix<T> + {};*/ + + #else // #if !defined(BOOST_NO_VARIADIC_TEMPLATES) + + template < class T + , class InnerAlloc + BOOST_PP_ENUM_TRAILING( BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS + , BOOST_CONTAINER_PP_TEMPLATE_PARAM_WITH_DEFAULT + , void) + > + struct is_constructible_with_allocator_prefix + : constructible_with_allocator_prefix<T> + {}; +/* + template < class T + , class InnerAlloc + BOOST_PP_ENUM_TRAILING( BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS + , BOOST_CONTAINER_PP_TEMPLATE_PARAM_WITH_DEFAULT + , void) + > + struct is_constructible_with_allocator_suffix + : constructible_with_allocator_suffix<T> + {};*/ + + #endif // #if !defined(BOOST_NO_VARIADIC_TEMPLATES) + +#endif // #if !defined(BOOST_NO_SFINAE_EXPR) + +#if !defined(BOOST_NO_VARIADIC_TEMPLATES) + +template < typename OutermostAlloc + , typename InnerAlloc + , typename T + , class ...Args + > +inline void dispatch_allocator_prefix_suffix + ( boost::true_type use_alloc_prefix, OutermostAlloc& outermost_alloc + , InnerAlloc& inner_alloc, T* p, BOOST_FWD_REF(Args) ...args) +{ + (void)use_alloc_prefix; + allocator_traits<OutermostAlloc>::construct + ( outermost_alloc, p, allocator_arg, inner_alloc, ::boost::forward<Args>(args)...); +} + +template < typename OutermostAlloc + , typename InnerAlloc + , typename T + , class ...Args + > +inline void dispatch_allocator_prefix_suffix + ( boost::false_type use_alloc_prefix, OutermostAlloc& outermost_alloc + , InnerAlloc &inner_alloc, T* p, BOOST_FWD_REF(Args)...args) +{ + (void)use_alloc_prefix; + allocator_traits<OutermostAlloc>::construct + (outermost_alloc, p, ::boost::forward<Args>(args)..., inner_alloc); +} + +template < typename OutermostAlloc + , typename InnerAlloc + , typename T + , class ...Args + > +inline void dispatch_uses_allocator + ( boost::true_type uses_allocator, OutermostAlloc& outermost_alloc + , InnerAlloc& inner_alloc, T* p, BOOST_FWD_REF(Args)...args) +{ + (void)uses_allocator; + //BOOST_STATIC_ASSERT((is_constructible_with_allocator_prefix<T, InnerAlloc, Args...>::value || + // is_constructible_with_allocator_suffix<T, InnerAlloc, Args...>::value )); + dispatch_allocator_prefix_suffix + ( is_constructible_with_allocator_prefix<T, InnerAlloc, Args...>() + , outermost_alloc, inner_alloc, p, ::boost::forward<Args>(args)...); +} + +template < typename OutermostAlloc + , typename InnerAlloc + , typename T + , class ...Args + > +inline void dispatch_uses_allocator + ( boost::false_type uses_allocator, OutermostAlloc & outermost_alloc + , InnerAlloc & inner_alloc + ,T* p, BOOST_FWD_REF(Args)...args) +{ + (void)uses_allocator; (void)inner_alloc; + allocator_traits<OutermostAlloc>::construct + (outermost_alloc, p, ::boost::forward<Args>(args)...); +} + +#else //#if !defined(BOOST_NO_VARIADIC_TEMPLATES) + +#define BOOST_PP_LOCAL_MACRO(n) \ +template < typename OutermostAlloc \ + , typename InnerAlloc \ + , typename T \ + BOOST_PP_ENUM_TRAILING_PARAMS(n, class P) \ + > \ +inline void dispatch_allocator_prefix_suffix( \ + boost::true_type use_alloc_prefix, \ + OutermostAlloc& outermost_alloc, \ + InnerAlloc& inner_alloc, \ + T* p \ + BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \ +{ \ + (void)use_alloc_prefix, \ + allocator_traits<OutermostAlloc>::construct \ + (outermost_alloc, p, allocator_arg, inner_alloc \ + BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); \ +} \ + \ +template < typename OutermostAlloc \ + , typename InnerAlloc \ + , typename T \ + BOOST_PP_ENUM_TRAILING_PARAMS(n, class P) \ + > \ +inline void dispatch_allocator_prefix_suffix( \ + boost::false_type use_alloc_prefix, \ + OutermostAlloc& outermost_alloc, \ + InnerAlloc& inner_alloc, \ + T* p BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \ +{ \ + (void)use_alloc_prefix; \ + allocator_traits<OutermostAlloc>::construct \ + (outermost_alloc, p \ + BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _) \ + , inner_alloc); \ +} \ + \ +template < typename OutermostAlloc \ + , typename InnerAlloc \ + , typename T \ + BOOST_PP_ENUM_TRAILING_PARAMS(n, class P) \ + > \ +inline void dispatch_uses_allocator(boost::true_type uses_allocator, \ + OutermostAlloc& outermost_alloc, \ + InnerAlloc& inner_alloc, \ + T* p BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \ +{ \ + (void)uses_allocator; \ + dispatch_allocator_prefix_suffix \ + (is_constructible_with_allocator_prefix \ + < T, InnerAlloc BOOST_PP_ENUM_TRAILING_PARAMS(n, P)>() \ + , outermost_alloc, inner_alloc, p \ + BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); \ +} \ + \ +template < typename OutermostAlloc \ + , typename InnerAlloc \ + , typename T \ + BOOST_PP_ENUM_TRAILING_PARAMS(n, class P) \ + > \ +inline void dispatch_uses_allocator(boost::false_type uses_allocator \ + ,OutermostAlloc & outermost_alloc \ + ,InnerAlloc & inner_alloc \ + ,T* p BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \ +{ \ + (void)uses_allocator; (void)inner_alloc; \ + allocator_traits<OutermostAlloc>::construct \ + (outermost_alloc, p BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); \ +} \ +//! +#define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS) +#include BOOST_PP_LOCAL_ITERATE() + +#endif //#if !defined(BOOST_NO_VARIADIC_TEMPLATES) + +#if !defined(BOOST_NO_VARIADIC_TEMPLATES) + +template <typename OuterAlloc, class ...InnerAllocs> +class scoped_allocator_adaptor_base + : public OuterAlloc +{ + typedef allocator_traits<OuterAlloc> outer_traits_type; + BOOST_COPYABLE_AND_MOVABLE(scoped_allocator_adaptor_base) + + public: + template <class OuterA2> + struct rebind_base + { + typedef scoped_allocator_adaptor_base<OuterA2, InnerAllocs...> other; + }; + + typedef OuterAlloc outer_allocator_type; + typedef scoped_allocator_adaptor<InnerAllocs...> inner_allocator_type; + typedef boost::integral_constant< + bool, + outer_traits_type::propagate_on_container_copy_assignment::value || + inner_allocator_type::propagate_on_container_copy_assignment::value + > propagate_on_container_copy_assignment; + typedef boost::integral_constant< + bool, + outer_traits_type::propagate_on_container_move_assignment::value || + inner_allocator_type::propagate_on_container_move_assignment::value + > propagate_on_container_move_assignment; + typedef boost::integral_constant< + bool, + outer_traits_type::propagate_on_container_swap::value || + inner_allocator_type::propagate_on_container_swap::value + > propagate_on_container_swap; + + scoped_allocator_adaptor_base() + {} + + template <class OuterA2> + scoped_allocator_adaptor_base(BOOST_FWD_REF(OuterA2) outerAlloc, const InnerAllocs &...args) + : outer_allocator_type(::boost::forward<OuterA2>(outerAlloc)) + , m_inner(args...) + {} + + scoped_allocator_adaptor_base(const scoped_allocator_adaptor_base& other) + : outer_allocator_type(other.outer_allocator()) + , m_inner(other.inner_allocator()) + {} + + scoped_allocator_adaptor_base(BOOST_RV_REF(scoped_allocator_adaptor_base) other) + : outer_allocator_type(::boost::move(other.outer_allocator())) + , m_inner(::boost::move(other.inner_allocator())) + {} + + template <class OuterA2> + scoped_allocator_adaptor_base + (const scoped_allocator_adaptor_base<OuterA2, InnerAllocs...>& other) + : outer_allocator_type(other.outer_allocator()) + , m_inner(other.inner_allocator()) + {} + + template <class OuterA2> + scoped_allocator_adaptor_base + (BOOST_RV_REF_BEG scoped_allocator_adaptor_base + <OuterA2, InnerAllocs...> BOOST_RV_REF_END other) + : outer_allocator_type(other.outer_allocator()) + , m_inner(other.inner_allocator()) + {} + + protected: + struct internal_type_t{}; + + template <class OuterA2> + scoped_allocator_adaptor_base + ( internal_type_t + , BOOST_FWD_REF(OuterA2) outerAlloc + , const inner_allocator_type &inner) + : outer_allocator_type(::boost::forward<OuterA2>(outerAlloc)) + , m_inner(inner) + {} + + public: + + scoped_allocator_adaptor_base &operator= + (BOOST_COPY_ASSIGN_REF(scoped_allocator_adaptor_base) other) + { + outer_allocator_type::operator=(other.outer_allocator()); + m_inner = other.inner_allocator(); + return *this; + } + + scoped_allocator_adaptor_base &operator=(BOOST_RV_REF(scoped_allocator_adaptor_base) other) + { + outer_allocator_type::operator=(boost::move(other.outer_allocator())); + m_inner = ::boost::move(other.inner_allocator()); + return *this; + } + + inner_allocator_type& inner_allocator() + { return m_inner; } + + inner_allocator_type const& inner_allocator() const + { return m_inner; } + + outer_allocator_type & outer_allocator() + { return static_cast<outer_allocator_type&>(*this); } + + const outer_allocator_type &outer_allocator() const + { return static_cast<const outer_allocator_type&>(*this); } + + private: + inner_allocator_type m_inner; +}; + +#else //#if !defined(BOOST_NO_VARIADIC_TEMPLATES) + +//Let's add a dummy first template parameter to allow creating +//specializations up to maximum InnerAlloc count +template < + typename OuterAlloc + , bool Dummy + BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, class Q) + > +class scoped_allocator_adaptor_base; + +//Specializations for the adaptor with InnerAlloc allocators + +#define BOOST_PP_LOCAL_MACRO(n) \ +template <typename OuterAlloc \ +BOOST_PP_ENUM_TRAILING_PARAMS(n, class Q) \ +> \ +class scoped_allocator_adaptor_base<OuterAlloc, true \ + BOOST_PP_ENUM_TRAILING_PARAMS(n, Q) \ + BOOST_PP_ENUM_TRAILING( BOOST_PP_SUB(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, n) \ + , BOOST_CONTAINER_PP_IDENTITY, nat) \ + > \ + : public OuterAlloc \ +{ \ + typedef allocator_traits<OuterAlloc> outer_traits_type; \ + BOOST_COPYABLE_AND_MOVABLE(scoped_allocator_adaptor_base) \ + \ + public: \ + template <class OuterA2> \ + struct rebind_base \ + { \ + typedef scoped_allocator_adaptor_base<OuterA2, true BOOST_PP_ENUM_TRAILING_PARAMS(n, Q) \ + BOOST_PP_ENUM_TRAILING \ + ( BOOST_PP_SUB(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, n) \ + , BOOST_CONTAINER_PP_IDENTITY, nat) \ + > other; \ + }; \ + \ + typedef OuterAlloc outer_allocator_type; \ + typedef scoped_allocator_adaptor<BOOST_PP_ENUM_PARAMS(n, Q) \ + BOOST_PP_ENUM_TRAILING \ + ( BOOST_PP_SUB(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, n) \ + , BOOST_CONTAINER_PP_IDENTITY, nat) \ + > inner_allocator_type; \ + typedef boost::integral_constant< \ + bool, \ + outer_traits_type::propagate_on_container_copy_assignment::value || \ + inner_allocator_type::propagate_on_container_copy_assignment::value \ + > propagate_on_container_copy_assignment; \ + typedef boost::integral_constant< \ + bool, \ + outer_traits_type::propagate_on_container_move_assignment::value || \ + inner_allocator_type::propagate_on_container_move_assignment::value \ + > propagate_on_container_move_assignment; \ + typedef boost::integral_constant< \ + bool, \ + outer_traits_type::propagate_on_container_swap::value || \ + inner_allocator_type::propagate_on_container_swap::value \ + > propagate_on_container_swap; \ + \ + scoped_allocator_adaptor_base() \ + {} \ + \ + template <class OuterA2> \ + scoped_allocator_adaptor_base(BOOST_FWD_REF(OuterA2) outerAlloc \ + BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_CONST_REF_PARAM_LIST_Q, _)) \ + : outer_allocator_type(::boost::forward<OuterA2>(outerAlloc)) \ + , m_inner(BOOST_PP_ENUM_PARAMS(n, q)) \ + {} \ + \ + scoped_allocator_adaptor_base(const scoped_allocator_adaptor_base& other) \ + : outer_allocator_type(other.outer_allocator()) \ + , m_inner(other.inner_allocator()) \ + {} \ + \ + scoped_allocator_adaptor_base(BOOST_RV_REF(scoped_allocator_adaptor_base) other) \ + : outer_allocator_type(::boost::move(other.outer_allocator())) \ + , m_inner(::boost::move(other.inner_allocator())) \ + {} \ + \ + template <class OuterA2> \ + scoped_allocator_adaptor_base(const scoped_allocator_adaptor_base<OuterA2, true \ + BOOST_PP_ENUM_TRAILING_PARAMS(n, Q) \ + BOOST_PP_ENUM_TRAILING \ + ( BOOST_PP_SUB(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, n) \ + , BOOST_CONTAINER_PP_IDENTITY, nat) \ + >& other) \ + : outer_allocator_type(other.outer_allocator()) \ + , m_inner(other.inner_allocator()) \ + {} \ + \ + template <class OuterA2> \ + scoped_allocator_adaptor_base \ + (BOOST_RV_REF_BEG scoped_allocator_adaptor_base<OuterA2, true \ + BOOST_PP_ENUM_TRAILING_PARAMS(n, Q) \ + BOOST_PP_ENUM_TRAILING \ + ( BOOST_PP_SUB(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, n) \ + , BOOST_CONTAINER_PP_IDENTITY, nat) \ + > BOOST_RV_REF_END other) \ + : outer_allocator_type(other.outer_allocator()) \ + , m_inner(other.inner_allocator()) \ + {} \ + \ + protected: \ + struct internal_type_t{}; \ + \ + template <class OuterA2> \ + scoped_allocator_adaptor_base \ + ( internal_type_t \ + , BOOST_FWD_REF(OuterA2) outerAlloc \ + , const inner_allocator_type &inner) \ + : outer_allocator_type(::boost::forward<OuterA2>(outerAlloc)) \ + , m_inner(inner) \ + {} \ + \ + public: \ + scoped_allocator_adaptor_base &operator= \ + (BOOST_COPY_ASSIGN_REF(scoped_allocator_adaptor_base) other) \ + { \ + outer_allocator_type::operator=(other.outer_allocator()); \ + m_inner = other.inner_allocator(); \ + return *this; \ + } \ + \ + scoped_allocator_adaptor_base &operator=(BOOST_RV_REF(scoped_allocator_adaptor_base) other) \ + { \ + outer_allocator_type::operator=(boost::move(other.outer_allocator())); \ + m_inner = ::boost::move(other.inner_allocator()); \ + return *this; \ + } \ + \ + inner_allocator_type& inner_allocator() \ + { return m_inner; } \ + \ + inner_allocator_type const& inner_allocator() const \ + { return m_inner; } \ + \ + outer_allocator_type & outer_allocator() \ + { return static_cast<outer_allocator_type&>(*this); } \ + \ + const outer_allocator_type &outer_allocator() const \ + { return static_cast<const outer_allocator_type&>(*this); } \ + \ + private: \ + inner_allocator_type m_inner; \ +}; \ +//! +#define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS) +#include BOOST_PP_LOCAL_ITERATE() + +#endif //#if !defined(BOOST_NO_VARIADIC_TEMPLATES) + +//Specialization for adaptor without any InnerAlloc +template <typename OuterAlloc> +class scoped_allocator_adaptor_base + < OuterAlloc + #if defined(BOOST_NO_VARIADIC_TEMPLATES) + , true + BOOST_PP_ENUM_TRAILING(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, BOOST_CONTAINER_PP_IDENTITY, nat) + #endif + > + : public OuterAlloc +{ + BOOST_COPYABLE_AND_MOVABLE(scoped_allocator_adaptor_base) + public: + + template <class U> + struct rebind_base + { + typedef scoped_allocator_adaptor_base + <typename allocator_traits<OuterAlloc>::template portable_rebind_alloc<U>::type + #if defined(BOOST_NO_VARIADIC_TEMPLATES) + , true + BOOST_PP_ENUM_TRAILING(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, BOOST_CONTAINER_PP_IDENTITY, container_detail::nat) + #endif + > other; + }; + + typedef OuterAlloc outer_allocator_type; + typedef allocator_traits<OuterAlloc> outer_traits_type; + typedef scoped_allocator_adaptor<OuterAlloc> inner_allocator_type; + typedef typename outer_traits_type:: + propagate_on_container_copy_assignment propagate_on_container_copy_assignment; + typedef typename outer_traits_type:: + propagate_on_container_move_assignment propagate_on_container_move_assignment; + typedef typename outer_traits_type:: + propagate_on_container_swap propagate_on_container_swap; + + scoped_allocator_adaptor_base() + {} + + template <class OuterA2> + scoped_allocator_adaptor_base(BOOST_FWD_REF(OuterA2) outerAlloc) + : outer_allocator_type(::boost::forward<OuterA2>(outerAlloc)) + {} + + scoped_allocator_adaptor_base(const scoped_allocator_adaptor_base& other) + : outer_allocator_type(other.outer_allocator()) + {} + + scoped_allocator_adaptor_base(BOOST_RV_REF(scoped_allocator_adaptor_base) other) + : outer_allocator_type(::boost::move(other.outer_allocator())) + {} + + template <class OuterA2> + scoped_allocator_adaptor_base + (const scoped_allocator_adaptor_base< + OuterA2 + #if defined(BOOST_NO_VARIADIC_TEMPLATES) + , true + BOOST_PP_ENUM_TRAILING(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, BOOST_CONTAINER_PP_IDENTITY, container_detail::nat) + #endif + >& other) + : outer_allocator_type(other.outer_allocator()) + {} + + template <class OuterA2> + scoped_allocator_adaptor_base + (BOOST_RV_REF_BEG scoped_allocator_adaptor_base< + OuterA2 + #if defined(BOOST_NO_VARIADIC_TEMPLATES) + , true + BOOST_PP_ENUM_TRAILING(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, BOOST_CONTAINER_PP_IDENTITY, container_detail::nat) + #endif + > BOOST_RV_REF_END other) + : outer_allocator_type(other.outer_allocator()) + {} + + protected: + struct internal_type_t{}; + + template <class OuterA2> + scoped_allocator_adaptor_base(internal_type_t, BOOST_FWD_REF(OuterA2) outerAlloc, const inner_allocator_type &) + : outer_allocator_type(::boost::forward<OuterA2>(outerAlloc)) + {} + + public: + scoped_allocator_adaptor_base &operator=(BOOST_COPY_ASSIGN_REF(scoped_allocator_adaptor_base) other) + { + outer_allocator_type::operator=(other.outer_allocator()); + return *this; + } + + scoped_allocator_adaptor_base &operator=(BOOST_RV_REF(scoped_allocator_adaptor_base) other) + { + outer_allocator_type::operator=(boost::move(other.outer_allocator())); + return *this; + } + + inner_allocator_type& inner_allocator() + { return static_cast<inner_allocator_type&>(*this); } + + inner_allocator_type const& inner_allocator() const + { return static_cast<const inner_allocator_type&>(*this); } + + outer_allocator_type & outer_allocator() + { return static_cast<outer_allocator_type&>(*this); } + + const outer_allocator_type &outer_allocator() const + { return static_cast<const outer_allocator_type&>(*this); } +}; + +} //namespace container_detail { + +///@endcond + +//Scoped allocator +#if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + + #if !defined(BOOST_CONTAINER_UNIMPLEMENTED_PACK_EXPANSION_TO_FIXED_LIST) + + //! This class is a C++03-compatible implementation of std::scoped_allocator_adaptor. + //! The class template scoped_allocator_adaptor is an allocator template that specifies + //! the memory resource (the outer allocator) to be used by a container (as any other + //! allocator does) and also specifies an inner allocator resource to be passed to + //! the constructor of every element within the container. + //! + //! This adaptor is + //! instantiated with one outer and zero or more inner allocator types. If + //! instantiated with only one allocator type, the inner allocator becomes the + //! scoped_allocator_adaptor itself, thus using the same allocator resource for the + //! container and every element within the container and, if the elements themselves + //! are containers, each of their elements recursively. If instantiated with more than + //! one allocator, the first allocator is the outer allocator for use by the container, + //! the second allocator is passed to the constructors of the container's elements, + //! and, if the elements themselves are containers, the third allocator is passed to + //! the elements' elements, and so on. If containers are nested to a depth greater + //! than the number of allocators, the last allocator is used repeatedly, as in the + //! single-allocator case, for any remaining recursions. + //! + //! [<b>Note</b>: The + //! scoped_allocator_adaptor is derived from the outer allocator type so it can be + //! substituted for the outer allocator type in most expressions. -end note] + //! + //! In the construct member functions, `OUTERMOST(x)` is x if x does not have + //! an `outer_allocator()` member function and + //! `OUTERMOST(x.outer_allocator())` otherwise; `OUTERMOST_ALLOC_TRAITS(x)` is + //! `allocator_traits<decltype(OUTERMOST(x))>`. + //! + //! [<b>Note</b>: `OUTERMOST(x)` and + //! `OUTERMOST_ALLOC_TRAITS(x)` are recursive operations. It is incumbent upon + //! the definition of `outer_allocator()` to ensure that the recursion terminates. + //! It will terminate for all instantiations of scoped_allocator_adaptor. -end note] + template <typename OuterAlloc, typename ...InnerAllocs> + class scoped_allocator_adaptor + + #else // #if !defined(BOOST_CONTAINER_UNIMPLEMENTED_PACK_EXPANSION_TO_FIXED_LIST) + + template <typename OuterAlloc, typename ...InnerAllocs> + class scoped_allocator_adaptor<OuterAlloc, InnerAllocs...> + + #endif // #if !defined(BOOST_CONTAINER_UNIMPLEMENTED_PACK_EXPANSION_TO_FIXED_LIST) + +#else // #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + +template <typename OuterAlloc + BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, class Q) + > +class scoped_allocator_adaptor +#endif + : public container_detail::scoped_allocator_adaptor_base + <OuterAlloc + #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + , InnerAllocs... + #else + , true BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, Q) + #endif + > +{ + BOOST_COPYABLE_AND_MOVABLE(scoped_allocator_adaptor) + + public: + /// @cond + typedef container_detail::scoped_allocator_adaptor_base + <OuterAlloc + #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + , InnerAllocs... + #else + , true BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, Q) + #endif + > base_type; + typedef typename base_type::internal_type_t internal_type_t; + /// @endcond + typedef OuterAlloc outer_allocator_type; + //! Type: For exposition only + //! + typedef allocator_traits<OuterAlloc> outer_traits_type; + //! Type: `scoped_allocator_adaptor<OuterAlloc>` if `sizeof...(InnerAllocs)` is zero; otherwise, + //! `scoped_allocator_adaptor<InnerAllocs...>`. + typedef typename base_type::inner_allocator_type inner_allocator_type; + typedef typename outer_traits_type::value_type value_type; + typedef typename outer_traits_type::size_type size_type; + typedef typename outer_traits_type::difference_type difference_type; + typedef typename outer_traits_type::pointer pointer; + typedef typename outer_traits_type::const_pointer const_pointer; + typedef typename outer_traits_type::void_pointer void_pointer; + typedef typename outer_traits_type::const_void_pointer const_void_pointer; + //! Type: `true_type` if `allocator_traits<Allocator>::propagate_on_container_copy_assignment::value` is + //! true for any `Allocator` in the set of `OuterAlloc` and `InnerAllocs...`; otherwise, false_type. + typedef typename base_type:: + propagate_on_container_copy_assignment propagate_on_container_copy_assignment; + //! Type: `true_type` if `allocator_traits<Allocator>::propagate_on_container_move_assignment::value` is + //! true for any `Allocator` in the set of `OuterAlloc` and `InnerAllocs...`; otherwise, false_type. + typedef typename base_type:: + propagate_on_container_move_assignment propagate_on_container_move_assignment; + //! Type: `true_type` if `allocator_traits<Allocator>::propagate_on_container_swap::value` is true for any + //! `Allocator` in the set of `OuterAlloc` and `InnerAllocs...`; otherwise, false_type. + typedef typename base_type:: + propagate_on_container_swap propagate_on_container_swap; + + //! Type: Rebinds scoped allocator to + //! `typedef scoped_allocator_adaptor + //! < typename outer_traits_type::template portable_rebind_alloc<U>::type + //! , InnerAllocs... >` + template <class U> + struct rebind + { + typedef scoped_allocator_adaptor + < typename outer_traits_type::template portable_rebind_alloc<U>::type + #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + , InnerAllocs... + #else + BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, Q) + #endif + > other; + }; + + //! <b>Effects</b>: value-initializes the OuterAlloc base class + //! and the inner allocator object. + scoped_allocator_adaptor() + {} + + ~scoped_allocator_adaptor() + {} + + //! <b>Effects</b>: initializes each allocator within the adaptor with + //! the corresponding allocator from other. + scoped_allocator_adaptor(const scoped_allocator_adaptor& other) + : base_type(other.base()) + {} + + //! <b>Effects</b>: move constructs each allocator within the adaptor with + //! the corresponding allocator from other. + scoped_allocator_adaptor(BOOST_RV_REF(scoped_allocator_adaptor) other) + : base_type(::boost::move(other.base())) + {} + + #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + + //! <b>Requires</b>: OuterAlloc shall be constructible from OuterA2. + //! + //! <b>Effects</b>: initializes the OuterAlloc base class with boost::forward<OuterA2>(outerAlloc) and inner + //! with innerAllocs...(hence recursively initializing each allocator within the adaptor with the + //! corresponding allocator from the argument list). + template <class OuterA2> + scoped_allocator_adaptor(BOOST_FWD_REF(OuterA2) outerAlloc, const InnerAllocs & ...innerAllocs) + : base_type(::boost::forward<OuterA2>(outerAlloc), innerAllocs...) + {} + #else // #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + + #define BOOST_PP_LOCAL_MACRO(n) \ + template <class OuterA2> \ + scoped_allocator_adaptor(BOOST_FWD_REF(OuterA2) outerAlloc \ + BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_CONST_REF_PARAM_LIST_Q, _)) \ + : base_type(::boost::forward<OuterA2>(outerAlloc) \ + BOOST_PP_ENUM_TRAILING_PARAMS(n, q) \ + ) \ + {} \ + //! + #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS) + #include BOOST_PP_LOCAL_ITERATE() + + #endif // #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + + //! <b>Requires</b>: OuterAlloc shall be constructible from OuterA2. + //! + //! <b>Effects</b>: initializes each allocator within the adaptor with the corresponding allocator from other. + template <class OuterA2> + scoped_allocator_adaptor(const scoped_allocator_adaptor<OuterA2 + #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + , InnerAllocs... + #else + BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, Q) + #endif + > &other) + : base_type(other.base()) + {} + + //! <b>Requires</b>: OuterAlloc shall be constructible from OuterA2. + //! + //! <b>Effects</b>: initializes each allocator within the adaptor with the corresponding allocator + //! rvalue from other. + template <class OuterA2> + scoped_allocator_adaptor(BOOST_RV_REF_BEG scoped_allocator_adaptor<OuterA2 + #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + , InnerAllocs... + #else + BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, Q) + #endif + > BOOST_RV_REF_END other) + : base_type(::boost::move(other.base())) + {} + + scoped_allocator_adaptor &operator=(BOOST_COPY_ASSIGN_REF(scoped_allocator_adaptor) other) + { + base_type::operator=(static_cast<const base_type &>(other)); + return *this; + } + + scoped_allocator_adaptor &operator=(BOOST_RV_REF(scoped_allocator_adaptor) other) + { + base_type::operator=(boost::move(static_cast<scoped_allocator_adaptor&>(other))); + return *this; + } + + //! <b>Returns</b>: + //! `static_cast<OuterAlloc&>(*this)`. + outer_allocator_type & outer_allocator() + { return *this; } + + //! <b>Returns</b>: + //! `static_cast<const OuterAlloc&>(*this)`. + const outer_allocator_type &outer_allocator() const + { return *this; } + + //! <b>Returns</b>: + //! *this if `sizeof...(InnerAllocs)` is zero; otherwise, inner. + inner_allocator_type& inner_allocator() + { return base_type::inner_allocator(); } + + //! <b>Returns</b>: + //! *this if `sizeof...(InnerAllocs)` is zero; otherwise, inner. + inner_allocator_type const& inner_allocator() const + { return base_type::inner_allocator(); } + + //! <b>Returns</b>: + //! `allocator_traits<OuterAlloc>::max_size(outer_allocator())`. + size_type max_size() const + { + return outer_traits_type::max_size(this->outer_allocator()); + } + + //! <b>Effects</b>: + //! calls `OUTERMOST_ALLOC_TRAITS(*this)::destroy(OUTERMOST(*this), p)`. + template <class T> + void destroy(T* p) + { + allocator_traits<typename outermost_allocator<OuterAlloc>::type> + ::destroy(get_outermost_allocator(this->outer_allocator()), p); + } + + //! <b>Returns</b>: + //! `allocator_traits<OuterAlloc>::allocate(outer_allocator(), n)`. + pointer allocate(size_type n) + { + return outer_traits_type::allocate(this->outer_allocator(), n); + } + + //! <b>Returns</b>: + //! `allocator_traits<OuterAlloc>::allocate(outer_allocator(), n, hint)`. + pointer allocate(size_type n, const_void_pointer hint) + { + return outer_traits_type::allocate(this->outer_allocator(), n, hint); + } + + //! <b>Effects</b>: + //! `allocator_traits<OuterAlloc>::deallocate(outer_allocator(), p, n)`. + void deallocate(pointer p, size_type n) + { + outer_traits_type::deallocate(this->outer_allocator(), p, n); + } + + //! <b>Returns</b>: Allocator new scoped_allocator_adaptor object where each allocator + //! A in the adaptor is initialized from the result of calling + //! `allocator_traits<Allocator>::select_on_container_copy_construction()` on + //! the corresponding allocator in *this. + scoped_allocator_adaptor select_on_container_copy_construction() const + { + return scoped_allocator_adaptor + (internal_type_t() + ,outer_traits_type::select_on_container_copy_construction(this->outer_allocator()) + ,outer_traits_type::select_on_container_copy_construction(this->inner_allocator()) + ); + } + /// @cond + base_type &base() { return *this; } + + const base_type &base() const { return *this; } + /// @endcond + + #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + + //! <b>Effects</b>: + //! 1) If `uses_allocator<T, inner_allocator_type>::value` is false calls + //! `OUTERMOST_ALLOC_TRAITS(*this)::construct + //! (OUTERMOST(*this), p, std::forward<Args>(args)...)`. + //! + //! 2) Otherwise, if `uses_allocator<T, inner_allocator_type>::value` is true and + //! `is_constructible<T, allocator_arg_t, inner_allocator_type, Args...>::value` is true, calls + //! `OUTERMOST_ALLOC_TRAITS(*this)::construct(OUTERMOST(*this), p, allocator_arg, + //! inner_allocator(), std::forward<Args>(args)...)`. + //! + //! [<b>Note</b>: In compilers without advanced decltype SFINAE support, `is_constructible` can't + //! be implemented so that condition will be replaced by + //! constructible_with_allocator_prefix<T>::value. -end note] + //! + //! 3) Otherwise, if uses_allocator<T, inner_allocator_type>::value is true and + //! `is_constructible<T, Args..., inner_allocator_type>::value` is true, calls + //! `OUTERMOST_ALLOC_TRAITS(*this)::construct(OUTERMOST(*this), p, + //! std::forward<Args>(args)..., inner_allocator())`. + //! + //! [<b>Note</b>: In compilers without advanced decltype SFINAE support, `is_constructible` can't be + //! implemented so that condition will be replaced by + //! `constructible_with_allocator_suffix<T>::value`. -end note] + //! + //! 4) Otherwise, the program is ill-formed. + //! + //! [<b>Note</b>: An error will result if `uses_allocator` evaluates + //! to true but the specific constructor does not take an allocator. This definition prevents a silent + //! failure to pass an inner allocator to a contained element. -end note] + template < typename T, class ...Args> + #if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + void + #else + typename container_detail::enable_if_c<!container_detail::is_pair<T>::value, void>::type + #endif + construct(T* p, BOOST_FWD_REF(Args)...args) + { + container_detail::dispatch_uses_allocator + ( uses_allocator<T, inner_allocator_type>() + , get_outermost_allocator(this->outer_allocator()) + , this->inner_allocator() + , p, ::boost::forward<Args>(args)...); + } + + #else // #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + + //Disable this overload if the first argument is pair as some compilers have + //overload selection problems when the first parameter is a pair. + #define BOOST_PP_LOCAL_MACRO(n) \ + template < typename T \ + BOOST_PP_ENUM_TRAILING_PARAMS(n, class P) \ + > \ + typename container_detail::enable_if_c<!container_detail::is_pair<T>::value, void>::type \ + construct(T* p BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \ + { \ + container_detail::dispatch_uses_allocator \ + ( uses_allocator<T, inner_allocator_type>() \ + , get_outermost_allocator(this->outer_allocator()) \ + , this->inner_allocator() \ + , p BOOST_PP_ENUM_TRAILING(n, BOOST_CONTAINER_PP_PARAM_FORWARD, _)); \ + } \ + //! + #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS) + #include BOOST_PP_LOCAL_ITERATE() + + #endif // #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + + template <class T1, class T2> + void construct(std::pair<T1,T2>* p) + { this->construct_pair(p); } + + template <class T1, class T2> + void construct(container_detail::pair<T1,T2>* p) + { this->construct_pair(p); } + + template <class T1, class T2, class U, class V> + void construct(std::pair<T1, T2>* p, BOOST_FWD_REF(U) x, BOOST_FWD_REF(V) y) + { this->construct_pair(p, ::boost::forward<U>(x), ::boost::forward<V>(y)); } + + template <class T1, class T2, class U, class V> + void construct(container_detail::pair<T1, T2>* p, BOOST_FWD_REF(U) x, BOOST_FWD_REF(V) y) + { this->construct_pair(p, ::boost::forward<U>(x), ::boost::forward<V>(y)); } + + template <class T1, class T2, class U, class V> + void construct(std::pair<T1, T2>* p, const std::pair<U, V>& x) + { this->construct_pair(p, x); } + + template <class T1, class T2, class U, class V> + void construct( container_detail::pair<T1, T2>* p + , const container_detail::pair<U, V>& x) + { this->construct_pair(p, x); } + + template <class T1, class T2, class U, class V> + void construct( std::pair<T1, T2>* p + , BOOST_RV_REF_BEG std::pair<U, V> BOOST_RV_REF_END x) + { this->construct_pair(p, x); } + + template <class T1, class T2, class U, class V> + void construct( container_detail::pair<T1, T2>* p + , BOOST_RV_REF_BEG container_detail::pair<U, V> BOOST_RV_REF_END x) + { this->construct_pair(p, x); } + + /// @cond + private: + template <class Pair> + void construct_pair(Pair* p) + { + this->construct(container_detail::addressof(p->first)); + try { + this->construct(container_detail::addressof(p->second)); + } + catch (...) { + this->destroy(container_detail::addressof(p->first)); + throw; + } + } + + template <class Pair, class U, class V> + void construct_pair(Pair* p, BOOST_FWD_REF(U) x, BOOST_FWD_REF(V) y) + { + this->construct(container_detail::addressof(p->first), ::boost::forward<U>(x)); + try { + this->construct(container_detail::addressof(p->second), ::boost::forward<V>(y)); + } + catch (...) { + this->destroy(container_detail::addressof(p->first)); + throw; + } + } + + template <class Pair, class Pair2> + void construct_pair(Pair* p, const Pair2& pr) + { + this->construct(container_detail::addressof(p->first), pr.first); + try { + this->construct(container_detail::addressof(p->second), pr.second); + } + catch (...) { + this->destroy(container_detail::addressof(p->first)); + throw; + } + } + + template <class Pair, class Pair2> + void construct_pair(Pair* p, BOOST_RV_REF(Pair2) pr) + { + this->construct(container_detail::addressof(p->first), ::boost::move(pr.first)); + try { + this->construct(container_detail::addressof(p->second), ::boost::move(pr.second)); + } + catch (...) { + this->destroy(container_detail::addressof(p->first)); + throw; + } + } + + //template <class T1, class T2, class... Args1, class... Args2> + //void construct(pair<T1, T2>* p, piecewise_construct_t, tuple<Args1...> x, tuple<Args2...> y); + + private: + template <class OuterA2> + scoped_allocator_adaptor(internal_type_t, BOOST_FWD_REF(OuterA2) outer, const inner_allocator_type& inner) + : base_type(internal_type_t(), ::boost::forward<OuterA2>(outer), inner) + {} + + /// @endcond +}; + +template <typename OuterA1, typename OuterA2 + #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + , typename... InnerAllocs + #else + BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, class Q) + #endif + > +inline bool operator==( + const scoped_allocator_adaptor<OuterA1 + #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + ,InnerAllocs... + #else + BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, Q) + #endif + >& a, + const scoped_allocator_adaptor<OuterA2 + #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + ,InnerAllocs... + #else + BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, Q) + #endif + >& b) +{ + #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + const bool has_zero_inner = sizeof...(InnerAllocs) == 0u; + #else + const bool has_zero_inner = + boost::container::container_detail::is_same + <Q0, container_detail::nat>::value; + #endif + + return a.outer_allocator() == b.outer_allocator() + && (has_zero_inner || a.inner_allocator() == b.inner_allocator()); +} + +template <typename OuterA1, typename OuterA2 + #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + , typename... InnerAllocs + #else + BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, class Q) + #endif + > +inline bool operator!=( + const scoped_allocator_adaptor<OuterA1 + #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + ,InnerAllocs... + #else + BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, Q) + #endif + >& a, + const scoped_allocator_adaptor<OuterA2 + #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) + ,InnerAllocs... + #else + BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, Q) + #endif + >& b) +{ + return ! (a == b); +} + +}} // namespace boost { namespace container { + +#include <boost/container/detail/config_end.hpp> + +#endif // BOOST_CONTAINER_ALLOCATOR_SCOPED_ALLOCATOR_HPP diff --git a/3rdParty/Boost/src/boost/container/scoped_allocator_fwd.hpp b/3rdParty/Boost/src/boost/container/scoped_allocator_fwd.hpp new file mode 100644 index 0000000..0814a50 --- /dev/null +++ b/3rdParty/Boost/src/boost/container/scoped_allocator_fwd.hpp @@ -0,0 +1,83 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2011-2012. 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) +// +// See http://www.boost.org/libs/container for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_CONTAINER_ALLOCATOR_SCOPED_ALLOCATOR_FWD_HPP +#define BOOST_CONTAINER_ALLOCATOR_SCOPED_ALLOCATOR_FWD_HPP + +#if (defined MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include <boost/container/detail/config_begin.hpp> +#include <boost/container/detail/workaround.hpp> + +#if defined(BOOST_NO_VARIADIC_TEMPLATES) +#include <boost/container/detail/preprocessor.hpp> +#include <boost/container/detail/type_traits.hpp> +#endif + +namespace boost { namespace container { + +///@cond + +#if !defined(BOOST_NO_VARIADIC_TEMPLATES) + + #if !defined(BOOST_CONTAINER_UNIMPLEMENTED_PACK_EXPANSION_TO_FIXED_LIST) + + template <typename OuterAlloc, typename ...InnerAllocs> + class scoped_allocator_adaptor; + + #else // #if !defined(BOOST_CONTAINER_UNIMPLEMENTED_PACK_EXPANSION_TO_FIXED_LIST) + + template <typename ...InnerAllocs> + class scoped_allocator_adaptor; + + template <typename OuterAlloc, typename ...InnerAllocs> + class scoped_allocator_adaptor<OuterAlloc, InnerAllocs...>; + + #endif // #if !defined(BOOST_CONTAINER_UNIMPLEMENTED_PACK_EXPANSION_TO_FIXED_LIST) + + +#else // #if !defined(BOOST_NO_VARIADIC_TEMPLATES) + +template <typename OuterAlloc +BOOST_PP_ENUM_TRAILING( BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS + , BOOST_CONTAINER_PP_TEMPLATE_PARAM_WITH_DEFAULT, container_detail::nat) +> +class scoped_allocator_adaptor; + +#endif + +///@endcond + +//! The allocator_arg_t struct is an empty structure type used as a unique type to +//! disambiguate constructor and function overloading. Specifically, several types +//! have constructors with allocator_arg_t as the first argument, immediately followed +//! by an argument of a type that satisfies the Allocator requirements +struct allocator_arg_t{}; + +//! A instance of type allocator_arg_t +//! +static const allocator_arg_t allocator_arg = allocator_arg_t(); + +template <class T> +struct constructible_with_allocator_suffix; + +template <class T> +struct constructible_with_allocator_prefix; + +template <typename T, typename Alloc> +struct uses_allocator; + +}} // namespace boost { namespace container { + +#include <boost/container/detail/config_end.hpp> + +#endif // BOOST_CONTAINER_ALLOCATOR_SCOPED_ALLOCATOR_FWD_HPP diff --git a/3rdParty/Boost/src/boost/current_function.hpp b/3rdParty/Boost/src/boost/current_function.hpp index aa5756e..cb36e35 100644 --- a/3rdParty/Boost/src/boost/current_function.hpp +++ b/3rdParty/Boost/src/boost/current_function.hpp @@ -28,7 +28,7 @@ namespace detail inline void current_function_helper() { -#if defined(__GNUC__) || (defined(__MWERKS__) && (__MWERKS__ >= 0x3000)) || (defined(__ICC) && (__ICC >= 600)) +#if defined(__GNUC__) || (defined(__MWERKS__) && (__MWERKS__ >= 0x3000)) || (defined(__ICC) && (__ICC >= 600)) || defined(__ghs__) # define BOOST_CURRENT_FUNCTION __PRETTY_FUNCTION__ @@ -65,3 +65,4 @@ inline void current_function_helper() } // namespace boost #endif // #ifndef BOOST_CURRENT_FUNCTION_HPP_INCLUDED + diff --git a/3rdParty/Boost/src/boost/date_time/adjust_functors.hpp b/3rdParty/Boost/src/boost/date_time/adjust_functors.hpp index 7854ae4..dde8ca8 100644 --- a/3rdParty/Boost/src/boost/date_time/adjust_functors.hpp +++ b/3rdParty/Boost/src/boost/date_time/adjust_functors.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ #include "boost/date_time/date.hpp" diff --git a/3rdParty/Boost/src/boost/date_time/c_local_time_adjustor.hpp b/3rdParty/Boost/src/boost/date_time/c_local_time_adjustor.hpp index f802582..45e96d3 100644 --- a/3rdParty/Boost/src/boost/date_time/c_local_time_adjustor.hpp +++ b/3rdParty/Boost/src/boost/date_time/c_local_time_adjustor.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $ + * $Date: 2008-11-12 11:37:53 -0800 (Wed, 12 Nov 2008) $ */ /*! @file c_local_time_adjustor.hpp diff --git a/3rdParty/Boost/src/boost/date_time/c_time.hpp b/3rdParty/Boost/src/boost/date_time/c_time.hpp index 24ccfe5..f7e116b 100644 --- a/3rdParty/Boost/src/boost/date_time/c_time.hpp +++ b/3rdParty/Boost/src/boost/date_time/c_time.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2010-01-10 14:17:23 -0500 (Sun, 10 Jan 2010) $ + * $Date: 2012-09-22 09:04:10 -0700 (Sat, 22 Sep 2012) $ */ @@ -57,7 +57,15 @@ namespace date_time { static std::tm* localtime(const std::time_t* t, std::tm* result) { // localtime_r() not in namespace std??? + #if defined(__VMS) && __INITIAL_POINTER_SIZE == 64 + std::tm tmp; + if(!localtime_r(t,&tmp)) + result = 0; + else + *result = tmp; + #else result = localtime_r(t, result); + #endif if (!result) boost::throw_exception(std::runtime_error("could not convert calendar time to local time")); return result; @@ -67,7 +75,15 @@ namespace date_time { static std::tm* gmtime(const std::time_t* t, std::tm* result) { // gmtime_r() not in namespace std??? + #if defined(__VMS) && __INITIAL_POINTER_SIZE == 64 + std::tm tmp; + if(!gmtime_r(t,&tmp)) + result = 0; + else + *result = tmp; + #else result = gmtime_r(t, result); + #endif if (!result) boost::throw_exception(std::runtime_error("could not convert calendar time to UTC time")); return result; diff --git a/3rdParty/Boost/src/boost/date_time/compiler_config.hpp b/3rdParty/Boost/src/boost/date_time/compiler_config.hpp index 0dc893f..1aa1330 100644 --- a/3rdParty/Boost/src/boost/date_time/compiler_config.hpp +++ b/3rdParty/Boost/src/boost/date_time/compiler_config.hpp @@ -5,7 +5,7 @@ * Subject to the Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $ + * $Date: 2011-07-26 10:40:21 -0700 (Tue, 26 Jul 2011) $ */ #include <cstdlib> @@ -118,20 +118,18 @@ namespace std { * */ -#ifdef BOOST_HAS_DECLSPEC // defined in config system - // we need to import/export our code only if the user has specifically - // asked for it by defining either BOOST_ALL_DYN_LINK if they want all boost - // libraries to be dynamically linked, or BOOST_DATE_TIME_DYN_LINK - // if they want just this one to be dynamically liked: -# if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_DATE_TIME_DYN_LINK) - // export if this is our own source, otherwise import: -# ifdef BOOST_DATE_TIME_SOURCE -# define BOOST_DATE_TIME_DECL __declspec(dllexport) -# else -# define BOOST_DATE_TIME_DECL __declspec(dllimport) -# endif // BOOST_DATE_TIME_SOURCE -# endif // DYN_LINK -#endif // BOOST_HAS_DECLSPEC +// we need to import/export our code only if the user has specifically +// asked for it by defining either BOOST_ALL_DYN_LINK if they want all boost +// libraries to be dynamically linked, or BOOST_DATE_TIME_DYN_LINK +// if they want just this one to be dynamically liked: +#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_DATE_TIME_DYN_LINK) + // export if this is our own source, otherwise import: +# ifdef BOOST_DATE_TIME_SOURCE +# define BOOST_DATE_TIME_DECL BOOST_SYMBOL_EXPORT +# else +# define BOOST_DATE_TIME_DECL BOOST_SYMBOL_IMPORT +# endif // BOOST_DATE_TIME_SOURCE +#endif // DYN_LINK // // if BOOST_WHATEVER_DECL isn't defined yet define it now: #ifndef BOOST_DATE_TIME_DECL diff --git a/3rdParty/Boost/src/boost/date_time/constrained_value.hpp b/3rdParty/Boost/src/boost/date_time/constrained_value.hpp index b273dd5..7338105 100644 --- a/3rdParty/Boost/src/boost/date_time/constrained_value.hpp +++ b/3rdParty/Boost/src/boost/date_time/constrained_value.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland - * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $ + * $Date: 2008-11-12 11:37:53 -0800 (Wed, 12 Nov 2008) $ */ #include <exception> diff --git a/3rdParty/Boost/src/boost/date_time/date.hpp b/3rdParty/Boost/src/boost/date_time/date.hpp index 1056fb6..f77ae29 100644 --- a/3rdParty/Boost/src/boost/date_time/date.hpp +++ b/3rdParty/Boost/src/boost/date_time/date.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2010-01-10 14:17:23 -0500 (Sun, 10 Jan 2010) $ + * $Date: 2012-09-22 15:33:33 -0700 (Sat, 22 Sep 2012) $ */ #include <boost/operators.hpp> @@ -191,8 +191,8 @@ namespace date_time { dates. It is not exposed to users since that would require class users to understand the inner workings of the date class. */ - explicit date(date_int_type days) : days_(days) {}; - explicit date(date_rep_type days) : days_(days.as_number()) {}; + explicit date(date_int_type days) : days_(days) {} + explicit date(date_rep_type days) : days_(days.as_number()) {} date_int_type days_; }; diff --git a/3rdParty/Boost/src/boost/date_time/date_clock_device.hpp b/3rdParty/Boost/src/boost/date_time/date_clock_device.hpp index 6ccb26e..6202f6c 100644 --- a/3rdParty/Boost/src/boost/date_time/date_clock_device.hpp +++ b/3rdParty/Boost/src/boost/date_time/date_clock_device.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ #include "boost/date_time/c_time.hpp" diff --git a/3rdParty/Boost/src/boost/date_time/date_defs.hpp b/3rdParty/Boost/src/boost/date_time/date_defs.hpp index bc25b56..ae7e4c5 100644 --- a/3rdParty/Boost/src/boost/date_time/date_defs.hpp +++ b/3rdParty/Boost/src/boost/date_time/date_defs.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ diff --git a/3rdParty/Boost/src/boost/date_time/date_duration.hpp b/3rdParty/Boost/src/boost/date_time/date_duration.hpp index 3871aac..c573944 100644 --- a/3rdParty/Boost/src/boost/date_time/date_duration.hpp +++ b/3rdParty/Boost/src/boost/date_time/date_duration.hpp @@ -2,11 +2,11 @@ #define DATE_TIME_DATE_DURATION__ /* Copyright (c) 2002,2003 CrystalClear Software, Inc. - * Use, modification and distribution is subject to the + * Use, modification and distribution is subject to the * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $ + * $Date: 2012-09-22 15:33:33 -0700 (Sat, 22 Sep 2012) $ */ @@ -26,14 +26,14 @@ namespace date_time { , boost::subtractable1< date_duration< duration_rep_traits > , boost::dividable2< date_duration< duration_rep_traits >, int > > > > > - { + { public: typedef typename duration_rep_traits::int_type duration_rep_type; typedef typename duration_rep_traits::impl_type duration_rep; - + //! Construct from a day count - explicit date_duration(duration_rep day_count) : days_(day_count) {}; - + explicit date_duration(duration_rep day_count) : days_(day_count) {} + /*! construct from special_values - only works when * instantiated with duration_traits_adapted */ date_duration(special_values sv) : @@ -125,7 +125,7 @@ namespace date_time { { typedef long int_type; typedef long impl_type; - static int_type as_number(impl_type i) { return i; }; + static int_type as_number(impl_type i) { return i; } }; /*! Struct for instantiating date_duration <b>WITH</b> special values @@ -135,9 +135,9 @@ namespace date_time { { typedef long int_type; typedef boost::date_time::int_adapter<long> impl_type; - static int_type as_number(impl_type i) { return i.as_number(); }; + static int_type as_number(impl_type i) { return i.as_number(); } }; - + } } //namspace date_time diff --git a/3rdParty/Boost/src/boost/date_time/date_duration_types.hpp b/3rdParty/Boost/src/boost/date_time/date_duration_types.hpp index 1512c0e..e44c59f 100644 --- a/3rdParty/Boost/src/boost/date_time/date_duration_types.hpp +++ b/3rdParty/Boost/src/boost/date_time/date_duration_types.hpp @@ -6,7 +6,7 @@ * (See accompanying file LICENSE_1_0.txt or * http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ #include <boost/date_time/int_adapter.hpp> diff --git a/3rdParty/Boost/src/boost/date_time/date_facet.hpp b/3rdParty/Boost/src/boost/date_time/date_facet.hpp index 3eda4c7..fc2ddc2 100644 --- a/3rdParty/Boost/src/boost/date_time/date_facet.hpp +++ b/3rdParty/Boost/src/boost/date_time/date_facet.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Martin Andrian, Jeff Garland, Bart Garst - * $Date: 2009-06-04 07:40:18 -0400 (Thu, 04 Jun 2009) $ + * $Date: 2012-09-30 16:25:22 -0700 (Sun, 30 Sep 2012) $ */ #include <locale> @@ -208,7 +208,8 @@ namespace boost { namespace date_time { // return do_put_special(next, a_ios, fill_char, d.as_special()); //} //The following line of code required the date to support a to_tm function - std::tm dtm = {}; + std::tm dtm; + std::memset(&dtm, 0, sizeof(dtm)); dtm.tm_mon = m - 1; return do_put_tm(next, a_ios, fill_char, dtm, m_month_format); } @@ -219,7 +220,8 @@ namespace boost { namespace date_time { char_type fill_char, const day_type& day) const { - std::tm dtm = {}; + std::tm dtm; + std::memset(&dtm, 0, sizeof(dtm)); dtm.tm_mday = day.as_number(); char_type tmp[3] = {'%','d'}; string_type temp_format(tmp); @@ -235,7 +237,8 @@ namespace boost { namespace date_time { // return do_put_special(next, a_ios, fill_char, d.as_special()); //} //The following line of code required the date to support a to_tm function - std::tm dtm = {}; + std::tm dtm; + std::memset(&dtm, 0, sizeof(dtm)); dtm.tm_wday = dow; return do_put_tm(next, a_ios, fill_char, dtm, m_weekday_format); } diff --git a/3rdParty/Boost/src/boost/date_time/date_format_simple.hpp b/3rdParty/Boost/src/boost/date_time/date_format_simple.hpp index be21ce4..05119c4 100644 --- a/3rdParty/Boost/src/boost/date_time/date_format_simple.hpp +++ b/3rdParty/Boost/src/boost/date_time/date_format_simple.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ #include "boost/date_time/parse_format_base.hpp" diff --git a/3rdParty/Boost/src/boost/date_time/date_formatting.hpp b/3rdParty/Boost/src/boost/date_time/date_formatting.hpp index abe547a..06709bc 100644 --- a/3rdParty/Boost/src/boost/date_time/date_formatting.hpp +++ b/3rdParty/Boost/src/boost/date_time/date_formatting.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2012-09-30 16:25:22 -0700 (Sun, 30 Sep 2012) $ */ #include "boost/date_time/iso_format.hpp" @@ -54,7 +54,9 @@ namespace date_time { os << std::setw(2) << std::setfill(os.widen('0')) << month.as_number(); break; } - + default: + break; + } return os; } // format_month @@ -79,7 +81,13 @@ namespace date_time { { typedef typename ymd_type::month_type month_type; std::basic_ostringstream<charT> ss; + + // Temporarily switch to classic locale to prevent possible formatting + // of year with comma or other character (for example 2,008). + ss.imbue(std::locale::classic()); ss << ymd.year; + ss.imbue(std::locale()); + if (format_type::has_date_sep_chars()) { ss << format_type::month_sep_char(); } diff --git a/3rdParty/Boost/src/boost/date_time/date_formatting_limited.hpp b/3rdParty/Boost/src/boost/date_time/date_formatting_limited.hpp index 38fee07..5721473 100644 --- a/3rdParty/Boost/src/boost/date_time/date_formatting_limited.hpp +++ b/3rdParty/Boost/src/boost/date_time/date_formatting_limited.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ #include "boost/date_time/iso_format.hpp" diff --git a/3rdParty/Boost/src/boost/date_time/date_formatting_locales.hpp b/3rdParty/Boost/src/boost/date_time/date_formatting_locales.hpp index 4ac9c4e..e3aec49 100644 --- a/3rdParty/Boost/src/boost/date_time/date_formatting_locales.hpp +++ b/3rdParty/Boost/src/boost/date_time/date_formatting_locales.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ diff --git a/3rdParty/Boost/src/boost/date_time/date_generator_formatter.hpp b/3rdParty/Boost/src/boost/date_time/date_generator_formatter.hpp index 88cd7e1..159cf36 100644 --- a/3rdParty/Boost/src/boost/date_time/date_generator_formatter.hpp +++ b/3rdParty/Boost/src/boost/date_time/date_generator_formatter.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-11-13 14:05:31 -0500 (Thu, 13 Nov 2008) $ + * $Date: 2008-11-13 11:05:31 -0800 (Thu, 13 Nov 2008) $ */ #include <iostream> diff --git a/3rdParty/Boost/src/boost/date_time/date_generator_parser.hpp b/3rdParty/Boost/src/boost/date_time/date_generator_parser.hpp index f11eb42..7cff9ca 100644 --- a/3rdParty/Boost/src/boost/date_time/date_generator_parser.hpp +++ b/3rdParty/Boost/src/boost/date_time/date_generator_parser.hpp @@ -7,7 +7,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $ + * $Date: 2008-11-12 11:37:53 -0800 (Wed, 12 Nov 2008) $ */ #include <string> diff --git a/3rdParty/Boost/src/boost/date_time/date_generators.hpp b/3rdParty/Boost/src/boost/date_time/date_generators.hpp index 1f1a34a..6d3a4ac 100644 --- a/3rdParty/Boost/src/boost/date_time/date_generators.hpp +++ b/3rdParty/Boost/src/boost/date_time/date_generators.hpp @@ -2,11 +2,11 @@ #define DATE_TIME_DATE_GENERATORS_HPP__ /* Copyright (c) 2002,2003,2005 CrystalClear Software, Inc. - * Use, modification and distribution is subject to the + * Use, modification and distribution is subject to the * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) - * Author: Jeff Garland, Bart Garst - * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $ + * Author: Jeff Garland, Bart Garst + * $Date: 2012-09-22 15:33:33 -0700 (Sat, 22 Sep 2012) $ */ /*! @file date_generators.hpp @@ -34,16 +34,16 @@ namespace date_time { public: typedef typename date_type::calendar_type calendar_type; typedef typename calendar_type::year_type year_type; - year_based_generator() {}; - virtual ~year_based_generator() {}; + year_based_generator() {} + virtual ~year_based_generator() {} virtual date_type get_date(year_type y) const = 0; //! Returns a string for use in a POSIX time_zone string virtual std::string to_string() const =0; }; - + //! Generates a date by applying the year to the given month and day. /*! - Example usage: + Example usage: @code partial_date pd(1, Jan); partial_date pd2(70); @@ -123,9 +123,9 @@ namespace date_time { //months are equal return (day_ < rhs.day_); } - + // added for streaming purposes - month_type month() const + month_type month() const { return month_; } @@ -135,15 +135,15 @@ namespace date_time { } //! Returns string suitable for use in POSIX time zone string - /*! Returns string formatted with up to 3 digits: - * Jan-01 == "0" + /*! Returns string formatted with up to 3 digits: + * Jan-01 == "0" * Feb-29 == "58" * Dec-31 == "365" */ virtual std::string to_string() const { std::ostringstream ss; date_type d(2004, month_, day_); - unsigned short c = d.day_of_year(); + unsigned short c = d.day_of_year(); c--; // numbered 0-365 while day_of_year is 1 based... ss << c; return ss.str(); @@ -161,7 +161,7 @@ namespace date_time { /*! Based on the idea in Cal. Calc. for finding holidays that are * the 'first Monday of September'. When instantiated with * 'fifth' kday of month, the result will be the last kday of month - * which can be the fourth or fifth depending on the structure of + * which can be the fourth or fifth depending on the structure of * the month. * * The algorithm here basically guesses for the first @@ -169,8 +169,8 @@ namespace date_time { * type. That is, if the first of the month is a Tuesday * and it needs Wenesday then we simply increment by a day * and then we can add the length of a week until we get - * to the 'nth kday'. There are probably more efficient - * algorithms based on using a mod 7, but this one works + * to the 'nth kday'. There are probably more efficient + * algorithms based on using a mod 7, but this one works * reasonably well for basic applications. * \ingroup date_alg */ @@ -233,7 +233,7 @@ namespace date_time { virtual std::string to_string() const { std::ostringstream ss; - ss << 'M' + ss << 'M' << static_cast<int>(month_) << '.' << static_cast<int>(wn_) << '.' << static_cast<int>(dow_); @@ -244,7 +244,7 @@ namespace date_time { week_num wn_; day_of_week_type dow_; }; - + //! Useful generator functor for finding holidays and daylight savings /*! Similar to nth_kday_of_month, but requires less paramters * \ingroup date_alg @@ -290,7 +290,7 @@ namespace date_time { virtual std::string to_string() const { std::ostringstream ss; - ss << 'M' + ss << 'M' << static_cast<int>(month_) << '.' << 1 << '.' << static_cast<int>(dow_); @@ -300,9 +300,9 @@ namespace date_time { month_type month_; day_of_week_type dow_; }; - - - + + + //! Calculate something like Last Sunday of January /*! Useful generator functor for finding holidays and daylight savings * Get the last day of the month and then calculate the difference @@ -351,7 +351,7 @@ namespace date_time { virtual std::string to_string() const { std::ostringstream ss; - ss << 'M' + ss << 'M' << static_cast<int>(month_) << '.' << 5 << '.' << static_cast<int>(dow_); @@ -361,8 +361,8 @@ namespace date_time { month_type month_; day_of_week_type dow_; }; - - + + //! Calculate something like "First Sunday after Jan 1,2002 /*! Date generator that takes a date and finds kday after *@code @@ -400,7 +400,7 @@ namespace date_time { private: day_of_week_type dow_; }; - + //! Calculate something like "First Sunday before Jan 1,2002 /*! Date generator that takes a date and finds kday after *@code @@ -438,10 +438,10 @@ namespace date_time { private: day_of_week_type dow_; }; - + //! Calculates the number of days until the next weekday /*! Calculates the number of days until the next weekday. - * If the date given falls on a Sunday and the given weekday + * If the date given falls on a Sunday and the given weekday * is Tuesday the result will be 2 days */ template<typename date_type, class weekday_type> inline @@ -458,8 +458,8 @@ namespace date_time { //! Calculates the number of days since the previous weekday /*! Calculates the number of days since the previous weekday - * If the date given falls on a Sunday and the given weekday - * is Tuesday the result will be 5 days. The answer will be a positive + * If the date given falls on a Sunday and the given weekday + * is Tuesday the result will be 5 days. The answer will be a positive * number because Tuesday is 5 days before Sunday, not -5 days before. */ template<typename date_type, class weekday_type> inline @@ -477,9 +477,9 @@ namespace date_time { } //! Generates a date object representing the date of the following weekday from the given date - /*! Generates a date object representing the date of the following - * weekday from the given date. If the date given is 2004-May-9 - * (a Sunday) and the given weekday is Tuesday then the resulting date + /*! Generates a date object representing the date of the following + * weekday from the given date. If the date given is 2004-May-9 + * (a Sunday) and the given weekday is Tuesday then the resulting date * will be 2004-May-11. */ template<class date_type, class weekday_type> inline @@ -489,9 +489,9 @@ namespace date_time { } //! Generates a date object representing the date of the previous weekday from the given date - /*! Generates a date object representing the date of the previous - * weekday from the given date. If the date given is 2004-May-9 - * (a Sunday) and the given weekday is Tuesday then the resulting date + /*! Generates a date object representing the date of the previous + * weekday from the given date. If the date given is 2004-May-9 + * (a Sunday) and the given weekday is Tuesday then the resulting date * will be 2004-May-4. */ template<class date_type, class weekday_type> inline diff --git a/3rdParty/Boost/src/boost/date_time/date_iterator.hpp b/3rdParty/Boost/src/boost/date_time/date_iterator.hpp index 284dc74..c8ec50e 100644 --- a/3rdParty/Boost/src/boost/date_time/date_iterator.hpp +++ b/3rdParty/Boost/src/boost/date_time/date_iterator.hpp @@ -2,11 +2,11 @@ #define DATE_ITERATOR_HPP___ /* Copyright (c) 2002,2003 CrystalClear Software, Inc. - * Use, modification and distribution is subject to the + * Use, modification and distribution is subject to the * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2012-09-22 15:33:33 -0700 (Sat, 22 Sep 2012) $ */ #include <iterator> @@ -32,7 +32,7 @@ namespace date_time { template<class date_type> class date_itr_base { // works, but benefit unclear at the moment - // class date_itr_base : public std::iterator<std::input_iterator_tag, + // class date_itr_base : public std::iterator<std::input_iterator_tag, // date_type, void, void, void>{ public: typedef typename date_type::duration_type duration_type; @@ -40,31 +40,31 @@ namespace date_time { typedef std::input_iterator_tag iterator_category; date_itr_base(date_type d) : current_(d) {} - virtual ~date_itr_base() {}; - date_itr_base& operator++() + virtual ~date_itr_base() {} + date_itr_base& operator++() { current_ = current_ + get_offset(current_); return *this; } - date_itr_base& operator--() + date_itr_base& operator--() { current_ = current_ + get_neg_offset(current_); return *this; } virtual duration_type get_offset(const date_type& current) const=0; virtual duration_type get_neg_offset(const date_type& current) const=0; - date_type operator*() {return current_;}; - date_type* operator->() {return ¤t_;}; + date_type operator*() {return current_;} + date_type* operator->() {return ¤t_;} bool operator< (const date_type& d) {return current_ < d;} bool operator<= (const date_type& d) {return current_ <= d;} bool operator> (const date_type& d) {return current_ > d;} bool operator>= (const date_type& d) {return current_ >= d;} bool operator== (const date_type& d) {return current_ == d;} - bool operator!= (const date_type& d) {return current_ != d;} + bool operator!= (const date_type& d) {return current_ != d;} private: date_type current_; }; - + //! Overrides the base date iterator providing hook for functors /* * <b>offset_functor</b> @@ -77,9 +77,9 @@ namespace date_time { class date_itr : public date_itr_base<date_type> { public: typedef typename date_type::duration_type duration_type; - date_itr(date_type d, int factor=1) : - date_itr_base<date_type>(d), - of_(factor) + date_itr(date_type d, int factor=1) : + date_itr_base<date_type>(d), + of_(factor) {} private: virtual duration_type get_offset(const date_type& current) const @@ -92,9 +92,9 @@ namespace date_time { } offset_functor of_; }; - - + + } } //namespace date_time diff --git a/3rdParty/Boost/src/boost/date_time/date_names_put.hpp b/3rdParty/Boost/src/boost/date_time/date_names_put.hpp index c6f0ce2..32aeb36 100644 --- a/3rdParty/Boost/src/boost/date_time/date_names_put.hpp +++ b/3rdParty/Boost/src/boost/date_time/date_names_put.hpp @@ -2,11 +2,11 @@ #define DATE_TIME_DATE_NAMES_PUT_HPP___ /* Copyright (c) 2002-2005 CrystalClear Software, Inc. - * Use, modification and distribution is subject to the + * Use, modification and distribution is subject to the * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) - * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * Author: Jeff Garland, Bart Garst + * $Date: 2012-09-22 15:33:33 -0700 (Sat, 22 Sep 2012) $ */ @@ -27,22 +27,22 @@ namespace date_time { //! Output facet base class for gregorian dates. /*! This class is a base class for date facets used to localize the * names of months and the names of days in the week. - * + * * Requirements of Config - * - define an enumeration month_enum that enumerates the months. + * - define an enumeration month_enum that enumerates the months. * The enumeration should be '1' based eg: Jan==1 * - define as_short_string and as_long_string * * (see langer & kreft p334). - * + * */ template<class Config, - class charT = char, + class charT = char, class OutputIterator = std::ostreambuf_iterator<charT> > class date_names_put : public std::locale::facet { public: - date_names_put() {}; + date_names_put() {} typedef OutputIterator iter_type; typedef typename Config::month_type month_type; typedef typename Config::month_enum month_enum; @@ -118,7 +118,7 @@ namespace date_time { put_string(oitr, gm.as_short_string(c)); } //! Default facet implementation uses month_type defaults - virtual void do_put_month_long(iter_type& oitr, + virtual void do_put_month_long(iter_type& oitr, month_enum moy) const { month_type gm(moy); @@ -160,7 +160,7 @@ namespace date_time { string_type s(separator); //put in '-' put_string(oitr, s); } - //! Default for date order + //! Default for date order virtual ymd_order_spec do_date_order() const { return ymd_order_iso; @@ -186,27 +186,27 @@ namespace date_time { } } }; - + template<class Config, class charT, class OutputIterator> - const typename date_names_put<Config, charT, OutputIterator>::char_type - date_names_put<Config, charT, OutputIterator>::default_special_value_names[3][17] = { + const typename date_names_put<Config, charT, OutputIterator>::char_type + date_names_put<Config, charT, OutputIterator>::default_special_value_names[3][17] = { {'n','o','t','-','a','-','d','a','t','e','-','t','i','m','e'}, {'-','i','n','f','i','n','i','t','y'}, {'+','i','n','f','i','n','i','t','y'} }; template<class Config, class charT, class OutputIterator> - const typename date_names_put<Config, charT, OutputIterator>::char_type - date_names_put<Config, charT, OutputIterator>::separator[2] = + const typename date_names_put<Config, charT, OutputIterator>::char_type + date_names_put<Config, charT, OutputIterator>::separator[2] = {'-', '\0'} ; - - //! Generate storage location for a std::locale::id + + //! Generate storage location for a std::locale::id template<class Config, class charT, class OutputIterator> std::locale::id date_names_put<Config, charT, OutputIterator>::id; //! A date name output facet that takes an array of char* to define strings template<class Config, - class charT = char, + class charT = char, class OutputIterator = std::ostreambuf_iterator<charT> > class all_date_names_put : public date_names_put<Config, charT, OutputIterator> { @@ -230,29 +230,29 @@ namespace date_time { separator_char_[0] = separator_char; separator_char_[1] = '\0'; - }; + } typedef OutputIterator iter_type; typedef typename Config::month_enum month_enum; typedef typename Config::weekday_enum weekday_enum; typedef typename Config::special_value_enum special_value_enum; - const charT* const* get_short_month_names() const + const charT* const* get_short_month_names() const { return month_short_names_; } - const charT* const* get_long_month_names() const + const charT* const* get_long_month_names() const { return month_long_names_; } - const charT* const* get_special_value_names() const + const charT* const* get_special_value_names() const { return special_value_names_; } - const charT* const* get_short_weekday_names()const + const charT* const* get_short_weekday_names()const { return weekday_short_names_; } - const charT* const* get_long_weekday_names()const + const charT* const* get_long_weekday_names()const { return weekday_long_names_; } @@ -263,7 +263,7 @@ namespace date_time { { this->put_string(oitr, month_short_names_[moy-1]); } - //! Long month names + //! Long month names virtual void do_put_month_long(iter_type& oitr, month_enum moy) const { this->put_string(oitr, month_long_names_[moy-1]); @@ -310,7 +310,7 @@ namespace date_time { const charT* const* weekday_long_names_; charT separator_char_[2]; ymd_order_spec order_spec_; - month_format_spec month_format_spec_; + month_format_spec month_format_spec_; }; } } //namespace boost::date_time diff --git a/3rdParty/Boost/src/boost/date_time/date_parsing.hpp b/3rdParty/Boost/src/boost/date_time/date_parsing.hpp index f361bc8..35ec8e4 100644 --- a/3rdParty/Boost/src/boost/date_time/date_parsing.hpp +++ b/3rdParty/Boost/src/boost/date_time/date_parsing.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2009-06-04 04:24:49 -0400 (Thu, 04 Jun 2009) $ + * $Date: 2012-09-30 16:25:22 -0700 (Sun, 30 Sep 2012) $ */ #include <string> @@ -148,6 +148,7 @@ namespace date_time { day = boost::lexical_cast<unsigned short>(*beg); break; } + default: break; } //switch } return date_type(year, month, day); @@ -180,6 +181,7 @@ namespace date_time { case 0: y = i; break; case 1: m = i; break; case 2: d = i; break; + default: break; } pos++; } diff --git a/3rdParty/Boost/src/boost/date_time/dst_rules.hpp b/3rdParty/Boost/src/boost/date_time/dst_rules.hpp index 20cb40b..cf65c16 100644 --- a/3rdParty/Boost/src/boost/date_time/dst_rules.hpp +++ b/3rdParty/Boost/src/boost/date_time/dst_rules.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2012-09-30 16:25:22 -0700 (Sun, 30 Sep 2012) $ */ /*! @file dst_rules.hpp @@ -371,7 +371,7 @@ namespace boost { return is_not_in_dst; } - static bool is_dst_boundary_day(date_type d) + static bool is_dst_boundary_day(date_type /*d*/) { return false; } diff --git a/3rdParty/Boost/src/boost/date_time/dst_transition_generators.hpp b/3rdParty/Boost/src/boost/date_time/dst_transition_generators.hpp index 6c4da1c..16c1fd6 100644 --- a/3rdParty/Boost/src/boost/date_time/dst_transition_generators.hpp +++ b/3rdParty/Boost/src/boost/date_time/dst_transition_generators.hpp @@ -18,7 +18,7 @@ namespace date_time { { public: typedef typename date_type::year_type year_type; - virtual ~dst_day_calc_rule() {}; + virtual ~dst_day_calc_rule() {} virtual date_type start_day(year_type y) const=0; virtual std::string start_rule_as_string() const=0; virtual date_type end_day(year_type y) const=0; diff --git a/3rdParty/Boost/src/boost/date_time/filetime_functions.hpp b/3rdParty/Boost/src/boost/date_time/filetime_functions.hpp index 27ed754..3c7f13f 100644 --- a/3rdParty/Boost/src/boost/date_time/filetime_functions.hpp +++ b/3rdParty/Boost/src/boost/date_time/filetime_functions.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2009-06-06 07:24:09 -0400 (Sat, 06 Jun 2009) $ + * $Date: 2012-09-22 09:04:10 -0700 (Sat, 22 Sep 2012) $ */ /*! @file filetime_functions.hpp @@ -73,12 +73,12 @@ namespace winapi { file_time ft_utc; GetSystemTimeAsFileTime(&ft_utc); FileTimeToLocalFileTime(&ft_utc, &ft); -#elif defined(BOOST_NO_GETSYSTEMTIMEASFILETIME) +#elif defined(BOOST_HAS_GETSYSTEMTIMEASFILETIME) + GetSystemTimeAsFileTime(&ft); +#else system_time st; GetSystemTime(&st); SystemTimeToFileTime(&st, &ft); -#else - GetSystemTimeAsFileTime(&ft); #endif } diff --git a/3rdParty/Boost/src/boost/date_time/format_date_parser.hpp b/3rdParty/Boost/src/boost/date_time/format_date_parser.hpp index a4a4d0d..0c3503f 100644 --- a/3rdParty/Boost/src/boost/date_time/format_date_parser.hpp +++ b/3rdParty/Boost/src/boost/date_time/format_date_parser.hpp @@ -7,7 +7,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2009-06-04 04:24:49 -0400 (Thu, 04 Jun 2009) $ + * $Date: 2012-09-30 16:25:22 -0700 (Sun, 30 Sep 2012) $ */ @@ -256,7 +256,6 @@ class format_date_parser // skip leading whitespace while(std::isspace(*sitr) && sitr != stream_end) { ++sitr; } - charT current_char = *sitr; short year(0), month(0), day(0), day_of_year(0);// wkday(0); /* Initialized the following to their minimum values. These intermediate @@ -290,7 +289,6 @@ class format_date_parser } wkday = mr.current_match; if (mr.has_remaining()) { - current_char = mr.last_char(); use_current_char = true; } break; @@ -310,7 +308,6 @@ class format_date_parser } wkday = mr.current_match; if (mr.has_remaining()) { - current_char = mr.last_char(); use_current_char = true; } break; @@ -326,7 +323,6 @@ class format_date_parser } t_month = month_type(mr.current_match); if (mr.has_remaining()) { - current_char = mr.last_char(); use_current_char = true; } break; @@ -342,7 +338,6 @@ class format_date_parser } t_month = month_type(mr.current_match); if (mr.has_remaining()) { - current_char = mr.last_char(); use_current_char = true; } break; @@ -438,7 +433,6 @@ class format_date_parser itr++; if (use_current_char) { use_current_char = false; - current_char = *sitr; } else { sitr++; diff --git a/3rdParty/Boost/src/boost/date_time/gregorian/conversion.hpp b/3rdParty/Boost/src/boost/date_time/gregorian/conversion.hpp index c505bdd..33f6856 100644 --- a/3rdParty/Boost/src/boost/date_time/gregorian/conversion.hpp +++ b/3rdParty/Boost/src/boost/date_time/gregorian/conversion.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2010-06-09 14:10:13 -0400 (Wed, 09 Jun 2010) $ + * $Date: 2010-06-09 11:10:13 -0700 (Wed, 09 Jun 2010) $ */ #include <cstring> diff --git a/3rdParty/Boost/src/boost/date_time/gregorian/formatters.hpp b/3rdParty/Boost/src/boost/date_time/gregorian/formatters.hpp index 786e79f..eda7dc3 100644 --- a/3rdParty/Boost/src/boost/date_time/gregorian/formatters.hpp +++ b/3rdParty/Boost/src/boost/date_time/gregorian/formatters.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ #include "boost/date_time/compiler_config.hpp" diff --git a/3rdParty/Boost/src/boost/date_time/gregorian/formatters_limited.hpp b/3rdParty/Boost/src/boost/date_time/gregorian/formatters_limited.hpp index 4531ebe..8dfd2d0 100644 --- a/3rdParty/Boost/src/boost/date_time/gregorian/formatters_limited.hpp +++ b/3rdParty/Boost/src/boost/date_time/gregorian/formatters_limited.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ #include "boost/date_time/gregorian/gregorian_types.hpp" diff --git a/3rdParty/Boost/src/boost/date_time/gregorian/greg_calendar.hpp b/3rdParty/Boost/src/boost/date_time/gregorian/greg_calendar.hpp index 483ead5..e9c1852 100644 --- a/3rdParty/Boost/src/boost/date_time/gregorian/greg_calendar.hpp +++ b/3rdParty/Boost/src/boost/date_time/gregorian/greg_calendar.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland - * $Date: 2010-01-10 14:17:23 -0500 (Sun, 10 Jan 2010) $ + * $Date: 2010-01-10 11:17:23 -0800 (Sun, 10 Jan 2010) $ */ #include <boost/cstdint.hpp> diff --git a/3rdParty/Boost/src/boost/date_time/gregorian/greg_date.hpp b/3rdParty/Boost/src/boost/date_time/gregorian/greg_date.hpp index ad67c0c..860a407 100644 --- a/3rdParty/Boost/src/boost/date_time/gregorian/greg_date.hpp +++ b/3rdParty/Boost/src/boost/date_time/gregorian/greg_date.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland - * $Date: 2010-01-10 14:17:23 -0500 (Sun, 10 Jan 2010) $ + * $Date: 2010-01-10 11:17:23 -0800 (Sun, 10 Jan 2010) $ */ #include <boost/throw_exception.hpp> diff --git a/3rdParty/Boost/src/boost/date_time/gregorian/greg_day.hpp b/3rdParty/Boost/src/boost/date_time/gregorian/greg_day.hpp index 92ea6ab..4ea829f 100644 --- a/3rdParty/Boost/src/boost/date_time/gregorian/greg_day.hpp +++ b/3rdParty/Boost/src/boost/date_time/gregorian/greg_day.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ #include "boost/date_time/constrained_value.hpp" diff --git a/3rdParty/Boost/src/boost/date_time/gregorian/greg_day_of_year.hpp b/3rdParty/Boost/src/boost/date_time/gregorian/greg_day_of_year.hpp index 36b22c2..2f8874d 100644 --- a/3rdParty/Boost/src/boost/date_time/gregorian/greg_day_of_year.hpp +++ b/3rdParty/Boost/src/boost/date_time/gregorian/greg_day_of_year.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ #include "boost/date_time/constrained_value.hpp" diff --git a/3rdParty/Boost/src/boost/date_time/gregorian/greg_duration.hpp b/3rdParty/Boost/src/boost/date_time/gregorian/greg_duration.hpp index fd75542..a9c0c17 100644 --- a/3rdParty/Boost/src/boost/date_time/gregorian/greg_duration.hpp +++ b/3rdParty/Boost/src/boost/date_time/gregorian/greg_duration.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $ + * $Date: 2008-11-12 11:37:53 -0800 (Wed, 12 Nov 2008) $ */ #include <boost/date_time/date_duration.hpp> diff --git a/3rdParty/Boost/src/boost/date_time/gregorian/greg_duration_types.hpp b/3rdParty/Boost/src/boost/date_time/gregorian/greg_duration_types.hpp index 3d1ce62..8328ca3 100644 --- a/3rdParty/Boost/src/boost/date_time/gregorian/greg_duration_types.hpp +++ b/3rdParty/Boost/src/boost/date_time/gregorian/greg_duration_types.hpp @@ -5,7 +5,7 @@ * Subject to Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $ + * $Date: 2008-11-12 11:37:53 -0800 (Wed, 12 Nov 2008) $ */ diff --git a/3rdParty/Boost/src/boost/date_time/gregorian/greg_facet.hpp b/3rdParty/Boost/src/boost/date_time/gregorian/greg_facet.hpp index 9c3877e..9efc619 100644 --- a/3rdParty/Boost/src/boost/date_time/gregorian/greg_facet.hpp +++ b/3rdParty/Boost/src/boost/date_time/gregorian/greg_facet.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-11-23 06:13:35 -0500 (Sun, 23 Nov 2008) $ + * $Date: 2008-11-23 03:13:35 -0800 (Sun, 23 Nov 2008) $ */ #include "boost/date_time/gregorian/gregorian_types.hpp" diff --git a/3rdParty/Boost/src/boost/date_time/gregorian/greg_month.hpp b/3rdParty/Boost/src/boost/date_time/gregorian/greg_month.hpp index fc9c861..b48a8a8 100644 --- a/3rdParty/Boost/src/boost/date_time/gregorian/greg_month.hpp +++ b/3rdParty/Boost/src/boost/date_time/gregorian/greg_month.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ #include "boost/date_time/constrained_value.hpp" diff --git a/3rdParty/Boost/src/boost/date_time/gregorian/greg_weekday.hpp b/3rdParty/Boost/src/boost/date_time/gregorian/greg_weekday.hpp index 9b566c4..ab68fcd 100644 --- a/3rdParty/Boost/src/boost/date_time/gregorian/greg_weekday.hpp +++ b/3rdParty/Boost/src/boost/date_time/gregorian/greg_weekday.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $ + * $Date: 2008-11-12 11:37:53 -0800 (Wed, 12 Nov 2008) $ */ #include "boost/date_time/constrained_value.hpp" diff --git a/3rdParty/Boost/src/boost/date_time/gregorian/greg_year.hpp b/3rdParty/Boost/src/boost/date_time/gregorian/greg_year.hpp index ef1735f..322f40d 100644 --- a/3rdParty/Boost/src/boost/date_time/gregorian/greg_year.hpp +++ b/3rdParty/Boost/src/boost/date_time/gregorian/greg_year.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ #include "boost/date_time/constrained_value.hpp" diff --git a/3rdParty/Boost/src/boost/date_time/gregorian/greg_ymd.hpp b/3rdParty/Boost/src/boost/date_time/gregorian/greg_ymd.hpp index 086e73d..e7d441e 100644 --- a/3rdParty/Boost/src/boost/date_time/gregorian/greg_ymd.hpp +++ b/3rdParty/Boost/src/boost/date_time/gregorian/greg_ymd.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ #include "boost/date_time/year_month_day.hpp" diff --git a/3rdParty/Boost/src/boost/date_time/gregorian/gregorian.hpp b/3rdParty/Boost/src/boost/date_time/gregorian/gregorian.hpp index bfafa1b..becbc06 100644 --- a/3rdParty/Boost/src/boost/date_time/gregorian/gregorian.hpp +++ b/3rdParty/Boost/src/boost/date_time/gregorian/gregorian.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ /*! @file gregorian.hpp diff --git a/3rdParty/Boost/src/boost/date_time/gregorian/gregorian_io.hpp b/3rdParty/Boost/src/boost/date_time/gregorian/gregorian_io.hpp index 62a759f..e6ba01f 100644 --- a/3rdParty/Boost/src/boost/date_time/gregorian/gregorian_io.hpp +++ b/3rdParty/Boost/src/boost/date_time/gregorian/gregorian_io.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $ + * $Date: 2008-11-12 11:37:53 -0800 (Wed, 12 Nov 2008) $ */ #include <locale> diff --git a/3rdParty/Boost/src/boost/date_time/gregorian/gregorian_types.hpp b/3rdParty/Boost/src/boost/date_time/gregorian/gregorian_types.hpp index 0c74857..3f4b92f 100644 --- a/3rdParty/Boost/src/boost/date_time/gregorian/gregorian_types.hpp +++ b/3rdParty/Boost/src/boost/date_time/gregorian/gregorian_types.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ /*! @file gregorian_types.hpp diff --git a/3rdParty/Boost/src/boost/date_time/gregorian/parsers.hpp b/3rdParty/Boost/src/boost/date_time/gregorian/parsers.hpp index 95d4f23..a2fa4e1 100644 --- a/3rdParty/Boost/src/boost/date_time/gregorian/parsers.hpp +++ b/3rdParty/Boost/src/boost/date_time/gregorian/parsers.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ #include "boost/date_time/gregorian/gregorian_types.hpp" diff --git a/3rdParty/Boost/src/boost/date_time/gregorian_calendar.hpp b/3rdParty/Boost/src/boost/date_time/gregorian_calendar.hpp index c27c09e..b645aa4 100644 --- a/3rdParty/Boost/src/boost/date_time/gregorian_calendar.hpp +++ b/3rdParty/Boost/src/boost/date_time/gregorian_calendar.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland - * $Date: 2010-01-10 14:17:23 -0500 (Sun, 10 Jan 2010) $ + * $Date: 2010-01-10 11:17:23 -0800 (Sun, 10 Jan 2010) $ */ diff --git a/3rdParty/Boost/src/boost/date_time/gregorian_calendar.ipp b/3rdParty/Boost/src/boost/date_time/gregorian_calendar.ipp index a281b45..af19394 100644 --- a/3rdParty/Boost/src/boost/date_time/gregorian_calendar.ipp +++ b/3rdParty/Boost/src/boost/date_time/gregorian_calendar.ipp @@ -3,7 +3,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2010-01-10 14:17:23 -0500 (Sun, 10 Jan 2010) $ + * $Date: 2012-09-22 09:04:10 -0700 (Sat, 22 Sep 2012) $ */ #ifndef NO_BOOST_DATE_TIME_INLINE @@ -47,7 +47,7 @@ namespace date_time { return week; } - if ((week == 53)) { + if (week == 53) { if((day==6) ||(day == 5 && is_leap_year(ymd.year))) { return week; //under these circumstances week == 53. } else { diff --git a/3rdParty/Boost/src/boost/date_time/int_adapter.hpp b/3rdParty/Boost/src/boost/date_time/int_adapter.hpp index fc98fc1..d1246e7 100644 --- a/3rdParty/Boost/src/boost/date_time/int_adapter.hpp +++ b/3rdParty/Boost/src/boost/date_time/int_adapter.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $ + * $Date: 2008-11-12 11:37:53 -0800 (Wed, 12 Nov 2008) $ */ diff --git a/3rdParty/Boost/src/boost/date_time/iso_format.hpp b/3rdParty/Boost/src/boost/date_time/iso_format.hpp index 8262fa2..1f9e73d 100644 --- a/3rdParty/Boost/src/boost/date_time/iso_format.hpp +++ b/3rdParty/Boost/src/boost/date_time/iso_format.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ #include "boost/date_time/parse_format_base.hpp" diff --git a/3rdParty/Boost/src/boost/date_time/local_time/conversion.hpp b/3rdParty/Boost/src/boost/date_time/local_time/conversion.hpp index 13e4d3e..a530de4 100644 --- a/3rdParty/Boost/src/boost/date_time/local_time/conversion.hpp +++ b/3rdParty/Boost/src/boost/date_time/local_time/conversion.hpp @@ -5,7 +5,7 @@ * Subject to the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2009-06-04 04:24:49 -0400 (Thu, 04 Jun 2009) $ + * $Date: 2009-06-04 01:24:49 -0700 (Thu, 04 Jun 2009) $ */ diff --git a/3rdParty/Boost/src/boost/date_time/local_time/custom_time_zone.hpp b/3rdParty/Boost/src/boost/date_time/local_time/custom_time_zone.hpp index a6c1d42..84c59a3 100644 --- a/3rdParty/Boost/src/boost/date_time/local_time/custom_time_zone.hpp +++ b/3rdParty/Boost/src/boost/date_time/local_time/custom_time_zone.hpp @@ -2,10 +2,10 @@ #define LOCAL_TIME_CUSTOM_TIME_ZONE_HPP__ /* Copyright (c) 2003-2005 CrystalClear Software, Inc. - * Subject to the Boost Software License, Version 1.0. + * Subject to the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2012-09-22 15:33:33 -0700 (Sat, 22 Sep 2012) $ */ #include "boost/date_time/time_zone_base.hpp" @@ -34,8 +34,8 @@ namespace local_time { typedef typename base_type::stringstream_type stringstream_type; typedef date_time::time_zone_names_base<CharT> time_zone_names; typedef CharT char_type; - - custom_time_zone_base(const time_zone_names& zone_names, + + custom_time_zone_base(const time_zone_names& zone_names, const time_duration_type& utc_offset, const dst_adjustment_offsets& dst_shift, boost::shared_ptr<dst_calc_rule> calc_rule) : @@ -43,8 +43,8 @@ namespace local_time { base_utc_offset_(utc_offset), dst_offsets_(dst_shift), dst_calc_rules_(calc_rule) - {}; - virtual ~custom_time_zone_base() {}; + {} + virtual ~custom_time_zone_base() {} virtual string_type dst_zone_abbrev() const { return zone_names_.dst_zone_abbrev(); diff --git a/3rdParty/Boost/src/boost/date_time/local_time/date_duration_operators.hpp b/3rdParty/Boost/src/boost/date_time/local_time/date_duration_operators.hpp index ee87022..b4c325d 100644 --- a/3rdParty/Boost/src/boost/date_time/local_time/date_duration_operators.hpp +++ b/3rdParty/Boost/src/boost/date_time/local_time/date_duration_operators.hpp @@ -6,7 +6,7 @@ * (See accompanying file LICENSE_1_0.txt or * http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ #include "boost/date_time/gregorian/greg_duration_types.hpp" diff --git a/3rdParty/Boost/src/boost/date_time/local_time/dst_transition_day_rules.hpp b/3rdParty/Boost/src/boost/date_time/local_time/dst_transition_day_rules.hpp index 3d6cfba..d82731c 100644 --- a/3rdParty/Boost/src/boost/date_time/local_time/dst_transition_day_rules.hpp +++ b/3rdParty/Boost/src/boost/date_time/local_time/dst_transition_day_rules.hpp @@ -5,7 +5,7 @@ * Subject to the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ diff --git a/3rdParty/Boost/src/boost/date_time/local_time/local_date_time.hpp b/3rdParty/Boost/src/boost/date_time/local_time/local_date_time.hpp index 9c9f623..96b2915 100644 --- a/3rdParty/Boost/src/boost/date_time/local_time/local_date_time.hpp +++ b/3rdParty/Boost/src/boost/date_time/local_time/local_date_time.hpp @@ -5,7 +5,7 @@ * Subject to the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2010-01-10 14:17:23 -0500 (Sun, 10 Jan 2010) $ + * $Date: 2012-09-22 15:33:33 -0700 (Sat, 22 Sep 2012) $ */ #include <string> @@ -208,7 +208,7 @@ namespace local_time { } //! Simple destructor, releases time zone if last referrer - ~local_date_time_base() {}; + ~local_date_time_base() {} //! Copy constructor local_date_time_base(const local_date_time_base& rhs) : diff --git a/3rdParty/Boost/src/boost/date_time/local_time/local_time.hpp b/3rdParty/Boost/src/boost/date_time/local_time/local_time.hpp index f7d4cc6..162cac5 100644 --- a/3rdParty/Boost/src/boost/date_time/local_time/local_time.hpp +++ b/3rdParty/Boost/src/boost/date_time/local_time/local_time.hpp @@ -5,7 +5,7 @@ * Subject to the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ #include "boost/date_time/posix_time/posix_time.hpp" diff --git a/3rdParty/Boost/src/boost/date_time/local_time/local_time_io.hpp b/3rdParty/Boost/src/boost/date_time/local_time/local_time_io.hpp index c161ff7..b5e3c3f 100644 --- a/3rdParty/Boost/src/boost/date_time/local_time/local_time_io.hpp +++ b/3rdParty/Boost/src/boost/date_time/local_time/local_time_io.hpp @@ -5,7 +5,7 @@ * Subject to the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-11-13 14:05:31 -0500 (Thu, 13 Nov 2008) $ + * $Date: 2008-11-13 11:05:31 -0800 (Thu, 13 Nov 2008) $ */ #include <locale> diff --git a/3rdParty/Boost/src/boost/date_time/local_time/local_time_types.hpp b/3rdParty/Boost/src/boost/date_time/local_time/local_time_types.hpp index ed58b80..5e04422 100644 --- a/3rdParty/Boost/src/boost/date_time/local_time/local_time_types.hpp +++ b/3rdParty/Boost/src/boost/date_time/local_time/local_time_types.hpp @@ -5,7 +5,7 @@ * Subject to the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ #include "boost/date_time/local_time/local_date_time.hpp" diff --git a/3rdParty/Boost/src/boost/date_time/local_time/posix_time_zone.hpp b/3rdParty/Boost/src/boost/date_time/local_time/posix_time_zone.hpp index 2a0199f..ee1b553 100644 --- a/3rdParty/Boost/src/boost/date_time/local_time/posix_time_zone.hpp +++ b/3rdParty/Boost/src/boost/date_time/local_time/posix_time_zone.hpp @@ -5,7 +5,7 @@ * Subject to the Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2010-06-10 13:24:38 -0400 (Thu, 10 Jun 2010) $ + * $Date: 2012-09-22 15:33:33 -0700 (Sat, 22 Sep 2012) $ */ #include <string> @@ -115,7 +115,7 @@ namespace local_time{ calc_rules(dst_begin, dst_end); } } - virtual ~posix_time_zone_base() {}; + virtual ~posix_time_zone_base() {} //!String for the zone when not in daylight savings (eg: EST) virtual string_type std_zone_abbrev()const { diff --git a/3rdParty/Boost/src/boost/date_time/local_time/tz_database.hpp b/3rdParty/Boost/src/boost/date_time/local_time/tz_database.hpp index 4cfca45..aceda93 100644 --- a/3rdParty/Boost/src/boost/date_time/local_time/tz_database.hpp +++ b/3rdParty/Boost/src/boost/date_time/local_time/tz_database.hpp @@ -5,7 +5,7 @@ * Subject to the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ #include <string> diff --git a/3rdParty/Boost/src/boost/date_time/locale_config.hpp b/3rdParty/Boost/src/boost/date_time/locale_config.hpp index d01e008..194d5dd 100644 --- a/3rdParty/Boost/src/boost/date_time/locale_config.hpp +++ b/3rdParty/Boost/src/boost/date_time/locale_config.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ // This file configures whether the library will support locales and hence diff --git a/3rdParty/Boost/src/boost/date_time/microsec_time_clock.hpp b/3rdParty/Boost/src/boost/date_time/microsec_time_clock.hpp index 9396579..177811e 100644 --- a/3rdParty/Boost/src/boost/date_time/microsec_time_clock.hpp +++ b/3rdParty/Boost/src/boost/date_time/microsec_time_clock.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2010-05-10 05:15:48 -0400 (Mon, 10 May 2010) $ + * $Date: 2010-05-10 02:15:48 -0700 (Mon, 10 May 2010) $ */ diff --git a/3rdParty/Boost/src/boost/date_time/parse_format_base.hpp b/3rdParty/Boost/src/boost/date_time/parse_format_base.hpp index b17a5c8..087baf9 100644 --- a/3rdParty/Boost/src/boost/date_time/parse_format_base.hpp +++ b/3rdParty/Boost/src/boost/date_time/parse_format_base.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ namespace boost { diff --git a/3rdParty/Boost/src/boost/date_time/period.hpp b/3rdParty/Boost/src/boost/date_time/period.hpp index c67bc36..3e34def 100644 --- a/3rdParty/Boost/src/boost/date_time/period.hpp +++ b/3rdParty/Boost/src/boost/date_time/period.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ /*! \file period.hpp diff --git a/3rdParty/Boost/src/boost/date_time/period_formatter.hpp b/3rdParty/Boost/src/boost/date_time/period_formatter.hpp index 08082e1..b6ddc82 100644 --- a/3rdParty/Boost/src/boost/date_time/period_formatter.hpp +++ b/3rdParty/Boost/src/boost/date_time/period_formatter.hpp @@ -7,7 +7,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2012-09-22 15:33:33 -0700 (Sat, 22 Sep 2012) $ */ @@ -114,10 +114,10 @@ namespace boost { namespace date_time { { m_range_option = option; } - void delimiter_strings(const string_type& separator, - const string_type& start_delim, - const string_type& open_end_delim, - const string_type& closed_end_delim) + void delimiter_strings(const string_type& , + const string_type& , + const string_type& , + const string_type& ) { m_period_separator; m_period_start_delimeter; diff --git a/3rdParty/Boost/src/boost/date_time/period_parser.hpp b/3rdParty/Boost/src/boost/date_time/period_parser.hpp index 9cd57e1..84b9d13 100644 --- a/3rdParty/Boost/src/boost/date_time/period_parser.hpp +++ b/3rdParty/Boost/src/boost/date_time/period_parser.hpp @@ -7,7 +7,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-11-13 15:10:23 -0500 (Thu, 13 Nov 2008) $ + * $Date: 2008-11-13 12:10:23 -0800 (Thu, 13 Nov 2008) $ */ #include <boost/throw_exception.hpp> diff --git a/3rdParty/Boost/src/boost/date_time/posix_time/conversion.hpp b/3rdParty/Boost/src/boost/date_time/posix_time/conversion.hpp index 3fb21d7..83ccf60 100644 --- a/3rdParty/Boost/src/boost/date_time/posix_time/conversion.hpp +++ b/3rdParty/Boost/src/boost/date_time/posix_time/conversion.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2010-06-09 14:10:13 -0400 (Wed, 09 Jun 2010) $ + * $Date: 2010-06-09 11:10:13 -0700 (Wed, 09 Jun 2010) $ */ #include <cstring> diff --git a/3rdParty/Boost/src/boost/date_time/posix_time/date_duration_operators.hpp b/3rdParty/Boost/src/boost/date_time/posix_time/date_duration_operators.hpp index e6899ba..6846a77 100644 --- a/3rdParty/Boost/src/boost/date_time/posix_time/date_duration_operators.hpp +++ b/3rdParty/Boost/src/boost/date_time/posix_time/date_duration_operators.hpp @@ -6,7 +6,7 @@ * (See accompanying file LICENSE_1_0.txt or * http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ #include "boost/date_time/gregorian/greg_duration_types.hpp" diff --git a/3rdParty/Boost/src/boost/date_time/posix_time/posix_time.hpp b/3rdParty/Boost/src/boost/date_time/posix_time/posix_time.hpp index 4e9294c..3b85ff4 100644 --- a/3rdParty/Boost/src/boost/date_time/posix_time/posix_time.hpp +++ b/3rdParty/Boost/src/boost/date_time/posix_time/posix_time.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ /*!@file posix_time.hpp Global header file to get all of posix time types */ diff --git a/3rdParty/Boost/src/boost/date_time/posix_time/posix_time_config.hpp b/3rdParty/Boost/src/boost/date_time/posix_time/posix_time_config.hpp index 60c3f7e..d0b7653 100644 --- a/3rdParty/Boost/src/boost/date_time/posix_time/posix_time_config.hpp +++ b/3rdParty/Boost/src/boost/date_time/posix_time/posix_time_config.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2009-06-04 07:52:28 -0400 (Thu, 04 Jun 2009) $ + * $Date: 2012-10-10 12:05:03 -0700 (Wed, 10 Oct 2012) $ */ #include <cstdlib> //for MCW 7.2 std::abs(long long) @@ -81,7 +81,7 @@ namespace posix_time { {} //Give duration access to ticks constructor -- hide from users friend class date_time::time_duration<time_duration, time_res_traits>; - private: + protected: explicit time_duration(impl_type tick_count) : date_time::time_duration<time_duration, time_res_traits>(tick_count) {} diff --git a/3rdParty/Boost/src/boost/date_time/posix_time/posix_time_duration.hpp b/3rdParty/Boost/src/boost/date_time/posix_time/posix_time_duration.hpp index db3b85f..9778fd7 100644 --- a/3rdParty/Boost/src/boost/date_time/posix_time/posix_time_duration.hpp +++ b/3rdParty/Boost/src/boost/date_time/posix_time/posix_time_duration.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ #include "boost/date_time/posix_time/posix_time_config.hpp" diff --git a/3rdParty/Boost/src/boost/date_time/posix_time/posix_time_io.hpp b/3rdParty/Boost/src/boost/date_time/posix_time/posix_time_io.hpp index 9a80737..fb63a91 100644 --- a/3rdParty/Boost/src/boost/date_time/posix_time/posix_time_io.hpp +++ b/3rdParty/Boost/src/boost/date_time/posix_time/posix_time_io.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-11-13 14:05:31 -0500 (Thu, 13 Nov 2008) $ + * $Date: 2008-11-13 11:05:31 -0800 (Thu, 13 Nov 2008) $ */ #include <locale> diff --git a/3rdParty/Boost/src/boost/date_time/posix_time/posix_time_legacy_io.hpp b/3rdParty/Boost/src/boost/date_time/posix_time/posix_time_legacy_io.hpp index f5b20a8..fcc3fac 100644 --- a/3rdParty/Boost/src/boost/date_time/posix_time/posix_time_legacy_io.hpp +++ b/3rdParty/Boost/src/boost/date_time/posix_time/posix_time_legacy_io.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ /*! @file posix_time_pre133_operators.hpp diff --git a/3rdParty/Boost/src/boost/date_time/posix_time/posix_time_system.hpp b/3rdParty/Boost/src/boost/date_time/posix_time/posix_time_system.hpp index 3d44e0f..13626e9 100644 --- a/3rdParty/Boost/src/boost/date_time/posix_time/posix_time_system.hpp +++ b/3rdParty/Boost/src/boost/date_time/posix_time/posix_time_system.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ diff --git a/3rdParty/Boost/src/boost/date_time/posix_time/ptime.hpp b/3rdParty/Boost/src/boost/date_time/posix_time/ptime.hpp index 2abc02d..3f1cb04 100644 --- a/3rdParty/Boost/src/boost/date_time/posix_time/ptime.hpp +++ b/3rdParty/Boost/src/boost/date_time/posix_time/ptime.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ #include "boost/date_time/posix_time/posix_time_system.hpp" diff --git a/3rdParty/Boost/src/boost/date_time/posix_time/time_formatters.hpp b/3rdParty/Boost/src/boost/date_time/posix_time/time_formatters.hpp index 466331b..534b952 100644 --- a/3rdParty/Boost/src/boost/date_time/posix_time/time_formatters.hpp +++ b/3rdParty/Boost/src/boost/date_time/posix_time/time_formatters.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2010-01-10 14:17:23 -0500 (Sun, 10 Jan 2010) $ + * $Date: 2010-01-10 11:17:23 -0800 (Sun, 10 Jan 2010) $ */ #include <boost/date_time/gregorian/gregorian.hpp> diff --git a/3rdParty/Boost/src/boost/date_time/posix_time/time_formatters_limited.hpp b/3rdParty/Boost/src/boost/date_time/posix_time/time_formatters_limited.hpp index d0e959e..8d2ebdc 100644 --- a/3rdParty/Boost/src/boost/date_time/posix_time/time_formatters_limited.hpp +++ b/3rdParty/Boost/src/boost/date_time/posix_time/time_formatters_limited.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2010-01-10 14:17:23 -0500 (Sun, 10 Jan 2010) $ + * $Date: 2010-01-10 11:17:23 -0800 (Sun, 10 Jan 2010) $ */ #include <boost/date_time/gregorian/gregorian.hpp> diff --git a/3rdParty/Boost/src/boost/date_time/posix_time/time_parsers.hpp b/3rdParty/Boost/src/boost/date_time/posix_time/time_parsers.hpp index 8a352f6..3dc02b1 100644 --- a/3rdParty/Boost/src/boost/date_time/posix_time/time_parsers.hpp +++ b/3rdParty/Boost/src/boost/date_time/posix_time/time_parsers.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ #include "boost/date_time/gregorian/gregorian.hpp" diff --git a/3rdParty/Boost/src/boost/date_time/posix_time/time_period.hpp b/3rdParty/Boost/src/boost/date_time/posix_time/time_period.hpp index cb7bf07..11f8120 100644 --- a/3rdParty/Boost/src/boost/date_time/posix_time/time_period.hpp +++ b/3rdParty/Boost/src/boost/date_time/posix_time/time_period.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ #include "boost/date_time/period.hpp" diff --git a/3rdParty/Boost/src/boost/date_time/special_defs.hpp b/3rdParty/Boost/src/boost/date_time/special_defs.hpp index 56eb6fe..661814e 100644 --- a/3rdParty/Boost/src/boost/date_time/special_defs.hpp +++ b/3rdParty/Boost/src/boost/date_time/special_defs.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ namespace boost { diff --git a/3rdParty/Boost/src/boost/date_time/special_values_formatter.hpp b/3rdParty/Boost/src/boost/date_time/special_values_formatter.hpp index 33542b6..53fe984 100644 --- a/3rdParty/Boost/src/boost/date_time/special_values_formatter.hpp +++ b/3rdParty/Boost/src/boost/date_time/special_values_formatter.hpp @@ -7,7 +7,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ #include <vector> diff --git a/3rdParty/Boost/src/boost/date_time/string_convert.hpp b/3rdParty/Boost/src/boost/date_time/string_convert.hpp index 54a979c..a3cc86c 100644 --- a/3rdParty/Boost/src/boost/date_time/string_convert.hpp +++ b/3rdParty/Boost/src/boost/date_time/string_convert.hpp @@ -5,7 +5,7 @@ * Subject to the Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ #include "boost/date_time/compiler_config.hpp" diff --git a/3rdParty/Boost/src/boost/date_time/string_parse_tree.hpp b/3rdParty/Boost/src/boost/date_time/string_parse_tree.hpp index 0d515ff..d67bf6b 100644 --- a/3rdParty/Boost/src/boost/date_time/string_parse_tree.hpp +++ b/3rdParty/Boost/src/boost/date_time/string_parse_tree.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $ + * $Date: 2008-11-12 11:37:53 -0800 (Wed, 12 Nov 2008) $ */ diff --git a/3rdParty/Boost/src/boost/date_time/strings_from_facet.hpp b/3rdParty/Boost/src/boost/date_time/strings_from_facet.hpp index 2bc26fb..7c0765b 100644 --- a/3rdParty/Boost/src/boost/date_time/strings_from_facet.hpp +++ b/3rdParty/Boost/src/boost/date_time/strings_from_facet.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland - * $Date: 2009-02-01 06:29:43 -0500 (Sun, 01 Feb 2009) $ + * $Date: 2012-09-22 09:04:10 -0700 (Sat, 22 Sep 2012) $ */ #include <sstream> @@ -50,8 +50,8 @@ gather_month_strings(const std::locale& locale, bool short_strings=true) //grab the needed strings by using the locale to //output each month const charT* p_outfmt = outfmt.c_str(), *p_outfmt_end = p_outfmt + outfmt.size(); + tm tm_value = {}; for (int m=0; m < 12; m++) { - tm tm_value; tm_value.tm_mon = m; stringstream_type ss; ostream_iter_type oitr(ss); @@ -103,8 +103,8 @@ gather_weekday_strings(const std::locale& locale, bool short_strings=true) //grab the needed strings by using the locale to //output each month / weekday const charT* p_outfmt = outfmt.c_str(), *p_outfmt_end = p_outfmt + outfmt.size(); + tm tm_value = {}; for (int i=0; i < 7; i++) { - tm tm_value; tm_value.tm_wday = i; stringstream_type ss; ostream_iter_type oitr(ss); diff --git a/3rdParty/Boost/src/boost/date_time/time.hpp b/3rdParty/Boost/src/boost/date_time/time.hpp index 6a6cbe1..8b21144 100644 --- a/3rdParty/Boost/src/boost/date_time/time.hpp +++ b/3rdParty/Boost/src/boost/date_time/time.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $ + * $Date: 2008-11-12 11:37:53 -0800 (Wed, 12 Nov 2008) $ */ diff --git a/3rdParty/Boost/src/boost/date_time/time_clock.hpp b/3rdParty/Boost/src/boost/date_time/time_clock.hpp index 1ea5d2e8..9aa2ff0 100644 --- a/3rdParty/Boost/src/boost/date_time/time_clock.hpp +++ b/3rdParty/Boost/src/boost/date_time/time_clock.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ /*! @file time_clock.hpp diff --git a/3rdParty/Boost/src/boost/date_time/time_defs.hpp b/3rdParty/Boost/src/boost/date_time/time_defs.hpp index 55fe42a..d74631d 100644 --- a/3rdParty/Boost/src/boost/date_time/time_defs.hpp +++ b/3rdParty/Boost/src/boost/date_time/time_defs.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland - * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $ + * $Date: 2008-11-12 11:37:53 -0800 (Wed, 12 Nov 2008) $ */ diff --git a/3rdParty/Boost/src/boost/date_time/time_duration.hpp b/3rdParty/Boost/src/boost/date_time/time_duration.hpp index 2fd2590..fc3660b 100644 --- a/3rdParty/Boost/src/boost/date_time/time_duration.hpp +++ b/3rdParty/Boost/src/boost/date_time/time_duration.hpp @@ -2,15 +2,16 @@ #define DATE_TIME_TIME_DURATION_HPP___ /* Copyright (c) 2002,2003 CrystalClear Software, Inc. - * Use, modification and distribution is subject to the + * Use, modification and distribution is subject to the * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2009-06-04 04:24:49 -0400 (Thu, 04 Jun 2009) $ + * $Date: 2012-10-10 12:05:03 -0700 (Wed, 10 Oct 2012) $ */ #include <boost/cstdint.hpp> #include <boost/operators.hpp> +#include <boost/static_assert.hpp> #include <boost/date_time/time_defs.hpp> #include <boost/date_time/special_defs.hpp> #include <boost/date_time/compiler_config.hpp> @@ -179,7 +180,7 @@ namespace date_time { return duration_type(ticks_); } //! Division operations on a duration with an integer. - duration_type operator/=(int divisor) + duration_type operator/=(int divisor) { ticks_ = ticks_ / divisor; return duration_type(ticks_); @@ -251,7 +252,7 @@ namespace date_time { } protected: - explicit time_duration(impl_type in) : ticks_(in) {}; + explicit time_duration(impl_type in) : ticks_(in) {} impl_type ticks_; }; @@ -265,10 +266,20 @@ namespace date_time { class subsecond_duration : public base_duration { public: + typedef typename base_duration::impl_type impl_type; typedef typename base_duration::traits_type traits_type; + + private: + // To avoid integer overflow we precompute the duration resolution conversion coefficient (ticket #3471) + BOOST_STATIC_ASSERT_MSG((traits_type::ticks_per_second >= frac_of_second ? traits_type::ticks_per_second % frac_of_second : frac_of_second % traits_type::ticks_per_second) == 0,\ + "The base duration resolution must be a multiple of the subsecond duration resolution"); + BOOST_STATIC_CONSTANT(boost::int64_t, adjustment_ratio = (traits_type::ticks_per_second >= frac_of_second ? traits_type::ticks_per_second / frac_of_second : frac_of_second / traits_type::ticks_per_second)); + + public: explicit subsecond_duration(boost::int64_t ss) : - base_duration(0,0,0,ss*traits_type::res_adjust()/frac_of_second) - {} + base_duration(impl_type(traits_type::ticks_per_second >= frac_of_second ? ss * adjustment_ratio : ss / adjustment_ratio)) + { + } }; diff --git a/3rdParty/Boost/src/boost/date_time/time_facet.hpp b/3rdParty/Boost/src/boost/date_time/time_facet.hpp index a456db9..8346ca3 100644 --- a/3rdParty/Boost/src/boost/date_time/time_facet.hpp +++ b/3rdParty/Boost/src/boost/date_time/time_facet.hpp @@ -7,7 +7,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Martin Andrian, Jeff Garland, Bart Garst - * $Date: 2010-06-09 12:39:31 -0400 (Wed, 09 Jun 2010) $ + * $Date: 2012-09-22 09:04:10 -0700 (Sat, 22 Sep 2012) $ */ #include <cctype> @@ -244,22 +244,22 @@ namespace date_time { #endif //! sets default formats for ptime, local_date_time, and time_duration - explicit time_facet(::size_t a_ref = 0) - : base_type(default_time_format, period_formatter_type(), special_values_formatter_type(), date_gen_formatter_type(), a_ref), + explicit time_facet(::size_t ref_arg = 0) + : base_type(default_time_format, period_formatter_type(), special_values_formatter_type(), date_gen_formatter_type(), ref_arg), m_time_duration_format(string_type(duration_sign_negative_only) + default_time_duration_format) {} //! Construct the facet with an explicitly specified format - explicit time_facet(const char_type* a_format, - period_formatter_type period_formatter = period_formatter_type(), + explicit time_facet(const char_type* format_arg, + period_formatter_type period_formatter_arg = period_formatter_type(), const special_values_formatter_type& special_value_formatter = special_values_formatter_type(), date_gen_formatter_type dg_formatter = date_gen_formatter_type(), - ::size_t a_ref = 0) - : base_type(a_format, - period_formatter, + ::size_t ref_arg = 0) + : base_type(format_arg, + period_formatter_arg, special_value_formatter, dg_formatter, - a_ref), + ref_arg), m_time_duration_format(string_type(duration_sign_negative_only) + default_time_duration_format) {} @@ -278,56 +278,56 @@ namespace date_time { this->m_format = iso_time_format_extended_specifier; } - OutItrT put(OutItrT a_next, - std::ios_base& a_ios, - char_type a_fill, - const time_type& a_time) const + OutItrT put(OutItrT next_arg, + std::ios_base& ios_arg, + char_type fill_arg, + const time_type& time_arg) const { - if (a_time.is_special()) { - return this->do_put_special(a_next, a_ios, a_fill, - a_time.date().as_special()); + if (time_arg.is_special()) { + return this->do_put_special(next_arg, ios_arg, fill_arg, + time_arg.date().as_special()); } - string_type format(this->m_format); + string_type local_format(this->m_format); // %T and %R have to be replaced here since they are not standard - boost::algorithm::replace_all(format, + boost::algorithm::replace_all(local_format, boost::as_literal(formats_type::full_24_hour_time_format), boost::as_literal(formats_type::full_24_hour_time_expanded_format)); - boost::algorithm::replace_all(format, + boost::algorithm::replace_all(local_format, boost::as_literal(formats_type::short_24_hour_time_format), boost::as_literal(formats_type::short_24_hour_time_expanded_format)); string_type frac_str; - if (format.find(seconds_with_fractional_seconds_format) != string_type::npos) { + if (local_format.find(seconds_with_fractional_seconds_format) != string_type::npos) { // replace %s with %S.nnn frac_str = - fractional_seconds_as_string(a_time.time_of_day(), false); - char_type sep = std::use_facet<std::numpunct<char_type> >(a_ios.getloc()).decimal_point(); + fractional_seconds_as_string(time_arg.time_of_day(), false); + char_type sep = std::use_facet<std::numpunct<char_type> >(ios_arg.getloc()).decimal_point(); string_type replace_string(seconds_format); replace_string += sep; replace_string += frac_str; - boost::algorithm::replace_all(format, + boost::algorithm::replace_all(local_format, seconds_with_fractional_seconds_format, replace_string); } /* NOTE: replacing posix_zone_string_format must be done BEFORE * zone_name_format: "%ZP" & "%Z", if Z is checked first it will * incorrectly replace a zone_name where a posix_string should go */ - if (format.find(posix_zone_string_format) != string_type::npos) { - if(a_time.zone_abbrev().empty()) { + if (local_format.find(posix_zone_string_format) != string_type::npos) { + if(time_arg.zone_abbrev().empty()) { // if zone_abbrev() returns an empty string, we want to // erase posix_zone_string_format from format - boost::algorithm::erase_all(format, posix_zone_string_format); + boost::algorithm::erase_all(local_format, posix_zone_string_format); } else{ - boost::algorithm::replace_all(format, + boost::algorithm::replace_all(local_format, posix_zone_string_format, - a_time.zone_as_posix_string()); + time_arg.zone_as_posix_string()); } } - if (format.find(zone_name_format) != string_type::npos) { - if(a_time.zone_name().empty()) { + if (local_format.find(zone_name_format) != string_type::npos) { + if(time_arg.zone_name().empty()) { /* TODO: this'll probably create problems if a user places * the zone_*_format flag in the format with a ptime. This * code removes the flag from the default formats */ @@ -336,16 +336,16 @@ namespace date_time { // erase zone_name_format & one preceeding space std::basic_ostringstream<char_type> ss; ss << ' ' << zone_name_format; - boost::algorithm::erase_all(format, ss.str()); + boost::algorithm::erase_all(local_format, ss.str()); } else{ - boost::algorithm::replace_all(format, + boost::algorithm::replace_all(local_format, zone_name_format, - a_time.zone_name()); + time_arg.zone_name()); } } - if (format.find(zone_abbrev_format) != string_type::npos) { - if(a_time.zone_abbrev(false).empty()) { + if (local_format.find(zone_abbrev_format) != string_type::npos) { + if(time_arg.zone_abbrev(false).empty()) { /* TODO: this'll probably create problems if a user places * the zone_*_format flag in the format with a ptime. This * code removes the flag from the default formats */ @@ -354,93 +354,93 @@ namespace date_time { // erase zone_abbrev_format & one preceeding space std::basic_ostringstream<char_type> ss; ss << ' ' << zone_abbrev_format; - boost::algorithm::erase_all(format, ss.str()); + boost::algorithm::erase_all(local_format, ss.str()); } else{ - boost::algorithm::replace_all(format, + boost::algorithm::replace_all(local_format, zone_abbrev_format, - a_time.zone_abbrev(false)); + time_arg.zone_abbrev(false)); } } - if (format.find(zone_iso_extended_format) != string_type::npos) { - if(a_time.zone_name(true).empty()) { + if (local_format.find(zone_iso_extended_format) != string_type::npos) { + if(time_arg.zone_name(true).empty()) { /* TODO: this'll probably create problems if a user places * the zone_*_format flag in the format with a ptime. This * code removes the flag from the default formats */ // if zone_name() returns an empty string, we want to // erase zone_iso_extended_format from format - boost::algorithm::erase_all(format, zone_iso_extended_format); + boost::algorithm::erase_all(local_format, zone_iso_extended_format); } else{ - boost::algorithm::replace_all(format, + boost::algorithm::replace_all(local_format, zone_iso_extended_format, - a_time.zone_name(true)); + time_arg.zone_name(true)); } } - if (format.find(zone_iso_format) != string_type::npos) { - if(a_time.zone_abbrev(true).empty()) { + if (local_format.find(zone_iso_format) != string_type::npos) { + if(time_arg.zone_abbrev(true).empty()) { /* TODO: this'll probably create problems if a user places * the zone_*_format flag in the format with a ptime. This * code removes the flag from the default formats */ // if zone_abbrev() returns an empty string, we want to // erase zone_iso_format from format - boost::algorithm::erase_all(format, zone_iso_format); + boost::algorithm::erase_all(local_format, zone_iso_format); } else{ - boost::algorithm::replace_all(format, + boost::algorithm::replace_all(local_format, zone_iso_format, - a_time.zone_abbrev(true)); + time_arg.zone_abbrev(true)); } } - if (format.find(fractional_seconds_format) != string_type::npos) { + if (local_format.find(fractional_seconds_format) != string_type::npos) { // replace %f with nnnnnnn if (frac_str.empty()) { - frac_str = fractional_seconds_as_string(a_time.time_of_day(), false); + frac_str = fractional_seconds_as_string(time_arg.time_of_day(), false); } - boost::algorithm::replace_all(format, + boost::algorithm::replace_all(local_format, fractional_seconds_format, frac_str); } - if (format.find(fractional_seconds_or_none_format) != string_type::npos) { + if (local_format.find(fractional_seconds_or_none_format) != string_type::npos) { // replace %F with nnnnnnn or nothing if fs == 0 frac_str = - fractional_seconds_as_string(a_time.time_of_day(), true); + fractional_seconds_as_string(time_arg.time_of_day(), true); if (frac_str.size()) { - char_type sep = std::use_facet<std::numpunct<char_type> >(a_ios.getloc()).decimal_point(); + char_type sep = std::use_facet<std::numpunct<char_type> >(ios_arg.getloc()).decimal_point(); string_type replace_string; replace_string += sep; replace_string += frac_str; - boost::algorithm::replace_all(format, + boost::algorithm::replace_all(local_format, fractional_seconds_or_none_format, replace_string); } else { - boost::algorithm::erase_all(format, + boost::algorithm::erase_all(local_format, fractional_seconds_or_none_format); } } - return this->do_put_tm(a_next, a_ios, a_fill, - to_tm(a_time), format); + return this->do_put_tm(next_arg, ios_arg, fill_arg, + to_tm(time_arg), local_format); } //! put function for time_duration - OutItrT put(OutItrT a_next, - std::ios_base& a_ios, - char_type a_fill, - const time_duration_type& a_time_dur) const + OutItrT put(OutItrT next_arg, + std::ios_base& ios_arg, + char_type fill_arg, + const time_duration_type& time_dur_arg) const { - if (a_time_dur.is_special()) { - return this->do_put_special(a_next, a_ios, a_fill, - a_time_dur.get_rep().as_special()); + if (time_dur_arg.is_special()) { + return this->do_put_special(next_arg, ios_arg, fill_arg, + time_dur_arg.get_rep().as_special()); } string_type format(m_time_duration_format); - if (a_time_dur.is_negative()) { + if (time_dur_arg.is_negative()) { // replace %- with minus sign. Should we use the numpunct facet? boost::algorithm::replace_all(format, duration_sign_negative_only, @@ -477,7 +477,7 @@ namespace date_time { */ string_type hours_str; if (format.find(unrestricted_hours_format) != string_type::npos) { - hours_str = hours_as_string(a_time_dur); + hours_str = hours_as_string(time_dur_arg); boost::algorithm::replace_all(format, unrestricted_hours_format, hours_str); } // We still have to process restricted hours format specifier. In order to @@ -485,7 +485,7 @@ namespace date_time { // restrict the stringified hours length to 2 characters. if (format.find(hours_format) != string_type::npos) { if (hours_str.empty()) - hours_str = hours_as_string(a_time_dur); + hours_str = hours_as_string(time_dur_arg); BOOST_ASSERT(hours_str.length() <= 2); boost::algorithm::replace_all(format, hours_format, hours_str); } @@ -494,8 +494,8 @@ namespace date_time { if (format.find(seconds_with_fractional_seconds_format) != string_type::npos) { // replace %s with %S.nnn frac_str = - fractional_seconds_as_string(a_time_dur, false); - char_type sep = std::use_facet<std::numpunct<char_type> >(a_ios.getloc()).decimal_point(); + fractional_seconds_as_string(time_dur_arg, false); + char_type sep = std::use_facet<std::numpunct<char_type> >(ios_arg.getloc()).decimal_point(); string_type replace_string(seconds_format); replace_string += sep; @@ -507,7 +507,7 @@ namespace date_time { if (format.find(fractional_seconds_format) != string_type::npos) { // replace %f with nnnnnnn if (!frac_str.size()) { - frac_str = fractional_seconds_as_string(a_time_dur, false); + frac_str = fractional_seconds_as_string(time_dur_arg, false); } boost::algorithm::replace_all(format, fractional_seconds_format, @@ -517,9 +517,9 @@ namespace date_time { if (format.find(fractional_seconds_or_none_format) != string_type::npos) { // replace %F with nnnnnnn or nothing if fs == 0 frac_str = - fractional_seconds_as_string(a_time_dur, true); + fractional_seconds_as_string(time_dur_arg, true); if (frac_str.size()) { - char_type sep = std::use_facet<std::numpunct<char_type> >(a_ios.getloc()).decimal_point(); + char_type sep = std::use_facet<std::numpunct<char_type> >(ios_arg.getloc()).decimal_point(); string_type replace_string; replace_string += sep; replace_string += frac_str; @@ -533,14 +533,14 @@ namespace date_time { } } - return this->do_put_tm(a_next, a_ios, a_fill, - to_tm(a_time_dur), format); + return this->do_put_tm(next_arg, ios_arg, fill_arg, + to_tm(time_dur_arg), format); } - OutItrT put(OutItrT next, std::ios_base& a_ios, + OutItrT put(OutItrT next, std::ios_base& ios_arg, char_type fill, const period_type& p) const { - return this->m_period_formatter.put_period(next, a_ios, fill,p,*this); + return this->m_period_formatter.put_period(next, ios_arg, fill,p,*this); } @@ -548,11 +548,11 @@ namespace date_time { static string_type - fractional_seconds_as_string(const time_duration_type& a_time, + fractional_seconds_as_string(const time_duration_type& time_arg, bool null_when_zero) { typename time_duration_type::fractional_seconds_type frac_sec = - a_time.fractional_seconds(); + time_arg.fractional_seconds(); if (null_when_zero && (frac_sec == 0)) { return string_type(); @@ -566,9 +566,9 @@ namespace date_time { static string_type - hours_as_string(const time_duration_type& a_time, int width = 2) + hours_as_string(const time_duration_type& time_arg, int width = 2) { - return integral_as_string(date_time::absolute_value(a_time.hours()), width); + return integral_as_string(date_time::absolute_value(time_arg.hours()), width); } template< typename IntT > @@ -731,8 +731,8 @@ namespace date_time { static std::locale::id id; //! Constructor that takes a format string for a ptime - explicit time_input_facet(const string_type& format, ::size_t a_ref = 0) - : base_type(format, a_ref), + explicit time_input_facet(const string_type& format, ::size_t ref_arg = 0) + : base_type(format, ref_arg), m_time_duration_format(default_time_duration_format) { } @@ -741,19 +741,19 @@ namespace date_time { const special_values_parser_type& sv_parser, const period_parser_type& per_parser, const date_gen_parser_type& date_gen_parser, - ::size_t a_ref = 0) + ::size_t ref_arg = 0) : base_type(format, date_parser, sv_parser, per_parser, date_gen_parser, - a_ref), + ref_arg), m_time_duration_format(default_time_duration_format) {} //! sets default formats for ptime, local_date_time, and time_duration - explicit time_input_facet(::size_t a_ref = 0) - : base_type(default_time_input_format, a_ref), + explicit time_input_facet(::size_t ref_arg = 0) + : base_type(default_time_input_format, ref_arg), m_time_duration_format(default_time_duration_format) { } @@ -772,12 +772,12 @@ namespace date_time { InItrT get(InItrT& sitr, InItrT& stream_end, - std::ios_base& a_ios, + std::ios_base& ios_arg, period_type& p) const { p = this->m_period_parser.get_period(sitr, stream_end, - a_ios, + ios_arg, p, time_duration_type::unit(), *this); @@ -789,7 +789,7 @@ namespace date_time { InItrT get(InItrT& sitr, InItrT& stream_end, - std::ios_base& a_ios, + std::ios_base& ios_arg, time_duration_type& td) const { // skip leading whitespace @@ -813,10 +813,10 @@ namespace date_time { typename time_duration_type::fractional_seconds_type frac(0); typedef std::num_get<CharT, InItrT> num_get; - if(!std::has_facet<num_get>(a_ios.getloc())) { + if(!std::has_facet<num_get>(ios_arg.getloc())) { num_get* ng = new num_get(); - std::locale loc = std::locale(a_ios.getloc(), ng); - a_ios.imbue(loc); + std::locale loc = std::locale(ios_arg.getloc(), ng); + ios_arg.imbue(loc); } const_itr itr(m_time_duration_format.begin()); @@ -928,27 +928,27 @@ namespace date_time { //! Parses a time object from the input stream InItrT get(InItrT& sitr, InItrT& stream_end, - std::ios_base& a_ios, + std::ios_base& ios_arg, time_type& t) const { string_type tz_str; - return get(sitr, stream_end, a_ios, t, tz_str, false); + return get(sitr, stream_end, ios_arg, t, tz_str, false); } //! Expects a time_zone in the input stream InItrT get_local_time(InItrT& sitr, InItrT& stream_end, - std::ios_base& a_ios, + std::ios_base& ios_arg, time_type& t, string_type& tz_str) const { - return get(sitr, stream_end, a_ios, t, tz_str, true); + return get(sitr, stream_end, ios_arg, t, tz_str, true); } protected: InItrT get(InItrT& sitr, InItrT& stream_end, - std::ios_base& a_ios, + std::ios_base& ios_arg, time_type& t, string_type& tz_str, bool time_is_local) const @@ -985,10 +985,10 @@ namespace date_time { day_type t_day(1); typedef std::num_get<CharT, InItrT> num_get; - if(!std::has_facet<num_get>(a_ios.getloc())) { + if(!std::has_facet<num_get>(ios_arg.getloc())) { num_get* ng = new num_get(); - std::locale loc = std::locale(a_ios.getloc(), ng); - a_ios.imbue(loc); + std::locale loc = std::locale(ios_arg.getloc(), ng); + ios_arg.imbue(loc); } const_itr itr(this->m_format.begin()); diff --git a/3rdParty/Boost/src/boost/date_time/time_formatting_streams.hpp b/3rdParty/Boost/src/boost/date_time/time_formatting_streams.hpp index 3537c10..2d07d34 100644 --- a/3rdParty/Boost/src/boost/date_time/time_formatting_streams.hpp +++ b/3rdParty/Boost/src/boost/date_time/time_formatting_streams.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $ + * $Date: 2008-11-12 11:37:53 -0800 (Wed, 12 Nov 2008) $ */ #include <boost/date_time/compiler_config.hpp> diff --git a/3rdParty/Boost/src/boost/date_time/time_iterator.hpp b/3rdParty/Boost/src/boost/date_time/time_iterator.hpp index 2258a33..4c33f39 100644 --- a/3rdParty/Boost/src/boost/date_time/time_iterator.hpp +++ b/3rdParty/Boost/src/boost/date_time/time_iterator.hpp @@ -2,50 +2,50 @@ #define DATE_TIME_TIME_ITERATOR_HPP___ /* Copyright (c) 2002,2003 CrystalClear Software, Inc. - * Use, modification and distribution is subject to the + * Use, modification and distribution is subject to the * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2012-09-22 15:33:33 -0700 (Sat, 22 Sep 2012) $ */ namespace boost { namespace date_time { - + //! Simple time iterator skeleton class template<class time_type> class time_itr { public: typedef typename time_type::time_duration_type time_duration_type; - time_itr(time_type t, time_duration_type d) : current_(t), offset_(d) {}; - time_itr& operator++() + time_itr(time_type t, time_duration_type d) : current_(t), offset_(d) {} + time_itr& operator++() { current_ = current_ + offset_; return *this; } - time_itr& operator--() + time_itr& operator--() { current_ = current_ - offset_; return *this; } - time_type operator*() {return current_;}; - time_type* operator->() {return ¤t_;}; - bool operator< (const time_type& t) {return current_ < t;}; - bool operator<= (const time_type& t) {return current_ <= t;}; - bool operator!= (const time_type& t) {return current_ != t;}; - bool operator== (const time_type& t) {return current_ == t;}; - bool operator> (const time_type& t) {return current_ > t;}; - bool operator>= (const time_type& t) {return current_ >= t;}; - + time_type operator*() {return current_;} + time_type* operator->() {return ¤t_;} + bool operator< (const time_type& t) {return current_ < t;} + bool operator<= (const time_type& t) {return current_ <= t;} + bool operator!= (const time_type& t) {return current_ != t;} + bool operator== (const time_type& t) {return current_ == t;} + bool operator> (const time_type& t) {return current_ > t;} + bool operator>= (const time_type& t) {return current_ >= t;} + private: time_type current_; time_duration_type offset_; }; - - + + } }//namespace date_time diff --git a/3rdParty/Boost/src/boost/date_time/time_parsing.hpp b/3rdParty/Boost/src/boost/date_time/time_parsing.hpp index dfccf6a..7b71de0 100644 --- a/3rdParty/Boost/src/boost/date_time/time_parsing.hpp +++ b/3rdParty/Boost/src/boost/date_time/time_parsing.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2012-10-10 12:05:03 -0700 (Wed, 10 Oct 2012) $ */ #include "boost/tokenizer.hpp" @@ -116,6 +116,7 @@ namespace date_time { break; } + default: break; }//switch pos++; } @@ -153,9 +154,10 @@ namespace date_time { std::string& first, std::string& second) { - int sep_pos = static_cast<int>(s.find(sep)); + std::string::size_type sep_pos = s.find(sep); first = s.substr(0,sep_pos); - second = s.substr(sep_pos+1); + if (sep_pos!=std::string::npos) + second = s.substr(sep_pos+1); return true; } @@ -280,6 +282,7 @@ namespace date_time { break; } + default: break; }; pos++; } diff --git a/3rdParty/Boost/src/boost/date_time/time_resolution_traits.hpp b/3rdParty/Boost/src/boost/date_time/time_resolution_traits.hpp index 658f3d2..903830c 100644 --- a/3rdParty/Boost/src/boost/date_time/time_resolution_traits.hpp +++ b/3rdParty/Boost/src/boost/date_time/time_resolution_traits.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2009-06-06 07:25:55 -0400 (Sat, 06 Jun 2009) $ + * $Date: 2009-06-06 04:25:55 -0700 (Sat, 06 Jun 2009) $ */ diff --git a/3rdParty/Boost/src/boost/date_time/time_system_counted.hpp b/3rdParty/Boost/src/boost/date_time/time_system_counted.hpp index fa88390..5425f62 100644 --- a/3rdParty/Boost/src/boost/date_time/time_system_counted.hpp +++ b/3rdParty/Boost/src/boost/date_time/time_system_counted.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ diff --git a/3rdParty/Boost/src/boost/date_time/time_system_split.hpp b/3rdParty/Boost/src/boost/date_time/time_system_split.hpp index 08ea1ec..6fc4a33 100644 --- a/3rdParty/Boost/src/boost/date_time/time_system_split.hpp +++ b/3rdParty/Boost/src/boost/date_time/time_system_split.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-11-13 15:10:23 -0500 (Thu, 13 Nov 2008) $ + * $Date: 2008-11-13 12:10:23 -0800 (Thu, 13 Nov 2008) $ */ diff --git a/3rdParty/Boost/src/boost/date_time/time_zone_base.hpp b/3rdParty/Boost/src/boost/date_time/time_zone_base.hpp index 0d3cb90..f239d54 100644 --- a/3rdParty/Boost/src/boost/date_time/time_zone_base.hpp +++ b/3rdParty/Boost/src/boost/date_time/time_zone_base.hpp @@ -2,10 +2,10 @@ #define _DATE_TIME_TIME_ZONE_BASE__ /* Copyright (c) 2003-2005 CrystalClear Software, Inc. - * Subject to the Boost Software License, Version 1.0. + * Subject to the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2012-09-22 15:33:33 -0700 (Sat, 22 Sep 2012) $ */ @@ -26,9 +26,9 @@ namespace date_time { * would be to convert from POSIX timezone strings. Regardless of * the construction technique, this is the interface that these * time zone types must provide. - * + * * Note that this class is intended to be used as a shared - * resource (hence the derivation from boost::counted_base. + * resource (hence the derivation from boost::counted_base. */ template<typename time_type, typename CharT> class time_zone_base { @@ -39,8 +39,8 @@ namespace date_time { typedef typename time_type::date_type::year_type year_type; typedef typename time_type::time_duration_type time_duration_type; - time_zone_base() {}; - virtual ~time_zone_base() {}; + time_zone_base() {} + virtual ~time_zone_base() {} //!String for the timezone when in daylight savings (eg: EDT) virtual string_type dst_zone_abbrev() const=0; //!String for the zone when not in daylight savings (eg: EST) @@ -61,9 +61,9 @@ namespace date_time { virtual time_duration_type dst_offset() const=0; //! Returns a POSIX time_zone string for this object virtual string_type to_posix_string() const =0; - + private: - + }; @@ -82,7 +82,7 @@ namespace date_time { dst_start_offset_(dst_start_offset), dst_end_offset_(dst_end_offset) {} - + //! Amount DST adjusts the clock eg: plus one hour time_duration_type dst_adjust_; //! Time past midnight on start transition day that dst starts diff --git a/3rdParty/Boost/src/boost/date_time/time_zone_names.hpp b/3rdParty/Boost/src/boost/date_time/time_zone_names.hpp index 05260c7..a565027 100644 --- a/3rdParty/Boost/src/boost/date_time/time_zone_names.hpp +++ b/3rdParty/Boost/src/boost/date_time/time_zone_names.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ #include <string> diff --git a/3rdParty/Boost/src/boost/date_time/tz_db_base.hpp b/3rdParty/Boost/src/boost/date_time/tz_db_base.hpp index 2440115..a6d8ea9 100644 --- a/3rdParty/Boost/src/boost/date_time/tz_db_base.hpp +++ b/3rdParty/Boost/src/boost/date_time/tz_db_base.hpp @@ -5,7 +5,7 @@ * Subject to the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $ + * $Date: 2012-09-22 09:04:10 -0700 (Sat, 22 Sep 2012) $ */ #include <map> @@ -167,6 +167,16 @@ namespace boost { tz_db_base() {} //! Process csv data file, may throw exceptions + /*! May throw bad_field_count exceptions */ + void load_from_stream(std::istream &in) + { + std::string buff; + while( std::getline(in, buff)) { + parse_string(buff); + } + } + + //! Process csv data file, may throw exceptions /*! May throw data_not_accessible, or bad_field_count exceptions */ void load_from_file(const std::string& pathspec) { @@ -178,10 +188,7 @@ namespace boost { boost::throw_exception(data_not_accessible(pathspec)); } std::getline(ifs, buff); // first line is column headings - - while( std::getline(ifs, buff)) { - parse_string(buff); - } + this->load_from_stream(ifs); } //! returns true if record successfully added to map diff --git a/3rdParty/Boost/src/boost/date_time/wrapping_int.hpp b/3rdParty/Boost/src/boost/date_time/wrapping_int.hpp index 969b078..e6f87d5 100644 --- a/3rdParty/Boost/src/boost/date_time/wrapping_int.hpp +++ b/3rdParty/Boost/src/boost/date_time/wrapping_int.hpp @@ -2,11 +2,11 @@ #define _DATE_TIME_WRAPPING_INT_HPP__ /* Copyright (c) 2002,2003,2005 CrystalClear Software, Inc. - * Use, modification and distribution is subject to the + * Use, modification and distribution is subject to the * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-11-12 14:37:53 -0500 (Wed, 12 Nov 2008) $ + * $Date: 2012-09-22 15:33:33 -0700 (Sat, 22 Sep 2012) $ */ @@ -16,15 +16,15 @@ namespace date_time { //! A wrapping integer used to support time durations (WARNING: only instantiate with a signed type) /*! In composite date and time types this type is used to * wrap at the day boundary. - * Ex: - * A wrapping_int<short, 10> will roll over after nine, and + * Ex: + * A wrapping_int<short, 10> will roll over after nine, and * roll under below zero. This gives a range of [0,9] * - * NOTE: it is strongly recommended that wrapping_int2 be used - * instead of wrapping_int as wrapping_int is to be depricated + * NOTE: it is strongly recommended that wrapping_int2 be used + * instead of wrapping_int as wrapping_int is to be depricated * at some point soon. * - * Also Note that warnings will occur if instantiated with an + * Also Note that warnings will occur if instantiated with an * unsigned type. Only a signed type should be used! */ template<typename int_type_, int_type_ wrap_val> @@ -34,17 +34,17 @@ public: //typedef overflow_type_ overflow_type; static int_type wrap_value() {return wrap_val;} //!Add, return true if wrapped - wrapping_int(int_type v) : value_(v) {}; + wrapping_int(int_type v) : value_(v) {} //! Explicit converion method int_type as_int() const {return value_;} operator int_type() const {return value_;} //!Add, return number of wraps performed - /*! The sign of the returned value will indicate which direction the + /*! The sign of the returned value will indicate which direction the * wraps went. Ex: add a negative number and wrapping under could occur, - * this would be indicated by a negative return value. If wrapping over + * this would be indicated by a negative return value. If wrapping over * took place, a positive value would be returned */ template< typename IntT > - IntT add(IntT v) + IntT add(IntT v) { int_type remainder = static_cast<int_type>(v % (wrap_val)); IntT overflow = static_cast<IntT>(v / (wrap_val)); @@ -53,12 +53,12 @@ public: } //! Subtract will return '+d' if wrapping under took place ('d' is the number of wraps) /*! The sign of the returned value will indicate which direction the - * wraps went (positive indicates wrap under, negative indicates wrap over). - * Ex: subtract a negative number and wrapping over could - * occur, this would be indicated by a negative return value. If + * wraps went (positive indicates wrap under, negative indicates wrap over). + * Ex: subtract a negative number and wrapping over could + * occur, this would be indicated by a negative return value. If * wrapping under took place, a positive value would be returned. */ template< typename IntT > - IntT subtract(IntT v) + IntT subtract(IntT v) { int_type remainder = static_cast<int_type>(v % (wrap_val)); IntT underflow = static_cast<IntT>(-(v / (wrap_val))); @@ -71,19 +71,19 @@ private: template< typename IntT > IntT calculate_wrap(IntT wrap) { - if ((value_) >= wrap_val) + if ((value_) >= wrap_val) { ++wrap; value_ -= (wrap_val); } - else if(value_ < 0) + else if(value_ < 0) { --wrap; value_ += (wrap_val); } return wrap; } - + }; @@ -113,12 +113,12 @@ public: int_type as_int() const {return value_;} operator int_type() const {return value_;} //!Add, return number of wraps performed - /*! The sign of the returned value will indicate which direction the + /*! The sign of the returned value will indicate which direction the * wraps went. Ex: add a negative number and wrapping under could occur, - * this would be indicated by a negative return value. If wrapping over + * this would be indicated by a negative return value. If wrapping over * took place, a positive value would be returned */ template< typename IntT > - IntT add(IntT v) + IntT add(IntT v) { int_type remainder = static_cast<int_type>(v % (wrap_max - wrap_min + 1)); IntT overflow = static_cast<IntT>(v / (wrap_max - wrap_min + 1)); @@ -127,30 +127,30 @@ public: } //! Subtract will return '-d' if wrapping under took place ('d' is the number of wraps) /*! The sign of the returned value will indicate which direction the - * wraps went. Ex: subtract a negative number and wrapping over could - * occur, this would be indicated by a positive return value. If + * wraps went. Ex: subtract a negative number and wrapping over could + * occur, this would be indicated by a positive return value. If * wrapping under took place, a negative value would be returned */ template< typename IntT > - IntT subtract(IntT v) + IntT subtract(IntT v) { int_type remainder = static_cast<int_type>(v % (wrap_max - wrap_min + 1)); IntT underflow = static_cast<IntT>(-(v / (wrap_max - wrap_min + 1))); value_ = static_cast<int_type>(value_ - remainder); return calculate_wrap(underflow); } - + private: int_type value_; template< typename IntT > IntT calculate_wrap(IntT wrap) { - if ((value_) > wrap_max) + if ((value_) > wrap_max) { ++wrap; value_ -= (wrap_max - wrap_min + 1); } - else if((value_) < wrap_min) + else if((value_) < wrap_min) { --wrap; value_ += (wrap_max - wrap_min + 1); diff --git a/3rdParty/Boost/src/boost/date_time/year_month_day.hpp b/3rdParty/Boost/src/boost/date_time/year_month_day.hpp index 802ce42..9340e53 100644 --- a/3rdParty/Boost/src/boost/date_time/year_month_day.hpp +++ b/3rdParty/Boost/src/boost/date_time/year_month_day.hpp @@ -6,7 +6,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ namespace boost { diff --git a/3rdParty/Boost/src/boost/detail/allocator_utilities.hpp b/3rdParty/Boost/src/boost/detail/allocator_utilities.hpp deleted file mode 100644 index 5d6ef48..0000000 --- a/3rdParty/Boost/src/boost/detail/allocator_utilities.hpp +++ /dev/null @@ -1,212 +0,0 @@ -/* Copyright 2003-2009 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) - * - * See Boost website at http://www.boost.org/ - */ - -#ifndef BOOST_DETAIL_ALLOCATOR_UTILITIES_HPP -#define BOOST_DETAIL_ALLOCATOR_UTILITIES_HPP - -#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> -#include <memory> -#include <new> - -namespace boost{ - -namespace detail{ - -/* Allocator adaption layer. Some stdlibs provide allocators without rebind - * and template ctors. These facilities are simulated with the external - * template class rebind_to and the aid of partial_std_allocator_wrapper. - */ - -namespace allocator{ - -/* partial_std_allocator_wrapper inherits the functionality of a std - * allocator while providing a templatized ctor and other bits missing - * in some stdlib implementation or another. - */ - -template<typename Type> -class partial_std_allocator_wrapper:public std::allocator<Type> -{ -public: - /* Oddly enough, STLport does not define std::allocator<void>::value_type - * when configured to work without partial template specialization. - * No harm in supplying the definition here unconditionally. - */ - - typedef Type value_type; - - partial_std_allocator_wrapper(){}; - - template<typename Other> - partial_std_allocator_wrapper(const partial_std_allocator_wrapper<Other>&){} - - partial_std_allocator_wrapper(const std::allocator<Type>& x): - std::allocator<Type>(x) - { - }; - -#if defined(BOOST_DINKUMWARE_STDLIB) - /* Dinkumware guys didn't provide a means to call allocate() without - * supplying a hint, in disagreement with the standard. - */ - - Type* allocate(std::size_t n,const void* hint=0) - { - std::allocator<Type>& a=*this; - return a.allocate(n,hint); - } -#endif - -}; - -/* Detects whether a given allocator belongs to a defective stdlib not - * having the required member templates. - * Note that it does not suffice to check the Boost.Config stdlib - * macros, as the user might have passed a custom, compliant allocator. - * The checks also considers partial_std_allocator_wrapper to be - * a standard defective allocator. - */ - -#if defined(BOOST_NO_STD_ALLOCATOR)&&\ - (defined(BOOST_HAS_PARTIAL_STD_ALLOCATOR)||defined(BOOST_DINKUMWARE_STDLIB)) - -template<typename Allocator> -struct is_partial_std_allocator -{ - BOOST_STATIC_CONSTANT(bool, - value= - (is_same< - std::allocator<BOOST_DEDUCED_TYPENAME Allocator::value_type>, - Allocator - >::value)|| - (is_same< - partial_std_allocator_wrapper< - BOOST_DEDUCED_TYPENAME Allocator::value_type>, - Allocator - >::value)); -}; - -#else - -template<typename Allocator> -struct is_partial_std_allocator -{ - BOOST_STATIC_CONSTANT(bool,value=false); -}; - -#endif - -/* rebind operations for defective std allocators */ - -template<typename Allocator,typename Type> -struct partial_std_allocator_rebind_to -{ - typedef partial_std_allocator_wrapper<Type> type; -}; - -/* 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 -{ - template<typename Type> - struct result - { - typedef typename Allocator::BOOST_NESTED_TEMPLATE - rebind<Type>::other other; - }; -}; -#endif - -template<typename Allocator,typename Type> -struct compliant_allocator_rebind_to -{ - typedef typename rebinder<Allocator>:: - BOOST_NESTED_TEMPLATE result<Type>::other type; -}; - -/* rebind front-end */ - -template<typename Allocator,typename Type> -struct rebind_to: - mpl::eval_if_c< - is_partial_std_allocator<Allocator>::value, - partial_std_allocator_rebind_to<Allocator,Type>, - compliant_allocator_rebind_to<Allocator,Type> - > -{ -}; - -/* allocator-independent versions of construct and destroy */ - -template<typename Type> -void construct(void* p,const Type& t) -{ - new (p) Type(t); -} - -#if BOOST_WORKAROUND(BOOST_MSVC,BOOST_TESTED_AT(1500)) -/* MSVC++ issues spurious warnings about unreferencend formal parameters - * in destroy<Type> when Type is a class with trivial dtor. - */ - -#pragma warning(push) -#pragma warning(disable:4100) -#endif - -template<typename Type> -void destroy(const Type* p) -{ - -#if BOOST_WORKAROUND(__SUNPRO_CC,BOOST_TESTED_AT(0x590)) - const_cast<Type*>(p)->~Type(); -#else - p->~Type(); -#endif - -} - -#if BOOST_WORKAROUND(BOOST_MSVC,BOOST_TESTED_AT(1500)) -#pragma warning(pop) -#endif - -} /* namespace boost::detail::allocator */ - -} /* namespace boost::detail */ - -} /* namespace boost */ - -#endif diff --git a/3rdParty/Boost/src/boost/detail/call_traits.hpp b/3rdParty/Boost/src/boost/detail/call_traits.hpp index 6ad646e..36dea00 100644 --- a/3rdParty/Boost/src/boost/detail/call_traits.hpp +++ b/3rdParty/Boost/src/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/3rdParty/Boost/src/boost/detail/compressed_pair.hpp b/3rdParty/Boost/src/boost/detail/compressed_pair.hpp deleted file mode 100644 index 3f32645..0000000 --- a/3rdParty/Boost/src/boost/detail/compressed_pair.hpp +++ /dev/null @@ -1,443 +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. - -// compressed_pair: pair that "compresses" empty members -// (see libs/utility/compressed_pair.htm) -// -// JM changes 25 Jan 2004: -// For the case where T1 == T2 and both are empty, then first() and second() -// should return different objects. -// JM changes 25 Jan 2000: -// Removed default arguments from compressed_pair_switch to get -// C++ Builder 4 to accept them -// rewriten swap to get gcc and C++ builder to compile. -// added partial specialisations for case T1 == T2 to avoid duplicate constructor defs. - -#ifndef BOOST_DETAIL_COMPRESSED_PAIR_HPP -#define BOOST_DETAIL_COMPRESSED_PAIR_HPP - -#include <algorithm> - -#include <boost/type_traits/remove_cv.hpp> -#include <boost/type_traits/is_empty.hpp> -#include <boost/type_traits/is_same.hpp> -#include <boost/call_traits.hpp> - -#ifdef BOOST_MSVC -# pragma warning(push) -# pragma warning(disable:4512) -#endif -namespace boost -{ - -template <class T1, class T2> -class compressed_pair; - - -// compressed_pair - -namespace details -{ - // JM altered 26 Jan 2000: - template <class T1, class T2, bool IsSame, bool FirstEmpty, bool SecondEmpty> - struct compressed_pair_switch; - - template <class T1, class T2> - struct compressed_pair_switch<T1, T2, false, false, false> - {static const int value = 0;}; - - template <class T1, class T2> - struct compressed_pair_switch<T1, T2, false, true, true> - {static const int value = 3;}; - - template <class T1, class T2> - struct compressed_pair_switch<T1, T2, false, true, false> - {static const int value = 1;}; - - template <class T1, class T2> - struct compressed_pair_switch<T1, T2, false, false, true> - {static const int value = 2;}; - - template <class T1, class T2> - struct compressed_pair_switch<T1, T2, true, true, true> - {static const int value = 4;}; - - template <class T1, class T2> - struct compressed_pair_switch<T1, T2, true, false, false> - {static const int value = 5;}; - - template <class T1, class T2, int Version> class compressed_pair_imp; - -#ifdef __GNUC__ - // workaround for GCC (JM): - using std::swap; -#endif - // - // can't call unqualified swap from within classname::swap - // as Koenig lookup rules will find only the classname::swap - // member function not the global declaration, so use cp_swap - // as a forwarding function (JM): - template <typename T> - inline void cp_swap(T& t1, T& t2) - { -#ifndef __GNUC__ - using std::swap; -#endif - swap(t1, t2); - } - - // 0 derive from neither - - template <class T1, class T2> - class compressed_pair_imp<T1, T2, 0> - { - public: - typedef T1 first_type; - typedef T2 second_type; - typedef typename call_traits<first_type>::param_type first_param_type; - typedef typename call_traits<second_type>::param_type second_param_type; - typedef typename call_traits<first_type>::reference first_reference; - typedef typename call_traits<second_type>::reference second_reference; - typedef typename call_traits<first_type>::const_reference first_const_reference; - typedef typename call_traits<second_type>::const_reference second_const_reference; - - compressed_pair_imp() {} - - compressed_pair_imp(first_param_type x, second_param_type y) - : first_(x), second_(y) {} - - compressed_pair_imp(first_param_type x) - : first_(x) {} - - compressed_pair_imp(second_param_type y) - : second_(y) {} - - first_reference first() {return first_;} - first_const_reference first() const {return first_;} - - second_reference second() {return second_;} - second_const_reference second() const {return second_;} - - void swap(::boost::compressed_pair<T1, T2>& y) - { - cp_swap(first_, y.first()); - cp_swap(second_, y.second()); - } - private: - first_type first_; - second_type second_; - }; - - // 1 derive from T1 - - template <class T1, class T2> - class compressed_pair_imp<T1, T2, 1> - : protected ::boost::remove_cv<T1>::type - { - public: - typedef T1 first_type; - typedef T2 second_type; - typedef typename call_traits<first_type>::param_type first_param_type; - typedef typename call_traits<second_type>::param_type second_param_type; - typedef typename call_traits<first_type>::reference first_reference; - typedef typename call_traits<second_type>::reference second_reference; - typedef typename call_traits<first_type>::const_reference first_const_reference; - typedef typename call_traits<second_type>::const_reference second_const_reference; - - compressed_pair_imp() {} - - compressed_pair_imp(first_param_type x, second_param_type y) - : first_type(x), second_(y) {} - - compressed_pair_imp(first_param_type x) - : first_type(x) {} - - compressed_pair_imp(second_param_type y) - : second_(y) {} - - first_reference first() {return *this;} - first_const_reference first() const {return *this;} - - second_reference second() {return second_;} - second_const_reference second() const {return second_;} - - void swap(::boost::compressed_pair<T1,T2>& y) - { - // no need to swap empty base class: - cp_swap(second_, y.second()); - } - private: - second_type second_; - }; - - // 2 derive from T2 - - template <class T1, class T2> - class compressed_pair_imp<T1, T2, 2> - : protected ::boost::remove_cv<T2>::type - { - public: - typedef T1 first_type; - typedef T2 second_type; - typedef typename call_traits<first_type>::param_type first_param_type; - typedef typename call_traits<second_type>::param_type second_param_type; - typedef typename call_traits<first_type>::reference first_reference; - typedef typename call_traits<second_type>::reference second_reference; - typedef typename call_traits<first_type>::const_reference first_const_reference; - typedef typename call_traits<second_type>::const_reference second_const_reference; - - compressed_pair_imp() {} - - compressed_pair_imp(first_param_type x, second_param_type y) - : second_type(y), first_(x) {} - - compressed_pair_imp(first_param_type x) - : first_(x) {} - - compressed_pair_imp(second_param_type y) - : second_type(y) {} - - first_reference first() {return first_;} - first_const_reference first() const {return first_;} - - second_reference second() {return *this;} - second_const_reference second() const {return *this;} - - void swap(::boost::compressed_pair<T1,T2>& y) - { - // no need to swap empty base class: - cp_swap(first_, y.first()); - } - - private: - first_type first_; - }; - - // 3 derive from T1 and T2 - - template <class T1, class T2> - class compressed_pair_imp<T1, T2, 3> - : protected ::boost::remove_cv<T1>::type, - protected ::boost::remove_cv<T2>::type - { - public: - typedef T1 first_type; - typedef T2 second_type; - typedef typename call_traits<first_type>::param_type first_param_type; - typedef typename call_traits<second_type>::param_type second_param_type; - typedef typename call_traits<first_type>::reference first_reference; - typedef typename call_traits<second_type>::reference second_reference; - typedef typename call_traits<first_type>::const_reference first_const_reference; - typedef typename call_traits<second_type>::const_reference second_const_reference; - - compressed_pair_imp() {} - - compressed_pair_imp(first_param_type x, second_param_type y) - : first_type(x), second_type(y) {} - - compressed_pair_imp(first_param_type x) - : first_type(x) {} - - compressed_pair_imp(second_param_type y) - : second_type(y) {} - - first_reference first() {return *this;} - first_const_reference first() const {return *this;} - - second_reference second() {return *this;} - second_const_reference second() const {return *this;} - // - // no need to swap empty bases: - void swap(::boost::compressed_pair<T1,T2>&) {} - }; - - // JM - // 4 T1 == T2, T1 and T2 both empty - // Originally this did not store an instance of T2 at all - // but that led to problems beause it meant &x.first() == &x.second() - // which is not true for any other kind of pair, so now we store an instance - // of T2 just in case the user is relying on first() and second() returning - // different objects (albeit both empty). - template <class T1, class T2> - class compressed_pair_imp<T1, T2, 4> - : protected ::boost::remove_cv<T1>::type - { - public: - typedef T1 first_type; - typedef T2 second_type; - typedef typename call_traits<first_type>::param_type first_param_type; - typedef typename call_traits<second_type>::param_type second_param_type; - typedef typename call_traits<first_type>::reference first_reference; - typedef typename call_traits<second_type>::reference second_reference; - typedef typename call_traits<first_type>::const_reference first_const_reference; - typedef typename call_traits<second_type>::const_reference second_const_reference; - - compressed_pair_imp() {} - - compressed_pair_imp(first_param_type x, second_param_type y) - : first_type(x), m_second(y) {} - - compressed_pair_imp(first_param_type x) - : first_type(x), m_second(x) {} - - first_reference first() {return *this;} - first_const_reference first() const {return *this;} - - second_reference second() {return m_second;} - second_const_reference second() const {return m_second;} - - void swap(::boost::compressed_pair<T1,T2>&) {} - private: - T2 m_second; - }; - - // 5 T1 == T2 and are not empty: //JM - - template <class T1, class T2> - class compressed_pair_imp<T1, T2, 5> - { - public: - typedef T1 first_type; - typedef T2 second_type; - typedef typename call_traits<first_type>::param_type first_param_type; - typedef typename call_traits<second_type>::param_type second_param_type; - typedef typename call_traits<first_type>::reference first_reference; - typedef typename call_traits<second_type>::reference second_reference; - typedef typename call_traits<first_type>::const_reference first_const_reference; - typedef typename call_traits<second_type>::const_reference second_const_reference; - - compressed_pair_imp() {} - - compressed_pair_imp(first_param_type x, second_param_type y) - : first_(x), second_(y) {} - - compressed_pair_imp(first_param_type x) - : first_(x), second_(x) {} - - first_reference first() {return first_;} - first_const_reference first() const {return first_;} - - second_reference second() {return second_;} - second_const_reference second() const {return second_;} - - void swap(::boost::compressed_pair<T1, T2>& y) - { - cp_swap(first_, y.first()); - cp_swap(second_, y.second()); - } - private: - first_type first_; - second_type second_; - }; - -} // details - -template <class T1, class T2> -class compressed_pair - : private ::boost::details::compressed_pair_imp<T1, T2, - ::boost::details::compressed_pair_switch< - T1, - T2, - ::boost::is_same<typename remove_cv<T1>::type, typename remove_cv<T2>::type>::value, - ::boost::is_empty<T1>::value, - ::boost::is_empty<T2>::value>::value> -{ -private: - typedef details::compressed_pair_imp<T1, T2, - ::boost::details::compressed_pair_switch< - T1, - T2, - ::boost::is_same<typename remove_cv<T1>::type, typename remove_cv<T2>::type>::value, - ::boost::is_empty<T1>::value, - ::boost::is_empty<T2>::value>::value> base; -public: - typedef T1 first_type; - typedef T2 second_type; - typedef typename call_traits<first_type>::param_type first_param_type; - typedef typename call_traits<second_type>::param_type second_param_type; - typedef typename call_traits<first_type>::reference first_reference; - typedef typename call_traits<second_type>::reference second_reference; - typedef typename call_traits<first_type>::const_reference first_const_reference; - typedef typename call_traits<second_type>::const_reference second_const_reference; - - compressed_pair() : base() {} - compressed_pair(first_param_type x, second_param_type y) : base(x, y) {} - explicit compressed_pair(first_param_type x) : base(x) {} - explicit compressed_pair(second_param_type y) : base(y) {} - - first_reference first() {return base::first();} - first_const_reference first() const {return base::first();} - - second_reference second() {return base::second();} - second_const_reference second() const {return base::second();} - - void swap(compressed_pair& y) { base::swap(y); } -}; - -// JM -// Partial specialisation for case where T1 == T2: -// -template <class T> -class compressed_pair<T, T> - : private details::compressed_pair_imp<T, T, - ::boost::details::compressed_pair_switch< - T, - T, - ::boost::is_same<typename remove_cv<T>::type, typename remove_cv<T>::type>::value, - ::boost::is_empty<T>::value, - ::boost::is_empty<T>::value>::value> -{ -private: - typedef details::compressed_pair_imp<T, T, - ::boost::details::compressed_pair_switch< - T, - T, - ::boost::is_same<typename remove_cv<T>::type, typename remove_cv<T>::type>::value, - ::boost::is_empty<T>::value, - ::boost::is_empty<T>::value>::value> base; -public: - typedef T first_type; - typedef T second_type; - typedef typename call_traits<first_type>::param_type first_param_type; - typedef typename call_traits<second_type>::param_type second_param_type; - typedef typename call_traits<first_type>::reference first_reference; - typedef typename call_traits<second_type>::reference second_reference; - typedef typename call_traits<first_type>::const_reference first_const_reference; - typedef typename call_traits<second_type>::const_reference second_const_reference; - - compressed_pair() : base() {} - compressed_pair(first_param_type x, second_param_type y) : base(x, y) {} -#if !(defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530)) - explicit -#endif - compressed_pair(first_param_type x) : base(x) {} - - first_reference first() {return base::first();} - first_const_reference first() const {return base::first();} - - second_reference second() {return base::second();} - second_const_reference second() const {return base::second();} - - void swap(::boost::compressed_pair<T,T>& y) { base::swap(y); } -}; - -template <class T1, class T2> -inline -void -swap(compressed_pair<T1, T2>& x, compressed_pair<T1, T2>& y) -{ - x.swap(y); -} - -} // boost - -#ifdef BOOST_MSVC -# pragma warning(pop) -#endif - -#endif // BOOST_DETAIL_COMPRESSED_PAIR_HPP - diff --git a/3rdParty/Boost/src/boost/detail/container_fwd.hpp b/3rdParty/Boost/src/boost/detail/container_fwd.hpp index 9a21252..ef17498 100644 --- a/3rdParty/Boost/src/boost/detail/container_fwd.hpp +++ b/3rdParty/Boost/src/boost/detail/container_fwd.hpp @@ -1,24 +1,92 @@ -// Copyright 2005-2008 Daniel James. +// Copyright 2005-2011 Daniel James. // 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) +// Note: if you change this include guard, you also need to change +// container_fwd_compile_fail.cpp #if !defined(BOOST_DETAIL_CONTAINER_FWD_HPP) #define BOOST_DETAIL_CONTAINER_FWD_HPP -#if defined(_MSC_VER) && (_MSC_VER >= 1020) +#if defined(_MSC_VER) && (_MSC_VER >= 1020) && \ + !defined(BOOST_DETAIL_TEST_CONFIG_ONLY) # pragma once #endif #include <boost/config.hpp> #include <boost/detail/workaround.hpp> -#if defined(BOOST_DETAIL_NO_CONTAINER_FWD) \ - || ((defined(__GLIBCPP__) || defined(__GLIBCXX__)) \ - && (defined(_GLIBCXX_DEBUG) || defined(_GLIBCXX_PARALLEL))) \ - || BOOST_WORKAROUND(__BORLANDC__, > 0x551) \ - || BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x842)) \ - || (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)) +//////////////////////////////////////////////////////////////////////////////// +// // +// Define BOOST_DETAIL_NO_CONTAINER_FWD if you don't want this header to // +// forward declare standard containers. // +// // +// BOOST_DETAIL_CONTAINER_FWD to make it foward declare containers even if it // +// normally doesn't. // +// // +// BOOST_DETAIL_NO_CONTAINER_FWD overrides BOOST_DETAIL_CONTAINER_FWD. // +// // +//////////////////////////////////////////////////////////////////////////////// + +#if !defined(BOOST_DETAIL_NO_CONTAINER_FWD) +# if defined(BOOST_DETAIL_CONTAINER_FWD) + // Force forward declarations. +# elif defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION) + // STLport +# define BOOST_DETAIL_NO_CONTAINER_FWD +# elif defined(__LIBCOMO__) + // Comeau STL: +# define BOOST_DETAIL_NO_CONTAINER_FWD +# elif defined(__STD_RWCOMPILER_H__) || defined(_RWSTD_VER) + // Rogue Wave library: +# define BOOST_DETAIL_NO_CONTAINER_FWD +# elif defined(_LIBCPP_VERSION) + // libc++ +# define BOOST_DETAIL_NO_CONTAINER_FWD +# elif defined(__GLIBCPP__) || defined(__GLIBCXX__) + // GNU libstdc++ 3 + // + // Disable forwarding for all recent versions, as the library has a + // versioned namespace mode, and I don't know how to detect it. +# if __GLIBCXX__ >= 20070513 \ + || defined(_GLIBCXX_DEBUG) \ + || defined(_GLIBCXX_PARALLEL) \ + || defined(_GLIBCXX_PROFILE) +# define BOOST_DETAIL_NO_CONTAINER_FWD +# else +# if defined(__GLIBCXX__) && __GLIBCXX__ >= 20040530 +# define BOOST_CONTAINER_FWD_COMPLEX_STRUCT +# endif +# endif +# elif defined(__STL_CONFIG_H) + // generic SGI STL + // + // Forward declaration seems to be okay, but it has a couple of odd + // implementations. +# define BOOST_CONTAINER_FWD_BAD_BITSET +# if !defined(__STL_NON_TYPE_TMPL_PARAM_BUG) +# define BOOST_CONTAINER_FWD_BAD_DEQUE +# endif +# elif defined(__MSL_CPP__) + // MSL standard lib: +# define BOOST_DETAIL_NO_CONTAINER_FWD +# elif defined(__IBMCPP__) + // The default VACPP std lib, forward declaration seems to be fine. +# elif defined(MSIPL_COMPILE_H) + // Modena C++ standard library +# define BOOST_DETAIL_NO_CONTAINER_FWD +# elif (defined(_YVALS) && !defined(__IBMCPP__)) || defined(_CPPLIB_VER) + // Dinkumware Library (this has to appear after any possible replacement + // libraries) +# else +# define BOOST_DETAIL_NO_CONTAINER_FWD +# endif +#endif + +#if !defined(BOOST_DETAIL_TEST_CONFIG_ONLY) + +#if defined(BOOST_DETAIL_NO_CONTAINER_FWD) && \ + !defined(BOOST_DETAIL_TEST_FORCE_CONTAINER_FWD) #include <deque> #include <list> @@ -33,17 +101,6 @@ #include <cstddef> -#if !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION) && \ - defined(__STL_CONFIG_H) - -#define BOOST_CONTAINER_FWD_BAD_BITSET - -#if !defined(__STL_NON_TYPE_TMPL_PARAM_BUG) -#define BOOST_CONTAINER_FWD_BAD_DEQUE -#endif - -#endif - #if defined(BOOST_CONTAINER_FWD_BAD_DEQUE) #include <deque> #endif @@ -63,21 +120,18 @@ namespace std 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 BOOST_CLANG - template <class T> struct complex; - #else - template <class T> class complex; - #endif -} +#if defined(BOOST_CONTAINER_FWD_COMPLEX_STRUCT) + template <class T> struct complex; +#else + template <class T> class complex; +#endif -// gcc 3.4 and greater -namespace std -{ #if !defined(BOOST_CONTAINER_FWD_BAD_DEQUE) template <class T, class Allocator> class deque; #endif @@ -100,6 +154,9 @@ namespace std #pragma warning(pop) #endif -#endif +#endif // BOOST_DETAIL_NO_CONTAINER_FWD && + // !defined(BOOST_DETAIL_TEST_FORCE_CONTAINER_FWD) + +#endif // BOOST_DETAIL_TEST_CONFIG_ONLY #endif diff --git a/3rdParty/Boost/src/boost/detail/fenv.hpp b/3rdParty/Boost/src/boost/detail/fenv.hpp new file mode 100644 index 0000000..f048706 --- /dev/null +++ b/3rdParty/Boost/src/boost/detail/fenv.hpp @@ -0,0 +1,74 @@ +/*============================================================================= + Copyright (c) 2010 Bryce Lelbach + + 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_FENV_H) + #error This platform does not have a floating point environment +#endif + +#if !defined(BOOST_DETAIL_FENV_HPP) +#define BOOST_DETAIL_FENV_HPP + +/* 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 */ \ + defined(__GLIBC__) && /* version 6 + */ \ + !defined(_FENV_H) + #define _FENV_H + + #include <features.h> + #include <bits/fenv.h> + + extern "C" { + extern int fegetexceptflag (fexcept_t*, int) __THROW; + extern int fesetexceptflag (__const fexcept_t*, int) __THROW; + extern int feclearexcept (int) __THROW; + extern int feraiseexcept (int) __THROW; + extern int fetestexcept (int) __THROW; + extern int fegetround (void) __THROW; + extern int fesetround (int) __THROW; + extern int fegetenv (fenv_t*) __THROW; + extern int fesetenv (__const fenv_t*) __THROW; + extern int feupdateenv (__const fenv_t*) __THROW; + extern int feholdexcept (fenv_t*) __THROW; + + #ifdef __USE_GNU + extern int feenableexcept (int) __THROW; + extern int fedisableexcept (int) __THROW; + extern int fegetexcept (void) __THROW; + #endif + } + + namespace std { namespace tr1 { + 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/3rdParty/Boost/src/boost/detail/interlocked.hpp b/3rdParty/Boost/src/boost/detail/interlocked.hpp index fccebc3..75e5a30 100644 --- a/3rdParty/Boost/src/boost/detail/interlocked.hpp +++ b/3rdParty/Boost/src/boost/detail/interlocked.hpp @@ -33,6 +33,21 @@ #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 +62,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,7 +71,11 @@ extern "C" long __cdecl InterlockedExchangeAdd( long*, long ); #elif defined( BOOST_MSVC ) || defined( BOOST_INTEL_WIN ) -#if defined( __CLRCALL_PURE_OR_CDECL ) +#if defined( BOOST_MSVC ) && BOOST_MSVC >= 1600 + +#include <intrin.h> + +#elif defined( __CLRCALL_PURE_OR_CDECL ) extern "C" long __CLRCALL_PURE_OR_CDECL _InterlockedIncrement( long volatile * ); extern "C" long __CLRCALL_PURE_OR_CDECL _InterlockedDecrement( long volatile * ); @@ -106,17 +127,29 @@ extern "C" void* __cdecl _InterlockedExchangePointer( void* volatile *, void* ); #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 { namespace detail { -extern "C" __declspec(dllimport) long __stdcall InterlockedIncrement( long volatile * ); -extern "C" __declspec(dllimport) long __stdcall InterlockedDecrement( long volatile * ); -extern "C" __declspec(dllimport) long __stdcall InterlockedCompareExchange( long volatile *, long, long ); -extern "C" __declspec(dllimport) long __stdcall InterlockedExchange( long volatile *, long ); -extern "C" __declspec(dllimport) long __stdcall InterlockedExchangeAdd( long volatile *, long ); +extern "C" BOOST_INTERLOCKED_IMPORT long __stdcall InterlockedIncrement( long volatile * ); +extern "C" BOOST_INTERLOCKED_IMPORT long __stdcall InterlockedDecrement( long volatile * ); +extern "C" BOOST_INTERLOCKED_IMPORT long __stdcall InterlockedCompareExchange( long volatile *, long, long ); +extern "C" BOOST_INTERLOCKED_IMPORT long __stdcall InterlockedExchange( long volatile *, long ); +extern "C" BOOST_INTERLOCKED_IMPORT long __stdcall InterlockedExchangeAdd( long volatile *, long ); + +# if defined(_M_IA64) || defined(_M_AMD64) +extern "C" BOOST_INTERLOCKED_IMPORT void* __stdcall InterlockedCompareExchangePointer( void* volatile *, void*, void* ); +extern "C" BOOST_INTERLOCKED_IMPORT void* __stdcall InterlockedExchangePointer( void* volatile *, void* ); +# endif } // namespace detail @@ -128,10 +161,15 @@ extern "C" __declspec(dllimport) long __stdcall InterlockedExchangeAdd( long vol # define BOOST_INTERLOCKED_EXCHANGE ::boost::detail::InterlockedExchange # define BOOST_INTERLOCKED_EXCHANGE_ADD ::boost::detail::InterlockedExchangeAdd -# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest,exchange,compare) \ +# if defined(_M_IA64) || defined(_M_AMD64) +# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER ::boost::detail::InterlockedCompareExchangePointer +# define BOOST_INTERLOCKED_EXCHANGE_POINTER ::boost::detail::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) \ +# define BOOST_INTERLOCKED_EXCHANGE_POINTER(dest,exchange) \ ((void*)BOOST_INTERLOCKED_EXCHANGE((long volatile*)(dest),(long)(exchange))) +# endif #else diff --git a/3rdParty/Boost/src/boost/detail/is_incrementable.hpp b/3rdParty/Boost/src/boost/detail/is_incrementable.hpp new file mode 100644 index 0000000..e7ef9dc --- /dev/null +++ b/3rdParty/Boost/src/boost/detail/is_incrementable.hpp @@ -0,0 +1,134 @@ +// Copyright David Abrahams 2004. 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) +#ifndef IS_INCREMENTABLE_DWA200415_HPP +# define IS_INCREMENTABLE_DWA200415_HPP + +# include <boost/type_traits/detail/template_arity_spec.hpp> +# include <boost/type_traits/remove_cv.hpp> +# include <boost/mpl/aux_/lambda_support.hpp> +# include <boost/mpl/bool.hpp> +# include <boost/detail/workaround.hpp> + +// Must be the last include +# include <boost/type_traits/detail/bool_trait_def.hpp> + +namespace boost { namespace detail { + +// is_incrementable<T> metafunction +// +// Requires: Given x of type T&, if the expression ++x is well-formed +// it must have complete type; otherwise, it must neither be ambiguous +// nor violate access. + +// This namespace ensures that ADL doesn't mess things up. +namespace is_incrementable_ +{ + // a type returned from operator++ when no increment is found in the + // type's own namespace + struct tag {}; + + // any soaks up implicit conversions and makes the following + // operator++ less-preferred than any other such operator that + // might be found via ADL. + struct any { template <class T> any(T const&); }; + + // This is a last-resort operator++ for when none other is found +# if BOOST_WORKAROUND(__GNUC__, == 4) && __GNUC_MINOR__ == 0 && __GNUC_PATCHLEVEL__ == 2 + +} + +namespace is_incrementable_2 +{ + is_incrementable_::tag operator++(is_incrementable_::any const&); + is_incrementable_::tag operator++(is_incrementable_::any const&,int); +} +using namespace is_incrementable_2; + +namespace is_incrementable_ +{ + +# else + + tag operator++(any const&); + tag operator++(any const&,int); + +# endif + +# if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3202)) \ + || BOOST_WORKAROUND(BOOST_MSVC, <= 1300) +# define BOOST_comma(a,b) (a) +# else + // In case an operator++ is found that returns void, we'll use ++x,0 + tag operator,(tag,int); +# define BOOST_comma(a,b) (a,b) +# endif + +# if defined(BOOST_MSVC) +# pragma warning(push) +# pragma warning(disable:4913) // Warning about operator, +# endif + + // two check overloads help us identify which operator++ was picked + char (& check_(tag) )[2]; + + template <class T> + char check_(T const&); + + + template <class T> + struct impl + { + static typename boost::remove_cv<T>::type& x; + + BOOST_STATIC_CONSTANT( + bool + , value = sizeof(is_incrementable_::check_(BOOST_comma(++x,0))) == 1 + ); + }; + + template <class T> + struct postfix_impl + { + static typename boost::remove_cv<T>::type& x; + + BOOST_STATIC_CONSTANT( + bool + , value = sizeof(is_incrementable_::check_(BOOST_comma(x++,0))) == 1 + ); + }; + +# if defined(BOOST_MSVC) +# pragma warning(pop) +# endif + +} + +# undef BOOST_comma + +template<typename T> +struct is_incrementable +BOOST_TT_AUX_BOOL_C_BASE(::boost::detail::is_incrementable_::impl<T>::value) +{ + BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(::boost::detail::is_incrementable_::impl<T>::value) + BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_incrementable,(T)) +}; + +template<typename T> +struct is_postfix_incrementable +BOOST_TT_AUX_BOOL_C_BASE(::boost::detail::is_incrementable_::impl<T>::value) +{ + BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(::boost::detail::is_incrementable_::postfix_impl<T>::value) + BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_postfix_incrementable,(T)) +}; + +} // namespace detail + +BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(1, ::boost::detail::is_incrementable) +BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(1, ::boost::detail::is_postfix_incrementable) + +} // namespace boost + +# include <boost/type_traits/detail/bool_trait_undef.hpp> + +#endif // IS_INCREMENTABLE_DWA200415_HPP diff --git a/3rdParty/Boost/src/boost/detail/ob_compressed_pair.hpp b/3rdParty/Boost/src/boost/detail/ob_compressed_pair.hpp deleted file mode 100644 index 727acab..0000000 --- a/3rdParty/Boost/src/boost/detail/ob_compressed_pair.hpp +++ /dev/null @@ -1,510 +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. -// see libs/utility/compressed_pair.hpp -// -/* Release notes: - 20 Jan 2001: - Fixed obvious bugs (David Abrahams) - 07 Oct 2000: - Added better single argument constructor support. - 03 Oct 2000: - Added VC6 support (JM). - 23rd July 2000: - Additional comments added. (JM) - Jan 2000: - Original version: this version crippled for use with crippled compilers - - John Maddock Jan 2000. -*/ - - -#ifndef BOOST_OB_COMPRESSED_PAIR_HPP -#define BOOST_OB_COMPRESSED_PAIR_HPP - -#include <algorithm> -#ifndef BOOST_OBJECT_TYPE_TRAITS_HPP -#include <boost/type_traits/object_traits.hpp> -#endif -#ifndef BOOST_SAME_TRAITS_HPP -#include <boost/type_traits/same_traits.hpp> -#endif -#ifndef BOOST_CALL_TRAITS_HPP -#include <boost/call_traits.hpp> -#endif - -namespace boost -{ -#ifdef BOOST_MSVC6_MEMBER_TEMPLATES -// -// use member templates to emulate -// partial specialisation. Note that due to -// problems with overload resolution with VC6 -// each of the compressed_pair versions that follow -// have one template single-argument constructor -// in place of two specific constructors: -// - -template <class T1, class T2> -class compressed_pair; - -namespace detail{ - -template <class A, class T1, class T2> -struct best_conversion_traits -{ - typedef char one; - typedef char (&two)[2]; - static A a; - static one test(T1); - static two test(T2); - - enum { value = sizeof(test(a)) }; -}; - -template <int> -struct init_one; - -template <> -struct init_one<1> -{ - template <class A, class T1, class T2> - static void init(const A& a, T1* p1, T2*) - { - *p1 = a; - } -}; - -template <> -struct init_one<2> -{ - template <class A, class T1, class T2> - static void init(const A& a, T1*, T2* p2) - { - *p2 = a; - } -}; - - -// T1 != T2, both non-empty -template <class T1, class T2> -class compressed_pair_0 -{ -private: - T1 _first; - T2 _second; -public: - typedef T1 first_type; - typedef T2 second_type; - typedef typename call_traits<first_type>::param_type first_param_type; - typedef typename call_traits<second_type>::param_type second_param_type; - typedef typename call_traits<first_type>::reference first_reference; - typedef typename call_traits<second_type>::reference second_reference; - typedef typename call_traits<first_type>::const_reference first_const_reference; - typedef typename call_traits<second_type>::const_reference second_const_reference; - - compressed_pair_0() : _first(), _second() {} - compressed_pair_0(first_param_type x, second_param_type y) : _first(x), _second(y) {} - template <class A> - explicit compressed_pair_0(const A& val) - { - init_one<best_conversion_traits<A, T1, T2>::value>::init(val, &_first, &_second); - } - compressed_pair_0(const ::boost::compressed_pair<T1,T2>& x) - : _first(x.first()), _second(x.second()) {} - -#if 0 - compressed_pair_0& operator=(const compressed_pair_0& x) { - cout << "assigning compressed pair 0" << endl; - _first = x._first; - _second = x._second; - cout << "finished assigning compressed pair 0" << endl; - return *this; - } -#endif - - first_reference first() { return _first; } - first_const_reference first() const { return _first; } - - second_reference second() { return _second; } - second_const_reference second() const { return _second; } - - void swap(compressed_pair_0& y) - { - using std::swap; - swap(_first, y._first); - swap(_second, y._second); - } -}; - -// T1 != T2, T2 empty -template <class T1, class T2> -class compressed_pair_1 : T2 -{ -private: - T1 _first; -public: - typedef T1 first_type; - typedef T2 second_type; - typedef typename call_traits<first_type>::param_type first_param_type; - typedef typename call_traits<second_type>::param_type second_param_type; - typedef typename call_traits<first_type>::reference first_reference; - typedef typename call_traits<second_type>::reference second_reference; - typedef typename call_traits<first_type>::const_reference first_const_reference; - typedef typename call_traits<second_type>::const_reference second_const_reference; - - compressed_pair_1() : T2(), _first() {} - compressed_pair_1(first_param_type x, second_param_type y) : T2(y), _first(x) {} - - template <class A> - explicit compressed_pair_1(const A& val) - { - init_one<best_conversion_traits<A, T1, T2>::value>::init(val, &_first, static_cast<T2*>(this)); - } - - 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; } - - second_reference second() { return *this; } - second_const_reference second() const { return *this; } - - void swap(compressed_pair_1& y) - { - // no need to swap empty base class: - using std::swap; - swap(_first, y._first); - } -}; - -// T1 != T2, T1 empty -template <class T1, class T2> -class compressed_pair_2 : T1 -{ -private: - T2 _second; -public: - typedef T1 first_type; - typedef T2 second_type; - typedef typename call_traits<first_type>::param_type first_param_type; - typedef typename call_traits<second_type>::param_type second_param_type; - typedef typename call_traits<first_type>::reference first_reference; - typedef typename call_traits<second_type>::reference second_reference; - typedef typename call_traits<first_type>::const_reference first_const_reference; - typedef typename call_traits<second_type>::const_reference second_const_reference; - - compressed_pair_2() : T1(), _second() {} - compressed_pair_2(first_param_type x, second_param_type y) : T1(x), _second(y) {} - template <class A> - explicit compressed_pair_2(const A& val) - { - init_one<best_conversion_traits<A, T1, T2>::value>::init(val, static_cast<T1*>(this), &_second); - } - compressed_pair_2(const ::boost::compressed_pair<T1,T2>& x) - : T1(x.first()), _second(x.second()) {} - -#if 0 - compressed_pair_2& operator=(const compressed_pair_2& x) { - cout << "assigning compressed pair 2" << endl; - T1::operator=(x); - _second = x._second; - cout << "finished assigning compressed pair 2" << endl; - return *this; - } -#endif - first_reference first() { return *this; } - first_const_reference first() const { return *this; } - - second_reference second() { return _second; } - second_const_reference second() const { return _second; } - - void swap(compressed_pair_2& y) - { - // no need to swap empty base class: - using std::swap; - swap(_second, y._second); - } -}; - -// T1 != T2, both empty -template <class T1, class T2> -class compressed_pair_3 : T1, T2 -{ -public: - typedef T1 first_type; - typedef T2 second_type; - typedef typename call_traits<first_type>::param_type first_param_type; - typedef typename call_traits<second_type>::param_type second_param_type; - typedef typename call_traits<first_type>::reference first_reference; - typedef typename call_traits<second_type>::reference second_reference; - typedef typename call_traits<first_type>::const_reference first_const_reference; - typedef typename call_traits<second_type>::const_reference second_const_reference; - - compressed_pair_3() : T1(), T2() {} - compressed_pair_3(first_param_type x, second_param_type y) : T1(x), T2(y) {} - template <class A> - explicit compressed_pair_3(const A& val) - { - init_one<best_conversion_traits<A, T1, T2>::value>::init(val, static_cast<T1*>(this), static_cast<T2*>(this)); - } - compressed_pair_3(const ::boost::compressed_pair<T1,T2>& x) - : T1(x.first()), T2(x.second()) {} - - first_reference first() { return *this; } - first_const_reference first() const { return *this; } - - second_reference second() { return *this; } - second_const_reference second() const { return *this; } - - void swap(compressed_pair_3& y) - { - // no need to swap empty base classes: - } -}; - -// T1 == T2, and empty -template <class T1, class T2> -class compressed_pair_4 : T1 -{ -public: - typedef T1 first_type; - typedef T2 second_type; - typedef typename call_traits<first_type>::param_type first_param_type; - typedef typename call_traits<second_type>::param_type second_param_type; - typedef typename call_traits<first_type>::reference first_reference; - typedef typename call_traits<second_type>::reference second_reference; - typedef typename call_traits<first_type>::const_reference first_const_reference; - typedef typename call_traits<second_type>::const_reference second_const_reference; - - compressed_pair_4() : T1() {} - compressed_pair_4(first_param_type x, second_param_type y) : T1(x), m_second(y) {} - // only one single argument constructor since T1 == T2 - explicit compressed_pair_4(first_param_type x) : T1(x), m_second(x) {} - compressed_pair_4(const ::boost::compressed_pair<T1,T2>& x) - : T1(x.first()), m_second(x.second()) {} - - first_reference first() { return *this; } - first_const_reference first() const { return *this; } - - second_reference second() { return m_second; } - second_const_reference second() const { return m_second; } - - void swap(compressed_pair_4& y) - { - // no need to swap empty base classes: - } -private: - T2 m_second; -}; - -// T1 == T2, not empty -template <class T1, class T2> -class compressed_pair_5 -{ -private: - T1 _first; - T2 _second; -public: - typedef T1 first_type; - typedef T2 second_type; - typedef typename call_traits<first_type>::param_type first_param_type; - typedef typename call_traits<second_type>::param_type second_param_type; - typedef typename call_traits<first_type>::reference first_reference; - typedef typename call_traits<second_type>::reference second_reference; - typedef typename call_traits<first_type>::const_reference first_const_reference; - typedef typename call_traits<second_type>::const_reference second_const_reference; - - compressed_pair_5() : _first(), _second() {} - compressed_pair_5(first_param_type x, second_param_type y) : _first(x), _second(y) {} - // only one single argument constructor since T1 == T2 - explicit compressed_pair_5(first_param_type x) : _first(x), _second(x) {} - compressed_pair_5(const ::boost::compressed_pair<T1,T2>& c) - : _first(c.first()), _second(c.second()) {} - - first_reference first() { return _first; } - first_const_reference first() const { return _first; } - - second_reference second() { return _second; } - second_const_reference second() const { return _second; } - - void swap(compressed_pair_5& y) - { - using std::swap; - swap(_first, y._first); - swap(_second, y._second); - } -}; - -template <bool e1, bool e2, bool same> -struct compressed_pair_chooser -{ - template <class T1, class T2> - struct rebind - { - typedef compressed_pair_0<T1, T2> type; - }; -}; - -template <> -struct compressed_pair_chooser<false, true, false> -{ - template <class T1, class T2> - struct rebind - { - typedef compressed_pair_1<T1, T2> type; - }; -}; - -template <> -struct compressed_pair_chooser<true, false, false> -{ - template <class T1, class T2> - struct rebind - { - typedef compressed_pair_2<T1, T2> type; - }; -}; - -template <> -struct compressed_pair_chooser<true, true, false> -{ - template <class T1, class T2> - struct rebind - { - typedef compressed_pair_3<T1, T2> type; - }; -}; - -template <> -struct compressed_pair_chooser<true, true, true> -{ - template <class T1, class T2> - struct rebind - { - typedef compressed_pair_4<T1, T2> type; - }; -}; - -template <> -struct compressed_pair_chooser<false, false, true> -{ - template <class T1, class T2> - struct rebind - { - typedef compressed_pair_5<T1, T2> type; - }; -}; - -template <class T1, class T2> -struct compressed_pair_traits -{ -private: - typedef compressed_pair_chooser<is_empty<T1>::value, is_empty<T2>::value, is_same<T1,T2>::value> chooser; - typedef typename chooser::template rebind<T1, T2> bound_type; -public: - typedef typename bound_type::type type; -}; - -} // namespace detail - -template <class T1, class T2> -class compressed_pair : public detail::compressed_pair_traits<T1, T2>::type -{ -private: - typedef typename detail::compressed_pair_traits<T1, T2>::type base_type; -public: - typedef T1 first_type; - typedef T2 second_type; - typedef typename call_traits<first_type>::param_type first_param_type; - typedef typename call_traits<second_type>::param_type second_param_type; - typedef typename call_traits<first_type>::reference first_reference; - typedef typename call_traits<second_type>::reference second_reference; - typedef typename call_traits<first_type>::const_reference first_const_reference; - typedef typename call_traits<second_type>::const_reference second_const_reference; - - compressed_pair() : base_type() {} - compressed_pair(first_param_type x, second_param_type y) : base_type(x, y) {} - template <class A> - explicit compressed_pair(const A& x) : base_type(x){} - - first_reference first() { return base_type::first(); } - first_const_reference first() const { return base_type::first(); } - - second_reference second() { return base_type::second(); } - second_const_reference second() const { return base_type::second(); } -}; - -template <class T1, class T2> -inline void swap(compressed_pair<T1, T2>& x, compressed_pair<T1, T2>& y) -{ - x.swap(y); -} - -#else -// no partial specialisation, no member templates: - -template <class T1, class T2> -class compressed_pair -{ -private: - T1 _first; - T2 _second; -public: - typedef T1 first_type; - typedef T2 second_type; - typedef typename call_traits<first_type>::param_type first_param_type; - typedef typename call_traits<second_type>::param_type second_param_type; - typedef typename call_traits<first_type>::reference first_reference; - typedef typename call_traits<second_type>::reference second_reference; - typedef typename call_traits<first_type>::const_reference first_const_reference; - typedef typename call_traits<second_type>::const_reference second_const_reference; - - compressed_pair() : _first(), _second() {} - compressed_pair(first_param_type x, second_param_type y) : _first(x), _second(y) {} - explicit compressed_pair(first_param_type x) : _first(x), _second() {} - // can't define this in case T1 == T2: - // explicit compressed_pair(second_param_type y) : _first(), _second(y) {} - - first_reference first() { return _first; } - first_const_reference first() const { return _first; } - - second_reference second() { return _second; } - second_const_reference second() const { return _second; } - - void swap(compressed_pair& y) - { - using std::swap; - swap(_first, y._first); - swap(_second, y._second); - } -}; - -template <class T1, class T2> -inline void swap(compressed_pair<T1, T2>& x, compressed_pair<T1, T2>& y) -{ - x.swap(y); -} - -#endif - -} // boost - -#endif // BOOST_OB_COMPRESSED_PAIR_HPP - - - diff --git a/3rdParty/Boost/src/boost/detail/scoped_enum_emulation.hpp b/3rdParty/Boost/src/boost/detail/scoped_enum_emulation.hpp index e695a20..80394cf 100644 --- a/3rdParty/Boost/src/boost/detail/scoped_enum_emulation.hpp +++ b/3rdParty/Boost/src/boost/detail/scoped_enum_emulation.hpp @@ -1,56 +1,337 @@ // 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 -// 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. -// -// 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 emulation is via struct rather than namespace to allow use within classes. -// Thanks to Andrey Semashev for pointing that out. -// -// Helpful comments and suggestions were also made by Kjell Elster, Phil Endecott, -// Joel Falcou, Mathias Gaunard, Felipe Magno de Almeida, Matt Calabrese, Vincente -// Botet, and Daniel James. -// -// 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 ); +/* +[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 -# define BOOST_SCOPED_ENUM_START(name) struct name { enum enum_type -# define BOOST_SCOPED_ENUM_END }; -# define BOOST_SCOPED_ENUM(name) name::enum_type + 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_START(name) enum class name -# define BOOST_SCOPED_ENUM_END -# define BOOST_SCOPED_ENUM(name) name +#define BOOST_SCOPED_ENUM_UT_DECLARE_CONVERSION_OPERATOR #endif +/** + * Start a declaration of a scoped enum. + * + * @param EnumType The new scoped enum. + * @param UnderlyingType The underlying type. + */ +#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_); } \ + }; + +#define BOOST_SCOPED_ENUM_DECLARE_END(EnumType) \ + ; \ + EnumType(enum_type v) BOOST_NOEXCEPT : v_(v) {} \ + BOOST_SCOPED_ENUM_DECLARE_END2() + +/** + * 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) + +/** + * 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 diff --git a/3rdParty/Boost/src/boost/detail/utf8_codecvt_facet.ipp b/3rdParty/Boost/src/boost/detail/utf8_codecvt_facet.ipp new file mode 100644 index 0000000..064fdaf --- /dev/null +++ b/3rdParty/Boost/src/boost/detail/utf8_codecvt_facet.ipp @@ -0,0 +1,285 @@ +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// utf8_codecvt_facet.ipp + +// Copyright (c) 2001 Ronald Garcia, Indiana University (garcia@osl.iu.edu) +// Andrew Lumsdaine, Indiana University (lums@osl.iu.edu). +// 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) + +// Please see the comments in <boost/detail/utf8_codecvt_facet.hpp> to +// learn how this file should be used. + +#include <boost/detail/utf8_codecvt_facet.hpp> + +#include <cstdlib> // for multi-byte converson routines +#include <cassert> + +#include <boost/limits.hpp> +#include <boost/config.hpp> + +// If we don't have wstring, then Unicode support +// is not available anyway, so we don't need to even +// compiler this file. This also fixes the problem +// with mingw, which can compile this file, but will +// generate link error when building DLL. +#ifndef BOOST_NO_STD_WSTRING + +BOOST_UTF8_BEGIN_NAMESPACE + +/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 +// implementation for wchar_t + +// Translate incoming UTF-8 into UCS-4 +std::codecvt_base::result utf8_codecvt_facet::do_in( + std::mbstate_t& /*state*/, + const char * from, + const char * from_end, + const char * & from_next, + wchar_t * to, + wchar_t * to_end, + wchar_t * & to_next +) const { + // Basic algorithm: The first octet determines how many + // octets total make up the UCS-4 character. The remaining + // "continuing octets" all begin with "10". To convert, subtract + // the amount that specifies the number of octets from the first + // octet. Subtract 0x80 (1000 0000) from each continuing octet, + // then mash the whole lot together. Note that each continuing + // octet only uses 6 bits as unique values, so only shift by + // multiples of 6 to combine. + while (from != from_end && to != to_end) { + + // Error checking on the first octet + if (invalid_leading_octet(*from)){ + from_next = from; + to_next = to; + return std::codecvt_base::error; + } + + // The first octet is adjusted by a value dependent upon + // the number of "continuing octets" encoding the character + const int cont_octet_count = get_cont_octet_count(*from); + const wchar_t octet1_modifier_table[] = { + 0x00, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc + }; + + // The unsigned char conversion is necessary in case char is + // signed (I learned this the hard way) + wchar_t ucs_result = + (unsigned char)(*from++) - octet1_modifier_table[cont_octet_count]; + + // Invariants : + // 1) At the start of the loop, 'i' continuing characters have been + // processed + // 2) *from points to the next continuing character to be processed. + int i = 0; + while(i != cont_octet_count && from != from_end) { + + // Error checking on continuing characters + if (invalid_continuing_octet(*from)) { + from_next = from; + to_next = to; + return std::codecvt_base::error; + } + + ucs_result *= (1 << 6); + + // each continuing character has an extra (10xxxxxx)b attached to + // it that must be removed. + ucs_result += (unsigned char)(*from++) - 0x80; + ++i; + } + + // If the buffer ends with an incomplete unicode character... + if (from == from_end && i != cont_octet_count) { + // rewind "from" to before the current character translation + from_next = from - (i+1); + to_next = to; + return std::codecvt_base::partial; + } + *to++ = ucs_result; + } + from_next = from; + to_next = to; + + // Were we done converting or did we run out of destination space? + if(from == from_end) return std::codecvt_base::ok; + else return std::codecvt_base::partial; +} + +std::codecvt_base::result utf8_codecvt_facet::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 +) const +{ + // RG - consider merging this table with the other one + const wchar_t octet1_modifier_table[] = { + 0x00, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc + }; + + wchar_t max_wchar = (std::numeric_limits<wchar_t>::max)(); + while (from != from_end && to != to_end) { + + // Check for invalid UCS-4 character + if (*from > max_wchar) { + from_next = from; + to_next = to; + return std::codecvt_base::error; + } + + int cont_octet_count = get_cont_octet_out_count(*from); + + // RG - comment this formula better + int shift_exponent = (cont_octet_count) * 6; + + // Process the first character + *to++ = static_cast<char>(octet1_modifier_table[cont_octet_count] + + (unsigned char)(*from / (1 << shift_exponent))); + + // Process the continuation characters + // Invariants: At the start of the loop: + // 1) 'i' continuing octets have been generated + // 2) '*to' points to the next location to place an octet + // 3) shift_exponent is 6 more than needed for the next octet + int i = 0; + while (i != cont_octet_count && to != to_end) { + shift_exponent -= 6; + *to++ = static_cast<char>(0x80 + ((*from / (1 << shift_exponent)) % (1 << 6))); + ++i; + } + // If we filled up the out buffer before encoding the character + if(to == to_end && i != cont_octet_count) { + from_next = from; + to_next = to - (i+1); + return std::codecvt_base::partial; + } + ++from; + } + from_next = from; + to_next = to; + // Were we done or did we run out of destination space + if(from == from_end) return std::codecvt_base::ok; + else return std::codecvt_base::partial; +} + +// 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 char * from, + const char * from_end, + std::size_t max_limit +#if BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600)) +) const throw() +#else +) const +#endif +{ + // RG - this code is confusing! I need a better way to express it. + // and test cases. + + // Invariants: + // 1) last_octet_count has the size of the last measured character + // 2) char_count holds the number of characters shown to fit + // within the bounds so far (no greater than max_limit) + // 3) from_next points to the octet 'last_octet_count' before the + // last measured character. + int last_octet_count=0; + std::size_t char_count = 0; + const char* from_next = from; + // Use "<" because the buffer may represent incomplete characters + while (from_next+last_octet_count <= from_end && char_count <= max_limit) { + from_next += last_octet_count; + last_octet_count = (get_octet_count(*from_next)); + ++char_count; + } + return static_cast<int>(from_next-from_end); +} + +unsigned int utf8_codecvt_facet::get_octet_count( + unsigned char lead_octet +){ + // if the 0-bit (MSB) is 0, then 1 character + if (lead_octet <= 0x7f) return 1; + + // Otherwise the count number of consecutive 1 bits starting at MSB +// assert(0xc0 <= lead_octet && lead_octet <= 0xfd); + + if (0xc0 <= lead_octet && lead_octet <= 0xdf) return 2; + else if (0xe0 <= lead_octet && lead_octet <= 0xef) return 3; + else if (0xf0 <= lead_octet && lead_octet <= 0xf7) return 4; + else if (0xf8 <= lead_octet && lead_octet <= 0xfb) return 5; + else return 6; +} +BOOST_UTF8_END_NAMESPACE + +namespace { +template<std::size_t s> +int get_cont_octet_out_count_impl(wchar_t word){ + if (word < 0x80) { + return 0; + } + if (word < 0x800) { + return 1; + } + return 2; +} + +template<> +int get_cont_octet_out_count_impl<4>(wchar_t word){ + if (word < 0x80) { + return 0; + } + if (word < 0x800) { + return 1; + } + + // Note that the following code will generate warnings on some platforms + // where wchar_t is defined as UCS2. The warnings are superfluous as the + // specialization is never instantitiated with such compilers, but this + // can cause problems if warnings are being treated as errors, so we guard + // against that. Including <boost/detail/utf8_codecvt_facet.hpp> as we do + // should be enough to get WCHAR_MAX defined. +#if !defined(WCHAR_MAX) +# error WCHAR_MAX not defined! +#endif + // cope with VC++ 7.1 or earlier having invalid WCHAR_MAX +#if defined(_MSC_VER) && _MSC_VER <= 1310 // 7.1 or earlier + return 2; +#elif WCHAR_MAX > 0x10000 + + if (word < 0x10000) { + return 2; + } + if (word < 0x200000) { + return 3; + } + if (word < 0x4000000) { + return 4; + } + return 5; + +#else + return 2; +#endif +} + +} // namespace anonymous + +BOOST_UTF8_BEGIN_NAMESPACE +// How many "continuing octets" will be needed for this word +// == total octets - 1. +int utf8_codecvt_facet::get_cont_octet_out_count( + wchar_t word +) const { + return get_cont_octet_out_count_impl<sizeof(wchar_t)>(word); +} +BOOST_UTF8_END_NAMESPACE + +#endif diff --git a/3rdParty/Boost/src/boost/detail/win/GetLastError.hpp b/3rdParty/Boost/src/boost/detail/win/GetLastError.hpp new file mode 100644 index 0000000..d040abf --- /dev/null +++ b/3rdParty/Boost/src/boost/detail/win/GetLastError.hpp @@ -0,0 +1,27 @@ +// GetLastError.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_GETLASTERROR_HPP +#define BOOST_DETAIL_WIN_GETLASTERROR_HPP + +#include <boost/detail/win/basic_types.hpp> + +namespace boost { +namespace detail { +namespace win32 { +#if defined( BOOST_USE_WINDOWS_H ) + using ::GetLastError; +#else + extern "C" __declspec(dllimport) DWORD_ WINAPI + GetLastError(); +#endif +} +} +} + +#endif // BOOST_DETAIL_WIN_TIME_HPP diff --git a/3rdParty/Boost/src/boost/detail/win/basic_types.hpp b/3rdParty/Boost/src/boost/detail/win/basic_types.hpp new file mode 100644 index 0000000..f4e3472 --- /dev/null +++ b/3rdParty/Boost/src/boost/detail/win/basic_types.hpp @@ -0,0 +1,111 @@ +// basic_types.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_BASIC_TYPES_HPP +#define BOOST_DETAIL_WIN_BASIC_TYPES_HPP +#include <boost/config.hpp> +#include <cstdarg> +#include <boost/cstdint.hpp> +#if defined( BOOST_USE_WINDOWS_H ) +# include <windows.h> +#elif defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || defined(__CYGWIN__) +# include <WinError.h> +// @FIXME Which condition must be tested +# ifdef UNDER_CE +# ifndef WINAPI +# ifndef _WIN32_WCE_EMULATION +# define WINAPI __cdecl // Note this doesn't match the desktop definition +# else +# define WINAPI __stdcall +# endif +# endif +# else +# ifndef WINAPI +# define WINAPI __stdcall +# endif +# endif +#else +# error "Win32 functions not available" +#endif + +namespace boost { +namespace detail { +namespace win32 { +#if defined( BOOST_USE_WINDOWS_H ) + typedef ::BOOL BOOL_; + typedef ::WORD WORD_; + typedef ::DWORD DWORD_; + typedef ::HANDLE HANDLE_; + typedef ::LONG LONG_; + typedef ::LONGLONG LONGLONG_; + typedef ::ULONG_PTR ULONG_PTR_; + typedef ::LARGE_INTEGER LARGE_INTEGER_; + typedef ::PLARGE_INTEGER PLARGE_INTEGER_; + typedef ::PVOID PVOID_; + typedef ::LPVOID LPVOID_; + typedef ::CHAR CHAR_; + typedef ::LPSTR LPSTR_; + typedef ::LPCSTR LPCSTR_; + typedef ::WCHAR WCHAR_; + typedef ::LPWSTR LPWSTR_; + typedef ::LPCWSTR LPCWSTR_; +#else +extern "C" { + typedef int BOOL_; + typedef unsigned short WORD_; + typedef unsigned long DWORD_; + typedef void* HANDLE_; + + typedef long LONG_; + +// @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_; + +// @FIXME Which condition must be tested +# ifdef _WIN64 +#if defined(__CYGWIN__) + typedef unsigned long ULONG_PTR_; +#else + typedef unsigned __int64 ULONG_PTR_; +#endif +# else + typedef unsigned long ULONG_PTR_; +# endif + + typedef struct _LARGE_INTEGER { + LONGLONG_ QuadPart; + } LARGE_INTEGER_; + typedef LARGE_INTEGER_ *PLARGE_INTEGER_; + + typedef void *PVOID_; + typedef void *LPVOID_; + typedef const void *LPCVOID_; + + typedef char CHAR_; + typedef CHAR_ *LPSTR_; + typedef const CHAR_ *LPCSTR_; + + typedef wchar_t WCHAR_; + typedef WCHAR_ *LPWSTR_; + typedef const WCHAR_ *LPCWSTR_; + +} +#endif +} +} +} +#endif // BOOST_DETAIL_WIN_TIME_HPP diff --git a/3rdParty/Boost/src/boost/detail/win/time.hpp b/3rdParty/Boost/src/boost/detail/win/time.hpp new file mode 100644 index 0000000..7f636ed --- /dev/null +++ b/3rdParty/Boost/src/boost/detail/win/time.hpp @@ -0,0 +1,72 @@ +// time.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_TIME_HPP +#define BOOST_DETAIL_WIN_TIME_HPP + +#include <boost/detail/win/basic_types.hpp> + + +namespace boost { +namespace detail { +namespace win32 { +#if defined( BOOST_USE_WINDOWS_H ) + typedef FILETIME FILETIME_; + typedef PFILETIME PFILETIME_; + typedef LPFILETIME LPFILETIME_; + + typedef SYSTEMTIME SYSTEMTIME_; + typedef SYSTEMTIME* PSYSTEMTIME_; + + #ifndef UNDER_CE // Windows CE does not define GetSystemTimeAsFileTime + using ::GetSystemTimeAsFileTime; + #endif + using ::FileTimeToLocalFileTime; + using ::GetSystemTime; + using ::SystemTimeToFileTime; + using ::GetTickCount; + +#else +extern "C" { + typedef struct _FILETIME { + DWORD_ dwLowDateTime; + DWORD_ dwHighDateTime; + } FILETIME_, *PFILETIME_, *LPFILETIME_; + + typedef struct _SYSTEMTIME { + WORD_ wYear; + WORD_ wMonth; + WORD_ wDayOfWeek; + WORD_ wDay; + WORD_ wHour; + WORD_ wMinute; + WORD_ wSecond; + WORD_ wMilliseconds; + } SYSTEMTIME_, *PSYSTEMTIME_; + + #ifndef UNDER_CE // Windows CE does not define GetSystemTimeAsFileTime + __declspec(dllimport) void WINAPI + GetSystemTimeAsFileTime(FILETIME_* lpFileTime); + #endif + __declspec(dllimport) int WINAPI + FileTimeToLocalFileTime(const FILETIME_* lpFileTime, + FILETIME_* lpLocalFileTime); + __declspec(dllimport) void WINAPI + GetSystemTime(SYSTEMTIME_* lpSystemTime); + __declspec(dllimport) int WINAPI + SystemTimeToFileTime(const SYSTEMTIME_* lpSystemTime, + FILETIME_* lpFileTime); + __declspec(dllimport) unsigned long __stdcall + GetTickCount(); +} +#endif +} +} +} + +#endif // BOOST_DETAIL_WIN_TIME_HPP diff --git a/3rdParty/Boost/src/boost/detail/win/timers.hpp b/3rdParty/Boost/src/boost/detail/win/timers.hpp new file mode 100644 index 0000000..753c91f --- /dev/null +++ b/3rdParty/Boost/src/boost/detail/win/timers.hpp @@ -0,0 +1,41 @@ +// timers.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_TIMERS_HPP +#define BOOST_DETAIL_WIN_TIMERS_HPP + +#include <boost/detail/win/basic_types.hpp> + + +namespace boost +{ +namespace detail +{ +namespace win32 +{ +#if defined( BOOST_USE_WINDOWS_H ) + using ::QueryPerformanceCounter; + using ::QueryPerformanceFrequency; +#else +extern "C" { + __declspec(dllimport) BOOL_ WINAPI + QueryPerformanceCounter( + LARGE_INTEGER_ *lpPerformanceCount + ); + + __declspec(dllimport) BOOL_ WINAPI + QueryPerformanceFrequency( + LARGE_INTEGER_ *lpFrequency + ); +} +#endif +} +} +} + +#endif // BOOST_DETAIL_WIN_TIMERS_HPP diff --git a/3rdParty/Boost/src/boost/exception/detail/attribute_noreturn.hpp b/3rdParty/Boost/src/boost/exception/detail/attribute_noreturn.hpp index f6a0b59..ae9f031 100644 --- a/3rdParty/Boost/src/boost/exception/detail/attribute_noreturn.hpp +++ b/3rdParty/Boost/src/boost/exception/detail/attribute_noreturn.hpp @@ -9,7 +9,7 @@ #if defined(_MSC_VER) #define BOOST_ATTRIBUTE_NORETURN __declspec(noreturn) #elif defined(__GNUC__) -#define BOOST_ATTRIBUTE_NORETURN __attribute__((noreturn)) +#define BOOST_ATTRIBUTE_NORETURN __attribute__((__noreturn__)) #else #define BOOST_ATTRIBUTE_NORETURN #endif diff --git a/3rdParty/Boost/src/boost/exception/detail/clone_current_exception.hpp b/3rdParty/Boost/src/boost/exception/detail/clone_current_exception.hpp new file mode 100644 index 0000000..cc201b9 --- /dev/null +++ b/3rdParty/Boost/src/boost/exception/detail/clone_current_exception.hpp @@ -0,0 +1,47 @@ +//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc. + +//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 UUID_81522C0EB56511DFAB613DB0DFD72085 +#define UUID_81522C0EB56511DFAB613DB0DFD72085 + +#ifdef BOOST_NO_EXCEPTIONS +# error This header requires exception handling to be enabled. +#endif + +namespace +boost + { + namespace + exception_detail + { + class clone_base; + +#ifdef BOOST_ENABLE_NON_INTRUSIVE_EXCEPTION_PTR + int clone_current_exception_non_intrusive( clone_base const * & cloned ); +#endif + + namespace + clone_current_exception_result + { + int const success=0; + int const bad_alloc=1; + int const bad_exception=2; + int const not_supported=3; + } + + inline + int + clone_current_exception( clone_base const * & cloned ) + { +#ifdef BOOST_ENABLE_NON_INTRUSIVE_EXCEPTION_PTR + return clone_current_exception_non_intrusive(cloned); +#else + return clone_current_exception_result::not_supported; +#endif + } + } + } + +#endif diff --git a/3rdParty/Boost/src/boost/exception/detail/error_info_impl.hpp b/3rdParty/Boost/src/boost/exception/detail/error_info_impl.hpp index 883d313..a8d1aa7 100644 --- a/3rdParty/Boost/src/boost/exception/detail/error_info_impl.hpp +++ b/3rdParty/Boost/src/boost/exception/detail/error_info_impl.hpp @@ -30,6 +30,7 @@ boost protected: + virtual ~error_info_base() throw() { } diff --git a/3rdParty/Boost/src/boost/exception/detail/exception_ptr.hpp b/3rdParty/Boost/src/boost/exception/detail/exception_ptr.hpp index 0510fe2..5e5a267 100644 --- a/3rdParty/Boost/src/boost/exception/detail/exception_ptr.hpp +++ b/3rdParty/Boost/src/boost/exception/detail/exception_ptr.hpp @@ -20,18 +20,52 @@ #include <boost/exception/info.hpp> #include <boost/exception/diagnostic_information.hpp> #include <boost/exception/detail/type_info.hpp> +#include <boost/exception/detail/clone_current_exception.hpp> #include <boost/shared_ptr.hpp> #include <stdexcept> #include <new> #include <ios> +#include <stdlib.h> namespace boost { - typedef shared_ptr<exception_detail::clone_base const> exception_ptr; - + class exception_ptr; + BOOST_ATTRIBUTE_NORETURN void rethrow_exception( exception_ptr const & ); exception_ptr current_exception(); + class + exception_ptr + { + typedef boost::shared_ptr<exception_detail::clone_base const> impl; + impl ptr_; + friend void rethrow_exception( exception_ptr const & ); + typedef exception_detail::clone_base const * (impl::*unspecified_bool_type)() const; + public: + exception_ptr() + { + } + explicit + exception_ptr( impl const & ptr ): + ptr_(ptr) + { + } + bool + operator==( exception_ptr const & other ) const + { + return ptr_==other.ptr_; + } + bool + operator!=( exception_ptr const & other ) const + { + return ptr_!=other.ptr_; + } + operator unspecified_bool_type() const + { + return ptr_?&impl::get:0; + } + }; + template <class T> inline exception_ptr @@ -67,35 +101,49 @@ boost boost::exception, std::bad_alloc { + ~bad_alloc_() throw() { } }; - template <int Dummy> + struct + bad_exception_: + boost::exception, + std::bad_exception + { + ~bad_exception_() throw() { } + }; + + template <class Exception> exception_ptr - get_bad_alloc() + get_static_exception_object() { - bad_alloc_ ba; - exception_detail::clone_impl<bad_alloc_> c(ba); + Exception ba; + exception_detail::clone_impl<Exception> c(ba); c << throw_function(BOOST_CURRENT_FUNCTION) << throw_file(__FILE__) << throw_line(__LINE__); - static exception_ptr ep(new exception_detail::clone_impl<bad_alloc_>(c)); + static exception_ptr ep(shared_ptr<exception_detail::clone_base const>(new exception_detail::clone_impl<Exception>(c))); return ep; } - template <int Dummy> + template <class Exception> struct - exception_ptr_bad_alloc + exception_ptr_static_exception_object { static exception_ptr const e; }; - template <int Dummy> + template <class Exception> exception_ptr const - exception_ptr_bad_alloc<Dummy>:: - e = get_bad_alloc<Dummy>(); + exception_ptr_static_exception_object<Exception>:: + e = get_static_exception_object<Exception>(); } +#if defined(__GNUC__) +# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4) +# pragma GCC visibility push (default) +# endif +#endif class unknown_exception: public boost::exception, @@ -135,6 +183,11 @@ boost #endif } }; +#if defined(__GNUC__) +# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4) +# pragma GCC visibility pop +# endif +#endif namespace exception_detail @@ -244,101 +297,131 @@ boost exception_ptr current_exception_impl() { - try - { - throw; - } - catch( - exception_detail::clone_base & e ) - { - return exception_ptr(e.clone()); - } - catch( - std::domain_error & e ) - { - return exception_detail::current_exception_std_exception(e); - } - catch( - std::invalid_argument & e ) - { - return exception_detail::current_exception_std_exception(e); - } - catch( - std::length_error & e ) - { - return exception_detail::current_exception_std_exception(e); - } - catch( - std::out_of_range & e ) - { - return exception_detail::current_exception_std_exception(e); - } - catch( - std::logic_error & e ) - { - return exception_detail::current_exception_std_exception(e); - } - catch( - std::range_error & e ) - { - return exception_detail::current_exception_std_exception(e); - } - catch( - std::overflow_error & e ) - { - return exception_detail::current_exception_std_exception(e); - } - catch( - std::underflow_error & e ) - { - return exception_detail::current_exception_std_exception(e); - } - catch( - std::ios_base::failure & e ) - { - return exception_detail::current_exception_std_exception(e); - } - catch( - std::runtime_error & e ) - { - return exception_detail::current_exception_std_exception(e); - } - catch( - std::bad_alloc & e ) - { - return exception_detail::current_exception_std_exception(e); - } + exception_detail::clone_base const * e=0; + switch( + exception_detail::clone_current_exception(e) ) + { + case exception_detail::clone_current_exception_result:: + success: + { + BOOST_ASSERT(e!=0); + return exception_ptr(shared_ptr<exception_detail::clone_base const>(e)); + } + case exception_detail::clone_current_exception_result:: + bad_alloc: + { + BOOST_ASSERT(!e); + return exception_detail::exception_ptr_static_exception_object<bad_alloc_>::e; + } + case exception_detail::clone_current_exception_result:: + bad_exception: + { + BOOST_ASSERT(!e); + return exception_detail::exception_ptr_static_exception_object<bad_exception_>::e; + } + default: + BOOST_ASSERT(0); + case exception_detail::clone_current_exception_result:: + not_supported: + { + BOOST_ASSERT(!e); + try + { + throw; + } + catch( + exception_detail::clone_base & e ) + { + return exception_ptr(shared_ptr<exception_detail::clone_base const>(e.clone())); + } + catch( + std::domain_error & e ) + { + return exception_detail::current_exception_std_exception(e); + } + catch( + std::invalid_argument & e ) + { + return exception_detail::current_exception_std_exception(e); + } + catch( + std::length_error & e ) + { + return exception_detail::current_exception_std_exception(e); + } + catch( + std::out_of_range & e ) + { + return exception_detail::current_exception_std_exception(e); + } + catch( + std::logic_error & e ) + { + return exception_detail::current_exception_std_exception(e); + } + catch( + std::range_error & e ) + { + return exception_detail::current_exception_std_exception(e); + } + catch( + std::overflow_error & e ) + { + return exception_detail::current_exception_std_exception(e); + } + catch( + std::underflow_error & e ) + { + return exception_detail::current_exception_std_exception(e); + } + catch( + std::ios_base::failure & e ) + { + return exception_detail::current_exception_std_exception(e); + } + catch( + std::runtime_error & e ) + { + return exception_detail::current_exception_std_exception(e); + } + catch( + std::bad_alloc & e ) + { + return exception_detail::current_exception_std_exception(e); + } #ifndef BOOST_NO_TYPEID - catch( - std::bad_cast & e ) - { - return exception_detail::current_exception_std_exception(e); - } - catch( - std::bad_typeid & e ) - { - return exception_detail::current_exception_std_exception(e); - } + catch( + std::bad_cast & e ) + { + return exception_detail::current_exception_std_exception(e); + } + catch( + std::bad_typeid & e ) + { + return exception_detail::current_exception_std_exception(e); + } #endif - catch( - std::bad_exception & e ) - { - return exception_detail::current_exception_std_exception(e); - } - catch( - std::exception & e ) - { - return exception_detail::current_exception_unknown_std_exception(e); - } - catch( - boost::exception & e ) - { - return exception_detail::current_exception_unknown_boost_exception(e); - } - catch( - ... ) - { - return exception_detail::current_exception_unknown_exception(); + catch( + std::bad_exception & e ) + { + return exception_detail::current_exception_std_exception(e); + } + catch( + std::exception & e ) + { + return exception_detail::current_exception_unknown_std_exception(e); + } + catch( + boost::exception & e ) + { + return exception_detail::current_exception_unknown_boost_exception(e); + } + catch( + ... ) + { + return exception_detail::current_exception_unknown_exception(); + } + } } } } @@ -348,7 +431,6 @@ boost current_exception() { exception_ptr ret; - BOOST_ASSERT(!ret); try { ret=exception_detail::current_exception_impl(); @@ -356,36 +438,31 @@ boost catch( std::bad_alloc & ) { - ret=exception_detail::exception_ptr_bad_alloc<42>::e; + ret=exception_detail::exception_ptr_static_exception_object<exception_detail::bad_alloc_>::e; } catch( ... ) { - try - { - ret=exception_detail::current_exception_std_exception(std::bad_exception()); - } - catch( - std::bad_alloc & ) - { - ret=exception_detail::exception_ptr_bad_alloc<42>::e; - } - catch( - ... ) - { - BOOST_ASSERT(0); - } + ret=exception_detail::exception_ptr_static_exception_object<exception_detail::bad_exception_>::e; } BOOST_ASSERT(ret); return ret; } + BOOST_ATTRIBUTE_NORETURN inline void rethrow_exception( exception_ptr const & p ) { BOOST_ASSERT(p); - p->rethrow(); + p.ptr_->rethrow(); + BOOST_ASSERT(0); + #if defined(UNDER_CE) + // some CE platforms don't define ::abort() + exit(-1); + #else + abort(); + #endif } inline diff --git a/3rdParty/Boost/src/boost/exception/detail/type_info.hpp b/3rdParty/Boost/src/boost/exception/detail/type_info.hpp index 9ab1c57..92f8464 100644 --- a/3rdParty/Boost/src/boost/exception/detail/type_info.hpp +++ b/3rdParty/Boost/src/boost/exception/detail/type_info.hpp @@ -53,11 +53,11 @@ boost struct type_info_ { - detail::sp_typeinfo const & type_; + detail::sp_typeinfo const * type_; explicit type_info_( detail::sp_typeinfo const & type ): - type_(type) + type_(&type) { } @@ -65,7 +65,7 @@ boost bool operator<( type_info_ const & a, type_info_ const & b ) { - return 0!=(a.type_.before(b.type_)); + return 0!=(a.type_->before(*b.type_)); } }; } diff --git a/3rdParty/Boost/src/boost/exception/diagnostic_information.hpp b/3rdParty/Boost/src/boost/exception/diagnostic_information.hpp index 2297676..ef89d73 100644 --- a/3rdParty/Boost/src/boost/exception/diagnostic_information.hpp +++ b/3rdParty/Boost/src/boost/exception/diagnostic_information.hpp @@ -14,6 +14,7 @@ #include <boost/config.hpp> #include <boost/exception/get_error_info.hpp> +#include <boost/exception/info.hpp> #include <boost/utility/enable_if.hpp> #ifndef BOOST_NO_RTTI #include <boost/units/detail/utility.hpp> @@ -85,19 +86,23 @@ boost char const * get_diagnostic_information( exception const & x, char const * header ) { - if( error_info_container * c=x.data_.get() ) #ifndef BOOST_NO_EXCEPTIONS - try - { + try + { #endif - return c->diagnostic_information(header); + error_info_container * c=x.data_.get(); + if( !c ) + x.data_.adopt(c=new exception_detail::error_info_container_impl); + char const * di=c->diagnostic_information(header); + BOOST_ASSERT(di!=0); + return di; #ifndef BOOST_NO_EXCEPTIONS - } - catch(...) - { - } + } + catch(...) + { + return 0; + } #endif - return 0; } inline @@ -122,22 +127,30 @@ boost std::ostringstream tmp; if( be ) { - if( char const * const * f=get_error_info<throw_file>(*be) ) + char const * const * f=get_error_info<throw_file>(*be); + int const * l=get_error_info<throw_line>(*be); + char const * const * fn=get_error_info<throw_function>(*be); + if( !f && !l && !fn ) + tmp << "Throw location unknown (consider using BOOST_THROW_EXCEPTION)\n"; + else { - tmp << *f; - if( int const * l=get_error_info<throw_line>(*be) ) - tmp << '(' << *l << "): "; + if( f ) + { + tmp << *f; + if( int const * l=get_error_info<throw_line>(*be) ) + tmp << '(' << *l << "): "; + } + tmp << "Throw in function "; + if( char const * const * fn=get_error_info<throw_function>(*be) ) + tmp << *fn; + else + tmp << "(unknown)"; + tmp << '\n'; } - tmp << "Throw in function "; - if( char const * const * fn=get_error_info<throw_function>(*be) ) - tmp << *fn; - else - tmp << "(unknown)"; - tmp << '\n'; } #ifndef BOOST_NO_RTTI tmp << std::string("Dynamic exception type: ") << - units::detail::demangle((be?(BOOST_EXCEPTION_DYNAMIC_TYPEID(*be)):(BOOST_EXCEPTION_DYNAMIC_TYPEID(*se))).type_.name()) << '\n'; + units::detail::demangle((be?(BOOST_EXCEPTION_DYNAMIC_TYPEID(*be)):(BOOST_EXCEPTION_DYNAMIC_TYPEID(*se))).type_->name()) << '\n'; #endif if( with_what && se ) tmp << "std::exception::what: " << wh << '\n'; @@ -166,7 +179,10 @@ boost { #endif (void) exception_detail::diagnostic_information_impl(&e,0,false); - return exception_detail::get_diagnostic_information(e,0); + if( char const * di=exception_detail::get_diagnostic_information(e,0) ) + return di; + else + return "Failed to produce boost::diagnostic_information_what()"; #ifndef BOOST_NO_EXCEPTIONS } catch( diff --git a/3rdParty/Boost/src/boost/exception/exception.hpp b/3rdParty/Boost/src/boost/exception/exception.hpp index adaac68..42d2787 100644 --- a/3rdParty/Boost/src/boost/exception/exception.hpp +++ b/3rdParty/Boost/src/boost/exception/exception.hpp @@ -132,7 +132,17 @@ boost } }; +#if defined(__GNUC__) +# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4) +# pragma GCC visibility push (default) +# endif +#endif class exception; +#if defined(__GNUC__) +# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4) +# pragma GCC visibility pop +# endif +#endif template <class T> class shared_ptr; @@ -189,6 +199,11 @@ boost E const & set_info( E const &, throw_line const & ); } +#if defined(__GNUC__) +# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4) +# pragma GCC visibility push (default) +# endif +#endif class exception { @@ -250,6 +265,11 @@ boost mutable char const * throw_file_; mutable int throw_line_; }; +#if defined(__GNUC__) +# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4) +# pragma GCC visibility pop +# endif +#endif inline exception:: @@ -290,6 +310,11 @@ boost namespace exception_detail { +#if defined(__GNUC__) +# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4) +# pragma GCC visibility push (default) +# endif +#endif template <class T> struct error_info_injector: @@ -306,6 +331,11 @@ boost { } }; +#if defined(__GNUC__) +# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4) +# pragma GCC visibility pop +# endif +#endif struct large_size { char c[256]; }; large_size dispatch_boost_exception( exception const * ); @@ -334,7 +364,7 @@ boost struct enable_error_info_return_type { - typedef typename enable_error_info_helper<T,sizeof(exception_detail::dispatch_boost_exception((T*)0))>::type type; + typedef typename enable_error_info_helper<T,sizeof(exception_detail::dispatch_boost_exception(static_cast<T *>(0)))>::type type; }; } @@ -353,6 +383,11 @@ boost namespace exception_detail { +#if defined(__GNUC__) +# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4) +# pragma GCC visibility push (default) +# endif +#endif class clone_base { @@ -366,6 +401,11 @@ boost { } }; +#if defined(__GNUC__) +# if (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4) +# pragma GCC visibility pop +# endif +#endif inline void @@ -390,8 +430,15 @@ boost class clone_impl: public T, - public clone_base + public virtual clone_base { + struct clone_tag { }; + clone_impl( clone_impl const & x, clone_tag ): + T(x) + { + copy_boost_exception(this,&x); + } + public: explicit @@ -410,7 +457,7 @@ boost clone_base const * clone() const { - return new clone_impl(*this); + return new clone_impl(*this,clone_tag()); } void diff --git a/3rdParty/Boost/src/boost/exception/info.hpp b/3rdParty/Boost/src/boost/exception/info.hpp index c918dbd..7b56076 100644 --- a/3rdParty/Boost/src/boost/exception/info.hpp +++ b/3rdParty/Boost/src/boost/exception/info.hpp @@ -97,7 +97,7 @@ boost { shared_ptr<error_info_base> const & p = i->second; #ifndef BOOST_NO_RTTI - BOOST_ASSERT( BOOST_EXCEPTION_DYNAMIC_TYPEID(*p).type_==ti.type_ ); + BOOST_ASSERT( *BOOST_EXCEPTION_DYNAMIC_TYPEID(*p).type_==*ti.type_ ); #endif return p; } @@ -109,7 +109,6 @@ boost { if( header ) { - BOOST_ASSERT(*header!=0); std::ostringstream tmp; tmp << header; for( error_info_map::const_iterator i=info_.begin(),end=info_.end(); i!=end; ++i ) diff --git a/3rdParty/Boost/src/boost/filesystem.hpp b/3rdParty/Boost/src/boost/filesystem.hpp index d64d760..1a75302 100644 --- a/3rdParty/Boost/src/boost/filesystem.hpp +++ b/3rdParty/Boost/src/boost/filesystem.hpp @@ -12,30 +12,9 @@ #ifndef BOOST_FILESYSTEM_FILESYSTEM_HPP #define BOOST_FILESYSTEM_FILESYSTEM_HPP -#include <boost/config.hpp> // for <boost/config/user.hpp>, in case - // BOOST_FILESYSTEM_VERSION defined there - -# if defined(BOOST_FILESYSTEM_VERSION) \ - && BOOST_FILESYSTEM_VERSION != 2 && BOOST_FILESYSTEM_VERSION != 3 -# error BOOST_FILESYSTEM_VERSION defined, but not as 2 or 3 -# endif - -# if !defined(BOOST_FILESYSTEM_VERSION) -# define BOOST_FILESYSTEM_VERSION 3 -# endif - -#if BOOST_FILESYSTEM_VERSION == 2 -# include <boost/filesystem/v2/config.hpp> -# include <boost/filesystem/v2/path.hpp> -# include <boost/filesystem/v2/operations.hpp> -# include <boost/filesystem/v2/convenience.hpp> - -# else -# include <boost/filesystem/v3/config.hpp> -# include <boost/filesystem/v3/path.hpp> -# include <boost/filesystem/v3/operations.hpp> -# include <boost/filesystem/v3/convenience.hpp> - -# endif +# include <boost/filesystem/config.hpp> +# include <boost/filesystem/path.hpp> +# include <boost/filesystem/operations.hpp> +# include <boost/filesystem/convenience.hpp> #endif // BOOST_FILESYSTEM_FILESYSTEM_HPP diff --git a/3rdParty/Boost/src/boost/filesystem/config.hpp b/3rdParty/Boost/src/boost/filesystem/config.hpp index c813bf5..ca695f4 100644 --- a/3rdParty/Boost/src/boost/filesystem/config.hpp +++ b/3rdParty/Boost/src/boost/filesystem/config.hpp @@ -1,6 +1,6 @@ -// boost/filesystem/config.hpp -------------------------------------------------------// +// boost/filesystem/v3/config.hpp ----------------------------------------------------// -// Copyright Beman Dawes 2010 +// Copyright Beman Dawes 2003 // Distributed under the Boost Software License, Version 1.0. // See http://www.boost.org/LICENSE_1_0.txt @@ -9,27 +9,101 @@ //--------------------------------------------------------------------------------------// -#ifndef BOOST_FILESYSTEM_CONFIGX_HPP -#define BOOST_FILESYSTEM_CONFIGX_HPP +#ifndef BOOST_FILESYSTEM3_CONFIG_HPP +#define BOOST_FILESYSTEM3_CONFIG_HPP -#include <boost/config.hpp> // for <boost/config/user.hpp>, in case - // BOOST_FILESYSTEM_VERSION defined there - -# if defined(BOOST_FILESYSTEM_VERSION) \ - && BOOST_FILESYSTEM_VERSION != 2 && BOOST_FILESYSTEM_VERSION != 3 -# error BOOST_FILESYSTEM_VERSION defined, but not as 2 or 3 +# if defined(BOOST_FILESYSTEM_VERSION) && BOOST_FILESYSTEM_VERSION != 3 +# error Compiling Filesystem version 3 file with BOOST_FILESYSTEM_VERSION defined != 3 # endif # if !defined(BOOST_FILESYSTEM_VERSION) # define BOOST_FILESYSTEM_VERSION 3 # endif -#if BOOST_FILESYSTEM_VERSION == 2 -# include <boost/filesystem/v2/config.hpp> +#define BOOST_FILESYSTEM_I18N // aid users wishing to compile several versions + +// This header implements separate compilation features as described in +// http://www.boost.org/more/separate_compilation.html + +#include <boost/config.hpp> +#include <boost/system/api_config.hpp> // for BOOST_POSIX_API or BOOST_WINDOWS_API +#include <boost/detail/workaround.hpp> + +// BOOST_FILESYSTEM_DEPRECATED needed for source compiles -----------------------------// + +# ifdef BOOST_FILESYSTEM_SOURCE +# define BOOST_FILESYSTEM_DEPRECATED +# endif + +// throw an exception ----------------------------------------------------------------// +// +// Exceptions were originally thrown via boost::throw_exception(). +// As throw_exception() became more complex, it caused user error reporting +// to be harder to interpret, since the exception reported became much more complex. +// The immediate fix was to throw directly, wrapped in a macro to make any later change +// easier. + +#define BOOST_FILESYSTEM_THROW(EX) throw EX + +# if defined( BOOST_NO_STD_WSTRING ) +# error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support +# endif + +// This header implements separate compilation features as described in +// http://www.boost.org/more/separate_compilation.html + +// normalize macros ------------------------------------------------------------------// + +#if !defined(BOOST_FILESYSTEM_DYN_LINK) && !defined(BOOST_FILESYSTEM_STATIC_LINK) \ + && !defined(BOOST_ALL_DYN_LINK) && !defined(BOOST_ALL_STATIC_LINK) +# define BOOST_FILESYSTEM_STATIC_LINK +#endif + +#if defined(BOOST_ALL_DYN_LINK) && !defined(BOOST_FILESYSTEM_DYN_LINK) +# define BOOST_FILESYSTEM_DYN_LINK +#elif defined(BOOST_ALL_STATIC_LINK) && !defined(BOOST_FILESYSTEM_STATIC_LINK) +# define BOOST_FILESYSTEM_STATIC_LINK +#endif -# else -# include <boost/filesystem/v3/config.hpp> +#if defined(BOOST_FILESYSTEM_DYN_LINK) && defined(BOOST_FILESYSTEM_STATIC_LINK) +# error Must not define both BOOST_FILESYSTEM_DYN_LINK and BOOST_FILESYSTEM_STATIC_LINK +#endif +#if defined(BOOST_ALL_NO_LIB) && !defined(BOOST_FILESYSTEM_NO_LIB) +# define BOOST_FILESYSTEM_NO_LIB +#endif + +// enable dynamic linking ------------------------------------------------------------// + +#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_FILESYSTEM_DYN_LINK) +# if defined(BOOST_FILESYSTEM_SOURCE) +# define BOOST_FILESYSTEM_DECL BOOST_SYMBOL_EXPORT +# else +# define BOOST_FILESYSTEM_DECL BOOST_SYMBOL_IMPORT # endif +#else +# define BOOST_FILESYSTEM_DECL +#endif + +// enable automatic library variant selection ----------------------------------------// + +#if !defined(BOOST_FILESYSTEM_SOURCE) && !defined(BOOST_ALL_NO_LIB) \ + && !defined(BOOST_FILESYSTEM_NO_LIB) +// +// Set the name of our library, this will get undef'ed by auto_link.hpp +// once it's done with it: +// +#define BOOST_LIB_NAME boost_filesystem +// +// If we're importing code from a dll, then tell auto_link.hpp about it: +// +#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_FILESYSTEM_DYN_LINK) +# define BOOST_DYN_LINK +#endif +// +// And include the header that does the work: +// +#include <boost/config/auto_link.hpp> +#endif // auto-linking disabled -#endif // BOOST_FILESYSTEM_CONFIGX_HPP +#endif // BOOST_FILESYSTEM3_CONFIG_HPP diff --git a/3rdParty/Boost/src/boost/filesystem/convenience.hpp b/3rdParty/Boost/src/boost/filesystem/convenience.hpp new file mode 100644 index 0000000..f0bd986 --- /dev/null +++ b/3rdParty/Boost/src/boost/filesystem/convenience.hpp @@ -0,0 +1,58 @@ +// boost/filesystem/convenience.hpp ----------------------------------------// + +// Copyright Beman Dawes, 2002-2005 +// Copyright Vladimir Prus, 2002 +// 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 library home page at http://www.boost.org/libs/filesystem + +//----------------------------------------------------------------------------// + +#ifndef BOOST_FILESYSTEM3_CONVENIENCE_HPP +#define BOOST_FILESYSTEM3_CONVENIENCE_HPP + +#include <boost/config.hpp> + +# if defined( BOOST_NO_STD_WSTRING ) +# error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support +# endif + +#include <boost/filesystem/operations.hpp> +#include <boost/system/error_code.hpp> + +#include <boost/config/abi_prefix.hpp> // must be the last #include + +namespace boost +{ + namespace filesystem + { + +# ifndef BOOST_FILESYSTEM_NO_DEPRECATED + + inline std::string extension(const path & p) + { + return p.extension().string(); + } + + inline std::string basename(const path & p) + { + return p.stem().string(); + } + + inline path change_extension( const path & p, const path & new_extension ) + { + path new_p( p ); + new_p.replace_extension( new_extension ); + return new_p; + } + +# endif + + + } // namespace filesystem +} // namespace boost + +#include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas +#endif // BOOST_FILESYSTEM3_CONVENIENCE_HPP diff --git a/3rdParty/Boost/src/boost/filesystem/exception.hpp b/3rdParty/Boost/src/boost/filesystem/exception.hpp index 6ba8466..985cd8f 100644 --- a/3rdParty/Boost/src/boost/filesystem/exception.hpp +++ b/3rdParty/Boost/src/boost/filesystem/exception.hpp @@ -1,35 +1,9 @@ -// boost/filesystem/exception.hpp ----------------------------------------------------// +// boost/filesystem/exception.hpp -----------------------------------------------------// -// Copyright Beman Dawes 2010 +// Copyright Beman Dawes 2003 +// 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) -// Distributed under the Boost Software License, Version 1.0. -// See http://www.boost.org/LICENSE_1_0.txt - -// Library home page: http://www.boost.org/libs/filesystem - -//--------------------------------------------------------------------------------------// - -#ifndef BOOST_FILESYSTEM_EXCEPTIONX_HPP -#define BOOST_FILESYSTEM_EXCEPTIONX_HPP - -#include <boost/config.hpp> // for <boost/config/user.hpp>, in case - // BOOST_FILESYSTEM_VERSION defined there - -# if defined(BOOST_FILESYSTEM_VERSION) \ - && BOOST_FILESYSTEM_VERSION != 2 && BOOST_FILESYSTEM_VERSION != 3 -# error BOOST_FILESYSTEM_VERSION defined, but not as 2 or 3 -# endif - -# if !defined(BOOST_FILESYSTEM_VERSION) -# define BOOST_FILESYSTEM_VERSION 3 -# endif - -#if BOOST_FILESYSTEM_VERSION == 2 -# include <boost/filesystem/v2/exception.hpp> - -# else -# include <boost/filesystem/v3/exception.hpp> - -# endif - -#endif // BOOST_FILESYSTEM_EXCEPTIONX_HPP +// This header is no longer used. The contents have been moved to path.hpp. +// It is provided so that user code #includes do not have to be changed. diff --git a/3rdParty/Boost/src/boost/filesystem/fstream.hpp b/3rdParty/Boost/src/boost/filesystem/fstream.hpp index e159e58..0727238 100644 --- a/3rdParty/Boost/src/boost/filesystem/fstream.hpp +++ b/3rdParty/Boost/src/boost/filesystem/fstream.hpp @@ -1,6 +1,6 @@ // boost/filesystem/fstream.hpp ------------------------------------------------------// -// Copyright Beman Dawes 2010 +// Copyright Beman Dawes 2002 // Distributed under the Boost Software License, Version 1.0. // See http://www.boost.org/LICENSE_1_0.txt @@ -9,27 +9,174 @@ //--------------------------------------------------------------------------------------// -#ifndef BOOST_FILESYSTEM_FSTREAMX_HPP -#define BOOST_FILESYSTEM_FSTREAMX_HPP +#ifndef BOOST_FILESYSTEM3_FSTREAM_HPP +#define BOOST_FILESYSTEM3_FSTREAM_HPP -#include <boost/config.hpp> // for <boost/config/user.hpp>, in case - // BOOST_FILESYSTEM_VERSION defined there +#include <boost/config.hpp> -# if defined(BOOST_FILESYSTEM_VERSION) \ - && BOOST_FILESYSTEM_VERSION != 2 && BOOST_FILESYSTEM_VERSION != 3 -# error BOOST_FILESYSTEM_VERSION defined, but not as 2 or 3 +# if defined( BOOST_NO_STD_WSTRING ) +# error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support # endif -# if !defined(BOOST_FILESYSTEM_VERSION) -# define BOOST_FILESYSTEM_VERSION 3 -# endif +#include <boost/filesystem/path.hpp> +#include <iosfwd> +#include <fstream> -#if BOOST_FILESYSTEM_VERSION == 2 -# include <boost/filesystem/v2/fstream.hpp> +#include <boost/config/abi_prefix.hpp> // must be the last #include -# else -# include <boost/filesystem/v3/fstream.hpp> +// on Windows, except for standard libaries known to have wchar_t overloads for +// file stream I/O, use path::string() to get a narrow character c_str() +#if defined(BOOST_WINDOWS_API) \ + && (!defined(_CPPLIB_VER) || _CPPLIB_VER < 405 || defined(_STLPORT_VERSION)) + // !Dinkumware || early Dinkumware || STLPort masquerading as Dinkumware +# define BOOST_FILESYSTEM_C_STR string().c_str() // use narrow, since wide not available +#else // use the native c_str, which will be narrow on POSIX, wide on Windows +# define BOOST_FILESYSTEM_C_STR c_str() +#endif -# endif +namespace boost +{ +namespace filesystem +{ + +//--------------------------------------------------------------------------------------// +// basic_filebuf // +//--------------------------------------------------------------------------------------// + + template < class charT, class traits = std::char_traits<charT> > + class basic_filebuf : public std::basic_filebuf<charT,traits> + { + private: // disallow copying + basic_filebuf(const basic_filebuf&); + const basic_filebuf& operator=(const basic_filebuf&); + + public: + basic_filebuf() {} + virtual ~basic_filebuf() {} + + basic_filebuf<charT,traits>* + open(const path& p, std::ios_base::openmode mode) + { + return std::basic_filebuf<charT,traits>::open(p.BOOST_FILESYSTEM_C_STR, mode) + ? this : 0; + } + }; + +//--------------------------------------------------------------------------------------// +// basic_ifstream // +//--------------------------------------------------------------------------------------// + + template < class charT, class traits = std::char_traits<charT> > + class basic_ifstream : public std::basic_ifstream<charT,traits> + { + private: // disallow copying + basic_ifstream(const basic_ifstream&); + const basic_ifstream& operator=(const basic_ifstream&); + + public: + basic_ifstream() {} + + // use two signatures, rather than one signature with default second + // argument, to workaround VC++ 7.1 bug (ID VSWhidbey 38416) + + explicit basic_ifstream(const path& p) + : std::basic_ifstream<charT,traits>(p.BOOST_FILESYSTEM_C_STR, std::ios_base::in) {} + + basic_ifstream(const path& p, std::ios_base::openmode mode) + : std::basic_ifstream<charT,traits>(p.BOOST_FILESYSTEM_C_STR, mode) {} + + void open(const path& p) + { std::basic_ifstream<charT,traits>::open(p.BOOST_FILESYSTEM_C_STR, std::ios_base::in); } + + void open(const path& p, std::ios_base::openmode mode) + { std::basic_ifstream<charT,traits>::open(p.BOOST_FILESYSTEM_C_STR, mode); } + + virtual ~basic_ifstream() {} + }; + +//--------------------------------------------------------------------------------------// +// basic_ofstream // +//--------------------------------------------------------------------------------------// + + template < class charT, class traits = std::char_traits<charT> > + class basic_ofstream : public std::basic_ofstream<charT,traits> + { + private: // disallow copying + basic_ofstream(const basic_ofstream&); + const basic_ofstream& operator=(const basic_ofstream&); + + public: + basic_ofstream() {} + + // use two signatures, rather than one signature with default second + // argument, to workaround VC++ 7.1 bug (ID VSWhidbey 38416) + + explicit basic_ofstream(const path& p) + : std::basic_ofstream<charT,traits>(p.BOOST_FILESYSTEM_C_STR, std::ios_base::out) {} + + basic_ofstream(const path& p, std::ios_base::openmode mode) + : std::basic_ofstream<charT,traits>(p.BOOST_FILESYSTEM_C_STR, mode) {} + + void open(const path& p) + { std::basic_ofstream<charT,traits>::open(p.BOOST_FILESYSTEM_C_STR, std::ios_base::out); } + + void open(const path& p, std::ios_base::openmode mode) + { std::basic_ofstream<charT,traits>::open(p.BOOST_FILESYSTEM_C_STR, mode); } + + virtual ~basic_ofstream() {} + }; + +//--------------------------------------------------------------------------------------// +// basic_fstream // +//--------------------------------------------------------------------------------------// + + template < class charT, class traits = std::char_traits<charT> > + class basic_fstream : public std::basic_fstream<charT,traits> + { + private: // disallow copying + basic_fstream(const basic_fstream&); + const basic_fstream & operator=(const basic_fstream&); + + public: + basic_fstream() {} + + // use two signatures, rather than one signature with default second + // argument, to workaround VC++ 7.1 bug (ID VSWhidbey 38416) + + explicit basic_fstream(const path& p) + : std::basic_fstream<charT,traits>(p.BOOST_FILESYSTEM_C_STR, + std::ios_base::in | std::ios_base::out) {} + + basic_fstream(const path& p, std::ios_base::openmode mode) + : std::basic_fstream<charT,traits>(p.BOOST_FILESYSTEM_C_STR, mode) {} + + void open(const path& p) + { std::basic_fstream<charT,traits>::open(p.BOOST_FILESYSTEM_C_STR, + std::ios_base::in | std::ios_base::out); } + + void open(const path& p, std::ios_base::openmode mode) + { std::basic_fstream<charT,traits>::open(p.BOOST_FILESYSTEM_C_STR, mode); } + + virtual ~basic_fstream() {} + + }; + +//--------------------------------------------------------------------------------------// +// typedefs // +//--------------------------------------------------------------------------------------// + + typedef basic_filebuf<char> filebuf; + typedef basic_ifstream<char> ifstream; + typedef basic_ofstream<char> ofstream; + typedef basic_fstream<char> fstream; + + typedef basic_filebuf<wchar_t> wfilebuf; + typedef basic_ifstream<wchar_t> wifstream; + typedef basic_ofstream<wchar_t> wofstream; + typedef basic_fstream<wchar_t> wfstream; + +} // namespace filesystem +} // namespace boost -#endif // BOOST_FILESYSTEM_FSTREAMX_HPP +#include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas +#endif // BOOST_FILESYSTEM3_FSTREAM_HPP diff --git a/3rdParty/Boost/src/boost/filesystem/operations.hpp b/3rdParty/Boost/src/boost/filesystem/operations.hpp index db7b123..dc01b7d 100644 --- a/3rdParty/Boost/src/boost/filesystem/operations.hpp +++ b/3rdParty/Boost/src/boost/filesystem/operations.hpp @@ -1,35 +1,1096 @@ // boost/filesystem/operations.hpp ---------------------------------------------------// -// Copyright Beman Dawes 2010 - +// Copyright Beman Dawes 2002-2009 +// Copyright Jan Langer 2002 +// Copyright Dietmar Kuehl 2001 +// Copyright Vladimir Prus 2002 + // Distributed under the Boost Software License, Version 1.0. // See http://www.boost.org/LICENSE_1_0.txt // Library home page: http://www.boost.org/libs/filesystem -//--------------------------------------------------------------------------------------// +//--------------------------------------------------------------------------------------// + +#ifndef BOOST_FILESYSTEM3_OPERATIONS_HPP +#define BOOST_FILESYSTEM3_OPERATIONS_HPP + +#include <boost/config.hpp> + +# if defined( BOOST_NO_STD_WSTRING ) +# error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support +# endif + +#include <boost/filesystem/config.hpp> +#include <boost/filesystem/path.hpp> + +#include <boost/detail/scoped_enum_emulation.hpp> +#include <boost/detail/bitmask.hpp> +#include <boost/system/error_code.hpp> +#include <boost/system/system_error.hpp> +#include <boost/shared_ptr.hpp> +#include <boost/utility/enable_if.hpp> +#include <boost/type_traits/is_same.hpp> +#include <boost/iterator.hpp> +#include <boost/cstdint.hpp> +#include <boost/assert.hpp> + +#include <string> +#include <utility> // for pair +#include <ctime> +#include <vector> +#include <stack> + +#ifdef BOOST_WINDOWS_API +# include <fstream> +#endif + +#include <boost/config/abi_prefix.hpp> // must be the last #include + +//--------------------------------------------------------------------------------------// + +namespace boost +{ + namespace filesystem + { + +//--------------------------------------------------------------------------------------// +// file_type // +//--------------------------------------------------------------------------------------// + + enum file_type + { + status_error, +# ifndef BOOST_FILESYSTEM_NO_DEPRECATED + status_unknown = status_error, +# endif + file_not_found, + regular_file, + directory_file, + // the following may not apply to some operating systems or file systems + symlink_file, + block_file, + character_file, + fifo_file, + socket_file, + reparse_file, // Windows: FILE_ATTRIBUTE_REPARSE_POINT that is not a symlink + type_unknown, // file does exist, but isn't one of the above types or + // we don't have strong enough permission to find its type + + _detail_directory_symlink // internal use only; never exposed to users + }; + +//--------------------------------------------------------------------------------------// +// perms // +//--------------------------------------------------------------------------------------// + + enum perms + { + no_perms = 0, // file_not_found is no_perms rather than perms_not_known + + // POSIX equivalent macros given in comments. + // Values are from POSIX and are given in octal per the POSIX standard. + + // permission bits + + owner_read = 0400, // S_IRUSR, Read permission, owner + owner_write = 0200, // S_IWUSR, Write permission, owner + owner_exe = 0100, // S_IXUSR, Execute/search permission, owner + owner_all = 0700, // S_IRWXU, Read, write, execute/search by owner + + group_read = 040, // S_IRGRP, Read permission, group + group_write = 020, // S_IWGRP, Write permission, group + group_exe = 010, // S_IXGRP, Execute/search permission, group + group_all = 070, // S_IRWXG, Read, write, execute/search by group + + others_read = 04, // S_IROTH, Read permission, others + others_write = 02, // S_IWOTH, Write permission, others + others_exe = 01, // S_IXOTH, Execute/search permission, others + others_all = 07, // S_IRWXO, Read, write, execute/search by others + + all_all = owner_all|group_all|others_all, // 0777 + + // other POSIX bits + + set_uid_on_exe = 04000, // S_ISUID, Set-user-ID on execution + set_gid_on_exe = 02000, // S_ISGID, Set-group-ID on execution + sticky_bit = 01000, // S_ISVTX, + // (POSIX XSI) On directories, restricted deletion flag + // (V7) 'sticky bit': save swapped text even after use + // (SunOS) On non-directories: don't cache this file + // (SVID-v4.2) On directories: restricted deletion flag + // Also see http://en.wikipedia.org/wiki/Sticky_bit + + perms_mask = all_all|set_uid_on_exe|set_gid_on_exe|sticky_bit, // 07777 + + perms_not_known = 0xFFFF, // present when directory_entry cache not loaded + + // options for permissions() function + + add_perms = 0x1000, // adds the given permission bits to the current bits + remove_perms = 0x2000, // removes the given permission bits from the current bits; + // choose add_perms or remove_perms, not both; if neither add_perms + // nor remove_perms is given, replace the current bits with + // the given bits. + + symlink_perms = 0x4000 // on POSIX, don't resolve symlinks; implied on Windows + }; + + BOOST_BITMASK(perms) + +//--------------------------------------------------------------------------------------// +// file_status // +//--------------------------------------------------------------------------------------// + + class BOOST_FILESYSTEM_DECL file_status + { + public: + file_status() : m_value(status_error), m_perms(perms_not_known) {} + explicit file_status(file_type v, perms prms = perms_not_known) + : m_value(v), m_perms(prms) {} + + // observers + file_type type() const { return m_value; } + perms permissions() const { return m_perms; } + + // modifiers + void type(file_type v) { m_value = v; } + void permissions(perms prms) { m_perms = prms; } + + bool operator==(const file_status& rhs) const { return type() == rhs.type() && + permissions() == rhs.permissions(); } + bool operator!=(const file_status& rhs) const { return !(*this == rhs); } + + private: + file_type m_value; + enum perms m_perms; + }; + + inline bool type_present(file_status f) { return f.type() != status_error; } + inline bool permissions_present(file_status f) + {return f.permissions() != perms_not_known;} + inline bool status_known(file_status f) { return type_present(f) && permissions_present(f); } + inline bool exists(file_status f) { return f.type() != status_error + && f.type() != file_not_found; } + inline bool is_regular_file(file_status f){ return f.type() == regular_file; } + inline bool is_directory(file_status f) { return f.type() == directory_file; } + inline bool is_symlink(file_status f) { return f.type() == symlink_file; } + inline bool is_other(file_status f) { return exists(f) && !is_regular_file(f) + && !is_directory(f) && !is_symlink(f); } + +# ifndef BOOST_FILESYSTEM_NO_DEPRECATED + inline bool is_regular(file_status f) { return f.type() == regular_file; } +# endif + + struct space_info + { + // all values are byte counts + boost::uintmax_t capacity; + boost::uintmax_t free; // <= capacity + boost::uintmax_t available; // <= free + }; -#ifndef BOOST_FILESYSTEM_OPERATIONSX_HPP -#define BOOST_FILESYSTEM_OPERATIONSX_HPP + BOOST_SCOPED_ENUM_START(copy_option) + {none, fail_if_exists = none, overwrite_if_exists}; + BOOST_SCOPED_ENUM_END -#include <boost/config.hpp> // for <boost/config/user.hpp>, in case - // BOOST_FILESYSTEM_VERSION defined there +//--------------------------------------------------------------------------------------// +// implementation details // +//--------------------------------------------------------------------------------------// -# if defined(BOOST_FILESYSTEM_VERSION) \ - && BOOST_FILESYSTEM_VERSION != 2 && BOOST_FILESYSTEM_VERSION != 3 -# error BOOST_FILESYSTEM_VERSION defined, but not as 2 or 3 + namespace detail + { + BOOST_FILESYSTEM_DECL + file_status status(const path&p, system::error_code* ec=0); + BOOST_FILESYSTEM_DECL + file_status symlink_status(const path& p, system::error_code* ec=0); + BOOST_FILESYSTEM_DECL + bool is_empty(const path& p, system::error_code* ec=0); + BOOST_FILESYSTEM_DECL + path initial_path(system::error_code* ec=0); + BOOST_FILESYSTEM_DECL + path canonical(const path& p, const path& base, system::error_code* ec=0); + BOOST_FILESYSTEM_DECL + void copy(const path& from, const path& to, system::error_code* ec=0); + BOOST_FILESYSTEM_DECL + void copy_directory(const path& from, const path& to, system::error_code* ec=0); + BOOST_FILESYSTEM_DECL + void copy_file(const path& from, const path& to, + BOOST_SCOPED_ENUM(copy_option) option, // See ticket #2925 + system::error_code* ec=0); + BOOST_FILESYSTEM_DECL + void copy_symlink(const path& existing_symlink, const path& new_symlink, system::error_code* ec=0); + BOOST_FILESYSTEM_DECL + bool create_directories(const path& p, system::error_code* ec=0); + BOOST_FILESYSTEM_DECL + bool create_directory(const path& p, system::error_code* ec=0); + BOOST_FILESYSTEM_DECL + void create_directory_symlink(const path& to, const path& from, + system::error_code* ec=0); + BOOST_FILESYSTEM_DECL + void create_hard_link(const path& to, const path& from, system::error_code* ec=0); + BOOST_FILESYSTEM_DECL + void create_symlink(const path& to, const path& from, system::error_code* ec=0); + BOOST_FILESYSTEM_DECL + path current_path(system::error_code* ec=0); + BOOST_FILESYSTEM_DECL + void current_path(const path& p, system::error_code* ec=0); + BOOST_FILESYSTEM_DECL + bool equivalent(const path& p1, const path& p2, system::error_code* ec=0); + BOOST_FILESYSTEM_DECL + boost::uintmax_t file_size(const path& p, system::error_code* ec=0); + BOOST_FILESYSTEM_DECL + boost::uintmax_t hard_link_count(const path& p, system::error_code* ec=0); + BOOST_FILESYSTEM_DECL + std::time_t last_write_time(const path& p, system::error_code* ec=0); + BOOST_FILESYSTEM_DECL + void last_write_time(const path& p, const std::time_t new_time, + system::error_code* ec=0); + BOOST_FILESYSTEM_DECL + void permissions(const path& p, perms prms, system::error_code* ec=0); + BOOST_FILESYSTEM_DECL + path read_symlink(const path& p, system::error_code* ec=0); + BOOST_FILESYSTEM_DECL + // For standardization, if the committee doesn't like "remove", consider "eliminate" + bool remove(const path& p, system::error_code* ec=0); + BOOST_FILESYSTEM_DECL + boost::uintmax_t remove_all(const path& p, system::error_code* ec=0); + BOOST_FILESYSTEM_DECL + void rename(const path& old_p, const path& new_p, system::error_code* ec=0); + BOOST_FILESYSTEM_DECL + void resize_file(const path& p, uintmax_t size, system::error_code* ec=0); + BOOST_FILESYSTEM_DECL + space_info space(const path& p, system::error_code* ec=0); + BOOST_FILESYSTEM_DECL + path system_complete(const path& p, system::error_code* ec=0); + BOOST_FILESYSTEM_DECL + path temp_directory_path(system::error_code* ec=0); + BOOST_FILESYSTEM_DECL + path unique_path(const path& p, system::error_code* ec=0); + } // namespace detail + +//--------------------------------------------------------------------------------------// +// // +// status query functions // +// // +//--------------------------------------------------------------------------------------// + + inline + file_status status(const path& p) {return detail::status(p);} + inline + file_status status(const path& p, system::error_code& ec) + {return detail::status(p, &ec);} + inline + file_status symlink_status(const path& p) {return detail::symlink_status(p);} + inline + file_status symlink_status(const path& p, system::error_code& ec) + {return detail::symlink_status(p, &ec);} + inline + bool exists(const path& p) {return exists(detail::status(p));} + inline + bool exists(const path& p, system::error_code& ec) + {return exists(detail::status(p, &ec));} + inline + bool is_directory(const path& p) {return is_directory(detail::status(p));} + inline + bool is_directory(const path& p, system::error_code& ec) + {return is_directory(detail::status(p, &ec));} + inline + bool is_regular_file(const path& p) {return is_regular_file(detail::status(p));} + inline + bool is_regular_file(const path& p, system::error_code& ec) + {return is_regular_file(detail::status(p, &ec));} + inline + bool is_other(const path& p) {return is_other(detail::status(p));} + inline + bool is_other(const path& p, system::error_code& ec) + {return is_other(detail::status(p, &ec));} + inline + bool is_symlink(const path& p) {return is_symlink(detail::symlink_status(p));} + inline + bool is_symlink(const path& p, system::error_code& ec) + {return is_symlink(detail::symlink_status(p, &ec));} +# ifndef BOOST_FILESYSTEM_NO_DEPRECATED + inline + bool is_regular(const path& p) {return is_regular(detail::status(p));} + inline + bool is_regular(const path& p, system::error_code& ec) + {return is_regular(detail::status(p, &ec));} +# endif + + inline + bool is_empty(const path& p) {return detail::is_empty(p);} + inline + bool is_empty(const path& p, system::error_code& ec) + {return detail::is_empty(p, &ec);} + +//--------------------------------------------------------------------------------------// +// // +// operational functions // +// in alphabetical order, unless otherwise noted // +// // +//--------------------------------------------------------------------------------------// + + // forward declarations + path current_path(); // fwd declaration + path initial_path(); + + BOOST_FILESYSTEM_DECL + path absolute(const path& p, const path& base=current_path()); + // If base.is_absolute(), throws nothing. Thus no need for ec argument + + inline + path canonical(const path& p, const path& base=current_path()) + {return detail::canonical(p, base);} + inline + path canonical(const path& p, system::error_code& ec) + {return detail::canonical(p, current_path(), &ec);} + inline + path canonical(const path& p, const path& base, system::error_code& ec) + {return detail::canonical(p, base, &ec);} + +# ifndef BOOST_FILESYSTEM_NO_DEPRECATED + inline + path complete(const path& p) + { + return absolute(p, initial_path()); + } + + inline + path complete(const path& p, const path& base) + { + return absolute(p, base); + } +# endif + + inline + void copy(const path& from, const path& to) {detail::copy(from, to);} + + inline + void copy(const path& from, const path& to, system::error_code& ec) + {detail::copy(from, to, &ec);} + inline + void copy_directory(const path& from, const path& to) + {detail::copy_directory(from, to);} + inline + void copy_directory(const path& from, const path& to, system::error_code& ec) + {detail::copy_directory(from, to, &ec);} + inline + void copy_file(const path& from, const path& to, // See ticket #2925 + BOOST_SCOPED_ENUM(copy_option) option) + {detail::copy_file(from, to, option);} + inline + void copy_file(const path& from, const path& to) + {detail::copy_file(from, to, copy_option::fail_if_exists);} + inline + void copy_file(const path& from, const path& to, // See ticket #2925 + BOOST_SCOPED_ENUM(copy_option) option, system::error_code& ec) + {detail::copy_file(from, to, option, &ec);} + inline + void copy_file(const path& from, const path& to, system::error_code& ec) + {detail::copy_file(from, to, copy_option::fail_if_exists, &ec);} + inline + void copy_symlink(const path& existing_symlink, const path& new_symlink) {detail::copy_symlink(existing_symlink, new_symlink);} + + inline + void copy_symlink(const path& existing_symlink, const path& new_symlink, system::error_code& ec) + {detail::copy_symlink(existing_symlink, new_symlink, &ec);} + inline + bool create_directories(const path& p) {return detail::create_directories(p);} + + inline + bool create_directories(const path& p, system::error_code& ec) + {return detail::create_directories(p, &ec);} + inline + bool create_directory(const path& p) {return detail::create_directory(p);} + + inline + bool create_directory(const path& p, system::error_code& ec) + {return detail::create_directory(p, &ec);} + inline + void create_directory_symlink(const path& to, const path& from) + {detail::create_directory_symlink(to, from);} + inline + void create_directory_symlink(const path& to, const path& from, system::error_code& ec) + {detail::create_directory_symlink(to, from, &ec);} + inline + void create_hard_link(const path& to, const path& new_hard_link) {detail::create_hard_link(to, new_hard_link);} + + inline + void create_hard_link(const path& to, const path& new_hard_link, system::error_code& ec) + {detail::create_hard_link(to, new_hard_link, &ec);} + inline + void create_symlink(const path& to, const path& new_symlink) {detail::create_symlink(to, new_symlink);} + + inline + void create_symlink(const path& to, const path& new_symlink, system::error_code& ec) + {detail::create_symlink(to, new_symlink, &ec);} + inline + path current_path() {return detail::current_path();} + + inline + path current_path(system::error_code& ec) {return detail::current_path(&ec);} + + inline + void current_path(const path& p) {detail::current_path(p);} + + inline + void current_path(const path& p, system::error_code& ec) {detail::current_path(p, &ec);} + + inline + bool equivalent(const path& p1, const path& p2) {return detail::equivalent(p1, p2);} + + inline + bool equivalent(const path& p1, const path& p2, system::error_code& ec) + {return detail::equivalent(p1, p2, &ec);} + inline + boost::uintmax_t file_size(const path& p) {return detail::file_size(p);} + + inline + boost::uintmax_t file_size(const path& p, system::error_code& ec) + {return detail::file_size(p, &ec);} + inline + boost::uintmax_t hard_link_count(const path& p) {return detail::hard_link_count(p);} + + inline + boost::uintmax_t hard_link_count(const path& p, system::error_code& ec) + {return detail::hard_link_count(p, &ec);} + inline + path initial_path() {return detail::initial_path();} + + inline + path initial_path(system::error_code& ec) {return detail::initial_path(&ec);} + + template <class Path> + path initial_path() {return initial_path();} + template <class Path> + path initial_path(system::error_code& ec) {return detail::initial_path(&ec);} + + inline + std::time_t last_write_time(const path& p) {return detail::last_write_time(p);} + + inline + std::time_t last_write_time(const path& p, system::error_code& ec) + {return detail::last_write_time(p, &ec);} + inline + void last_write_time(const path& p, const std::time_t new_time) + {detail::last_write_time(p, new_time);} + inline + void last_write_time(const path& p, const std::time_t new_time, system::error_code& ec) + {detail::last_write_time(p, new_time, &ec);} + inline + void permissions(const path& p, perms prms) + {detail::permissions(p, prms);} + inline + void permissions(const path& p, perms prms, system::error_code& ec) + {detail::permissions(p, prms, &ec);} + + inline + path read_symlink(const path& p) {return detail::read_symlink(p);} + + inline + path read_symlink(const path& p, system::error_code& ec) + {return detail::read_symlink(p, &ec);} + inline + // For standardization, if the committee doesn't like "remove", consider "eliminate" + bool remove(const path& p) {return detail::remove(p);} + + inline + bool remove(const path& p, system::error_code& ec) {return detail::remove(p, &ec);} + + inline + boost::uintmax_t remove_all(const path& p) {return detail::remove_all(p);} + + inline + boost::uintmax_t remove_all(const path& p, system::error_code& ec) + {return detail::remove_all(p, &ec);} + inline + void rename(const path& old_p, const path& new_p) {detail::rename(old_p, new_p);} + + inline + void rename(const path& old_p, const path& new_p, system::error_code& ec) + {detail::rename(old_p, new_p, &ec);} + inline // name suggested by Scott McMurray + void resize_file(const path& p, uintmax_t size) {detail::resize_file(p, size);} + + inline + void resize_file(const path& p, uintmax_t size, system::error_code& ec) + {detail::resize_file(p, size, &ec);} + inline + space_info space(const path& p) {return detail::space(p);} + + inline + space_info space(const path& p, system::error_code& ec) {return detail::space(p, &ec);} + +# ifndef BOOST_FILESYSTEM_NO_DEPRECATED + inline bool symbolic_link_exists(const path& p) + { return is_symlink(symlink_status(p)); } # endif -# if !defined(BOOST_FILESYSTEM_VERSION) -# define BOOST_FILESYSTEM_VERSION 3 + inline + path system_complete(const path& p) {return detail::system_complete(p);} + + inline + path system_complete(const path& p, system::error_code& ec) + {return detail::system_complete(p, &ec);} + inline + path temp_directory_path() {return detail::temp_directory_path();} + + inline + path temp_directory_path(system::error_code& ec) + {return detail::temp_directory_path(&ec);} + inline + path unique_path(const path& p="%%%%-%%%%-%%%%-%%%%") + { return detail::unique_path(p); } + inline + path unique_path(const path& p, system::error_code& ec) + { return detail::unique_path(p, &ec); } + +//--------------------------------------------------------------------------------------// +// // +// directory_entry // +// // +//--------------------------------------------------------------------------------------// + +// GCC has a problem with a member function named path within a namespace or +// sub-namespace that also has a class named path. The workaround is to always +// fully qualify the name path when it refers to the class name. + +class BOOST_FILESYSTEM_DECL directory_entry +{ +public: + + // compiler generated copy constructor, copy assignment, and destructor apply + + directory_entry() {} + explicit directory_entry(const boost::filesystem::path& p, + file_status st = file_status(), file_status symlink_st=file_status()) + : m_path(p), m_status(st), m_symlink_status(symlink_st) + {} + + void assign(const boost::filesystem::path& p, + file_status st = file_status(), file_status symlink_st = file_status()) + { m_path = p; m_status = st; m_symlink_status = symlink_st; } + + void replace_filename(const boost::filesystem::path& p, + file_status st = file_status(), file_status symlink_st = file_status()) + { + m_path.remove_filename(); + m_path /= p; + m_status = st; + m_symlink_status = symlink_st; + } + +# ifndef BOOST_FILESYSTEM_NO_DEPRECATED + void replace_leaf(const boost::filesystem::path& p, + file_status st, file_status symlink_st) + { replace_filename(p, st, symlink_st); } # endif -#if BOOST_FILESYSTEM_VERSION == 2 -# include <boost/filesystem/v2/operations.hpp> + const boost::filesystem::path& path() const {return m_path;} + file_status status() const {return m_get_status();} + file_status status(system::error_code& ec) const {return m_get_status(&ec);} + file_status symlink_status() const {return m_get_symlink_status();} + file_status symlink_status(system::error_code& ec) const {return m_get_symlink_status(&ec);} + + bool operator==(const directory_entry& rhs) {return m_path == rhs.m_path;} + bool operator!=(const directory_entry& rhs) {return m_path != rhs.m_path;} + bool operator< (const directory_entry& rhs) {return m_path < rhs.m_path;} + bool operator<=(const directory_entry& rhs) {return m_path <= rhs.m_path;} + bool operator> (const directory_entry& rhs) {return m_path > rhs.m_path;} + bool operator>=(const directory_entry& rhs) {return m_path >= rhs.m_path;} + +private: + boost::filesystem::path m_path; + mutable file_status m_status; // stat()-like + mutable file_status m_symlink_status; // lstat()-like + + file_status m_get_status(system::error_code* ec=0) const; + file_status m_get_symlink_status(system::error_code* ec=0) const; +}; // directory_entry + +//--------------------------------------------------------------------------------------// +// // +// directory_iterator helpers // +// // +//--------------------------------------------------------------------------------------// + +class directory_iterator; + +namespace detail +{ + BOOST_FILESYSTEM_DECL + system::error_code dir_itr_close(// never throws() + void *& handle +# if defined(BOOST_POSIX_API) + , void *& buffer +# endif + ); + + struct dir_itr_imp + { + directory_entry dir_entry; + void* handle; + +# ifdef BOOST_POSIX_API + void* buffer; // see dir_itr_increment implementation +# endif + + dir_itr_imp() : handle(0) +# ifdef BOOST_POSIX_API + , buffer(0) +# endif + {} + + ~dir_itr_imp() // never throws + { + dir_itr_close(handle +# if defined(BOOST_POSIX_API) + , buffer +# endif + ); + } + }; + + // see path::iterator: comment below + BOOST_FILESYSTEM_DECL void directory_iterator_construct(directory_iterator& it, + const path& p, system::error_code* ec); + BOOST_FILESYSTEM_DECL void directory_iterator_increment(directory_iterator& it, + system::error_code* ec); + +} // namespace detail + +//--------------------------------------------------------------------------------------// +// // +// directory_iterator // +// // +//--------------------------------------------------------------------------------------// + + class directory_iterator + : public boost::iterator_facade< directory_iterator, + directory_entry, + boost::single_pass_traversal_tag > + { + public: + + directory_iterator(){} // creates the "end" iterator + + // iterator_facade derived classes don't seem to like implementations in + // separate translation unit dll's, so forward to detail functions + explicit directory_iterator(const path& p) + : m_imp(new detail::dir_itr_imp) + { detail::directory_iterator_construct(*this, p, 0); } + + directory_iterator(const path& p, system::error_code& ec) + : m_imp(new detail::dir_itr_imp) + { detail::directory_iterator_construct(*this, p, &ec); } + + ~directory_iterator() {} // never throws + + directory_iterator& increment(system::error_code& ec) + { + detail::directory_iterator_increment(*this, &ec); + return *this; + } + + private: + friend struct detail::dir_itr_imp; + friend BOOST_FILESYSTEM_DECL void detail::directory_iterator_construct(directory_iterator& it, + const path& p, system::error_code* ec); + friend BOOST_FILESYSTEM_DECL void detail::directory_iterator_increment(directory_iterator& it, + system::error_code* ec); + + // shared_ptr provides shallow-copy semantics required for InputIterators. + // m_imp.get()==0 indicates the end iterator. + boost::shared_ptr< detail::dir_itr_imp > m_imp; + + friend class boost::iterator_core_access; + + boost::iterator_facade< + directory_iterator, + directory_entry, + boost::single_pass_traversal_tag >::reference dereference() const + { + BOOST_ASSERT_MSG(m_imp.get(), "attempt to dereference end iterator"); + return m_imp->dir_entry; + } + + void increment() { detail::directory_iterator_increment(*this, 0); } + + bool equal(const directory_iterator& rhs) const + { return m_imp == rhs.m_imp; } + }; + +//--------------------------------------------------------------------------------------// +// // +// recursive_directory_iterator helpers // +// // +//--------------------------------------------------------------------------------------// + + BOOST_SCOPED_ENUM_START(symlink_option) + { + none, + no_recurse = none, // don't follow directory symlinks (default behavior) + recurse, // follow directory symlinks + _detail_no_push = recurse << 1 // internal use only + }; + BOOST_SCOPED_ENUM_END + + BOOST_BITMASK(BOOST_SCOPED_ENUM(symlink_option)) + + namespace detail + { + struct recur_dir_itr_imp + { + typedef directory_iterator element_type; + std::stack< element_type, std::vector< element_type > > m_stack; + int m_level; + BOOST_SCOPED_ENUM(symlink_option) m_options; + + recur_dir_itr_imp() : m_level(0), m_options(symlink_option::none) {} + + void increment(system::error_code* ec); // ec == 0 means throw on error + + void pop(); + + }; + + // Implementation is inline to avoid dynamic linking difficulties with m_stack: + // Microsoft warning C4251, m_stack needs to have dll-interface to be used by + // clients of struct 'boost::filesystem::detail::recur_dir_itr_imp' -# else -# include <boost/filesystem/v3/operations.hpp> + inline + void recur_dir_itr_imp::increment(system::error_code* ec) + // ec == 0 means throw on error + { + if ((m_options & symlink_option::_detail_no_push) == symlink_option::_detail_no_push) + m_options &= ~symlink_option::_detail_no_push; + else + { + // Logic for following predicate was contributed by Daniel Aarno to handle cyclic + // symlinks correctly and efficiently, fixing ticket #5652. + // if (((m_options & symlink_option::recurse) == symlink_option::recurse + // || !is_symlink(m_stack.top()->symlink_status())) + // && is_directory(m_stack.top()->status())) ... + // The predicate code has since been rewritten to pass error_code arguments, + // per ticket #5653. + bool or_pred = (m_options & symlink_option::recurse) == symlink_option::recurse + || (ec == 0 ? !is_symlink(m_stack.top()->symlink_status()) + : !is_symlink(m_stack.top()->symlink_status(*ec))); + if (ec != 0 && *ec) + return; + bool and_pred = or_pred && (ec == 0 ? is_directory(m_stack.top()->status()) + : is_directory(m_stack.top()->status(*ec))); + if (ec != 0 && *ec) + return; + + if (and_pred) + { + if (ec == 0) + m_stack.push(directory_iterator(m_stack.top()->path())); + else + { + m_stack.push(directory_iterator(m_stack.top()->path(), *ec)); + if (*ec) + return; + } + if (m_stack.top() != directory_iterator()) + { + ++m_level; + return; + } + m_stack.pop(); + } + } + + while (!m_stack.empty() && ++m_stack.top() == directory_iterator()) + { + m_stack.pop(); + --m_level; + } + } + + inline + void recur_dir_itr_imp::pop() + { + BOOST_ASSERT_MSG(m_level > 0, + "pop() on recursive_directory_iterator with level < 1"); + + do + { + m_stack.pop(); + --m_level; + } + while (!m_stack.empty() && ++m_stack.top() == directory_iterator()); + } + } // namespace detail + +//--------------------------------------------------------------------------------------// +// // +// recursive_directory_iterator // +// // +//--------------------------------------------------------------------------------------// + + class recursive_directory_iterator + : public boost::iterator_facade< + recursive_directory_iterator, + directory_entry, + boost::single_pass_traversal_tag > + { + public: + + recursive_directory_iterator(){} // creates the "end" iterator + + explicit recursive_directory_iterator(const path& dir_path, + BOOST_SCOPED_ENUM(symlink_option) opt = symlink_option::none) + : m_imp(new detail::recur_dir_itr_imp) + { + m_imp->m_options = opt; + m_imp->m_stack.push(directory_iterator(dir_path)); + if (m_imp->m_stack.top() == directory_iterator()) + { m_imp.reset (); } + } + + recursive_directory_iterator(const path& dir_path, + BOOST_SCOPED_ENUM(symlink_option) opt, + system::error_code & ec) + : m_imp(new detail::recur_dir_itr_imp) + { + m_imp->m_options = opt; + m_imp->m_stack.push(directory_iterator(dir_path, ec)); + if (m_imp->m_stack.top() == directory_iterator()) + { m_imp.reset (); } + } + + recursive_directory_iterator(const path& dir_path, + system::error_code & ec) + : m_imp(new detail::recur_dir_itr_imp) + { + m_imp->m_options = symlink_option::none; + m_imp->m_stack.push(directory_iterator(dir_path, ec)); + if (m_imp->m_stack.top() == directory_iterator()) + { m_imp.reset (); } + } + + recursive_directory_iterator& increment(system::error_code& ec) + { + BOOST_ASSERT_MSG(m_imp.get(), + "increment() on end recursive_directory_iterator"); + m_imp->increment(&ec); + if (m_imp->m_stack.empty()) + m_imp.reset(); // done, so make end iterator + return *this; + } + + int level() const + { + BOOST_ASSERT_MSG(m_imp.get(), + "level() on end recursive_directory_iterator"); + return m_imp->m_level; + } + + bool no_push_pending() const + { + BOOST_ASSERT_MSG(m_imp.get(), + "is_no_push_requested() on end recursive_directory_iterator"); + return (m_imp->m_options & symlink_option::_detail_no_push) + == symlink_option::_detail_no_push; + } + +# ifndef BOOST_FILESYSTEM_NO_DEPRECATED + bool no_push_request() const { return no_push_pending(); } +# endif + + void pop() + { + BOOST_ASSERT_MSG(m_imp.get(), + "pop() on end recursive_directory_iterator"); + m_imp->pop(); + if (m_imp->m_stack.empty()) m_imp.reset(); // done, so make end iterator + } + + void no_push(bool value=true) + { + BOOST_ASSERT_MSG(m_imp.get(), + "no_push() on end recursive_directory_iterator"); + if (value) + m_imp->m_options |= symlink_option::_detail_no_push; + else + m_imp->m_options &= ~symlink_option::_detail_no_push; + } + + file_status status() const + { + BOOST_ASSERT_MSG(m_imp.get(), + "status() on end recursive_directory_iterator"); + return m_imp->m_stack.top()->status(); + } + + file_status symlink_status() const + { + BOOST_ASSERT_MSG(m_imp.get(), + "symlink_status() on end recursive_directory_iterator"); + return m_imp->m_stack.top()->symlink_status(); + } + + private: + + // shared_ptr provides shallow-copy semantics required for InputIterators. + // m_imp.get()==0 indicates the end iterator. + boost::shared_ptr< detail::recur_dir_itr_imp > m_imp; + + friend class boost::iterator_core_access; + + boost::iterator_facade< + recursive_directory_iterator, + directory_entry, + boost::single_pass_traversal_tag >::reference + dereference() const + { + BOOST_ASSERT_MSG(m_imp.get(), + "dereference of end recursive_directory_iterator"); + return *m_imp->m_stack.top(); + } + + void increment() + { + BOOST_ASSERT_MSG(m_imp.get(), + "increment of end recursive_directory_iterator"); + m_imp->increment(0); + if (m_imp->m_stack.empty()) + m_imp.reset(); // done, so make end iterator + } + + bool equal(const recursive_directory_iterator& rhs) const + { return m_imp == rhs.m_imp; } + + }; + +# if !defined(BOOST_FILESYSTEM_NO_DEPRECATED) + typedef recursive_directory_iterator wrecursive_directory_iterator; # endif -#endif // BOOST_FILESYSTEM_OPERATIONSX_HPP +//--------------------------------------------------------------------------------------// +// // +// class filesystem_error // +// // +//--------------------------------------------------------------------------------------// + + class BOOST_SYMBOL_VISIBLE filesystem_error : public system::system_error + { + // see http://www.boost.org/more/error_handling.html for design rationale + + // all functions are inline to avoid issues with crossing dll boundaries + + public: + // compiler generates copy constructor and copy assignment + + filesystem_error( + const std::string & what_arg, system::error_code ec) + : system::system_error(ec, what_arg) + { + try + { + m_imp_ptr.reset(new m_imp); + } + catch (...) { m_imp_ptr.reset(); } + } + + filesystem_error( + const std::string & what_arg, const path& path1_arg, + system::error_code ec) + : system::system_error(ec, what_arg) + { + try + { + m_imp_ptr.reset(new m_imp); + m_imp_ptr->m_path1 = path1_arg; + } + catch (...) { m_imp_ptr.reset(); } + } + + filesystem_error( + const std::string & what_arg, const path& path1_arg, + const path& path2_arg, system::error_code ec) + : system::system_error(ec, what_arg) + { + try + { + m_imp_ptr.reset(new m_imp); + m_imp_ptr->m_path1 = path1_arg; + m_imp_ptr->m_path2 = path2_arg; + } + catch (...) { m_imp_ptr.reset(); } + } + + ~filesystem_error() throw() {} + + const path& path1() const + { + static const path empty_path; + return m_imp_ptr.get() ? m_imp_ptr->m_path1 : empty_path ; + } + const path& path2() const + { + static const path empty_path; + return m_imp_ptr.get() ? m_imp_ptr->m_path2 : empty_path ; + } + + const char* what() const throw() + { + if (!m_imp_ptr.get()) + return system::system_error::what(); + + try + { + if (m_imp_ptr->m_what.empty()) + { + m_imp_ptr->m_what = system::system_error::what(); + if (!m_imp_ptr->m_path1.empty()) + { + m_imp_ptr->m_what += ": \""; + m_imp_ptr->m_what += m_imp_ptr->m_path1.string(); + m_imp_ptr->m_what += "\""; + } + if (!m_imp_ptr->m_path2.empty()) + { + m_imp_ptr->m_what += ", \""; + m_imp_ptr->m_what += m_imp_ptr->m_path2.string(); + m_imp_ptr->m_what += "\""; + } + } + return m_imp_ptr->m_what.c_str(); + } + catch (...) + { + return system::system_error::what(); + } + } + + private: + struct m_imp + { + path m_path1; // may be empty() + path m_path2; // may be empty() + std::string m_what; // not built until needed + }; + boost::shared_ptr<m_imp> m_imp_ptr; + }; + +// test helper -----------------------------------------------------------------------// + +// Not part of the documented interface since false positives are possible; +// there is no law that says that an OS that has large stat.st_size +// actually supports large file sizes. + + namespace detail + { + BOOST_FILESYSTEM_DECL bool possible_large_file_size_support(); + } + + } // namespace filesystem +} // namespace boost + +#include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas +#endif // BOOST_FILESYSTEM3_OPERATIONS_HPP diff --git a/3rdParty/Boost/src/boost/filesystem/path.hpp b/3rdParty/Boost/src/boost/filesystem/path.hpp index 3bed7d2..2dd1b00 100644 --- a/3rdParty/Boost/src/boost/filesystem/path.hpp +++ b/3rdParty/Boost/src/boost/filesystem/path.hpp @@ -1,35 +1,758 @@ -// boost/filesystem/path.hpp ---------------------------------------------------------// +// filesystem path.hpp ---------------------------------------------------------------// -// Copyright Beman Dawes 2010 +// Copyright Beman Dawes 2002-2005, 2009 +// Copyright Vladimir Prus 2002 // Distributed under the Boost Software License, Version 1.0. // See http://www.boost.org/LICENSE_1_0.txt // Library home page: http://www.boost.org/libs/filesystem -//--------------------------------------------------------------------------------------// +// path::stem(), extension(), and replace_extension() are based on +// basename(), extension(), and change_extension() from the original +// filesystem/convenience.hpp header by Vladimir Prus. -#ifndef BOOST_FILESYSTEM_PATHX_HPP -#define BOOST_FILESYSTEM_PATHX_HPP +#ifndef BOOST_FILESYSTEM_PATH_HPP +#define BOOST_FILESYSTEM_PATH_HPP -#include <boost/config.hpp> // for <boost/config/user.hpp>, in case - // BOOST_FILESYSTEM_VERSION defined there +#include <boost/config.hpp> -# if defined(BOOST_FILESYSTEM_VERSION) \ - && BOOST_FILESYSTEM_VERSION != 2 && BOOST_FILESYSTEM_VERSION != 3 -# error BOOST_FILESYSTEM_VERSION defined, but not as 2 or 3 +# if defined( BOOST_NO_STD_WSTRING ) +# error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support # endif -# if !defined(BOOST_FILESYSTEM_VERSION) -# define BOOST_FILESYSTEM_VERSION 3 +#include <boost/filesystem/config.hpp> +#include <boost/filesystem/path_traits.hpp> // includes <cwchar> +#include <boost/system/error_code.hpp> +#include <boost/system/system_error.hpp> +#include <boost/iterator/iterator_facade.hpp> +#include <boost/shared_ptr.hpp> +#include <boost/io/detail/quoted_manip.hpp> +#include <boost/static_assert.hpp> +#include <boost/functional/hash_fwd.hpp> +#include <boost/type_traits/is_integral.hpp> +#include <string> +#include <iterator> +#include <cstring> +#include <iosfwd> +#include <stdexcept> +#include <cassert> +#include <locale> +#include <algorithm> + +#include <boost/config/abi_prefix.hpp> // must be the last #include + +namespace boost +{ +namespace filesystem +{ + //------------------------------------------------------------------------------------// + // // + // class path // + // // + //------------------------------------------------------------------------------------// + + class BOOST_FILESYSTEM_DECL path + { + public: + + // value_type is the character type used by the operating system API to + // represent paths. + +# ifdef BOOST_WINDOWS_API + typedef wchar_t value_type; + BOOST_STATIC_CONSTEXPR value_type preferred_separator = L'\\'; +# else + typedef char value_type; + BOOST_STATIC_CONSTEXPR value_type preferred_separator = '/'; # endif + typedef std::basic_string<value_type> string_type; + typedef std::codecvt<wchar_t, char, + std::mbstate_t> codecvt_type; + + + // ----- character encoding conversions ----- + + // Following the principle of least astonishment, path input arguments + // passed to or obtained from the operating system via objects of + // class path behave as if they were directly passed to or + // obtained from the O/S API, unless conversion is explicitly requested. + // + // POSIX specfies that path strings are passed unchanged to and from the + // API. Note that this is different from the POSIX command line utilities, + // which convert according to a locale. + // + // Thus for POSIX, char strings do not undergo conversion. wchar_t strings + // are converted to/from char using the path locale or, if a conversion + // argument is given, using a conversion object modeled on + // std::wstring_convert. + // + // The path locale, which is global to the thread, can be changed by the + // imbue() function. It is initialized to an implementation defined locale. + // + // For Windows, wchar_t strings do not undergo conversion. char strings + // are converted using the "ANSI" or "OEM" code pages, as determined by + // the AreFileApisANSI() function, or, if a conversion argument is given, + // using a conversion object modeled on std::wstring_convert. + // + // See m_pathname comments for further important rationale. + + // TODO: rules needed for operating systems that use / or . + // differently, or format directory paths differently from file paths. + // + // ********************************************************************************** + // + // More work needed: How to handle an operating system that may have + // slash characters or dot characters in valid filenames, either because + // it doesn't follow the POSIX standard, or because it allows MBCS + // filename encodings that may contain slash or dot characters. For + // example, ISO/IEC 2022 (JIS) encoding which allows switching to + // JIS x0208-1983 encoding. A valid filename in this set of encodings is + // 0x1B 0x24 0x42 [switch to X0208-1983] 0x24 0x2F [U+304F Kiragana letter KU] + // ^^^^ + // Note that 0x2F is the ASCII slash character + // + // ********************************************************************************** + + // Supported source arguments: half-open iterator range, container, c-array, + // and single pointer to null terminated string. + + // All source arguments except pointers to null terminated byte strings support + // multi-byte character strings which may have embedded nulls. Embedded null + // support is required for some Asian languages on Windows. + + // [defaults] "const codecvt_type& cvt=codecvt()" default arguments are not used + // because some compilers, such as Microsoft prior to VC++ 10, do not handle defaults + // correctly in templates. + + // ----- constructors ----- + + path(){} + + path(const path& p) : m_pathname(p.m_pathname) {} + + template <class Source> + path(Source const& source, + typename boost::enable_if<path_traits::is_pathable< + typename boost::decay<Source>::type> >::type* =0) + { + path_traits::dispatch(source, m_pathname, codecvt()); + } + + // Overloads for the operating system API's native character type. Rationale: + // - Avoids use of codecvt() for native value_type strings. This limits the + // impact of locale("") initialization failures on POSIX systems to programs + // that actually depend on locale(""). It further ensures that exceptions thrown + // as a result of such failues occur after main() has started, so can be caught. + // This is a partial resolution of tickets 4688, 5100, and 5289. + // - A slight optimization for a common use case, particularly on POSIX since + // value_type is char and that is the most common useage. + path(const value_type* s) : m_pathname(s) {} + path(const std::basic_string<value_type>& s) : m_pathname(s) {} + + template <class Source> + path(Source const& source, const codecvt_type& cvt) + // see [defaults] note above explaining why codecvt() default arguments are not used + { + path_traits::dispatch(source, m_pathname, cvt); + } + + template <class InputIterator> + path(InputIterator begin, InputIterator end) + { + if (begin != end) + { + std::basic_string<typename std::iterator_traits<InputIterator>::value_type> + s(begin, end); + path_traits::convert(s.c_str(), s.c_str()+s.size(), m_pathname, codecvt()); + } + } + + template <class InputIterator> + path(InputIterator begin, InputIterator end, const codecvt_type& cvt) + { + if (begin != end) + { + std::basic_string<typename std::iterator_traits<InputIterator>::value_type> + s(begin, end); + path_traits::convert(s.c_str(), s.c_str()+s.size(), m_pathname, cvt); + } + } + + // ----- assignments ----- + + path& operator=(const path& p) + { + m_pathname = p.m_pathname; + return *this; + } + + path& operator=(const value_type* ptr) // required in case ptr overlaps *this + { + m_pathname = ptr; + return *this; + } + + template <class Source> + typename boost::enable_if<path_traits::is_pathable< + typename boost::decay<Source>::type>, path&>::type + operator=(Source const& source) + { + m_pathname.clear(); + path_traits::dispatch(source, m_pathname, codecvt()); + return *this; + } + + path& assign(const value_type* ptr, const codecvt_type&) // required in case ptr overlaps *this + { + m_pathname = ptr; + return *this; + } + + template <class Source> + path& assign(Source const& source, const codecvt_type& cvt) + { + m_pathname.clear(); + path_traits::dispatch(source, m_pathname, cvt); + return *this; + } + + template <class InputIterator> + path& assign(InputIterator begin, InputIterator end) + { + return assign(begin, end, codecvt()); + } + + template <class InputIterator> + path& assign(InputIterator begin, InputIterator end, const codecvt_type& cvt) + { + m_pathname.clear(); + if (begin != end) + { + std::basic_string<typename std::iterator_traits<InputIterator>::value_type> + s(begin, end); + path_traits::convert(s.c_str(), s.c_str()+s.size(), m_pathname, cvt); + } + return *this; + } + + // ----- concatenation ----- + + path& operator+=(const path& p) {m_pathname += p.m_pathname; return *this;} + path& operator+=(const string_type& s) {m_pathname += s; return *this;} + path& operator+=(const value_type* ptr) {m_pathname += ptr; return *this;} + path& operator+=(value_type c) {m_pathname += c; return *this;} + + template <class Source> + typename boost::enable_if<path_traits::is_pathable< + typename boost::decay<Source>::type>, path&>::type + operator+=(Source const& source) + { + return concat(source, codecvt()); + } + + template <class CharT> + typename boost::enable_if<is_integral<CharT>, path&>::type + operator+=(CharT c) + { + CharT tmp[2]; + tmp[0] = c; + tmp[1] = 0; + return concat(tmp, codecvt()); + } + + template <class Source> + path& concat(Source const& source, const codecvt_type& cvt) + { + path_traits::dispatch(source, m_pathname, cvt); + return *this; + } + + template <class InputIterator> + path& concat(InputIterator begin, InputIterator end) + { + return concat(begin, end, codecvt()); + } + + template <class InputIterator> + path& concat(InputIterator begin, InputIterator end, const codecvt_type& cvt) + { + if (begin == end) + return *this; + std::basic_string<typename std::iterator_traits<InputIterator>::value_type> + s(begin, end); + path_traits::convert(s.c_str(), s.c_str()+s.size(), m_pathname, cvt); + return *this; + } + + // ----- appends ----- + + // if a separator is added, it is the preferred separator for the platform; + // slash for POSIX, backslash for Windows + + path& operator/=(const path& p); + + path& operator/=(const value_type* ptr); + + template <class Source> + typename boost::enable_if<path_traits::is_pathable< + typename boost::decay<Source>::type>, path&>::type + operator/=(Source const& source) + { + return append(source, codecvt()); + } + + path& append(const value_type* ptr, const codecvt_type&) // required in case ptr overlaps *this + { + this->operator/=(ptr); + return *this; + } + + template <class Source> + path& append(Source const& source, const codecvt_type& cvt); + + template <class InputIterator> + path& append(InputIterator begin, InputIterator end) + { + return append(begin, end, codecvt()); + } + + template <class InputIterator> + path& append(InputIterator begin, InputIterator end, const codecvt_type& cvt); + + // ----- modifiers ----- + + void clear() { m_pathname.clear(); } + path& make_preferred() +# ifdef BOOST_POSIX_API + { return *this; } // POSIX no effect +# else // BOOST_WINDOWS_API + ; // change slashes to backslashes +# endif + path& remove_filename(); + path& replace_extension(const path& new_extension = path()); + void swap(path& rhs) { m_pathname.swap(rhs.m_pathname); } + + // ----- observers ----- + + // For operating systems that format file paths differently than directory + // paths, return values from observers are formatted as file names unless there + // is a trailing separator, in which case returns are formatted as directory + // paths. POSIX and Windows make no such distinction. + + // Implementations are permitted to return const values or const references. + + // The string or path returned by an observer are specified as being formatted + // as "native" or "generic". + // + // For POSIX, these are all the same format; slashes and backslashes are as input and + // are not modified. + // + // For Windows, native: as input; slashes and backslashes are not modified; + // this is the format of the internally stored string. + // generic: backslashes are converted to slashes + + // ----- native format observers ----- + + const string_type& native() const { return m_pathname; } // Throws: nothing + const value_type* c_str() const { return m_pathname.c_str(); } // Throws: nothing + + template <class String> + String string() const; + + template <class String> + String string(const codecvt_type& cvt) const; + +# ifdef BOOST_WINDOWS_API + const std::string string() const { return string(codecvt()); } + const std::string string(const codecvt_type& cvt) const + { + std::string tmp; + if (!m_pathname.empty()) + path_traits::convert(&*m_pathname.begin(), &*m_pathname.begin()+m_pathname.size(), + tmp, cvt); + return tmp; + } + + // string_type is std::wstring, so there is no conversion + const std::wstring& wstring() const { return m_pathname; } + const std::wstring& wstring(const codecvt_type&) const { return m_pathname; } + +# else // BOOST_POSIX_API + // string_type is std::string, so there is no conversion + const std::string& string() const { return m_pathname; } + const std::string& string(const codecvt_type&) const { return m_pathname; } + + const std::wstring wstring() const { return wstring(codecvt()); } + const std::wstring wstring(const codecvt_type& cvt) const + { + std::wstring tmp; + if (!m_pathname.empty()) + path_traits::convert(&*m_pathname.begin(), &*m_pathname.begin()+m_pathname.size(), + tmp, cvt); + return tmp; + } + +# endif + + // ----- generic format observers ----- + + template <class String> + String generic_string() const; + + template <class String> + String generic_string(const codecvt_type& cvt) const; + +# ifdef BOOST_WINDOWS_API + const std::string generic_string() const { return generic_string(codecvt()); } + const std::string generic_string(const codecvt_type& cvt) const; + const std::wstring generic_wstring() const; + const std::wstring generic_wstring(const codecvt_type&) const { return generic_wstring(); }; -#if BOOST_FILESYSTEM_VERSION == 2 -# include <boost/filesystem/v2/path.hpp> +# else // BOOST_POSIX_API + // On POSIX-like systems, the generic format is the same as the native format + const std::string& generic_string() const { return m_pathname; } + const std::string& generic_string(const codecvt_type&) const { return m_pathname; } + const std::wstring generic_wstring() const { return wstring(codecvt()); } + const std::wstring generic_wstring(const codecvt_type& cvt) const { return wstring(cvt); } -# else -# include <boost/filesystem/v3/path.hpp> +# endif + // ----- compare ----- + + int compare(const path& p) const BOOST_NOEXCEPT; // generic, lexicographical + int compare(const std::string& s) const { return compare(path(s)); } + int compare(const value_type* s) const { return compare(path(s)); } + + // ----- decomposition ----- + + path root_path() const; + path root_name() const; // returns 0 or 1 element path + // even on POSIX, root_name() is non-empty() for network paths + path root_directory() const; // returns 0 or 1 element path + path relative_path() const; + path parent_path() const; + path filename() const; // returns 0 or 1 element path + path stem() const; // returns 0 or 1 element path + path extension() const; // returns 0 or 1 element path + + // ----- query ----- + + bool empty() const { return m_pathname.empty(); } // name consistent with std containers + bool has_root_path() const { return has_root_directory() || has_root_name(); } + bool has_root_name() const { return !root_name().empty(); } + bool has_root_directory() const { return !root_directory().empty(); } + bool has_relative_path() const { return !relative_path().empty(); } + bool has_parent_path() const { return !parent_path().empty(); } + bool has_filename() const { return !m_pathname.empty(); } + bool has_stem() const { return !stem().empty(); } + bool has_extension() const { return !extension().empty(); } + bool is_absolute() const + { +# ifdef BOOST_WINDOWS_API + return has_root_name() && has_root_directory(); +# else + return has_root_directory(); +# endif + } + bool is_relative() const { return !is_absolute(); } + + // ----- iterators ----- + + class iterator; + typedef iterator const_iterator; + + iterator begin() const; + iterator end() const; + + // ----- static member functions ----- + + static std::locale imbue(const std::locale& loc); + static const codecvt_type& codecvt(); + + // ----- deprecated functions ----- + +# if defined(BOOST_FILESYSTEM_DEPRECATED) && defined(BOOST_FILESYSTEM_NO_DEPRECATED) +# error both BOOST_FILESYSTEM_DEPRECATED and BOOST_FILESYSTEM_NO_DEPRECATED are defined +# endif + +# if !defined(BOOST_FILESYSTEM_NO_DEPRECATED) + // recently deprecated functions supplied by default + path& normalize() { return m_normalize(); } + path& remove_leaf() { return remove_filename(); } + path leaf() const { return filename(); } + path branch_path() const { return parent_path(); } + bool has_leaf() const { return !m_pathname.empty(); } + bool has_branch_path() const { return !parent_path().empty(); } + bool is_complete() const { return is_absolute(); } +# endif + +# if defined(BOOST_FILESYSTEM_DEPRECATED) + // deprecated functions with enough signature or semantic changes that they are + // not supplied by default + const std::string file_string() const { return string(); } + const std::string directory_string() const { return string(); } + const std::string native_file_string() const { return string(); } + const std::string native_directory_string() const { return string(); } + const string_type external_file_string() const { return native(); } + const string_type external_directory_string() const { return native(); } + + // older functions no longer supported + //typedef bool (*name_check)(const std::string & name); + //basic_path(const string_type& str, name_check) { operator/=(str); } + //basic_path(const typename string_type::value_type* s, name_check) + // { operator/=(s);} + //static bool default_name_check_writable() { return false; } + //static void default_name_check(name_check) {} + //static name_check default_name_check() { return 0; } + //basic_path& canonize(); +# endif + +//--------------------------------------------------------------------------------------// +// class path private members // +//--------------------------------------------------------------------------------------// + + private: +# if defined(_MSC_VER) +# pragma warning(push) // Save warning settings +# pragma warning(disable : 4251) // disable warning: class 'std::basic_string<_Elem,_Traits,_Ax>' +# endif // needs to have dll-interface... +/* + m_pathname has the type, encoding, and format required by the native + operating system. Thus for POSIX and Windows there is no conversion for + passing m_pathname.c_str() to the O/S API or when obtaining a path from the + O/S API. POSIX encoding is unspecified other than for dot and slash + characters; POSIX just treats paths as a sequence of bytes. Windows + encoding is UCS-2 or UTF-16 depending on the version. +*/ + string_type m_pathname; // Windows: as input; backslashes NOT converted to slashes, + // slashes NOT converted to backslashes +# if defined(_MSC_VER) +# pragma warning(pop) // restore warning settings. +# endif + + string_type::size_type m_append_separator_if_needed(); + // Returns: If separator is to be appended, m_pathname.size() before append. Otherwise 0. + // Note: An append is never performed if size()==0, so a returned 0 is unambiguous. + + void m_erase_redundant_separator(string_type::size_type sep_pos); + string_type::size_type m_parent_path_end() const; + + path& m_normalize(); + + // Was qualified; como433beta8 reports: + // warning #427-D: qualified name is not allowed in member declaration + friend class iterator; + friend bool operator<(const path& lhs, const path& rhs); + + // see path::iterator::increment/decrement comment below + static void m_path_iterator_increment(path::iterator & it); + static void m_path_iterator_decrement(path::iterator & it); + + }; // class path + + namespace detail + { + BOOST_FILESYSTEM_DECL + int lex_compare(path::iterator first1, path::iterator last1, + path::iterator first2, path::iterator last2); + } + +# ifndef BOOST_FILESYSTEM_NO_DEPRECATED + typedef path wpath; +# endif + + //------------------------------------------------------------------------------------// + // class path::iterator // + //------------------------------------------------------------------------------------// + + class path::iterator + : public boost::iterator_facade< + path::iterator, + path const, + boost::bidirectional_traversal_tag > + { + private: + friend class boost::iterator_core_access; + friend class boost::filesystem::path; + friend void m_path_iterator_increment(path::iterator & it); + friend void m_path_iterator_decrement(path::iterator & it); + + const path& dereference() const { return m_element; } + + bool equal(const iterator & rhs) const + { + return m_path_ptr == rhs.m_path_ptr && m_pos == rhs.m_pos; + } + + // iterator_facade derived classes don't seem to like implementations in + // separate translation unit dll's, so forward to class path static members + void increment() { m_path_iterator_increment(*this); } + void decrement() { m_path_iterator_decrement(*this); } + + path m_element; // current element + const path* m_path_ptr; // path being iterated over + string_type::size_type m_pos; // position of m_element in + // m_path_ptr->m_pathname. + // if m_element is implicit dot, m_pos is the + // position of the last separator in the path. + // end() iterator is indicated by + // m_pos == m_path_ptr->m_pathname.size() + }; // path::iterator + + //------------------------------------------------------------------------------------// + // // + // non-member functions // + // // + //------------------------------------------------------------------------------------// + + // std::lexicographical_compare would infinately recurse because path iterators + // yield paths, so provide a path aware version + inline bool lexicographical_compare(path::iterator first1, path::iterator last1, + path::iterator first2, path::iterator last2) + { return detail::lex_compare(first1, last1, first2, last2) < 0; } + + inline bool operator==(const path& lhs, const path& rhs) {return lhs.compare(rhs) == 0;} + inline bool operator==(const path& lhs, const path::string_type& rhs) {return lhs.compare(rhs) == 0;} + inline bool operator==(const path::string_type& lhs, const path& rhs) {return rhs.compare(lhs) == 0;} + inline bool operator==(const path& lhs, const path::value_type* rhs) {return lhs.compare(rhs) == 0;} + inline bool operator==(const path::value_type* lhs, const path& rhs) {return rhs.compare(lhs) == 0;} + + inline bool operator!=(const path& lhs, const path& rhs) {return lhs.compare(rhs) != 0;} + inline bool operator!=(const path& lhs, const path::string_type& rhs) {return lhs.compare(rhs) != 0;} + inline bool operator!=(const path::string_type& lhs, const path& rhs) {return rhs.compare(lhs) != 0;} + inline bool operator!=(const path& lhs, const path::value_type* rhs) {return lhs.compare(rhs) != 0;} + inline bool operator!=(const path::value_type* lhs, const path& rhs) {return rhs.compare(lhs) != 0;} + + // TODO: why do == and != have additional overloads, but the others don't? + + inline bool operator<(const path& lhs, const path& rhs) {return lhs.compare(rhs) < 0;} + inline bool operator<=(const path& lhs, const path& rhs) {return !(rhs < lhs);} + inline bool operator> (const path& lhs, const path& rhs) {return rhs < lhs;} + inline bool operator>=(const path& lhs, const path& rhs) {return !(lhs < rhs);} + + inline std::size_t hash_value(const path& x) + { +# ifdef BOOST_WINDOWS_API + std::size_t seed = 0; + for(const path::value_type* it = x.c_str(); *it; ++it) + hash_combine(seed, *it == '/' ? L'\\' : *it); + return seed; +# else // BOOST_POSIX_API + return hash_range(x.native().begin(), x.native().end()); # endif + } + + inline void swap(path& lhs, path& rhs) { lhs.swap(rhs); } + + inline path operator/(const path& lhs, const path& rhs) { return path(lhs) /= rhs; } + + // inserters and extractors + // use boost::io::quoted() to handle spaces in paths + // use '&' as escape character to ease use for Windows paths + + template <class Char, class Traits> + inline std::basic_ostream<Char, Traits>& + operator<<(std::basic_ostream<Char, Traits>& os, const path& p) + { + return os + << boost::io::quoted(p.template string<std::basic_string<Char> >(), static_cast<Char>('&')); + } + + template <class Char, class Traits> + inline std::basic_istream<Char, Traits>& + operator>>(std::basic_istream<Char, Traits>& is, path& p) + { + std::basic_string<Char> str; + is >> boost::io::quoted(str, static_cast<Char>('&')); + p = str; + return is; + } + + // name_checks + + // These functions are holdovers from version 1. It isn't clear they have much + // usefulness, or how to generalize them for later versions. + + BOOST_FILESYSTEM_DECL bool portable_posix_name(const std::string & name); + BOOST_FILESYSTEM_DECL bool windows_name(const std::string & name); + BOOST_FILESYSTEM_DECL bool portable_name(const std::string & name); + BOOST_FILESYSTEM_DECL bool portable_directory_name(const std::string & name); + BOOST_FILESYSTEM_DECL bool portable_file_name(const std::string & name); + BOOST_FILESYSTEM_DECL bool native(const std::string & name); + +//--------------------------------------------------------------------------------------// +// class path member template implementation // +//--------------------------------------------------------------------------------------// + + template <class InputIterator> + path& path::append(InputIterator begin, InputIterator end, const codecvt_type& cvt) + { + if (begin == end) + return *this; + string_type::size_type sep_pos(m_append_separator_if_needed()); + std::basic_string<typename std::iterator_traits<InputIterator>::value_type> + s(begin, end); + path_traits::convert(s.c_str(), s.c_str()+s.size(), m_pathname, cvt); + if (sep_pos) + m_erase_redundant_separator(sep_pos); + return *this; + } + + template <class Source> + path& path::append(Source const& source, const codecvt_type& cvt) + { + if (path_traits::empty(source)) + return *this; + string_type::size_type sep_pos(m_append_separator_if_needed()); + path_traits::dispatch(source, m_pathname, cvt); + if (sep_pos) + m_erase_redundant_separator(sep_pos); + return *this; + } + +//--------------------------------------------------------------------------------------// +// class path member template specializations // +//--------------------------------------------------------------------------------------// + + template <> inline + std::string path::string<std::string>() const + { return string(); } + + template <> inline + std::wstring path::string<std::wstring>() const + { return wstring(); } + + template <> inline + std::string path::string<std::string>(const codecvt_type& cvt) const + { return string(cvt); } + + template <> inline + std::wstring path::string<std::wstring>(const codecvt_type& cvt) const + { return wstring(cvt); } + + template <> inline + std::string path::generic_string<std::string>() const + { return generic_string(); } + + template <> inline + std::wstring path::generic_string<std::wstring>() const + { return generic_wstring(); } + + template <> inline + std::string path::generic_string<std::string>(const codecvt_type& cvt) const + { return generic_string(cvt); } + + template <> inline + std::wstring path::generic_string<std::wstring>(const codecvt_type& cvt) const + { return generic_wstring(cvt); } + + +} // namespace filesystem +} // namespace boost + +//----------------------------------------------------------------------------// + +#include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas -#endif // BOOST_FILESYSTEM_PATHX_HPP +#endif // BOOST_FILESYSTEM_PATH_HPP diff --git a/3rdParty/Boost/src/boost/filesystem/path_traits.hpp b/3rdParty/Boost/src/boost/filesystem/path_traits.hpp new file mode 100644 index 0000000..a6a2505 --- /dev/null +++ b/3rdParty/Boost/src/boost/filesystem/path_traits.hpp @@ -0,0 +1,235 @@ +// filesystem path_traits.hpp --------------------------------------------------------// + +// Copyright Beman Dawes 2009 + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +// Library home page: http://www.boost.org/libs/filesystem + +#ifndef BOOST_FILESYSTEM_PATH_TRAITS_HPP +#define BOOST_FILESYSTEM_PATH_TRAITS_HPP + +#include <boost/config.hpp> + +# if defined( BOOST_NO_STD_WSTRING ) +# error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support +# endif + +#include <boost/filesystem/config.hpp> +#include <boost/utility/enable_if.hpp> +#include <boost/type_traits/is_array.hpp> +#include <boost/type_traits/decay.hpp> +#include <boost/system/error_code.hpp> +#include <cwchar> // for mbstate_t +#include <string> +#include <vector> +#include <list> +#include <iterator> +#include <locale> +#include <boost/assert.hpp> +// #include <iostream> //**** comment me out **** + +#include <boost/config/abi_prefix.hpp> // must be the last #include + +namespace boost { namespace filesystem { + + BOOST_FILESYSTEM_DECL const system::error_category& codecvt_error_category(); + // uses std::codecvt_base::result used for error codes: + // + // ok: Conversion successful. + // partial: Not all source characters converted; one or more additional source + // characters are needed to produce the final target character, or the + // size of the target intermediate buffer was too small to hold the result. + // error: A character in the source could not be converted to the target encoding. + // noconv: The source and target characters have the same type and encoding, so no + // conversion was necessary. + + class directory_entry; + +namespace path_traits { + + typedef std::codecvt<wchar_t, char, std::mbstate_t> codecvt_type; + + // is_pathable type trait; allows disabling over-agressive class path member templates + + template <class T> + struct is_pathable { static const bool value = false; }; + + template<> struct is_pathable<char*> { static const bool value = true; }; + template<> struct is_pathable<const char*> { static const bool value = true; }; + template<> struct is_pathable<wchar_t*> { static const bool value = true; }; + template<> struct is_pathable<const wchar_t*> { static const bool value = true; }; + template<> struct is_pathable<std::string> { static const bool value = true; }; + template<> struct is_pathable<std::wstring> { static const bool value = true; }; + template<> struct is_pathable<std::vector<char> > { static const bool value = true; }; + template<> struct is_pathable<std::vector<wchar_t> > { static const bool value = true; }; + template<> struct is_pathable<std::list<char> > { static const bool value = true; }; + template<> struct is_pathable<std::list<wchar_t> > { static const bool value = true; }; + template<> struct is_pathable<directory_entry> { static const bool value = true; }; + + // Pathable empty + + template <class Container> inline + // disable_if aids broken compilers (IBM, old GCC, etc.) and is harmless for + // conforming compilers. Replace by plain "bool" at some future date (2012?) + typename boost::disable_if<boost::is_array<Container>, bool>::type + empty(const Container & c) + { return c.begin() == c.end(); } + + template <class T> inline + bool empty(T * const & c_str) + { + BOOST_ASSERT(c_str); + return !*c_str; + } + + template <typename T, size_t N> inline + bool empty(T (&x)[N]) + { return !x[0]; } + + // value types differ ---------------------------------------------------------------// + // + // A from_end argument of 0 is less efficient than a known end, so use only if needed + + BOOST_FILESYSTEM_DECL + void convert(const char* from, + const char* from_end, // 0 for null terminated MBCS + std::wstring & to, + const codecvt_type& cvt); + + BOOST_FILESYSTEM_DECL + void convert(const wchar_t* from, + const wchar_t* from_end, // 0 for null terminated MBCS + std::string & to, + const codecvt_type& cvt); + + inline + void convert(const char* from, + std::wstring & to, + const codecvt_type& cvt) + { + BOOST_ASSERT(from); + convert(from, 0, to, cvt); + } + + inline + void convert(const wchar_t* from, + std::string & to, + const codecvt_type& cvt) + { + BOOST_ASSERT(from); + convert(from, 0, to, cvt); + } + + // value types same -----------------------------------------------------------------// + + // char + + inline + void convert(const char* from, const char* from_end, std::string & to, + const codecvt_type&) + { + BOOST_ASSERT(from); + BOOST_ASSERT(from_end); + to.append(from, from_end); + } + + inline + void convert(const char* from, + std::string & to, + const codecvt_type&) + { + BOOST_ASSERT(from); + to += from; + } + + // wchar_t + + inline + void convert(const wchar_t* from, const wchar_t* from_end, std::wstring & to, + const codecvt_type&) + { + BOOST_ASSERT(from); + BOOST_ASSERT(from_end); + to.append(from, from_end); + } + + inline + void convert(const wchar_t* from, + std::wstring & to, + const codecvt_type&) + { + BOOST_ASSERT(from); + to += from; + } + + // Source dispatch -----------------------------------------------------------------// + + // contiguous containers + template <class U> inline + void dispatch(const std::string& c, U& to, const codecvt_type& cvt) + { + if (c.size()) + convert(&*c.begin(), &*c.begin() + c.size(), to, cvt); + } + template <class U> inline + void dispatch(const std::wstring& c, U& to, const codecvt_type& cvt) + { + if (c.size()) + convert(&*c.begin(), &*c.begin() + c.size(), to, cvt); + } + template <class U> inline + void dispatch(const std::vector<char>& c, U& to, const codecvt_type& cvt) + { + if (c.size()) + convert(&*c.begin(), &*c.begin() + c.size(), to, cvt); + } + template <class U> inline + void dispatch(const std::vector<wchar_t>& c, U& to, const codecvt_type& cvt) + { + if (c.size()) + convert(&*c.begin(), &*c.begin() + c.size(), to, cvt); + } + + // non-contiguous containers + template <class Container, class U> inline + // disable_if aids broken compilers (IBM, old GCC, etc.) and is harmless for + // conforming compilers. Replace by plain "void" at some future date (2012?) + typename boost::disable_if<boost::is_array<Container>, void>::type + dispatch(const Container & c, U& to, const codecvt_type& cvt) + { + if (c.size()) + { + std::basic_string<typename Container::value_type> s(c.begin(), c.end()); + convert(s.c_str(), s.c_str()+s.size(), to, cvt); + } + } + + // c_str + template <class T, class U> inline + void dispatch(T * const & c_str, U& to, const codecvt_type& cvt) + { +// std::cout << "dispatch() const T *\n"; + BOOST_ASSERT(c_str); + convert(c_str, to, cvt); + } + + // Note: there is no dispatch on C-style arrays because the array may + // contain a string smaller than the array size. + + BOOST_FILESYSTEM_DECL + void dispatch(const directory_entry & de, +# ifdef BOOST_WINDOWS_API + std::wstring & to, +# else + std::string & to, +# endif + const codecvt_type&); + + +}}} // namespace boost::filesystem::path_traits + +#include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas + +#endif // BOOST_FILESYSTEM_PATH_TRAITS_HPP diff --git a/3rdParty/Boost/src/boost/filesystem/v2/config.hpp b/3rdParty/Boost/src/boost/filesystem/v2/config.hpp deleted file mode 100644 index 7116de5..0000000 --- a/3rdParty/Boost/src/boost/filesystem/v2/config.hpp +++ /dev/null @@ -1,106 +0,0 @@ -// boost/filesystem/v2/config.hpp ------------------------------------------// - -// Copyright Beman Dawes 2003 - -// 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) - -// See library home page at http://www.boost.org/libs/filesystem - -//----------------------------------------------------------------------------// - -#ifndef BOOST_FILESYSTEM2_CONFIG_HPP -#define BOOST_FILESYSTEM2_CONFIG_HPP - -# if defined(BOOST_FILESYSTEM_VERSION) && BOOST_FILESYSTEM_VERSION != 2 -# error Compiling Filesystem version 2 file with BOOST_FILESYSTEM_VERSION defined != 2 -# endif - -# if !defined(BOOST_FILESYSTEM_VERSION) -# define BOOST_FILESYSTEM_VERSION 2 -# endif - -#define BOOST_FILESYSTEM_I18N // aid users wishing to compile several versions - -// ability to change namespace aids path_table.cpp ------------------------// -#ifndef BOOST_FILESYSTEM2_NAMESPACE -# define BOOST_FILESYSTEM2_NAMESPACE filesystem2 -#endif - -#include <boost/config.hpp> -#include <boost/system/api_config.hpp> // for BOOST_POSIX_API or BOOST_WINDOWS_API -#include <boost/detail/workaround.hpp> - -// BOOST_POSIX_PATH or BOOST_WINDOWS_PATH specify which path syntax to recognise - -# if defined(BOOST_WINDOWS_API) && defined(BOOST_POSIX_PATH) -# error builds with Windows API do not support BOOST_POSIX_PATH -# endif - -# if !defined(_WIN32) && !defined(__CYGWIN__) && defined(BOOST_WINDOWS_PATH) -# error builds on non-Windows platforms do not support BOOST_WINDOWS_PATH -# endif - -# if defined(BOOST_WINDOWS_PATH) && defined(BOOST_POSIX_PATH) -# error both BOOST_WINDOWS_PATH and BOOST_POSIX_PATH are defined -# elif !defined(BOOST_WINDOWS_PATH) && !defined(BOOST_POSIX_PATH) -# if !defined(BOOST_POSIX_PATH) && (defined(_WIN32) || defined(__CYGWIN__)) -# define BOOST_WINDOWS_PATH -# else -# define BOOST_POSIX_PATH -# endif -# endif - -// throw an exception ----------------------------------------------------------------// -// -// Exceptions were originally thrown via boost::throw_exception(). -// As throw_exception() became more complex, it caused user error reporting -// to be harder to interpret, since the exception reported became much more complex. -// The immediate fix was to throw directly, wrapped in a macro to make any later change -// easier. - -#define BOOST_FILESYSTEM_THROW(EX) throw EX - -// narrow support only for badly broken compilers or libraries -------------// - -# if defined(BOOST_NO_STD_WSTRING) || defined(BOOST_NO_SFINAE) || defined(BOOST_NO_STD_LOCALE) || BOOST_WORKAROUND(__BORLANDC__, <0x610) -# define BOOST_FILESYSTEM2_NARROW_ONLY -# endif - -// This header implements separate compilation features as described in -// http://www.boost.org/more/separate_compilation.html - -// enable dynamic linking ---------------------------------------------------// - -#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_FILESYSTEM_DYN_LINK) -# if defined(BOOST_FILESYSTEM_SOURCE) -# define BOOST_FILESYSTEM_DECL BOOST_SYMBOL_EXPORT -# else -# define BOOST_FILESYSTEM_DECL BOOST_SYMBOL_IMPORT -# endif -#else -# define BOOST_FILESYSTEM_DECL -#endif - -// enable automatic library variant selection ------------------------------// - -#if !defined(BOOST_FILESYSTEM_SOURCE) && !defined(BOOST_ALL_NO_LIB) \ - && !defined(BOOST_FILESYSTEM_NO_LIB) -// -// Set the name of our library, this will get undef'ed by auto_link.hpp -// once it's done with it: -// -#define BOOST_LIB_NAME boost_filesystem -// -// If we're importing code from a dll, then tell auto_link.hpp about it: -// -#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_FILESYSTEM_DYN_LINK) -# define BOOST_DYN_LINK -#endif -// -// And include the header that does the work: -// -#include <boost/config/auto_link.hpp> -#endif // auto-linking disabled - -#endif // BOOST_FILESYSTEM2_CONFIG_HPP diff --git a/3rdParty/Boost/src/boost/filesystem/v2/convenience.hpp b/3rdParty/Boost/src/boost/filesystem/v2/convenience.hpp deleted file mode 100644 index 30b6ade..0000000 --- a/3rdParty/Boost/src/boost/filesystem/v2/convenience.hpp +++ /dev/null @@ -1,339 +0,0 @@ -// boost/filesystem/convenience.hpp ----------------------------------------// - -// Copyright Beman Dawes, 2002-2005 -// Copyright Vladimir Prus, 2002 -// 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 library home page at http://www.boost.org/libs/filesystem - -//----------------------------------------------------------------------------// - -#ifndef BOOST_FILESYSTEM2_CONVENIENCE_HPP -#define BOOST_FILESYSTEM2_CONVENIENCE_HPP - -#include <boost/filesystem/v2/config.hpp> -#include <boost/filesystem/v2/operations.hpp> -#include <boost/system/error_code.hpp> -#include <vector> -#include <stack> - -#include <boost/config/abi_prefix.hpp> // must be the last #include - -# ifndef BOOST_FILESYSTEM2_NARROW_ONLY -# define BOOST_FS_FUNC(BOOST_FS_TYPE) \ - template<class Path> typename boost::enable_if<is_basic_path<Path>, \ - BOOST_FS_TYPE>::type -# define BOOST_FS_FUNC_STRING BOOST_FS_FUNC(typename Path::string_type) -# define BOOST_FS_TYPENAME typename -# else -# define BOOST_FS_FUNC(BOOST_FS_TYPE) inline BOOST_FS_TYPE - typedef boost::filesystem::path Path; -# define BOOST_FS_FUNC_STRING inline std::string -# define BOOST_FS_TYPENAME -# endif - -namespace boost -{ - namespace filesystem2 - { - - BOOST_FS_FUNC(bool) create_directories(const Path& ph) - { - if (ph.empty() || exists(ph)) - { - if ( !ph.empty() && !is_directory(ph) ) - boost::throw_exception( basic_filesystem_error<Path>( - "boost::filesystem::create_directories", ph, - make_error_code( boost::system::errc::file_exists ) ) ); - return false; - } - - // First create branch, by calling ourself recursively - create_directories(ph.parent_path()); - // Now that parent's path exists, create the directory - create_directory(ph); - return true; - } - -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED - - BOOST_FS_FUNC_STRING extension(const Path& ph) - { - typedef BOOST_FS_TYPENAME Path::string_type string_type; - string_type filename = ph.filename(); - - BOOST_FS_TYPENAME string_type::size_type n = filename.rfind('.'); - if (n != string_type::npos) - return filename.substr(n); - else - return string_type(); - } - - BOOST_FS_FUNC_STRING basename(const Path& ph) - { - typedef BOOST_FS_TYPENAME Path::string_type string_type; - string_type filename = ph.filename(); - BOOST_FS_TYPENAME string_type::size_type n = filename.rfind('.'); - return filename.substr(0, n); - } - - - BOOST_FS_FUNC(Path) change_extension( const Path & ph, - const BOOST_FS_TYPENAME Path::string_type & new_extension ) - { -# if !defined(_STLPORT_VERSION) - return ph.parent_path() / (basename(ph) + new_extension); -# else - typedef BOOST_FS_TYPENAME Path::string_type string_type; - string_type filename = basename(ph) + new_extension; - return ph.parent_path() / filename; -# endif - } -# endif - -# ifndef BOOST_FILESYSTEM2_NARROW_ONLY - - // "do-the-right-thing" overloads ---------------------------------------// - - inline bool create_directories(const path& ph) - { return create_directories<path>(ph); } - inline bool create_directories(const wpath& ph) - { return create_directories<wpath>(ph); } - -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED - inline std::string extension(const path& ph) - { return extension<path>(ph); } - inline std::wstring extension(const wpath& ph) - { return extension<wpath>(ph); } - - inline std::string basename(const path& ph) - { return basename<path>( ph ); } - inline std::wstring basename(const wpath& ph) - { return basename<wpath>( ph ); } - - inline path change_extension( const path & ph, const std::string& new_ex ) - { return change_extension<path>( ph, new_ex ); } - inline wpath change_extension( const wpath & ph, const std::wstring& new_ex ) - { return change_extension<wpath>( ph, new_ex ); } -# endif - -# endif - - - // basic_recursive_directory_iterator helpers --------------------------// - - namespace detail - { - template< class Path > - struct recur_dir_itr_imp - { - typedef basic_directory_iterator< Path > element_type; - std::stack< element_type, std::vector< element_type > > m_stack; - int m_level; - bool m_no_push; - bool m_no_throw; - - recur_dir_itr_imp() : m_level(0), m_no_push(false), m_no_throw(false) {} - }; - - } // namespace detail - - // basic_recursive_directory_iterator ----------------------------------// - - template< class Path > - class basic_recursive_directory_iterator - : public boost::iterator_facade< - basic_recursive_directory_iterator<Path>, - basic_directory_entry<Path>, - boost::single_pass_traversal_tag > - { - public: - typedef Path path_type; - - basic_recursive_directory_iterator(){} // creates the "end" iterator - - explicit basic_recursive_directory_iterator( const Path & dir_path ); - basic_recursive_directory_iterator( const Path & dir_path, - system::error_code & ec ); - - int level() const { return m_imp->m_level; } - - void pop(); - void no_push() - { - BOOST_ASSERT( m_imp.get() && "attempt to no_push() on end iterator" ); - m_imp->m_no_push = true; - } - - file_status status() const - { - BOOST_ASSERT( m_imp.get() - && "attempt to call status() on end recursive_iterator" ); - return m_imp->m_stack.top()->status(); - } - - file_status symlink_status() const - { - BOOST_ASSERT( m_imp.get() - && "attempt to call symlink_status() on end recursive_iterator" ); - return m_imp->m_stack.top()->symlink_status(); - } - - private: - - // shared_ptr provides shallow-copy semantics required for InputIterators. - // m_imp.get()==0 indicates the end iterator. - boost::shared_ptr< detail::recur_dir_itr_imp< Path > > m_imp; - - friend class boost::iterator_core_access; - - typename boost::iterator_facade< - basic_recursive_directory_iterator<Path>, - basic_directory_entry<Path>, - boost::single_pass_traversal_tag >::reference - dereference() const - { - BOOST_ASSERT( m_imp.get() && "attempt to dereference end iterator" ); - return *m_imp->m_stack.top(); - } - - void increment(); - - bool equal( const basic_recursive_directory_iterator & rhs ) const - { return m_imp == rhs.m_imp; } - - }; - - typedef basic_recursive_directory_iterator<path> recursive_directory_iterator; -# ifndef BOOST_FILESYSTEM2_NARROW_ONLY - typedef basic_recursive_directory_iterator<wpath> wrecursive_directory_iterator; -# endif - - // basic_recursive_directory_iterator implementation -------------------// - - // constructors - template<class Path> - basic_recursive_directory_iterator<Path>:: - basic_recursive_directory_iterator( const Path & dir_path ) - : m_imp( new detail::recur_dir_itr_imp<Path> ) - { - m_imp->m_stack.push( basic_directory_iterator<Path>( dir_path ) ); - if ( m_imp->m_stack.top () == basic_directory_iterator<Path>() ) - { m_imp.reset (); } - } - - template<class Path> - basic_recursive_directory_iterator<Path>:: - basic_recursive_directory_iterator( const Path & dir_path, - system::error_code & ec ) - : m_imp( new detail::recur_dir_itr_imp<Path> ) - { - m_imp->m_no_throw = true; - m_imp->m_stack.push( basic_directory_iterator<Path>( dir_path, ec ) ); - if ( m_imp->m_stack.top () == basic_directory_iterator<Path>() ) - { m_imp.reset (); } - } - - // increment - template<class Path> - void basic_recursive_directory_iterator<Path>::increment() - { - BOOST_ASSERT( m_imp.get() && "increment on end iterator" ); - - static const basic_directory_iterator<Path> end_itr; - - if ( m_imp->m_no_push ) - { m_imp->m_no_push = false; } - else if ( is_directory( m_imp->m_stack.top()->status() ) ) - { - system::error_code ec; -#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x610)) - if( m_imp->m_no_throw ) { - m_imp->m_stack.push( - basic_directory_iterator<Path>( *m_imp->m_stack.top(), ec ) - ); - } - else { - m_imp->m_stack.push( - basic_directory_iterator<Path>( *m_imp->m_stack.top() ) - ); - } -#else - m_imp->m_stack.push( - m_imp->m_no_throw - ? basic_directory_iterator<Path>( *m_imp->m_stack.top(), ec ) - : basic_directory_iterator<Path>( *m_imp->m_stack.top() ) ); -#endif - if ( m_imp->m_stack.top() != end_itr ) - { - ++m_imp->m_level; - return; - } - m_imp->m_stack.pop(); - } - - while ( !m_imp->m_stack.empty() - && ++m_imp->m_stack.top() == end_itr ) - { - m_imp->m_stack.pop(); - --m_imp->m_level; - } - - if ( m_imp->m_stack.empty() ) m_imp.reset(); // done, so make end iterator - } - - // pop - template<class Path> - void basic_recursive_directory_iterator<Path>::pop() - { - BOOST_ASSERT( m_imp.get() && "pop on end iterator" ); - BOOST_ASSERT( m_imp->m_level > 0 && "pop with level < 1" ); - - static const basic_directory_iterator<Path> end_itr; - - do - { - m_imp->m_stack.pop(); - --m_imp->m_level; - } - while ( !m_imp->m_stack.empty() - && ++m_imp->m_stack.top() == end_itr ); - - if ( m_imp->m_stack.empty() ) m_imp.reset(); // done, so make end iterator - } - - } // namespace filesystem2 -} // namespace boost - -#undef BOOST_FS_FUNC_STRING -#undef BOOST_FS_FUNC - -//----------------------------------------------------------------------------// - -namespace boost -{ - namespace filesystem - { - using filesystem2::create_directories; - using filesystem2::basic_recursive_directory_iterator; - using filesystem2::recursive_directory_iterator; - -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED - using filesystem2::extension; - using filesystem2::basename; - using filesystem2::change_extension; -# endif - -# ifndef BOOST_FILESYSTEM2_NARROW_ONLY - using filesystem2::wrecursive_directory_iterator; -# endif - - } -} - -//----------------------------------------------------------------------------// - -#include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas -#endif // BOOST_FILESYSTEM2_CONVENIENCE_HPP diff --git a/3rdParty/Boost/src/boost/filesystem/v2/exception.hpp b/3rdParty/Boost/src/boost/filesystem/v2/exception.hpp deleted file mode 100644 index edea663..0000000 --- a/3rdParty/Boost/src/boost/filesystem/v2/exception.hpp +++ /dev/null @@ -1,9 +0,0 @@ -// boost/filesystem/exception.hpp -------------------------------------------// - -// Copyright Beman Dawes 2003 -// 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 header is no long used. The contents have been moved to path.hpp. -// It is provided so that user code #includes do not have to be changed. diff --git a/3rdParty/Boost/src/boost/filesystem/v2/fstream.hpp b/3rdParty/Boost/src/boost/filesystem/v2/fstream.hpp deleted file mode 100644 index 887d59d..0000000 --- a/3rdParty/Boost/src/boost/filesystem/v2/fstream.hpp +++ /dev/null @@ -1,613 +0,0 @@ -// boost/filesystem/fstream.hpp --------------------------------------------// - -// Copyright Beman Dawes 2002. -// 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 library home page at http://www.boost.org/libs/filesystem - -//----------------------------------------------------------------------------// - -#ifndef BOOST_FILESYSTEM2_FSTREAM_HPP -#define BOOST_FILESYSTEM2_FSTREAM_HPP - -#include <boost/filesystem/v2/config.hpp> -#include <boost/filesystem/v2/operations.hpp> // for 8.3 hack (see below) -#include <boost/utility/enable_if.hpp> -#include <boost/detail/workaround.hpp> - -#include <iosfwd> -#include <fstream> - -#include <boost/config/abi_prefix.hpp> // must be the last #include - -// NOTE: fstream.hpp for Boost 1.32.0 and earlier supplied workarounds for -// various compiler problems. They have been removed to ease development of the -// basic i18n functionality. Once the new interface is stable, the workarounds -// will be reinstated for any compilers that otherwise can support the rest of -// the library after internationalization. - -namespace boost -{ - namespace filesystem2 - { - namespace detail - { -# if defined(BOOST_WINDOWS_API) && !defined(BOOST_FILESYSTEM2_NARROW_ONLY) -# if !defined(BOOST_DINKUMWARE_STDLIB) || BOOST_DINKUMWARE_STDLIB < 405 - // The 8.3 hack: - // C++98 does not supply a wchar_t open, so try to get an equivalent - // narrow char name based on the short, so-called 8.3, name. - // Not needed for Dinkumware 405 and later as they do supply wchar_t open. - BOOST_FILESYSTEM_DECL bool create_file_api( const std::wstring & ph, - std::ios_base::openmode mode ); // true if succeeds - BOOST_FILESYSTEM_DECL std::string narrow_path_api( - const std::wstring & ph ); // return is empty if fails - - inline std::string path_proxy( const std::wstring & file_ph, - std::ios_base::openmode mode ) - // Return a non-existant path if cannot supply narrow short path. - // An empty path doesn't work because some Dinkumware versions - // assert the path is non-empty. - { - std::string narrow_ph; - bool created_file( false ); - if ( !exists( file_ph ) - && (mode & std::ios_base::out) != 0 - && create_file_api( file_ph, mode ) ) - { - created_file = true; - } - narrow_ph = narrow_path_api( file_ph ); - if ( narrow_ph.empty() ) - { - if ( created_file ) remove_api( file_ph ); - narrow_ph = "\x01"; - } - return narrow_ph; - } -# else - // Dinkumware 405 and later does supply wchar_t functions - inline const std::wstring & path_proxy( const std::wstring & file_ph, - std::ios_base::openmode ) - { return file_ph; } -# endif -# endif - - inline const std::string & path_proxy( const std::string & file_ph, - std::ios_base::openmode ) - { return file_ph; } - - } // namespace detail - - template < class charT, class traits = std::char_traits<charT> > - class basic_filebuf : public std::basic_filebuf<charT,traits> - { - private: // disallow copying - basic_filebuf( const basic_filebuf & ); - const basic_filebuf & operator=( const basic_filebuf & ); - public: - basic_filebuf() {} - virtual ~basic_filebuf() {} - -# ifndef BOOST_FILESYSTEM2_NARROW_ONLY - template<class Path> - typename boost::enable_if<is_basic_path<Path>, - basic_filebuf<charT,traits> *>::type - open( const Path & file_ph, std::ios_base::openmode mode ); - - basic_filebuf<charT,traits> * - open( const wpath & file_ph, std::ios_base::openmode mode ); -# endif - -# if !BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) // VC++ 6.0 can't handle this - basic_filebuf<charT,traits> * - open( const path & file_ph, std::ios_base::openmode mode ); -# endif - }; - - template < class charT, class traits = std::char_traits<charT> > - class basic_ifstream : public std::basic_ifstream<charT,traits> - { - private: // disallow copying - basic_ifstream( const basic_ifstream & ); - const basic_ifstream & operator=( const basic_ifstream & ); - public: - basic_ifstream() {} - - // use two signatures, rather than one signature with default second - // argument, to workaround VC++ 7.1 bug (ID VSWhidbey 38416) - -# ifndef BOOST_FILESYSTEM2_NARROW_ONLY - template<class Path> - explicit basic_ifstream( const Path & file_ph, - typename boost::enable_if<is_basic_path<Path> >::type* dummy = 0 ); - - template<class Path> - basic_ifstream( const Path & file_ph, std::ios_base::openmode mode, - typename boost::enable_if<is_basic_path<Path> >::type* dummy = 0 ); - - template<class Path> - typename boost::enable_if<is_basic_path<Path>, void>::type - open( const Path & file_ph ); - - template<class Path> - typename boost::enable_if<is_basic_path<Path>, void>::type - open( const Path & file_ph, std::ios_base::openmode mode ); - - explicit basic_ifstream( const wpath & file_ph ); - basic_ifstream( const wpath & file_ph, std::ios_base::openmode mode ); - void open( const wpath & file_ph ); - void open( const wpath & file_ph, std::ios_base::openmode mode ); -# endif - - explicit basic_ifstream( const path & file_ph ); - basic_ifstream( const path & file_ph, std::ios_base::openmode mode ); -# if !BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) // VC++ 6.0 can't handle this - void open( const path & file_ph ); - void open( const path & file_ph, std::ios_base::openmode mode ); -# endif - virtual ~basic_ifstream() {} - }; - - template < class charT, class traits = std::char_traits<charT> > - class basic_ofstream : public std::basic_ofstream<charT,traits> - { - private: // disallow copying - basic_ofstream( const basic_ofstream & ); - const basic_ofstream & operator=( const basic_ofstream & ); - public: - basic_ofstream() {} - - // use two signatures, rather than one signature with default second - // argument, to workaround VC++ 7.1 bug (ID VSWhidbey 38416) - -# ifndef BOOST_FILESYSTEM2_NARROW_ONLY - - template<class Path> - explicit basic_ofstream( const Path & file_ph, - typename boost::enable_if<is_basic_path<Path> >::type* dummy = 0 ); - explicit basic_ofstream( const wpath & file_ph ); - - template<class Path> - basic_ofstream( const Path & file_ph, std::ios_base::openmode mode, - typename boost::enable_if<is_basic_path<Path> >::type* dummy = 0 ); - basic_ofstream( const wpath & file_ph, std::ios_base::openmode mode ); - - template<class Path> - typename boost::enable_if<is_basic_path<Path>, void>::type - open( const Path & file_ph ); - void open( const wpath & file_ph ); - - template<class Path> - typename boost::enable_if<is_basic_path<Path>, void>::type - open( const Path & file_ph, std::ios_base::openmode mode ); - void open( const wpath & file_ph, std::ios_base::openmode mode ); - -# endif - - explicit basic_ofstream( const path & file_ph ); - basic_ofstream( const path & file_ph, std::ios_base::openmode mode ); -# if !BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) // VC++ 6.0 can't handle this - void open( const path & file_ph ); - void open( const path & file_ph, std::ios_base::openmode mode ); -# endif - virtual ~basic_ofstream() {} - }; - - template < class charT, class traits = std::char_traits<charT> > - class basic_fstream : public std::basic_fstream<charT,traits> - { - private: // disallow copying - basic_fstream( const basic_fstream & ); - const basic_fstream & operator=( const basic_fstream & ); - public: - basic_fstream() {} - - // use two signatures, rather than one signature with default second - // argument, to workaround VC++ 7.1 bug (ID VSWhidbey 38416) - -# ifndef BOOST_FILESYSTEM2_NARROW_ONLY - - template<class Path> - explicit basic_fstream( const Path & file_ph, - typename boost::enable_if<is_basic_path<Path> >::type* dummy = 0 ); - explicit basic_fstream( const wpath & file_ph ); - - template<class Path> - basic_fstream( const Path & file_ph, std::ios_base::openmode mode, - typename boost::enable_if<is_basic_path<Path> >::type* dummy = 0 ); - basic_fstream( const wpath & file_ph, std::ios_base::openmode mode ); - - template<class Path> - typename boost::enable_if<is_basic_path<Path>, void>::type - open( const Path & file_ph ); - void open( const wpath & file_ph ); - - template<class Path> - typename boost::enable_if<is_basic_path<Path>, void>::type - open( const Path & file_ph, std::ios_base::openmode mode ); - void open( const wpath & file_ph, std::ios_base::openmode mode ); - -# endif - - explicit basic_fstream( const path & file_ph ); - basic_fstream( const path & file_ph, std::ios_base::openmode mode ); -# if !BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) // VC++ 6.0 can't handle this - void open( const path & file_ph ); - void open( const path & file_ph, std::ios_base::openmode mode ); -# endif - virtual ~basic_fstream() {} - - }; - - typedef basic_filebuf<char> filebuf; - typedef basic_ifstream<char> ifstream; - typedef basic_ofstream<char> ofstream; - typedef basic_fstream<char> fstream; - -# ifndef BOOST_FILESYSTEM2_NARROW_ONLY - typedef basic_filebuf<wchar_t> wfilebuf; - typedef basic_ifstream<wchar_t> wifstream; - typedef basic_fstream<wchar_t> wfstream; - typedef basic_ofstream<wchar_t> wofstream; -# endif - -# ifndef BOOST_FILESYSTEM2_NARROW_ONLY - -// basic_filebuf definitions -----------------------------------------------// - - template <class charT, class traits> - template<class Path> - typename boost::enable_if<is_basic_path<Path>, - basic_filebuf<charT,traits> *>::type - basic_filebuf<charT,traits>::open( const Path & file_ph, - std::ios_base::openmode mode ) - { - return (std::basic_filebuf<charT,traits>::open( detail::path_proxy( - file_ph.external_file_string(), mode ).c_str(), mode ) - == 0) ? 0 : this; - } - - template <class charT, class traits> - basic_filebuf<charT,traits> * - basic_filebuf<charT, traits>::open( const wpath & file_ph, - std::ios_base::openmode mode ) - { - return this->BOOST_NESTED_TEMPLATE open<wpath>( file_ph, mode ); - } - -// basic_ifstream definitions ----------------------------------------------// - - template <class charT, class traits> template<class Path> - basic_ifstream<charT,traits>::basic_ifstream(const Path & file_ph, - typename boost::enable_if<is_basic_path<Path> >::type* ) - : std::basic_ifstream<charT,traits>( - detail::path_proxy( file_ph.external_file_string(), - std::ios_base::in ).c_str(), std::ios_base::in ) {} - - template <class charT, class traits> - basic_ifstream<charT,traits>::basic_ifstream( const wpath & file_ph ) - : std::basic_ifstream<charT,traits>( - detail::path_proxy( file_ph.external_file_string(), - std::ios_base::in ).c_str(), std::ios_base::in ) {} - - template <class charT, class traits> template<class Path> - basic_ifstream<charT,traits>::basic_ifstream( const Path & file_ph, - std::ios_base::openmode mode, - typename boost::enable_if<is_basic_path<Path> >::type* ) - : std::basic_ifstream<charT,traits>( - detail::path_proxy( file_ph.external_file_string(), - mode ).c_str(), mode ) {} - - template <class charT, class traits> - basic_ifstream<charT,traits>::basic_ifstream( const wpath & file_ph, - std::ios_base::openmode mode ) - : std::basic_ifstream<charT,traits>( - detail::path_proxy( file_ph.external_file_string(), - mode ).c_str(), mode ) {} - - template <class charT, class traits> template<class Path> - typename boost::enable_if<is_basic_path<Path>, void>::type - basic_ifstream<charT,traits>::open( const Path & file_ph ) - { - std::basic_ifstream<charT,traits>::open( - detail::path_proxy( file_ph.external_file_string(), - std::ios_base::in ).c_str(), std::ios_base::in ); - } - - template <class charT, class traits> - void basic_ifstream<charT,traits>::open( const wpath & file_ph ) - { - std::basic_ifstream<charT,traits>::open( - detail::path_proxy( file_ph.external_file_string(), - std::ios_base::in ).c_str(), std::ios_base::in ); - } - - template <class charT, class traits> template<class Path> - typename boost::enable_if<is_basic_path<Path>, void>::type - basic_ifstream<charT,traits>::open( const Path & file_ph, - std::ios_base::openmode mode ) - { - std::basic_ifstream<charT,traits>::open( - detail::path_proxy( file_ph.external_file_string(), - mode ).c_str(), mode ); - } - - template <class charT, class traits> - void basic_ifstream<charT,traits>::open( const wpath & file_ph, - std::ios_base::openmode mode ) - { - std::basic_ifstream<charT,traits>::open( - detail::path_proxy( file_ph.external_file_string(), - mode ).c_str(), mode ); - } - -// basic_ofstream definitions ----------------------------------------------// - - template <class charT, class traits> template<class Path> - basic_ofstream<charT,traits>::basic_ofstream(const Path & file_ph, - typename boost::enable_if<is_basic_path<Path> >::type* ) - : std::basic_ofstream<charT,traits>( - detail::path_proxy( file_ph.external_file_string(), - std::ios_base::out ).c_str(), std::ios_base::out ) {} - - template <class charT, class traits> - basic_ofstream<charT,traits>::basic_ofstream( const wpath & file_ph ) - : std::basic_ofstream<charT,traits>( - detail::path_proxy( file_ph.external_file_string(), - std::ios_base::out ).c_str(), std::ios_base::out ) {} - - template <class charT, class traits> template<class Path> - basic_ofstream<charT,traits>::basic_ofstream( const Path & file_ph, - std::ios_base::openmode mode, - typename boost::enable_if<is_basic_path<Path> >::type* ) - : std::basic_ofstream<charT,traits>( - detail::path_proxy( file_ph.external_file_string(), - mode ).c_str(), mode ) {} - - template <class charT, class traits> - basic_ofstream<charT,traits>::basic_ofstream( const wpath & file_ph, - std::ios_base::openmode mode ) - : std::basic_ofstream<charT,traits>( - detail::path_proxy( file_ph.external_file_string(), - mode ).c_str(), mode ) {} - - template <class charT, class traits> template<class Path> - typename boost::enable_if<is_basic_path<Path>, void>::type - basic_ofstream<charT,traits>::open( const Path & file_ph ) - { - std::basic_ofstream<charT,traits>::open( - detail::path_proxy( file_ph.external_file_string(), - std::ios_base::out ).c_str(), std::ios_base::out ); - } - - template <class charT, class traits> - void basic_ofstream<charT,traits>::open( const wpath & file_ph ) - { - std::basic_ofstream<charT,traits>::open( - detail::path_proxy( file_ph.external_file_string(), - std::ios_base::out ).c_str(), std::ios_base::out ); - } - - template <class charT, class traits> template<class Path> - typename boost::enable_if<is_basic_path<Path>, void>::type - basic_ofstream<charT,traits>::open( const Path & file_ph, - std::ios_base::openmode mode ) - { - std::basic_ofstream<charT,traits>::open( - detail::path_proxy( file_ph.external_file_string(), - mode ).c_str(), mode ); - } - - template <class charT, class traits> - void basic_ofstream<charT,traits>::open( const wpath & file_ph, - std::ios_base::openmode mode ) - { - std::basic_ofstream<charT,traits>::open( - detail::path_proxy( file_ph.external_file_string(), - mode ).c_str(), mode ); - } - -// basic_fstream definitions -----------------------------------------------// - - template <class charT, class traits> template<class Path> - basic_fstream<charT,traits>::basic_fstream(const Path & file_ph, - typename boost::enable_if<is_basic_path<Path> >::type* ) - : std::basic_fstream<charT,traits>( - detail::path_proxy( file_ph.external_file_string(), - std::ios_base::in|std::ios_base::out ).c_str(), - std::ios_base::in|std::ios_base::out ) {} - - template <class charT, class traits> - basic_fstream<charT,traits>::basic_fstream( const wpath & file_ph ) - : std::basic_fstream<charT,traits>( - detail::path_proxy( file_ph.external_file_string(), - std::ios_base::in|std::ios_base::out ).c_str(), - std::ios_base::in|std::ios_base::out ) {} - - template <class charT, class traits> template<class Path> - basic_fstream<charT,traits>::basic_fstream( const Path & file_ph, - std::ios_base::openmode mode, - typename boost::enable_if<is_basic_path<Path> >::type* ) - : std::basic_fstream<charT,traits>( - detail::path_proxy( file_ph.external_file_string(), - mode ).c_str(), mode ) {} - - template <class charT, class traits> - basic_fstream<charT,traits>::basic_fstream( const wpath & file_ph, - std::ios_base::openmode mode ) - : std::basic_fstream<charT,traits>( - detail::path_proxy( file_ph.external_file_string(), - mode ).c_str(), mode ) {} - - template <class charT, class traits> template<class Path> - typename boost::enable_if<is_basic_path<Path>, void>::type - basic_fstream<charT,traits>::open( const Path & file_ph ) - { - std::basic_fstream<charT,traits>::open( - detail::path_proxy( file_ph.external_file_string(), - std::ios_base::in|std::ios_base::out ).c_str(), - std::ios_base::in|std::ios_base::out ); - } - - template <class charT, class traits> - void basic_fstream<charT,traits>::open( const wpath & file_ph ) - { - std::basic_fstream<charT,traits>::open( - detail::path_proxy( file_ph.external_file_string(), - std::ios_base::in|std::ios_base::out ).c_str(), - std::ios_base::in|std::ios_base::out ); - } - - template <class charT, class traits> template<class Path> - typename boost::enable_if<is_basic_path<Path>, void>::type - basic_fstream<charT,traits>::open( const Path & file_ph, - std::ios_base::openmode mode ) - { - std::basic_fstream<charT,traits>::open( - detail::path_proxy( file_ph.external_file_string(), - mode ).c_str(), mode ); - } - - template <class charT, class traits> - void basic_fstream<charT,traits>::open( const wpath & file_ph, - std::ios_base::openmode mode ) - { - std::basic_fstream<charT,traits>::open( - detail::path_proxy( file_ph.external_file_string(), - mode ).c_str(), mode ); - } - -# endif - -# if !BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) // VC++ 6.0 can't handle this - template <class charT, class traits> - basic_filebuf<charT,traits> * - basic_filebuf<charT, traits>::open( const path & file_ph, - std::ios_base::openmode mode ) - { - return std::basic_filebuf<charT,traits>::open( - file_ph.file_string().c_str(), mode ) == 0 ? 0 : this; - } -# endif - - template <class charT, class traits> - basic_ifstream<charT,traits>::basic_ifstream( const path & file_ph ) - : std::basic_ifstream<charT,traits>( - file_ph.file_string().c_str(), std::ios_base::in ) {} - - template <class charT, class traits> - basic_ifstream<charT,traits>::basic_ifstream( const path & file_ph, - std::ios_base::openmode mode ) - : std::basic_ifstream<charT,traits>( - file_ph.file_string().c_str(), mode ) {} - -# if !BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) // VC++ 6.0 can't handle this - template <class charT, class traits> - void basic_ifstream<charT,traits>::open( const path & file_ph ) - { - std::basic_ifstream<charT,traits>::open( - file_ph.file_string().c_str(), std::ios_base::in ); - } - - template <class charT, class traits> - void basic_ifstream<charT,traits>::open( const path & file_ph, - std::ios_base::openmode mode ) - { - std::basic_ifstream<charT,traits>::open( - file_ph.file_string().c_str(), mode ); - } -# endif - - template <class charT, class traits> - basic_ofstream<charT,traits>::basic_ofstream( const path & file_ph ) - : std::basic_ofstream<charT,traits>( - file_ph.file_string().c_str(), std::ios_base::out ) {} - - template <class charT, class traits> - basic_ofstream<charT,traits>::basic_ofstream( const path & file_ph, - std::ios_base::openmode mode ) - : std::basic_ofstream<charT,traits>( - file_ph.file_string().c_str(), mode ) {} - -# if !BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) // VC++ 6.0 can't handle this - template <class charT, class traits> - void basic_ofstream<charT,traits>::open( const path & file_ph ) - { - std::basic_ofstream<charT,traits>::open( - file_ph.file_string().c_str(), std::ios_base::out ); - } - - template <class charT, class traits> - void basic_ofstream<charT,traits>::open( const path & file_ph, - std::ios_base::openmode mode ) - { - std::basic_ofstream<charT,traits>::open( - file_ph.file_string().c_str(), mode ); - } -# endif - - template <class charT, class traits> - basic_fstream<charT,traits>::basic_fstream( const path & file_ph ) - : std::basic_fstream<charT,traits>( - file_ph.file_string().c_str(), - std::ios_base::in|std::ios_base::out ) {} - - - template <class charT, class traits> - basic_fstream<charT,traits>::basic_fstream( const path & file_ph, - std::ios_base::openmode mode ) - : std::basic_fstream<charT,traits>( - file_ph.file_string().c_str(), mode ) {} - -# if !BOOST_WORKAROUND( BOOST_MSVC, <= 1200 ) // VC++ 6.0 can't handle this - template <class charT, class traits> - void basic_fstream<charT,traits>::open( const path & file_ph ) - { - std::basic_fstream<charT,traits>::open( - file_ph.file_string().c_str(), std::ios_base::in|std::ios_base::out ); - } - - template <class charT, class traits> - void basic_fstream<charT,traits>::open( const path & file_ph, - std::ios_base::openmode mode ) - { - std::basic_fstream<charT,traits>::open( - file_ph.file_string().c_str(), mode ); - } -# endif - } // namespace filesystem2 -} // namespace boost - -//----------------------------------------------------------------------------// - -namespace boost -{ - namespace filesystem - { -# ifndef BOOST_FILESYSTEM2_NARROW_ONLY - using filesystem2::wfilebuf; - using filesystem2::wifstream; - using filesystem2::wfstream; - using filesystem2::wofstream; -# endif - using filesystem2::filebuf; - using filesystem2::ifstream; - using filesystem2::ofstream; - using filesystem2::fstream; - using filesystem2::basic_filebuf; - using filesystem2::basic_ifstream; - using filesystem2::basic_ofstream; - using filesystem2::basic_fstream; - -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED -# endif - } -} - -//----------------------------------------------------------------------------// - -#include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas -#endif // BOOST_FILESYSTEM2_FSTREAM_HPP diff --git a/3rdParty/Boost/src/boost/filesystem/v2/operations.hpp b/3rdParty/Boost/src/boost/filesystem/v2/operations.hpp deleted file mode 100644 index 57c406d..0000000 --- a/3rdParty/Boost/src/boost/filesystem/v2/operations.hpp +++ /dev/null @@ -1,1245 +0,0 @@ -// boost/filesystem/operations.hpp -----------------------------------------// - -// Copyright 2002-2005 Beman Dawes -// Copyright 2002 Jan Langer -// Copyright 2001 Dietmar Kuehl -// -// 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) - -// See library home page at http://www.boost.org/libs/filesystem - -//----------------------------------------------------------------------------// - -#ifndef BOOST_FILESYSTEM2_OPERATIONS_HPP -#define BOOST_FILESYSTEM2_OPERATIONS_HPP - -#include <boost/filesystem/v2/config.hpp> -#include <boost/filesystem/v2/path.hpp> -#include <boost/detail/scoped_enum_emulation.hpp> - -#include <boost/shared_ptr.hpp> -#include <boost/utility/enable_if.hpp> -#include <boost/type_traits/is_same.hpp> -#include <boost/iterator.hpp> -#include <boost/cstdint.hpp> -#include <boost/assert.hpp> - -#include <string> -#include <utility> // for pair -#include <ctime> - -#ifdef BOOST_WINDOWS_API -# include <fstream> -# if !defined(_WIN32_WINNT) || _WIN32_WINNT >= 0x0500 -# define BOOST_FS_HARD_LINK // Default for Windows 2K or later -# endif -#endif - -#include <boost/config/abi_prefix.hpp> // must be the last #include - -# ifdef BOOST_NO_STDC_NAMESPACE - namespace std { using ::time_t; } -# endif - -//----------------------------------------------------------------------------// - -namespace boost -{ - namespace filesystem2 - { - -// typedef boost::filesystem::path Path; needs to be in namespace boost::filesystem -# ifndef BOOST_FILESYSTEM2_NARROW_ONLY -# define BOOST_FS_FUNC(BOOST_FS_TYPE) \ - template<class Path> typename boost::enable_if<is_basic_path<Path>, \ - BOOST_FS_TYPE>::type -# define BOOST_INLINE_FS_FUNC(BOOST_FS_TYPE) \ - template<class Path> inline typename boost::enable_if<is_basic_path<Path>, \ - BOOST_FS_TYPE>::type -# define BOOST_FS_TYPENAME typename -# else -# define BOOST_FS_FUNC(BOOST_FS_TYPE) inline BOOST_FS_TYPE -# define BOOST_INLINE_FS_FUNC(BOOST_FS_TYPE) inline BOOST_FS_TYPE - typedef boost::filesystem2::path Path; -# define BOOST_FS_TYPENAME -# endif - - template<class Path> class basic_directory_iterator; - - // BOOST_FILESYSTEM2_NARROW_ONLY needs this: - typedef basic_directory_iterator<path> directory_iterator; - - template<class Path> class basic_directory_entry; - - enum file_type - { - status_unknown, - file_not_found, - regular_file, - directory_file, - // the following will never be reported by some operating or file systems - symlink_file, - block_file, - character_file, - fifo_file, - socket_file, - type_unknown // file does exist, but isn't one of the above types or - // we don't have strong enough permission to find its type - }; - - class file_status - { - public: - explicit file_status( file_type v = status_unknown ) : m_value(v) {} - - void type( file_type v ) { m_value = v; } - file_type type() const { return m_value; } - - private: - // the internal representation is unspecified so that additional state - // information such as permissions can be added in the future; this - // implementation just uses status_type as the internal representation - - file_type m_value; - }; - - inline bool status_known( file_status f ) { return f.type() != status_unknown; } - inline bool exists( file_status f ) { return f.type() != status_unknown && f.type() != file_not_found; } - inline bool is_regular_file(file_status f){ return f.type() == regular_file; } - inline bool is_directory( file_status f ) { return f.type() == directory_file; } - inline bool is_symlink( file_status f ) { return f.type() == symlink_file; } - inline bool is_other( file_status f ) { return exists(f) && !is_regular_file(f) && !is_directory(f) && !is_symlink(f); } - -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED - inline bool is_regular( file_status f ) { return f.type() == regular_file; } -# endif - - struct space_info - { - // all values are byte counts - boost::uintmax_t capacity; - boost::uintmax_t free; // <= capacity - boost::uintmax_t available; // <= free - }; - - namespace detail - { - typedef std::pair< system::error_code, bool > - query_pair; - - typedef std::pair< system::error_code, boost::uintmax_t > - uintmax_pair; - - typedef std::pair< system::error_code, std::time_t > - time_pair; - - typedef std::pair< system::error_code, space_info > - space_pair; - - template< class Path > - struct directory_pair - { - typedef std::pair< system::error_code, - typename Path::external_string_type > type; - }; - -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED - BOOST_FILESYSTEM_DECL bool - symbolic_link_exists_api( const std::string & ); // deprecated -# endif - - BOOST_FILESYSTEM_DECL file_status - status_api( const std::string & ph, system::error_code & ec ); -# ifndef BOOST_WINDOWS_API - BOOST_FILESYSTEM_DECL file_status - symlink_status_api( const std::string & ph, system::error_code & ec ); -# endif - BOOST_FILESYSTEM_DECL query_pair - is_empty_api( const std::string & ph ); - BOOST_FILESYSTEM_DECL query_pair - equivalent_api( const std::string & ph1, const std::string & ph2 ); - BOOST_FILESYSTEM_DECL uintmax_pair - file_size_api( const std::string & ph ); - BOOST_FILESYSTEM_DECL space_pair - space_api( const std::string & ph ); - BOOST_FILESYSTEM_DECL time_pair - last_write_time_api( const std::string & ph ); - BOOST_FILESYSTEM_DECL system::error_code - last_write_time_api( const std::string & ph, std::time_t new_value ); - BOOST_FILESYSTEM_DECL system::error_code - get_current_path_api( std::string & ph ); - BOOST_FILESYSTEM_DECL system::error_code - set_current_path_api( const std::string & ph ); - BOOST_FILESYSTEM_DECL query_pair - create_directory_api( const std::string & ph ); - BOOST_FILESYSTEM_DECL system::error_code - create_hard_link_api( const std::string & to_ph, - const std::string & from_ph ); - BOOST_FILESYSTEM_DECL system::error_code - create_symlink_api( const std::string & to_ph, - const std::string & from_ph ); - BOOST_FILESYSTEM_DECL system::error_code - remove_api( const std::string & ph ); - BOOST_FILESYSTEM_DECL system::error_code - rename_api( const std::string & from, const std::string & to ); - BOOST_FILESYSTEM_DECL system::error_code - copy_file_api( const std::string & from, const std::string & to, bool fail_if_exists ); - -# if defined(BOOST_WINDOWS_API) - - BOOST_FILESYSTEM_DECL system::error_code - get_full_path_name_api( const std::string & ph, std::string & target ); - -# if !defined(BOOST_FILESYSTEM2_NARROW_ONLY) - - BOOST_FILESYSTEM_DECL boost::filesystem2::file_status - status_api( const std::wstring & ph, system::error_code & ec ); - BOOST_FILESYSTEM_DECL query_pair - is_empty_api( const std::wstring & ph ); - BOOST_FILESYSTEM_DECL query_pair - equivalent_api( const std::wstring & ph1, const std::wstring & ph2 ); - BOOST_FILESYSTEM_DECL uintmax_pair - file_size_api( const std::wstring & ph ); - BOOST_FILESYSTEM_DECL space_pair - space_api( const std::wstring & ph ); - BOOST_FILESYSTEM_DECL system::error_code - get_full_path_name_api( const std::wstring & ph, std::wstring & target ); - BOOST_FILESYSTEM_DECL time_pair - last_write_time_api( const std::wstring & ph ); - BOOST_FILESYSTEM_DECL system::error_code - last_write_time_api( const std::wstring & ph, std::time_t new_value ); - BOOST_FILESYSTEM_DECL system::error_code - get_current_path_api( std::wstring & ph ); - BOOST_FILESYSTEM_DECL system::error_code - set_current_path_api( const std::wstring & ph ); - BOOST_FILESYSTEM_DECL query_pair - create_directory_api( const std::wstring & ph ); -# ifdef BOOST_FS_HARD_LINK - BOOST_FILESYSTEM_DECL system::error_code - create_hard_link_api( const std::wstring & existing_ph, - const std::wstring & new_ph ); -# endif - BOOST_FILESYSTEM_DECL system::error_code - create_symlink_api( const std::wstring & to_ph, - const std::wstring & from_ph ); - BOOST_FILESYSTEM_DECL system::error_code - remove_api( const std::wstring & ph ); - BOOST_FILESYSTEM_DECL system::error_code - rename_api( const std::wstring & from, const std::wstring & to ); - BOOST_FILESYSTEM_DECL system::error_code - copy_file_api( const std::wstring & from, const std::wstring & to, bool fail_if_exists ); - -# endif -# endif - - template<class Path> - bool remove_aux( const Path & ph, file_status f ); - - template<class Path> - unsigned long remove_all_aux( const Path & ph, file_status f ); - - } // namespace detail - -// operations functions ----------------------------------------------------// - - // The non-template overloads enable automatic conversion from std and - // C-style strings. See basic_path constructors. The enable_if for the - // templates implements the famous "do-the-right-thing" rule. - -// query functions ---------------------------------------------------------// - - BOOST_INLINE_FS_FUNC(file_status) - status( const Path & ph, system::error_code & ec ) - { return detail::status_api( ph.external_file_string(), ec ); } - - BOOST_FS_FUNC(file_status) - status( const Path & ph ) - { - system::error_code ec; - file_status result( detail::status_api( ph.external_file_string(), ec ) ); - if ( ec ) - BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>( - "boost::filesystem::status", ph, ec ) ); - return result; - } - - BOOST_INLINE_FS_FUNC(file_status) - symlink_status( const Path & ph, system::error_code & ec ) -# ifdef BOOST_WINDOWS_API - { return detail::status_api( ph.external_file_string(), ec ); } -# else - { return detail::symlink_status_api( ph.external_file_string(), ec ); } -# endif - - BOOST_FS_FUNC(file_status) - symlink_status( const Path & ph ) - { - system::error_code ec; - file_status result( symlink_status( ph, ec ) ); - if ( ec ) - BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>( - "boost::filesystem::symlink_status", ph, ec ) ); - return result; - } - -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED - inline bool symbolic_link_exists( const path & ph ) - { return is_symlink( symlink_status(ph) ); } -# endif - - BOOST_FS_FUNC(bool) exists( const Path & ph ) - { - system::error_code ec; - file_status result( detail::status_api( ph.external_file_string(), ec ) ); - if ( ec ) - BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>( - "boost::filesystem::exists", ph, ec ) ); - return exists( result ); - } - - BOOST_FS_FUNC(bool) is_directory( const Path & ph ) - { - system::error_code ec; - file_status result( detail::status_api( ph.external_file_string(), ec ) ); - if ( ec ) - BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>( - "boost::filesystem::is_directory", ph, ec ) ); - return is_directory( result ); - } - - BOOST_FS_FUNC(bool) is_regular_file( const Path & ph ) - { - system::error_code ec; - file_status result( detail::status_api( ph.external_file_string(), ec ) ); - if ( ec ) - BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>( - "boost::filesystem::is_regular_file", ph, ec ) ); - return is_regular_file( result ); - } - -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED - BOOST_FS_FUNC(bool) is_regular( const Path & ph ) - { - system::error_code ec; - file_status result( detail::status_api( ph.external_file_string(), ec ) ); - if ( ec ) - BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>( - "boost::filesystem::is_regular", ph, ec ) ); - return is_regular( result ); - } -# endif - - BOOST_FS_FUNC(bool) is_other( const Path & ph ) - { - system::error_code ec; - file_status result( detail::status_api( ph.external_file_string(), ec ) ); - if ( ec ) - BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>( - "boost::filesystem::is_other", ph, ec ) ); - return is_other( result ); - } - - BOOST_FS_FUNC(bool) is_symlink( -# ifdef BOOST_WINDOWS_API - const Path & ) - { - return false; -# else - const Path & ph) - { - system::error_code ec; - file_status result( detail::symlink_status_api( ph.external_file_string(), ec ) ); - if ( ec ) - BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>( - "boost::filesystem::is_symlink", ph, ec ) ); - return is_symlink( result ); -# endif - } - - // VC++ 7.0 and earlier has a serious namespace bug that causes a clash - // between boost::filesystem2::is_empty and the unrelated type trait - // boost::is_empty. - -# if !defined( BOOST_MSVC ) || BOOST_MSVC > 1300 - BOOST_FS_FUNC(bool) is_empty( const Path & ph ) -# else - BOOST_FS_FUNC(bool) _is_empty( const Path & ph ) -# endif - { - detail::query_pair result( - detail::is_empty_api( ph.external_file_string() ) ); - if ( result.first ) - BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>( - "boost::filesystem::is_empty", ph, result.first ) ); - return result.second; - } - - BOOST_FS_FUNC(bool) equivalent( const Path & ph1, const Path & ph2 ) - { - detail::query_pair result( detail::equivalent_api( - ph1.external_file_string(), ph2.external_file_string() ) ); - if ( result.first ) - BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>( - "boost::filesystem::equivalent", ph1, ph2, result.first ) ); - return result.second; - } - - BOOST_FS_FUNC(boost::uintmax_t) file_size( const Path & ph ) - { - detail::uintmax_pair result - ( detail::file_size_api( ph.external_file_string() ) ); - if ( result.first ) - BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>( - "boost::filesystem::file_size", ph, result.first ) ); - return result.second; - } - - BOOST_FS_FUNC(space_info) space( const Path & ph ) - { - detail::space_pair result - ( detail::space_api( ph.external_file_string() ) ); - if ( result.first ) - BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>( - "boost::filesystem::space", ph, result.first ) ); - return result.second; - } - - BOOST_FS_FUNC(std::time_t) last_write_time( const Path & ph ) - { - detail::time_pair result - ( detail::last_write_time_api( ph.external_file_string() ) ); - if ( result.first ) - BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>( - "boost::filesystem::last_write_time", ph, result.first ) ); - return result.second; - } - - -// operations --------------------------------------------------------------// - - BOOST_FS_FUNC(bool) create_directory( const Path & dir_ph ) - { - detail::query_pair result( - detail::create_directory_api( dir_ph.external_directory_string() ) ); - if ( result.first ) - BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>( - "boost::filesystem::create_directory", - dir_ph, result.first ) ); - return result.second; - } - -#if !defined(BOOST_WINDOWS_API) || defined(BOOST_FS_HARD_LINK) - BOOST_FS_FUNC(void) - create_hard_link( const Path & to_ph, const Path & from_ph ) - { - system::error_code ec( - detail::create_hard_link_api( - to_ph.external_file_string(), - from_ph.external_file_string() ) ); - if ( ec ) - BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>( - "boost::filesystem::create_hard_link", - to_ph, from_ph, ec ) ); - } - - BOOST_FS_FUNC(system::error_code) - create_hard_link( const Path & to_ph, const Path & from_ph, - system::error_code & ec ) - { - ec = detail::create_hard_link_api( - to_ph.external_file_string(), - from_ph.external_file_string() ); - return ec; - } -#endif - - BOOST_FS_FUNC(void) - create_symlink( const Path & to_ph, const Path & from_ph ) - { - system::error_code ec( - detail::create_symlink_api( - to_ph.external_file_string(), - from_ph.external_file_string() ) ); - if ( ec ) - BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>( - "boost::filesystem::create_symlink", - to_ph, from_ph, ec ) ); - } - - BOOST_FS_FUNC(system::error_code) - create_symlink( const Path & to_ph, const Path & from_ph, - system::error_code & ec ) - { - ec = detail::create_symlink_api( - to_ph.external_file_string(), - from_ph.external_file_string() ); - return ec; - } - - BOOST_FS_FUNC(bool) remove( const Path & ph ) - { - system::error_code ec; - file_status f = symlink_status( ph, ec ); - if ( ec ) - BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>( - "boost::filesystem::remove", ph, ec ) ); - return detail::remove_aux( ph, f ); - } - - BOOST_FS_FUNC(unsigned long) remove_all( const Path & ph ) - { - system::error_code ec; - file_status f = symlink_status( ph, ec ); - if ( ec ) - BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>( - "boost::filesystem::remove_all", ph, ec ) ); - return exists( f ) ? detail::remove_all_aux( ph, f ) : 0; - } - - BOOST_FS_FUNC(void) rename( const Path & from_path, const Path & to_path ) - { - system::error_code ec( detail::rename_api( - from_path.external_directory_string(), - to_path.external_directory_string() ) ); - if ( ec ) - BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>( - "boost::filesystem::rename", - from_path, to_path, ec ) ); - } - - BOOST_SCOPED_ENUM_START(copy_option) - { fail_if_exists, overwrite_if_exists }; - BOOST_SCOPED_ENUM_END - - BOOST_FS_FUNC(void) copy_file( const Path & from_path, const Path & to_path, - BOOST_SCOPED_ENUM(copy_option) option = copy_option::fail_if_exists ) - { - system::error_code ec( detail::copy_file_api( - from_path.external_directory_string(), - to_path.external_directory_string(), option == copy_option::fail_if_exists ) ); - if ( ec ) - BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>( - "boost::filesystem::copy_file", - from_path, to_path, ec ) ); - } - - template< class Path > - Path current_path() - { - typename Path::external_string_type ph; - system::error_code ec( detail::get_current_path_api( ph ) ); - if ( ec ) - BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>( - "boost::filesystem::current_path", ec ) ); - return Path( Path::traits_type::to_internal( ph ) ); - } - - BOOST_FS_FUNC(void) current_path( const Path & ph ) - { - system::error_code ec( detail::set_current_path_api( - ph.external_directory_string() ) ); - if ( ec ) - BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>( - "boost::filesystem::current_path", ph, ec ) ); - } - - template< class Path > - const Path & initial_path() - { - static Path init_path; - if ( init_path.empty() ) init_path = current_path<Path>(); - return init_path; - } - -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED - // legacy support - inline path current_path() // overload supports pre-i18n apps - { return current_path<boost::filesystem2::path>(); } - inline const path & initial_path() // overload supports pre-i18n apps - { return initial_path<boost::filesystem2::path>(); } -# endif - - BOOST_FS_FUNC(Path) system_complete( const Path & ph ) - { -# ifdef BOOST_WINDOWS_API - if ( ph.empty() ) return ph; - BOOST_FS_TYPENAME Path::external_string_type sys_ph; - system::error_code ec( detail::get_full_path_name_api( ph.external_file_string(), - sys_ph ) ); - if ( ec ) - BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>( - "boost::filesystem::system_complete", ph, ec ) ); - return Path( Path::traits_type::to_internal( sys_ph ) ); -# else - return (ph.empty() || ph.is_complete()) - ? ph : current_path<Path>() / ph; -# endif - } - - BOOST_FS_FUNC(Path) - complete( const Path & ph, - const Path & base/* = initial_path<Path>() */) - { - BOOST_ASSERT( base.is_complete() - && (ph.is_complete() || !ph.has_root_name()) - && "boost::filesystem::complete() precondition not met" ); -# ifdef BOOST_WINDOWS_PATH - if (ph.empty() || ph.is_complete()) return ph; - if ( !ph.has_root_name() ) - return ph.has_root_directory() - ? Path( base.root_name() ) / ph - : base / ph; - return base / ph; -# else - return (ph.empty() || ph.is_complete()) ? ph : base / ph; -# endif - } - - // VC++ 7.1 had trouble with default arguments, so separate one argument - // signatures are provided as workarounds; the effect is the same. - BOOST_FS_FUNC(Path) complete( const Path & ph ) - { return complete( ph, initial_path<Path>() ); } - - BOOST_FS_FUNC(void) - last_write_time( const Path & ph, const std::time_t new_time ) - { - system::error_code ec( detail::last_write_time_api( ph.external_file_string(), - new_time ) ); - if ( ec ) - BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>( - "boost::filesystem::last_write_time", ph, ec ) ); - } - -# ifndef BOOST_FILESYSTEM2_NARROW_ONLY - - // "do-the-right-thing" overloads ---------------------------------------// - - inline file_status status( const path & ph ) - { return status<path>( ph ); } - inline file_status status( const wpath & ph ) - { return status<wpath>( ph ); } - - inline file_status status( const path & ph, system::error_code & ec ) - { return status<path>( ph, ec ); } - inline file_status status( const wpath & ph, system::error_code & ec ) - { return status<wpath>( ph, ec ); } - - inline file_status symlink_status( const path & ph ) - { return symlink_status<path>( ph ); } - inline file_status symlink_status( const wpath & ph ) - { return symlink_status<wpath>( ph ); } - - inline file_status symlink_status( const path & ph, system::error_code & ec ) - { return symlink_status<path>( ph, ec ); } - inline file_status symlink_status( const wpath & ph, system::error_code & ec ) - { return symlink_status<wpath>( ph, ec ); } - - inline bool exists( const path & ph ) { return exists<path>( ph ); } - inline bool exists( const wpath & ph ) { return exists<wpath>( ph ); } - - inline bool is_directory( const path & ph ) - { return is_directory<path>( ph ); } - inline bool is_directory( const wpath & ph ) - { return is_directory<wpath>( ph ); } - - inline bool is_regular_file( const path & ph ) - { return is_regular_file<path>( ph ); } - inline bool is_regular_file( const wpath & ph ) - { return is_regular_file<wpath>( ph ); } - -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED - inline bool is_regular( const path & ph ) - { return is_regular<path>( ph ); } - inline bool is_regular( const wpath & ph ) - { return is_regular<wpath>( ph ); } -# endif - - inline bool is_other( const path & ph ) - { return is_other<path>( ph ); } - inline bool is_other( const wpath & ph ) - { return is_other<wpath>( ph ); } - - inline bool is_symlink( const path & ph ) - { return is_symlink<path>( ph ); } - inline bool is_symlink( const wpath & ph ) - { return is_symlink<wpath>( ph ); } - - inline bool is_empty( const path & ph ) - { return boost::filesystem2::is_empty<path>( ph ); } - inline bool is_empty( const wpath & ph ) - { return boost::filesystem2::is_empty<wpath>( ph ); } - - inline bool equivalent( const path & ph1, const path & ph2 ) - { return equivalent<path>( ph1, ph2 ); } - inline bool equivalent( const wpath & ph1, const wpath & ph2 ) - { return equivalent<wpath>( ph1, ph2 ); } - - inline boost::uintmax_t file_size( const path & ph ) - { return file_size<path>( ph ); } - inline boost::uintmax_t file_size( const wpath & ph ) - { return file_size<wpath>( ph ); } - - inline space_info space( const path & ph ) - { return space<path>( ph ); } - inline space_info space( const wpath & ph ) - { return space<wpath>( ph ); } - - inline std::time_t last_write_time( const path & ph ) - { return last_write_time<path>( ph ); } - inline std::time_t last_write_time( const wpath & ph ) - { return last_write_time<wpath>( ph ); } - - inline bool create_directory( const path & dir_ph ) - { return create_directory<path>( dir_ph ); } - inline bool create_directory( const wpath & dir_ph ) - { return create_directory<wpath>( dir_ph ); } - -#if !defined(BOOST_WINDOWS_API) || defined(BOOST_FS_HARD_LINK) - inline void create_hard_link( const path & to_ph, - const path & from_ph ) - { return create_hard_link<path>( to_ph, from_ph ); } - inline void create_hard_link( const wpath & to_ph, - const wpath & from_ph ) - { return create_hard_link<wpath>( to_ph, from_ph ); } - - inline system::error_code create_hard_link( const path & to_ph, - const path & from_ph, system::error_code & ec ) - { return create_hard_link<path>( to_ph, from_ph, ec ); } - inline system::error_code create_hard_link( const wpath & to_ph, - const wpath & from_ph, system::error_code & ec ) - { return create_hard_link<wpath>( to_ph, from_ph, ec ); } -#endif - - inline void create_symlink( const path & to_ph, - const path & from_ph ) - { return create_symlink<path>( to_ph, from_ph ); } - inline void create_symlink( const wpath & to_ph, - const wpath & from_ph ) - { return create_symlink<wpath>( to_ph, from_ph ); } - - inline system::error_code create_symlink( const path & to_ph, - const path & from_ph, system::error_code & ec ) - { return create_symlink<path>( to_ph, from_ph, ec ); } - inline system::error_code create_symlink( const wpath & to_ph, - const wpath & from_ph, system::error_code & ec ) - { return create_symlink<wpath>( to_ph, from_ph, ec ); } - - inline bool remove( const path & ph ) - { return remove<path>( ph ); } - inline bool remove( const wpath & ph ) - { return remove<wpath>( ph ); } - - inline unsigned long remove_all( const path & ph ) - { return remove_all<path>( ph ); } - inline unsigned long remove_all( const wpath & ph ) - { return remove_all<wpath>( ph ); } - - inline void rename( const path & from_path, const path & to_path ) - { return rename<path>( from_path, to_path ); } - inline void rename( const wpath & from_path, const wpath & to_path ) - { return rename<wpath>( from_path, to_path ); } - - inline void copy_file( const path & from_path, const path & to_path ) - { return copy_file<path>( from_path, to_path ); } - inline void copy_file( const wpath & from_path, const wpath & to_path ) - { return copy_file<wpath>( from_path, to_path ); } - - inline path system_complete( const path & ph ) - { return system_complete<path>( ph ); } - inline wpath system_complete( const wpath & ph ) - { return system_complete<wpath>( ph ); } - - inline path complete( const path & ph, - const path & base/* = initial_path<path>()*/ ) - { return complete<path>( ph, base ); } - inline wpath complete( const wpath & ph, - const wpath & base/* = initial_path<wpath>()*/ ) - { return complete<wpath>( ph, base ); } - - inline path complete( const path & ph ) - { return complete<path>( ph, initial_path<path>() ); } - inline wpath complete( const wpath & ph ) - { return complete<wpath>( ph, initial_path<wpath>() ); } - - inline void last_write_time( const path & ph, const std::time_t new_time ) - { last_write_time<path>( ph, new_time ); } - inline void last_write_time( const wpath & ph, const std::time_t new_time ) - { last_write_time<wpath>( ph, new_time ); } - - inline void current_path( const path & ph ) - { current_path<path>( ph ); } - inline void current_path( const wpath & ph ) - { current_path<wpath>( ph ); } - -# endif // ifndef BOOST_FILESYSTEM2_NARROW_ONLY - - namespace detail - { - template<class Path> - bool remove_aux( const Path & ph, file_status f ) - { - if ( exists( f ) ) - { - system::error_code ec = remove_api( ph.external_file_string() ); - if ( ec ) - BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>( - "boost::filesystem::remove", ph, ec ) ); - return true; - } - return false; - } - - template<class Path> - unsigned long remove_all_aux( const Path & ph, file_status f ) - { - static const boost::filesystem2::basic_directory_iterator<Path> end_itr; - unsigned long count = 1; - if ( !boost::filesystem2::is_symlink( f ) // don't recurse symbolic links - && boost::filesystem2::is_directory( f ) ) - { - for ( boost::filesystem2::basic_directory_iterator<Path> itr( ph ); - itr != end_itr; ++itr ) - { - boost::system::error_code ec; - boost::filesystem2::file_status fn = boost::filesystem2::symlink_status( itr->path(), ec ); - if ( ec ) - BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>( - "boost::filesystem:remove_all", ph, ec ) ); - count += remove_all_aux( itr->path(), fn ); - } - } - remove_aux( ph, f ); - return count; - } - -// test helper -------------------------------------------------------------// - - // not part of the documented interface because false positives are possible; - // there is no law that says that an OS that has large stat.st_size - // actually supports large file sizes. - BOOST_FILESYSTEM_DECL bool possible_large_file_size_support(); - -// directory_iterator helpers ----------------------------------------------// - -// forwarding functions avoid need for BOOST_FILESYSTEM_DECL for class -// basic_directory_iterator, and so avoid iterator_facade DLL template -// problems. They also overload to the proper external path character type. - - BOOST_FILESYSTEM_DECL system::error_code - dir_itr_first( void *& handle, -#if defined(BOOST_POSIX_API) - void *& buffer, -#endif - const std::string & dir_path, - std::string & target, file_status & fs, file_status & symlink_fs ); - // eof: return==0 && handle==0 - - BOOST_FILESYSTEM_DECL system::error_code - dir_itr_increment( void *& handle, -#if defined(BOOST_POSIX_API) - void *& buffer, -#endif - std::string & target, file_status & fs, file_status & symlink_fs ); - // eof: return==0 && handle==0 - - BOOST_FILESYSTEM_DECL system::error_code - dir_itr_close( void *& handle -#if defined(BOOST_POSIX_API) - , void *& buffer -#endif - ); - // Effects: none if handle==0, otherwise close handle, set handle=0 - -# if defined(BOOST_WINDOWS_API) && !defined(BOOST_FILESYSTEM2_NARROW_ONLY) - BOOST_FILESYSTEM_DECL system::error_code - dir_itr_first( void *& handle, const std::wstring & ph, - std::wstring & target, file_status & fs, file_status & symlink_fs ); - BOOST_FILESYSTEM_DECL system::error_code - dir_itr_increment( void *& handle, std::wstring & target, - file_status & fs, file_status & symlink_fs ); -# endif - - template< class Path > - class dir_itr_imp - { - public: - basic_directory_entry<Path> m_directory_entry; - void * m_handle; -# ifdef BOOST_POSIX_API - void * m_buffer; // see dir_itr_increment implementation -# endif - dir_itr_imp() : m_handle(0) -# ifdef BOOST_POSIX_API - , m_buffer(0) -# endif - {} - - ~dir_itr_imp() { dir_itr_close( m_handle -#if defined(BOOST_POSIX_API) - , m_buffer -#endif - ); } - }; - - BOOST_FILESYSTEM_DECL system::error_code not_found_error(); - - } // namespace detail - -// basic_directory_iterator ------------------------------------------------// - - template< class Path > - class basic_directory_iterator - : public boost::iterator_facade< - basic_directory_iterator<Path>, - basic_directory_entry<Path>, - boost::single_pass_traversal_tag > - { - public: - typedef Path path_type; - - basic_directory_iterator(){} // creates the "end" iterator - - explicit basic_directory_iterator( const Path & dir_path ); - basic_directory_iterator( const Path & dir_path, system::error_code & ec ); - - private: - - // shared_ptr provides shallow-copy semantics required for InputIterators. - // m_imp.get()==0 indicates the end iterator. - boost::shared_ptr< detail::dir_itr_imp< Path > > m_imp; - - friend class boost::iterator_core_access; - - typename boost::iterator_facade< - basic_directory_iterator<Path>, - basic_directory_entry<Path>, - boost::single_pass_traversal_tag >::reference dereference() const - { - BOOST_ASSERT( m_imp.get() && "attempt to dereference end iterator" ); - return m_imp->m_directory_entry; - } - - void increment(); - - bool equal( const basic_directory_iterator & rhs ) const - { return m_imp == rhs.m_imp; } - - system::error_code m_init( const Path & dir_path ); - }; - - typedef basic_directory_iterator< path > directory_iterator; -# ifndef BOOST_FILESYSTEM2_NARROW_ONLY - typedef basic_directory_iterator< wpath > wdirectory_iterator; -# endif - - // basic_directory_iterator implementation ---------------------------// - - template<class Path> - system::error_code basic_directory_iterator<Path>::m_init( - const Path & dir_path ) - { - if ( dir_path.empty() ) - { - m_imp.reset(); - return detail::not_found_error(); - } - typename Path::external_string_type name; - file_status fs, symlink_fs; - system::error_code ec( detail::dir_itr_first( m_imp->m_handle, -#if defined(BOOST_POSIX_API) - m_imp->m_buffer, -#endif - dir_path.external_directory_string(), - name, fs, symlink_fs ) ); - - if ( ec ) - { - m_imp.reset(); - return ec; - } - - if ( m_imp->m_handle == 0 ) m_imp.reset(); // eof, so make end iterator - else // not eof - { - m_imp->m_directory_entry.assign( dir_path - / Path::traits_type::to_internal( name ), fs, symlink_fs ); - if ( name[0] == dot<Path>::value // dot or dot-dot - && (name.size() == 1 - || (name[1] == dot<Path>::value - && name.size() == 2)) ) - { increment(); } - } - return boost::system::error_code(); - } - - template<class Path> - basic_directory_iterator<Path>::basic_directory_iterator( - const Path & dir_path ) - : m_imp( new detail::dir_itr_imp<Path> ) - { - system::error_code ec( m_init(dir_path) ); - if ( ec ) - { - BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>( - "boost::filesystem::basic_directory_iterator constructor", - dir_path, ec ) ); - } - } - - template<class Path> - basic_directory_iterator<Path>::basic_directory_iterator( - const Path & dir_path, system::error_code & ec ) - : m_imp( new detail::dir_itr_imp<Path> ) - { - ec = m_init(dir_path); - } - - template<class Path> - void basic_directory_iterator<Path>::increment() - { - BOOST_ASSERT( m_imp.get() && "attempt to increment end iterator" ); - BOOST_ASSERT( m_imp->m_handle != 0 && "internal program error" ); - - typename Path::external_string_type name; - file_status fs, symlink_fs; - system::error_code ec; - - for (;;) - { - ec = detail::dir_itr_increment( m_imp->m_handle, -#if defined(BOOST_POSIX_API) - m_imp->m_buffer, -#endif - name, fs, symlink_fs ); - if ( ec ) - { - BOOST_FILESYSTEM_THROW( basic_filesystem_error<Path>( - "boost::filesystem::basic_directory_iterator increment", - m_imp->m_directory_entry.path().parent_path(), ec ) ); - } - if ( m_imp->m_handle == 0 ) { m_imp.reset(); return; } // eof, make end - if ( !(name[0] == dot<Path>::value // !(dot or dot-dot) - && (name.size() == 1 - || (name[1] == dot<Path>::value - && name.size() == 2))) ) - { - m_imp->m_directory_entry.replace_filename( - Path::traits_type::to_internal( name ), fs, symlink_fs ); - return; - } - } - } - - // basic_directory_entry -----------------------------------------------// - - template<class Path> - class basic_directory_entry - { - public: - typedef Path path_type; - typedef typename Path::string_type string_type; - - // compiler generated copy-ctor, copy assignment, and destructor apply - - basic_directory_entry() {} - explicit basic_directory_entry( const path_type & p, - file_status st = file_status(), file_status symlink_st=file_status() ) - : m_path(p), m_status(st), m_symlink_status(symlink_st) - {} - - void assign( const path_type & p, - file_status st, file_status symlink_st ) - { m_path = p; m_status = st; m_symlink_status = symlink_st; } - - void replace_filename( const string_type & s, - file_status st, file_status symlink_st ) - { - m_path.remove_filename(); - m_path /= s; - m_status = st; - m_symlink_status = symlink_st; - } - -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED - void replace_leaf( const string_type & s, - file_status st, file_status symlink_st ) - { replace_filename( s, st, symlink_st ); } -# endif - - const Path & path() const { return m_path; } - file_status status() const; - file_status status( system::error_code & ec ) const; - file_status symlink_status() const; - file_status symlink_status( system::error_code & ec ) const; - - // conversion simplifies the most common use of basic_directory_entry - operator const path_type &() const { return m_path; } - -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED - // deprecated functions preserve common use cases in legacy code - typename Path::string_type filename() const - { - return path().filename(); - } - typename Path::string_type leaf() const - { - return path().filename(); - } - typename Path::string_type string() const - { - return path().string(); - } -# endif - - private: - path_type m_path; - mutable file_status m_status; // stat()-like - mutable file_status m_symlink_status; // lstat()-like - // note: m_symlink_status is not used by Windows implementation - - }; // basic_directory_status - - typedef basic_directory_entry<path> directory_entry; -# ifndef BOOST_FILESYSTEM2_NARROW_ONLY - typedef basic_directory_entry<wpath> wdirectory_entry; -# endif - - // basic_directory_entry implementation --------------------------------// - - template<class Path> - file_status - basic_directory_entry<Path>::status() const - { - if ( !status_known( m_status ) ) - { -# ifndef BOOST_WINDOWS_API - if ( status_known( m_symlink_status ) - && !is_symlink( m_symlink_status ) ) - { m_status = m_symlink_status; } - else { m_status = boost::filesystem2::status( m_path ); } -# else - m_status = boost::filesystem2::status( m_path ); -# endif - } - return m_status; - } - - template<class Path> - file_status - basic_directory_entry<Path>::status( system::error_code & ec ) const - { - if ( !status_known( m_status ) ) - { -# ifndef BOOST_WINDOWS_API - if ( status_known( m_symlink_status ) - && !is_symlink( m_symlink_status ) ) - { ec = boost::system::error_code();; m_status = m_symlink_status; } - else { m_status = boost::filesystem2::status( m_path, ec ); } -# else - m_status = boost::filesystem2::status( m_path, ec ); -# endif - } - else ec = boost::system::error_code();; - return m_status; - } - - template<class Path> - file_status - basic_directory_entry<Path>::symlink_status() const - { -# ifndef BOOST_WINDOWS_API - if ( !status_known( m_symlink_status ) ) - { m_symlink_status = boost::filesystem2::symlink_status( m_path ); } - return m_symlink_status; -# else - return status(); -# endif - } - - template<class Path> - file_status - basic_directory_entry<Path>::symlink_status( system::error_code & ec ) const - { -# ifndef BOOST_WINDOWS_API - if ( !status_known( m_symlink_status ) ) - { m_symlink_status = boost::filesystem2::symlink_status( m_path, ec ); } - else ec = boost::system::error_code();; - return m_symlink_status; -# else - return status( ec ); -# endif - } - } // namespace filesystem2 -} // namespace boost - -#undef BOOST_FS_FUNC - -//----------------------------------------------------------------------------// - -namespace boost -{ - namespace filesystem - { - using filesystem2::basic_directory_entry; - using filesystem2::basic_directory_iterator; - using filesystem2::block_file; - using filesystem2::character_file; - using filesystem2::complete; - using filesystem2::copy_file; - using filesystem2::copy_option; - using filesystem2::create_directory; -# if !defined(BOOST_WINDOWS_API) || defined(BOOST_FS_HARD_LINK) - using filesystem2::create_hard_link; -# endif - using filesystem2::create_symlink; - using filesystem2::current_path; - using filesystem2::directory_entry; - using filesystem2::directory_file; - using filesystem2::directory_iterator; - using filesystem2::equivalent; - using filesystem2::exists; - using filesystem2::fifo_file; - using filesystem2::file_not_found; - using filesystem2::file_size; - using filesystem2::file_status; - using filesystem2::file_type; - using filesystem2::initial_path; - using filesystem2::is_directory; - using filesystem2::is_directory; - using filesystem2::is_empty; - using filesystem2::is_other; - using filesystem2::is_regular_file; - using filesystem2::is_symlink; - using filesystem2::last_write_time; - using filesystem2::regular_file; - using filesystem2::remove; - using filesystem2::remove_all; - using filesystem2::rename; - using filesystem2::socket_file; - using filesystem2::space; - using filesystem2::space_info; - using filesystem2::status; - using filesystem2::status_known; - using filesystem2::symlink_file; - using filesystem2::symlink_status; - using filesystem2::system_complete; - using filesystem2::type_unknown; -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED - using filesystem2::is_regular; - using filesystem2::symbolic_link_exists; -# endif -# ifndef BOOST_FILESYSTEM2_NARROW_ONLY - using filesystem2::wdirectory_iterator; - using filesystem2::wdirectory_entry; -# endif - namespace detail - { - using filesystem2::detail::not_found_error; - using filesystem2::detail::possible_large_file_size_support; - } - } -} - -#include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas -#endif // BOOST_FILESYSTEM2_OPERATIONS_HPP diff --git a/3rdParty/Boost/src/boost/filesystem/v2/path.hpp b/3rdParty/Boost/src/boost/filesystem/v2/path.hpp deleted file mode 100644 index 615b89c..0000000 --- a/3rdParty/Boost/src/boost/filesystem/v2/path.hpp +++ /dev/null @@ -1,1571 +0,0 @@ -// boost/filesystem/path.hpp -----------------------------------------------// - -// Copyright Beman Dawes 2002-2005 -// Copyright Vladimir Prus 2002 - -// 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) - -// See library home page at http://www.boost.org/libs/filesystem - -// basic_path's stem(), extension(), and replace_extension() are based on -// basename(), extension(), and change_extension() from the original -// filesystem/convenience.hpp header by Vladimir Prus. - -//----------------------------------------------------------------------------// - -#ifndef BOOST_FILESYSTEM2_PATH_HPP -#define BOOST_FILESYSTEM2_PATH_HPP - -#include <boost/filesystem/v2/config.hpp> -#include <boost/system/system_error.hpp> -#include <boost/iterator/iterator_facade.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/type_traits/is_same.hpp> -#include <boost/static_assert.hpp> -#include <boost/assert.hpp> - -#include <string> -#include <algorithm> // for lexicographical_compare -#include <iosfwd> // needed by basic_path inserter and extractor -#include <stdexcept> - -# ifndef BOOST_FILESYSTEM2_NARROW_ONLY -# include <locale> -# endif - -#include <boost/config/abi_prefix.hpp> // must be the last #include - -namespace boost -{ - namespace BOOST_FILESYSTEM2_NAMESPACE - { - template<class String, class Traits> class basic_path; - - struct path_traits; - typedef basic_path< std::string, path_traits > path; - - struct path_traits - { - typedef std::string internal_string_type; - typedef std::string external_string_type; - static external_string_type to_external( const path &, - const internal_string_type & src ) { return src; } - static internal_string_type to_internal( - const external_string_type & src ) { return src; } - }; - -# ifndef BOOST_FILESYSTEM2_NARROW_ONLY - - struct BOOST_FILESYSTEM_DECL wpath_traits; - - typedef basic_path< std::wstring, wpath_traits > wpath; - - struct BOOST_FILESYSTEM_DECL wpath_traits - { - typedef std::wstring internal_string_type; -# ifdef BOOST_WINDOWS_API - typedef std::wstring external_string_type; - static external_string_type to_external( const wpath &, - const internal_string_type & src ) { return src; } - static internal_string_type to_internal( - const external_string_type & src ) { return src; } -# else - typedef std::string external_string_type; - static external_string_type to_external( const wpath & ph, - const internal_string_type & src ); - static internal_string_type to_internal( - const external_string_type & src ); -# endif - static void imbue( const std::locale & loc ); - static bool imbue( const std::locale & loc, const std::nothrow_t & ); - }; - -# endif // ifndef BOOST_FILESYSTEM2_NARROW_ONLY - - // path traits ---------------------------------------------------------// - - template<class Path> struct is_basic_path - { BOOST_STATIC_CONSTANT( bool, value = false ); }; - template<> struct is_basic_path<path> - { BOOST_STATIC_CONSTANT( bool, value = true ); }; -# ifndef BOOST_FILESYSTEM2_NARROW_ONLY - template<> struct is_basic_path<wpath> - { BOOST_STATIC_CONSTANT( bool, value = true ); }; -# endif - - // These only have to be specialized if Path::string_type::value_type - // is not convertible from char, although specializations may eliminate - // compiler warnings. See ticket 2543. - template<class Path> struct slash - { BOOST_STATIC_CONSTANT( char, value = '/' ); }; - - template<class Path> struct dot - { BOOST_STATIC_CONSTANT( char, value = '.' ); }; - - template<class Path> struct colon - { BOOST_STATIC_CONSTANT( char, value = ':' ); }; - -# ifndef BOOST_FILESYSTEM2_NARROW_ONLY - template<> struct slash<wpath> - { BOOST_STATIC_CONSTANT( wchar_t, value = L'/' ); }; - template<> struct dot<wpath> - { BOOST_STATIC_CONSTANT( wchar_t, value = L'.' ); }; - template<> struct colon<wpath> - { BOOST_STATIC_CONSTANT( wchar_t, value = L':' ); }; -# endif - -# ifdef BOOST_WINDOWS_PATH - template<class Path> struct path_alt_separator - { BOOST_STATIC_CONSTANT( char, value = '\\' ); }; -# ifndef BOOST_FILESYSTEM2_NARROW_ONLY - template<> struct path_alt_separator<wpath> - { BOOST_STATIC_CONSTANT( wchar_t, value = L'\\' ); }; -# endif -# endif - - // workaround for VC++ 7.0 and earlier issues with nested classes - namespace detail - { - template<class Path> - class iterator_helper - { - public: - typedef typename Path::iterator iterator; - static void do_increment( iterator & ph ); - static void do_decrement( iterator & ph ); - }; - } - - // basic_path ----------------------------------------------------------// - - template<class String, class Traits> - class basic_path - { - // invariant: m_path valid according to the portable generic path grammar - - // validate template arguments -// TODO: get these working -// BOOST_STATIC_ASSERT( ::boost::is_same<String,typename Traits::internal_string_type>::value ); -// BOOST_STATIC_ASSERT( ::boost::is_same<typename Traits::external_string_type,std::string>::value || ::boost::is_same<typename Traits::external_string_type,std::wstring>::value ); - - public: - // compiler generates copy constructor and copy assignment - - typedef basic_path<String, Traits> path_type; - typedef String string_type; - typedef typename String::value_type value_type; - typedef Traits traits_type; - typedef typename Traits::external_string_type external_string_type; - - // constructors/destructor - basic_path() {} - basic_path( const string_type & s ) { operator/=( s ); } - basic_path( const value_type * s ) { operator/=( s ); } -# ifndef BOOST_NO_MEMBER_TEMPLATES - template <class InputIterator> - basic_path( InputIterator first, InputIterator last ) - { append( first, last ); } -# endif - ~basic_path() {} - - // assignments - basic_path & operator=( const string_type & s ) - { -# if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, >= 310) - m_path.clear(); -# else - m_path.erase( m_path.begin(), m_path.end() ); -# endif - operator/=( s ); - return *this; - } - basic_path & operator=( const value_type * s ) - { -# if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, >= 310) - m_path.clear(); -# else - m_path.erase( m_path.begin(), m_path.end() ); -# endif - operator/=( s ); - return *this; - } -# ifndef BOOST_NO_MEMBER_TEMPLATES - template <class InputIterator> - basic_path & assign( InputIterator first, InputIterator last ) - { m_path.clear(); append( first, last ); return *this; } -# endif - - // modifiers - basic_path & operator/=( const basic_path & rhs ) { return operator /=( rhs.string().c_str() ); } - basic_path & operator/=( const string_type & rhs ) { return operator /=( rhs.c_str() ); } - basic_path & operator/=( const value_type * s ); -# ifndef BOOST_NO_MEMBER_TEMPLATES - template <class InputIterator> - basic_path & append( InputIterator first, InputIterator last ); -# endif - - void clear() - { -# if BOOST_WORKAROUND(BOOST_DINKUMWARE_STDLIB, >= 310) - m_path.clear(); -# else - m_path.erase( m_path.begin(), m_path.end() ); -# endif - } - - void swap( basic_path & rhs ) - { - m_path.swap( rhs.m_path ); -# ifdef BOOST_CYGWIN_PATH - std::swap( m_cygwin_root, rhs.m_cygwin_root ); -# endif - } - - basic_path & remove_filename(); - basic_path & replace_extension( const string_type & new_extension = string_type() ); - -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED - basic_path & remove_leaf() { return remove_filename(); } -# endif - - // observers - const string_type & string() const { return m_path; } - const string_type file_string() const; - const string_type directory_string() const { return file_string(); } - - const external_string_type external_file_string() const { return Traits::to_external( *this, file_string() ); } - const external_string_type external_directory_string() const { return Traits::to_external( *this, directory_string() ); } - - basic_path root_path() const; - string_type root_name() const; - string_type root_directory() const; - basic_path relative_path() const; - basic_path parent_path() const; - string_type filename() const; - string_type stem() const; - string_type extension() const; - -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED - string_type leaf() const { return filename(); } - basic_path branch_path() const { return parent_path(); } - bool has_leaf() const { return !m_path.empty(); } - bool has_branch_path() const { return !parent_path().empty(); } -# endif - - bool empty() const { return m_path.empty(); } // name consistent with std containers - bool is_complete() const; - bool has_root_path() const; - bool has_root_name() const; - bool has_root_directory() const; - bool has_relative_path() const { return !relative_path().empty(); } - bool has_filename() const { return !m_path.empty(); } - bool has_parent_path() const { return !parent_path().empty(); } - - // iterators - class iterator : public boost::iterator_facade< - iterator, - string_type const, - boost::bidirectional_traversal_tag > - { - private: - friend class boost::iterator_core_access; - friend class boost::BOOST_FILESYSTEM2_NAMESPACE::basic_path<String, Traits>; - - const string_type & dereference() const - { return m_name; } - bool equal( const iterator & rhs ) const - { return m_path_ptr == rhs.m_path_ptr && m_pos == rhs.m_pos; } - - friend class boost::BOOST_FILESYSTEM2_NAMESPACE::detail::iterator_helper<path_type>; - - void increment() - { - boost::BOOST_FILESYSTEM2_NAMESPACE::detail::iterator_helper<path_type>::do_increment( - *this ); - } - void decrement() - { - boost::BOOST_FILESYSTEM2_NAMESPACE::detail::iterator_helper<path_type>::do_decrement( - *this ); - } - - string_type m_name; // current element - const basic_path * m_path_ptr; // path being iterated over - typename string_type::size_type m_pos; // position of name in - // path_ptr->string(). The - // end() iterator is indicated by - // pos == path_ptr->m_path.size() - }; // iterator - - typedef iterator const_iterator; - - iterator begin() const; - iterator end() const; - - private: - // Note: This is an implementation for POSIX and Windows, where there - // are only minor differences between generic and native path grammars. - // Private members might be quite different in other implementations, - // particularly where there were wide differences between portable and - // native path formats, or between file_string() and - // directory_string() formats, or simply that the implementation - // was willing expend additional memory to achieve greater speed for - // some operations at the expense of other operations. - - string_type m_path; // invariant: portable path grammar - // on Windows, backslashes converted to slashes - -# ifdef BOOST_CYGWIN_PATH - bool m_cygwin_root; // if present, m_path[0] was slash. note: initialization - // done by append -# endif - - void m_append_separator_if_needed(); - void m_append( value_type value ); // converts Windows alt_separator - - // Was qualified; como433beta8 reports: - // warning #427-D: qualified name is not allowed in member declaration - friend class iterator; - friend class boost::BOOST_FILESYSTEM2_NAMESPACE::detail::iterator_helper<path_type>; - - // Deprecated features ease transition for existing code. Don't use these - // in new code. -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED - public: - typedef bool (*name_check)( const std::string & name ); - basic_path( const string_type & str, name_check ) { operator/=( str ); } - basic_path( const typename string_type::value_type * s, name_check ) - { operator/=( s );} - string_type native_file_string() const { return file_string(); } - string_type native_directory_string() const { return directory_string(); } - static bool default_name_check_writable() { return false; } - static void default_name_check( name_check ) {} - static name_check default_name_check() { return 0; } - basic_path & canonize(); - basic_path & normalize(); -# endif - }; - - // basic_path non-member functions ---------------------------------------// - - template< class String, class Traits > - inline void swap( basic_path<String, Traits> & lhs, - basic_path<String, Traits> & rhs ) { lhs.swap( rhs ); } - - template< class String, class Traits > - bool operator<( const basic_path<String, Traits> & lhs, const basic_path<String, Traits> & rhs ) - { - return std::lexicographical_compare( - lhs.begin(), lhs.end(), rhs.begin(), rhs.end() ); - } - - template< class String, class Traits > - bool operator<( const typename basic_path<String, Traits>::string_type::value_type * lhs, - const basic_path<String, Traits> & rhs ) - { - basic_path<String, Traits> tmp( lhs ); - return std::lexicographical_compare( - tmp.begin(), tmp.end(), rhs.begin(), rhs.end() ); - } - - template< class String, class Traits > - bool operator<( const typename basic_path<String, Traits>::string_type & lhs, - const basic_path<String, Traits> & rhs ) - { - basic_path<String, Traits> tmp( lhs ); - return std::lexicographical_compare( - tmp.begin(), tmp.end(), rhs.begin(), rhs.end() ); - } - - template< class String, class Traits > - bool operator<( const basic_path<String, Traits> & lhs, - const typename basic_path<String, Traits>::string_type::value_type * rhs ) - { - basic_path<String, Traits> tmp( rhs ); - return std::lexicographical_compare( - lhs.begin(), lhs.end(), tmp.begin(), tmp.end() ); - } - - template< class String, class Traits > - bool operator<( const basic_path<String, Traits> & lhs, - const typename basic_path<String, Traits>::string_type & rhs ) - { - basic_path<String, Traits> tmp( rhs ); - return std::lexicographical_compare( - lhs.begin(), lhs.end(), tmp.begin(), tmp.end() ); - } - - // operator == uses hand-written compare rather than !(lhs < rhs) && !(rhs < lhs) - // because the result is the same yet the direct compare is much more efficient - // than lexicographical_compare, which would also be called twice. - - template< class String, class Traits > - inline bool operator==( const basic_path<String, Traits> & lhs, - const typename basic_path<String, Traits>::string_type::value_type * rhs ) - { - typedef typename - boost::BOOST_FILESYSTEM2_NAMESPACE::basic_path<String, Traits> path_type; - const typename path_type::string_type::value_type * l (lhs.string().c_str()); - while ( (*l == *rhs -# ifdef BOOST_WINDOWS_PATH - || (*l == path_alt_separator<path_type>::value && *rhs == slash<path_type>::value) - || (*l == slash<path_type>::value && *rhs == path_alt_separator<path_type>::value) -# endif - ) && *l ) { ++l; ++rhs; } - return *l == *rhs -# ifdef BOOST_WINDOWS_PATH - || (*l == path_alt_separator<path_type>::value && *rhs == slash<path_type>::value) - || (*l == slash<path_type>::value && *rhs == path_alt_separator<path_type>::value) -# endif - ; - } - - template< class String, class Traits > - inline bool operator==( const basic_path<String, Traits> & lhs, - const basic_path<String, Traits> & rhs ) - { - return lhs == rhs.string().c_str(); - } - - template< class String, class Traits > - inline bool operator==( const typename basic_path<String, Traits>::string_type::value_type * lhs, - const basic_path<String, Traits> & rhs ) - { - return rhs == lhs; - } - - template< class String, class Traits > - inline bool operator==( const typename basic_path<String, Traits>::string_type & lhs, - const basic_path<String, Traits> & rhs ) - { - return rhs == lhs.c_str(); - } - - template< class String, class Traits > - inline bool operator==( const basic_path<String, Traits> & lhs, - const typename basic_path<String, Traits>::string_type & rhs ) - { - return lhs == rhs.c_str(); - } - - template< class String, class Traits > - inline bool operator!=( const basic_path<String, Traits> & lhs, - const basic_path<String, Traits> & rhs ) - { return !(lhs == rhs); } - - template< class String, class Traits > - inline bool operator!=( const typename basic_path<String, - Traits>::string_type::value_type * lhs, - const basic_path<String, Traits> & rhs ) - { return !(lhs == rhs); } - - template< class String, class Traits > - inline bool operator!=( const typename basic_path<String, Traits>::string_type & lhs, - const basic_path<String, Traits> & rhs ) - { return !(lhs == rhs); } - - template< class String, class Traits > - inline bool operator!=( const basic_path<String, Traits> & lhs, - const typename basic_path<String, Traits>::string_type::value_type * rhs ) - { return !(lhs == rhs); } - - template< class String, class Traits > - inline bool operator!=( const basic_path<String, Traits> & lhs, - const typename basic_path<String, Traits>::string_type & rhs ) - { return !(lhs == rhs); } - - template< class String, class Traits > - inline bool operator>( const basic_path<String, Traits> & lhs, const basic_path<String, Traits> & rhs ) { return rhs < lhs; } - - template< class String, class Traits > - inline bool operator>( const typename basic_path<String, Traits>::string_type::value_type * lhs, - const basic_path<String, Traits> & rhs ) { return rhs < basic_path<String, Traits>(lhs); } - - template< class String, class Traits > - inline bool operator>( const typename basic_path<String, Traits>::string_type & lhs, - const basic_path<String, Traits> & rhs ) { return rhs < basic_path<String, Traits>(lhs); } - - template< class String, class Traits > - inline bool operator>( const basic_path<String, Traits> & lhs, - const typename basic_path<String, Traits>::string_type::value_type * rhs ) - { return basic_path<String, Traits>(rhs) < lhs; } - - template< class String, class Traits > - inline bool operator>( const basic_path<String, Traits> & lhs, - const typename basic_path<String, Traits>::string_type & rhs ) - { return basic_path<String, Traits>(rhs) < lhs; } - - template< class String, class Traits > - inline bool operator<=( const basic_path<String, Traits> & lhs, const basic_path<String, Traits> & rhs ) { return !(rhs < lhs); } - - template< class String, class Traits > - inline bool operator<=( const typename basic_path<String, Traits>::string_type::value_type * lhs, - const basic_path<String, Traits> & rhs ) { return !(rhs < basic_path<String, Traits>(lhs)); } - - template< class String, class Traits > - inline bool operator<=( const typename basic_path<String, Traits>::string_type & lhs, - const basic_path<String, Traits> & rhs ) { return !(rhs < basic_path<String, Traits>(lhs)); } - - template< class String, class Traits > - inline bool operator<=( const basic_path<String, Traits> & lhs, - const typename basic_path<String, Traits>::string_type::value_type * rhs ) - { return !(basic_path<String, Traits>(rhs) < lhs); } - - template< class String, class Traits > - inline bool operator<=( const basic_path<String, Traits> & lhs, - const typename basic_path<String, Traits>::string_type & rhs ) - { return !(basic_path<String, Traits>(rhs) < lhs); } - - template< class String, class Traits > - inline bool operator>=( const basic_path<String, Traits> & lhs, const basic_path<String, Traits> & rhs ) { return !(lhs < rhs); } - - template< class String, class Traits > - inline bool operator>=( const typename basic_path<String, Traits>::string_type::value_type * lhs, - const basic_path<String, Traits> & rhs ) { return !(lhs < basic_path<String, Traits>(rhs)); } - - template< class String, class Traits > - inline bool operator>=( const typename basic_path<String, Traits>::string_type & lhs, - const basic_path<String, Traits> & rhs ) { return !(lhs < basic_path<String, Traits>(rhs)); } - - template< class String, class Traits > - inline bool operator>=( const basic_path<String, Traits> & lhs, - const typename basic_path<String, Traits>::string_type::value_type * rhs ) - { return !(basic_path<String, Traits>(lhs) < rhs); } - - template< class String, class Traits > - inline bool operator>=( const basic_path<String, Traits> & lhs, - const typename basic_path<String, Traits>::string_type & rhs ) - { return !(basic_path<String, Traits>(lhs) < rhs); } - - // operator / - - template< class String, class Traits > - inline basic_path<String, Traits> operator/( - const basic_path<String, Traits> & lhs, - const basic_path<String, Traits> & rhs ) - { return basic_path<String, Traits>( lhs ) /= rhs; } - - template< class String, class Traits > - inline basic_path<String, Traits> operator/( - const basic_path<String, Traits> & lhs, - const typename String::value_type * rhs ) - { return basic_path<String, Traits>( lhs ) /= - basic_path<String, Traits>( rhs ); } - - template< class String, class Traits > - inline basic_path<String, Traits> operator/( - const basic_path<String, Traits> & lhs, const String & rhs ) - { return basic_path<String, Traits>( lhs ) /= - basic_path<String, Traits>( rhs ); } - - template< class String, class Traits > - inline basic_path<String, Traits> operator/( - const typename String::value_type * lhs, - const basic_path<String, Traits> & rhs ) - { return basic_path<String, Traits>( lhs ) /= rhs; } - - template< class String, class Traits > - inline basic_path<String, Traits> operator/( - const String & lhs, const basic_path<String, Traits> & rhs ) - { return basic_path<String, Traits>( lhs ) /= rhs; } - - // inserters and extractors --------------------------------------------// - -// bypass VC++ 7.0 and earlier, and broken Borland compilers -# if !BOOST_WORKAROUND(BOOST_MSVC, <= 1300) && !BOOST_WORKAROUND(__BORLANDC__, < 0x610) - template< class Path > - std::basic_ostream< typename Path::string_type::value_type, - typename Path::string_type::traits_type > & - operator<< - ( std::basic_ostream< typename Path::string_type::value_type, - typename Path::string_type::traits_type >& os, const Path & ph ) - { - os << ph.string(); - return os; - } - - template< class Path > - std::basic_istream< typename Path::string_type::value_type, - typename Path::string_type::traits_type > & - operator>> - ( std::basic_istream< typename Path::string_type::value_type, - typename Path::string_type::traits_type >& is, Path & ph ) - { - typename Path::string_type str; - std::getline(is, str); // See ticket 3863 - ph = str; - return is; - } -# elif BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) - template< class String, class Traits > - std::basic_ostream< BOOST_DEDUCED_TYPENAME String::value_type, - BOOST_DEDUCED_TYPENAME String::traits_type > & - operator<< - ( std::basic_ostream< BOOST_DEDUCED_TYPENAME String::value_type, - BOOST_DEDUCED_TYPENAME String::traits_type >& os, - const basic_path< String, Traits > & ph ) - { - os << ph.string(); - return os; - } - - template< class String, class Traits > - std::basic_istream< BOOST_DEDUCED_TYPENAME String::value_type, - BOOST_DEDUCED_TYPENAME String::traits_type > & - operator>> - ( std::basic_istream< BOOST_DEDUCED_TYPENAME String::value_type, - BOOST_DEDUCED_TYPENAME String::traits_type> & is, - basic_path< String, Traits > & ph ) - { - String str; - std::getline(is, str); // See ticket 3863 - ph = str; - return is; - } -# endif - - // basic_filesystem_error helpers --------------------------------------// - - // Originally choice of implementation was done via specialization of - // basic_filesystem_error::what(). Several compilers (GCC, aCC, etc.) - // couldn't handle that, so the choice is now accomplished by overloading. - - namespace detail - { - // BOOST_FILESYSTEM_DECL version works for VC++ but not GCC. Go figure! - inline - const char * what( const char * sys_err_what, - const path & path1_arg, const path & path2_arg, std::string & target ) - { - try - { - if ( target.empty() ) - { - target = sys_err_what; - if ( !path1_arg.empty() ) - { - target += ": \""; - target += path1_arg.file_string(); - target += "\""; - } - if ( !path2_arg.empty() ) - { - target += ", \""; - target += path2_arg.file_string(); - target += "\""; - } - } - return target.c_str(); - } - catch (...) - { - return sys_err_what; - } - } - - template<class Path> - const char * what( const char * sys_err_what, - const Path & /*path1_arg*/, const Path & /*path2_arg*/, std::string & /*target*/ ) - { - return sys_err_what; - } - } - - // basic_filesystem_error ----------------------------------------------// - - template<class Path> - class basic_filesystem_error : public system::system_error - { - // see http://www.boost.org/more/error_handling.html for design rationale - public: - // compiler generates copy constructor and copy assignment - - typedef Path path_type; - - basic_filesystem_error( const std::string & what_arg, - system::error_code ec ); - - basic_filesystem_error( const std::string & what_arg, - const path_type & path1_arg, system::error_code ec ); - - basic_filesystem_error( const std::string & what_arg, const path_type & path1_arg, - const path_type & path2_arg, system::error_code ec ); - - ~basic_filesystem_error() throw() {} - - const path_type & path1() const - { - static const path_type empty_path; - return m_imp_ptr.get() ? m_imp_ptr->m_path1 : empty_path ; - } - const path_type & path2() const - { - static const path_type empty_path; - return m_imp_ptr.get() ? m_imp_ptr->m_path2 : empty_path ; - } - - const char * what() const throw() - { - if ( !m_imp_ptr.get() ) - return system::system_error::what(); - return detail::what( system::system_error::what(), m_imp_ptr->m_path1, - m_imp_ptr->m_path2, m_imp_ptr->m_what ); - } - - private: - struct m_imp - { - path_type m_path1; // may be empty() - path_type m_path2; // may be empty() - std::string m_what; // not built until needed - }; - boost::shared_ptr<m_imp> m_imp_ptr; - }; - - typedef basic_filesystem_error<path> filesystem_error; - -# ifndef BOOST_FILESYSTEM2_NARROW_ONLY - typedef basic_filesystem_error<wpath> wfilesystem_error; -# endif - - // path::name_checks -----------------------------------------------------// - - BOOST_FILESYSTEM_DECL bool portable_posix_name( const std::string & name ); - BOOST_FILESYSTEM_DECL bool windows_name( const std::string & name ); - BOOST_FILESYSTEM_DECL bool portable_name( const std::string & name ); - BOOST_FILESYSTEM_DECL bool portable_directory_name( const std::string & name ); - BOOST_FILESYSTEM_DECL bool portable_file_name( const std::string & name ); - BOOST_FILESYSTEM_DECL bool native( const std::string & name ); - inline bool no_check( const std::string & ) - { return true; } - -// implementation -----------------------------------------------------------// - - namespace detail - { - - // is_separator helper ------------------------------------------------// - - template<class Path> - inline bool is_separator( typename Path::string_type::value_type c ) - { - return c == slash<Path>::value -# ifdef BOOST_WINDOWS_PATH - || c == path_alt_separator<Path>::value -# endif - ; - } - - // filename_pos helper ----------------------------------------------------// - - template<class String, class Traits> - typename String::size_type filename_pos( - const String & str, // precondition: portable generic path grammar - typename String::size_type end_pos ) // end_pos is past-the-end position - // return 0 if str itself is filename (or empty) - { - typedef typename - boost::BOOST_FILESYSTEM2_NAMESPACE::basic_path<String, Traits> path_type; - - // case: "//" - if ( end_pos == 2 - && str[0] == slash<path_type>::value - && str[1] == slash<path_type>::value ) return 0; - - // case: ends in "/" - if ( end_pos && str[end_pos-1] == slash<path_type>::value ) - return end_pos-1; - - // set pos to start of last element - typename String::size_type pos( - str.find_last_of( slash<path_type>::value, end_pos-1 ) ); -# ifdef BOOST_WINDOWS_PATH - if ( pos == String::npos ) - pos = str.find_last_of( path_alt_separator<path_type>::value, end_pos-1 ); - if ( pos == String::npos ) - pos = str.find_last_of( colon<path_type>::value, end_pos-2 ); -# endif - - return ( pos == String::npos // path itself must be a filename (or empty) - || (pos == 1 && str[0] == slash<path_type>::value) ) // or net - ? 0 // so filename is entire string - : pos + 1; // or starts after delimiter - } - - // first_element helper -----------------------------------------------// - // sets pos and len of first element, excluding extra separators - // if src.empty(), sets pos,len, to 0,0. - - template<class String, class Traits> - void first_element( - const String & src, // precondition: portable generic path grammar - typename String::size_type & element_pos, - typename String::size_type & element_size, -# if !BOOST_WORKAROUND( BOOST_MSVC, <= 1310 ) // VC++ 7.1 - typename String::size_type size = String::npos -# else - typename String::size_type size = -1 -# endif - ) - { - if ( size == String::npos ) size = src.size(); - element_pos = 0; - element_size = 0; - if ( src.empty() ) return; - - typedef typename boost::BOOST_FILESYSTEM2_NAMESPACE::basic_path<String, Traits> path_type; - - typename String::size_type cur(0); - - // deal with // [network] - if ( size >= 2 && src[0] == slash<path_type>::value - && src[1] == slash<path_type>::value - && (size == 2 - || src[2] != slash<path_type>::value) ) - { - cur += 2; - element_size += 2; - } - - // leading (not non-network) separator - else if ( src[0] == slash<path_type>::value ) - { - ++element_size; - // bypass extra leading separators - while ( cur+1 < size - && src[cur+1] == slash<path_type>::value ) - { - ++cur; - ++element_pos; - } - return; - } - - // at this point, we have either a plain name, a network name, - // or (on Windows only) a device name - - // find the end - while ( cur < size -# ifdef BOOST_WINDOWS_PATH - && src[cur] != colon<path_type>::value -# endif - && src[cur] != slash<path_type>::value ) - { - ++cur; - ++element_size; - } - -# ifdef BOOST_WINDOWS_PATH - if ( cur == size ) return; - // include device delimiter - if ( src[cur] == colon<path_type>::value ) - { ++element_size; } -# endif - - return; - } - - // root_directory_start helper ----------------------------------------// - - template<class String, class Traits> - typename String::size_type root_directory_start( - const String & s, // precondition: portable generic path grammar - typename String::size_type size ) - // return npos if no root_directory found - { - typedef typename boost::BOOST_FILESYSTEM2_NAMESPACE::basic_path<String, Traits> path_type; - -# ifdef BOOST_WINDOWS_PATH - // case "c:/" - if ( size > 2 - && s[1] == colon<path_type>::value - && s[2] == slash<path_type>::value ) return 2; -# endif - - // case "//" - if ( size == 2 - && s[0] == slash<path_type>::value - && s[1] == slash<path_type>::value ) return String::npos; - - // case "//net {/}" - if ( size > 3 - && s[0] == slash<path_type>::value - && s[1] == slash<path_type>::value - && s[2] != slash<path_type>::value ) - { - typename String::size_type pos( - s.find( slash<path_type>::value, 2 ) ); - return pos < size ? pos : String::npos; - } - - // case "/" - if ( size > 0 && s[0] == slash<path_type>::value ) return 0; - - return String::npos; - } - - // is_non_root_slash helper -------------------------------------------// - - template<class String, class Traits> - bool is_non_root_slash( const String & str, - typename String::size_type pos ) // pos is position of the slash - { - typedef typename - boost::BOOST_FILESYSTEM2_NAMESPACE::basic_path<String, Traits> - path_type; - - BOOST_ASSERT( !str.empty() && str[pos] == slash<path_type>::value - && "precondition violation" ); - - // subsequent logic expects pos to be for leftmost slash of a set - while ( pos > 0 && str[pos-1] == slash<path_type>::value ) - --pos; - - return pos != 0 - && (pos <= 2 || str[1] != slash<path_type>::value - || str.find( slash<path_type>::value, 2 ) != pos) -# ifdef BOOST_WINDOWS_PATH - && (pos !=2 || str[1] != colon<path_type>::value) -# endif - ; - } - } // namespace detail - - // decomposition functions ----------------------------------------------// - - template<class String, class Traits> - String basic_path<String, Traits>::filename() const - { - typename String::size_type end_pos( - detail::filename_pos<String, Traits>( m_path, m_path.size() ) ); - return (m_path.size() - && end_pos - && m_path[end_pos] == slash<path_type>::value - && detail::is_non_root_slash< String, Traits >(m_path, end_pos)) - ? String( 1, dot<path_type>::value ) - : m_path.substr( end_pos ); - } - - template<class String, class Traits> - String basic_path<String, Traits>::stem() const - { - string_type name = filename(); - typename string_type::size_type n = name.rfind(dot<path_type>::value); - return name.substr(0, n); - } - - template<class String, class Traits> - String basic_path<String, Traits>::extension() const - { - string_type name = filename(); - typename string_type::size_type n = name.rfind(dot<path_type>::value); - if (n != string_type::npos) - return name.substr(n); - else - return string_type(); - } - - template<class String, class Traits> - basic_path<String, Traits> basic_path<String, Traits>::parent_path() const - { - typename String::size_type end_pos( - detail::filename_pos<String, Traits>( m_path, m_path.size() ) ); - - bool filename_was_separator( m_path.size() - && m_path[end_pos] == slash<path_type>::value ); - - // skip separators unless root directory - typename string_type::size_type root_dir_pos( detail::root_directory_start - <string_type, traits_type>( m_path, end_pos ) ); - for ( ; - end_pos > 0 - && (end_pos-1) != root_dir_pos - && m_path[end_pos-1] == slash<path_type>::value - ; - --end_pos ) {} - - return (end_pos == 1 && root_dir_pos == 0 && filename_was_separator) - ? path_type() - : path_type( m_path.substr( 0, end_pos ) ); - } - - template<class String, class Traits> - basic_path<String, Traits> basic_path<String, Traits>::relative_path() const - { - iterator itr( begin() ); - for ( ; itr.m_pos != m_path.size() - && (itr.m_name[0] == slash<path_type>::value -# ifdef BOOST_WINDOWS_PATH - || itr.m_name[itr.m_name.size()-1] - == colon<path_type>::value -# endif - ); ++itr ) {} - - return basic_path<String, Traits>( m_path.substr( itr.m_pos ) ); - } - - template<class String, class Traits> - String basic_path<String, Traits>::root_name() const - { - iterator itr( begin() ); - - return ( itr.m_pos != m_path.size() - && ( - ( itr.m_name.size() > 1 - && itr.m_name[0] == slash<path_type>::value - && itr.m_name[1] == slash<path_type>::value - ) -# ifdef BOOST_WINDOWS_PATH - || itr.m_name[itr.m_name.size()-1] - == colon<path_type>::value -# endif - ) ) - ? *itr - : String(); - } - - template<class String, class Traits> - String basic_path<String, Traits>::root_directory() const - { - typename string_type::size_type start( - detail::root_directory_start<String, Traits>( m_path, m_path.size() ) ); - - return start == string_type::npos - ? string_type() - : m_path.substr( start, 1 ); - } - - template<class String, class Traits> - basic_path<String, Traits> basic_path<String, Traits>::root_path() const - { - // even on POSIX, root_name() is non-empty() on network paths - return basic_path<String, Traits>( root_name() ) /= root_directory(); - } - - // path query functions -------------------------------------------------// - - template<class String, class Traits> - inline bool basic_path<String, Traits>::is_complete() const - { -# ifdef BOOST_WINDOWS_PATH - return has_root_name() && has_root_directory(); -# else - return has_root_directory(); -# endif - } - - template<class String, class Traits> - inline bool basic_path<String, Traits>::has_root_path() const - { - return !root_path().empty(); - } - - template<class String, class Traits> - inline bool basic_path<String, Traits>::has_root_name() const - { - return !root_name().empty(); - } - - template<class String, class Traits> - inline bool basic_path<String, Traits>::has_root_directory() const - { - return !root_directory().empty(); - } - - // append ---------------------------------------------------------------// - - template<class String, class Traits> - void basic_path<String, Traits>::m_append_separator_if_needed() - // requires: !empty() - { - if ( -# ifdef BOOST_WINDOWS_PATH - *(m_path.end()-1) != colon<path_type>::value && -# endif - *(m_path.end()-1) != slash<path_type>::value ) - { - m_path += slash<path_type>::value; - } - } - - template<class String, class Traits> - void basic_path<String, Traits>::m_append( value_type value ) - { -# ifdef BOOST_CYGWIN_PATH - if ( m_path.empty() ) m_cygwin_root = (value == slash<path_type>::value); -# endif - -# ifdef BOOST_WINDOWS_PATH - // for BOOST_WINDOWS_PATH, convert alt_separator ('\') to separator ('/') - m_path += ( value == path_alt_separator<path_type>::value - ? slash<path_type>::value - : value ); -# else - m_path += value; -# endif - } - - // except that it wouldn't work for BOOST_NO_MEMBER_TEMPLATES compilers, - // the append() member template could replace this code. - template<class String, class Traits> - basic_path<String, Traits> & basic_path<String, Traits>::operator /= - ( const value_type * next_p ) - { - // ignore escape sequence on POSIX or Windows - if ( *next_p == slash<path_type>::value - && *(next_p+1) == slash<path_type>::value - && *(next_p+2) == colon<path_type>::value ) next_p += 3; - - // append slash<path_type>::value if needed - if ( !empty() && *next_p != 0 - && !detail::is_separator<path_type>( *next_p ) ) - { m_append_separator_if_needed(); } - - for ( ; *next_p != 0; ++next_p ) m_append( *next_p ); - return *this; - } - -# ifndef BOOST_NO_MEMBER_TEMPLATES - template<class String, class Traits> template <class InputIterator> - basic_path<String, Traits> & basic_path<String, Traits>::append( - InputIterator first, InputIterator last ) - { - // append slash<path_type>::value if needed - if ( !empty() && first != last - && !detail::is_separator<path_type>( *first ) ) - { m_append_separator_if_needed(); } - - // song-and-dance to avoid violating InputIterator requirements - // (which prohibit lookahead) in detecting a possible escape sequence - // (escape sequences are simply ignored on POSIX and Windows) - bool was_escape_sequence(true); - std::size_t append_count(0); - typename String::size_type initial_pos( m_path.size() ); - - for ( ; first != last && *first; ++first ) - { - if ( append_count == 0 && *first != slash<path_type>::value ) - was_escape_sequence = false; - if ( append_count == 1 && *first != slash<path_type>::value ) - was_escape_sequence = false; - if ( append_count == 2 && *first != colon<path_type>::value ) - was_escape_sequence = false; - m_append( *first ); - ++append_count; - } - - // erase escape sequence if any - if ( was_escape_sequence && append_count >= 3 ) - m_path.erase( initial_pos, 3 ); - - return *this; - } -# endif - -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED - - // canonize ------------------------------------------------------------// - - template<class String, class Traits> - basic_path<String, Traits> & basic_path<String, Traits>::canonize() - { - static const typename string_type::value_type dot_str[] - = { dot<path_type>::value, 0 }; - - if ( m_path.empty() ) return *this; - - path_type temp; - - for ( iterator itr( begin() ); itr != end(); ++itr ) - { - temp /= *itr; - }; - - if ( temp.empty() ) temp /= dot_str; - m_path = temp.m_path; - return *this; - } - - // normalize ------------------------------------------------------------// - - template<class String, class Traits> - basic_path<String, Traits> & basic_path<String, Traits>::normalize() - { - static const typename string_type::value_type dot_str[] - = { dot<path_type>::value, 0 }; - - if ( m_path.empty() ) return *this; - - path_type temp; - iterator start( begin() ); - iterator last( end() ); - iterator stop( last-- ); - for ( iterator itr( start ); itr != stop; ++itr ) - { - // ignore "." except at start and last - if ( itr->size() == 1 - && (*itr)[0] == dot<path_type>::value - && itr != start - && itr != last ) continue; - - // ignore a name and following ".." - if ( !temp.empty() - && itr->size() == 2 - && (*itr)[0] == dot<path_type>::value - && (*itr)[1] == dot<path_type>::value ) // dot dot - { - string_type lf( temp.filename() ); - if ( lf.size() > 0 - && (lf.size() != 1 - || (lf[0] != dot<path_type>::value - && lf[0] != slash<path_type>::value)) - && (lf.size() != 2 - || (lf[0] != dot<path_type>::value - && lf[1] != dot<path_type>::value -# ifdef BOOST_WINDOWS_PATH - && lf[1] != colon<path_type>::value -# endif - ) - ) - ) - { - temp.remove_filename(); - // if not root directory, must also remove "/" if any - if ( temp.m_path.size() > 0 - && temp.m_path[temp.m_path.size()-1] - == slash<path_type>::value ) - { - typename string_type::size_type rds( - detail::root_directory_start<String,Traits>( temp.m_path, - temp.m_path.size() ) ); - if ( rds == string_type::npos - || rds != temp.m_path.size()-1 ) - { temp.m_path.erase( temp.m_path.size()-1 ); } - } - - iterator next( itr ); - if ( temp.empty() && ++next != stop - && next == last && *last == dot_str ) temp /= dot_str; - continue; - } - } - - temp /= *itr; - }; - - if ( temp.empty() ) temp /= dot_str; - m_path = temp.m_path; - return *this; - } - -# endif - - // modifiers ------------------------------------------------------------// - - template<class String, class Traits> - basic_path<String, Traits> & basic_path<String, Traits>::remove_filename() - { - m_path.erase( - detail::filename_pos<String, Traits>( m_path, m_path.size() ) ); - return *this; - } - - template<class String, class Traits> - basic_path<String, Traits> & - basic_path<String, Traits>::replace_extension( const string_type & new_ext ) - { - // erase existing extension if any - string_type old_ext = extension(); - if ( !old_ext.empty() ) - m_path.erase( m_path.size() - old_ext.size() ); - - if ( !new_ext.empty() && new_ext[0] != dot<path_type>::value ) - m_path += dot<path_type>::value; - - m_path += new_ext; - - return *this; - } - - - // path conversion functions --------------------------------------------// - - template<class String, class Traits> - const String - basic_path<String, Traits>::file_string() const - { -# ifdef BOOST_WINDOWS_PATH - // for Windows, use the alternate separator, and bypass extra - // root separators - - typename string_type::size_type root_dir_start( - detail::root_directory_start<String, Traits>( m_path, m_path.size() ) ); - bool in_root( root_dir_start != string_type::npos ); - String s; - for ( typename string_type::size_type pos( 0 ); - pos != m_path.size(); ++pos ) - { - // special case // [net] - if ( pos == 0 && m_path.size() > 1 - && m_path[0] == slash<path_type>::value - && m_path[1] == slash<path_type>::value - && ( m_path.size() == 2 - || !detail::is_separator<path_type>( m_path[2] ) - ) ) - { - ++pos; - s += path_alt_separator<path_type>::value; - s += path_alt_separator<path_type>::value; - continue; - } - - // bypass extra root separators - if ( in_root ) - { - if ( s.size() > 0 - && s[s.size()-1] == path_alt_separator<path_type>::value - && m_path[pos] == slash<path_type>::value - ) continue; - } - - if ( m_path[pos] == slash<path_type>::value ) - s += path_alt_separator<path_type>::value; - else - s += m_path[pos]; - - if ( pos > root_dir_start - && m_path[pos] == slash<path_type>::value ) - { in_root = false; } - } -# ifdef BOOST_CYGWIN_PATH - if ( m_cygwin_root ) s[0] = slash<path_type>::value; -# endif - return s; -# else - return m_path; -# endif - } - - // iterator functions ---------------------------------------------------// - - template<class String, class Traits> - typename basic_path<String, Traits>::iterator basic_path<String, Traits>::begin() const - { - iterator itr; - itr.m_path_ptr = this; - typename string_type::size_type element_size; - detail::first_element<String, Traits>( m_path, itr.m_pos, element_size ); - itr.m_name = m_path.substr( itr.m_pos, element_size ); - return itr; - } - - template<class String, class Traits> - typename basic_path<String, Traits>::iterator basic_path<String, Traits>::end() const - { - iterator itr; - itr.m_path_ptr = this; - itr.m_pos = m_path.size(); - return itr; - } - - namespace detail - { - // do_increment ------------------------------------------------------// - - template<class Path> - void iterator_helper<Path>::do_increment( iterator & itr ) - { - typedef typename Path::string_type string_type; - typedef typename Path::traits_type traits_type; - - BOOST_ASSERT( itr.m_pos < itr.m_path_ptr->m_path.size() && "basic_path::iterator increment past end()" ); - - bool was_net( itr.m_name.size() > 2 - && itr.m_name[0] == slash<Path>::value - && itr.m_name[1] == slash<Path>::value - && itr.m_name[2] != slash<Path>::value ); - - // increment to position past current element - itr.m_pos += itr.m_name.size(); - - // if end reached, create end iterator - if ( itr.m_pos == itr.m_path_ptr->m_path.size() ) - { - itr.m_name.erase( itr.m_name.begin(), itr.m_name.end() ); // VC++ 6.0 lib didn't supply clear() - return; - } - - // process separator (Windows drive spec is only case not a separator) - if ( itr.m_path_ptr->m_path[itr.m_pos] == slash<Path>::value ) - { - // detect root directory - if ( was_net - # ifdef BOOST_WINDOWS_PATH - // case "c:/" - || itr.m_name[itr.m_name.size()-1] == colon<Path>::value - # endif - ) - { - itr.m_name = slash<Path>::value; - return; - } - - // bypass separators - while ( itr.m_pos != itr.m_path_ptr->m_path.size() - && itr.m_path_ptr->m_path[itr.m_pos] == slash<Path>::value ) - { ++itr.m_pos; } - - // detect trailing separator, and treat it as ".", per POSIX spec - if ( itr.m_pos == itr.m_path_ptr->m_path.size() - && detail::is_non_root_slash< string_type, traits_type >( - itr.m_path_ptr->m_path, itr.m_pos-1 ) ) - { - --itr.m_pos; - itr.m_name = dot<Path>::value; - return; - } - } - - // get next element - typename string_type::size_type end_pos( - itr.m_path_ptr->m_path.find( slash<Path>::value, itr.m_pos ) ); - itr.m_name = itr.m_path_ptr->m_path.substr( itr.m_pos, end_pos - itr.m_pos ); - } - - // do_decrement ------------------------------------------------------// - - template<class Path> - void iterator_helper<Path>::do_decrement( iterator & itr ) - { - BOOST_ASSERT( itr.m_pos && "basic_path::iterator decrement past begin()" ); - - typedef typename Path::string_type string_type; - typedef typename Path::traits_type traits_type; - - typename string_type::size_type end_pos( itr.m_pos ); - - typename string_type::size_type root_dir_pos( - detail::root_directory_start<string_type, traits_type>( - itr.m_path_ptr->m_path, end_pos ) ); - - // if at end and there was a trailing non-root '/', return "." - if ( itr.m_pos == itr.m_path_ptr->m_path.size() - && itr.m_path_ptr->m_path.size() > 1 - && itr.m_path_ptr->m_path[itr.m_pos-1] == slash<Path>::value - && detail::is_non_root_slash< string_type, traits_type >( - itr.m_path_ptr->m_path, itr.m_pos-1 ) - ) - { - --itr.m_pos; - itr.m_name = dot<Path>::value; - return; - } - - // skip separators unless root directory - for ( - ; - end_pos > 0 - && (end_pos-1) != root_dir_pos - && itr.m_path_ptr->m_path[end_pos-1] == slash<Path>::value - ; - --end_pos ) {} - - itr.m_pos = detail::filename_pos<string_type, traits_type> - ( itr.m_path_ptr->m_path, end_pos ); - itr.m_name = itr.m_path_ptr->m_path.substr( itr.m_pos, end_pos - itr.m_pos ); - } - } // namespace detail - - // basic_filesystem_error implementation --------------------------------// - - template<class Path> - basic_filesystem_error<Path>::basic_filesystem_error( - const std::string & what_arg, system::error_code ec ) - : system::system_error(ec, what_arg) - { - try - { - m_imp_ptr.reset( new m_imp ); - } - catch (...) { m_imp_ptr.reset(); } - } - - template<class Path> - basic_filesystem_error<Path>::basic_filesystem_error( - const std::string & what_arg, const path_type & path1_arg, - system::error_code ec ) - : system::system_error(ec, what_arg) - { - try - { - m_imp_ptr.reset( new m_imp ); - m_imp_ptr->m_path1 = path1_arg; - } - catch (...) { m_imp_ptr.reset(); } - } - - template<class Path> - basic_filesystem_error<Path>::basic_filesystem_error( - const std::string & what_arg, const path_type & path1_arg, - const path_type & path2_arg, system::error_code ec ) - : system::system_error(ec, what_arg) - { - try - { - m_imp_ptr.reset( new m_imp ); - m_imp_ptr->m_path1 = path1_arg; - m_imp_ptr->m_path2 = path2_arg; - } - catch (...) { m_imp_ptr.reset(); } - } - - } // namespace BOOST_FILESYSTEM2_NAMESPACE -} // namespace boost - -//----------------------------------------------------------------------------// - -namespace boost -{ - namespace filesystem - { - using filesystem2::basic_path; - using filesystem2::path_traits; - - using filesystem2::slash; - using filesystem2::dot; - using filesystem2::colon; - - using filesystem2::path; -# ifndef BOOST_FILESYSTEM2_NARROW_ONLY - using filesystem2::wpath_traits; - using filesystem2::wpath; - using filesystem2::wfilesystem_error; -# endif - using filesystem2::basic_filesystem_error; - using filesystem2::filesystem_error; - using filesystem2::portable_posix_name; - using filesystem2::windows_name; - using filesystem2::portable_name; - using filesystem2::portable_directory_name; - using filesystem2::portable_file_name; - using filesystem2::native; - using filesystem2::no_check; - using filesystem2::swap; - using filesystem2::operator<; - using filesystem2::operator==; - using filesystem2::operator!=; - using filesystem2::operator>; - using filesystem2::operator<=; - using filesystem2::operator>=; - using filesystem2::operator/; - using filesystem2::operator<<; - using filesystem2::operator>>; - } -} - -//----------------------------------------------------------------------------// - -#include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas - -#endif // BOOST_FILESYSTEM2_PATH_HPP diff --git a/3rdParty/Boost/src/boost/filesystem/v3/config.hpp b/3rdParty/Boost/src/boost/filesystem/v3/config.hpp deleted file mode 100644 index 13fc308..0000000 --- a/3rdParty/Boost/src/boost/filesystem/v3/config.hpp +++ /dev/null @@ -1,85 +0,0 @@ -// boost/filesystem/v3/config.hpp ----------------------------------------------------// - -// Copyright Beman Dawes 2003 - -// Distributed under the Boost Software License, Version 1.0. -// See http://www.boost.org/LICENSE_1_0.txt - -// Library home page: http://www.boost.org/libs/filesystem - -//--------------------------------------------------------------------------------------// - -#ifndef BOOST_FILESYSTEM3_CONFIG_HPP -#define BOOST_FILESYSTEM3_CONFIG_HPP - -# if defined(BOOST_FILESYSTEM_VERSION) && BOOST_FILESYSTEM_VERSION != 3 -# error Compiling Filesystem version 3 file with BOOST_FILESYSTEM_VERSION defined != 3 -# endif - -# if !defined(BOOST_FILESYSTEM_VERSION) -# define BOOST_FILESYSTEM_VERSION 3 -# endif - -#define BOOST_FILESYSTEM_I18N // aid users wishing to compile several versions - -// This header implements separate compilation features as described in -// http://www.boost.org/more/separate_compilation.html - -#include <boost/config.hpp> -#include <boost/system/api_config.hpp> // for BOOST_POSIX_API or BOOST_WINDOWS_API -#include <boost/detail/workaround.hpp> - -// BOOST_FILESYSTEM_DEPRECATED needed for source compiles -----------------------------// - -# ifdef BOOST_FILESYSTEM_SOURCE -# define BOOST_FILESYSTEM_DEPRECATED -# endif - -// throw an exception ----------------------------------------------------------------// -// -// Exceptions were originally thrown via boost::throw_exception(). -// As throw_exception() became more complex, it caused user error reporting -// to be harder to interpret, since the exception reported became much more complex. -// The immediate fix was to throw directly, wrapped in a macro to make any later change -// easier. - -#define BOOST_FILESYSTEM_THROW(EX) throw EX - -# if defined( BOOST_NO_STD_WSTRING ) -# error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support -# endif - -// enable dynamic linking -------------------------------------------------------------// - -#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_FILESYSTEM_DYN_LINK) -# if defined(BOOST_FILESYSTEM_SOURCE) -# define BOOST_FILESYSTEM_DECL BOOST_SYMBOL_EXPORT -# else -# define BOOST_FILESYSTEM_DECL BOOST_SYMBOL_IMPORT -# endif -#else -# define BOOST_FILESYSTEM_DECL -#endif - -// enable automatic library variant selection ----------------------------------------// - -#if !defined(BOOST_FILESYSTEM_SOURCE) && !defined(BOOST_ALL_NO_LIB) \ - && !defined(BOOST_FILESYSTEM_NO_LIB) -// -// Set the name of our library, this will get undef'ed by auto_link.hpp -// once it's done with it: -// -#define BOOST_LIB_NAME boost_filesystem -// -// If we're importing code from a dll, then tell auto_link.hpp about it: -// -#if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_FILESYSTEM_DYN_LINK) -# define BOOST_DYN_LINK -#endif -// -// And include the header that does the work: -// -#include <boost/config/auto_link.hpp> -#endif // auto-linking disabled - -#endif // BOOST_FILESYSTEM3_CONFIG_HPP diff --git a/3rdParty/Boost/src/boost/filesystem/v3/convenience.hpp b/3rdParty/Boost/src/boost/filesystem/v3/convenience.hpp deleted file mode 100644 index 1a1f943..0000000 --- a/3rdParty/Boost/src/boost/filesystem/v3/convenience.hpp +++ /dev/null @@ -1,74 +0,0 @@ -// boost/filesystem/convenience.hpp ----------------------------------------// - -// Copyright Beman Dawes, 2002-2005 -// Copyright Vladimir Prus, 2002 -// 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 library home page at http://www.boost.org/libs/filesystem - -//----------------------------------------------------------------------------// - -#ifndef BOOST_FILESYSTEM3_CONVENIENCE_HPP -#define BOOST_FILESYSTEM3_CONVENIENCE_HPP - -#include <boost/config.hpp> - -# if defined( BOOST_NO_STD_WSTRING ) -# error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support -# endif - -#include <boost/filesystem/v3/operations.hpp> -#include <boost/system/error_code.hpp> - -#include <boost/config/abi_prefix.hpp> // must be the last #include - -namespace boost -{ - namespace filesystem3 - { - -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED - - inline std::string extension(const path & p) - { - return p.extension().string(); - } - - inline std::string basename(const path & p) - { - return p.stem().string(); - } - - inline path change_extension( const path & p, const path & new_extension ) - { - path new_p( p ); - new_p.replace_extension( new_extension ); - return new_p; - } - -# endif - - - } // namespace filesystem3 -} // namespace boost - -//----------------------------------------------------------------------------// - -namespace boost -{ - namespace filesystem - { -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED - using filesystem3::extension; - using filesystem3::basename; - using filesystem3::change_extension; -# endif - } -} - -//----------------------------------------------------------------------------// - -#include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas -#endif // BOOST_FILESYSTEM3_CONVENIENCE_HPP diff --git a/3rdParty/Boost/src/boost/filesystem/v3/exception.hpp b/3rdParty/Boost/src/boost/filesystem/v3/exception.hpp deleted file mode 100644 index 985cd8f..0000000 --- a/3rdParty/Boost/src/boost/filesystem/v3/exception.hpp +++ /dev/null @@ -1,9 +0,0 @@ -// boost/filesystem/exception.hpp -----------------------------------------------------// - -// Copyright Beman Dawes 2003 -// 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 header is no longer used. The contents have been moved to path.hpp. -// It is provided so that user code #includes do not have to be changed. diff --git a/3rdParty/Boost/src/boost/filesystem/v3/fstream.hpp b/3rdParty/Boost/src/boost/filesystem/v3/fstream.hpp deleted file mode 100644 index 60a2a3b..0000000 --- a/3rdParty/Boost/src/boost/filesystem/v3/fstream.hpp +++ /dev/null @@ -1,208 +0,0 @@ -// boost/filesystem/fstream.hpp ------------------------------------------------------// - -// Copyright Beman Dawes 2002 - -// Distributed under the Boost Software License, Version 1.0. -// See http://www.boost.org/LICENSE_1_0.txt - -// Library home page: http://www.boost.org/libs/filesystem - -//--------------------------------------------------------------------------------------// - -#ifndef BOOST_FILESYSTEM3_FSTREAM_HPP -#define BOOST_FILESYSTEM3_FSTREAM_HPP - -#include <boost/config.hpp> - -# if defined( BOOST_NO_STD_WSTRING ) -# error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support -# endif - -#include <boost/filesystem/v3/path.hpp> -#include <iosfwd> -#include <fstream> - -#include <boost/config/abi_prefix.hpp> // must be the last #include - -// on Windows, except for standard libaries known to have wchar_t overloads for -// file stream I/O, use path::string() to get a narrow character c_str() -#if defined(BOOST_WINDOWS_API) \ - && (!defined(_CPPLIB_VER) || _CPPLIB_VER < 405 || defined(_STLPORT_VERSION)) - // !Dinkumware || early Dinkumware || STLPort masquerading as Dinkumware -# define BOOST_FILESYSTEM_C_STR string().c_str() // use narrow, since wide not available -#else // use the native c_str, which will be narrow on POSIX, wide on Windows -# define BOOST_FILESYSTEM_C_STR c_str() -#endif - -namespace boost -{ -namespace filesystem3 -{ - -//--------------------------------------------------------------------------------------// -// basic_filebuf // -//--------------------------------------------------------------------------------------// - - template < class charT, class traits = std::char_traits<charT> > - class basic_filebuf : public std::basic_filebuf<charT,traits> - { - private: // disallow copying - basic_filebuf(const basic_filebuf&); - const basic_filebuf& operator=(const basic_filebuf&); - - public: - basic_filebuf() {} - virtual ~basic_filebuf() {} - - basic_filebuf<charT,traits>* - open(const path& p, std::ios_base::openmode mode) - { - return std::basic_filebuf<charT,traits>::open(p.BOOST_FILESYSTEM_C_STR, mode) - ? this : 0; - } - }; - -//--------------------------------------------------------------------------------------// -// basic_ifstream // -//--------------------------------------------------------------------------------------// - - template < class charT, class traits = std::char_traits<charT> > - class basic_ifstream : public std::basic_ifstream<charT,traits> - { - private: // disallow copying - basic_ifstream(const basic_ifstream&); - const basic_ifstream& operator=(const basic_ifstream&); - - public: - basic_ifstream() {} - - // use two signatures, rather than one signature with default second - // argument, to workaround VC++ 7.1 bug (ID VSWhidbey 38416) - - explicit basic_ifstream(const path& p) - : std::basic_ifstream<charT,traits>(p.BOOST_FILESYSTEM_C_STR, std::ios_base::in) {} - - basic_ifstream(const path& p, std::ios_base::openmode mode) - : std::basic_ifstream<charT,traits>(p.BOOST_FILESYSTEM_C_STR, mode) {} - - void open(const path& p) - { std::basic_ifstream<charT,traits>::open(p.BOOST_FILESYSTEM_C_STR, std::ios_base::in); } - - void open(const path& p, std::ios_base::openmode mode) - { std::basic_ifstream<charT,traits>::open(p.BOOST_FILESYSTEM_C_STR, mode); } - - virtual ~basic_ifstream() {} - }; - -//--------------------------------------------------------------------------------------// -// basic_ofstream // -//--------------------------------------------------------------------------------------// - - template < class charT, class traits = std::char_traits<charT> > - class basic_ofstream : public std::basic_ofstream<charT,traits> - { - private: // disallow copying - basic_ofstream(const basic_ofstream&); - const basic_ofstream& operator=(const basic_ofstream&); - - public: - basic_ofstream() {} - - // use two signatures, rather than one signature with default second - // argument, to workaround VC++ 7.1 bug (ID VSWhidbey 38416) - - explicit basic_ofstream(const path& p) - : std::basic_ofstream<charT,traits>(p.BOOST_FILESYSTEM_C_STR, std::ios_base::out) {} - - basic_ofstream(const path& p, std::ios_base::openmode mode) - : std::basic_ofstream<charT,traits>(p.BOOST_FILESYSTEM_C_STR, mode) {} - - void open(const path& p) - { std::basic_ofstream<charT,traits>::open(p.BOOST_FILESYSTEM_C_STR, std::ios_base::out); } - - void open(const path& p, std::ios_base::openmode mode) - { std::basic_ofstream<charT,traits>::open(p.BOOST_FILESYSTEM_C_STR, mode); } - - virtual ~basic_ofstream() {} - }; - -//--------------------------------------------------------------------------------------// -// basic_fstream // -//--------------------------------------------------------------------------------------// - - template < class charT, class traits = std::char_traits<charT> > - class basic_fstream : public std::basic_fstream<charT,traits> - { - private: // disallow copying - basic_fstream(const basic_fstream&); - const basic_fstream & operator=(const basic_fstream&); - - public: - basic_fstream() {} - - // use two signatures, rather than one signature with default second - // argument, to workaround VC++ 7.1 bug (ID VSWhidbey 38416) - - explicit basic_fstream(const path& p) - : std::basic_fstream<charT,traits>(p.BOOST_FILESYSTEM_C_STR, - std::ios_base::in | std::ios_base::out) {} - - basic_fstream(const path& p, std::ios_base::openmode mode) - : std::basic_fstream<charT,traits>(p.BOOST_FILESYSTEM_C_STR, mode) {} - - void open(const path& p) - { std::basic_fstream<charT,traits>::open(p.BOOST_FILESYSTEM_C_STR, - std::ios_base::in | std::ios_base::out); } - - void open(const path& p, std::ios_base::openmode mode) - { std::basic_fstream<charT,traits>::open(p.BOOST_FILESYSTEM_C_STR, mode); } - - virtual ~basic_fstream() {} - - }; - -//--------------------------------------------------------------------------------------// -// typedefs // -//--------------------------------------------------------------------------------------// - - typedef basic_filebuf<char> filebuf; - typedef basic_ifstream<char> ifstream; - typedef basic_ofstream<char> ofstream; - typedef basic_fstream<char> fstream; - - typedef basic_filebuf<wchar_t> wfilebuf; - typedef basic_ifstream<wchar_t> wifstream; - typedef basic_ofstream<wchar_t> wofstream; - typedef basic_fstream<wchar_t> wfstream; - -} // namespace filesystem3 -} // namespace boost - -//----------------------------------------------------------------------------// - -namespace boost -{ - namespace filesystem - { - using filesystem3::filebuf; - using filesystem3::ifstream; - using filesystem3::ofstream; - using filesystem3::fstream; - using filesystem3::wfilebuf; - using filesystem3::wifstream; - using filesystem3::wfstream; - using filesystem3::wofstream; - using filesystem3::basic_filebuf; - using filesystem3::basic_ifstream; - using filesystem3::basic_ofstream; - using filesystem3::basic_fstream; - -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED -# endif - } -} - -//----------------------------------------------------------------------------// - -#include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas -#endif // BOOST_FILESYSTEM3_FSTREAM_HPP diff --git a/3rdParty/Boost/src/boost/filesystem/v3/operations.hpp b/3rdParty/Boost/src/boost/filesystem/v3/operations.hpp deleted file mode 100644 index 7d1608d..0000000 --- a/3rdParty/Boost/src/boost/filesystem/v3/operations.hpp +++ /dev/null @@ -1,1052 +0,0 @@ -// boost/filesystem/operations.hpp ---------------------------------------------------// - -// Copyright Beman Dawes 2002-2009 -// Copyright Jan Langer 2002 -// Copyright Dietmar Kuehl 2001 -// Copyright Vladimir Prus 2002 - -// Distributed under the Boost Software License, Version 1.0. -// See http://www.boost.org/LICENSE_1_0.txt - -// Library home page: http://www.boost.org/libs/filesystem - -//--------------------------------------------------------------------------------------// - -#ifndef BOOST_FILESYSTEM3_OPERATIONS_HPP -#define BOOST_FILESYSTEM3_OPERATIONS_HPP - -#include <boost/config.hpp> - -# if defined( BOOST_NO_STD_WSTRING ) -# error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support -# endif - -#include <boost/filesystem/v3/config.hpp> -#include <boost/filesystem/v3/path.hpp> - -#include <boost/detail/scoped_enum_emulation.hpp> -#include <boost/detail/bitmask.hpp> -#include <boost/system/error_code.hpp> -#include <boost/system/system_error.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/utility/enable_if.hpp> -#include <boost/type_traits/is_same.hpp> -#include <boost/iterator.hpp> -#include <boost/cstdint.hpp> -#include <boost/assert.hpp> - -#include <string> -#include <utility> // for pair -#include <ctime> -#include <vector> -#include <stack> - -#ifdef BOOST_WINDOWS_API -# include <fstream> -#endif - -#include <boost/config/abi_prefix.hpp> // must be the last #include - -//--------------------------------------------------------------------------------------// - -namespace boost -{ - namespace filesystem3 - { - -//--------------------------------------------------------------------------------------// -// // -// support classes and enums // -// // -//--------------------------------------------------------------------------------------// - - enum file_type - { - status_error, -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED - status_unknown = status_error, -# endif - file_not_found, - regular_file, - directory_file, - // the following may not apply to some operating systems or file systems - symlink_file, - block_file, - character_file, - fifo_file, - socket_file, - reparse_file, // Windows: FILE_ATTRIBUTE_REPARSE_POINT that is not a symlink - type_unknown, // file does exist, but isn't one of the above types or - // we don't have strong enough permission to find its type - - _detail_directory_symlink // internal use only; never exposed to users - }; - - class BOOST_FILESYSTEM_DECL file_status - { - public: - file_status() : m_value(status_error) {} - explicit file_status(file_type v) : m_value(v) {} - - void type(file_type v) { m_value = v; } - file_type type() const { return m_value; } - - bool operator==(const file_status& rhs) const { return type() == rhs.type(); } - bool operator!=(const file_status& rhs) const { return !(*this == rhs); } - - private: - // the internal representation is unspecified so that additional state - // information such as permissions can be added in the future; this - // implementation just uses file_type as the internal representation - - file_type m_value; - }; - - inline bool status_known(file_status f) { return f.type() != status_error; } - inline bool exists(file_status f) { return f.type() != status_error - && f.type() != file_not_found; } - inline bool is_regular_file(file_status f){ return f.type() == regular_file; } - inline bool is_directory(file_status f) { return f.type() == directory_file; } - inline bool is_symlink(file_status f) { return f.type() == symlink_file; } - inline bool is_other(file_status f) { return exists(f) && !is_regular_file(f) - && !is_directory(f) && !is_symlink(f); } - -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED - inline bool is_regular(file_status f) { return f.type() == regular_file; } -# endif - - struct space_info - { - // all values are byte counts - boost::uintmax_t capacity; - boost::uintmax_t free; // <= capacity - boost::uintmax_t available; // <= free - }; - - BOOST_SCOPED_ENUM_START(copy_option) - {none, fail_if_exists = none, overwrite_if_exists}; - BOOST_SCOPED_ENUM_END - -//--------------------------------------------------------------------------------------// -// implementation details // -//--------------------------------------------------------------------------------------// - - namespace detail - { - BOOST_FILESYSTEM_DECL - file_status status(const path&p, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - file_status symlink_status(const path& p, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - bool is_empty(const path& p, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - path initial_path(system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - void copy(const path& from, const path& to, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - void copy_directory(const path& from, const path& to, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - void copy_file(const path& from, const path& to, - BOOST_SCOPED_ENUM(copy_option) option, // See ticket #2925 - system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - void copy_symlink(const path& existing_symlink, const path& new_symlink, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - bool create_directories(const path& p, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - bool create_directory(const path& p, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - void create_directory_symlink(const path& to, const path& from, - system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - void create_hard_link(const path& to, const path& from, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - void create_symlink(const path& to, const path& from, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - path current_path(system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - void current_path(const path& p, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - bool equivalent(const path& p1, const path& p2, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - boost::uintmax_t file_size(const path& p, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - boost::uintmax_t hard_link_count(const path& p, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - std::time_t last_write_time(const path& p, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - void last_write_time(const path& p, const std::time_t new_time, - system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - path read_symlink(const path& p, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - // For standardization, if the committee doesn't like "remove", consider "eliminate" - bool remove(const path& p, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - boost::uintmax_t remove_all(const path& p, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - void rename(const path& old_p, const path& new_p, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - void resize_file(const path& p, uintmax_t size, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - space_info space(const path& p, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - path system_complete(const path& p, system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - path temp_directory_path(system::error_code* ec=0); - BOOST_FILESYSTEM_DECL - path unique_path(const path& p, system::error_code* ec=0); - } // namespace detail - -//--------------------------------------------------------------------------------------// -// // -// status query functions // -// // -//--------------------------------------------------------------------------------------// - - inline - file_status status(const path& p) {return detail::status(p);} - inline - file_status status(const path& p, system::error_code& ec) - {return detail::status(p, &ec);} - inline - file_status symlink_status(const path& p) {return detail::symlink_status(p);} - inline - file_status symlink_status(const path& p, system::error_code& ec) - {return detail::symlink_status(p, &ec);} - inline - bool exists(const path& p) {return exists(detail::status(p));} - inline - bool exists(const path& p, system::error_code& ec) - {return exists(detail::status(p, &ec));} - inline - bool is_directory(const path& p) {return is_directory(detail::status(p));} - inline - bool is_directory(const path& p, system::error_code& ec) - {return is_directory(detail::status(p, &ec));} - inline - bool is_regular_file(const path& p) {return is_regular_file(detail::status(p));} - inline - bool is_regular_file(const path& p, system::error_code& ec) - {return is_regular_file(detail::status(p, &ec));} - inline - bool is_other(const path& p) {return is_other(detail::status(p));} - inline - bool is_other(const path& p, system::error_code& ec) - {return is_other(detail::status(p, &ec));} - inline - bool is_symlink(const path& p) {return is_symlink(detail::symlink_status(p));} - inline - bool is_symlink(const path& p, system::error_code& ec) - {return is_symlink(detail::symlink_status(p, &ec));} -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED - inline - bool is_regular(const path& p) {return is_regular(detail::status(p));} - inline - bool is_regular(const path& p, system::error_code& ec) - {return is_regular(detail::status(p, &ec));} -# endif - - inline - bool is_empty(const path& p) {return detail::is_empty(p);} - inline - bool is_empty(const path& p, system::error_code& ec) - {return detail::is_empty(p, &ec);} - -//--------------------------------------------------------------------------------------// -// // -// operational functions // -// in alphabetical order, unless otherwise noted // -// // -//--------------------------------------------------------------------------------------// - - // forward declarations - path current_path(); // fwd declaration - path initial_path(); - - BOOST_FILESYSTEM_DECL - path absolute(const path& p, const path& base=current_path()); - // If base.is_absolute(), throws nothing. Thus no need for ec argument - -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED - inline - path complete(const path& p) - { - return absolute(p, initial_path()); - } - - inline - path complete(const path& p, const path& base) - { - return absolute(p, base); - } -# endif - - inline - void copy(const path& from, const path& to) {detail::copy(from, to);} - - inline - void copy(const path& from, const path& to, system::error_code& ec) - {detail::copy(from, to, &ec);} - inline - void copy_directory(const path& from, const path& to) - {detail::copy_directory(from, to);} - inline - void copy_directory(const path& from, const path& to, system::error_code& ec) - {detail::copy_directory(from, to, &ec);} - inline - void copy_file(const path& from, const path& to, // See ticket #2925 - BOOST_SCOPED_ENUM(copy_option) option) - {detail::copy_file(from, to, option);} - inline - void copy_file(const path& from, const path& to) - {detail::copy_file(from, to, copy_option::fail_if_exists);} - inline - void copy_file(const path& from, const path& to, // See ticket #2925 - BOOST_SCOPED_ENUM(copy_option) option, system::error_code& ec) - {detail::copy_file(from, to, option, &ec);} - inline - void copy_file(const path& from, const path& to, system::error_code& ec) - {detail::copy_file(from, to, copy_option::fail_if_exists, &ec);} - inline - void copy_symlink(const path& existing_symlink, const path& new_symlink) {detail::copy_symlink(existing_symlink, new_symlink);} - - inline - void copy_symlink(const path& existing_symlink, const path& new_symlink, system::error_code& ec) - {detail::copy_symlink(existing_symlink, new_symlink, &ec);} - inline - bool create_directories(const path& p) {return detail::create_directories(p);} - - inline - bool create_directories(const path& p, system::error_code& ec) - {return detail::create_directories(p, &ec);} - inline - bool create_directory(const path& p) {return detail::create_directory(p);} - - inline - bool create_directory(const path& p, system::error_code& ec) - {return detail::create_directory(p, &ec);} - inline - void create_directory_symlink(const path& to, const path& from) - {detail::create_directory_symlink(to, from);} - inline - void create_directory_symlink(const path& to, const path& from, system::error_code& ec) - {detail::create_directory_symlink(to, from, &ec);} - inline - void create_hard_link(const path& to, const path& new_hard_link) {detail::create_hard_link(to, new_hard_link);} - - inline - void create_hard_link(const path& to, const path& new_hard_link, system::error_code& ec) - {detail::create_hard_link(to, new_hard_link, &ec);} - inline - void create_symlink(const path& to, const path& new_symlink) {detail::create_symlink(to, new_symlink);} - - inline - void create_symlink(const path& to, const path& new_symlink, system::error_code& ec) - {detail::create_symlink(to, new_symlink, &ec);} - inline - path current_path() {return detail::current_path();} - - inline - path current_path(system::error_code& ec) {return detail::current_path(&ec);} - - inline - void current_path(const path& p) {detail::current_path(p);} - - inline - void current_path(const path& p, system::error_code& ec) {detail::current_path(p, &ec);} - - inline - bool equivalent(const path& p1, const path& p2) {return detail::equivalent(p1, p2);} - - inline - bool equivalent(const path& p1, const path& p2, system::error_code& ec) - {return detail::equivalent(p1, p2, &ec);} - inline - boost::uintmax_t file_size(const path& p) {return detail::file_size(p);} - - inline - boost::uintmax_t file_size(const path& p, system::error_code& ec) - {return detail::file_size(p, &ec);} - inline - boost::uintmax_t hard_link_count(const path& p) {return detail::hard_link_count(p);} - - inline - boost::uintmax_t hard_link_count(const path& p, system::error_code& ec) - {return detail::hard_link_count(p, &ec);} - inline - path initial_path() {return detail::initial_path();} - - inline - path initial_path(system::error_code& ec) {return detail::initial_path(&ec);} - - template <class Path> - path initial_path() {return initial_path();} - template <class Path> - path initial_path(system::error_code& ec) {return detail::initial_path(&ec);} - - inline - std::time_t last_write_time(const path& p) {return detail::last_write_time(p);} - - inline - std::time_t last_write_time(const path& p, system::error_code& ec) - {return detail::last_write_time(p, &ec);} - inline - void last_write_time(const path& p, const std::time_t new_time) - {detail::last_write_time(p, new_time);} - inline - void last_write_time(const path& p, const std::time_t new_time, system::error_code& ec) - {detail::last_write_time(p, new_time, &ec);} - inline - path read_symlink(const path& p) {return detail::read_symlink(p);} - - inline - path read_symlink(const path& p, system::error_code& ec) - {return detail::read_symlink(p, &ec);} - inline - // For standardization, if the committee doesn't like "remove", consider "eliminate" - bool remove(const path& p) {return detail::remove(p);} - - inline - bool remove(const path& p, system::error_code& ec) {return detail::remove(p, &ec);} - - inline - boost::uintmax_t remove_all(const path& p) {return detail::remove_all(p);} - - inline - boost::uintmax_t remove_all(const path& p, system::error_code& ec) - {return detail::remove_all(p, &ec);} - inline - void rename(const path& old_p, const path& new_p) {detail::rename(old_p, new_p);} - - inline - void rename(const path& old_p, const path& new_p, system::error_code& ec) - {detail::rename(old_p, new_p, &ec);} - inline // name suggested by Scott McMurray - void resize_file(const path& p, uintmax_t size) {detail::resize_file(p, size);} - - inline - void resize_file(const path& p, uintmax_t size, system::error_code& ec) - {detail::resize_file(p, size, &ec);} - inline - space_info space(const path& p) {return detail::space(p);} - - inline - space_info space(const path& p, system::error_code& ec) {return detail::space(p, &ec);} - -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED - inline bool symbolic_link_exists(const path& p) - { return is_symlink(symlink_status(p)); } -# endif - - inline - path system_complete(const path& p) {return detail::system_complete(p);} - - inline - path system_complete(const path& p, system::error_code& ec) - {return detail::system_complete(p, &ec);} - inline - path temp_directory_path() {return detail::temp_directory_path();} - - inline - path temp_directory_path(system::error_code& ec) - {return detail::temp_directory_path(&ec);} - inline - path unique_path(const path& p="%%%%-%%%%-%%%%-%%%%") - { return detail::unique_path(p); } - inline - path unique_path(const path& p, system::error_code& ec) - { return detail::unique_path(p, &ec); } - -//--------------------------------------------------------------------------------------// -// // -// directory_entry // -// // -//--------------------------------------------------------------------------------------// - -// GCC has a problem with a member function named path within a namespace or -// sub-namespace that also has a class named path. The workaround is to always -// fully qualify the name path when it refers to the class name. - -class BOOST_FILESYSTEM_DECL directory_entry -{ -public: - - // compiler generated copy constructor, copy assignment, and destructor apply - - directory_entry() {} - explicit directory_entry(const boost::filesystem::path& p, - file_status st = file_status(), file_status symlink_st=file_status()) - : m_path(p), m_status(st), m_symlink_status(symlink_st) - {} - - void assign(const boost::filesystem::path& p, - file_status st = file_status(), file_status symlink_st = file_status()) - { m_path = p; m_status = st; m_symlink_status = symlink_st; } - - void replace_filename(const boost::filesystem::path& p, - file_status st = file_status(), file_status symlink_st = file_status()) - { - m_path.remove_filename(); - m_path /= p; - m_status = st; - m_symlink_status = symlink_st; - } - -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED - void replace_leaf(const boost::filesystem::path& p, - file_status st, file_status symlink_st) - { replace_filename(p, st, symlink_st); } -# endif - - const boost::filesystem::path& path() const {return m_path;} - file_status status() const {return m_get_status();} - file_status status(system::error_code& ec) const {return m_get_status(&ec);} - file_status symlink_status() const {return m_get_symlink_status();} - file_status symlink_status(system::error_code& ec) const {return m_get_symlink_status(&ec);} - - bool operator==(const directory_entry& rhs) {return m_path == rhs.m_path;} - bool operator!=(const directory_entry& rhs) {return m_path != rhs.m_path;} - bool operator< (const directory_entry& rhs) {return m_path < rhs.m_path;} - bool operator<=(const directory_entry& rhs) {return m_path <= rhs.m_path;} - bool operator> (const directory_entry& rhs) {return m_path > rhs.m_path;} - bool operator>=(const directory_entry& rhs) {return m_path >= rhs.m_path;} - -private: - boost::filesystem::path m_path; - mutable file_status m_status; // stat()-like - mutable file_status m_symlink_status; // lstat()-like - - file_status m_get_status(system::error_code* ec=0) const; - file_status m_get_symlink_status(system::error_code* ec=0) const; -}; // directory_entry - -//--------------------------------------------------------------------------------------// -// // -// directory_iterator helpers // -// // -//--------------------------------------------------------------------------------------// - -class directory_iterator; - -namespace detail -{ - BOOST_FILESYSTEM_DECL - system::error_code dir_itr_close(// never throws() - void *& handle -# if defined(BOOST_POSIX_API) - , void *& buffer -# endif - ); - - struct dir_itr_imp - { - directory_entry dir_entry; - void* handle; - -# ifdef BOOST_POSIX_API - void* buffer; // see dir_itr_increment implementation -# endif - - dir_itr_imp() : handle(0) -# ifdef BOOST_POSIX_API - , buffer(0) -# endif - {} - - ~dir_itr_imp() // never throws - { - dir_itr_close(handle -# if defined(BOOST_POSIX_API) - , buffer -# endif - ); - } - }; - - // see path::iterator: comment below - BOOST_FILESYSTEM_DECL void directory_iterator_construct(directory_iterator& it, - const path& p, system::error_code* ec); - BOOST_FILESYSTEM_DECL void directory_iterator_increment(directory_iterator& it, - system::error_code* ec); - -} // namespace detail - -//--------------------------------------------------------------------------------------// -// // -// directory_iterator // -// // -//--------------------------------------------------------------------------------------// - - class directory_iterator - : public boost::iterator_facade< directory_iterator, - directory_entry, - boost::single_pass_traversal_tag > - { - public: - - directory_iterator(){} // creates the "end" iterator - - // iterator_facade derived classes don't seem to like implementations in - // separate translation unit dll's, so forward to detail functions - explicit directory_iterator(const path& p) - : m_imp(new detail::dir_itr_imp) - { detail::directory_iterator_construct(*this, p, 0); } - - directory_iterator(const path& p, system::error_code& ec) - : m_imp(new detail::dir_itr_imp) - { detail::directory_iterator_construct(*this, p, &ec); } - - ~directory_iterator() {} // never throws - - directory_iterator& increment(system::error_code& ec) - { - detail::directory_iterator_increment(*this, &ec); - return *this; - } - - private: - friend struct detail::dir_itr_imp; - friend BOOST_FILESYSTEM_DECL void detail::directory_iterator_construct(directory_iterator& it, - const path& p, system::error_code* ec); - friend BOOST_FILESYSTEM_DECL void detail::directory_iterator_increment(directory_iterator& it, - system::error_code* ec); - - // shared_ptr provides shallow-copy semantics required for InputIterators. - // m_imp.get()==0 indicates the end iterator. - boost::shared_ptr< detail::dir_itr_imp > m_imp; - - friend class boost::iterator_core_access; - - boost::iterator_facade< - directory_iterator, - directory_entry, - boost::single_pass_traversal_tag >::reference dereference() const - { - BOOST_ASSERT(m_imp.get() && "attempt to dereference end iterator"); - return m_imp->dir_entry; - } - - void increment() { detail::directory_iterator_increment(*this, 0); } - - bool equal(const directory_iterator& rhs) const - { return m_imp == rhs.m_imp; } - }; - -//--------------------------------------------------------------------------------------// -// // -// recursive_directory_iterator helpers // -// // -//--------------------------------------------------------------------------------------// - - BOOST_SCOPED_ENUM_START(symlink_option) - { - none, - no_recurse = none, // don't follow directory symlinks (default behavior) - recurse, // follow directory symlinks - _detail_no_push = recurse << 1 // internal use only - }; - BOOST_SCOPED_ENUM_END - - BOOST_BITMASK(BOOST_SCOPED_ENUM(symlink_option)) - - namespace detail - { - struct recur_dir_itr_imp - { - typedef directory_iterator element_type; - std::stack< element_type, std::vector< element_type > > m_stack; - int m_level; - BOOST_SCOPED_ENUM(symlink_option) m_options; - - recur_dir_itr_imp() : m_level(0), m_options(symlink_option::none) {} - - void increment(system::error_code* ec); // ec == 0 means throw on error - - void pop(); - - }; - - // Implementation is inline to avoid dynamic linking difficulties with m_stack: - // Microsoft warning C4251, m_stack needs to have dll-interface to be used by - // clients of struct 'boost::filesystem::detail::recur_dir_itr_imp' - - inline - void recur_dir_itr_imp::increment(system::error_code* ec) - // ec == 0 means throw on error - { - if ((m_options & symlink_option::_detail_no_push) == symlink_option::_detail_no_push) - m_options &= ~symlink_option::_detail_no_push; - else if (is_directory(m_stack.top()->status()) - && (!is_symlink(m_stack.top()->symlink_status()) - || (m_options & symlink_option::recurse) == symlink_option::recurse)) - { - if (ec == 0) - m_stack.push(directory_iterator(m_stack.top()->path())); - else - { - m_stack.push(directory_iterator(m_stack.top()->path(), *ec)); - if (*ec) return; - } - if (m_stack.top() != directory_iterator()) - { - ++m_level; - return; - } - m_stack.pop(); - } - - while (!m_stack.empty() && ++m_stack.top() == directory_iterator()) - { - m_stack.pop(); - --m_level; - } - } - - inline - void recur_dir_itr_imp::pop() - { - BOOST_ASSERT(m_level > 0 && "pop() on recursive_directory_iterator with level < 1"); - - do - { - m_stack.pop(); - --m_level; - } - while (!m_stack.empty() && ++m_stack.top() == directory_iterator()); - } - } // namespace detail - -//--------------------------------------------------------------------------------------// -// // -// recursive_directory_iterator // -// // -//--------------------------------------------------------------------------------------// - - class recursive_directory_iterator - : public boost::iterator_facade< - recursive_directory_iterator, - directory_entry, - boost::single_pass_traversal_tag > - { - public: - - recursive_directory_iterator(){} // creates the "end" iterator - - explicit recursive_directory_iterator(const path& dir_path, - BOOST_SCOPED_ENUM(symlink_option) opt = symlink_option::none) - : m_imp(new detail::recur_dir_itr_imp) - { - m_imp->m_options = opt; - m_imp->m_stack.push(directory_iterator(dir_path)); - if (m_imp->m_stack.top() == directory_iterator()) - { m_imp.reset (); } - } - - recursive_directory_iterator(const path& dir_path, - BOOST_SCOPED_ENUM(symlink_option) opt, - system::error_code & ec) - : m_imp(new detail::recur_dir_itr_imp) - { - m_imp->m_options = opt; - m_imp->m_stack.push(directory_iterator(dir_path, ec)); - if (m_imp->m_stack.top() == directory_iterator()) - { m_imp.reset (); } - } - - recursive_directory_iterator(const path& dir_path, - system::error_code & ec) - : m_imp(new detail::recur_dir_itr_imp) - { - m_imp->m_options = symlink_option::none; - m_imp->m_stack.push(directory_iterator(dir_path, ec)); - if (m_imp->m_stack.top() == directory_iterator()) - { m_imp.reset (); } - } - - recursive_directory_iterator& increment(system::error_code& ec) - { - BOOST_ASSERT(m_imp.get() && "increment() on end recursive_directory_iterator"); - m_imp->increment(&ec); - return *this; - } - - int level() const - { - BOOST_ASSERT(m_imp.get() && "level() on end recursive_directory_iterator"); - return m_imp->m_level; - } - - bool no_push_pending() const - { - BOOST_ASSERT(m_imp.get() && "is_no_push_requested() on end recursive_directory_iterator"); - return (m_imp->m_options & symlink_option::_detail_no_push) - == symlink_option::_detail_no_push; - } - -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED - bool no_push_request() const { return no_push_pending(); } -# endif - - void pop() - { - BOOST_ASSERT(m_imp.get() && "pop() on end recursive_directory_iterator"); - m_imp->pop(); - if (m_imp->m_stack.empty()) m_imp.reset(); // done, so make end iterator - } - - void no_push(bool value=true) - { - BOOST_ASSERT(m_imp.get() && "no_push() on end recursive_directory_iterator"); - if (value) - m_imp->m_options |= symlink_option::_detail_no_push; - else - m_imp->m_options &= ~symlink_option::_detail_no_push; - } - - file_status status() const - { - BOOST_ASSERT(m_imp.get() - && "status() on end recursive_directory_iterator"); - return m_imp->m_stack.top()->status(); - } - - file_status symlink_status() const - { - BOOST_ASSERT(m_imp.get() - && "symlink_status() on end recursive_directory_iterator"); - return m_imp->m_stack.top()->symlink_status(); - } - - private: - - // shared_ptr provides shallow-copy semantics required for InputIterators. - // m_imp.get()==0 indicates the end iterator. - boost::shared_ptr< detail::recur_dir_itr_imp > m_imp; - - friend class boost::iterator_core_access; - - boost::iterator_facade< - recursive_directory_iterator, - directory_entry, - boost::single_pass_traversal_tag >::reference - dereference() const - { - BOOST_ASSERT(m_imp.get() && "dereference of end recursive_directory_iterator"); - return *m_imp->m_stack.top(); - } - - void increment() - { - BOOST_ASSERT(m_imp.get() && "increment of end recursive_directory_iterator"); - m_imp->increment(0); - if (m_imp->m_stack.empty()) - m_imp.reset(); // done, so make end iterator - } - - bool equal(const recursive_directory_iterator& rhs) const - { return m_imp == rhs.m_imp; } - - }; - -# if !defined(BOOST_FILESYSTEM_NO_DEPRECATED) - typedef recursive_directory_iterator wrecursive_directory_iterator; -# endif - -//--------------------------------------------------------------------------------------// -// // -// class filesystem_error // -// // -//--------------------------------------------------------------------------------------// - - class BOOST_SYMBOL_VISIBLE filesystem_error : public system::system_error - { - // see http://www.boost.org/more/error_handling.html for design rationale - - // all functions are inline to avoid issues with crossing dll boundaries - - public: - // compiler generates copy constructor and copy assignment - - filesystem_error( - const std::string & what_arg, system::error_code ec) - : system::system_error(ec, what_arg) - { - try - { - m_imp_ptr.reset(new m_imp); - } - catch (...) { m_imp_ptr.reset(); } - } - - filesystem_error( - const std::string & what_arg, const path& path1_arg, - system::error_code ec) - : system::system_error(ec, what_arg) - { - try - { - m_imp_ptr.reset(new m_imp); - m_imp_ptr->m_path1 = path1_arg; - } - catch (...) { m_imp_ptr.reset(); } - } - - filesystem_error( - const std::string & what_arg, const path& path1_arg, - const path& path2_arg, system::error_code ec) - : system::system_error(ec, what_arg) - { - try - { - m_imp_ptr.reset(new m_imp); - m_imp_ptr->m_path1 = path1_arg; - m_imp_ptr->m_path2 = path2_arg; - } - catch (...) { m_imp_ptr.reset(); } - } - - ~filesystem_error() throw() {} - - const path& path1() const - { - static const path empty_path; - return m_imp_ptr.get() ? m_imp_ptr->m_path1 : empty_path ; - } - const path& path2() const - { - static const path empty_path; - return m_imp_ptr.get() ? m_imp_ptr->m_path2 : empty_path ; - } - - const char* what() const throw() - { - if (!m_imp_ptr.get()) - return system::system_error::what(); - - try - { - if (m_imp_ptr->m_what.empty()) - { - m_imp_ptr->m_what = system::system_error::what(); - if (!m_imp_ptr->m_path1.empty()) - { - m_imp_ptr->m_what += ": \""; - m_imp_ptr->m_what += m_imp_ptr->m_path1.string(); - m_imp_ptr->m_what += "\""; - } - if (!m_imp_ptr->m_path2.empty()) - { - m_imp_ptr->m_what += ", \""; - m_imp_ptr->m_what += m_imp_ptr->m_path2.string(); - m_imp_ptr->m_what += "\""; - } - } - return m_imp_ptr->m_what.c_str(); - } - catch (...) - { - return system::system_error::what(); - } - } - - private: - struct m_imp - { - path m_path1; // may be empty() - path m_path2; // may be empty() - std::string m_what; // not built until needed - }; - boost::shared_ptr<m_imp> m_imp_ptr; - }; - -// test helper -----------------------------------------------------------------------// - -// Not part of the documented interface since false positives are possible; -// there is no law that says that an OS that has large stat.st_size -// actually supports large file sizes. - - namespace detail - { - BOOST_FILESYSTEM_DECL bool possible_large_file_size_support(); - } - - } // namespace filesystem3 -} // namespace boost - -//----------------------------------------------------------------------------// - -namespace boost -{ - namespace filesystem - { - using filesystem3::absolute; - using filesystem3::block_file; - using filesystem3::character_file; -// using filesystem3::copy; - using filesystem3::copy_file; - using filesystem3::copy_option; - using filesystem3::copy_symlink; - using filesystem3::create_directories; - using filesystem3::create_directory; - using filesystem3::create_hard_link; - using filesystem3::create_symlink; - using filesystem3::create_directory_symlink; - using filesystem3::current_path; - using filesystem3::directory_entry; - using filesystem3::directory_file; - using filesystem3::directory_iterator; - using filesystem3::equivalent; - using filesystem3::exists; - using filesystem3::fifo_file; - using filesystem3::file_not_found; - using filesystem3::file_size; - using filesystem3::file_status; - using filesystem3::file_type; - using filesystem3::filesystem_error; - using filesystem3::hard_link_count; - using filesystem3::initial_path; - using filesystem3::is_directory; - using filesystem3::is_directory; - using filesystem3::is_empty; - using filesystem3::is_other; - using filesystem3::is_regular_file; - using filesystem3::is_symlink; - using filesystem3::last_write_time; - using filesystem3::read_symlink; - using filesystem3::recursive_directory_iterator; - using filesystem3::regular_file; - using filesystem3::reparse_file; - using filesystem3::remove; - using filesystem3::remove_all; - using filesystem3::rename; - using filesystem3::resize_file; - using filesystem3::socket_file; - using filesystem3::space; - using filesystem3::space_info; - using filesystem3::status; - using filesystem3::status_error; - using filesystem3::status_known; - using filesystem3::symlink_file; - using filesystem3::symlink_option; - using filesystem3::symlink_status; - using filesystem3::system_complete; - using filesystem3::temp_directory_path; - using filesystem3::type_unknown; - using filesystem3::unique_path; -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED - using filesystem3::is_regular; - using filesystem3::status_unknown; - using filesystem3::symbolic_link_exists; - //using filesystem3::wdirectory_iterator; - //using filesystem3::wdirectory_entry; -# endif - namespace detail - { - using filesystem3::detail::possible_large_file_size_support; - } - } -} - -#include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas -#endif // BOOST_FILESYSTEM3_OPERATIONS_HPP diff --git a/3rdParty/Boost/src/boost/filesystem/v3/path.hpp b/3rdParty/Boost/src/boost/filesystem/v3/path.hpp deleted file mode 100644 index f81b631..0000000 --- a/3rdParty/Boost/src/boost/filesystem/v3/path.hpp +++ /dev/null @@ -1,713 +0,0 @@ -// filesystem path.hpp ---------------------------------------------------------------// - -// Copyright Beman Dawes 2002-2005, 2009 -// Copyright Vladimir Prus 2002 - -// Distributed under the Boost Software License, Version 1.0. -// See http://www.boost.org/LICENSE_1_0.txt - -// Library home page: http://www.boost.org/libs/filesystem - -// path::stem(), extension(), and replace_extension() are based on -// basename(), extension(), and change_extension() from the original -// filesystem/convenience.hpp header by Vladimir Prus. - -#ifndef BOOST_FILESYSTEM_PATH_HPP -#define BOOST_FILESYSTEM_PATH_HPP - -#include <boost/config.hpp> - -# if defined( BOOST_NO_STD_WSTRING ) -# error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support -# endif - -#include <boost/filesystem/v3/config.hpp> -#include <boost/filesystem/v3/path_traits.hpp> // includes <cwchar> -#include <boost/system/error_code.hpp> -#include <boost/system/system_error.hpp> -#include <boost/iterator/iterator_facade.hpp> -#include <boost/shared_ptr.hpp> -#include <boost/io/detail/quoted_manip.hpp> -#include <boost/static_assert.hpp> -#include <string> -#include <iterator> -#include <cstring> -#include <iosfwd> -#include <stdexcept> -#include <cassert> -#include <locale> -#include <algorithm> - -#include <boost/config/abi_prefix.hpp> // must be the last #include - -namespace boost -{ -namespace filesystem3 -{ - //------------------------------------------------------------------------------------// - // // - // class path // - // // - //------------------------------------------------------------------------------------// - - class BOOST_FILESYSTEM_DECL path - { - public: - - // value_type is the character type used by the operating system API to - // represent paths. - -# ifdef BOOST_WINDOWS_API - typedef wchar_t value_type; -# else - typedef char value_type; -# endif - typedef std::basic_string<value_type> string_type; - typedef std::codecvt<wchar_t, char, std::mbstate_t> codecvt_type; - - - // ----- character encoding conversions ----- - - // Following the principle of least astonishment, path input arguments - // passed to or obtained from the operating system via objects of - // class path behave as if they were directly passed to or - // obtained from the O/S API, unless conversion is explicitly requested. - // - // POSIX specfies that path strings are passed unchanged to and from the - // API. Note that this is different from the POSIX command line utilities, - // which convert according to a locale. - // - // Thus for POSIX, char strings do not undergo conversion. wchar_t strings - // are converted to/from char using the path locale or, if a conversion - // argument is given, using a conversion object modeled on - // std::wstring_convert. - // - // The path locale, which is global to the thread, can be changed by the - // imbue() function. It is initialized to an implementation defined locale. - // - // For Windows, wchar_t strings do not undergo conversion. char strings - // are converted using the "ANSI" or "OEM" code pages, as determined by - // the AreFileApisANSI() function, or, if a conversion argument is given, - // using a conversion object modeled on std::wstring_convert. - // - // See m_pathname comments for further important rationale. - - // TODO: rules needed for operating systems that use / or . - // differently, or format directory paths differently from file paths. - // - // ************************************************************************ - // - // More work needed: How to handle an operating system that may have - // slash characters or dot characters in valid filenames, either because - // it doesn't follow the POSIX standard, or because it allows MBCS - // filename encodings that may contain slash or dot characters. For - // example, ISO/IEC 2022 (JIS) encoding which allows switching to - // JIS x0208-1983 encoding. A valid filename in this set of encodings is - // 0x1B 0x24 0x42 [switch to X0208-1983] 0x24 0x2F [U+304F Kiragana letter KU] - // ^^^^ - // Note that 0x2F is the ASCII slash character - // - // ************************************************************************ - - // Supported source arguments: half-open iterator range, container, c-array, - // and single pointer to null terminated string. - - // All source arguments except pointers to null terminated byte strings support - // multi-byte character strings which may have embedded nulls. Embedded null - // support is required for some Asian languages on Windows. - - // "const codecvt_type& cvt=codecvt()" default arguments are not used because some - // compilers, such as Microsoft prior to VC++ 10, do not handle defaults correctly - // in templates. - - // ----- constructors ----- - - path(){} - - path(const path& p) : m_pathname(p.m_pathname) {} - - template <class Source> - path(Source const& source, - typename boost::enable_if<path_traits::is_pathable< - typename boost::decay<Source>::type> >::type* =0) - { - path_traits::dispatch(source, m_pathname, codecvt()); - } - - template <class Source> - path(Source const& source, const codecvt_type& cvt) - // see note above explaining why codecvt() default arguments are not used - { - path_traits::dispatch(source, m_pathname, cvt); - } - - template <class InputIterator> - path(InputIterator begin, InputIterator end) - { - if (begin != end) - { - std::basic_string<typename std::iterator_traits<InputIterator>::value_type> - s(begin, end); - path_traits::convert(s.c_str(), s.c_str()+s.size(), m_pathname, codecvt()); - } - } - - template <class InputIterator> - path(InputIterator begin, InputIterator end, const codecvt_type& cvt) - { - if (begin != end) - { - std::basic_string<typename std::iterator_traits<InputIterator>::value_type> - s(begin, end); - path_traits::convert(s.c_str(), s.c_str()+s.size(), m_pathname, cvt); - } - } - - // ----- assignments ----- - - path& operator=(const path& p) - { - m_pathname = p.m_pathname; - return *this; - } - - template <class Source> - typename boost::enable_if<path_traits::is_pathable< - typename boost::decay<Source>::type>, path&>::type - operator=(Source const& source) - { - m_pathname.clear(); - path_traits::dispatch(source, m_pathname, codecvt()); - return *this; - } - - template <class Source> - path& assign(Source const& source, const codecvt_type& cvt) - { - m_pathname.clear(); - path_traits::dispatch(source, m_pathname, cvt); - return *this; - } - - template <class InputIterator> - path& assign(InputIterator begin, InputIterator end) - { - return assign(begin, end, codecvt()); - } - - template <class InputIterator> - path& assign(InputIterator begin, InputIterator end, const codecvt_type& cvt) - { - m_pathname.clear(); - if (begin != end) - { - std::basic_string<typename std::iterator_traits<InputIterator>::value_type> - s(begin, end); - path_traits::convert(s.c_str(), s.c_str()+s.size(), m_pathname, cvt); - } - return *this; - } - - // ----- appends ----- - - // if a separator is added, it is the preferred separator for the platform; - // slash for POSIX, backslash for Windows - - path& operator/=(const path& p); - - template <class Source> - typename boost::enable_if<path_traits::is_pathable< - typename boost::decay<Source>::type>, path&>::type - operator/=(Source const& source) - { - return append(source, codecvt()); - } - - template <class Source> - path& append(Source const& source, const codecvt_type& cvt); - - template <class InputIterator> - path& append(InputIterator begin, InputIterator end) - { - return append(begin, end, codecvt()); - } - - template <class InputIterator> - path& append(InputIterator begin, InputIterator end, const codecvt_type& cvt); - - // ----- modifiers ----- - - void clear() { m_pathname.clear(); } - path& make_preferred() -# ifdef BOOST_POSIX_API - { return *this; } // POSIX no effect -# else // BOOST_WINDOWS_API - ; // change slashes to backslashes -# endif - path& remove_filename(); - path& replace_extension(const path& new_extension = path()); - void swap(path& rhs) { m_pathname.swap(rhs.m_pathname); } - - // ----- observers ----- - - // For operating systems that format file paths differently than directory - // paths, return values from observers are formatted as file names unless there - // is a trailing separator, in which case returns are formatted as directory - // paths. POSIX and Windows make no such distinction. - - // Implementations are permitted to return const values or const references. - - // The string or path returned by an observer are specified as being formatted - // as "native" or "generic". - // - // For POSIX, these are all the same format; slashes and backslashes are as input and - // are not modified. - // - // For Windows, native: as input; slashes and backslashes are not modified; - // this is the format of the internally stored string. - // generic: backslashes are converted to slashes - - // ----- native format observers ----- - - const string_type& native() const { return m_pathname; } // Throws: nothing - const value_type* c_str() const { return m_pathname.c_str(); } // Throws: nothing - - template <class String> - String string() const; - - template <class String> - String string(const codecvt_type& cvt) const; - -# ifdef BOOST_WINDOWS_API - const std::string string() const { return string(codecvt()); } - const std::string string(const codecvt_type& cvt) const - { - std::string tmp; - if (!m_pathname.empty()) - path_traits::convert(&*m_pathname.begin(), &*m_pathname.begin()+m_pathname.size(), - tmp, cvt); - return tmp; - } - - // string_type is std::wstring, so there is no conversion - const std::wstring& wstring() const { return m_pathname; } - const std::wstring& wstring(const codecvt_type&) const { return m_pathname; } - -# else // BOOST_POSIX_API - // string_type is std::string, so there is no conversion - const std::string& string() const { return m_pathname; } - const std::string& string(const codecvt_type&) const { return m_pathname; } - - const std::wstring wstring() const { return wstring(codecvt()); } - const std::wstring wstring(const codecvt_type& cvt) const - { - std::wstring tmp; - if (!m_pathname.empty()) - path_traits::convert(&*m_pathname.begin(), &*m_pathname.begin()+m_pathname.size(), - tmp, cvt); - return tmp; - } - -# endif - - // ----- generic format observers ----- - - template <class String> - String generic_string() const; - - template <class String> - String generic_string(const codecvt_type& cvt) const; - -# ifdef BOOST_WINDOWS_API - const std::string generic_string() const { return generic_string(codecvt()); } - const std::string generic_string(const codecvt_type& cvt) const; - const std::wstring generic_wstring() const; - const std::wstring generic_wstring(const codecvt_type&) const { return generic_wstring(); }; - -# else // BOOST_POSIX_API - // On POSIX-like systems, the generic format is the same as the native format - const std::string& generic_string() const { return m_pathname; } - const std::string& generic_string(const codecvt_type&) const { return m_pathname; } - const std::wstring generic_wstring() const { return wstring(codecvt()); } - const std::wstring generic_wstring(const codecvt_type& cvt) const { return wstring(cvt); } - -# endif - - // ----- decomposition ----- - - path root_path() const; - path root_name() const; // returns 0 or 1 element path - // even on POSIX, root_name() is non-empty() for network paths - path root_directory() const; // returns 0 or 1 element path - path relative_path() const; - path parent_path() const; - path filename() const; // returns 0 or 1 element path - path stem() const; // returns 0 or 1 element path - path extension() const; // returns 0 or 1 element path - - // ----- query ----- - - bool empty() const { return m_pathname.empty(); } // name consistent with std containers - bool has_root_path() const { return has_root_directory() || has_root_name(); } - bool has_root_name() const { return !root_name().empty(); } - bool has_root_directory() const { return !root_directory().empty(); } - bool has_relative_path() const { return !relative_path().empty(); } - bool has_parent_path() const { return !parent_path().empty(); } - bool has_filename() const { return !m_pathname.empty(); } - bool has_stem() const { return !stem().empty(); } - bool has_extension() const { return !extension().empty(); } - bool is_absolute() const - { -# ifdef BOOST_WINDOWS_API - return has_root_name() && has_root_directory(); -# else - return has_root_directory(); -# endif - } - bool is_relative() const { return !is_absolute(); } - - // ----- imbue ----- - - static std::locale imbue(const std::locale& loc); - - // ----- codecvt ----- - - static const codecvt_type& codecvt() - { - return *wchar_t_codecvt_facet(); - } - - // ----- iterators ----- - - class iterator; - typedef iterator const_iterator; - - iterator begin() const; - iterator end() const; - - // ----- deprecated functions ----- - -# if defined(BOOST_FILESYSTEM_DEPRECATED) && defined(BOOST_FILESYSTEM_NO_DEPRECATED) -# error both BOOST_FILESYSTEM_DEPRECATED and BOOST_FILESYSTEM_NO_DEPRECATED are defined -# endif - -# if !defined(BOOST_FILESYSTEM_NO_DEPRECATED) - // recently deprecated functions supplied by default - path& normalize() { return m_normalize(); } - path& remove_leaf() { return remove_filename(); } - path leaf() const { return filename(); } - path branch_path() const { return parent_path(); } - bool has_leaf() const { return !m_pathname.empty(); } - bool has_branch_path() const { return !parent_path().empty(); } - bool is_complete() const { return is_absolute(); } -# endif - -# if defined(BOOST_FILESYSTEM_DEPRECATED) - // deprecated functions with enough signature or semantic changes that they are - // not supplied by default - const std::string file_string() const { return string(); } - const std::string directory_string() const { return string(); } - const std::string native_file_string() const { return string(); } - const std::string native_directory_string() const { return string(); } - const string_type external_file_string() const { return native(); } - const string_type external_directory_string() const { return native(); } - - // older functions no longer supported - //typedef bool (*name_check)(const std::string & name); - //basic_path(const string_type& str, name_check) { operator/=(str); } - //basic_path(const typename string_type::value_type* s, name_check) - // { operator/=(s);} - //static bool default_name_check_writable() { return false; } - //static void default_name_check(name_check) {} - //static name_check default_name_check() { return 0; } - //basic_path& canonize(); -# endif - -//--------------------------------------------------------------------------------------// -// class path private members // -//--------------------------------------------------------------------------------------// - - private: -# if defined(_MSC_VER) -# pragma warning(push) // Save warning settings -# pragma warning(disable : 4251) // disable warning: class 'std::basic_string<_Elem,_Traits,_Ax>' -# endif // needs to have dll-interface... -/* - m_pathname has the type, encoding, and format required by the native - operating system. Thus for POSIX and Windows there is no conversion for - passing m_pathname.c_str() to the O/S API or when obtaining a path from the - O/S API. POSIX encoding is unspecified other than for dot and slash - characters; POSIX just treats paths as a sequence of bytes. Windows - encoding is UCS-2 or UTF-16 depending on the version. -*/ - string_type m_pathname; // Windows: as input; backslashes NOT converted to slashes, - // slashes NOT converted to backslashes -# if defined(_MSC_VER) -# pragma warning(pop) // restore warning settings. -# endif - - string_type::size_type m_append_separator_if_needed(); - // Returns: If separator is to be appended, m_pathname.size() before append. Otherwise 0. - // Note: An append is never performed if size()==0, so a returned 0 is unambiguous. - - void m_erase_redundant_separator(string_type::size_type sep_pos); - string_type::size_type m_parent_path_end() const; - - path& m_normalize(); - - // Was qualified; como433beta8 reports: - // warning #427-D: qualified name is not allowed in member declaration - friend class iterator; - friend bool operator<(const path& lhs, const path& rhs); - - // see path::iterator::increment/decrement comment below - static void m_path_iterator_increment(path::iterator & it); - static void m_path_iterator_decrement(path::iterator & it); - - static const codecvt_type *& wchar_t_codecvt_facet(); - - }; // class path - -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED - typedef path wpath; -# endif - - //------------------------------------------------------------------------------------// - // class path::iterator // - //------------------------------------------------------------------------------------// - - class path::iterator - : public boost::iterator_facade< - path::iterator, - path const, - boost::bidirectional_traversal_tag > - { - private: - friend class boost::iterator_core_access; - friend class boost::filesystem3::path; - friend void m_path_iterator_increment(path::iterator & it); - friend void m_path_iterator_decrement(path::iterator & it); - - const path& dereference() const { return m_element; } - - bool equal(const iterator & rhs) const - { - return m_path_ptr == rhs.m_path_ptr && m_pos == rhs.m_pos; - } - - // iterator_facade derived classes don't seem to like implementations in - // separate translation unit dll's, so forward to class path static members - void increment() { m_path_iterator_increment(*this); } - void decrement() { m_path_iterator_decrement(*this); } - - path m_element; // current element - const path * m_path_ptr; // path being iterated over - string_type::size_type m_pos; // position of name in - // m_path_ptr->m_pathname. The - // end() iterator is indicated by - // m_pos == m_path_ptr->m_pathname.size() - }; // path::iterator - - //------------------------------------------------------------------------------------// - // // - // non-member functions // - // // - //------------------------------------------------------------------------------------// - - // std::lexicographical_compare would infinately recurse because path iterators - // yield paths, so provide a path aware version - inline bool lexicographical_compare(path::iterator first1, path::iterator last1, - path::iterator first2, path::iterator last2) - { - for (; first1 != last1 && first2 != last2 ; ++first1, ++first2) - { - if (first1->native() < first2->native()) return true; - if (first2->native() < first1->native()) return false; - } - return first1 == last1 && first2 != last2; - } - - inline bool operator<(const path& lhs, const path& rhs) - { - return lexicographical_compare(lhs.begin(), lhs.end(), rhs.begin(), rhs.end()); - } - - inline bool operator<=(const path& lhs, const path& rhs) { return !(rhs < lhs); } - inline bool operator> (const path& lhs, const path& rhs) { return rhs < lhs; } - inline bool operator>=(const path& lhs, const path& rhs) { return !(lhs < rhs); } - - // equality operators act as if comparing generic format strings, to achieve the - // effect of lexicographical_compare element by element compare. - // operator==() efficiency is a concern; a user reported the original version 2 - // !(lhs < rhs) && !(rhs < lhs) implementation caused a serious performance problem - // for a map of 10,000 paths. - -# ifdef BOOST_WINDOWS_API - inline bool operator==(const path& lhs, const path::value_type* rhs) - { - const path::value_type* l(lhs.c_str()); - while ((*l == *rhs || (*l == L'\\' && *rhs == L'/') || (*l == L'/' && *rhs == L'\\')) - && *l) { ++l; ++rhs; } - return *l == *rhs || (*l == L'\\' && *rhs == L'/') || (*l == L'/' && *rhs == L'\\'); - } - inline bool operator==(const path& lhs, const path& rhs) { return lhs == rhs.c_str(); } - inline bool operator==(const path& lhs, const path::string_type& rhs) { return lhs == rhs.c_str(); } - inline bool operator==(const path::string_type& lhs, const path& rhs) { return rhs == lhs.c_str(); } - inline bool operator==(const path::value_type* lhs, const path& rhs) { return rhs == lhs; } -# else // BOOST_POSIX_API - inline bool operator==(const path& lhs, const path& rhs) { return lhs.native() == rhs.native(); } - inline bool operator==(const path& lhs, const path::string_type& rhs) { return lhs.native() == rhs; } - inline bool operator==(const path& lhs, const path::value_type* rhs) { return lhs.native() == rhs; } - inline bool operator==(const path::string_type& lhs, const path& rhs) { return lhs == rhs.native(); } - inline bool operator==(const path::value_type* lhs, const path& rhs) { return lhs == rhs.native(); } -# endif - - inline bool operator!=(const path& lhs, const path& rhs) { return !(lhs == rhs); } - inline bool operator!=(const path& lhs, const path::string_type& rhs) { return !(lhs == rhs); } - inline bool operator!=(const path& lhs, const path::value_type* rhs) { return !(lhs == rhs); } - inline bool operator!=(const path::string_type& lhs, const path& rhs) { return !(lhs == rhs); } - inline bool operator!=(const path::value_type* lhs, const path& rhs) { return !(lhs == rhs); } - - inline void swap(path& lhs, path& rhs) { lhs.swap(rhs); } - - inline path operator/(const path& lhs, const path& rhs) { return path(lhs) /= rhs; } - - // inserters and extractors - // use boost::io::quoted() to handle spaces in paths - // use '&' as escape character to ease use for Windows paths - - template <class Char, class Traits> - inline std::basic_ostream<Char, Traits>& - operator<<(std::basic_ostream<Char, Traits>& os, const path& p) - { - return os - << boost::io::quoted(p.string<std::basic_string<Char> >(), static_cast<Char>('&')); - } - - template <class Char, class Traits> - inline std::basic_istream<Char, Traits>& - operator>>(std::basic_istream<Char, Traits>& is, path& p) - { - std::basic_string<Char> str; - is >> boost::io::quoted(str, static_cast<Char>('&')); - p = str; - return is; - } - - // name_checks - - // These functions are holdovers from version 1. It isn't clear they have much - // usefulness, or how to generalize them for later versions. - - BOOST_FILESYSTEM_DECL bool portable_posix_name(const std::string & name); - BOOST_FILESYSTEM_DECL bool windows_name(const std::string & name); - BOOST_FILESYSTEM_DECL bool portable_name(const std::string & name); - BOOST_FILESYSTEM_DECL bool portable_directory_name(const std::string & name); - BOOST_FILESYSTEM_DECL bool portable_file_name(const std::string & name); - BOOST_FILESYSTEM_DECL bool native(const std::string & name); - -//--------------------------------------------------------------------------------------// -// class path member template implementation // -//--------------------------------------------------------------------------------------// - - template <class InputIterator> - path& path::append(InputIterator begin, InputIterator end, const codecvt_type& cvt) - { - if (begin == end) - return *this; - string_type::size_type sep_pos(m_append_separator_if_needed()); - std::basic_string<typename std::iterator_traits<InputIterator>::value_type> - s(begin, end); - path_traits::convert(s.c_str(), s.c_str()+s.size(), m_pathname, cvt); - if (sep_pos) - m_erase_redundant_separator(sep_pos); - return *this; - } - - template <class Source> - path& path::append(Source const & source, const codecvt_type& cvt) - { - if (path_traits::empty(source)) - return *this; - string_type::size_type sep_pos(m_append_separator_if_needed()); - path_traits::dispatch(source, m_pathname, cvt); - if (sep_pos) - m_erase_redundant_separator(sep_pos); - return *this; - } - -//--------------------------------------------------------------------------------------// -// class path member template specializations // -//--------------------------------------------------------------------------------------// - - template <> inline - std::string path::string<std::string>() const - { return string(); } - - template <> inline - std::wstring path::string<std::wstring>() const - { return wstring(); } - - template <> inline - std::string path::string<std::string>(const codecvt_type& cvt) const - { return string(cvt); } - - template <> inline - std::wstring path::string<std::wstring>(const codecvt_type& cvt) const - { return wstring(cvt); } - - template <> inline - std::string path::generic_string<std::string>() const - { return generic_string(); } - - template <> inline - std::wstring path::generic_string<std::wstring>() const - { return generic_wstring(); } - - template <> inline - std::string path::generic_string<std::string>(const codecvt_type& cvt) const - { return generic_string(cvt); } - - template <> inline - std::wstring path::generic_string<std::wstring>(const codecvt_type& cvt) const - { return generic_wstring(cvt); } - - -} // namespace filesystem3 -} // namespace boost - -//----------------------------------------------------------------------------// - -namespace boost -{ - namespace filesystem - { - using filesystem3::path; -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED - using filesystem3::wpath; -# endif - using filesystem3::lexicographical_compare; - using filesystem3::portable_posix_name; - using filesystem3::windows_name; - using filesystem3::portable_name; - using filesystem3::portable_directory_name; - using filesystem3::portable_file_name; - using filesystem3::native; - using filesystem3::swap; - using filesystem3::operator<; - using filesystem3::operator==; - using filesystem3::operator!=; - using filesystem3::operator>; - using filesystem3::operator<=; - using filesystem3::operator>=; - using filesystem3::operator/; - using filesystem3::operator<<; - using filesystem3::operator>>; - } -} - -//----------------------------------------------------------------------------// - -#include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas - -#endif // BOOST_FILESYSTEM_PATH_HPP diff --git a/3rdParty/Boost/src/boost/filesystem/v3/path_traits.hpp b/3rdParty/Boost/src/boost/filesystem/v3/path_traits.hpp deleted file mode 100644 index 71e80e2..0000000 --- a/3rdParty/Boost/src/boost/filesystem/v3/path_traits.hpp +++ /dev/null @@ -1,247 +0,0 @@ -// filesystem path_traits.hpp --------------------------------------------------------// - -// Copyright Beman Dawes 2009 - -// Distributed under the Boost Software License, Version 1.0. -// See http://www.boost.org/LICENSE_1_0.txt - -// Library home page: http://www.boost.org/libs/filesystem - -#ifndef BOOST_FILESYSTEM_PATH_TRAITS_HPP -#define BOOST_FILESYSTEM_PATH_TRAITS_HPP - -#include <boost/config.hpp> - -# if defined( BOOST_NO_STD_WSTRING ) -# error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support -# endif - -#include <boost/filesystem/v3/config.hpp> -#include <boost/utility/enable_if.hpp> -#include <boost/type_traits/is_array.hpp> -#include <boost/type_traits/decay.hpp> -#include <boost/system/error_code.hpp> -#include <cwchar> // for mbstate_t -#include <string> -#include <vector> -#include <list> -#include <iterator> -#include <locale> -#include <boost/assert.hpp> -// #include <iostream> //**** comment me out **** - -#include <boost/config/abi_prefix.hpp> // must be the last #include - -namespace boost { namespace filesystem3 { - - BOOST_FILESYSTEM_DECL const system::error_category& codecvt_error_category(); - // uses std::codecvt_base::result used for error codes: - // - // ok: Conversion successful. - // partial: Not all source characters converted; one or more additional source - // characters are needed to produce the final target character, or the - // size of the target intermediate buffer was too small to hold the result. - // error: A character in the source could not be converted to the target encoding. - // noconv: The source and target characters have the same type and encoding, so no - // conversion was necessary. - - class directory_entry; - -namespace path_traits { - - typedef std::codecvt<wchar_t, char, std::mbstate_t> codecvt_type; - - // is_pathable type trait; allows disabling over-agressive class path member templates - - template <class T> - struct is_pathable { static const bool value = false; }; - - template<> struct is_pathable<char*> { static const bool value = true; }; - template<> struct is_pathable<const char*> { static const bool value = true; }; - template<> struct is_pathable<wchar_t*> { static const bool value = true; }; - template<> struct is_pathable<const wchar_t*> { static const bool value = true; }; - template<> struct is_pathable<std::string> { static const bool value = true; }; - template<> struct is_pathable<std::wstring> { static const bool value = true; }; - template<> struct is_pathable<std::vector<char> > { static const bool value = true; }; - template<> struct is_pathable<std::vector<wchar_t> > { static const bool value = true; }; - template<> struct is_pathable<std::list<char> > { static const bool value = true; }; - template<> struct is_pathable<std::list<wchar_t> > { static const bool value = true; }; - template<> struct is_pathable<directory_entry> { static const bool value = true; }; - - // Pathable empty - - template <class Container> inline - // disable_if aids broken compilers (IBM, old GCC, etc.) and is harmless for - // conforming compilers. Replace by plain "bool" at some future date (2012?) - typename boost::disable_if<boost::is_array<Container>, bool>::type - empty(const Container & c) - { return c.begin() == c.end(); } - - template <class T> inline - bool empty(T * const & c_str) - { - BOOST_ASSERT(c_str); - return !*c_str; - } - - template <typename T, size_t N> inline - bool empty(T (&)[N]) - { return N <= 1; } - - // value types differ ---------------------------------------------------------------// - // - // A from_end argument of 0 is less efficient than a known end, so use only if needed - - BOOST_FILESYSTEM_DECL - void convert(const char* from, - const char* from_end, // 0 for null terminated MBCS - std::wstring & to, - const codecvt_type& cvt); - - BOOST_FILESYSTEM_DECL - void convert(const wchar_t* from, - const wchar_t* from_end, // 0 for null terminated MBCS - std::string & to, - const codecvt_type& cvt); - - inline - void convert(const char* from, - std::wstring & to, - const codecvt_type& cvt) - { - BOOST_ASSERT(from); - convert(from, 0, to, cvt); - } - - inline - void convert(const wchar_t* from, - std::string & to, - const codecvt_type& cvt) - { - BOOST_ASSERT(from); - convert(from, 0, to, cvt); - } - - // value types same -----------------------------------------------------------------// - - // char - - inline - void convert(const char* from, const char* from_end, std::string & to, - const codecvt_type&) - { - BOOST_ASSERT(from); - BOOST_ASSERT(from_end); - to.append(from, from_end); - } - - inline - void convert(const char* from, - std::string & to, - const codecvt_type&) - { - BOOST_ASSERT(from); - to += from; - } - - // wchar_t - - inline - void convert(const wchar_t* from, const wchar_t* from_end, std::wstring & to, - const codecvt_type&) - { - BOOST_ASSERT(from); - BOOST_ASSERT(from_end); - to.append(from, from_end); - } - - inline - void convert(const wchar_t* from, - std::wstring & to, - const codecvt_type&) - { - BOOST_ASSERT(from); - to += from; - } - - // Source dispatch - - // contiguous containers - template <class U> inline - void dispatch(const std::string& c, U& to, const codecvt_type& cvt) - { - if (c.size()) - convert(&*c.begin(), &*c.begin() + c.size(), to, cvt); - } - template <class U> inline - void dispatch(const std::wstring& c, U& to, const codecvt_type& cvt) - { - if (c.size()) - convert(&*c.begin(), &*c.begin() + c.size(), to, cvt); - } - template <class U> inline - void dispatch(const std::vector<char>& c, U& to, const codecvt_type& cvt) - { - if (c.size()) - convert(&*c.begin(), &*c.begin() + c.size(), to, cvt); - } - template <class U> inline - void dispatch(const std::vector<wchar_t>& c, U& to, const codecvt_type& cvt) - { - if (c.size()) - convert(&*c.begin(), &*c.begin() + c.size(), to, cvt); - } - - // non-contiguous containers - template <class Container, class U> inline - // disable_if aids broken compilers (IBM, old GCC, etc.) and is harmless for - // conforming compilers. Replace by plain "void" at some future date (2012?) - typename boost::disable_if<boost::is_array<Container>, void>::type - dispatch(const Container & c, U& to, const codecvt_type& cvt) - { - if (c.size()) - { - std::basic_string<typename Container::value_type> s(c.begin(), c.end()); - convert(s.c_str(), s.c_str()+s.size(), to, cvt); - } - } - - // c_str - template <class T, class U> inline - void dispatch(T * const & c_str, U& to, const codecvt_type& cvt) - { -// std::cout << "dispatch() const T *\n"; - BOOST_ASSERT(c_str); - convert(c_str, to, cvt); - } - - // Note: there is no dispatch on C-style arrays because the array may - // contain a string smaller than the array size. - - BOOST_FILESYSTEM_DECL - void dispatch(const directory_entry & de, -# ifdef BOOST_WINDOWS_API - std::wstring & to, -# else - std::string & to, -# endif - const codecvt_type&); - - -}}} // namespace boost::filesystem::path_traits - -//----------------------------------------------------------------------------// - -namespace boost -{ - namespace filesystem - { - using filesystem3::codecvt_error_category; -# ifndef BOOST_FILESYSTEM_NO_DEPRECATED -# endif - } -} - -#include <boost/config/abi_suffix.hpp> // pops abi_prefix.hpp pragmas - -#endif // BOOST_FILESYSTEM_PATH_TRAITS_HPP diff --git a/3rdParty/Boost/src/boost/foreach.hpp b/3rdParty/Boost/src/boost/foreach.hpp index db5b203..571b45c 100644 --- a/3rdParty/Boost/src/boost/foreach.hpp +++ b/3rdParty/Boost/src/boost/foreach.hpp @@ -15,6 +15,7 @@ // Alisdair Meredith - For help porting to Borland // Stefan Slapeta - For help porting to Intel // David Jenkins - For help finding a Microsoft Code Analysis bug +// mimomorin@... - For a patch to use rvalue refs on supporting compilers #ifndef BOOST_FOREACH @@ -30,8 +31,10 @@ #include <boost/detail/workaround.hpp> // Some compilers let us detect even const-qualified rvalues at compile-time -#if BOOST_WORKAROUND(BOOST_MSVC, >= 1310) && !defined(_PREFAST_) \ - || (BOOST_WORKAROUND(__GNUC__, >= 4) && !defined(BOOST_INTEL) && !defined(BOOST_CLANG)) \ +#if !defined(BOOST_NO_RVALUE_REFERENCES) \ + || BOOST_WORKAROUND(BOOST_MSVC, >= 1310) && !defined(_PREFAST_) \ + || (BOOST_WORKAROUND(__GNUC__, == 4) && (__GNUC_MINOR__ <= 5) && !defined(BOOST_INTEL) && \ + !defined(BOOST_CLANG)) \ || (BOOST_WORKAROUND(__GNUC__, == 3) && (__GNUC_MINOR__ >= 4) && !defined(BOOST_INTEL) && \ !defined(BOOST_CLANG)) # define BOOST_FOREACH_COMPILE_TIME_CONST_RVALUE_DETECTION @@ -80,6 +83,7 @@ #include <boost/type_traits/is_const.hpp> #include <boost/type_traits/is_abstract.hpp> #include <boost/type_traits/is_base_and_derived.hpp> +#include <boost/type_traits/is_rvalue_reference.hpp> #include <boost/iterator/iterator_traits.hpp> #include <boost/utility/addressof.hpp> #include <boost/foreach_fwd.hpp> @@ -214,12 +218,6 @@ template<typename Bool1> inline boost::mpl::not_<Bool1> *not_(Bool1 *) { return 0; } template<typename T> -inline boost::mpl::false_ *is_rvalue_(T &, int) { return 0; } - -template<typename T> -inline boost::mpl::true_ *is_rvalue_(T const &, ...) { return 0; } - -template<typename T> inline boost::is_array<T> *is_array_(T const &) { return 0; } template<typename T> @@ -230,6 +228,17 @@ template<typename T> inline boost::mpl::true_ *is_const_(T const &) { return 0; } #endif +#ifdef BOOST_NO_RVALUE_REFERENCES +template<typename T> +inline boost::mpl::false_ *is_rvalue_(T &, int) { return 0; } + +template<typename T> +inline boost::mpl::true_ *is_rvalue_(T const &, ...) { return 0; } +#else +template<typename T> +inline boost::is_rvalue_reference<T &&> *is_rvalue_(T &&, int) { return 0; } +#endif + /////////////////////////////////////////////////////////////////////////////// // auto_any_t/auto_any // General utility for putting an object of any type into automatic storage @@ -428,7 +437,6 @@ inline T (*&to_ptr(T (&)[N]))[N] static T (*t)[N] = 0; return t; } -#endif /////////////////////////////////////////////////////////////////////////////// // derefof @@ -445,7 +453,23 @@ inline T &derefof(T *t) ); } -#ifdef BOOST_FOREACH_COMPILE_TIME_CONST_RVALUE_DETECTION +# define BOOST_FOREACH_DEREFOF(T) boost::foreach_detail_::derefof(*T) +#else +# define BOOST_FOREACH_DEREFOF(T) (*T) +#endif + +#if defined(BOOST_FOREACH_COMPILE_TIME_CONST_RVALUE_DETECTION) \ + && !defined(BOOST_NO_RVALUE_REFERENCES) +/////////////////////////////////////////////////////////////////////////////// +// Rvalue references makes it drop-dead simple to detect at compile time +// whether an expression is an rvalue. +/////////////////////////////////////////////////////////////////////////////// + +# define BOOST_FOREACH_IS_RVALUE(COL) \ + boost::foreach_detail_::is_rvalue_((COL), 0) + +#elif defined(BOOST_FOREACH_COMPILE_TIME_CONST_RVALUE_DETECTION) \ + && defined(BOOST_NO_RVALUE_REFERENCES) /////////////////////////////////////////////////////////////////////////////// // Detect at compile-time whether an expression yields an rvalue or // an lvalue. This is rather non-standard, but some popular compilers @@ -647,7 +671,7 @@ begin(auto_any_t col, type2type<T, C> *, boost::mpl::false_ *) // lvalue typedef BOOST_DEDUCED_TYPENAME type2type<T, C>::type type; typedef BOOST_DEDUCED_TYPENAME foreach_iterator<T, C>::type iterator; return auto_any<BOOST_DEDUCED_TYPENAME foreach_iterator<T, C>::type>( - iterator(boost::begin(derefof(auto_any_cast<type *, boost::mpl::false_>(col))))); + iterator(boost::begin(BOOST_FOREACH_DEREFOF((auto_any_cast<type *, boost::mpl::false_>(col)))))); } #ifdef BOOST_FOREACH_RUN_TIME_CONST_RVALUE_DETECTION @@ -687,7 +711,7 @@ end(auto_any_t col, type2type<T, C> *, boost::mpl::false_ *) // lvalue typedef BOOST_DEDUCED_TYPENAME type2type<T, C>::type type; typedef BOOST_DEDUCED_TYPENAME foreach_iterator<T, C>::type iterator; return auto_any<BOOST_DEDUCED_TYPENAME foreach_iterator<T, C>::type>( - iterator(boost::end(derefof(auto_any_cast<type *, boost::mpl::false_>(col))))); + iterator(boost::end(BOOST_FOREACH_DEREFOF((auto_any_cast<type *, boost::mpl::false_>(col)))))); } #ifdef BOOST_FOREACH_RUN_TIME_CONST_RVALUE_DETECTION @@ -766,7 +790,7 @@ rbegin(auto_any_t col, type2type<T, C> *, boost::mpl::false_ *) // lvalue typedef BOOST_DEDUCED_TYPENAME type2type<T, C>::type type; typedef BOOST_DEDUCED_TYPENAME foreach_reverse_iterator<T, C>::type iterator; return auto_any<BOOST_DEDUCED_TYPENAME foreach_reverse_iterator<T, C>::type>( - iterator(boost::rbegin(derefof(auto_any_cast<type *, boost::mpl::false_>(col))))); + iterator(boost::rbegin(BOOST_FOREACH_DEREFOF((auto_any_cast<type *, boost::mpl::false_>(col)))))); } #ifdef BOOST_FOREACH_RUN_TIME_CONST_RVALUE_DETECTION @@ -809,7 +833,7 @@ rend(auto_any_t col, type2type<T, C> *, boost::mpl::false_ *) // lvalue typedef BOOST_DEDUCED_TYPENAME type2type<T, C>::type type; typedef BOOST_DEDUCED_TYPENAME foreach_reverse_iterator<T, C>::type iterator; return auto_any<BOOST_DEDUCED_TYPENAME foreach_reverse_iterator<T, C>::type>( - iterator(boost::rend(derefof(auto_any_cast<type *, boost::mpl::false_>(col))))); + iterator(boost::rend(BOOST_FOREACH_DEREFOF((auto_any_cast<type *, boost::mpl::false_>(col)))))); } #ifdef BOOST_FOREACH_RUN_TIME_CONST_RVALUE_DETECTION @@ -902,7 +926,7 @@ rderef(auto_any_t cur, type2type<T, C> *) boost::foreach_detail_::to_ptr(COL) \ , boost_foreach_argument_dependent_lookup_hack_value)) -#ifdef BOOST_FOREACH_COMPILE_TIME_CONST_RVALUE_DETECTION +#if defined(BOOST_FOREACH_COMPILE_TIME_CONST_RVALUE_DETECTION) /////////////////////////////////////////////////////////////////////////////// // R-values and const R-values supported here with zero runtime overhead /////////////////////////////////////////////////////////////////////////////// diff --git a/3rdParty/Boost/src/boost/function.hpp b/3rdParty/Boost/src/boost/function.hpp index bdb2769..b72842b 100644 --- a/3rdParty/Boost/src/boost/function.hpp +++ b/3rdParty/Boost/src/boost/function.hpp @@ -23,8 +23,8 @@ // in anything that may be included by function_template.hpp doesn't break #include <boost/function/detail/prologue.hpp> -// Visual Age C++ doesn't handle the file iteration well -#if BOOST_WORKAROUND(__IBMCPP__, >= 500) +// Older Visual Age C++ version do not handle the file iteration well +#if BOOST_WORKAROUND(__IBMCPP__, >= 500) && BOOST_WORKAROUND(__IBMCPP__, < 800) # if BOOST_FUNCTION_MAX_ARGS >= 0 # include <boost/function/function0.hpp> # endif diff --git a/3rdParty/Boost/src/boost/function/function_base.hpp b/3rdParty/Boost/src/boost/function/function_base.hpp index fe9bbbe..78b7dd1 100644 --- a/3rdParty/Boost/src/boost/function/function_base.hpp +++ b/3rdParty/Boost/src/boost/function/function_base.hpp @@ -203,11 +203,11 @@ namespace boost { { switch (op) { case clone_functor_tag: - out_buffer.obj_ref.obj_ptr = in_buffer.obj_ref.obj_ptr; + out_buffer.obj_ref = in_buffer.obj_ref; return; case move_functor_tag: - out_buffer.obj_ref.obj_ptr = in_buffer.obj_ref.obj_ptr; + out_buffer.obj_ref = in_buffer.obj_ref; in_buffer.obj_ref.obj_ptr = 0; return; @@ -315,14 +315,18 @@ namespace boost { if (op == clone_functor_tag || op == move_functor_tag) { const functor_type* in_functor = reinterpret_cast<const functor_type*>(&in_buffer.data); - new ((void*)&out_buffer.data) functor_type(*in_functor); + new (reinterpret_cast<void*>(&out_buffer.data)) functor_type(*in_functor); if (op == move_functor_tag) { - reinterpret_cast<functor_type*>(&in_buffer.data)->~Functor(); + functor_type* f = reinterpret_cast<functor_type*>(&in_buffer.data); + (void)f; // suppress warning about the value of f not being used (MSVC) + f->~Functor(); } } else if (op == destroy_functor_tag) { // Some compilers (Borland, vc6, ...) are unhappy with ~functor_type. - reinterpret_cast<functor_type*>(&out_buffer.data)->~Functor(); + functor_type* f = reinterpret_cast<functor_type*>(&out_buffer.data); + (void)f; // suppress warning about the value of f not being used (MSVC) + f->~Functor(); } else if (op == check_functor_type_tag) { const detail::sp_typeinfo& check_type = *out_buffer.type.type; @@ -369,8 +373,10 @@ namespace boost { // Clone the functor // GCC 2.95.3 gets the CV qualifiers wrong here, so we // can't do the static_cast that we should do. + // jewillco: Changing this to static_cast because GCC 2.95.3 is + // obsolete. const functor_type* f = - (const functor_type*)(in_buffer.obj_ptr); + static_cast<const functor_type*>(in_buffer.obj_ptr); functor_type* new_f = new functor_type(*f); out_buffer.obj_ptr = new_f; } else if (op == move_functor_tag) { @@ -474,7 +480,7 @@ namespace boost { // GCC 2.95.3 gets the CV qualifiers wrong here, so we // can't do the static_cast that we should do. const functor_wrapper_type* f = - (const functor_wrapper_type*)(in_buffer.obj_ptr); + static_cast<const functor_wrapper_type*>(in_buffer.obj_ptr); wrapper_allocator_type wrapper_allocator(static_cast<Allocator const &>(*f)); wrapper_allocator_pointer_type copy = wrapper_allocator.allocate(1); wrapper_allocator.construct(copy, *f); @@ -671,7 +677,7 @@ public: detail::function::check_functor_type_tag); // GCC 2.95.3 gets the CV qualifiers wrong here, so we // can't do the static_cast that we should do. - return (const Functor*)(type_result.obj_ptr); + return static_cast<const Functor*>(type_result.obj_ptr); } template<typename F> @@ -715,7 +721,7 @@ public: public: // should be protected, but GCC 2.95.3 will fail to allow access detail::function::vtable_base* get_vtable() const { return reinterpret_cast<detail::function::vtable_base*>( - reinterpret_cast<std::size_t>(vtable) & ~(std::size_t)0x01); + reinterpret_cast<std::size_t>(vtable) & ~static_cast<std::size_t>(0x01)); } bool has_trivial_copy_and_destroy() const { diff --git a/3rdParty/Boost/src/boost/function/function_template.hpp b/3rdParty/Boost/src/boost/function/function_template.hpp index 6a99109..f9699d0 100644 --- a/3rdParty/Boost/src/boost/function/function_template.hpp +++ b/3rdParty/Boost/src/boost/function/function_template.hpp @@ -486,19 +486,19 @@ namespace boost { BOOST_FUNCTION_TEMPLATE_ARGS); template<typename F> - bool assign_to(F f, function_buffer& functor) + bool assign_to(F f, function_buffer& functor) const { typedef typename get_function_tag<F>::type tag; return assign_to(f, functor, tag()); } template<typename F,typename Allocator> - bool assign_to_a(F f, function_buffer& functor, Allocator a) + bool assign_to_a(F f, function_buffer& functor, Allocator a) const { typedef typename get_function_tag<F>::type tag; return assign_to_a(f, functor, a, tag()); } - void clear(function_buffer& functor) + void clear(function_buffer& functor) const { if (base.manager) base.manager(functor, functor, destroy_functor_tag); @@ -508,13 +508,13 @@ namespace boost { // Function pointers template<typename FunctionPtr> bool - assign_to(FunctionPtr f, function_buffer& functor, function_ptr_tag) + assign_to(FunctionPtr f, function_buffer& functor, function_ptr_tag) const { this->clear(functor); if (f) { // should be a reinterpret cast, but some compilers insist // on giving cv-qualifiers to free functions - functor.func_ptr = (void (*)())(f); + functor.func_ptr = reinterpret_cast<void (*)()>(f); return true; } else { return false; @@ -522,7 +522,7 @@ namespace boost { } template<typename FunctionPtr,typename Allocator> bool - assign_to_a(FunctionPtr f, function_buffer& functor, Allocator, function_ptr_tag) + assign_to_a(FunctionPtr f, function_buffer& functor, Allocator, function_ptr_tag) const { return assign_to(f,functor,function_ptr_tag()); } @@ -530,26 +530,26 @@ namespace boost { // Member pointers #if BOOST_FUNCTION_NUM_ARGS > 0 template<typename MemberPtr> - bool assign_to(MemberPtr f, function_buffer& functor, member_ptr_tag) + bool assign_to(MemberPtr f, function_buffer& functor, member_ptr_tag) const { // DPG TBD: Add explicit support for member function // objects, so we invoke through mem_fn() but we retain the // right target_type() values. if (f) { - this->assign_to(mem_fn(f), functor); + this->assign_to(boost::mem_fn(f), functor); return true; } else { return false; } } template<typename MemberPtr,typename Allocator> - bool assign_to_a(MemberPtr f, function_buffer& functor, Allocator a, member_ptr_tag) + bool assign_to_a(MemberPtr f, function_buffer& functor, Allocator a, member_ptr_tag) const { // DPG TBD: Add explicit support for member function // objects, so we invoke through mem_fn() but we retain the // right target_type() values. if (f) { - this->assign_to_a(mem_fn(f), functor, a); + this->assign_to_a(boost::mem_fn(f), functor, a); return true; } else { return false; @@ -561,13 +561,13 @@ namespace boost { // Assign to a function object using the small object optimization template<typename FunctionObj> void - assign_functor(FunctionObj f, function_buffer& functor, mpl::true_) + assign_functor(FunctionObj f, function_buffer& functor, mpl::true_) const { - new ((void*)&functor.data) FunctionObj(f); + new (reinterpret_cast<void*>(&functor.data)) FunctionObj(f); } template<typename FunctionObj,typename Allocator> void - assign_functor_a(FunctionObj f, function_buffer& functor, Allocator, mpl::true_) + assign_functor_a(FunctionObj f, function_buffer& functor, Allocator, mpl::true_) const { assign_functor(f,functor,mpl::true_()); } @@ -575,13 +575,13 @@ namespace boost { // Assign to a function object allocated on the heap. template<typename FunctionObj> void - assign_functor(FunctionObj f, function_buffer& functor, mpl::false_) + assign_functor(FunctionObj f, function_buffer& functor, mpl::false_) const { functor.obj_ptr = new FunctionObj(f); } template<typename FunctionObj,typename Allocator> void - assign_functor_a(FunctionObj f, function_buffer& functor, Allocator a, mpl::false_) + assign_functor_a(FunctionObj f, function_buffer& functor, Allocator a, mpl::false_) const { typedef functor_wrapper<FunctionObj,Allocator> functor_wrapper_type; typedef typename Allocator::template rebind<functor_wrapper_type>::other @@ -596,7 +596,7 @@ namespace boost { template<typename FunctionObj> bool - assign_to(FunctionObj f, function_buffer& functor, function_obj_tag) + assign_to(FunctionObj f, function_buffer& functor, function_obj_tag) const { if (!boost::detail::function::has_empty_target(boost::addressof(f))) { assign_functor(f, functor, @@ -608,7 +608,7 @@ namespace boost { } template<typename FunctionObj,typename Allocator> bool - assign_to_a(FunctionObj f, function_buffer& functor, Allocator a, function_obj_tag) + assign_to_a(FunctionObj f, function_buffer& functor, Allocator a, function_obj_tag) const { if (!boost::detail::function::has_empty_target(boost::addressof(f))) { assign_functor_a(f, functor, a, @@ -623,9 +623,9 @@ namespace boost { template<typename FunctionObj> bool assign_to(const reference_wrapper<FunctionObj>& f, - function_buffer& functor, function_obj_ref_tag) + function_buffer& functor, function_obj_ref_tag) const { - functor.obj_ref.obj_ptr = (void *)f.get_pointer(); + functor.obj_ref.obj_ptr = (void *)(f.get_pointer()); functor.obj_ref.is_const_qualified = is_const<FunctionObj>::value; functor.obj_ref.is_volatile_qualified = is_volatile<FunctionObj>::value; return true; @@ -633,7 +633,7 @@ namespace boost { template<typename FunctionObj,typename Allocator> bool assign_to_a(const reference_wrapper<FunctionObj>& f, - function_buffer& functor, Allocator, function_obj_ref_tag) + function_buffer& functor, Allocator, function_obj_ref_tag) const { return assign_to(f,functor,function_obj_ref_tag()); } @@ -677,7 +677,7 @@ namespace boost { vtable_type* get_vtable() const { return reinterpret_cast<vtable_type*>( - reinterpret_cast<std::size_t>(vtable) & ~(std::size_t)0x01); + reinterpret_cast<std::size_t>(vtable) & ~static_cast<size_t>(0x01)); } struct clear_type {}; @@ -748,12 +748,16 @@ namespace boost { { this->assign_to_own(f); } - + +#ifndef BOOST_NO_RVALUE_REFERENCES + BOOST_FUNCTION_FUNCTION(BOOST_FUNCTION_FUNCTION&& f) : function_base() + { + this->move_assign(f); + } +#endif + ~BOOST_FUNCTION_FUNCTION() { clear(); } -#if BOOST_WORKAROUND(BOOST_MSVC, < 1300) - // MSVC 6.0 and prior require all definitions to be inline, but - // these definitions can become very costly. result_type operator()(BOOST_FUNCTION_PARMS) const { if (this->empty()) @@ -762,9 +766,6 @@ namespace boost { return get_vtable()->invoker (this->functor BOOST_FUNCTION_COMMA BOOST_FUNCTION_ARGS); } -#else - result_type operator()(BOOST_FUNCTION_PARMS) const; -#endif // The distinction between when to use BOOST_FUNCTION_FUNCTION and // when to use self_type is obnoxious. MSVC cannot handle self_type as @@ -836,6 +837,26 @@ namespace boost { BOOST_CATCH_END return *this; } + +#ifndef BOOST_NO_RVALUE_REFERENCES + // Move assignment from another BOOST_FUNCTION_FUNCTION + BOOST_FUNCTION_FUNCTION& operator=(BOOST_FUNCTION_FUNCTION&& f) + { + + if (&f == this) + return *this; + + this->clear(); + BOOST_TRY { + this->move_assign(f); + } BOOST_CATCH (...) { + vtable = 0; + BOOST_RETHROW; + } + BOOST_CATCH_END + return *this; + } +#endif void swap(BOOST_FUNCTION_FUNCTION& other) { @@ -864,7 +885,7 @@ namespace boost { #else private: struct dummy { - void nonnull() {}; + void nonnull() {} }; typedef void (dummy::*safe_bool)(); @@ -909,7 +930,7 @@ namespace boost { // static initialization. Otherwise, we will have a race // condition here in multi-threaded code. See // http://thread.gmane.org/gmane.comp.lib.boost.devel/164902/. - static vtable_type stored_vtable = + static const vtable_type stored_vtable = { { &manager_type::manage }, &invoker_type::invoke }; if (stored_vtable.assign_to(f, functor)) { @@ -917,7 +938,7 @@ namespace boost { if (boost::has_trivial_copy_constructor<Functor>::value && boost::has_trivial_destructor<Functor>::value && detail::function::function_allows_small_object_optimization<Functor>::value) - value |= (std::size_t)0x01; + value |= static_cast<size_t>(0x01); vtable = reinterpret_cast<detail::function::vtable_base *>(value); } else vtable = 0; @@ -943,7 +964,7 @@ namespace boost { // static initialization. Otherwise, we will have a race // condition here in multi-threaded code. See // http://thread.gmane.org/gmane.comp.lib.boost.devel/164902/. - static vtable_type stored_vtable = + static const vtable_type stored_vtable = { { &manager_type::manage }, &invoker_type::invoke }; if (stored_vtable.assign_to_a(f, functor, a)) { @@ -951,7 +972,7 @@ namespace boost { if (boost::has_trivial_copy_constructor<Functor>::value && boost::has_trivial_destructor<Functor>::value && detail::function::function_allows_small_object_optimization<Functor>::value) - value |= (std::size_t)0x01; + value |= static_cast<std::size_t>(0x01); vtable = reinterpret_cast<detail::function::vtable_base *>(value); } else vtable = 0; @@ -998,22 +1019,6 @@ namespace boost { f1.swap(f2); } -#if !BOOST_WORKAROUND(BOOST_MSVC, < 1300) - template<typename R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_PARMS> - typename BOOST_FUNCTION_FUNCTION< - R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_ARGS>::result_type - inline - BOOST_FUNCTION_FUNCTION<R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_ARGS> - ::operator()(BOOST_FUNCTION_PARMS) const - { - if (this->empty()) - boost::throw_exception(bad_function_call()); - - return get_vtable()->invoker - (this->functor BOOST_FUNCTION_COMMA BOOST_FUNCTION_ARGS); - } -#endif - // Poison comparisons between boost::function objects of the same type. template<typename R BOOST_FUNCTION_COMMA BOOST_FUNCTION_TEMPLATE_PARMS> void operator==(const BOOST_FUNCTION_FUNCTION< @@ -1085,12 +1090,26 @@ public: function(const base_type& f) : base_type(static_cast<const base_type&>(f)){} +#ifndef BOOST_NO_RVALUE_REFERENCES + // Move constructors + function(self_type&& f): base_type(static_cast<base_type&&>(f)){} + function(base_type&& f): base_type(static_cast<base_type&&>(f)){} +#endif + self_type& operator=(const self_type& f) { self_type(f).swap(*this); return *this; } +#ifndef BOOST_NO_RVALUE_REFERENCES + self_type& operator=(self_type&& f) + { + self_type(static_cast<self_type&&>(f)).swap(*this); + return *this; + } +#endif + template<typename Functor> #ifndef BOOST_NO_SFINAE typename enable_if_c< @@ -1119,6 +1138,14 @@ public: self_type(f).swap(*this); return *this; } + +#ifndef BOOST_NO_RVALUE_REFERENCES + self_type& operator=(base_type&& f) + { + self_type(static_cast<base_type&&>(f)).swap(*this); + return *this; + } +#endif }; #undef BOOST_FUNCTION_PARTIAL_SPEC diff --git a/3rdParty/Boost/src/boost/functional/hash/detail/container_fwd_0x.hpp b/3rdParty/Boost/src/boost/functional/hash/detail/container_fwd_0x.hpp new file mode 100644 index 0000000..bed7730 --- /dev/null +++ b/3rdParty/Boost/src/boost/functional/hash/detail/container_fwd_0x.hpp @@ -0,0 +1,29 @@ + +// Copyright 2012 Daniel James. +// 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_DETAIL_CONTAINER_FWD_0X_HPP) +#define BOOST_DETAIL_CONTAINER_FWD_0X_HPP + +#include <boost/detail/container_fwd.hpp> + +// std::array + +#if !defined(BOOST_NO_CXX11_HDR_ARRAY) +# include <array> +#endif + +// std::tuple + +#if !defined(BOOST_NO_CXX11_HDR_TUPLE) +# include <tuple> +#endif + +// std::shared_ptr/std::unique_ptr + +#if !defined(BOOST_NO_CXX11_HDR_MEMORY) +# include <memory> +#endif + +#endif diff --git a/3rdParty/Boost/src/boost/functional/hash/detail/hash_float.hpp b/3rdParty/Boost/src/boost/functional/hash/detail/hash_float.hpp index ea1bc25..3edc6ab 100644 --- a/3rdParty/Boost/src/boost/functional/hash/detail/hash_float.hpp +++ b/3rdParty/Boost/src/boost/functional/hash/detail/hash_float.hpp @@ -1,5 +1,5 @@ -// Copyright 2005-2009 Daniel James. +// Copyright 2005-2012 Daniel James. // 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) @@ -13,21 +13,19 @@ #include <boost/config.hpp> #include <boost/functional/hash/detail/float_functions.hpp> #include <boost/functional/hash/detail/limits.hpp> +#include <boost/utility/enable_if.hpp> #include <boost/integer/static_log2.hpp> #include <boost/cstdint.hpp> #include <boost/assert.hpp> +#include <boost/limits.hpp> +#include <cstring> -// Include hash implementation for the current platform. - -// Cygwn -#if defined(__CYGWIN__) -# if defined(__i386__) || defined(_M_IX86) -# include <boost/functional/hash/detail/hash_float_x86.hpp> -# else -# include <boost/functional/hash/detail/hash_float_generic.hpp> -# endif -#else -# include <boost/functional/hash/detail/hash_float_generic.hpp> +#if defined(BOOST_MSVC) +#pragma warning(push) +#if BOOST_MSVC >= 1400 +#pragma warning(disable:6294) // Ill-defined for-loop: initial condition does + // not satisfy test. Loop body not executed +#endif #endif // Can we use fpclassify? @@ -50,6 +48,157 @@ # define BOOST_HASH_USE_FPCLASSIFY 0 #endif +namespace boost +{ + namespace hash_detail + { + inline void hash_float_combine(std::size_t& seed, std::size_t value) + { + seed ^= value + (seed<<6) + (seed>>2); + } + + //////////////////////////////////////////////////////////////////////// + // Binary hash function + // + // Only used for floats with known iec559 floats, and certain values in + // numeric_limits + + inline std::size_t hash_binary(char* ptr, std::size_t length) + { + std::size_t seed = 0; + + if (length >= sizeof(std::size_t)) { + seed = *(std::size_t*) ptr; + length -= sizeof(std::size_t); + ptr += sizeof(std::size_t); + + while(length >= sizeof(std::size_t)) { + hash_float_combine(seed, *(std::size_t*) ptr); + length -= sizeof(std::size_t); + ptr += sizeof(std::size_t); + } + } + + if (length > 0) { + std::size_t buffer = 0; + std::memcpy(&buffer, ptr, length); + hash_float_combine(seed, buffer); + } + + return seed; + } + + template <typename Float> + inline std::size_t float_hash_impl(Float v, + BOOST_DEDUCED_TYPENAME boost::enable_if_c< + std::numeric_limits<Float>::is_iec559 && + std::numeric_limits<Float>::digits == 24 && + std::numeric_limits<Float>::radix == 2 && + std::numeric_limits<Float>::max_exponent == 128, + int>::type + ) + { + return hash_binary((char*) &v, 4); + } + + + template <typename Float> + inline std::size_t float_hash_impl(Float v, + BOOST_DEDUCED_TYPENAME boost::enable_if_c< + std::numeric_limits<Float>::is_iec559 && + std::numeric_limits<Float>::digits == 53 && + std::numeric_limits<Float>::radix == 2 && + std::numeric_limits<Float>::max_exponent == 1024, + int>::type + ) + { + return hash_binary((char*) &v, 8); + } + + template <typename Float> + inline std::size_t float_hash_impl(Float v, + BOOST_DEDUCED_TYPENAME boost::enable_if_c< + std::numeric_limits<Float>::is_iec559 && + std::numeric_limits<Float>::digits == 64 && + std::numeric_limits<Float>::radix == 2 && + std::numeric_limits<Float>::max_exponent == 16384, + int>::type + ) + { + return hash_binary((char*) &v, 10); + } + + template <typename Float> + inline std::size_t float_hash_impl(Float v, + BOOST_DEDUCED_TYPENAME boost::enable_if_c< + std::numeric_limits<Float>::is_iec559 && + std::numeric_limits<Float>::digits == 113 && + std::numeric_limits<Float>::radix == 2 && + std::numeric_limits<Float>::max_exponent == 16384, + int>::type + ) + { + return hash_binary((char*) &v, 16); + } + + //////////////////////////////////////////////////////////////////////// + // Portable hash function + // + // Used as a fallback when the binary hash function isn't supported. + + template <class T> + inline std::size_t float_hash_impl2(T v) + { + boost::hash_detail::call_frexp<T> frexp; + boost::hash_detail::call_ldexp<T> ldexp; + + int exp = 0; + + v = frexp(v, &exp); + + // A postive value is easier to hash, so combine the + // sign with the exponent and use the absolute value. + if(v < 0) { + v = -v; + exp += limits<T>::max_exponent - + limits<T>::min_exponent; + } + + v = ldexp(v, limits<std::size_t>::digits); + std::size_t seed = static_cast<std::size_t>(v); + v -= static_cast<T>(seed); + + // ceiling(digits(T) * log2(radix(T))/ digits(size_t)) - 1; + std::size_t const length + = (limits<T>::digits * + boost::static_log2<limits<T>::radix>::value + + limits<std::size_t>::digits - 1) + / limits<std::size_t>::digits; + + for(std::size_t i = 0; i != length; ++i) + { + v = ldexp(v, limits<std::size_t>::digits); + std::size_t part = static_cast<std::size_t>(v); + v -= static_cast<T>(part); + hash_float_combine(seed, part); + } + + hash_float_combine(seed, exp); + + return seed; + } + +#if !defined(BOOST_HASH_DETAIL_TEST_WITHOUT_GENERIC) + template <class T> + inline std::size_t float_hash_impl(T v, ...) + { + typedef BOOST_DEDUCED_TYPENAME select_hash_type<T>::type type; + return float_hash_impl2(static_cast<type>(v)); + } +#endif + } +} + #if BOOST_HASH_USE_FPCLASSIFY #include <boost/config/no_tr1/cmath.hpp> @@ -71,7 +220,7 @@ namespace boost return (std::size_t)(-3); case FP_NORMAL: case FP_SUBNORMAL: - return float_hash_impl(v); + return float_hash_impl(v, 0); default: BOOST_ASSERT(0); return 0; @@ -87,9 +236,23 @@ namespace boost namespace hash_detail { template <class T> + inline bool is_zero(T v) + { +#if !defined(__GNUC__) + return v == 0; +#else + // GCC's '-Wfloat-equal' will complain about comparing + // v to 0, but because it disables warnings for system + // headers it won't complain if you use std::equal_to to + // compare with 0. Resulting in this silliness: + return std::equal_to<T>()(v, 0); +#endif + } + + template <class T> inline std::size_t float_hash_value(T v) { - return v == 0 ? 0 : float_hash_impl(v); + return boost::hash_detail::is_zero(v) ? 0 : float_hash_impl(v, 0); } } } @@ -98,4 +261,8 @@ namespace boost #undef BOOST_HASH_USE_FPCLASSIFY +#if defined(BOOST_MSVC) +#pragma warning(pop) +#endif + #endif diff --git a/3rdParty/Boost/src/boost/functional/hash/detail/hash_float_generic.hpp b/3rdParty/Boost/src/boost/functional/hash/detail/hash_float_generic.hpp deleted file mode 100644 index 1278c2f..0000000 --- a/3rdParty/Boost/src/boost/functional/hash/detail/hash_float_generic.hpp +++ /dev/null @@ -1,91 +0,0 @@ - -// Copyright 2005-2009 Daniel James. -// 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) - -// A general purpose hash function for non-zero floating point values. - -#if !defined(BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_GENERIC_HEADER) -#define BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_GENERIC_HEADER - -#include <boost/functional/hash/detail/float_functions.hpp> -#include <boost/integer/static_log2.hpp> -#include <boost/functional/hash/detail/limits.hpp> - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -#if defined(BOOST_MSVC) -#pragma warning(push) -#if BOOST_MSVC >= 1400 -#pragma warning(disable:6294) // Ill-defined for-loop: initial condition does - // not satisfy test. Loop body not executed -#endif -#endif - -namespace boost -{ - namespace hash_detail - { - inline void hash_float_combine(std::size_t& seed, std::size_t value) - { - seed ^= value + (seed<<6) + (seed>>2); - } - - template <class T> - inline std::size_t float_hash_impl2(T v) - { - boost::hash_detail::call_frexp<T> frexp; - boost::hash_detail::call_ldexp<T> ldexp; - - int exp = 0; - - v = frexp(v, &exp); - - // A postive value is easier to hash, so combine the - // sign with the exponent and use the absolute value. - if(v < 0) { - v = -v; - exp += limits<T>::max_exponent - - limits<T>::min_exponent; - } - - v = ldexp(v, limits<std::size_t>::digits); - std::size_t seed = static_cast<std::size_t>(v); - v -= static_cast<T>(seed); - - // ceiling(digits(T) * log2(radix(T))/ digits(size_t)) - 1; - std::size_t const length - = (limits<T>::digits * - boost::static_log2<limits<T>::radix>::value - + limits<std::size_t>::digits - 1) - / limits<std::size_t>::digits; - - for(std::size_t i = 0; i != length; ++i) - { - v = ldexp(v, limits<std::size_t>::digits); - std::size_t part = static_cast<std::size_t>(v); - v -= static_cast<T>(part); - hash_float_combine(seed, part); - } - - hash_float_combine(seed, exp); - - return seed; - } - - template <class T> - inline std::size_t float_hash_impl(T v) - { - typedef BOOST_DEDUCED_TYPENAME select_hash_type<T>::type type; - return float_hash_impl2(static_cast<type>(v)); - } - } -} - -#if defined(BOOST_MSVC) -#pragma warning(pop) -#endif - -#endif diff --git a/3rdParty/Boost/src/boost/functional/hash/detail/hash_float_x86.hpp b/3rdParty/Boost/src/boost/functional/hash/detail/hash_float_x86.hpp deleted file mode 100644 index b39bb0d..0000000 --- a/3rdParty/Boost/src/boost/functional/hash/detail/hash_float_x86.hpp +++ /dev/null @@ -1,56 +0,0 @@ - -// Copyright 2005-2009 Daniel James. -// 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) - -// A non-portable hash function form non-zero floats on x86. -// -// Even if you're on an x86 platform, this might not work if their floating -// point isn't set up as this expects. So this should only be used if it's -// absolutely certain that it will work. - -#if !defined(BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_X86_HEADER) -#define BOOST_FUNCTIONAL_HASH_DETAIL_HASH_FLOAT_X86_HEADER - -#include <boost/cstdint.hpp> - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -namespace boost -{ - namespace hash_detail - { - inline void hash_float_combine(std::size_t& seed, std::size_t value) - { - seed ^= value + (seed<<6) + (seed>>2); - } - - inline std::size_t float_hash_impl(float v) - { - boost::uint32_t* ptr = (boost::uint32_t*)&v; - std::size_t seed = *ptr; - return seed; - } - - inline std::size_t float_hash_impl(double v) - { - boost::uint32_t* ptr = (boost::uint32_t*)&v; - std::size_t seed = *ptr++; - hash_float_combine(seed, *ptr); - return seed; - } - - inline std::size_t float_hash_impl(long double v) - { - boost::uint32_t* ptr = (boost::uint32_t*)&v; - std::size_t seed = *ptr++; - hash_float_combine(seed, *ptr++); - hash_float_combine(seed, *(boost::uint16_t*)ptr); - return seed; - } - } -} - -#endif diff --git a/3rdParty/Boost/src/boost/functional/hash/extensions.hpp b/3rdParty/Boost/src/boost/functional/hash/extensions.hpp index 3c587a3..4358736 100644 --- a/3rdParty/Boost/src/boost/functional/hash/extensions.hpp +++ b/3rdParty/Boost/src/boost/functional/hash/extensions.hpp @@ -14,7 +14,11 @@ #define BOOST_FUNCTIONAL_HASH_EXTENSIONS_HPP #include <boost/functional/hash/hash.hpp> -#include <boost/detail/container_fwd.hpp> +#include <boost/functional/hash/detail/container_fwd_0x.hpp> +#include <boost/utility/enable_if.hpp> +#include <boost/static_assert.hpp> +#include <boost/preprocessor/repetition/repeat_from_to.hpp> +#include <boost/preprocessor/repetition/enum_params.hpp> #if defined(_MSC_VER) && (_MSC_VER >= 1020) # pragma once @@ -54,51 +58,51 @@ namespace boost std::size_t hash_value(std::pair<A, B> const& v) { std::size_t seed = 0; - hash_combine(seed, v.first); - hash_combine(seed, v.second); + boost::hash_combine(seed, v.first); + boost::hash_combine(seed, v.second); return seed; } template <class T, class A> std::size_t hash_value(std::vector<T, A> const& v) { - return hash_range(v.begin(), v.end()); + return boost::hash_range(v.begin(), v.end()); } template <class T, class A> std::size_t hash_value(std::list<T, A> const& v) { - return hash_range(v.begin(), v.end()); + return boost::hash_range(v.begin(), v.end()); } template <class T, class A> std::size_t hash_value(std::deque<T, A> const& v) { - return hash_range(v.begin(), v.end()); + return boost::hash_range(v.begin(), v.end()); } template <class K, class C, class A> std::size_t hash_value(std::set<K, C, A> const& v) { - return hash_range(v.begin(), v.end()); + return boost::hash_range(v.begin(), v.end()); } template <class K, class C, class A> std::size_t hash_value(std::multiset<K, C, A> const& v) { - return hash_range(v.begin(), v.end()); + return boost::hash_range(v.begin(), v.end()); } template <class K, class T, class C, class A> std::size_t hash_value(std::map<K, T, C, A> const& v) { - return hash_range(v.begin(), v.end()); + return boost::hash_range(v.begin(), v.end()); } template <class K, class T, class C, class A> std::size_t hash_value(std::multimap<K, T, C, A> const& v) { - return hash_range(v.begin(), v.end()); + return boost::hash_range(v.begin(), v.end()); } template <class T> @@ -110,6 +114,83 @@ namespace boost return seed; } +#if !defined(BOOST_NO_CXX11_HDR_ARRAY) + template <class T, std::size_t N> + std::size_t hash_value(std::array<T, N> const& v) + { + return boost::hash_range(v.begin(), v.end()); + } +#endif + +#if !defined(BOOST_NO_CXX11_HDR_TUPLE) + namespace hash_detail { + template <std::size_t I, typename T> + inline typename boost::enable_if_c<(I == std::tuple_size<T>::value), + void>::type + hash_combine_tuple(std::size_t&, T const&) + { + } + + template <std::size_t I, typename T> + inline typename boost::enable_if_c<(I < std::tuple_size<T>::value), + void>::type + hash_combine_tuple(std::size_t& seed, T const& v) + { + boost::hash_combine(seed, std::get<I>(v)); + boost::hash_detail::hash_combine_tuple<I + 1>(seed, v); + } + + template <typename T> + inline std::size_t hash_tuple(T const& v) + { + std::size_t seed = 0; + boost::hash_detail::hash_combine_tuple<0>(seed, v); + return seed; + } + } + +#if !defined(BOOST_NO_VARIADIC_TEMPLATES) + template <typename... T> + inline std::size_t hash_value(std::tuple<T...> const& v) + { + return boost::hash_detail::hash_tuple(v); + } +#else + + inline std::size_t hash_value(std::tuple<> const& v) + { + return boost::hash_detail::hash_tuple(v); + } + +# define BOOST_HASH_TUPLE_F(z, n, _) \ + template< \ + BOOST_PP_ENUM_PARAMS_Z(z, n, typename A) \ + > \ + inline std::size_t hash_value(std::tuple< \ + BOOST_PP_ENUM_PARAMS_Z(z, n, A) \ + > const& v) \ + { \ + return boost::hash_detail::hash_tuple(v); \ + } + + BOOST_PP_REPEAT_FROM_TO(1, 11, BOOST_HASH_TUPLE_F, _) +# undef BOOST_HASH_TUPLE_F +#endif + +#endif + +#if !defined(BOOST_NO_CXX11_SMART_PTR) + template <typename T> + inline std::size_t hash_value(std::shared_ptr<T> const& x) { + return boost::hash_value(x.get()); + } + + template <typename T, typename Deleter> + inline std::size_t hash_value(std::unique_ptr<T, Deleter> const& x) { + return boost::hash_value(x.get()); + } +#endif + // // call_hash_impl // diff --git a/3rdParty/Boost/src/boost/functional/hash/hash.hpp b/3rdParty/Boost/src/boost/functional/hash/hash.hpp index 51ec860..647fd68 100644 --- a/3rdParty/Boost/src/boost/functional/hash/hash.hpp +++ b/3rdParty/Boost/src/boost/functional/hash/hash.hpp @@ -15,16 +15,14 @@ #include <boost/functional/hash/detail/hash_float.hpp> #include <string> #include <boost/limits.hpp> - -#if defined(BOOST_HASH_NO_IMPLICIT_CASTS) -#include <boost/static_assert.hpp> -#endif +#include <boost/type_traits/is_enum.hpp> +#include <boost/utility/enable_if.hpp> #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) #include <boost/type_traits/is_pointer.hpp> #endif -#if !defined(BOOST_NO_0X_HDR_TYPEINDEX) +#if !defined(BOOST_NO_CXX11_HDR_TYPEINDEX) #include <typeindex> #endif @@ -37,38 +35,67 @@ namespace boost { -#if defined(BOOST_HASH_NO_IMPLICIT_CASTS) - - // If you get a static assertion here, it's because hash_value - // isn't declared for your type. - template <typename T> - std::size_t hash_value(T const&) { - BOOST_STATIC_ASSERT((T*) 0 && false); - return 0; - } - -#endif - - std::size_t hash_value(bool); - std::size_t hash_value(char); - std::size_t hash_value(unsigned char); - std::size_t hash_value(signed char); - std::size_t hash_value(short); - std::size_t hash_value(unsigned short); - std::size_t hash_value(int); - std::size_t hash_value(unsigned int); - std::size_t hash_value(long); - std::size_t hash_value(unsigned long); + namespace hash_detail + { + struct enable_hash_value { typedef std::size_t type; }; + + template <typename T> struct basic_numbers {}; + template <typename T> struct long_numbers {}; + template <typename T> struct ulong_numbers {}; + template <typename T> struct float_numbers {}; + + template <> struct basic_numbers<bool> : + boost::hash_detail::enable_hash_value {}; + template <> struct basic_numbers<char> : + boost::hash_detail::enable_hash_value {}; + template <> struct basic_numbers<unsigned char> : + boost::hash_detail::enable_hash_value {}; + template <> struct basic_numbers<signed char> : + boost::hash_detail::enable_hash_value {}; + template <> struct basic_numbers<short> : + boost::hash_detail::enable_hash_value {}; + template <> struct basic_numbers<unsigned short> : + boost::hash_detail::enable_hash_value {}; + template <> struct basic_numbers<int> : + boost::hash_detail::enable_hash_value {}; + template <> struct basic_numbers<unsigned int> : + boost::hash_detail::enable_hash_value {}; + template <> struct basic_numbers<long> : + boost::hash_detail::enable_hash_value {}; + template <> struct basic_numbers<unsigned long> : + boost::hash_detail::enable_hash_value {}; #if !defined(BOOST_NO_INTRINSIC_WCHAR_T) - std::size_t hash_value(wchar_t); + template <> struct basic_numbers<wchar_t> : + boost::hash_detail::enable_hash_value {}; #endif - + #if !defined(BOOST_NO_LONG_LONG) - std::size_t hash_value(boost::long_long_type); - std::size_t hash_value(boost::ulong_long_type); + template <> struct long_numbers<boost::long_long_type> : + boost::hash_detail::enable_hash_value {}; + template <> struct ulong_numbers<boost::ulong_long_type> : + boost::hash_detail::enable_hash_value {}; #endif + template <> struct float_numbers<float> : + boost::hash_detail::enable_hash_value {}; + template <> struct float_numbers<double> : + boost::hash_detail::enable_hash_value {}; + template <> struct float_numbers<long double> : + boost::hash_detail::enable_hash_value {}; + } + + template <typename T> + typename boost::hash_detail::basic_numbers<T>::type hash_value(T); + template <typename T> + typename boost::hash_detail::long_numbers<T>::type hash_value(T); + template <typename T> + typename boost::hash_detail::ulong_numbers<T>::type hash_value(T); + + template <typename T> + typename boost::enable_if<boost::is_enum<T>, std::size_t>::type + hash_value(T); + #if !BOOST_WORKAROUND(__DMC__, <= 0x848) template <class T> std::size_t hash_value(T* const&); #else @@ -83,15 +110,14 @@ namespace boost std::size_t hash_value(T (&x)[N]); #endif - std::size_t hash_value(float v); - std::size_t hash_value(double v); - std::size_t hash_value(long double v); - template <class Ch, class A> std::size_t hash_value( std::basic_string<Ch, std::BOOST_HASH_CHAR_TRAITS<Ch>, A> const&); -#if !defined(BOOST_NO_0X_HDR_TYPEINDEX) + template <typename T> + typename boost::hash_detail::float_numbers<T>::type hash_value(T); + +#if !defined(BOOST_NO_CXX11_HDR_TYPEINDEX) std::size_t hash_value(std::type_index); #endif @@ -141,74 +167,30 @@ namespace boost } } - inline std::size_t hash_value(bool v) - { - return static_cast<std::size_t>(v); - } - - inline std::size_t hash_value(char v) - { - return static_cast<std::size_t>(v); - } - - inline std::size_t hash_value(unsigned char v) - { - return static_cast<std::size_t>(v); - } - - inline std::size_t hash_value(signed char v) - { - return static_cast<std::size_t>(v); - } - - inline std::size_t hash_value(short v) - { - return static_cast<std::size_t>(v); - } - - inline std::size_t hash_value(unsigned short v) - { - return static_cast<std::size_t>(v); - } - - inline std::size_t hash_value(int v) - { - return static_cast<std::size_t>(v); - } - - inline std::size_t hash_value(unsigned int v) - { - return static_cast<std::size_t>(v); - } - - inline std::size_t hash_value(long v) - { - return static_cast<std::size_t>(v); - } - - inline std::size_t hash_value(unsigned long v) + template <typename T> + typename boost::hash_detail::basic_numbers<T>::type hash_value(T v) { return static_cast<std::size_t>(v); } -#if !defined(BOOST_NO_INTRINSIC_WCHAR_T) - inline std::size_t hash_value(wchar_t v) + template <typename T> + typename boost::hash_detail::long_numbers<T>::type hash_value(T v) { - return static_cast<std::size_t>(v); + return hash_detail::hash_value_signed(v); } -#endif -#if !defined(BOOST_NO_LONG_LONG) - inline std::size_t hash_value(boost::long_long_type v) + template <typename T> + typename boost::hash_detail::ulong_numbers<T>::type hash_value(T v) { - return hash_detail::hash_value_signed(v); + return hash_detail::hash_value_unsigned(v); } - inline std::size_t hash_value(boost::ulong_long_type v) + template <typename T> + typename boost::enable_if<boost::is_enum<T>, std::size_t>::type + hash_value(T v) { - return hash_detail::hash_value_unsigned(v); + return static_cast<std::size_t>(v); } -#endif // Implementation by Alberto Barbati and Dave Harris. #if !BOOST_WORKAROUND(__DMC__, <= 0x848) @@ -324,22 +306,13 @@ namespace boost return hash_range(v.begin(), v.end()); } - inline std::size_t hash_value(float v) - { - return boost::hash_detail::float_hash_value(v); - } - - inline std::size_t hash_value(double v) - { - return boost::hash_detail::float_hash_value(v); - } - - inline std::size_t hash_value(long double v) + template <typename T> + typename boost::hash_detail::float_numbers<T>::type hash_value(T v) { return boost::hash_detail::float_hash_value(v); } -#if !defined(BOOST_NO_0X_HDR_TYPEINDEX) +#if !defined(BOOST_NO_CXX11_HDR_TYPEINDEX) inline std::size_t hash_value(std::type_index v) { return v.hash_code(); @@ -450,7 +423,7 @@ namespace boost BOOST_HASH_SPECIALIZE(boost::ulong_long_type) #endif -#if !defined(BOOST_NO_0X_HDR_TYPEINDEX) +#if !defined(BOOST_NO_CXX11_HDR_TYPEINDEX) BOOST_HASH_SPECIALIZE(std::type_index) #endif diff --git a/3rdParty/Boost/src/boost/implicit_cast.hpp b/3rdParty/Boost/src/boost/implicit_cast.hpp deleted file mode 100644 index 5b1cd92..0000000 --- a/3rdParty/Boost/src/boost/implicit_cast.hpp +++ /dev/null @@ -1,29 +0,0 @@ -// Copyright David Abrahams 2003. -// 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 IMPLICIT_CAST_DWA200356_HPP -# define IMPLICIT_CAST_DWA200356_HPP - -# include <boost/mpl/identity.hpp> - -namespace boost { - -// implementation originally suggested by C. Green in -// http://lists.boost.org/MailArchives/boost/msg00886.php - -// The use of identity creates a non-deduced form, so that the -// explicit template argument must be supplied -template <typename T> -inline T implicit_cast (typename mpl::identity<T>::type x) { - return x; -} - -// incomplete return type now is here -//template <typename T> -//void implicit_cast (...); - -} // namespace boost - - -#endif // IMPLICIT_CAST_DWA200356_HPP diff --git a/3rdParty/Boost/src/boost/indirect_reference.hpp b/3rdParty/Boost/src/boost/indirect_reference.hpp new file mode 100644 index 0000000..5fbb342 --- /dev/null +++ b/3rdParty/Boost/src/boost/indirect_reference.hpp @@ -0,0 +1,43 @@ +#ifndef INDIRECT_REFERENCE_DWA200415_HPP +# define INDIRECT_REFERENCE_DWA200415_HPP + +// +// Copyright David Abrahams 2004. 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) +// +// typename indirect_reference<P>::type provides the type of *p. +// +// http://www.boost.org/libs/iterator/doc/pointee.html +// + +# include <boost/detail/is_incrementable.hpp> +# include <boost/iterator/iterator_traits.hpp> +# include <boost/type_traits/remove_cv.hpp> +# include <boost/mpl/eval_if.hpp> +# include <boost/pointee.hpp> + +namespace boost { + +namespace detail +{ + template <class P> + struct smart_ptr_reference + { + typedef typename boost::pointee<P>::type& type; + }; +} + +template <class P> +struct indirect_reference + : mpl::eval_if< + detail::is_incrementable<P> + , iterator_reference<P> + , detail::smart_ptr_reference<P> + > +{ +}; + +} // namespace boost + +#endif // INDIRECT_REFERENCE_DWA200415_HPP diff --git a/3rdParty/Boost/src/boost/integer.hpp b/3rdParty/Boost/src/boost/integer.hpp index fc0b398..35a1e10 100644 --- a/3rdParty/Boost/src/boost/integer.hpp +++ b/3rdParty/Boost/src/boost/integer.hpp @@ -20,6 +20,7 @@ #include <boost/integer_traits.hpp> // for boost::::boost::integer_traits #include <boost/limits.hpp> // for ::std::numeric_limits #include <boost/cstdint.hpp> // for boost::int64_t and BOOST_NO_INTEGRAL_INT64_T +#include <boost/static_assert.hpp> // // We simply cannot include this header on gcc without getting copious warnings of the kind: @@ -51,6 +52,7 @@ namespace boost // convert category to type template< int Category > struct int_least_helper {}; // default is empty + template< int Category > struct uint_least_helper {}; // default is empty // specializatons: 1=long, 2=int, 3=short, 4=signed char, // 6=unsigned long, 7=unsigned int, 8=unsigned short, 9=unsigned char @@ -65,14 +67,14 @@ namespace boost template<> struct int_least_helper<4> { typedef short least; }; template<> struct int_least_helper<5> { typedef signed char least; }; #ifdef BOOST_HAS_LONG_LONG - template<> struct int_least_helper<6> { typedef boost::ulong_long_type least; }; + template<> struct uint_least_helper<1> { typedef boost::ulong_long_type least; }; #elif defined(BOOST_HAS_MS_INT64) - template<> struct int_least_helper<6> { typedef unsigned __int64 least; }; + template<> struct uint_least_helper<1> { typedef unsigned __int64 least; }; #endif - template<> struct int_least_helper<7> { typedef unsigned long least; }; - template<> struct int_least_helper<8> { typedef unsigned int least; }; - template<> struct int_least_helper<9> { typedef unsigned short least; }; - template<> struct int_least_helper<10> { typedef unsigned char least; }; + template<> struct uint_least_helper<2> { typedef unsigned long least; }; + template<> struct uint_least_helper<3> { typedef unsigned int least; }; + template<> struct uint_least_helper<4> { typedef unsigned short least; }; + template<> struct uint_least_helper<5> { typedef unsigned char least; }; template <int Bits> struct exact_signed_base_helper{}; @@ -111,10 +113,12 @@ namespace boost template< int Bits > // bits (including sign) required struct int_t : public detail::exact_signed_base_helper<Bits> { + BOOST_STATIC_ASSERT_MSG(Bits <= (int)(sizeof(boost::intmax_t) * CHAR_BIT), + "No suitable signed integer type with the requested number of bits is available."); typedef typename detail::int_least_helper < #ifdef BOOST_HAS_LONG_LONG - (Bits-1 <= (int)(sizeof(boost::long_long_type) * CHAR_BIT)) + + (Bits <= (int)(sizeof(boost::long_long_type) * CHAR_BIT)) + #else 1 + #endif @@ -130,6 +134,8 @@ namespace boost template< int Bits > // bits required struct uint_t : public detail::exact_unsigned_base_helper<Bits> { + BOOST_STATIC_ASSERT_MSG(Bits <= (int)(sizeof(boost::uintmax_t) * CHAR_BIT), + "No suitable unsigned integer type with the requested number of bits is available."); #if (defined(__BORLANDC__) || defined(__CODEGEAR__)) && defined(BOOST_NO_INTEGRAL_INT64_T) // It's really not clear why this workaround should be needed... shrug I guess! JM BOOST_STATIC_CONSTANT(int, s = @@ -140,11 +146,10 @@ namespace boost (Bits <= ::std::numeric_limits<unsigned char>::digits)); typedef typename detail::int_least_helper< ::boost::uint_t<Bits>::s>::least least; #else - typedef typename detail::int_least_helper + typedef typename detail::uint_least_helper < - 5 + #ifdef BOOST_HAS_LONG_LONG - (Bits-1 <= (int)(sizeof(boost::long_long_type) * CHAR_BIT)) + + (Bits <= (int)(sizeof(boost::long_long_type) * CHAR_BIT)) + #else 1 + #endif @@ -217,7 +222,7 @@ namespace boost // It's really not clear why this workaround should be needed... shrug I guess! JM #if defined(BOOST_NO_INTEGRAL_INT64_T) BOOST_STATIC_CONSTANT(unsigned, which = - 6 + + 1 + (MaxValue <= ::boost::integer_traits<unsigned long>::const_max) + (MaxValue <= ::boost::integer_traits<unsigned int>::const_max) + (MaxValue <= ::boost::integer_traits<unsigned short>::const_max) + @@ -225,18 +230,17 @@ namespace boost typedef typename detail::int_least_helper< ::boost::uint_value_t<MaxValue>::which>::least least; #else // BOOST_NO_INTEGRAL_INT64_T BOOST_STATIC_CONSTANT(unsigned, which = - 5 + + 1 + (MaxValue <= ::boost::integer_traits<boost::ulong_long_type>::const_max) + (MaxValue <= ::boost::integer_traits<unsigned long>::const_max) + (MaxValue <= ::boost::integer_traits<unsigned int>::const_max) + (MaxValue <= ::boost::integer_traits<unsigned short>::const_max) + (MaxValue <= ::boost::integer_traits<unsigned char>::const_max)); - typedef typename detail::int_least_helper< ::boost::uint_value_t<MaxValue>::which>::least least; + typedef typename detail::uint_least_helper< ::boost::uint_value_t<MaxValue>::which>::least least; #endif // BOOST_NO_INTEGRAL_INT64_T #else - typedef typename detail::int_least_helper + typedef typename detail::uint_least_helper < - 5 + #if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG) (MaxValue <= ::boost::integer_traits<boost::ulong_long_type>::const_max) + #else diff --git a/3rdParty/Boost/src/boost/integer/integer_mask.hpp b/3rdParty/Boost/src/boost/integer/integer_mask.hpp new file mode 100644 index 0000000..2acf7f7 --- /dev/null +++ b/3rdParty/Boost/src/boost/integer/integer_mask.hpp @@ -0,0 +1,126 @@ +// Boost integer/integer_mask.hpp header file ------------------------------// + +// (C) Copyright Daryle Walker 2001. +// 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) + +// See http://www.boost.org for updates, documentation, and revision history. + +#ifndef BOOST_INTEGER_INTEGER_MASK_HPP +#define BOOST_INTEGER_INTEGER_MASK_HPP + +#include <boost/integer_fwd.hpp> // self include + +#include <boost/config.hpp> // for BOOST_STATIC_CONSTANT +#include <boost/integer.hpp> // for boost::uint_t + +#include <climits> // for UCHAR_MAX, etc. +#include <cstddef> // for std::size_t + +#include <boost/limits.hpp> // for std::numeric_limits + +// +// We simply cannot include this header on gcc without getting copious warnings of the kind: +// +// boost/integer/integer_mask.hpp:93:35: warning: use of C99 long long integer constant +// +// And yet there is no other reasonable implementation, so we declare this a system header +// to suppress these warnings. +// +#if defined(__GNUC__) && (__GNUC__ >= 4) +#pragma GCC system_header +#endif + +namespace boost +{ + + +// Specified single-bit mask class declaration -----------------------------// +// (Lowest bit starts counting at 0.) + +template < std::size_t Bit > +struct high_bit_mask_t +{ + typedef typename uint_t<(Bit + 1)>::least least; + typedef typename uint_t<(Bit + 1)>::fast fast; + + BOOST_STATIC_CONSTANT( least, high_bit = (least( 1u ) << Bit) ); + BOOST_STATIC_CONSTANT( fast, high_bit_fast = (fast( 1u ) << Bit) ); + + BOOST_STATIC_CONSTANT( std::size_t, bit_position = Bit ); + +}; // boost::high_bit_mask_t + + +// Specified bit-block mask class declaration ------------------------------// +// Makes masks for the lowest N bits +// (Specializations are needed when N fills up a type.) + +template < std::size_t Bits > +struct low_bits_mask_t +{ + typedef typename uint_t<Bits>::least least; + typedef typename uint_t<Bits>::fast fast; + + BOOST_STATIC_CONSTANT( least, sig_bits = (~( ~(least( 0u )) << Bits )) ); + BOOST_STATIC_CONSTANT( fast, sig_bits_fast = fast(sig_bits) ); + + BOOST_STATIC_CONSTANT( std::size_t, bit_count = Bits ); + +}; // boost::low_bits_mask_t + + +#define BOOST_LOW_BITS_MASK_SPECIALIZE( Type ) \ + template < > struct low_bits_mask_t< std::numeric_limits<Type>::digits > { \ + typedef std::numeric_limits<Type> limits_type; \ + typedef uint_t<limits_type::digits>::least least; \ + typedef uint_t<limits_type::digits>::fast fast; \ + BOOST_STATIC_CONSTANT( least, sig_bits = (~( least(0u) )) ); \ + BOOST_STATIC_CONSTANT( fast, sig_bits_fast = fast(sig_bits) ); \ + BOOST_STATIC_CONSTANT( std::size_t, bit_count = limits_type::digits ); \ + } + +#ifdef BOOST_MSVC +#pragma warning(push) +#pragma warning(disable:4245) // 'initializing' : conversion from 'int' to 'const boost::low_bits_mask_t<8>::least', signed/unsigned mismatch +#endif + +BOOST_LOW_BITS_MASK_SPECIALIZE( unsigned char ); + +#if USHRT_MAX > UCHAR_MAX +BOOST_LOW_BITS_MASK_SPECIALIZE( unsigned short ); +#endif + +#if UINT_MAX > USHRT_MAX +BOOST_LOW_BITS_MASK_SPECIALIZE( unsigned int ); +#endif + +#if ULONG_MAX > UINT_MAX +BOOST_LOW_BITS_MASK_SPECIALIZE( unsigned long ); +#endif + +#if defined(BOOST_HAS_LONG_LONG) + #if ((defined(ULLONG_MAX) && (ULLONG_MAX > ULONG_MAX)) ||\ + (defined(ULONG_LONG_MAX) && (ULONG_LONG_MAX > ULONG_MAX)) ||\ + (defined(ULONGLONG_MAX) && (ULONGLONG_MAX > ULONG_MAX)) ||\ + (defined(_ULLONG_MAX) && (_ULLONG_MAX > ULONG_MAX))) + BOOST_LOW_BITS_MASK_SPECIALIZE( boost::ulong_long_type ); + #endif +#elif defined(BOOST_HAS_MS_INT64) + #if 18446744073709551615ui64 > ULONG_MAX + BOOST_LOW_BITS_MASK_SPECIALIZE( unsigned __int64 ); + #endif +#endif + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#undef BOOST_LOW_BITS_MASK_SPECIALIZE + + +} // namespace boost + + +#endif // BOOST_INTEGER_INTEGER_MASK_HPP diff --git a/3rdParty/Boost/src/boost/integer_traits.hpp b/3rdParty/Boost/src/boost/integer_traits.hpp index 129ce82..98fdd93 100644 --- a/3rdParty/Boost/src/boost/integer_traits.hpp +++ b/3rdParty/Boost/src/boost/integer_traits.hpp @@ -5,7 +5,7 @@ * accompanying file LICENSE_1_0.txt or copy at * http://www.boost.org/LICENSE_1_0.txt) * - * $Id: integer_traits.hpp 58381 2009-12-14 18:14:48Z johnmaddock $ + * $Id: integer_traits.hpp 80740 2012-09-28 18:34:12Z jewillco $ * * Idea by Beman Dawes, Ed Brey, Steve Cleary, and Nathan Myers */ @@ -227,7 +227,7 @@ class integer_traits< ::boost::ulong_long_type> template<> class integer_traits< ::boost::long_long_type> : public std::numeric_limits< ::boost::long_long_type>, - public detail::integer_traits_base< ::boost::long_long_type, (1LL << (sizeof(::boost::long_long_type) - 1)), ~(1LL << (sizeof(::boost::long_long_type) - 1))> + public detail::integer_traits_base< ::boost::long_long_type, (1LL << (sizeof(::boost::long_long_type) * CHAR_BIT - 1)), ~(1LL << (sizeof(::boost::long_long_type) * CHAR_BIT - 1))> { }; template<> diff --git a/3rdParty/Boost/src/boost/intrusive/detail/config_begin.hpp b/3rdParty/Boost/src/boost/intrusive/detail/config_begin.hpp new file mode 100644 index 0000000..7d15336 --- /dev/null +++ b/3rdParty/Boost/src/boost/intrusive/detail/config_begin.hpp @@ -0,0 +1,52 @@ +///////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2006-2012 +// +// 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) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +///////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTRUSIVE_CONFIG_INCLUDED +#define BOOST_INTRUSIVE_CONFIG_INCLUDED +#include <boost/config.hpp> +#endif + +#ifdef BOOST_MSVC + + #pragma warning (push) + // + //'function' : resolved overload was found by argument-dependent lookup + //A function found by argument-dependent lookup (Koenig lookup) was eventually + //chosen by overload resolution. + // + //In Visual C++ .NET and earlier compilers, a different function would have + //been called. To pick the original function, use an explicitly qualified name. + // + + //warning C4275: non dll-interface class 'x' used as base for + //dll-interface class 'Y' + #pragma warning (disable : 4275) + //warning C4251: 'x' : class 'y' needs to have dll-interface to + //be used by clients of class 'z' + #pragma warning (disable : 4251) + #pragma warning (disable : 4675) + #pragma warning (disable : 4996) + #pragma warning (disable : 4503) + #pragma warning (disable : 4284) // odd return type for operator-> + #pragma warning (disable : 4244) // possible loss of data + #pragma warning (disable : 4521) ////Disable "multiple copy constructors specified" + #pragma warning (disable : 4522) + #pragma warning (disable : 4146) + #pragma warning (disable : 4267) //conversion from 'X' to 'Y', possible loss of data + #pragma warning (disable : 4127) //conditional expression is constant + #pragma warning (disable : 4706) //assignment within conditional expression + #pragma warning (disable : 4541) //'typeid' used on polymorphic type 'boost::exception' with /GR- + #pragma warning (disable : 4512) //'typeid' used on polymorphic type 'boost::exception' with /GR- +#endif + +//#define BOOST_INTRUSIVE_USE_ITERATOR_FACADE +//#define BOOST_INTRUSIVE_USE_ITERATOR_ENABLE_IF_CONVERTIBLE diff --git a/3rdParty/Boost/src/boost/intrusive/detail/config_end.hpp b/3rdParty/Boost/src/boost/intrusive/detail/config_end.hpp new file mode 100644 index 0000000..d653030 --- /dev/null +++ b/3rdParty/Boost/src/boost/intrusive/detail/config_end.hpp @@ -0,0 +1,15 @@ +///////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2006-2012 +// +// 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) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +///////////////////////////////////////////////////////////////////////////// + +#if defined BOOST_MSVC + #pragma warning (pop) +#endif diff --git a/3rdParty/Boost/src/boost/intrusive/detail/has_member_function_callable_with.hpp b/3rdParty/Boost/src/boost/intrusive/detail/has_member_function_callable_with.hpp new file mode 100644 index 0000000..6516e28 --- /dev/null +++ b/3rdParty/Boost/src/boost/intrusive/detail/has_member_function_callable_with.hpp @@ -0,0 +1,356 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2011-2012. 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) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +// sample.h + +#if !defined(BOOST_PP_IS_ITERATING) + + #ifndef BOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_DETAILS_INCLUDED + #define BOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_DETAILS_INCLUDED + + #include <boost/intrusive/detail/config_begin.hpp> + #include <boost/intrusive/detail/workaround.hpp> + #include <boost/intrusive/detail/preprocessor.hpp> + #include <boost/static_assert.hpp> + #include <boost/move/move.hpp> + + //Mark that we don't support 0 arg calls due to compiler ICE in GCC 3.4/4.0/4.1 and + //wrong SFINAE for GCC 4.2/4.3 + #if defined(__GNUC__) && !defined(__clang__) && ((__GNUC__*100 + __GNUC_MINOR__*10) >= 340) && ((__GNUC__*100 + __GNUC_MINOR__*10) <= 430) + #define BOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_0_ARGS_UNSUPPORTED + #elif defined(BOOST_INTEL) && (BOOST_INTEL < 1200 ) + #define BOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_0_ARGS_UNSUPPORTED + #endif + + namespace boost_intrusive_has_member_function_callable_with { + + struct dont_care + { + dont_care(...); + }; + + struct private_type + { + static private_type p; + private_type const &operator,(int) const; + }; + + typedef char yes_type; // sizeof(yes_type) == 1 + struct no_type{ char dummy[2]; }; // sizeof(no_type) == 2 + + template<typename T> + no_type is_private_type(T const &); + yes_type is_private_type(private_type const &); + + } //boost_intrusive_has_member_function_callable_with + + #include <boost/intrusive/detail/config_end.hpp> + + #endif //BOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_DETAILS_INCLUDED + +#else //!BOOST_PP_IS_ITERATING + + #ifndef BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME + #error "BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME not defined!" + #endif + + #ifndef BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN + #error "BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN not defined!" + #endif + + #ifndef BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END + #error "BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END not defined!" + #endif + + #if BOOST_PP_ITERATION_START() != 0 + #error "BOOST_PP_ITERATION_START() must be zero (0)" + #endif + + #if BOOST_PP_ITERATION() == 0 + + BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN + + template <typename Type> + class BOOST_PP_CAT(has_member_function_named_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME) + { + struct BaseMixin + { + void BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME(); + }; + + struct Base : public Type, public BaseMixin { Base(); }; + template <typename T, T t> class Helper{}; + + template <typename U> + static boost_intrusive_has_member_function_callable_with::no_type deduce + (U*, Helper<void (BaseMixin::*)(), &U::BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME>* = 0); + static boost_intrusive_has_member_function_callable_with::yes_type deduce(...); + + public: + static const bool value = + sizeof(boost_intrusive_has_member_function_callable_with::yes_type) == sizeof(deduce((Base*)(0))); + }; + + #if !defined(BOOST_INTRUSIVE_PERFECT_FORWARDING) + + template<typename Fun, bool HasFunc + BOOST_PP_ENUM_TRAILING(BOOST_PP_ITERATION_FINISH(), BOOST_INTRUSIVE_PP_TEMPLATE_PARAM_VOID_DEFAULT, _)> + struct BOOST_PP_CAT(BOOST_PP_CAT(has_member_function_callable_with_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME), _impl); + //! + + template<typename Fun BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION_FINISH(), class P)> + struct BOOST_PP_CAT(BOOST_PP_CAT(has_member_function_callable_with_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME), _impl) + <Fun, false BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION_FINISH(), P)> + { + static const bool value = false; + }; + //! + + #if !defined(_MSC_VER) || (_MSC_VER < 1600) + + #if defined(BOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_0_ARGS_UNSUPPORTED) + + template<typename Fun> + struct BOOST_PP_CAT(BOOST_PP_CAT(has_member_function_callable_with_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME),_impl) + <Fun, true BOOST_PP_ENUM_TRAILING(BOOST_PP_SUB(BOOST_PP_ITERATION_FINISH(), BOOST_PP_ITERATION()), BOOST_INTRUSIVE_PP_IDENTITY, void)> + { + //Mark that we don't support 0 arg calls due to compiler ICE in GCC 3.4/4.0/4.1 and + //wrong SFINAE for GCC 4.2/4.3 + static const bool value = true; + }; + + #else //defined(BOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_0_ARGS_UNSUPPORTED) + + //Special case for 0 args + template< class F + , std::size_t N = + sizeof((boost::move_detail::declval<F>(). + BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME (), 0))> + struct BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME) + { + boost_intrusive_has_member_function_callable_with::yes_type dummy; + BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)(int); + }; + + //For buggy compilers like MSVC 7.1+ ((F*)0)->func() does not + //SFINAE-out the zeroarg_checker_ instantiation but sizeof yields to 0. + template<class F> + struct BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)<F, 0> + { + boost_intrusive_has_member_function_callable_with::no_type dummy; + BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)(int); + }; + + template<typename Fun> + struct BOOST_PP_CAT(BOOST_PP_CAT(has_member_function_callable_with_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME),_impl) + <Fun, true BOOST_PP_ENUM_TRAILING(BOOST_PP_SUB(BOOST_PP_ITERATION_FINISH(), BOOST_PP_ITERATION()), BOOST_INTRUSIVE_PP_IDENTITY, void)> + { + template<class U> + static BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)<U> + Test(BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)<U>*); + + template <class U> + static boost_intrusive_has_member_function_callable_with::no_type Test(...); + + static const bool value = sizeof(Test< Fun >(0)) + == sizeof(boost_intrusive_has_member_function_callable_with::yes_type); + }; + #endif //defined(BOOST_INTRUSIVE_DETAIL_HAS_MEMBER_FUNCTION_CALLABLE_WITH_0_ARGS_UNSUPPORTED) + + #else //#if !defined(_MSC_VER) || (_MSC_VER < 1600) + template<typename Fun> + struct BOOST_PP_CAT(BOOST_PP_CAT(has_member_function_callable_with_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME),_impl) + <Fun, true BOOST_PP_ENUM_TRAILING(BOOST_PP_SUB(BOOST_PP_ITERATION_FINISH(), BOOST_PP_ITERATION()), BOOST_INTRUSIVE_PP_IDENTITY, void)> + { + template<class U> + static decltype( boost::move_detail::declval<Fun>().BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME() + , boost_intrusive_has_member_function_callable_with::yes_type()) + Test(Fun*); + + template<class U> + static boost_intrusive_has_member_function_callable_with::no_type Test(...); + + static const bool value = sizeof(Test<Fun>(0)) + == sizeof(boost_intrusive_has_member_function_callable_with::yes_type); + }; + #endif //#if !defined(_MSC_VER) || (_MSC_VER < 1600) + + #else //#if !defined(BOOST_INTRUSIVE_PERFECT_FORWARDING) + + template<typename Fun, bool HasFunc, class ...Args> + struct BOOST_PP_CAT(BOOST_PP_CAT(has_member_function_callable_with_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME),_impl); + + template<typename Fun, class ...Args> + struct BOOST_PP_CAT(BOOST_PP_CAT(has_member_function_callable_with_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME),_impl) + <Fun, false, Args...> + { + static const bool value = false; + }; + + //Special case for 0 args + template< class F + , std::size_t N = + sizeof((boost::move_detail::declval<F>(). + BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME (), 0))> + struct BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME) + { + boost_intrusive_has_member_function_callable_with::yes_type dummy; + BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)(int); + }; + + //For buggy compilers like MSVC 7.1+ ((F*)0)->func() does not + //SFINAE-out the zeroarg_checker_ instantiation but sizeof yields to 0. + template<class F> + struct BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)<F, 0> + { + boost_intrusive_has_member_function_callable_with::no_type dummy; + BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)(int); + }; + + template<typename Fun> + struct BOOST_PP_CAT(BOOST_PP_CAT(has_member_function_callable_with_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME),_impl) + <Fun, true> + { + template<class U> + static BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME) + <U> Test(BOOST_PP_CAT(zeroarg_checker_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)<U>*); + + template <class U> + static boost_intrusive_has_member_function_callable_with::no_type Test(...); + + static const bool value = sizeof(Test< Fun >(0)) + == sizeof(boost_intrusive_has_member_function_callable_with::yes_type); + }; + + template<typename Fun, class ...DontCares> + struct BOOST_PP_CAT( funwrap_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME ) + : Fun + { + BOOST_PP_CAT( funwrap_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME )(); + using Fun::BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME; + + boost_intrusive_has_member_function_callable_with::private_type + BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME + ( DontCares...) const; + }; + + template<typename Fun, class ...Args> + struct BOOST_PP_CAT( BOOST_PP_CAT(has_member_function_callable_with_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME), _impl) + <Fun, true , Args...> + { + template<class T> + struct make_dontcare + { + typedef boost_intrusive_has_member_function_callable_with::dont_care type; + }; + + typedef BOOST_PP_CAT( funwrap_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME ) + <Fun, typename make_dontcare<Args>::type...> FunWrap; + + static bool const value = (sizeof(boost_intrusive_has_member_function_callable_with::no_type) == + sizeof(boost_intrusive_has_member_function_callable_with::is_private_type + ( (::boost::move_detail::declval< FunWrap >(). + BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME + ( ::boost::move_detail::declval<Args>()... ), 0) ) + ) + ); + }; + + template<typename Fun, class ...Args> + struct BOOST_PP_CAT( has_member_function_callable_with_ + , BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME) + : public BOOST_PP_CAT( BOOST_PP_CAT(has_member_function_callable_with_ + , BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME),_impl) + < Fun + , BOOST_PP_CAT( has_member_function_named_ + , BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME )<Fun>::value + , Args... > + {}; + + #endif //#if !defined(BOOST_INTRUSIVE_PERFECT_FORWARDING) + + BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END + + #else //BOOST_PP_ITERATION() == 0 + + #if !defined(BOOST_INTRUSIVE_PERFECT_FORWARDING) + + BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN + + template<typename Fun> + struct BOOST_PP_CAT( BOOST_PP_CAT(funwrap, BOOST_PP_ITERATION()) + , BOOST_PP_CAT(_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)) + : Fun + { + BOOST_PP_CAT( BOOST_PP_CAT(funwrap, BOOST_PP_ITERATION()) + , BOOST_PP_CAT(_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME))(); + + using Fun::BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME; + boost_intrusive_has_member_function_callable_with::private_type + BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME + ( BOOST_PP_ENUM(BOOST_PP_ITERATION() + , BOOST_INTRUSIVE_PP_IDENTITY + , boost_intrusive_has_member_function_callable_with::dont_care)) const; + }; + + template<typename Fun BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(), class P)> + struct BOOST_PP_CAT( BOOST_PP_CAT(has_member_function_callable_with_ + , BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME),_impl) + <Fun, true + BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(), P) + BOOST_PP_ENUM_TRAILING( BOOST_PP_SUB(BOOST_PP_ITERATION_FINISH(), BOOST_PP_ITERATION()) + , BOOST_INTRUSIVE_PP_IDENTITY + , void)> + { + typedef BOOST_PP_CAT( BOOST_PP_CAT(funwrap, BOOST_PP_ITERATION()) + , BOOST_PP_CAT(_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME))<Fun> + FunWrap; + static bool const value = + (sizeof(boost_intrusive_has_member_function_callable_with::no_type) == + sizeof(boost_intrusive_has_member_function_callable_with::is_private_type + ( (boost::move_detail::declval<FunWrap>(). + BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME + ( BOOST_PP_ENUM( BOOST_PP_ITERATION(), BOOST_INTRUSIVE_PP_DECLVAL, _) ), 0 + ) + ) + ) + ); + }; + + BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END + #endif //#if !defined(BOOST_INTRUSIVE_PERFECT_FORWARDING) + + #endif //BOOST_PP_ITERATION() == 0 + + #if BOOST_PP_ITERATION() == BOOST_PP_ITERATION_FINISH() + + #if !defined(BOOST_INTRUSIVE_PERFECT_FORWARDING) + + BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN + + template<typename Fun + BOOST_PP_ENUM_TRAILING(BOOST_PP_ITERATION_FINISH(), BOOST_INTRUSIVE_PP_TEMPLATE_PARAM_VOID_DEFAULT, _)> + struct BOOST_PP_CAT(has_member_function_callable_with_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME) + : public BOOST_PP_CAT(BOOST_PP_CAT(has_member_function_callable_with_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME), _impl) + <Fun, BOOST_PP_CAT(has_member_function_named_, BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME)<Fun>::value + BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION_FINISH(), P) > + {}; + + BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END + + #endif //#if !defined(BOOST_INTRUSIVE_PERFECT_FORWARDING) + + #undef BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME + #undef BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN + #undef BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END + + #endif //#if BOOST_PP_ITERATION() == BOOST_PP_ITERATION_FINISH() + +#endif //!BOOST_PP_IS_ITERATING diff --git a/3rdParty/Boost/src/boost/intrusive/detail/memory_util.hpp b/3rdParty/Boost/src/boost/intrusive/detail/memory_util.hpp new file mode 100644 index 0000000..1a6431b --- /dev/null +++ b/3rdParty/Boost/src/boost/intrusive/detail/memory_util.hpp @@ -0,0 +1,288 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Pablo Halpern 2009. 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) +// +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2011-2012. 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) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTRUSIVE_ALLOCATOR_MEMORY_UTIL_HPP +#define BOOST_INTRUSIVE_ALLOCATOR_MEMORY_UTIL_HPP + +#if (defined _MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include <boost/intrusive/detail/config_begin.hpp> +#include <boost/intrusive/detail/workaround.hpp> +#include <boost/intrusive/detail/mpl.hpp> +#include <boost/intrusive/detail/preprocessor.hpp> + +namespace boost { +namespace intrusive { +namespace detail { + +template <typename T> +inline T* addressof(T& obj) +{ + return static_cast<T*> + (static_cast<void*> + (const_cast<char*> + (&reinterpret_cast<const char&>(obj)) + ) + ); +} + +template <typename T> struct unvoid { typedef T type; }; +template <> struct unvoid<void> { struct type { }; }; +template <> struct unvoid<const void> { struct type { }; }; + +template <typename T> +struct LowPriorityConversion +{ + // Convertible from T with user-defined-conversion rank. + LowPriorityConversion(const T&) { } +}; + +// Infrastructure for providing a default type for T::TNAME if absent. +#define BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(TNAME) \ + template <typename T, typename DefaultType> \ + struct boost_intrusive_default_type_ ## TNAME \ + { \ + template <typename X> \ + static char test(int, typename X::TNAME*); \ + \ + template <typename X> \ + static int test(boost::intrusive::detail:: \ + LowPriorityConversion<int>, void*); \ + \ + struct DefaultWrap { typedef DefaultType TNAME; }; \ + \ + static const bool value = (1 == sizeof(test<T>(0, 0))); \ + \ + typedef typename \ + ::boost::intrusive::detail::if_c \ + <value, T, DefaultWrap>::type::TNAME type; \ + }; \ + \ + template <typename T, typename DefaultType> \ + struct boost_intrusive_eval_default_type_ ## TNAME \ + { \ + template <typename X> \ + static char test(int, typename X::TNAME*); \ + \ + template <typename X> \ + static int test(boost::intrusive::detail:: \ + LowPriorityConversion<int>, void*); \ + \ + struct DefaultWrap \ + { typedef typename DefaultType::type TNAME; }; \ + \ + static const bool value = (1 == sizeof(test<T>(0, 0))); \ + \ + typedef typename \ + ::boost::intrusive::detail::eval_if_c \ + < value \ + , ::boost::intrusive::detail::identity<T> \ + , ::boost::intrusive::detail::identity<DefaultWrap> \ + >::type::TNAME type; \ + }; \ +// + +#define BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT(INSTANTIATION_NS_PREFIX, T, TNAME, TIMPL) \ + typename INSTANTIATION_NS_PREFIX \ + boost_intrusive_default_type_ ## TNAME< T, TIMPL >::type \ +// + +#define BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_EVAL_DEFAULT(INSTANTIATION_NS_PREFIX, T, TNAME, TIMPL) \ + typename INSTANTIATION_NS_PREFIX \ + boost_intrusive_eval_default_type_ ## TNAME< T, TIMPL >::type \ +// + +}}} //namespace boost::intrusive::detail + +#include <boost/intrusive/detail/has_member_function_callable_with.hpp> + +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME pointer_to +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN namespace boost { namespace intrusive { namespace detail { +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}} +#define BOOST_PP_ITERATION_PARAMS_1 (3, (0, 1, <boost/intrusive/detail/has_member_function_callable_with.hpp>)) +#include BOOST_PP_ITERATE() + +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME static_cast_from +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN namespace boost { namespace intrusive { namespace detail { +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}} +#define BOOST_PP_ITERATION_PARAMS_1 (3, (0, 1, <boost/intrusive/detail/has_member_function_callable_with.hpp>)) +#include BOOST_PP_ITERATE() + +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME const_cast_from +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN namespace boost { namespace intrusive { namespace detail { +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}} +#define BOOST_PP_ITERATION_PARAMS_1 (3, (0, 1, <boost/intrusive/detail/has_member_function_callable_with.hpp>)) +#include BOOST_PP_ITERATE() + +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME dynamic_cast_from +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_BEGIN namespace boost { namespace intrusive { namespace detail { +#define BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_NS_END }}} +#define BOOST_PP_ITERATION_PARAMS_1 (3, (0, 1, <boost/intrusive/detail/has_member_function_callable_with.hpp>)) +#include BOOST_PP_ITERATE() + +namespace boost { +namespace intrusive { +namespace detail { + +BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(element_type) +BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(difference_type) + +////////////////////// +//struct first_param +////////////////////// + +template <typename T> struct first_param +{ typedef void type; }; + +#if !defined(BOOST_NO_VARIADIC_TEMPLATES) + + template <template <typename, typename...> class TemplateClass, typename T, typename... Args> + struct first_param< TemplateClass<T, Args...> > + { + typedef T type; + }; + +#else //C++03 compilers + + #define BOOST_PP_LOCAL_MACRO(n) \ + template < template <typename \ + BOOST_PP_ENUM_TRAILING(n, BOOST_INTRUSIVE_PP_IDENTITY, typename) > \ + class TemplateClass \ + , typename T BOOST_PP_ENUM_TRAILING_PARAMS(n, class P)> \ + struct first_param \ + < TemplateClass<T BOOST_PP_ENUM_TRAILING_PARAMS(n, P)> > \ + { \ + typedef T type; \ + }; \ + // + #define BOOST_PP_LOCAL_LIMITS (0, BOOST_INTRUSIVE_MAX_CONSTRUCTOR_PARAMETERS) + #include BOOST_PP_LOCAL_ITERATE() + +#endif //!defined(BOOST_NO_VARIADIC_TEMPLATES) + +/////////////////////////// +//struct type_rebind_mode +/////////////////////////// +template <typename Ptr, typename T> +struct type_has_rebind +{ + template <typename X> + #if !defined (__SUNPRO_CC) + static char test(int, typename X::template rebind<T>*); + #else + static char test(int, typename X::rebind<T>*); + #endif + + template <typename X> + static int test(boost::intrusive::detail::LowPriorityConversion<int>, void*); + + static const bool value = (1 == sizeof(test<Ptr>(0, 0))); +}; + +template <typename Ptr, typename T> +struct type_has_rebind_other +{ + template <typename X> + #if !defined (__SUNPRO_CC) + static char test(int, typename X::template rebind<T>::other*); + #else + static char test(int, typename X::rebind<T>::other*); + #endif + + template <typename X> + static int test(boost::intrusive::detail::LowPriorityConversion<int>, void*); + + static const bool value = (1 == sizeof(test<Ptr>(0, 0))); +}; + +template <typename Ptr, typename T> +struct type_rebind_mode +{ + static const unsigned int rebind = (unsigned int)type_has_rebind<Ptr, T>::value; + static const unsigned int rebind_other = (unsigned int)type_has_rebind_other<Ptr, T>::value; + static const unsigned int mode = rebind + rebind*rebind_other; +}; + +//////////////////////// +//struct type_rebinder +//////////////////////// +template <typename Ptr, typename U, unsigned int RebindMode = type_rebind_mode<Ptr, U>::mode> +struct type_rebinder; + +// Implementation of pointer_traits<Ptr>::rebind if Ptr has +// its own rebind::other type (C++03) +template <typename Ptr, typename U> +struct type_rebinder< Ptr, U, 2u > +{ + typedef typename Ptr::template rebind<U>::other type; +}; + +// Implementation of pointer_traits<Ptr>::rebind if Ptr has +// its own rebind template. +template <typename Ptr, typename U> +struct type_rebinder< Ptr, U, 1u > +{ + typedef typename Ptr::template rebind<U> type; +}; + +// Specialization of pointer_traits<Ptr>::rebind if Ptr does not +// have its own rebind template but has a the form Ptr<class T, +// OtherArgs>, where OtherArgs comprises zero or more type parameters. +// Many pointers fit this form, hence many pointers will get a +// reasonable default for rebind. +#if !defined(BOOST_NO_VARIADIC_TEMPLATES) + +template <template <class, class...> class Ptr, typename T, class... Tn, class U> +struct type_rebinder<Ptr<T, Tn...>, U, 0u > +{ + typedef Ptr<U, Tn...> type; +}; + +//Needed for non-conforming compilers like GCC 4.3 +template <template <class> class Ptr, typename T, class U> +struct type_rebinder<Ptr<T>, U, 0u > +{ + typedef Ptr<U> type; +}; + +#else //C++03 compilers + +#define BOOST_PP_LOCAL_MACRO(n) \ +template < template <typename \ + BOOST_PP_ENUM_TRAILING(n, BOOST_INTRUSIVE_PP_IDENTITY, typename) > \ + class Ptr \ + , typename T BOOST_PP_ENUM_TRAILING_PARAMS(n, class P) \ + , class U> \ +struct type_rebinder \ + < Ptr<T BOOST_PP_ENUM_TRAILING_PARAMS(n, P)>, U, 0u > \ +{ \ + typedef Ptr<U BOOST_PP_ENUM_TRAILING_PARAMS(n, P)> type; \ +}; \ +// +#define BOOST_PP_LOCAL_LIMITS (0, BOOST_INTRUSIVE_MAX_CONSTRUCTOR_PARAMETERS) +#include BOOST_PP_LOCAL_ITERATE() + +#endif //!defined(BOOST_NO_VARIADIC_TEMPLATES) + +} //namespace detail { +} //namespace intrusive { +} //namespace boost { + +#include <boost/intrusive/detail/config_end.hpp> + +#endif // ! defined(BOOST_INTRUSIVE_ALLOCATOR_MEMORY_UTIL_HPP) diff --git a/3rdParty/Boost/src/boost/intrusive/detail/mpl.hpp b/3rdParty/Boost/src/boost/intrusive/detail/mpl.hpp new file mode 100644 index 0000000..02b1361 --- /dev/null +++ b/3rdParty/Boost/src/boost/intrusive/detail/mpl.hpp @@ -0,0 +1,367 @@ +///////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2006-2012 +// +// 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) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +///////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTRUSIVE_DETAIL_MPL_HPP +#define BOOST_INTRUSIVE_DETAIL_MPL_HPP + +#include <boost/intrusive/detail/config_begin.hpp> +#include <cstddef> + +namespace boost { +namespace intrusive { +namespace detail { + +typedef char one; +struct two {one _[2];}; + +template< bool C_ > +struct bool_ +{ + static const bool value = C_; +}; + +typedef bool_<true> true_; +typedef bool_<false> false_; + +typedef true_ true_type; +typedef false_ false_type; + +typedef char yes_type; +struct no_type +{ + char padding[8]; +}; + +template <bool B, class T = void> +struct enable_if_c { + typedef T type; +}; + +template <class T> +struct enable_if_c<false, T> {}; + +template <class Cond, class T = void> +struct enable_if : public enable_if_c<Cond::value, T>{}; + +template<class F, class Param> +struct apply +{ + typedef typename F::template apply<Param>::type type; +}; + +template <class T, class U> +class is_convertible +{ + typedef char true_t; + class false_t { char dummy[2]; }; + static true_t dispatch(U); + static false_t dispatch(...); + static const T &trigger(); + public: + static const bool value = sizeof(dispatch(trigger())) == sizeof(true_t); +}; + +template< + bool C + , typename T1 + , typename T2 + > +struct if_c +{ + typedef T1 type; +}; + +template< + typename T1 + , typename T2 + > +struct if_c<false,T1,T2> +{ + typedef T2 type; +}; + +template< + typename C + , typename T1 + , typename T2 + > +struct if_ +{ + typedef typename if_c<0 != C::value, T1, T2>::type type; +}; + +template< + bool C + , typename F1 + , typename F2 + > +struct eval_if_c + : if_c<C,F1,F2>::type +{}; + +template< + typename C + , typename T1 + , typename T2 + > +struct eval_if + : if_<C,T1,T2>::type +{}; + +// identity is an extension: it is not part of the standard. +template <class T> +struct identity +{ + typedef T type; +}; + +#if defined(BOOST_MSVC) || defined(__BORLANDC_) +#define BOOST_INTRUSIVE_TT_DECL __cdecl +#else +#define BOOST_INTRUSIVE_TT_DECL +#endif + +#if defined(_MSC_EXTENSIONS) && !defined(__BORLAND__) && !defined(_WIN64) && !defined(UNDER_CE) +#define BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS +#endif + +template <typename T> +struct is_unary_or_binary_function_impl +{ static const bool value = false; }; + +// see boost ticket #4094 +// avoid duplicate definitions of is_unary_or_binary_function_impl +#ifndef BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS + +template <typename R> +struct is_unary_or_binary_function_impl<R (*)()> +{ static const bool value = true; }; + +template <typename R> +struct is_unary_or_binary_function_impl<R (*)(...)> +{ static const bool value = true; }; + +#else // BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS + +template <typename R> +struct is_unary_or_binary_function_impl<R (__stdcall*)()> +{ static const bool value = true; }; + +#ifndef _MANAGED + +template <typename R> +struct is_unary_or_binary_function_impl<R (__fastcall*)()> +{ static const bool value = true; }; + +#endif + +template <typename R> +struct is_unary_or_binary_function_impl<R (__cdecl*)()> +{ static const bool value = true; }; + +template <typename R> +struct is_unary_or_binary_function_impl<R (__cdecl*)(...)> +{ static const bool value = true; }; + +#endif + +// see boost ticket #4094 +// avoid duplicate definitions of is_unary_or_binary_function_impl +#ifndef BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS + +template <typename R, class T0> +struct is_unary_or_binary_function_impl<R (*)(T0)> +{ static const bool value = true; }; + +template <typename R, class T0> +struct is_unary_or_binary_function_impl<R (*)(T0...)> +{ static const bool value = true; }; + +#else // BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS + +template <typename R, class T0> +struct is_unary_or_binary_function_impl<R (__stdcall*)(T0)> +{ static const bool value = true; }; + +#ifndef _MANAGED + +template <typename R, class T0> +struct is_unary_or_binary_function_impl<R (__fastcall*)(T0)> +{ static const bool value = true; }; + +#endif + +template <typename R, class T0> +struct is_unary_or_binary_function_impl<R (__cdecl*)(T0)> +{ static const bool value = true; }; + +template <typename R, class T0> +struct is_unary_or_binary_function_impl<R (__cdecl*)(T0...)> +{ static const bool value = true; }; + +#endif + +// see boost ticket #4094 +// avoid duplicate definitions of is_unary_or_binary_function_impl +#ifndef BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS + +template <typename R, class T0, class T1> +struct is_unary_or_binary_function_impl<R (*)(T0, T1)> +{ static const bool value = true; }; + +template <typename R, class T0, class T1> +struct is_unary_or_binary_function_impl<R (*)(T0, T1...)> +{ static const bool value = true; }; + +#else // BOOST_INTRUSIVE_TT_TEST_MSC_FUNC_SIGS + +template <typename R, class T0, class T1> +struct is_unary_or_binary_function_impl<R (__stdcall*)(T0, T1)> +{ static const bool value = true; }; + +#ifndef _MANAGED + +template <typename R, class T0, class T1> +struct is_unary_or_binary_function_impl<R (__fastcall*)(T0, T1)> +{ static const bool value = true; }; + +#endif + +template <typename R, class T0, class T1> +struct is_unary_or_binary_function_impl<R (__cdecl*)(T0, T1)> +{ static const bool value = true; }; + +template <typename R, class T0, class T1> +struct is_unary_or_binary_function_impl<R (__cdecl*)(T0, T1...)> +{ static const bool value = true; }; +#endif + +template <typename T> +struct is_unary_or_binary_function_impl<T&> +{ static const bool value = false; }; + +template<typename T> +struct is_unary_or_binary_function +{ static const bool value = is_unary_or_binary_function_impl<T>::value; }; + +//boost::alignment_of yields to 10K lines of preprocessed code, so we +//need an alternative +template <typename T> struct alignment_of; + +template <typename T> +struct alignment_of_hack +{ + char c; + T t; + alignment_of_hack(); +}; + +template <unsigned A, unsigned S> +struct alignment_logic +{ + static const std::size_t value = A < S ? A : S; +}; + +template< typename T > +struct alignment_of +{ + static const std::size_t value = alignment_logic + < sizeof(alignment_of_hack<T>) - sizeof(T) + , sizeof(T) + >::value; +}; + +template <typename T, typename U> +struct is_same +{ + typedef char yes_type; + struct no_type + { + char padding[8]; + }; + + template <typename V> + static yes_type is_same_tester(V*, V*); + static no_type is_same_tester(...); + + static T *t; + static U *u; + + static const bool value = sizeof(yes_type) == sizeof(is_same_tester(t,u)); +}; + +template<typename T> +struct add_const +{ typedef const T type; }; + +template<typename T> +struct remove_const +{ typedef T type; }; + +template<typename T> +struct remove_const<const T> +{ typedef T type; }; + +template<class T> +struct remove_reference +{ + typedef T type; +}; + +template<class T> +struct remove_reference<T&> +{ + typedef T type; +}; + +template<class Class> +class is_empty_class +{ + template <typename T> + struct empty_helper_t1 : public T + { + empty_helper_t1(); + int i[256]; + }; + + struct empty_helper_t2 + { int i[256]; }; + + public: + static const bool value = sizeof(empty_helper_t1<Class>) == sizeof(empty_helper_t2); +}; + +template<std::size_t S> +struct ls_zeros +{ + static const std::size_t value = (S & std::size_t(1)) ? 0 : (1 + ls_zeros<(S>>1u)>::value); +}; + +template<> +struct ls_zeros<0> +{ + static const std::size_t value = 0; +}; + +template<> +struct ls_zeros<1> +{ + static const std::size_t value = 0; +}; + +} //namespace detail +} //namespace intrusive +} //namespace boost + +#include <boost/intrusive/detail/config_end.hpp> + +#endif //BOOST_INTRUSIVE_DETAIL_MPL_HPP diff --git a/3rdParty/Boost/src/boost/intrusive/detail/preprocessor.hpp b/3rdParty/Boost/src/boost/intrusive/detail/preprocessor.hpp new file mode 100644 index 0000000..348b104 --- /dev/null +++ b/3rdParty/Boost/src/boost/intrusive/detail/preprocessor.hpp @@ -0,0 +1,52 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2008-2012. 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) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTRUSIVE_DETAIL_PREPROCESSOR_HPP +#define BOOST_INTRUSIVE_DETAIL_PREPROCESSOR_HPP + +#if (defined _MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include <boost/intrusive/detail/config_begin.hpp> +#include <boost/intrusive/detail/workaround.hpp> + +#include <boost/preprocessor/iteration/local.hpp> +#include <boost/preprocessor/punctuation/paren_if.hpp> +#include <boost/preprocessor/punctuation/comma_if.hpp> +#include <boost/preprocessor/control/expr_if.hpp> +#include <boost/preprocessor/cat.hpp> +#include <boost/preprocessor/repetition/enum.hpp> +#include <boost/preprocessor/repetition/enum_params.hpp> +#include <boost/preprocessor/repetition/enum_trailing_params.hpp> +#include <boost/preprocessor/repetition/enum_trailing.hpp> +#include <boost/preprocessor/repetition/enum_shifted_params.hpp> +#include <boost/preprocessor/repetition/enum_shifted.hpp> +#include <boost/preprocessor/repetition/repeat.hpp> +#include <boost/preprocessor/logical/not.hpp> +#include <boost/preprocessor/arithmetic/sub.hpp> +#include <boost/preprocessor/arithmetic/add.hpp> +#include <boost/preprocessor/iteration/iterate.hpp> + +#define BOOST_INTRUSIVE_MAX_CONSTRUCTOR_PARAMETERS 10 + +#define BOOST_INTRUSIVE_PP_IDENTITY(z, n, data) data + +#define BOOST_INTRUSIVE_PP_DECLVAL(z, n, data) \ +boost::move_detail::declval< BOOST_PP_CAT(P, n) >() \ +//! + +#define BOOST_INTRUSIVE_PP_TEMPLATE_PARAM_VOID_DEFAULT(z, n, data) \ + BOOST_PP_CAT(class P, n) = void \ +//! + +#include <boost/intrusive/detail/config_end.hpp> + +#endif //#ifndef BOOST_INTRUSIVE_DETAIL_PREPROCESSOR_HPP diff --git a/3rdParty/Boost/src/boost/intrusive/detail/workaround.hpp b/3rdParty/Boost/src/boost/intrusive/detail/workaround.hpp new file mode 100644 index 0000000..87cab4b --- /dev/null +++ b/3rdParty/Boost/src/boost/intrusive/detail/workaround.hpp @@ -0,0 +1,22 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2005-2012. 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) +// +// See http://www.boost.org/libs/interprocess for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTRUSIVE_DETAIL_WRKRND_HPP +#define BOOST_INTRUSIVE_DETAIL_WRKRND_HPP + +#include <boost/intrusive/detail/config_begin.hpp> + +#if !defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_NO_VARIADIC_TEMPLATES) + #define BOOST_INTRUSIVE_PERFECT_FORWARDING +#endif + +#include <boost/intrusive/detail/config_end.hpp> + +#endif //#ifndef BOOST_INTRUSIVE_DETAIL_WRKRND_HPP diff --git a/3rdParty/Boost/src/boost/intrusive/pointer_traits.hpp b/3rdParty/Boost/src/boost/intrusive/pointer_traits.hpp new file mode 100644 index 0000000..98ca6b9 --- /dev/null +++ b/3rdParty/Boost/src/boost/intrusive/pointer_traits.hpp @@ -0,0 +1,265 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Pablo Halpern 2009. 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) +// +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright Ion Gaztanaga 2011-2012. 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) +// +// See http://www.boost.org/libs/intrusive for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_INTRUSIVE_POINTER_TRAITS_HPP +#define BOOST_INTRUSIVE_POINTER_TRAITS_HPP + +#if (defined _MSC_VER) && (_MSC_VER >= 1200) +# pragma once +#endif + +#include <boost/intrusive/detail/config_begin.hpp> +#include <boost/intrusive/detail/workaround.hpp> +#include <boost/intrusive/detail/memory_util.hpp> +#include <boost/type_traits/integral_constant.hpp> +#include <cstddef> + +namespace boost { +namespace intrusive { + +//! pointer_traits is the implementation of C++11 std::pointer_traits class with some +//! extensions like castings. +//! +//! pointer_traits supplies a uniform interface to certain attributes of pointer-like types. +template <typename Ptr> +struct pointer_traits +{ + #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED + //!The pointer type + //!queried by this pointer_traits instantiation + typedef Ptr pointer; + + //!Ptr::element_type if such a type exists; otherwise, T if Ptr is a class + //!template instantiation of the form SomePointer<T, Args>, where Args is zero or + //!more type arguments ; otherwise , the specialization is ill-formed. + typedef unspecified_type element_type; + + //!Ptr::difference_type if such a type exists; otherwise, + //!std::ptrdiff_t. + typedef unspecified_type difference_type; + + //!Ptr::rebind<U> if such a type exists; otherwise, SomePointer<U, Args> if Ptr is + //!a class template instantiation of the form SomePointer<T, Args>, where Args is zero or + //!more type arguments ; otherwise, the instantiation of rebind is ill-formed. + //! + //!For portable code for C++03 and C++11, <pre>typename rebind_pointer<U>::type</pre> + //!shall be used instead of rebind<U> to obtain a pointer to U. + template <class U> using rebind = unspecified; + + //!Ptr::rebind<U> if such a type exists; otherwise, SomePointer<U, Args> if Ptr is + //!a class template instantiation of the form SomePointer<T, Args>, where Args is zero or + //!more type arguments ; otherwise, the instantiation of rebind is ill-formed. + //! + typedef element_type &reference; + #else + typedef Ptr pointer; + // + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_EVAL_DEFAULT + ( boost::intrusive::detail::, Ptr, element_type + , boost::intrusive::detail::first_param<Ptr>) element_type; + // + typedef BOOST_INTRUSIVE_OBTAIN_TYPE_WITH_DEFAULT + (boost::intrusive::detail::, Ptr, difference_type, std::ptrdiff_t) difference_type; + // + typedef typename boost::intrusive::detail::unvoid<element_type>::type& reference; + // + template <class U> struct rebind_pointer + { + typedef typename boost::intrusive::detail::type_rebinder<Ptr, U>::type type; + }; + + #if !defined(BOOST_NO_TEMPLATE_ALIASES) + template <class U> using rebind = typename boost::intrusive::detail::type_rebinder<Ptr, U>::type; + #endif + #endif //#if !defined(BOOST_NO_TEMPLATE_ALIASES) + + //! <b>Remark</b>: If element_type is (possibly cv-qualified) void, r type is unspecified; otherwise, + //! it is element_type &. + //! + //! <b>Returns</b>: A dereferenceable pointer to r obtained by calling Ptr::pointer_to(r). + //! Non-standard extension: If such function does not exist, returns pointer(addressof(r)); + static pointer pointer_to(reference r) + { + //Non-standard extension, it does not require Ptr::pointer_to. If not present + //tries to converts &r to pointer. + const bool value = boost::intrusive::detail:: + has_member_function_callable_with_pointer_to + <Ptr, typename boost::intrusive::detail::unvoid<element_type &>::type>::value; + ::boost::integral_constant<bool, value> flag; + return pointer_traits::priv_pointer_to(flag, r); + } + + //! <b>Remark</b>: Non-standard extension. + //! + //! <b>Returns</b>: A dereferenceable pointer to r obtained by calling Ptr::static_cast_from(r). + //! If such function does not exist, returns pointer_to(static_cast<element_type&>(*uptr)) + template<class UPtr> + static pointer static_cast_from(const UPtr &uptr) + { + const bool value = boost::intrusive::detail:: + has_member_function_callable_with_static_cast_from + <Ptr, const UPtr>::value; + ::boost::integral_constant<bool, value> flag; + return pointer_traits::priv_static_cast_from(flag, uptr); + } + + //! <b>Remark</b>: Non-standard extension. + //! + //! <b>Returns</b>: A dereferenceable pointer to r obtained by calling Ptr::const_cast_from(r). + //! If such function does not exist, returns pointer_to(const_cast<element_type&>(*uptr)) + template<class UPtr> + static pointer const_cast_from(const UPtr &uptr) + { + const bool value = boost::intrusive::detail:: + has_member_function_callable_with_const_cast_from + <Ptr, const UPtr>::value; + ::boost::integral_constant<bool, value> flag; + return pointer_traits::priv_const_cast_from(flag, uptr); + } + + //! <b>Remark</b>: Non-standard extension. + //! + //! <b>Returns</b>: A dereferenceable pointer to r obtained by calling Ptr::dynamic_cast_from(r). + //! If such function does not exist, returns pointer_to(*dynamic_cast<element_type*>(&*uptr)) + template<class UPtr> + static pointer dynamic_cast_from(const UPtr &uptr) + { + const bool value = boost::intrusive::detail:: + has_member_function_callable_with_dynamic_cast_from + <Ptr, const UPtr>::value; + ::boost::integral_constant<bool, value> flag; + return pointer_traits::priv_dynamic_cast_from(flag, uptr); + } + + ///@cond + private: + //priv_to_raw_pointer + template <class T> + static T* to_raw_pointer(T* p) + { return p; } + + template <class Pointer> + static typename pointer_traits<Pointer>::element_type* + to_raw_pointer(const Pointer &p) + { return pointer_traits::to_raw_pointer(p.operator->()); } + + //priv_pointer_to + static pointer priv_pointer_to(boost::true_type, typename boost::intrusive::detail::unvoid<element_type>::type& r) + { return Ptr::pointer_to(r); } + + static pointer priv_pointer_to(boost::false_type, typename boost::intrusive::detail::unvoid<element_type>::type& r) + { return pointer(boost::intrusive::detail::addressof(r)); } + + //priv_static_cast_from + template<class UPtr> + static pointer priv_static_cast_from(boost::true_type, const UPtr &uptr) + { return Ptr::static_cast_from(uptr); } + + template<class UPtr> + static pointer priv_static_cast_from(boost::false_type, const UPtr &uptr) + { return pointer_to(*static_cast<element_type*>(to_raw_pointer(uptr))); } + + //priv_const_cast_from + template<class UPtr> + static pointer priv_const_cast_from(boost::true_type, const UPtr &uptr) + { return Ptr::const_cast_from(uptr); } + + template<class UPtr> + static pointer priv_const_cast_from(boost::false_type, const UPtr &uptr) + { return pointer_to(const_cast<element_type&>(*uptr)); } + + //priv_dynamic_cast_from + template<class UPtr> + static pointer priv_dynamic_cast_from(boost::true_type, const UPtr &uptr) + { return Ptr::dynamic_cast_from(uptr); } + + template<class UPtr> + static pointer priv_dynamic_cast_from(boost::false_type, const UPtr &uptr) + { return pointer_to(*dynamic_cast<element_type*>(&*uptr)); } + ///@endcond +}; + +///@cond + +// Remove cv qualification from Ptr parameter to pointer_traits: +template <typename Ptr> +struct pointer_traits<const Ptr> : pointer_traits<Ptr> {}; +template <typename Ptr> +struct pointer_traits<volatile Ptr> : pointer_traits<Ptr> { }; +template <typename Ptr> +struct pointer_traits<const volatile Ptr> : pointer_traits<Ptr> { }; +// Remove reference from Ptr parameter to pointer_traits: +template <typename Ptr> +struct pointer_traits<Ptr&> : pointer_traits<Ptr> { }; + +///@endcond + +//! Specialization of pointer_traits for raw pointers +//! +template <typename T> +struct pointer_traits<T*> +{ + typedef T element_type; + typedef T* pointer; + typedef std::ptrdiff_t difference_type; + + #ifdef BOOST_INTRUSIVE_DOXYGEN_INVOKED + typedef T & reference; + //!typedef for <pre>U *</pre> + //! + //!For portable code for C++03 and C++11, <pre>typename rebind_pointer<U>::type</pre> + //!shall be used instead of rebind<U> to obtain a pointer to U. + template <class U> using rebind = U*; + #else + typedef typename boost::intrusive::detail::unvoid<element_type>::type& reference; + #if !defined(BOOST_NO_TEMPLATE_ALIASES) + template <class U> using rebind = U*; + #endif + #endif + + template <class U> struct rebind_pointer + { typedef U* type; }; + + //! <b>Returns</b>: addressof(r) + //! + static pointer pointer_to(reference r) + { return boost::intrusive::detail::addressof(r); } + + //! <b>Returns</b>: static_cast<pointer>(uptr) + //! + template<class U> + static pointer static_cast_from(U *uptr) + { return static_cast<pointer>(uptr); } + + //! <b>Returns</b>: const_cast<pointer>(uptr) + //! + template<class U> + static pointer const_cast_from(U *uptr) + { return const_cast<pointer>(uptr); } + + //! <b>Returns</b>: dynamic_cast<pointer>(uptr) + //! + template<class U> + static pointer dynamic_cast_from(U *uptr) + { return dynamic_cast<pointer>(uptr); } +}; + +} //namespace container { +} //namespace boost { + +#include <boost/intrusive/detail/config_end.hpp> + +#endif // ! defined(BOOST_INTRUSIVE_POINTER_TRAITS_HPP) diff --git a/3rdParty/Boost/src/boost/iterator.hpp b/3rdParty/Boost/src/boost/iterator.hpp index a43cfe1..6adab0e 100644 --- a/3rdParty/Boost/src/boost/iterator.hpp +++ b/3rdParty/Boost/src/boost/iterator.hpp @@ -1,4 +1,4 @@ -// interator.hpp workarounds for non-conforming standard libraries ---------// +// iterator.hpp workarounds for non-conforming standard libraries ---------// // (C) Copyright Beman Dawes 2000. Distributed under the Boost // Software License, Version 1.0. (See accompanying file diff --git a/3rdParty/Boost/src/boost/iterator/iterator_adaptor.hpp b/3rdParty/Boost/src/boost/iterator/iterator_adaptor.hpp index 27b08ff..9f2fbb0 100644 --- a/3rdParty/Boost/src/boost/iterator/iterator_adaptor.hpp +++ b/3rdParty/Boost/src/boost/iterator/iterator_adaptor.hpp @@ -24,15 +24,9 @@ #ifdef BOOST_ITERATOR_REF_CONSTNESS_KILLS_WRITABILITY # include <boost/type_traits/remove_reference.hpp> - -# if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x610)) -# include <boost/type_traits/add_reference.hpp> -# endif - -#else -# include <boost/type_traits/add_reference.hpp> #endif +#include <boost/type_traits/add_reference.hpp> #include <boost/iterator/detail/config_def.hpp> #include <boost/iterator/iterator_traits.hpp> diff --git a/3rdParty/Boost/src/boost/iterator/iterator_facade.hpp b/3rdParty/Boost/src/boost/iterator/iterator_facade.hpp index 5ee73b5..d84b402 100644 --- a/3rdParty/Boost/src/boost/iterator/iterator_facade.hpp +++ b/3rdParty/Boost/src/boost/iterator/iterator_facade.hpp @@ -14,8 +14,8 @@ #include <boost/iterator/detail/facade_iterator_category.hpp> #include <boost/iterator/detail/enable_if.hpp> -#include <boost/implicit_cast.hpp> #include <boost/static_assert.hpp> +#include <boost/utility/addressof.hpp> #include <boost/type_traits/is_same.hpp> #include <boost/type_traits/add_const.hpp> @@ -147,7 +147,7 @@ namespace boost // Returning a mutable reference allows nonsense like // (*r++).mutate(), but it imposes fewer assumptions about the - // behavior of the value_type. In particular, recall taht + // behavior of the value_type. In particular, recall that // (*r).mutate() is legal if operator* returns by value. value_type& operator*() const @@ -294,46 +294,43 @@ namespace boost // operator->() needs special support for input iterators to strictly meet the // standard's requirements. If *i is not a reference type, we must still - // produce a lvalue to which a pointer can be formed. We do that by - // returning an instantiation of this special proxy class template. - template <class T> - struct operator_arrow_proxy + // produce an lvalue to which a pointer can be formed. We do that by + // returning a proxy object containing an instance of the reference object. + template <class Reference, class Pointer> + struct operator_arrow_dispatch // proxy references { - operator_arrow_proxy(T const* px) : m_value(*px) {} - T* operator->() const { return &m_value; } - // This function is needed for MWCW and BCC, which won't call operator-> - // again automatically per 13.3.1.2 para 8 - operator T*() const { return &m_value; } - mutable T m_value; + struct proxy + { + explicit proxy(Reference const & x) : m_ref(x) {} + Reference* operator->() { return boost::addressof(m_ref); } + // This function is needed for MWCW and BCC, which won't call + // operator-> again automatically per 13.3.1.2 para 8 + operator Reference*() { return boost::addressof(m_ref); } + Reference m_ref; + }; + typedef proxy result_type; + static result_type apply(Reference const & x) + { + return result_type(x); + } }; - // A metafunction that gets the result type for operator->. Also - // has a static function make() which builds the result from a - // Reference - template <class ValueType, class Reference, class Pointer> - struct operator_arrow_result + template <class T, class Pointer> + struct operator_arrow_dispatch<T&, Pointer> // "real" references { - // CWPro8.3 won't accept "operator_arrow_result::type", and we - // need that type below, so metafunction forwarding would be a - // losing proposition here. - typedef typename mpl::if_< - is_reference<Reference> - , Pointer - , operator_arrow_proxy<ValueType> - >::type type; - - static type make(Reference x) + typedef Pointer result_type; + static result_type apply(T& x) { - return boost::implicit_cast<type>(&x); + return boost::addressof(x); } }; # if BOOST_WORKAROUND(BOOST_MSVC, < 1300) // Deal with ETI template<> - struct operator_arrow_result<int, int, int> + struct operator_arrow_dispatch<int, int> { - typedef int type; + typedef int result_type; }; # endif @@ -618,11 +615,10 @@ namespace boost Value, CategoryOrTraversal, Reference, Difference > associated_types; - typedef boost::detail::operator_arrow_result< - typename associated_types::value_type - , Reference + typedef boost::detail::operator_arrow_dispatch< + Reference , typename associated_types::pointer - > pointer_; + > operator_arrow_dispatch_; protected: // For use by derived classes @@ -634,7 +630,7 @@ namespace boost typedef Reference reference; typedef Difference difference_type; - typedef typename pointer_::type pointer; + typedef typename operator_arrow_dispatch_::result_type pointer; typedef typename associated_types::iterator_category iterator_category; @@ -645,7 +641,7 @@ namespace boost pointer operator->() const { - return pointer_::make(*this->derived()); + return operator_arrow_dispatch_::apply(*this->derived()); } typename boost::detail::operator_brackets_result<Derived,Value,reference>::type diff --git a/3rdParty/Boost/src/boost/iterator/reverse_iterator.hpp b/3rdParty/Boost/src/boost/iterator/reverse_iterator.hpp index 97b6b48..79cc7f2 100644 --- a/3rdParty/Boost/src/boost/iterator/reverse_iterator.hpp +++ b/3rdParty/Boost/src/boost/iterator/reverse_iterator.hpp @@ -7,8 +7,8 @@ #ifndef BOOST_REVERSE_ITERATOR_23022003THW_HPP #define BOOST_REVERSE_ITERATOR_23022003THW_HPP +#include <boost/next_prior.hpp> #include <boost/iterator.hpp> -#include <boost/utility.hpp> #include <boost/iterator/iterator_adaptor.hpp> namespace boost diff --git a/3rdParty/Boost/src/boost/iterator/transform_iterator.hpp b/3rdParty/Boost/src/boost/iterator/transform_iterator.hpp index c365fe0..b79a440 100644 --- a/3rdParty/Boost/src/boost/iterator/transform_iterator.hpp +++ b/3rdParty/Boost/src/boost/iterator/transform_iterator.hpp @@ -20,6 +20,8 @@ #include <boost/type_traits/is_reference.hpp> #include <boost/type_traits/remove_const.hpp> #include <boost/type_traits/remove_reference.hpp> +#include <boost/utility/result_of.hpp> + #if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1310)) # include <boost/type_traits/is_base_and_derived.hpp> @@ -35,33 +37,16 @@ namespace boost namespace detail { - - template <class UnaryFunc> - struct function_object_result - { - typedef typename UnaryFunc::result_type type; - }; - -#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - template <class Return, class Argument> - struct function_object_result<Return(*)(Argument)> - { - typedef Return type; - }; -#endif - // Compute the iterator_adaptor instantiation to be used for transform_iterator template <class UnaryFunc, class Iterator, class Reference, class Value> struct transform_iterator_base { private: // By default, dereferencing the iterator yields the same as - // the function. Do we need to adjust the way - // function_object_result is computed for the standard - // proposal (e.g. using Doug's result_of)? + // the function. typedef typename ia_dflt_help< Reference - , function_object_result<UnaryFunc> + , result_of<const UnaryFunc(typename std::iterator_traits<Iterator>::reference)> >::type reference; // To get the default for Value: remove any reference on the @@ -113,7 +98,7 @@ namespace boost #endif } - template< + template < class OtherUnaryFunction , class OtherIterator , class OtherReference diff --git a/3rdParty/Boost/src/boost/lambda/bind.hpp b/3rdParty/Boost/src/boost/lambda/bind.hpp new file mode 100644 index 0000000..0371393 --- /dev/null +++ b/3rdParty/Boost/src/boost/lambda/bind.hpp @@ -0,0 +1,19 @@ +// -- bind.hpp -- Boost Lambda Library -------------------------------------- + +// Copyright (C) 1999-2001 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi) +// Gary Powell (gwpowell@hotmail.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) +// +// For more information, see http://www.boost.org + +#ifndef BOOST_LAMBDA_BIND_HPP +#define BOOST_LAMBDA_BIND_HPP + +#include "boost/lambda/core.hpp" + +#include "boost/lambda/detail/bind_functions.hpp" + +#endif diff --git a/3rdParty/Boost/src/boost/lambda/core.hpp b/3rdParty/Boost/src/boost/lambda/core.hpp new file mode 100644 index 0000000..e42766f --- /dev/null +++ b/3rdParty/Boost/src/boost/lambda/core.hpp @@ -0,0 +1,79 @@ +// -- core.hpp -- Boost Lambda Library ------------------------------------- +// +// Copyright (C) 2000 Gary Powell (powellg@amazon.com) +// Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi) +// +// 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) +// +// For more information, see www.boost.org +// +// Includes the core of LL, without any real features for client: +// +// tuples, lambda functors, return type deduction templates, +// argument substitution mechanism (select functions) +// +// Some functionality comes as well: +// Assignment and subscript operators, as well as function +// call operator for placeholder variables. +// ------------------------------------------------------------------------- + +#ifndef BOOST_LAMBDA_CORE_HPP +#define BOOST_LAMBDA_CORE_HPP + +#include "boost/type_traits/transform_traits.hpp" +#include "boost/type_traits/cv_traits.hpp" + +#include "boost/tuple/tuple.hpp" + +// inject some of the tuple names into lambda +namespace boost { +namespace lambda { + +using ::boost::tuples::tuple; +using ::boost::tuples::null_type; + +} // lambda +} // boost + +#include "boost/lambda/detail/lambda_config.hpp" +#include "boost/lambda/detail/lambda_fwd.hpp" + +#include "boost/lambda/detail/arity_code.hpp" +#include "boost/lambda/detail/actions.hpp" + +#include "boost/lambda/detail/lambda_traits.hpp" + +#include "boost/lambda/detail/function_adaptors.hpp" +#include "boost/lambda/detail/return_type_traits.hpp" + +#include "boost/lambda/detail/select_functions.hpp" + +#include "boost/lambda/detail/lambda_functor_base.hpp" + +#include "boost/lambda/detail/lambda_functors.hpp" + +#include "boost/lambda/detail/ret.hpp" + +namespace boost { +namespace lambda { + +namespace { + + // These are constants types and need to be initialised + boost::lambda::placeholder1_type free1 = boost::lambda::placeholder1_type(); + boost::lambda::placeholder2_type free2 = boost::lambda::placeholder2_type(); + boost::lambda::placeholder3_type free3 = boost::lambda::placeholder3_type(); + + boost::lambda::placeholder1_type& _1 = free1; + boost::lambda::placeholder2_type& _2 = free2; + boost::lambda::placeholder3_type& _3 = free3; + // _1, _2, ... naming scheme by Peter Dimov +} // unnamed + +} // lambda +} // boost + + +#endif //BOOST_LAMBDA_CORE_HPP diff --git a/3rdParty/Boost/src/boost/lambda/detail/actions.hpp b/3rdParty/Boost/src/boost/lambda/detail/actions.hpp new file mode 100644 index 0000000..668799f --- /dev/null +++ b/3rdParty/Boost/src/boost/lambda/detail/actions.hpp @@ -0,0 +1,174 @@ +// -- Boost Lambda Library - actions.hpp ---------------------------------- + +// Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi) +// +// 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) + +// For more information, see www.boost.org + +// ---------------------------------------------------------------- + +#ifndef BOOST_LAMBDA_ACTIONS_HPP +#define BOOST_LAMBDA_ACTIONS_HPP + +namespace boost { +namespace lambda { + + + +template<int Arity, class Act> class action; + +// these need to be defined here, since the corresponding lambda +// functions are members of lambda_functor classes + +class assignment_action {}; +class subscript_action {}; + +template <class Action> class other_action; + +// action for specifying the explicit return type +template <class RET> class explicit_return_type_action {}; + +// action for preventing the expansion of a lambda expression +struct protect_action {}; + + // must be defined here, comma is a special case +struct comma_action {}; + + + // actions, for which the existence of protect is checked in return type + // deduction. + +template <class Action> struct is_protectable { + BOOST_STATIC_CONSTANT(bool, value = false); +}; + +// NOTE: comma action is protectable. Other protectable actions +// are listed in operator_actions.hpp + +template<> struct is_protectable<other_action<comma_action> > { + BOOST_STATIC_CONSTANT(bool, value = true); +}; + + +namespace detail { + + // this type is used in return type deductions to signal that deduction + // did not find a result. It does not necessarily mean an error, it commonly + // means that something else should be tried. + class unspecified {}; +} + + // function action is a special case: bind functions can be called with + // the return type specialized explicitly e.g. bind<int>(foo); + // If this call syntax is used, the return type is stored in the latter + // argument of function_action template. Otherwise the argument gets the type + // 'unspecified'. + // This argument is only relevant in the return type deduction code +template <int I, class Result_type = detail::unspecified> +class function_action {}; + +template<class T> class function_action<1, T> { +public: + template<class RET, class A1> + static RET apply(A1& a1) { + return function_adaptor<typename boost::remove_cv<A1>::type>:: + template apply<RET>(a1); + } +}; + +template<class T> class function_action<2, T> { +public: + template<class RET, class A1, class A2> + static RET apply(A1& a1, A2& a2) { + return function_adaptor<typename boost::remove_cv<A1>::type>:: + template apply<RET>(a1, a2); + } +}; + +template<class T> class function_action<3, T> { +public: + template<class RET, class A1, class A2, class A3> + static RET apply(A1& a1, A2& a2, A3& a3) { + return function_adaptor<typename boost::remove_cv<A1>::type>:: + template apply<RET>(a1, a2, a3); + } +}; + +template<class T> class function_action<4, T> { +public: + template<class RET, class A1, class A2, class A3, class A4> + static RET apply(A1& a1, A2& a2, A3& a3, A4& a4) { + return function_adaptor<typename boost::remove_cv<A1>::type>:: + template apply<RET>(a1, a2, a3, a4); + } +}; + +template<class T> class function_action<5, T> { +public: + template<class RET, class A1, class A2, class A3, class A4, class A5> + static RET apply(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5) { + return function_adaptor<typename boost::remove_cv<A1>::type>:: + template apply<RET>(a1, a2, a3, a4, a5); + } +}; + +template<class T> class function_action<6, T> { +public: + template<class RET, class A1, class A2, class A3, class A4, class A5, + class A6> + static RET apply(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6) { + return function_adaptor<typename boost::remove_cv<A1>::type>:: + template apply<RET>(a1, a2, a3, a4, a5, a6); + } +}; + +template<class T> class function_action<7, T> { +public: + template<class RET, class A1, class A2, class A3, class A4, class A5, + class A6, class A7> + static RET apply(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7) { + return function_adaptor<typename boost::remove_cv<A1>::type>:: + template apply<RET>(a1, a2, a3, a4, a5, a6, a7); + } +}; + +template<class T> class function_action<8, T> { +public: + template<class RET, class A1, class A2, class A3, class A4, class A5, + class A6, class A7, class A8> + static RET apply(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7, + A8& a8) { + return function_adaptor<typename boost::remove_cv<A1>::type>:: + template apply<RET>(a1, a2, a3, a4, a5, a6, a7, a8); + } +}; + +template<class T> class function_action<9, T> { +public: + template<class RET, class A1, class A2, class A3, class A4, class A5, + class A6, class A7, class A8, class A9> + static RET apply(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7, + A8& a8, A9& a9) { + return function_adaptor<typename boost::remove_cv<A1>::type>:: + template apply<RET>(a1, a2, a3, a4, a5, a6, a7, a8, a9); + } +}; + +template<class T> class function_action<10, T> { +public: + template<class RET, class A1, class A2, class A3, class A4, class A5, + class A6, class A7, class A8, class A9, class A10> + static RET apply(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7, + A8& a8, A9& a9, A10& a10) { + return function_adaptor<typename boost::remove_cv<A1>::type>:: + template apply<RET>(a1, a2, a3, a4, a5, a6, a7, a8, a9, a10); + } +}; + +} // namespace lambda +} // namespace boost + +#endif diff --git a/3rdParty/Boost/src/boost/lambda/detail/arity_code.hpp b/3rdParty/Boost/src/boost/lambda/detail/arity_code.hpp new file mode 100644 index 0000000..bed34b9 --- /dev/null +++ b/3rdParty/Boost/src/boost/lambda/detail/arity_code.hpp @@ -0,0 +1,110 @@ +// -- Boost Lambda Library ------------------------------------------------- + +// Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi) +// +// 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) +// +// For more information, see www.boost.org + +// -------------------------------------------------- + +#ifndef BOOST_LAMBDA_ARITY_CODE_HPP +#define BOOST_LAMBDA_ARITY_CODE_HPP + +#include "boost/type_traits/cv_traits.hpp" +#include "boost/type_traits/transform_traits.hpp" + +namespace boost { +namespace lambda { + +// These constants state, whether a lambda_functor instantiation results from +// an expression which contains no placeholders (NONE), +// only free1 placeholders (FIRST), +// free2 placeholders and maybe free1 placeholders (SECOND), +// free3 and maybe free1 and free2 placeholders (THIRD), +// freeE placeholders and maybe free1 and free2 (EXCEPTION). +// RETHROW means, that a rethrow expression is used somewhere in the lambda_functor. + +enum { NONE = 0x00, // Notice we are using bits as flags here. + FIRST = 0x01, + SECOND = 0x02, + THIRD = 0x04, + EXCEPTION = 0x08, + RETHROW = 0x10}; + + +template<class T> +struct get_tuple_arity; + +namespace detail { + +template <class T> struct get_arity_; + +} // end detail; + +template <class T> struct get_arity { + + BOOST_STATIC_CONSTANT(int, value = detail::get_arity_<typename boost::remove_cv<typename boost::remove_reference<T>::type>::type>::value); + +}; + +namespace detail { + +template<class T> +struct get_arity_ { + BOOST_STATIC_CONSTANT(int, value = 0); +}; + +template<class T> +struct get_arity_<lambda_functor<T> > { + BOOST_STATIC_CONSTANT(int, value = get_arity<T>::value); +}; + +template<class Action, class Args> +struct get_arity_<lambda_functor_base<Action, Args> > { + BOOST_STATIC_CONSTANT(int, value = get_tuple_arity<Args>::value); +}; + +template<int I> +struct get_arity_<placeholder<I> > { + BOOST_STATIC_CONSTANT(int, value = I); +}; + +} // detail + +template<class T> +struct get_tuple_arity { + BOOST_STATIC_CONSTANT(int, value = get_arity<typename T::head_type>::value | get_tuple_arity<typename T::tail_type>::value); +}; + + +template<> +struct get_tuple_arity<null_type> { + BOOST_STATIC_CONSTANT(int, value = 0); +}; + + + // Does T have placeholder<I> as it's subexpression? + +template<class T, int I> +struct has_placeholder { + BOOST_STATIC_CONSTANT(bool, value = (get_arity<T>::value & I) != 0); +}; + +template<int I, int J> +struct includes_placeholder { + BOOST_STATIC_CONSTANT(bool, value = (J & I) != 0); +}; + +template<int I, int J> +struct lacks_placeholder { + BOOST_STATIC_CONSTANT(bool, value = ((J & I) == 0)); +}; + + +} // namespace lambda +} // namespace boost + +#endif diff --git a/3rdParty/Boost/src/boost/lambda/detail/bind_functions.hpp b/3rdParty/Boost/src/boost/lambda/detail/bind_functions.hpp new file mode 100644 index 0000000..f85513c --- /dev/null +++ b/3rdParty/Boost/src/boost/lambda/detail/bind_functions.hpp @@ -0,0 +1,1879 @@ +// -- bind_functions.hpp -- Boost Lambda Library +// +// Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi) +// +// 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) +// +// For more information, see http://www.boost.org + +// ---------------------------------------------------------------- + +#ifndef BOOST_LAMBDA_BIND_FUNCTIONS_HPP +#define BOOST_LAMBDA_BIND_FUNCTIONS_HPP + + +namespace boost { +namespace lambda { + +#ifdef BOOST_LAMBDA_INCORRECT_BIND_OVERLOADING + + // gcc 2.96 instantiates bind functions it does not even call. + // These instantiations lead to incorrect types in the return type, + // and a compilation error results. + // This tweaking is to prevent the formation of the erroneous type. +namespace detail { + +template<class T> struct constify_non_funcs { + typedef typename + detail::IF_type<boost::is_function<T>::value, + boost::add_reference<T>, + boost::add_const<T> + >::type type; +}; + +} +#endif +// 1-argument bind functions -------------------------- +#ifndef BOOST_REF_TO_FUNC_CONFLICTS_WITH_REF_TO_T +template <class Result> +inline const +lambda_functor< + lambda_functor_base< + action<1, function_action<1, Result> >, + typename detail::bind_tuple_mapper<Result(&)()>::type + > +> + +bind(Result(& a1)()) { + return + lambda_functor_base< + action<1, function_action<1, Result> >, + typename detail::bind_tuple_mapper<Result(&)()>::type + > + ( typename detail::bind_tuple_mapper<Result(&)()>::type + (a1) + ); +} +#endif + + #ifndef BOOST_LAMBDA_INCORRECT_BIND_OVERLOADING +template <class Arg1> +inline const +lambda_functor< + lambda_functor_base< + action<1, function_action<1> >, + typename detail::bind_tuple_mapper<const Arg1>::type + > +> + +bind(const Arg1& a1) { + return + lambda_functor_base< + action<1, function_action<1> >, + typename detail::bind_tuple_mapper<const Arg1>::type + > + ( typename detail::bind_tuple_mapper<const Arg1>::type + (a1) + ); +} + +template <class Result, class Arg1> +inline const +lambda_functor< + lambda_functor_base< + action<1, function_action<1, Result> >, + typename detail::bind_tuple_mapper<const Arg1>::type + > +> + +bind(const Arg1& a1) { + return + lambda_functor_base< + action<1, function_action<1, Result> >, + typename detail::bind_tuple_mapper<const Arg1>::type + > + ( typename detail::bind_tuple_mapper<const Arg1>::type + (a1) + ); +} + + + #else +template <class Arg1> +inline const +lambda_functor< + lambda_functor_base< + action<1, function_action<1> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type + >::type + > +> + +bind(const Arg1& a1) { + return + lambda_functor_base< + action<1, function_action<1> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type + >::type + > + ( typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type + >::type + (a1) + ); +} + +template <class Result, class Arg1> +inline const +lambda_functor< + lambda_functor_base< + action<1, function_action<1, Result> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type + >::type + > +> + +bind(const Arg1& a1) { + return + lambda_functor_base< + action<1, function_action<1, Result> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type + >::type + > + ( typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type + >::type + (a1) + ); +} + +template <class Result> +inline const +lambda_functor< + lambda_functor_base< + action<1, function_action<1, Result> >, + typename detail::bind_tuple_mapper<Result(*)()>::type + > +> + +bind(Result(* const & a1)()) { + return + lambda_functor_base< + action<1, function_action<1, Result> >, + typename detail::bind_tuple_mapper<Result(*)()>::type + > + ( typename detail::bind_tuple_mapper<Result(*)()>::type + (a1) + ); +} + + +#endif + +// 2-argument bind functions -------------------------- +#ifndef BOOST_REF_TO_FUNC_CONFLICTS_WITH_REF_TO_T +template <class Result, class Par1, class Arg2> +inline const +lambda_functor< + lambda_functor_base< + action<2, function_action<2, Result> >, + typename detail::bind_tuple_mapper<Result(&)(Par1), const Arg2>::type + > +> + +bind(Result(&a1)(Par1), const Arg2& a2) { + return + lambda_functor_base< + action<2, function_action<2, Result> >, + typename detail::bind_tuple_mapper<Result(&)(Par1), const Arg2>::type + > + ( typename detail::bind_tuple_mapper<Result(&)(Par1), const Arg2>::type + (a1, a2) + ); +} +#endif + +#ifndef BOOST_LAMBDA_INCORRECT_BIND_OVERLOADING +template <class Arg1, class Arg2> +inline const +lambda_functor< + lambda_functor_base< + action<2, function_action<2> >, + typename detail::bind_tuple_mapper<const Arg1, const Arg2>::type + > +> + +bind(const Arg1& a1, const Arg2& a2) { + return + lambda_functor_base< + action<2, function_action<2> >, + typename detail::bind_tuple_mapper<const Arg1, const Arg2>::type + > + ( typename detail::bind_tuple_mapper<const Arg1, const Arg2>::type + (a1, a2) + ); +} + +template <class Result, class Arg1, class Arg2> +inline const +lambda_functor< + lambda_functor_base< + action<2, function_action<2, Result> >, + typename detail::bind_tuple_mapper<const Arg1, const Arg2>::type + > +> + +bind(const Arg1& a1, const Arg2& a2) { + return + lambda_functor_base< + action<2, function_action<2, Result> >, + typename detail::bind_tuple_mapper<const Arg1, const Arg2>::type + > + ( typename detail::bind_tuple_mapper<const Arg1, const Arg2>::type + (a1, a2) + ); +} + + + #else +template <class Arg1, class Arg2> +inline const +lambda_functor< + lambda_functor_base< + action<2, function_action<2> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2) { + return + lambda_functor_base< + action<2, function_action<2> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2 + >::type + > + ( typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2 + >::type + (a1, a2) + ); +} + +template <class Result, class Arg1, class Arg2> +inline const +lambda_functor< + lambda_functor_base< + action<2, function_action<2, Result> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2) { + return + lambda_functor_base< + action<2, function_action<2, Result> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2 + >::type + > + ( typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2 + >::type + (a1, a2) + ); +} + +template <class Result, class Par1, class Arg2> +inline const +lambda_functor< + lambda_functor_base< + action<2, function_action<2, Result> >, + typename detail::bind_tuple_mapper<Result(*)(Par1), const Arg2>::type + > +> + +bind(Result(* const & a1)(Par1), const Arg2& a2) { + return + lambda_functor_base< + action<2, function_action<2, Result> >, + typename detail::bind_tuple_mapper<Result(*)(Par1), const Arg2>::type + > + ( typename detail::bind_tuple_mapper<Result(*)(Par1), const Arg2>::type + (a1, a2) + ); +} + + + #endif + +// 3-argument bind functions -------------------------- +#ifndef BOOST_REF_TO_FUNC_CONFLICTS_WITH_REF_TO_T +template <class Result, class Par1, class Par2, class Arg2, class Arg3> +inline const +lambda_functor< + lambda_functor_base< + action<3, function_action<3, Result> >, + typename detail::bind_tuple_mapper< + Result(&)(Par1, Par2), const Arg2, const Arg3 + >::type + > +> + +bind(Result(&a1)(Par1, Par2), const Arg2& a2, const Arg3& a3) { + return + lambda_functor_base< + action<3, function_action<3, Result> >, + typename detail::bind_tuple_mapper< + Result(&)(Par1, Par2), const Arg2, const Arg3 + >::type + > + ( typename detail::bind_tuple_mapper< + Result(&)(Par1, Par2), const Arg2, const Arg3 + >::type + (a1, a2, a3) + ); +} +#endif + + #ifndef BOOST_LAMBDA_INCORRECT_BIND_OVERLOADING +template <class Arg1, class Arg2, class Arg3> +inline const +lambda_functor< + lambda_functor_base< + action<3, function_action<3> >, + typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2, const Arg3& a3) { + return + lambda_functor_base< + action<3, function_action<3> >, + typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3 + >::type + > + ( typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3 + >::type + (a1, a2, a3) + ); +} + +template <class Result, class Arg1, class Arg2, class Arg3> +inline const +lambda_functor< + lambda_functor_base< + action<3, function_action<3, Result> >, + typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2, const Arg3& a3) { + return + lambda_functor_base< + action<3, function_action<3, Result> >, + typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3 + >::type + > + ( typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3 + >::type + (a1, a2, a3) + ); +} + + + #else +template <class Arg1, class Arg2, class Arg3> +inline const +lambda_functor< + lambda_functor_base< + action<3, function_action<3> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, const Arg3 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2, const Arg3& a3) { + return + lambda_functor_base< + action<3, function_action<3> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, + const Arg3 + >::type + > + ( typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, + const Arg3 + >::type + (a1, a2, a3) + ); +} + +template <class Result, class Arg1, class Arg2, class Arg3> +inline const +lambda_functor< + lambda_functor_base< + action<3, function_action<3, Result> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, const Arg3 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2, const Arg3& a3) { + return + lambda_functor_base< + action<3, function_action<3, Result> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, + const Arg3 + >::type + > + ( typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, + const Arg3 + >::type + (a1, a2, a3) + ); +} + +template <class Result, class Par1, class Par2, class Arg2, class Arg3> +inline const +lambda_functor< + lambda_functor_base< + action<3, function_action<3, Result> >, + typename detail::bind_tuple_mapper< + Result(*)(Par1, Par2), const Arg2, const Arg3 + >::type + > +> + +bind(Result(* const & a1)(Par1, Par2), const Arg2& a2, const Arg3& a3) { + return + lambda_functor_base< + action<3, function_action<3, Result> >, + typename detail::bind_tuple_mapper< + Result(*)(Par1, Par2), const Arg2, const Arg3 + >::type + > + ( typename detail::bind_tuple_mapper< + Result(*)(Par1, Par2), const Arg2, const Arg3 + >::type + (a1, a2, a3) + ); +} + + + #endif + +// 4-argument bind functions -------------------------- +#ifndef BOOST_REF_TO_FUNC_CONFLICTS_WITH_REF_TO_T +template <class Result, class Par1, class Par2, class Par3, class Arg2, + class Arg3, class Arg4> +inline const +lambda_functor< + lambda_functor_base< + action<4, function_action<4, Result> >, + typename detail::bind_tuple_mapper< + Result(&)(Par1, Par2, Par3), const Arg2, const Arg3, const Arg4 + >::type + > +> + +bind(Result(&a1)(Par1, Par2, Par3), const Arg2& a2, const Arg3& a3, + const Arg4& a4) { + return + lambda_functor_base< + action<4, function_action<4, Result> >, + typename detail::bind_tuple_mapper< + Result(&)(Par1, Par2, Par3), const Arg2, const Arg3, const Arg4 + >::type + > + ( typename detail::bind_tuple_mapper< + Result(&)(Par1, Par2, Par3), const Arg2, const Arg3, const Arg4 + >::type + (a1, a2, a3, a4) + ); +} +#endif + + #ifndef BOOST_LAMBDA_INCORRECT_BIND_OVERLOADING +template <class Arg1, class Arg2, class Arg3, class Arg4> +inline const +lambda_functor< + lambda_functor_base< + action<4, function_action<4> >, + typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2, const Arg3& a3, const Arg4& a4) { + return + lambda_functor_base< + action<4, function_action<4> >, + typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4 + >::type + > + ( typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4 + >::type + (a1, a2, a3, a4) + ); +} + +template <class Result, class Arg1, class Arg2, class Arg3, class Arg4> +inline const +lambda_functor< + lambda_functor_base< + action<4, function_action<4, Result> >, + typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2, const Arg3& a3, const Arg4& a4) { + return + lambda_functor_base< + action<4, function_action<4, Result> >, + typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4 + >::type + > + ( typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4 + >::type + (a1, a2, a3, a4) + ); +} + + + #else +template <class Arg1, class Arg2, class Arg3, class Arg4> +inline const +lambda_functor< + lambda_functor_base< + action<4, function_action<4> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, const Arg3, + const Arg4 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2, const Arg3& a3, const Arg4& a4) { + return + lambda_functor_base< + action<4, function_action<4> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, + const Arg3, const Arg4 + >::type + > + ( typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, + const Arg3, const Arg4 + >::type + (a1, a2, a3, a4) + ); +} + +template <class Result, class Arg1, class Arg2, class Arg3, class Arg4> +inline const +lambda_functor< + lambda_functor_base< + action<4, function_action<4, Result> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, const Arg3, + const Arg4 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2, const Arg3& a3, const Arg4& a4) { + return + lambda_functor_base< + action<4, function_action<4, Result> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, + const Arg3, const Arg4 + >::type + > + ( typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, + const Arg3, const Arg4 + >::type + (a1, a2, a3, a4) + ); +} + +template <class Result, class Par1, class Par2, class Par3, class Arg2, + class Arg3, class Arg4> +inline const +lambda_functor< + lambda_functor_base< + action<4, function_action<4, Result> >, + typename detail::bind_tuple_mapper< + Result(*)(Par1, Par2, Par3), const Arg2, const Arg3, const Arg4 + >::type + > +> + +bind(Result(* const & a1)(Par1, Par2, Par3), const Arg2& a2, + const Arg3& a3, const Arg4& a4) { + return + lambda_functor_base< + action<4, function_action<4, Result> >, + typename detail::bind_tuple_mapper< + Result(*)(Par1, Par2, Par3), const Arg2, const Arg3, const Arg4 + >::type + > + ( typename detail::bind_tuple_mapper< + Result(*)(Par1, Par2, Par3), const Arg2, const Arg3, const Arg4 + >::type + (a1, a2, a3, a4) + ); +} + + + #endif + +// 5-argument bind functions -------------------------- +#ifndef BOOST_REF_TO_FUNC_CONFLICTS_WITH_REF_TO_T +template <class Result, class Par1, class Par2, class Par3, class Par4, + class Arg2, class Arg3, class Arg4, class Arg5> +inline const +lambda_functor< + lambda_functor_base< + action<5, function_action<5, Result> >, + typename detail::bind_tuple_mapper< + Result(&)(Par1, Par2, Par3, Par4), const Arg2, const Arg3, const Arg4, + const Arg5 + >::type + > +> + +bind(Result(&a1)(Par1, Par2, Par3, Par4), const Arg2& a2, const Arg3& a3, + const Arg4& a4, const Arg5& a5) { + return + lambda_functor_base< + action<5, function_action<5, Result> >, + typename detail::bind_tuple_mapper< + Result(&)(Par1, Par2, Par3, Par4), const Arg2, const Arg3, const Arg4, + const Arg5 + >::type + > + ( typename detail::bind_tuple_mapper< + Result(&)(Par1, Par2, Par3, Par4), const Arg2, const Arg3, const Arg4, + const Arg5 + >::type + (a1, a2, a3, a4, a5) + ); +} +#endif + + #ifndef BOOST_LAMBDA_INCORRECT_BIND_OVERLOADING +template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5> +inline const +lambda_functor< + lambda_functor_base< + action<5, function_action<5> >, + typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2, const Arg3& a3, const Arg4& a4, + const Arg5& a5) { + return + lambda_functor_base< + action<5, function_action<5> >, + typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5 + >::type + > + ( typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5 + >::type + (a1, a2, a3, a4, a5) + ); +} + +template <class Result, class Arg1, class Arg2, class Arg3, class Arg4, + class Arg5> +inline const +lambda_functor< + lambda_functor_base< + action<5, function_action<5, Result> >, + typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2, const Arg3& a3, const Arg4& a4, + const Arg5& a5) { + return + lambda_functor_base< + action<5, function_action<5, Result> >, + typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5 + >::type + > + ( typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5 + >::type + (a1, a2, a3, a4, a5) + ); +} + + + #else +template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5> +inline const +lambda_functor< + lambda_functor_base< + action<5, function_action<5> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, const Arg3, + const Arg4, const Arg5 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2, const Arg3& a3, const Arg4& a4, + const Arg5& a5) { + return + lambda_functor_base< + action<5, function_action<5> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, + const Arg3, const Arg4, const Arg5 + >::type + > + ( typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, + const Arg3, const Arg4, const Arg5 + >::type + (a1, a2, a3, a4, a5) + ); +} + +template <class Result, class Arg1, class Arg2, class Arg3, class Arg4, + class Arg5> +inline const +lambda_functor< + lambda_functor_base< + action<5, function_action<5, Result> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, const Arg3, + const Arg4, const Arg5 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2, const Arg3& a3, const Arg4& a4, + const Arg5& a5) { + return + lambda_functor_base< + action<5, function_action<5, Result> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, + const Arg3, const Arg4, const Arg5 + >::type + > + ( typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, + const Arg3, const Arg4, const Arg5 + >::type + (a1, a2, a3, a4, a5) + ); +} + +template <class Result, class Par1, class Par2, class Par3, class Par4, + class Arg2, class Arg3, class Arg4, class Arg5> +inline const +lambda_functor< + lambda_functor_base< + action<5, function_action<5, Result> >, + typename detail::bind_tuple_mapper< + Result(*)(Par1, Par2, Par3, Par4), const Arg2, const Arg3, const Arg4, + const Arg5 + >::type + > +> + +bind(Result(* const & a1)(Par1, Par2, Par3, Par4), const Arg2& a2, + const Arg3& a3, const Arg4& a4, const Arg5& a5) { + return + lambda_functor_base< + action<5, function_action<5, Result> >, + typename detail::bind_tuple_mapper< + Result(*)(Par1, Par2, Par3, Par4), const Arg2, const Arg3, const Arg4, + const Arg5 + >::type + > + ( typename detail::bind_tuple_mapper< + Result(*)(Par1, Par2, Par3, Par4), const Arg2, const Arg3, const Arg4, + const Arg5 + >::type + (a1, a2, a3, a4, a5) + ); +} + + + #endif + +// 6-argument bind functions -------------------------- +#ifndef BOOST_REF_TO_FUNC_CONFLICTS_WITH_REF_TO_T +template <class Result, class Par1, class Par2, class Par3, class Par4, + class Par5, class Arg2, class Arg3, class Arg4, class Arg5, + class Arg6> +inline const +lambda_functor< + lambda_functor_base< + action<6, function_action<6, Result> >, + typename detail::bind_tuple_mapper< + Result(&)(Par1, Par2, Par3, Par4, Par5), const Arg2, const Arg3, + const Arg4, const Arg5, const Arg6 + >::type + > +> + +bind(Result(&a1)(Par1, Par2, Par3, Par4, Par5), const Arg2& a2, + const Arg3& a3, const Arg4& a4, const Arg5& a5, const Arg6& a6) { + return + lambda_functor_base< + action<6, function_action<6, Result> >, + typename detail::bind_tuple_mapper< + Result(&)(Par1, Par2, Par3, Par4, Par5), const Arg2, const Arg3, + const Arg4, const Arg5, const Arg6 + >::type + > + ( typename detail::bind_tuple_mapper< + Result(&)(Par1, Par2, Par3, Par4, Par5), const Arg2, const Arg3, + const Arg4, const Arg5, const Arg6 + >::type + (a1, a2, a3, a4, a5, a6) + ); +} +#endif + + #ifndef BOOST_LAMBDA_INCORRECT_BIND_OVERLOADING +template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, + class Arg6> +inline const +lambda_functor< + lambda_functor_base< + action<6, function_action<6> >, + typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5, const Arg6 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2, const Arg3& a3, const Arg4& a4, + const Arg5& a5, const Arg6& a6) { + return + lambda_functor_base< + action<6, function_action<6> >, + typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5, const Arg6 + >::type + > + ( typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5, const Arg6 + >::type + (a1, a2, a3, a4, a5, a6) + ); +} + +template <class Result, class Arg1, class Arg2, class Arg3, class Arg4, + class Arg5, class Arg6> +inline const +lambda_functor< + lambda_functor_base< + action<6, function_action<6, Result> >, + typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5, const Arg6 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2, const Arg3& a3, const Arg4& a4, + const Arg5& a5, const Arg6& a6) { + return + lambda_functor_base< + action<6, function_action<6, Result> >, + typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5, const Arg6 + >::type + > + ( typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5, const Arg6 + >::type + (a1, a2, a3, a4, a5, a6) + ); +} + + + #else +template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, + class Arg6> +inline const +lambda_functor< + lambda_functor_base< + action<6, function_action<6> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, const Arg3, + const Arg4, const Arg5, const Arg6 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2, const Arg3& a3, const Arg4& a4, + const Arg5& a5, const Arg6& a6) { + return + lambda_functor_base< + action<6, function_action<6> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, + const Arg3, const Arg4, const Arg5, const Arg6 + >::type + > + ( typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, + const Arg3, const Arg4, const Arg5, const Arg6 + >::type + (a1, a2, a3, a4, a5, a6) + ); +} + +template <class Result, class Arg1, class Arg2, class Arg3, class Arg4, + class Arg5, class Arg6> +inline const +lambda_functor< + lambda_functor_base< + action<6, function_action<6, Result> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, const Arg3, + const Arg4, const Arg5, const Arg6 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2, const Arg3& a3, const Arg4& a4, + const Arg5& a5, const Arg6& a6) { + return + lambda_functor_base< + action<6, function_action<6, Result> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, + const Arg3, const Arg4, const Arg5, const Arg6 + >::type + > + ( typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, + const Arg3, const Arg4, const Arg5, const Arg6 + >::type + (a1, a2, a3, a4, a5, a6) + ); +} + +template <class Result, class Par1, class Par2, class Par3, class Par4, + class Par5, class Arg2, class Arg3, class Arg4, class Arg5, + class Arg6> +inline const +lambda_functor< + lambda_functor_base< + action<6, function_action<6, Result> >, + typename detail::bind_tuple_mapper< + Result(*)(Par1, Par2, Par3, Par4, Par5), const Arg2, const Arg3, + const Arg4, const Arg5, const Arg6 + >::type + > +> + +bind(Result(* const & a1)(Par1, Par2, Par3, Par4, Par5), const Arg2& a2, + const Arg3& a3, const Arg4& a4, const Arg5& a5, const Arg6& a6) { + return + lambda_functor_base< + action<6, function_action<6, Result> >, + typename detail::bind_tuple_mapper< + Result(*)(Par1, Par2, Par3, Par4, Par5), const Arg2, const Arg3, + const Arg4, const Arg5, const Arg6 + >::type + > + ( typename detail::bind_tuple_mapper< + Result(*)(Par1, Par2, Par3, Par4, Par5), const Arg2, const Arg3, + const Arg4, const Arg5, const Arg6 + >::type + (a1, a2, a3, a4, a5, a6) + ); +} + + + #endif + +// 7-argument bind functions -------------------------- +#ifndef BOOST_REF_TO_FUNC_CONFLICTS_WITH_REF_TO_T +template <class Result, class Par1, class Par2, class Par3, class Par4, + class Par5, class Par6, class Arg2, class Arg3, class Arg4, + class Arg5, class Arg6, class Arg7> +inline const +lambda_functor< + lambda_functor_base< + action<7, function_action<7, Result> >, + typename detail::bind_tuple_mapper< + Result(&)(Par1, Par2, Par3, Par4, Par5, Par6), const Arg2, const Arg3, + const Arg4, const Arg5, const Arg6, const Arg7 + >::type + > +> + +bind(Result(&a1)(Par1, Par2, Par3, Par4, Par5, Par6), const Arg2& a2, + const Arg3& a3, const Arg4& a4, const Arg5& a5, const Arg6& a6, + const Arg7& a7) { + return + lambda_functor_base< + action<7, function_action<7, Result> >, + typename detail::bind_tuple_mapper< + Result(&)(Par1, Par2, Par3, Par4, Par5, Par6), const Arg2, const Arg3, + const Arg4, const Arg5, const Arg6, const Arg7 + >::type + > + ( typename detail::bind_tuple_mapper< + Result(&)(Par1, Par2, Par3, Par4, Par5, Par6), const Arg2, const Arg3, + const Arg4, const Arg5, const Arg6, const Arg7 + >::type + (a1, a2, a3, a4, a5, a6, a7) + ); +} +#endif + + #ifndef BOOST_LAMBDA_INCORRECT_BIND_OVERLOADING +template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, + class Arg6, class Arg7> +inline const +lambda_functor< + lambda_functor_base< + action<7, function_action<7> >, + typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5, const Arg6, + const Arg7 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2, const Arg3& a3, const Arg4& a4, + const Arg5& a5, const Arg6& a6, const Arg7& a7) { + return + lambda_functor_base< + action<7, function_action<7> >, + typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5, + const Arg6, const Arg7 + >::type + > + ( typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5, + const Arg6, const Arg7 + >::type + (a1, a2, a3, a4, a5, a6, a7) + ); +} + +template <class Result, class Arg1, class Arg2, class Arg3, class Arg4, + class Arg5, class Arg6, class Arg7> +inline const +lambda_functor< + lambda_functor_base< + action<7, function_action<7, Result> >, + typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5, const Arg6, + const Arg7 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2, const Arg3& a3, const Arg4& a4, + const Arg5& a5, const Arg6& a6, const Arg7& a7) { + return + lambda_functor_base< + action<7, function_action<7, Result> >, + typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5, + const Arg6, const Arg7 + >::type + > + ( typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5, + const Arg6, const Arg7 + >::type + (a1, a2, a3, a4, a5, a6, a7) + ); +} + + + #else +template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, + class Arg6, class Arg7> +inline const +lambda_functor< + lambda_functor_base< + action<7, function_action<7> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, const Arg3, + const Arg4, const Arg5, const Arg6, const Arg7 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2, const Arg3& a3, const Arg4& a4, + const Arg5& a5, const Arg6& a6, const Arg7& a7) { + return + lambda_functor_base< + action<7, function_action<7> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, + const Arg3, const Arg4, const Arg5, const Arg6, const Arg7 + >::type + > + ( typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, + const Arg3, const Arg4, const Arg5, const Arg6, const Arg7 + >::type + (a1, a2, a3, a4, a5, a6, a7) + ); +} + +template <class Result, class Arg1, class Arg2, class Arg3, class Arg4, + class Arg5, class Arg6, class Arg7> +inline const +lambda_functor< + lambda_functor_base< + action<7, function_action<7, Result> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, const Arg3, + const Arg4, const Arg5, const Arg6, const Arg7 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2, const Arg3& a3, const Arg4& a4, + const Arg5& a5, const Arg6& a6, const Arg7& a7) { + return + lambda_functor_base< + action<7, function_action<7, Result> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, + const Arg3, const Arg4, const Arg5, const Arg6, const Arg7 + >::type + > + ( typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, + const Arg3, const Arg4, const Arg5, const Arg6, const Arg7 + >::type + (a1, a2, a3, a4, a5, a6, a7) + ); +} + +template <class Result, class Par1, class Par2, class Par3, class Par4, + class Par5, class Par6, class Arg2, class Arg3, class Arg4, + class Arg5, class Arg6, class Arg7> +inline const +lambda_functor< + lambda_functor_base< + action<7, function_action<7, Result> >, + typename detail::bind_tuple_mapper< + Result(*)(Par1, Par2, Par3, Par4, Par5, Par6), const Arg2, const Arg3, + const Arg4, const Arg5, const Arg6, const Arg7 + >::type + > +> + +bind(Result(* const & a1)(Par1, Par2, Par3, Par4, Par5, Par6), + const Arg2& a2, const Arg3& a3, const Arg4& a4, const Arg5& a5, + const Arg6& a6, const Arg7& a7) { + return + lambda_functor_base< + action<7, function_action<7, Result> >, + typename detail::bind_tuple_mapper< + Result(*)(Par1, Par2, Par3, Par4, Par5, Par6), const Arg2, const Arg3, + const Arg4, const Arg5, const Arg6, const Arg7 + >::type + > + ( typename detail::bind_tuple_mapper< + Result(*)(Par1, Par2, Par3, Par4, Par5, Par6), const Arg2, const Arg3, + const Arg4, const Arg5, const Arg6, const Arg7 + >::type + (a1, a2, a3, a4, a5, a6, a7) + ); +} + + + #endif + +// 8-argument bind functions -------------------------- +#ifndef BOOST_REF_TO_FUNC_CONFLICTS_WITH_REF_TO_T +template <class Result, class Par1, class Par2, class Par3, class Par4, + class Par5, class Par6, class Par7, class Arg2, class Arg3, + class Arg4, class Arg5, class Arg6, class Arg7, class Arg8> +inline const +lambda_functor< + lambda_functor_base< + action<8, function_action<8, Result> >, + typename detail::bind_tuple_mapper< + Result(&)(Par1, Par2, Par3, Par4, Par5, Par6, Par7), const Arg2, + const Arg3, const Arg4, const Arg5, const Arg6, const Arg7, const Arg8 + >::type + > +> + +bind(Result(&a1)(Par1, Par2, Par3, Par4, Par5, Par6, Par7), const Arg2& a2, + const Arg3& a3, const Arg4& a4, const Arg5& a5, const Arg6& a6, + const Arg7& a7, const Arg8& a8) { + return + lambda_functor_base< + action<8, function_action<8, Result> >, + typename detail::bind_tuple_mapper< + Result(&)(Par1, Par2, Par3, Par4, Par5, Par6, Par7), const Arg2, + const Arg3, const Arg4, const Arg5, const Arg6, const Arg7, const Arg8 + >::type + > + ( typename detail::bind_tuple_mapper< + Result(&)(Par1, Par2, Par3, Par4, Par5, Par6, Par7), const Arg2, + const Arg3, const Arg4, const Arg5, const Arg6, const Arg7, const Arg8 + >::type + (a1, a2, a3, a4, a5, a6, a7, a8) + ); +} +#endif + + #ifndef BOOST_LAMBDA_INCORRECT_BIND_OVERLOADING +template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, + class Arg6, class Arg7, class Arg8> +inline const +lambda_functor< + lambda_functor_base< + action<8, function_action<8> >, + typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5, const Arg6, + const Arg7, const Arg8 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2, const Arg3& a3, const Arg4& a4, + const Arg5& a5, const Arg6& a6, const Arg7& a7, const Arg8& a8) { + return + lambda_functor_base< + action<8, function_action<8> >, + typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5, + const Arg6, const Arg7, const Arg8 + >::type + > + ( typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5, + const Arg6, const Arg7, const Arg8 + >::type + (a1, a2, a3, a4, a5, a6, a7, a8) + ); +} + +template <class Result, class Arg1, class Arg2, class Arg3, class Arg4, + class Arg5, class Arg6, class Arg7, class Arg8> +inline const +lambda_functor< + lambda_functor_base< + action<8, function_action<8, Result> >, + typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5, const Arg6, + const Arg7, const Arg8 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2, const Arg3& a3, const Arg4& a4, + const Arg5& a5, const Arg6& a6, const Arg7& a7, const Arg8& a8) { + return + lambda_functor_base< + action<8, function_action<8, Result> >, + typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5, + const Arg6, const Arg7, const Arg8 + >::type + > + ( typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5, + const Arg6, const Arg7, const Arg8 + >::type + (a1, a2, a3, a4, a5, a6, a7, a8) + ); +} + + + #else +template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, + class Arg6, class Arg7, class Arg8> +inline const +lambda_functor< + lambda_functor_base< + action<8, function_action<8> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, const Arg3, + const Arg4, const Arg5, const Arg6, const Arg7, const Arg8 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2, const Arg3& a3, const Arg4& a4, + const Arg5& a5, const Arg6& a6, const Arg7& a7, const Arg8& a8) { + return + lambda_functor_base< + action<8, function_action<8> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, + const Arg3, const Arg4, const Arg5, const Arg6, const Arg7, const Arg8 + >::type + > + ( typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, + const Arg3, const Arg4, const Arg5, const Arg6, const Arg7, const Arg8 + >::type + (a1, a2, a3, a4, a5, a6, a7, a8) + ); +} + +template <class Result, class Arg1, class Arg2, class Arg3, class Arg4, + class Arg5, class Arg6, class Arg7, class Arg8> +inline const +lambda_functor< + lambda_functor_base< + action<8, function_action<8, Result> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, const Arg3, + const Arg4, const Arg5, const Arg6, const Arg7, const Arg8 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2, const Arg3& a3, const Arg4& a4, + const Arg5& a5, const Arg6& a6, const Arg7& a7, const Arg8& a8) { + return + lambda_functor_base< + action<8, function_action<8, Result> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, + const Arg3, const Arg4, const Arg5, const Arg6, const Arg7, const Arg8 + >::type + > + ( typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, + const Arg3, const Arg4, const Arg5, const Arg6, const Arg7, const Arg8 + >::type + (a1, a2, a3, a4, a5, a6, a7, a8) + ); +} + +template <class Result, class Par1, class Par2, class Par3, class Par4, + class Par5, class Par6, class Par7, class Arg2, class Arg3, + class Arg4, class Arg5, class Arg6, class Arg7, class Arg8> +inline const +lambda_functor< + lambda_functor_base< + action<8, function_action<8, Result> >, + typename detail::bind_tuple_mapper< + Result(*)(Par1, Par2, Par3, Par4, Par5, Par6, Par7), const Arg2, + const Arg3, const Arg4, const Arg5, const Arg6, const Arg7, const Arg8 + >::type + > +> + +bind(Result(* const & a1)(Par1, Par2, Par3, Par4, Par5, Par6, Par7), + const Arg2& a2, const Arg3& a3, const Arg4& a4, const Arg5& a5, + const Arg6& a6, const Arg7& a7, const Arg8& a8) { + return + lambda_functor_base< + action<8, function_action<8, Result> >, + typename detail::bind_tuple_mapper< + Result(*)(Par1, Par2, Par3, Par4, Par5, Par6, Par7), const Arg2, + const Arg3, const Arg4, const Arg5, const Arg6, const Arg7, const Arg8 + >::type + > + ( typename detail::bind_tuple_mapper< + Result(*)(Par1, Par2, Par3, Par4, Par5, Par6, Par7), const Arg2, + const Arg3, const Arg4, const Arg5, const Arg6, const Arg7, const Arg8 + >::type + (a1, a2, a3, a4, a5, a6, a7, a8) + ); +} + + + #endif + +// 9-argument bind functions -------------------------- +#ifndef BOOST_REF_TO_FUNC_CONFLICTS_WITH_REF_TO_T +template <class Result, class Par1, class Par2, class Par3, class Par4, + class Par5, class Par6, class Par7, class Par8, class Arg2, + class Arg3, class Arg4, class Arg5, class Arg6, class Arg7, + class Arg8, class Arg9> +inline const +lambda_functor< + lambda_functor_base< + action<9, function_action<9, Result> >, + typename detail::bind_tuple_mapper< + Result(&)(Par1, Par2, Par3, Par4, Par5, Par6, Par7, Par8), const Arg2, + const Arg3, const Arg4, const Arg5, const Arg6, const Arg7, const Arg8, + const Arg9 + >::type + > +> + +bind(Result(&a1)(Par1, Par2, Par3, Par4, Par5, Par6, Par7, Par8), + const Arg2& a2, const Arg3& a3, const Arg4& a4, const Arg5& a5, + const Arg6& a6, const Arg7& a7, const Arg8& a8, const Arg9& a9) { + return + lambda_functor_base< + action<9, function_action<9, Result> >, + typename detail::bind_tuple_mapper< + Result(&)(Par1, Par2, Par3, Par4, Par5, Par6, Par7, Par8), const Arg2, + const Arg3, const Arg4, const Arg5, const Arg6, const Arg7, + const Arg8, const Arg9 + >::type + > + ( typename detail::bind_tuple_mapper< + Result(&)(Par1, Par2, Par3, Par4, Par5, Par6, Par7, Par8), const Arg2, + const Arg3, const Arg4, const Arg5, const Arg6, const Arg7, + const Arg8, const Arg9 + >::type + (a1, a2, a3, a4, a5, a6, a7, a8, a9) + ); +} +#endif + + #ifndef BOOST_LAMBDA_INCORRECT_BIND_OVERLOADING +template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, + class Arg6, class Arg7, class Arg8, class Arg9> +inline const +lambda_functor< + lambda_functor_base< + action<9, function_action<9> >, + typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5, const Arg6, + const Arg7, const Arg8, const Arg9 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2, const Arg3& a3, const Arg4& a4, + const Arg5& a5, const Arg6& a6, const Arg7& a7, const Arg8& a8, + const Arg9& a9) { + return + lambda_functor_base< + action<9, function_action<9> >, + typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5, + const Arg6, const Arg7, const Arg8, const Arg9 + >::type + > + ( typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5, + const Arg6, const Arg7, const Arg8, const Arg9 + >::type + (a1, a2, a3, a4, a5, a6, a7, a8, a9) + ); +} + +template <class Result, class Arg1, class Arg2, class Arg3, class Arg4, + class Arg5, class Arg6, class Arg7, class Arg8, class Arg9> +inline const +lambda_functor< + lambda_functor_base< + action<9, function_action<9, Result> >, + typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5, const Arg6, + const Arg7, const Arg8, const Arg9 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2, const Arg3& a3, const Arg4& a4, + const Arg5& a5, const Arg6& a6, const Arg7& a7, const Arg8& a8, + const Arg9& a9) { + return + lambda_functor_base< + action<9, function_action<9, Result> >, + typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5, + const Arg6, const Arg7, const Arg8, const Arg9 + >::type + > + ( typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5, + const Arg6, const Arg7, const Arg8, const Arg9 + >::type + (a1, a2, a3, a4, a5, a6, a7, a8, a9) + ); +} + + + #else +template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, + class Arg6, class Arg7, class Arg8, class Arg9> +inline const +lambda_functor< + lambda_functor_base< + action<9, function_action<9> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, const Arg3, + const Arg4, const Arg5, const Arg6, const Arg7, const Arg8, const Arg9 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2, const Arg3& a3, const Arg4& a4, + const Arg5& a5, const Arg6& a6, const Arg7& a7, const Arg8& a8, + const Arg9& a9) { + return + lambda_functor_base< + action<9, function_action<9> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, + const Arg3, const Arg4, const Arg5, const Arg6, const Arg7, + const Arg8, const Arg9 + >::type + > + ( typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, + const Arg3, const Arg4, const Arg5, const Arg6, const Arg7, + const Arg8, const Arg9 + >::type + (a1, a2, a3, a4, a5, a6, a7, a8, a9) + ); +} + +template <class Result, class Arg1, class Arg2, class Arg3, class Arg4, + class Arg5, class Arg6, class Arg7, class Arg8, class Arg9> +inline const +lambda_functor< + lambda_functor_base< + action<9, function_action<9, Result> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, const Arg3, + const Arg4, const Arg5, const Arg6, const Arg7, const Arg8, const Arg9 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2, const Arg3& a3, const Arg4& a4, + const Arg5& a5, const Arg6& a6, const Arg7& a7, const Arg8& a8, + const Arg9& a9) { + return + lambda_functor_base< + action<9, function_action<9, Result> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, + const Arg3, const Arg4, const Arg5, const Arg6, const Arg7, + const Arg8, const Arg9 + >::type + > + ( typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, + const Arg3, const Arg4, const Arg5, const Arg6, const Arg7, + const Arg8, const Arg9 + >::type + (a1, a2, a3, a4, a5, a6, a7, a8, a9) + ); +} + +template <class Result, class Par1, class Par2, class Par3, class Par4, + class Par5, class Par6, class Par7, class Par8, class Arg2, + class Arg3, class Arg4, class Arg5, class Arg6, class Arg7, + class Arg8, class Arg9> +inline const +lambda_functor< + lambda_functor_base< + action<9, function_action<9, Result> >, + typename detail::bind_tuple_mapper< + Result(*)(Par1, Par2, Par3, Par4, Par5, Par6, Par7, Par8), const Arg2, + const Arg3, const Arg4, const Arg5, const Arg6, const Arg7, const Arg8, + const Arg9 + >::type + > +> + +bind(Result(* const & a1)(Par1, Par2, Par3, Par4, Par5, Par6, Par7, Par8), + const Arg2& a2, const Arg3& a3, const Arg4& a4, const Arg5& a5, + const Arg6& a6, const Arg7& a7, const Arg8& a8, const Arg9& a9) { + return + lambda_functor_base< + action<9, function_action<9, Result> >, + typename detail::bind_tuple_mapper< + Result(*)(Par1, Par2, Par3, Par4, Par5, Par6, Par7, Par8), const Arg2, + const Arg3, const Arg4, const Arg5, const Arg6, const Arg7, + const Arg8, const Arg9 + >::type + > + ( typename detail::bind_tuple_mapper< + Result(*)(Par1, Par2, Par3, Par4, Par5, Par6, Par7, Par8), const Arg2, + const Arg3, const Arg4, const Arg5, const Arg6, const Arg7, + const Arg8, const Arg9 + >::type + (a1, a2, a3, a4, a5, a6, a7, a8, a9) + ); +} + + + #endif + +// 10-argument bind functions -------------------------- +#ifndef BOOST_REF_TO_FUNC_CONFLICTS_WITH_REF_TO_T +template <class Result, class Par1, class Par2, class Par3, class Par4, + class Par5, class Par6, class Par7, class Par8, class Par9, + class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, + class Arg7, class Arg8, class Arg9, class Arg10> +inline const +lambda_functor< + lambda_functor_base< + action<10, function_action<10, Result> >, + typename detail::bind_tuple_mapper< + Result(&)(Par1, Par2, Par3, Par4, Par5, Par6, Par7, Par8, Par9), + const Arg2, const Arg3, const Arg4, const Arg5, const Arg6, const Arg7, + const Arg8, const Arg9, const Arg10 + >::type + > +> + +bind(Result(&a1)(Par1, Par2, Par3, Par4, Par5, Par6, Par7, Par8, Par9), + const Arg2& a2, const Arg3& a3, const Arg4& a4, const Arg5& a5, + const Arg6& a6, const Arg7& a7, const Arg8& a8, const Arg9& a9, + const Arg10& a10) { + return + lambda_functor_base< + action<10, function_action<10, Result> >, + typename detail::bind_tuple_mapper< + Result(&)(Par1, Par2, Par3, Par4, Par5, Par6, Par7, Par8, Par9), + const Arg2, const Arg3, const Arg4, const Arg5, const Arg6, + const Arg7, const Arg8, const Arg9, const Arg10 + >::type + > + ( typename detail::bind_tuple_mapper< + Result(&)(Par1, Par2, Par3, Par4, Par5, Par6, Par7, Par8, Par9), + const Arg2, const Arg3, const Arg4, const Arg5, const Arg6, + const Arg7, const Arg8, const Arg9, const Arg10 + >::type + (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) + ); +} +#endif + + #ifndef BOOST_LAMBDA_INCORRECT_BIND_OVERLOADING +template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, + class Arg6, class Arg7, class Arg8, class Arg9, class Arg10> +inline const +lambda_functor< + lambda_functor_base< + action<10, function_action<10> >, + typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5, const Arg6, + const Arg7, const Arg8, const Arg9, const Arg10 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2, const Arg3& a3, const Arg4& a4, + const Arg5& a5, const Arg6& a6, const Arg7& a7, const Arg8& a8, + const Arg9& a9, const Arg10& a10) { + return + lambda_functor_base< + action<10, function_action<10> >, + typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5, + const Arg6, const Arg7, const Arg8, const Arg9, const Arg10 + >::type + > + ( typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5, + const Arg6, const Arg7, const Arg8, const Arg9, const Arg10 + >::type + (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) + ); +} + +template <class Result, class Arg1, class Arg2, class Arg3, class Arg4, + class Arg5, class Arg6, class Arg7, class Arg8, class Arg9, + class Arg10> +inline const +lambda_functor< + lambda_functor_base< + action<10, function_action<10, Result> >, + typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5, const Arg6, + const Arg7, const Arg8, const Arg9, const Arg10 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2, const Arg3& a3, const Arg4& a4, + const Arg5& a5, const Arg6& a6, const Arg7& a7, const Arg8& a8, + const Arg9& a9, const Arg10& a10) { + return + lambda_functor_base< + action<10, function_action<10, Result> >, + typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5, + const Arg6, const Arg7, const Arg8, const Arg9, const Arg10 + >::type + > + ( typename detail::bind_tuple_mapper< + const Arg1, const Arg2, const Arg3, const Arg4, const Arg5, + const Arg6, const Arg7, const Arg8, const Arg9, const Arg10 + >::type + (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) + ); +} + + + #else +template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, + class Arg6, class Arg7, class Arg8, class Arg9, class Arg10> +inline const +lambda_functor< + lambda_functor_base< + action<10, function_action<10> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, const Arg3, + const Arg4, const Arg5, const Arg6, const Arg7, const Arg8, const Arg9, + const Arg10 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2, const Arg3& a3, const Arg4& a4, + const Arg5& a5, const Arg6& a6, const Arg7& a7, const Arg8& a8, + const Arg9& a9, const Arg10& a10) { + return + lambda_functor_base< + action<10, function_action<10> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, + const Arg3, const Arg4, const Arg5, const Arg6, const Arg7, + const Arg8, const Arg9, const Arg10 + >::type + > + ( typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, + const Arg3, const Arg4, const Arg5, const Arg6, const Arg7, + const Arg8, const Arg9, const Arg10 + >::type + (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) + ); +} + +template <class Result, class Arg1, class Arg2, class Arg3, class Arg4, + class Arg5, class Arg6, class Arg7, class Arg8, class Arg9, + class Arg10> +inline const +lambda_functor< + lambda_functor_base< + action<10, function_action<10, Result> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, const Arg3, + const Arg4, const Arg5, const Arg6, const Arg7, const Arg8, const Arg9, + const Arg10 + >::type + > +> + +bind(const Arg1& a1, const Arg2& a2, const Arg3& a3, const Arg4& a4, + const Arg5& a5, const Arg6& a6, const Arg7& a7, const Arg8& a8, + const Arg9& a9, const Arg10& a10) { + return + lambda_functor_base< + action<10, function_action<10, Result> >, + typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, + const Arg3, const Arg4, const Arg5, const Arg6, const Arg7, + const Arg8, const Arg9, const Arg10 + >::type + > + ( typename detail::bind_tuple_mapper< + typename detail::constify_non_funcs<Arg1>::type, const Arg2, + const Arg3, const Arg4, const Arg5, const Arg6, const Arg7, + const Arg8, const Arg9, const Arg10 + >::type + (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) + ); +} + +template <class Result, class Par1, class Par2, class Par3, class Par4, + class Par5, class Par6, class Par7, class Par8, class Par9, + class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, + class Arg7, class Arg8, class Arg9, class Arg10> +inline const +lambda_functor< + lambda_functor_base< + action<10, function_action<10, Result> >, + typename detail::bind_tuple_mapper< + Result(*)(Par1, Par2, Par3, Par4, Par5, Par6, Par7, Par8, Par9), + const Arg2, const Arg3, const Arg4, const Arg5, const Arg6, const Arg7, + const Arg8, const Arg9, const Arg10 + >::type + > +> + +bind(Result(* const & a1)(Par1, Par2, Par3, Par4, Par5, Par6, Par7, Par8, + Par9), const Arg2& a2, const Arg3& a3, const Arg4& a4, const Arg5& a5, + const Arg6& a6, const Arg7& a7, const Arg8& a8, const Arg9& a9, + const Arg10& a10) { + return + lambda_functor_base< + action<10, function_action<10, Result> >, + typename detail::bind_tuple_mapper< + Result(*)(Par1, Par2, Par3, Par4, Par5, Par6, Par7, Par8, Par9), + const Arg2, const Arg3, const Arg4, const Arg5, const Arg6, + const Arg7, const Arg8, const Arg9, const Arg10 + >::type + > + ( typename detail::bind_tuple_mapper< + Result(*)(Par1, Par2, Par3, Par4, Par5, Par6, Par7, Par8, Par9), + const Arg2, const Arg3, const Arg4, const Arg5, const Arg6, + const Arg7, const Arg8, const Arg9, const Arg10 + >::type + (a1, a2, a3, a4, a5, a6, a7, a8, a9, a10) + ); +} + + + #endif + +} // namespace lambda +} // namespace boost + +#endif diff --git a/3rdParty/Boost/src/boost/lambda/detail/function_adaptors.hpp b/3rdParty/Boost/src/boost/lambda/detail/function_adaptors.hpp new file mode 100644 index 0000000..35db8b4 --- /dev/null +++ b/3rdParty/Boost/src/boost/lambda/detail/function_adaptors.hpp @@ -0,0 +1,789 @@ +// Boost Lambda Library - function_adaptors.hpp ---------------------------- + +// Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi) +// +// 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) +// +// For more information, see www.boost.org + + +#ifndef BOOST_LAMBDA_FUNCTION_ADAPTORS_HPP +#define BOOST_LAMBDA_FUNCTION_ADAPTORS_HPP + +#include "boost/mpl/has_xxx.hpp" +#include "boost/tuple/tuple.hpp" +#include "boost/type_traits/same_traits.hpp" +#include "boost/type_traits/remove_reference.hpp" +#include "boost/type_traits/remove_cv.hpp" +#include "boost/type_traits/add_const.hpp" +#include "boost/type_traits/add_volatile.hpp" +#include "boost/utility/result_of.hpp" + +namespace boost { +namespace lambda { + +namespace detail { + +BOOST_MPL_HAS_XXX_TEMPLATE_DEF(sig) + +template<class Tuple> +struct remove_references_from_elements { + typedef typename boost::tuples::cons< + typename boost::remove_reference<typename Tuple::head_type>::type, + typename remove_references_from_elements<typename Tuple::tail_type>::type + > type; +}; + +template<> +struct remove_references_from_elements<boost::tuples::null_type> { + typedef boost::tuples::null_type type; +}; + +} + +template <class Func> struct function_adaptor { + + typedef typename detail::remove_reference_and_cv<Func>::type plainF; + +#if !defined(BOOST_NO_RESULT_OF) + // Support functors that use the boost::result_of return type convention. + template<class Tuple, int Length, bool HasSig> + struct result_converter; + template<class Tuple, int Length> + struct result_converter<Tuple, Length, true> + : plainF::template sig< + typename detail::remove_references_from_elements<Tuple>::type + > + {}; + template<class Tuple> + struct result_converter<Tuple, 0, false> + : result_of<plainF()> + {}; + template<class Tuple> + struct result_converter<Tuple, 1, false> + : result_of<plainF( + typename tuples::element<1, Tuple>::type) + > + {}; + template<class Tuple> + struct result_converter<Tuple, 2, false> + : result_of<plainF( + typename tuples::element<1, Tuple>::type, + typename tuples::element<2, Tuple>::type) + > + {}; + template<class Tuple> + struct result_converter<Tuple, 3, false> + : result_of<plainF( + typename tuples::element<1, Tuple>::type, + typename tuples::element<2, Tuple>::type, + typename tuples::element<3, Tuple>::type) + > + {}; + template<class Tuple> + struct result_converter<Tuple, 4, false> + : result_of<plainF( + typename tuples::element<1, Tuple>::type, + typename tuples::element<2, Tuple>::type, + typename tuples::element<3, Tuple>::type, + typename tuples::element<4, Tuple>::type) + > + {}; + template<class Tuple> + struct result_converter<Tuple, 5, false> + : result_of<plainF( + typename tuples::element<1, Tuple>::type, + typename tuples::element<2, Tuple>::type, + typename tuples::element<3, Tuple>::type, + typename tuples::element<4, Tuple>::type, + typename tuples::element<5, Tuple>::type) + > + {}; + template<class Tuple> + struct result_converter<Tuple, 6, false> + : result_of<plainF( + typename tuples::element<1, Tuple>::type, + typename tuples::element<2, Tuple>::type, + typename tuples::element<3, Tuple>::type, + typename tuples::element<4, Tuple>::type, + typename tuples::element<5, Tuple>::type, + typename tuples::element<6, Tuple>::type) + > + {}; + template<class Tuple> + struct result_converter<Tuple, 7, false> + : result_of<plainF( + typename tuples::element<1, Tuple>::type, + typename tuples::element<2, Tuple>::type, + typename tuples::element<3, Tuple>::type, + typename tuples::element<4, Tuple>::type, + typename tuples::element<5, Tuple>::type, + typename tuples::element<6, Tuple>::type, + typename tuples::element<7, Tuple>::type) + > + {}; + template<class Tuple> + struct result_converter<Tuple, 8, false> + : result_of<plainF( + typename tuples::element<1, Tuple>::type, + typename tuples::element<2, Tuple>::type, + typename tuples::element<3, Tuple>::type, + typename tuples::element<4, Tuple>::type, + typename tuples::element<5, Tuple>::type, + typename tuples::element<6, Tuple>::type, + typename tuples::element<7, Tuple>::type, + typename tuples::element<8, Tuple>::type) + > + {}; + template<class Tuple> + struct result_converter<Tuple, 9, false> + : result_of<plainF( + typename tuples::element<1, Tuple>::type, + typename tuples::element<2, Tuple>::type, + typename tuples::element<3, Tuple>::type, + typename tuples::element<4, Tuple>::type, + typename tuples::element<5, Tuple>::type, + typename tuples::element<6, Tuple>::type, + typename tuples::element<7, Tuple>::type, + typename tuples::element<8, Tuple>::type, + typename tuples::element<9, Tuple>::type) + > + {}; + + // we do not know the return type off-hand, we must ask it from Func + // To sig we pass a cons list, where the head is the function object type + // itself (potentially cv-qualified) + // and the tail contains the types of the actual arguments to be passed + // to the function object. The arguments can be cv qualified + // as well. + template <class Args> + struct sig + : result_converter< + Args + , tuples::length<typename Args::tail_type>::value + , detail::has_sig<plainF>::value + > + {}; +#else // BOOST_NO_RESULT_OF + + template <class Args> class sig { + typedef typename detail::remove_reference_and_cv<Func>::type plainF; + public: + typedef typename plainF::template sig< + typename detail::remove_references_from_elements<Args>::type + >::type type; + }; +#endif + + template<class RET, class A1> + static RET apply(A1& a1) { + return a1(); + } + template<class RET, class A1, class A2> + static RET apply(A1& a1, A2& a2) { + return a1(a2); + } + template<class RET, class A1, class A2, class A3> + static RET apply(A1& a1, A2& a2, A3& a3) { + return a1(a2, a3); + } + template<class RET, class A1, class A2, class A3, class A4> + static RET apply(A1& a1, A2& a2, A3& a3, A4& a4) { + return a1(a2, a3, a4); + } + template<class RET, class A1, class A2, class A3, class A4, class A5> + static RET apply(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5) { + return a1(a2, a3, a4, a5); + } + template<class RET, class A1, class A2, class A3, class A4, class A5, class A6> + static RET apply(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6) { + return a1(a2, a3, a4, a5, a6); + } + template<class RET, class A1, class A2, class A3, class A4, class A5, class A6, + class A7> + static RET apply(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, + A7& a7) { + return a1(a2, a3, a4, a5, a6, a7); + } + template<class RET, class A1, class A2, class A3, class A4, class A5, class A6, + class A7, class A8> + static RET apply(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, + A7& a7, A8& a8) { + return a1(a2, a3, a4, a5, a6, a7, a8); + } + template<class RET, class A1, class A2, class A3, class A4, class A5, class A6, + class A7, class A8, class A9> + static RET apply(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, + A7& a7, A8& a8, A9& a9) { + return a1(a2, a3, a4, a5, a6, a7, a8, a9); + } + template<class RET, class A1, class A2, class A3, class A4, class A5, class A6, + class A7, class A8, class A9, class A10> + static RET apply(A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, + A7& a7, A8& a8, A9& a9, A10& a10) { + return a1(a2, a3, a4, a5, a6, a7, a8, a9, a10); + } +}; + +template <class Func> struct function_adaptor<const Func>; // error + +// -- function adaptors with data member access +template <class Object, class T> +struct function_adaptor<T Object::*> { + + // typedef detail::unspecified type; + + // T can have qualifiers and can be a reference type + // We get the return type by adding const, if the object through which + // the data member is accessed is const, and finally adding a reference + template<class Args> class sig { + typedef typename boost::tuples::element<1, Args>::type argument_type; + typedef typename boost::remove_reference< + argument_type + >::type unref_type; + + typedef typename detail::IF<boost::is_const<unref_type>::value, + typename boost::add_const<T>::type, + T + >::RET properly_consted_return_type; + + typedef typename detail::IF<boost::is_volatile<unref_type>::value, + typename boost::add_volatile<properly_consted_return_type>::type, + properly_consted_return_type + >::RET properly_cvd_return_type; + + + public: + typedef typename detail::IF<boost::is_reference<argument_type>::value, + typename boost::add_reference<properly_cvd_return_type>::type, + typename boost::remove_cv<T>::type + >::RET type; + }; + + template <class RET> + static RET apply( T Object::*data, Object& o) { + return o.*data; + } + template <class RET> + static RET apply( T Object::*data, const Object& o) { + return o.*data; + } + template <class RET> + static RET apply( T Object::*data, volatile Object& o) { + return o.*data; + } + template <class RET> + static RET apply( T Object::*data, const volatile Object& o) { + return o.*data; + } + template <class RET> + static RET apply( T Object::*data, Object* o) { + return o->*data; + } + template <class RET> + static RET apply( T Object::*data, const Object* o) { + return o->*data; + } + template <class RET> + static RET apply( T Object::*data, volatile Object* o) { + return o->*data; + } + template <class RET> + static RET apply( T Object::*data, const volatile Object* o) { + return o->*data; + } +}; + +// -- function adaptors with 1 argument apply + +template <class Result> +struct function_adaptor<Result (void)> { + + template<class T> struct sig { typedef Result type; }; + template <class RET> + static Result apply(Result (*func)()) { + return func(); + } +}; + +template <class Result> +struct function_adaptor<Result (*)(void)> { + + template<class T> struct sig { typedef Result type; }; + template <class RET> + static Result apply(Result (*func)()) { + return func(); + } +}; + + +// -- function adaptors with 2 argument apply +template <class Object, class Result> +struct function_adaptor<Result (Object::*)() const> { + + template<class T> struct sig { typedef Result type; }; + template <class RET> + static Result apply( Result (Object::*func)() const, const Object* o) { + return (o->*func)(); + } + template <class RET> + static Result apply( Result (Object::*func)() const, const Object& o) { + return (o.*func)(); + } +}; + +template <class Object, class Result> +struct function_adaptor<Result (Object::*)()> { + + template<class T> struct sig { typedef Result type; }; + template <class RET> + static Result apply( Result (Object::*func)(), Object* o) { + return (o->*func)(); + } + template <class RET> + static Result apply( Result (Object::*func)(), Object& o) { + return (o.*func)(); + } +}; + +template <class Arg1, class Result> +struct function_adaptor<Result (Arg1)> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1> + static Result apply(Result (*func)(Arg1), A1& a1) { + return func(a1); + } +}; + +template <class Arg1, class Result> +struct function_adaptor<Result (*)(Arg1)> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1> + static Result apply(Result (*func)(Arg1), A1& a1) { + return func(a1); + } +}; + + +// -- function adaptors with 3 argument apply +template <class Object, class Arg1, class Result> +struct function_adaptor<Result (Object::*)(Arg1) const> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1> + static Result apply( Result (Object::*func)(Arg1) const, const Object* o, + A1& a1) { + return (o->*func)(a1); + } + template <class RET, class A1> + static Result apply( Result (Object::*func)(Arg1) const, const Object& o, + A1& a1) { + return (o.*func)(a1); + } +}; + +template <class Object, class Arg1, class Result> +struct function_adaptor<Result (Object::*)(Arg1)> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1> + static Result apply( Result (Object::*func)(Arg1), Object* o, A1& a1) { + return (o->*func)(a1); + } + template <class RET, class A1> + static Result apply( Result (Object::*func)(Arg1), Object& o, A1& a1) { + return (o.*func)(a1); + } +}; + +template <class Arg1, class Arg2, class Result> +struct function_adaptor<Result (Arg1, Arg2)> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1, class A2> + static Result apply(Result (*func)(Arg1, Arg2), A1& a1, A2& a2) { + return func(a1, a2); + } +}; + +template <class Arg1, class Arg2, class Result> +struct function_adaptor<Result (*)(Arg1, Arg2)> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1, class A2> + static Result apply(Result (*func)(Arg1, Arg2), A1& a1, A2& a2) { + return func(a1, a2); + } +}; + + +// -- function adaptors with 4 argument apply +template <class Object, class Arg1, class Arg2, class Result> +struct function_adaptor<Result (Object::*)(Arg1, Arg2) const> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1, class A2> + static Result apply( Result (Object::*func)(Arg1, Arg2) const, const Object* o, A1& a1, A2& a2) { + return (o->*func)(a1, a2); + } + template <class RET, class A1, class A2> + static Result apply( Result (Object::*func)(Arg1, Arg2) const, const Object& o, A1& a1, A2& a2) { + return (o.*func)(a1, a2); + } +}; + +template <class Object, class Arg1, class Arg2, class Result> +struct function_adaptor<Result (Object::*)(Arg1, Arg2)> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1, class A2> + static Result apply( Result (Object::*func)(Arg1, Arg2), Object* o, A1& a1, A2& a2) { + return (o->*func)(a1, a2); + } + template <class RET, class A1, class A2> + static Result apply( Result (Object::*func)(Arg1, Arg2), Object& o, A1& a1, A2& a2) { + return (o.*func)(a1, a2); + } +}; + +template <class Arg1, class Arg2, class Arg3, class Result> +struct function_adaptor<Result (Arg1, Arg2, Arg3)> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1, class A2, class A3> + static Result apply(Result (*func)(Arg1, Arg2, Arg3), A1& a1, A2& a2, A3& a3) { + return func(a1, a2, a3); + } +}; + +template <class Arg1, class Arg2, class Arg3, class Result> +struct function_adaptor<Result (*)(Arg1, Arg2, Arg3)> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1, class A2, class A3> + static Result apply(Result (*func)(Arg1, Arg2, Arg3), A1& a1, A2& a2, A3& a3) { + return func(a1, a2, a3); + } +}; + + +// -- function adaptors with 5 argument apply +template <class Object, class Arg1, class Arg2, class Arg3, class Result> +struct function_adaptor<Result (Object::*)(Arg1, Arg2, Arg3) const> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1, class A2, class A3> + static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3) const, const Object* o, A1& a1, A2& a2, A3& a3) { + return (o->*func)(a1, a2, a3); + } + template <class RET, class A1, class A2, class A3> + static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3) const, const Object& o, A1& a1, A2& a2, A3& a3) { + return (o.*func)(a1, a2, a3); + } +}; + +template <class Object, class Arg1, class Arg2, class Arg3, class Result> +struct function_adaptor<Result (Object::*)(Arg1, Arg2, Arg3)> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1, class A2, class A3> + static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3), Object* o, A1& a1, A2& a2, A3& a3) { + return (o->*func)(a1, a2, a3); + } + template <class RET, class A1, class A2, class A3> + static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3), Object& o, A1& a1, A2& a2, A3& a3) { + return (o.*func)(a1, a2, a3); + } +}; + +template <class Arg1, class Arg2, class Arg3, class Arg4, class Result> +struct function_adaptor<Result (Arg1, Arg2, Arg3, Arg4)> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1, class A2, class A3, class A4> + static Result apply(Result (*func)(Arg1, Arg2, Arg3, Arg4), A1& a1, A2& a2, A3& a3, A4& a4) { + return func(a1, a2, a3, a4); + } +}; + +template <class Arg1, class Arg2, class Arg3, class Arg4, class Result> +struct function_adaptor<Result (*)(Arg1, Arg2, Arg3, Arg4)> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1, class A2, class A3, class A4> + static Result apply(Result (*func)(Arg1, Arg2, Arg3, Arg4), A1& a1, A2& a2, A3& a3, A4& a4) { + return func(a1, a2, a3, a4); + } +}; + + +// -- function adaptors with 6 argument apply +template <class Object, class Arg1, class Arg2, class Arg3, class Arg4, class Result> +struct function_adaptor<Result (Object::*)(Arg1, Arg2, Arg3, Arg4) const> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1, class A2, class A3, class A4> + static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4) const, const Object* o, A1& a1, A2& a2, A3& a3, A4& a4) { + return (o->*func)(a1, a2, a3, a4); + } + template <class RET, class A1, class A2, class A3, class A4> + static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4) const, const Object& o, A1& a1, A2& a2, A3& a3, A4& a4) { + return (o.*func)(a1, a2, a3, a4); + } +}; + +template <class Object, class Arg1, class Arg2, class Arg3, class Arg4, class Result> +struct function_adaptor<Result (Object::*)(Arg1, Arg2, Arg3, Arg4)> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1, class A2, class A3, class A4> + static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4), Object* o, A1& a1, A2& a2, A3& a3, A4& a4) { + return (o->*func)(a1, a2, a3, a4); + } + template <class RET, class A1, class A2, class A3, class A4> + static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4), Object& o, A1& a1, A2& a2, A3& a3, A4& a4) { + return (o.*func)(a1, a2, a3, a4); + } +}; + +template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Result> +struct function_adaptor<Result (Arg1, Arg2, Arg3, Arg4, Arg5)> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1, class A2, class A3, class A4, class A5> + static Result apply(Result (*func)(Arg1, Arg2, Arg3, Arg4, Arg5), A1& a1, A2& a2, A3& a3, A4& a4, A5& a5) { + return func(a1, a2, a3, a4, a5); + } +}; + +template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Result> +struct function_adaptor<Result (*)(Arg1, Arg2, Arg3, Arg4, Arg5)> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1, class A2, class A3, class A4, class A5> + static Result apply(Result (*func)(Arg1, Arg2, Arg3, Arg4, Arg5), A1& a1, A2& a2, A3& a3, A4& a4, A5& a5) { + return func(a1, a2, a3, a4, a5); + } +}; + + +// -- function adaptors with 7 argument apply +template <class Object, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Result> +struct function_adaptor<Result (Object::*)(Arg1, Arg2, Arg3, Arg4, Arg5) const> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1, class A2, class A3, class A4, class A5> + static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5) const, const Object* o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5) { + return (o->*func)(a1, a2, a3, a4, a5); + } + template <class RET, class A1, class A2, class A3, class A4, class A5> + static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5) const, const Object& o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5) { + return (o.*func)(a1, a2, a3, a4, a5); + } +}; + +template <class Object, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Result> +struct function_adaptor<Result (Object::*)(Arg1, Arg2, Arg3, Arg4, Arg5)> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1, class A2, class A3, class A4, class A5> + static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5), Object* o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5) { + return (o->*func)(a1, a2, a3, a4, a5); + } + template <class RET, class A1, class A2, class A3, class A4, class A5> + static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5), Object& o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5) { + return (o.*func)(a1, a2, a3, a4, a5); + } +}; + +template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Result> +struct function_adaptor<Result (Arg1, Arg2, Arg3, Arg4, Arg5, Arg6)> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1, class A2, class A3, class A4, class A5, class A6> + static Result apply(Result (*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6), A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6) { + return func(a1, a2, a3, a4, a5, a6); + } +}; + +template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Result> +struct function_adaptor<Result (*)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6)> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1, class A2, class A3, class A4, class A5, class A6> + static Result apply(Result (*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6), A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6) { + return func(a1, a2, a3, a4, a5, a6); + } +}; + + +// -- function adaptors with 8 argument apply +template <class Object, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Result> +struct function_adaptor<Result (Object::*)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6) const> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1, class A2, class A3, class A4, class A5, class A6> + static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6) const, const Object* o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6) { + return (o->*func)(a1, a2, a3, a4, a5, a6); + } + template <class RET, class A1, class A2, class A3, class A4, class A5, class A6> + static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6) const, const Object& o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6) { + return (o.*func)(a1, a2, a3, a4, a5, a6); + } +}; + +template <class Object, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Result> +struct function_adaptor<Result (Object::*)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6)> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1, class A2, class A3, class A4, class A5, class A6> + static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6), Object* o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6) { + return (o->*func)(a1, a2, a3, a4, a5, a6); + } + template <class RET, class A1, class A2, class A3, class A4, class A5, class A6> + static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6), Object& o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6) { + return (o.*func)(a1, a2, a3, a4, a5, a6); + } +}; + +template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7, class Result> +struct function_adaptor<Result (Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7)> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7> + static Result apply(Result (*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7), A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7) { + return func(a1, a2, a3, a4, a5, a6, a7); + } +}; + +template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7, class Result> +struct function_adaptor<Result (*)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7)> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7> + static Result apply(Result (*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7), A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7) { + return func(a1, a2, a3, a4, a5, a6, a7); + } +}; + + +// -- function adaptors with 9 argument apply +template <class Object, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7, class Result> +struct function_adaptor<Result (Object::*)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7) const> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7> + static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7) const, const Object* o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7) { + return (o->*func)(a1, a2, a3, a4, a5, a6, a7); + } + template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7> + static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7) const, const Object& o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7) { + return (o.*func)(a1, a2, a3, a4, a5, a6, a7); + } +}; + +template <class Object, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7, class Result> +struct function_adaptor<Result (Object::*)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7)> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7> + static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7), Object* o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7) { + return (o->*func)(a1, a2, a3, a4, a5, a6, a7); + } + template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7> + static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7), Object& o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7) { + return (o.*func)(a1, a2, a3, a4, a5, a6, a7); + } +}; + +template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7, class Arg8, class Result> +struct function_adaptor<Result (Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8)> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> + static Result apply(Result (*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8), A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7, A8& a8) { + return func(a1, a2, a3, a4, a5, a6, a7, a8); + } +}; + +template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7, class Arg8, class Result> +struct function_adaptor<Result (*)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8)> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> + static Result apply(Result (*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8), A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7, A8& a8) { + return func(a1, a2, a3, a4, a5, a6, a7, a8); + } +}; + + +// -- function adaptors with 10 argument apply +template <class Object, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7, class Arg8, class Result> +struct function_adaptor<Result (Object::*)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8) const> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> + static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8) const, const Object* o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7, A8& a8) { + return (o->*func)(a1, a2, a3, a4, a5, a6, a7, a8); + } + template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> + static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8) const, const Object& o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7, A8& a8) { + return (o.*func)(a1, a2, a3, a4, a5, a6, a7, a8); + } +}; + +template <class Object, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7, class Arg8, class Result> +struct function_adaptor<Result (Object::*)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8)> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> + static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8), Object* o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7, A8& a8) { + return (o->*func)(a1, a2, a3, a4, a5, a6, a7, a8); + } + template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> + static Result apply( Result (Object::*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8), Object& o, A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7, A8& a8) { + return (o.*func)(a1, a2, a3, a4, a5, a6, a7, a8); + } +}; + +template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7, class Arg8, class Arg9, class Result> +struct function_adaptor<Result (Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9)> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> + static Result apply(Result (*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9), A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7, A8& a8, A9& a9) { + return func(a1, a2, a3, a4, a5, a6, a7, a8, a9); + } +}; + +template <class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7, class Arg8, class Arg9, class Result> +struct function_adaptor<Result (*)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9)> { + + template<class T> struct sig { typedef Result type; }; + template <class RET, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> + static Result apply(Result (*func)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9), A1& a1, A2& a2, A3& a3, A4& a4, A5& a5, A6& a6, A7& a7, A8& a8, A9& a9) { + return func(a1, a2, a3, a4, a5, a6, a7, a8, a9); + } +}; + +} // namespace lambda +} // namespace boost + +#endif + + + + + + + + + + + + + diff --git a/3rdParty/Boost/src/boost/lambda/detail/is_instance_of.hpp b/3rdParty/Boost/src/boost/lambda/detail/is_instance_of.hpp new file mode 100644 index 0000000..1dfbd43 --- /dev/null +++ b/3rdParty/Boost/src/boost/lambda/detail/is_instance_of.hpp @@ -0,0 +1,104 @@ +// Boost Lambda Library - is_instance_of.hpp --------------------- + +// Copyright (C) 2001 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi) +// +// 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) +// +// For more information, see www.boost.org + +// --------------------------------------------------------------- + +#ifndef BOOST_LAMBDA_IS_INSTANCE_OF +#define BOOST_LAMBDA_IS_INSTANCE_OF + +#include "boost/config.hpp" // for BOOST_STATIC_CONSTANT +#include "boost/type_traits/conversion_traits.hpp" // for is_convertible +#include "boost/preprocessor/enum_shifted_params.hpp" +#include "boost/preprocessor/repeat_2nd.hpp" + +// is_instance_of -------------------------------- +// +// is_instance_of_n<A, B>::value is true, if type A is +// an instantiation of a template B, or A derives from an instantiation +// of template B +// +// n is the number of template arguments for B +// +// Example: +// is_instance_of_2<std::istream, basic_stream>::value == true + +// The original implementation was somewhat different, with different versions +// for different compilers. However, there was still a problem +// with gcc.3.0.2 and 3.0.3 compilers, which didn't think regard +// is_instance_of_N<...>::value was a constant. +// John Maddock suggested the way around this problem by building +// is_instance_of templates using boost::is_convertible. +// Now we only have one version of is_instance_of templates, which delagate +// all the nasty compiler tricks to is_convertible. + +#define BOOST_LAMBDA_CLASS(z, N,A) BOOST_PP_COMMA_IF(N) class +#define BOOST_LAMBDA_CLASS_ARG(z, N,A) BOOST_PP_COMMA_IF(N) class A##N +#define BOOST_LAMBDA_ARG(z, N,A) BOOST_PP_COMMA_IF(N) A##N + +#define BOOST_LAMBDA_CLASS_LIST(n, NAME) BOOST_PP_REPEAT(n, BOOST_LAMBDA_CLASS, NAME) + +#define BOOST_LAMBDA_CLASS_ARG_LIST(n, NAME) BOOST_PP_REPEAT(n, BOOST_LAMBDA_CLASS_ARG, NAME) + +#define BOOST_LAMBDA_ARG_LIST(n, NAME) BOOST_PP_REPEAT(n, BOOST_LAMBDA_ARG, NAME) + +namespace boost { +namespace lambda { + +#define BOOST_LAMBDA_IS_INSTANCE_OF_TEMPLATE(INDEX) \ + \ +namespace detail { \ + \ +template <template<BOOST_LAMBDA_CLASS_LIST(INDEX,T)> class F> \ +struct BOOST_PP_CAT(conversion_tester_,INDEX) { \ + template<BOOST_LAMBDA_CLASS_ARG_LIST(INDEX,A)> \ + BOOST_PP_CAT(conversion_tester_,INDEX) \ + (const F<BOOST_LAMBDA_ARG_LIST(INDEX,A)>&); \ +}; \ + \ +} /* end detail */ \ + \ +template <class From, template <BOOST_LAMBDA_CLASS_LIST(INDEX,T)> class To> \ +struct BOOST_PP_CAT(is_instance_of_,INDEX) \ +{ \ + private: \ + typedef ::boost::is_convertible< \ + From, \ + BOOST_PP_CAT(detail::conversion_tester_,INDEX)<To> \ + > helper_type; \ + \ +public: \ + BOOST_STATIC_CONSTANT(bool, value = helper_type::value); \ +}; + + +#define BOOST_LAMBDA_HELPER(z, N, A) BOOST_LAMBDA_IS_INSTANCE_OF_TEMPLATE( BOOST_PP_INC(N) ) + +// Generate the traits for 1-4 argument templates + +BOOST_PP_REPEAT_2ND(4,BOOST_LAMBDA_HELPER,FOO) + +#undef BOOST_LAMBDA_HELPER +#undef BOOST_LAMBDA_IS_INSTANCE_OF_TEMPLATE +#undef BOOST_LAMBDA_CLASS +#undef BOOST_LAMBDA_ARG +#undef BOOST_LAMBDA_CLASS_ARG +#undef BOOST_LAMBDA_CLASS_LIST +#undef BOOST_LAMBDA_ARG_LIST +#undef BOOST_LAMBDA_CLASS_ARG_LIST + +} // lambda +} // boost + +#endif + + + + + diff --git a/3rdParty/Boost/src/boost/lambda/detail/lambda_config.hpp b/3rdParty/Boost/src/boost/lambda/detail/lambda_config.hpp new file mode 100644 index 0000000..9fd1a7b --- /dev/null +++ b/3rdParty/Boost/src/boost/lambda/detail/lambda_config.hpp @@ -0,0 +1,48 @@ +// Boost Lambda Library - lambda_config.hpp ------------------------------ + +// Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi) +// +// 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) +// +// For more information, see www.boost.org + +// --------------------------------------------------------------- + +#ifndef BOOST_LAMBDA_LAMBDA_CONFIG_HPP +#define BOOST_LAMBDA_LAMBDA_CONFIG_HPP + +// add to boost/config.hpp +// for now + + +# if defined __GNUC__ +# if (__GNUC__ == 3 && __GNUC_MINOR__ >= 4) +# define BOOST_REF_TO_FUNC_CONFLICTS_WITH_REF_TO_T +# define BOOST_LAMBDA_INCORRECT_BIND_OVERLOADING +# endif +# if (__GNUC__ == 2 && __GNUC_MINOR__ <= 97) +# define BOOST_NO_TEMPLATED_STREAMS +# define BOOST_LAMBDA_INCORRECT_BIND_OVERLOADING +# endif +# if (__GNUC__ == 2 && __GNUC_MINOR__ <= 95) +# define BOOST_LAMBDA_FAILS_IN_TEMPLATE_KEYWORD_AFTER_SCOPE_OPER +# endif +# endif // __GNUC__ + + +#if defined __KCC + +#define BOOST_NO_FDECL_TEMPLATES_AS_TEMPLATE_TEMPLATE_PARAMS + +#endif // __KCC + +#endif + + + + + + + diff --git a/3rdParty/Boost/src/boost/lambda/detail/lambda_functor_base.hpp b/3rdParty/Boost/src/boost/lambda/detail/lambda_functor_base.hpp new file mode 100644 index 0000000..b084acd --- /dev/null +++ b/3rdParty/Boost/src/boost/lambda/detail/lambda_functor_base.hpp @@ -0,0 +1,615 @@ +// Boost Lambda Library lambda_functor_base.hpp ----------------------------- +// +// Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi) +// +// 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) +// +// For more information, see www.boost.org + +// ------------------------------------------------------------ + +#ifndef BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_HPP +#define BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_HPP + +#include "boost/type_traits/add_reference.hpp" +#include "boost/type_traits/add_const.hpp" +#include "boost/type_traits/remove_const.hpp" +#include "boost/lambda/detail/lambda_fwd.hpp" +#include "boost/lambda/detail/lambda_traits.hpp" + +namespace boost { +namespace lambda { + +#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) +#pragma warning(push) +#pragma warning(disable:4512) //assignment operator could not be generated +#endif + + // for return type deductions we wrap bound argument to this class, + // which fulfils the base class contract for lambda_functors +template <class T> +class identity { + + T elem; +public: + + typedef T element_t; + + // take all parameters as const references. Note that non-const references + // stay as they are. + typedef typename boost::add_reference< + typename boost::add_const<T>::type + >::type par_t; + + explicit identity(par_t t) : elem(t) {} + + template <typename SigArgs> + struct sig { typedef typename boost::remove_const<element_t>::type type; }; + + template<class RET, CALL_TEMPLATE_ARGS> + RET call(CALL_FORMAL_ARGS) const { CALL_USE_ARGS; return elem; } +}; + +#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) +#pragma warning(pop) +#endif + +template <class T> +inline lambda_functor<identity<T&> > var(T& t) { return identity<T&>(t); } + + // for lambda functors, var is an identity operator. It was forbidden + // at some point, but we might want to var something that can be a + // non-lambda functor or a lambda functor. +template <class T> +lambda_functor<T> var(const lambda_functor<T>& t) { return t; } + +template <class T> struct var_type { + typedef lambda_functor<identity<T&> > type; +}; + + +template <class T> +inline +lambda_functor<identity<typename bound_argument_conversion<const T>::type> > +constant(const T& t) { + return identity<typename bound_argument_conversion<const T>::type>(t); +} +template <class T> +lambda_functor<T> constant(const lambda_functor<T>& t) { return t; } + +template <class T> struct constant_type { + typedef + lambda_functor< + identity<typename bound_argument_conversion<const T>::type> + > type; +}; + + + +template <class T> +inline lambda_functor<identity<const T&> > constant_ref(const T& t) { + return identity<const T&>(t); +} +template <class T> +lambda_functor<T> constant_ref(const lambda_functor<T>& t) { return t; } + +template <class T> struct constant_ref_type { + typedef + lambda_functor<identity<const T&> > type; +}; + + + + // as_lambda_functor turns any types to lambda functors + // non-lambda_functors will be bound argument types +template <class T> +struct as_lambda_functor { + typedef typename + detail::remove_reference_and_cv<T>::type plain_T; + typedef typename + detail::IF<is_lambda_functor<plain_T>::value, + plain_T, + lambda_functor< + identity<typename bound_argument_conversion<T>::type> + > + >::RET type; +}; + +// turns arbitrary objects into lambda functors +template <class T> +inline +lambda_functor<identity<typename bound_argument_conversion<const T>::type> > +to_lambda_functor(const T& t) { + return identity<typename bound_argument_conversion<const T>::type>(t); +} + +template <class T> +inline lambda_functor<T> +to_lambda_functor(const lambda_functor<T>& t) { + return t; +} + +namespace detail { + + + +// In a call constify_rvals<T>::go(x) +// x should be of type T. If T is a non-reference type, do +// returns x as const reference. +// Otherwise the type doesn't change. +// The purpose of this class is to avoid +// 'cannot bind temporaries to non-const references' errors. +template <class T> struct constify_rvals { + template<class U> + static inline const U& go(const U& u) { return u; } +}; + +template <class T> struct constify_rvals<T&> { + template<class U> + static inline U& go(U& u) { return u; } +}; + + // check whether one of the elements of a tuple (cons list) is of type + // null_type. Needed, because the compiler goes ahead and instantiates + // sig template for nullary case even if the nullary operator() is not + // called +template <class T> struct is_null_type +{ BOOST_STATIC_CONSTANT(bool, value = false); }; + +template <> struct is_null_type<null_type> +{ BOOST_STATIC_CONSTANT(bool, value = true); }; + +template<class Tuple> struct has_null_type { + BOOST_STATIC_CONSTANT(bool, value = (is_null_type<typename Tuple::head_type>::value || has_null_type<typename Tuple::tail_type>::value)); +}; +template<> struct has_null_type<null_type> { + BOOST_STATIC_CONSTANT(bool, value = false); +}; + + +// helpers ------------------- + + +template<class Args, class SigArgs> +class deduce_argument_types_ { + typedef typename as_lambda_functor<typename Args::head_type>::type lf_t; + typedef typename lf_t::inherited::template sig<SigArgs>::type el_t; +public: + typedef + boost::tuples::cons< + el_t, + typename deduce_argument_types_<typename Args::tail_type, SigArgs>::type + > type; +}; + +template<class SigArgs> +class deduce_argument_types_<null_type, SigArgs> { +public: + typedef null_type type; +}; + + +// // note that tuples cannot have plain function types as elements. +// // Hence, all other types will be non-const, except references to +// // functions. +// template <class T> struct remove_reference_except_from_functions { +// typedef typename boost::remove_reference<T>::type t; +// typedef typename detail::IF<boost::is_function<t>::value, T, t>::RET type; +// }; + +template<class Args, class SigArgs> +class deduce_non_ref_argument_types_ { + typedef typename as_lambda_functor<typename Args::head_type>::type lf_t; + typedef typename lf_t::inherited::template sig<SigArgs>::type el_t; +public: + typedef + boost::tuples::cons< + // typename detail::remove_reference_except_from_functions<el_t>::type, + typename boost::remove_reference<el_t>::type, + typename deduce_non_ref_argument_types_<typename Args::tail_type, SigArgs>::type + > type; +}; + +template<class SigArgs> +class deduce_non_ref_argument_types_<null_type, SigArgs> { +public: + typedef null_type type; +}; + + // ------------- + +// take stored Args and Open Args, and return a const list with +// deduced elements (real return types) +template<class Args, class SigArgs> +class deduce_argument_types { + typedef typename deduce_argument_types_<Args, SigArgs>::type t1; +public: + typedef typename detail::IF< + has_null_type<t1>::value, null_type, t1 + >::RET type; +}; + +// take stored Args and Open Args, and return a const list with +// deduced elements (references are stripped from the element types) + +template<class Args, class SigArgs> +class deduce_non_ref_argument_types { + typedef typename deduce_non_ref_argument_types_<Args, SigArgs>::type t1; +public: + typedef typename detail::IF< + has_null_type<t1>::value, null_type, t1 + >::RET type; +}; + +template <int N, class Args, class SigArgs> +struct nth_return_type_sig { + typedef typename + as_lambda_functor< + typename boost::tuples::element<N, Args>::type + // typename tuple_element_as_reference<N, Args>::type + >::type lf_type; + + typedef typename lf_type::inherited::template sig<SigArgs>::type type; +}; + +template<int N, class Tuple> struct element_or_null { + typedef typename boost::tuples::element<N, Tuple>::type type; +}; + +template<int N> struct element_or_null<N, null_type> { + typedef null_type type; +}; + + + + +} // end detail + + // -- lambda_functor base --------------------- + +// the explicit_return_type_action case ----------------------------------- +template<class RET, class Args> +class lambda_functor_base<explicit_return_type_action<RET>, Args> +{ +public: + Args args; + + typedef RET result_type; + + explicit lambda_functor_base(const Args& a) : args(a) {} + + template <class SigArgs> struct sig { typedef RET type; }; + + template<class RET_, CALL_TEMPLATE_ARGS> + RET call(CALL_FORMAL_ARGS) const + { + return detail::constify_rvals<RET>::go( + detail::r_select<RET>::go(boost::tuples::get<0>(args), CALL_ACTUAL_ARGS)); + } +}; + +// the protect_action case ----------------------------------- +template<class Args> +class lambda_functor_base<protect_action, Args> +{ +public: + Args args; +public: + + explicit lambda_functor_base(const Args& a) : args(a) {} + + + template<class RET, CALL_TEMPLATE_ARGS> + RET call(CALL_FORMAL_ARGS) const + { + CALL_USE_ARGS; + return boost::tuples::get<0>(args); + } + + template<class SigArgs> struct sig { + // typedef typename detail::tuple_element_as_reference<0, SigArgs>::type type; + typedef typename boost::tuples::element<0, Args>::type type; + }; +}; + +// Do nothing -------------------------------------------------------- +class do_nothing_action {}; + +template<class Args> +class lambda_functor_base<do_nothing_action, Args> { + // Args args; +public: + // explicit lambda_functor_base(const Args& a) {} + lambda_functor_base() {} + + + template<class RET, CALL_TEMPLATE_ARGS> RET call(CALL_FORMAL_ARGS) const { + return CALL_USE_ARGS; + } + + template<class SigArgs> struct sig { typedef void type; }; +}; + + +// These specializations provide a shorter notation to define actions. +// These lambda_functor_base instances take care of the recursive evaluation +// of the arguments and pass the evaluated arguments to the apply function +// of an action class. To make action X work with these classes, one must +// instantiate the lambda_functor_base as: +// lambda_functor_base<action<ARITY, X>, Args> +// Where ARITY is the arity of the apply function in X + +// The return type is queried as: +// return_type_N<X, EvaluatedArgumentTypes>::type +// for which there must be a specialization. + +// Function actions, casts, throws,... all go via these classes. + + +template<class Act, class Args> +class lambda_functor_base<action<0, Act>, Args> +{ +public: +// Args args; not needed + explicit lambda_functor_base(const Args& /*a*/) {} + + template<class SigArgs> struct sig { + typedef typename return_type_N<Act, null_type>::type type; + }; + + template<class RET, CALL_TEMPLATE_ARGS> + RET call(CALL_FORMAL_ARGS) const { + CALL_USE_ARGS; + return Act::template apply<RET>(); + } +}; + + +#if defined BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART +#error "Multiple defines of BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART" +#endif + + +#define BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART(ARITY) \ +template<class Act, class Args> \ +class lambda_functor_base<action<ARITY, Act>, Args> \ +{ \ +public: \ + Args args; \ + \ + explicit lambda_functor_base(const Args& a) : args(a) {} \ + \ + template<class SigArgs> struct sig { \ + typedef typename \ + detail::deduce_argument_types<Args, SigArgs>::type rets_t; \ + public: \ + typedef typename \ + return_type_N_prot<Act, rets_t>::type type; \ + }; \ + \ + \ + template<class RET, CALL_TEMPLATE_ARGS> \ + RET call(CALL_FORMAL_ARGS) const { \ + using boost::tuples::get; \ + using detail::constify_rvals; \ + using detail::r_select; \ + using detail::element_or_null; \ + using detail::deduce_argument_types; + +BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART(1) + + typedef typename + deduce_argument_types<Args, tuple<CALL_REFERENCE_TYPES> >::type rets_t; + typedef typename element_or_null<0, rets_t>::type rt0; + + return Act::template apply<RET>( + constify_rvals<rt0>::go(r_select<rt0>::go(get<0>(args), CALL_ACTUAL_ARGS)) + ); + } +}; + + +BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART(2) + + typedef typename + deduce_argument_types<Args, tuple<CALL_REFERENCE_TYPES> >::type rets_t; + typedef typename element_or_null<0, rets_t>::type rt0; + typedef typename element_or_null<1, rets_t>::type rt1; + + return Act::template apply<RET>( + constify_rvals<rt0>::go(r_select<rt0>::go(get<0>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt1>::go(r_select<rt1>::go(get<1>(args), CALL_ACTUAL_ARGS)) + ); + } +}; + +BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART(3) + + typedef typename + deduce_argument_types<Args, tuple<CALL_REFERENCE_TYPES> >::type rets_t; + + typedef typename element_or_null<0, rets_t>::type rt0; + typedef typename element_or_null<1, rets_t>::type rt1; + typedef typename element_or_null<2, rets_t>::type rt2; + + return Act::template apply<RET>( + constify_rvals<rt0>::go(r_select<rt0>::go(get<0>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt1>::go(r_select<rt1>::go(get<1>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt2>::go(r_select<rt2>::go(get<2>(args), CALL_ACTUAL_ARGS)) + ); + } +}; + +BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART(4) + typedef typename + deduce_argument_types<Args, tuple<CALL_REFERENCE_TYPES> >::type rets_t; + typedef typename element_or_null<0, rets_t>::type rt0; + typedef typename element_or_null<1, rets_t>::type rt1; + typedef typename element_or_null<2, rets_t>::type rt2; + typedef typename element_or_null<3, rets_t>::type rt3; + + return Act::template apply<RET>( + constify_rvals<rt0>::go(r_select<rt0>::go(get<0>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt1>::go(r_select<rt1>::go(get<1>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt2>::go(r_select<rt2>::go(get<2>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt3>::go(r_select<rt3>::go(get<3>(args), CALL_ACTUAL_ARGS)) + ); + } +}; + +BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART(5) + typedef typename + deduce_argument_types<Args, tuple<CALL_REFERENCE_TYPES> >::type rets_t; + typedef typename element_or_null<0, rets_t>::type rt0; + typedef typename element_or_null<1, rets_t>::type rt1; + typedef typename element_or_null<2, rets_t>::type rt2; + typedef typename element_or_null<3, rets_t>::type rt3; + typedef typename element_or_null<4, rets_t>::type rt4; + + return Act::template apply<RET>( + constify_rvals<rt0>::go(r_select<rt0>::go(get<0>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt1>::go(r_select<rt1>::go(get<1>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt2>::go(r_select<rt2>::go(get<2>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt3>::go(r_select<rt3>::go(get<3>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt4>::go(r_select<rt4>::go(get<4>(args), CALL_ACTUAL_ARGS)) + ); + } +}; + +BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART(6) + + typedef typename + deduce_argument_types<Args, tuple<CALL_REFERENCE_TYPES> >::type rets_t; + typedef typename element_or_null<0, rets_t>::type rt0; + typedef typename element_or_null<1, rets_t>::type rt1; + typedef typename element_or_null<2, rets_t>::type rt2; + typedef typename element_or_null<3, rets_t>::type rt3; + typedef typename element_or_null<4, rets_t>::type rt4; + typedef typename element_or_null<5, rets_t>::type rt5; + + + return Act::template apply<RET>( + constify_rvals<rt0>::go(r_select<rt0>::go(get<0>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt1>::go(r_select<rt1>::go(get<1>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt2>::go(r_select<rt2>::go(get<2>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt3>::go(r_select<rt3>::go(get<3>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt4>::go(r_select<rt4>::go(get<4>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt5>::go(r_select<rt5>::go(get<5>(args), CALL_ACTUAL_ARGS)) + ); + } +}; + +BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART(7) + typedef typename + deduce_argument_types<Args, tuple<CALL_REFERENCE_TYPES> >::type rets_t; + typedef typename element_or_null<0, rets_t>::type rt0; + typedef typename element_or_null<1, rets_t>::type rt1; + typedef typename element_or_null<2, rets_t>::type rt2; + typedef typename element_or_null<3, rets_t>::type rt3; + typedef typename element_or_null<4, rets_t>::type rt4; + typedef typename element_or_null<5, rets_t>::type rt5; + typedef typename element_or_null<6, rets_t>::type rt6; + + + return Act::template apply<RET>( + constify_rvals<rt0>::go(r_select<rt0>::go(get<0>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt1>::go(r_select<rt1>::go(get<1>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt2>::go(r_select<rt2>::go(get<2>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt3>::go(r_select<rt3>::go(get<3>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt4>::go(r_select<rt4>::go(get<4>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt5>::go(r_select<rt5>::go(get<5>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt6>::go(r_select<rt6>::go(get<6>(args), CALL_ACTUAL_ARGS)) + ); + } +}; + +BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART(8) + typedef typename + deduce_argument_types<Args, tuple<CALL_REFERENCE_TYPES> >::type rets_t; + typedef typename element_or_null<0, rets_t>::type rt0; + typedef typename element_or_null<1, rets_t>::type rt1; + typedef typename element_or_null<2, rets_t>::type rt2; + typedef typename element_or_null<3, rets_t>::type rt3; + typedef typename element_or_null<4, rets_t>::type rt4; + typedef typename element_or_null<5, rets_t>::type rt5; + typedef typename element_or_null<6, rets_t>::type rt6; + typedef typename element_or_null<7, rets_t>::type rt7; + + return Act::template apply<RET>( + constify_rvals<rt0>::go(r_select<rt0>::go(get<0>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt1>::go(r_select<rt1>::go(get<1>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt2>::go(r_select<rt2>::go(get<2>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt3>::go(r_select<rt3>::go(get<3>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt4>::go(r_select<rt4>::go(get<4>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt5>::go(r_select<rt5>::go(get<5>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt6>::go(r_select<rt6>::go(get<6>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt7>::go(r_select<rt7>::go(get<7>(args), CALL_ACTUAL_ARGS)) + ); + } +}; + +BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART(9) + typedef typename + deduce_argument_types<Args, tuple<CALL_REFERENCE_TYPES> >::type rets_t; + typedef typename element_or_null<0, rets_t>::type rt0; + typedef typename element_or_null<1, rets_t>::type rt1; + typedef typename element_or_null<2, rets_t>::type rt2; + typedef typename element_or_null<3, rets_t>::type rt3; + typedef typename element_or_null<4, rets_t>::type rt4; + typedef typename element_or_null<5, rets_t>::type rt5; + typedef typename element_or_null<6, rets_t>::type rt6; + typedef typename element_or_null<7, rets_t>::type rt7; + typedef typename element_or_null<8, rets_t>::type rt8; + + return Act::template apply<RET>( + constify_rvals<rt0>::go(r_select<rt0>::go(get<0>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt1>::go(r_select<rt1>::go(get<1>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt2>::go(r_select<rt2>::go(get<2>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt3>::go(r_select<rt3>::go(get<3>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt4>::go(r_select<rt4>::go(get<4>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt5>::go(r_select<rt5>::go(get<5>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt6>::go(r_select<rt6>::go(get<6>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt7>::go(r_select<rt7>::go(get<7>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt8>::go(r_select<rt8>::go(get<8>(args), CALL_ACTUAL_ARGS)) + ); + } +}; + +BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART(10) + typedef typename + deduce_argument_types<Args, tuple<CALL_REFERENCE_TYPES> >::type rets_t; + typedef typename element_or_null<0, rets_t>::type rt0; + typedef typename element_or_null<1, rets_t>::type rt1; + typedef typename element_or_null<2, rets_t>::type rt2; + typedef typename element_or_null<3, rets_t>::type rt3; + typedef typename element_or_null<4, rets_t>::type rt4; + typedef typename element_or_null<5, rets_t>::type rt5; + typedef typename element_or_null<6, rets_t>::type rt6; + typedef typename element_or_null<7, rets_t>::type rt7; + typedef typename element_or_null<8, rets_t>::type rt8; + typedef typename element_or_null<9, rets_t>::type rt9; + + return Act::template apply<RET>( + constify_rvals<rt0>::go(r_select<rt0>::go(get<0>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt1>::go(r_select<rt1>::go(get<1>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt2>::go(r_select<rt2>::go(get<2>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt3>::go(r_select<rt3>::go(get<3>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt4>::go(r_select<rt4>::go(get<4>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt5>::go(r_select<rt5>::go(get<5>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt6>::go(r_select<rt6>::go(get<6>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt7>::go(r_select<rt7>::go(get<7>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt8>::go(r_select<rt8>::go(get<8>(args), CALL_ACTUAL_ARGS)), + constify_rvals<rt9>::go(r_select<rt9>::go(get<9>(args), CALL_ACTUAL_ARGS)) + ); + } +}; + +#undef BOOST_LAMBDA_LAMBDA_FUNCTOR_BASE_FIRST_PART + + +} // namespace lambda +} // namespace boost + +#endif diff --git a/3rdParty/Boost/src/boost/lambda/detail/lambda_functors.hpp b/3rdParty/Boost/src/boost/lambda/detail/lambda_functors.hpp new file mode 100644 index 0000000..9b1b082 --- /dev/null +++ b/3rdParty/Boost/src/boost/lambda/detail/lambda_functors.hpp @@ -0,0 +1,324 @@ +// Boost Lambda Library - lambda_functors.hpp ------------------------------- + +// Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi) +// +// 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) +// +// For more information, see http://www.boost.org + +// ------------------------------------------------ + +#ifndef BOOST_LAMBDA_LAMBDA_FUNCTORS_HPP +#define BOOST_LAMBDA_LAMBDA_FUNCTORS_HPP + +#include <boost/config.hpp> +#include <boost/detail/workaround.hpp> + +#if BOOST_WORKAROUND(BOOST_MSVC, == 1310) + +#include <boost/mpl/or.hpp> +#include <boost/utility/enable_if.hpp> +#include <boost/type_traits/is_array.hpp> + +#define BOOST_LAMBDA_DISABLE_IF_ARRAY1(A1, R1)\ + typename lazy_disable_if<is_array<A1>, typename R1 >::type +#define BOOST_LAMBDA_DISABLE_IF_ARRAY2(A1, A2, R1, R2) \ + typename lazy_disable_if<mpl::or_<is_array<A1>, is_array<A2> >, typename R1, R2 >::type +#define BOOST_LAMBDA_DISABLE_IF_ARRAY3(A1, A2, A3, R1, R2, R3) \ + typename lazy_disable_if<mpl::or_<is_array<A1>, is_array<A2>, is_array<A3> >, typename R1, R2, R3 >::type + +#else + +#define BOOST_LAMBDA_DISABLE_IF_ARRAY1(A1, R1) typename R1::type +#define BOOST_LAMBDA_DISABLE_IF_ARRAY2(A1, A2, R1, R2) typename R1, R2::type +#define BOOST_LAMBDA_DISABLE_IF_ARRAY3(A1, A2, A3, R1, R2, R3) typename R1, R2, R3::type + +#endif + +namespace boost { +namespace lambda { + +// -- lambda_functor -------------------------------------------- +// -------------------------------------------------------------- + +//inline const null_type const_null_type() { return null_type(); } + +namespace detail { +namespace { + + static const null_type constant_null_type = null_type(); + +} // unnamed +} // detail + +class unused {}; + +#define cnull_type() detail::constant_null_type + +// -- free variables types -------------------------------------------------- + + // helper to work around the case where the nullary return type deduction + // is always performed, even though the functor is not nullary +namespace detail { + template<int N, class Tuple> struct get_element_or_null_type { + typedef typename + detail::tuple_element_as_reference<N, Tuple>::type type; + }; + template<int N> struct get_element_or_null_type<N, null_type> { + typedef null_type type; + }; +} + +template <int I> struct placeholder; + +template<> struct placeholder<FIRST> { + + template<class SigArgs> struct sig { + typedef typename detail::get_element_or_null_type<0, SigArgs>::type type; + }; + + template<class RET, CALL_TEMPLATE_ARGS> + RET call(CALL_FORMAL_ARGS) const { + BOOST_STATIC_ASSERT(boost::is_reference<RET>::value); + CALL_USE_ARGS; // does nothing, prevents warnings for unused args + return a; + } +}; + +template<> struct placeholder<SECOND> { + + template<class SigArgs> struct sig { + typedef typename detail::get_element_or_null_type<1, SigArgs>::type type; + }; + + template<class RET, CALL_TEMPLATE_ARGS> + RET call(CALL_FORMAL_ARGS) const { CALL_USE_ARGS; return b; } +}; + +template<> struct placeholder<THIRD> { + + template<class SigArgs> struct sig { + typedef typename detail::get_element_or_null_type<2, SigArgs>::type type; + }; + + template<class RET, CALL_TEMPLATE_ARGS> + RET call(CALL_FORMAL_ARGS) const { CALL_USE_ARGS; return c; } +}; + +template<> struct placeholder<EXCEPTION> { + + template<class SigArgs> struct sig { + typedef typename detail::get_element_or_null_type<3, SigArgs>::type type; + }; + + template<class RET, CALL_TEMPLATE_ARGS> + RET call(CALL_FORMAL_ARGS) const { CALL_USE_ARGS; return env; } +}; + +typedef const lambda_functor<placeholder<FIRST> > placeholder1_type; +typedef const lambda_functor<placeholder<SECOND> > placeholder2_type; +typedef const lambda_functor<placeholder<THIRD> > placeholder3_type; + + +/////////////////////////////////////////////////////////////////////////////// + + +// free variables are lambda_functors. This is to allow uniform handling with +// other lambda_functors. +// ------------------------------------------------------------------- + +#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) +#pragma warning(push) +#pragma warning(disable:4512) //assignment operator could not be generated +#endif + +// -- lambda_functor NONE ------------------------------------------------ +template <class T> +class lambda_functor : public T +{ + +BOOST_STATIC_CONSTANT(int, arity_bits = get_arity<T>::value); + +public: + typedef T inherited; + + lambda_functor() {} + lambda_functor(const lambda_functor& l) : inherited(l) {} + + lambda_functor(const T& t) : inherited(t) {} + + template <class SigArgs> struct sig { + typedef typename inherited::template + sig<typename SigArgs::tail_type>::type type; + }; + + // Note that this return type deduction template is instantiated, even + // if the nullary + // operator() is not called at all. One must make sure that it does not fail. + typedef typename + inherited::template sig<null_type>::type + nullary_return_type; + + // Support for boost::result_of. + template <class Sig> struct result; + template <class F> + struct result<F()> { + typedef nullary_return_type type; + }; + template <class F, class A> + struct result<F(A)> { + typedef typename sig<tuple<F, A> >::type type; + }; + template <class F, class A, class B> + struct result<F(A, B)> { + typedef typename sig<tuple<F, A, B> >::type type; + }; + template <class F, class A, class B, class C> + struct result<F(A, B, C)> { + typedef typename sig<tuple<F, A, B, C> >::type type; + }; + + nullary_return_type operator()() const { + return inherited::template + call<nullary_return_type> + (cnull_type(), cnull_type(), cnull_type(), cnull_type()); + } + + template<class A> + typename inherited::template sig<tuple<A&> >::type + operator()(A& a) const { + return inherited::template call< + typename inherited::template sig<tuple<A&> >::type + >(a, cnull_type(), cnull_type(), cnull_type()); + } + + template<class A> + BOOST_LAMBDA_DISABLE_IF_ARRAY1(A, inherited::template sig<tuple<A const&> >) + operator()(A const& a) const { + return inherited::template call< + typename inherited::template sig<tuple<A const&> >::type + >(a, cnull_type(), cnull_type(), cnull_type()); + } + + template<class A, class B> + typename inherited::template sig<tuple<A&, B&> >::type + operator()(A& a, B& b) const { + return inherited::template call< + typename inherited::template sig<tuple<A&, B&> >::type + >(a, b, cnull_type(), cnull_type()); + } + + template<class A, class B> + BOOST_LAMBDA_DISABLE_IF_ARRAY2(A, B, inherited::template sig<tuple<A const&, B&> >) + operator()(A const& a, B& b) const { + return inherited::template call< + typename inherited::template sig<tuple<A const&, B&> >::type + >(a, b, cnull_type(), cnull_type()); + } + + template<class A, class B> + BOOST_LAMBDA_DISABLE_IF_ARRAY2(A, B, inherited::template sig<tuple<A&, B const&> >) + operator()(A& a, B const& b) const { + return inherited::template call< + typename inherited::template sig<tuple<A&, B const&> >::type + >(a, b, cnull_type(), cnull_type()); + } + + template<class A, class B> + BOOST_LAMBDA_DISABLE_IF_ARRAY2(A, B, inherited::template sig<tuple<A const&, B const&> >) + operator()(A const& a, B const& b) const { + return inherited::template call< + typename inherited::template sig<tuple<A const&, B const&> >::type + >(a, b, cnull_type(), cnull_type()); + } + + template<class A, class B, class C> + typename inherited::template sig<tuple<A&, B&, C&> >::type + operator()(A& a, B& b, C& c) const + { + return inherited::template call< + typename inherited::template sig<tuple<A&, B&, C&> >::type + >(a, b, c, cnull_type()); + } + + template<class A, class B, class C> + BOOST_LAMBDA_DISABLE_IF_ARRAY3(A, B, C, inherited::template sig<tuple<A const&, B const&, C const&> >) + operator()(A const& a, B const& b, C const& c) const + { + return inherited::template call< + typename inherited::template sig<tuple<A const&, B const&, C const&> >::type + >(a, b, c, cnull_type()); + } + + // for internal calls with env + template<CALL_TEMPLATE_ARGS> + typename inherited::template sig<tuple<CALL_REFERENCE_TYPES> >::type + internal_call(CALL_FORMAL_ARGS) const { + return inherited::template + call<typename inherited::template + sig<tuple<CALL_REFERENCE_TYPES> >::type>(CALL_ACTUAL_ARGS); + } + + template<class A> + const lambda_functor<lambda_functor_base< + other_action<assignment_action>, + boost::tuple<lambda_functor, + typename const_copy_argument <const A>::type> > > + operator=(const A& a) const { + return lambda_functor_base< + other_action<assignment_action>, + boost::tuple<lambda_functor, + typename const_copy_argument <const A>::type> > + ( boost::tuple<lambda_functor, + typename const_copy_argument <const A>::type>(*this, a) ); + } + + template<class A> + const lambda_functor<lambda_functor_base< + other_action<subscript_action>, + boost::tuple<lambda_functor, + typename const_copy_argument <const A>::type> > > + operator[](const A& a) const { + return lambda_functor_base< + other_action<subscript_action>, + boost::tuple<lambda_functor, + typename const_copy_argument <const A>::type> > + ( boost::tuple<lambda_functor, + typename const_copy_argument <const A>::type>(*this, a ) ); + } +}; + +#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) +#pragma warning(pop) +#endif + +} // namespace lambda +} // namespace boost + +// is_placeholder + +#include <boost/is_placeholder.hpp> + +namespace boost +{ + +template<> struct is_placeholder< lambda::lambda_functor< lambda::placeholder<lambda::FIRST> > > +{ + enum _vt { value = 1 }; +}; + +template<> struct is_placeholder< lambda::lambda_functor< lambda::placeholder<lambda::SECOND> > > +{ + enum _vt { value = 2 }; +}; + +template<> struct is_placeholder< lambda::lambda_functor< lambda::placeholder<lambda::THIRD> > > +{ + enum _vt { value = 3 }; +}; + +} // namespace boost + +#endif diff --git a/3rdParty/Boost/src/boost/lambda/detail/lambda_fwd.hpp b/3rdParty/Boost/src/boost/lambda/detail/lambda_fwd.hpp new file mode 100644 index 0000000..a27bfad --- /dev/null +++ b/3rdParty/Boost/src/boost/lambda/detail/lambda_fwd.hpp @@ -0,0 +1,74 @@ +// lambda_fwd.hpp - Boost Lambda Library ------------------------------- + +// Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi) +// +// 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) +// +// For more information, see www.boost.org + +// ------------------------------------------------------- + +#ifndef BOOST_LAMBDA_FWD_HPP +#define BOOST_LAMBDA_FWD_HPP + +namespace boost { +namespace lambda { + +namespace detail { + +template<class T> struct generate_error; + +} +// -- placeholders -------------------------------------------- + +template <int I> struct placeholder; + +// function_adaptors +template <class Func> +struct function_adaptor; + +template <int I, class Act> class action; + +template <class Base> +class lambda_functor; + +template <class Act, class Args> +class lambda_functor_base; + +} // namespace lambda +} // namespace boost + + +// #define CALL_TEMPLATE_ARGS class A, class Env +// #define CALL_FORMAL_ARGS A& a, Env& env +// #define CALL_ACTUAL_ARGS a, env +// #define CALL_ACTUAL_ARGS_NO_ENV a +// #define CALL_REFERENCE_TYPES A&, Env& +// #define CALL_PLAIN_TYPES A, Env +#define CALL_TEMPLATE_ARGS class A, class B, class C, class Env +#define CALL_FORMAL_ARGS A& a, B& b, C& c, Env& env +#define CALL_ACTUAL_ARGS a, b, c, env +#define CALL_ACTUAL_ARGS_NO_ENV a, b, c +#define CALL_REFERENCE_TYPES A&, B&, C&, Env& +#define CALL_PLAIN_TYPES A, B, C, Env + +namespace boost { +namespace lambda { +namespace detail { + +template<class A1, class A2, class A3, class A4> +void do_nothing(A1&, A2&, A3&, A4&) {} + +} // detail +} // lambda +} // boost + +// prevent the warnings from unused arguments +#define CALL_USE_ARGS \ +::boost::lambda::detail::do_nothing(a, b, c, env) + + + +#endif diff --git a/3rdParty/Boost/src/boost/lambda/detail/lambda_traits.hpp b/3rdParty/Boost/src/boost/lambda/detail/lambda_traits.hpp new file mode 100644 index 0000000..f35fa09 --- /dev/null +++ b/3rdParty/Boost/src/boost/lambda/detail/lambda_traits.hpp @@ -0,0 +1,578 @@ +// - lambda_traits.hpp --- Boost Lambda Library ---------------------------- +// +// Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi) +// +// 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) +// +// For more information, see www.boost.org +// ------------------------------------------------------------------------- + +#ifndef BOOST_LAMBDA_LAMBDA_TRAITS_HPP +#define BOOST_LAMBDA_LAMBDA_TRAITS_HPP + +#include "boost/type_traits/transform_traits.hpp" +#include "boost/type_traits/cv_traits.hpp" +#include "boost/type_traits/function_traits.hpp" +#include "boost/type_traits/object_traits.hpp" +#include "boost/tuple/tuple.hpp" + +namespace boost { +namespace lambda { + +// -- if construct ------------------------------------------------ +// Proposed by Krzysztof Czarnecki and Ulrich Eisenecker + +namespace detail { + +template <bool If, class Then, class Else> struct IF { typedef Then RET; }; + +template <class Then, class Else> struct IF<false, Then, Else> { + typedef Else RET; +}; + + +// An if construct that doesn't instantiate the non-matching template: + +// Called as: +// IF_type<condition, A, B>::type +// The matching template must define the typeded 'type' +// I.e. A::type if condition is true, B::type if condition is false +// Idea from Vesa Karvonen (from C&E as well I guess) +template<class T> +struct IF_type_ +{ + typedef typename T::type type; +}; + + +template<bool C, class T, class E> +struct IF_type +{ + typedef typename + IF_type_<typename IF<C, T, E>::RET >::type type; +}; + +// helper that can be used to give typedef T to some type +template <class T> struct identity_mapping { typedef T type; }; + +// An if construct for finding an integral constant 'value' +// Does not instantiate the non-matching branch +// Called as IF_value<condition, A, B>::value +// If condition is true A::value must be defined, otherwise B::value + +template<class T> +struct IF_value_ +{ + BOOST_STATIC_CONSTANT(int, value = T::value); +}; + + +template<bool C, class T, class E> +struct IF_value +{ + BOOST_STATIC_CONSTANT(int, value = (IF_value_<typename IF<C, T, E>::RET>::value)); +}; + + +// -------------------------------------------------------------- + +// removes reference from other than function types: +template<class T> class remove_reference_if_valid +{ + + typedef typename boost::remove_reference<T>::type plainT; +public: + typedef typename IF< + boost::is_function<plainT>::value, + T, + plainT + >::RET type; + +}; + + +template<class T> struct remove_reference_and_cv { + typedef typename boost::remove_cv< + typename boost::remove_reference<T>::type + >::type type; +}; + + + +// returns a reference to the element of tuple T +template<int N, class T> struct tuple_element_as_reference { + typedef typename + boost::tuples::access_traits< + typename boost::tuples::element<N, T>::type + >::non_const_type type; +}; + +// returns the cv and reverence stripped type of a tuple element +template<int N, class T> struct tuple_element_stripped { + typedef typename + remove_reference_and_cv< + typename boost::tuples::element<N, T>::type + >::type type; +}; + +// is_lambda_functor ------------------------------------------------- + +template <class T> struct is_lambda_functor_ { + BOOST_STATIC_CONSTANT(bool, value = false); +}; + +template <class Arg> struct is_lambda_functor_<lambda_functor<Arg> > { + BOOST_STATIC_CONSTANT(bool, value = true); +}; + +} // end detail + + +template <class T> struct is_lambda_functor { + BOOST_STATIC_CONSTANT(bool, + value = + detail::is_lambda_functor_< + typename detail::remove_reference_and_cv<T>::type + >::value); +}; + + +namespace detail { + +// -- parameter_traits_ --------------------------------------------- + +// An internal parameter type traits class that respects +// the reference_wrapper class. + +// The conversions performed are: +// references -> compile_time_error +// T1 -> T2, +// reference_wrapper<T> -> T& +// const array -> ref to const array +// array -> ref to array +// function -> ref to function + +// ------------------------------------------------------------------------ + +template<class T1, class T2> +struct parameter_traits_ { + typedef T2 type; +}; + +// Do not instantiate with reference types +template<class T, class Any> struct parameter_traits_<T&, Any> { + typedef typename + generate_error<T&>:: + parameter_traits_class_instantiated_with_reference_type type; +}; + +// Arrays can't be stored as plain types; convert them to references +template<class T, int n, class Any> struct parameter_traits_<T[n], Any> { + typedef T (&type)[n]; +}; + +template<class T, int n, class Any> +struct parameter_traits_<const T[n], Any> { + typedef const T (&type)[n]; +}; + +template<class T, int n, class Any> +struct parameter_traits_<volatile T[n], Any> { + typedef volatile T (&type)[n]; +}; +template<class T, int n, class Any> +struct parameter_traits_<const volatile T[n], Any> { + typedef const volatile T (&type)[n]; +}; + + +template<class T, class Any> +struct parameter_traits_<boost::reference_wrapper<T>, Any >{ + typedef T& type; +}; + +template<class T, class Any> +struct parameter_traits_<const boost::reference_wrapper<T>, Any >{ + typedef T& type; +}; + +template<class T, class Any> +struct parameter_traits_<volatile boost::reference_wrapper<T>, Any >{ + typedef T& type; +}; + +template<class T, class Any> +struct parameter_traits_<const volatile boost::reference_wrapper<T>, Any >{ + typedef T& type; +}; + +template<class Any> +struct parameter_traits_<void, Any> { + typedef void type; +}; + +template<class Arg, class Any> +struct parameter_traits_<lambda_functor<Arg>, Any > { + typedef lambda_functor<Arg> type; +}; + +template<class Arg, class Any> +struct parameter_traits_<const lambda_functor<Arg>, Any > { + typedef lambda_functor<Arg> type; +}; + +// Are the volatile versions needed? +template<class Arg, class Any> +struct parameter_traits_<volatile lambda_functor<Arg>, Any > { + typedef lambda_functor<Arg> type; +}; + +template<class Arg, class Any> +struct parameter_traits_<const volatile lambda_functor<Arg>, Any > { + typedef lambda_functor<Arg> type; +}; + +} // end namespace detail + + +// ------------------------------------------------------------------------ +// traits classes for lambda expressions (bind functions, operators ...) + +// must be instantiated with non-reference types + +// The default is const plain type ------------------------- +// const T -> const T, +// T -> const T, +// references -> compile_time_error +// reference_wrapper<T> -> T& +// array -> const ref array +template<class T> +struct const_copy_argument { + typedef typename + detail::parameter_traits_< + T, + typename detail::IF<boost::is_function<T>::value, T&, const T>::RET + >::type type; +}; + +// T may be a function type. Without the IF test, const would be added +// to a function type, which is illegal. + +// all arrays are converted to const. +// This traits template is used for 'const T&' parameter passing +// and thus the knowledge of the potential +// non-constness of an actual argument is lost. +template<class T, int n> struct const_copy_argument <T[n]> { + typedef const T (&type)[n]; +}; +template<class T, int n> struct const_copy_argument <volatile T[n]> { + typedef const volatile T (&type)[n]; +}; + +template<class T> +struct const_copy_argument<T&> {}; +// do not instantiate with references + // typedef typename detail::generate_error<T&>::references_not_allowed type; + + +template<> +struct const_copy_argument<void> { + typedef void type; +}; + + +// Does the same as const_copy_argument, but passes references through as such +template<class T> +struct bound_argument_conversion { + typedef typename const_copy_argument<T>::type type; +}; + +template<class T> +struct bound_argument_conversion<T&> { + typedef T& type; +}; + +// The default is non-const reference ------------------------- +// const T -> const T&, +// T -> T&, +// references -> compile_time_error +// reference_wrapper<T> -> T& +template<class T> +struct reference_argument { + typedef typename detail::parameter_traits_<T, T&>::type type; +}; + +template<class T> +struct reference_argument<T&> { + typedef typename detail::generate_error<T&>::references_not_allowed type; +}; + +template<class Arg> +struct reference_argument<lambda_functor<Arg> > { + typedef lambda_functor<Arg> type; +}; + +template<class Arg> +struct reference_argument<const lambda_functor<Arg> > { + typedef lambda_functor<Arg> type; +}; + +// Are the volatile versions needed? +template<class Arg> +struct reference_argument<volatile lambda_functor<Arg> > { + typedef lambda_functor<Arg> type; +}; + +template<class Arg> +struct reference_argument<const volatile lambda_functor<Arg> > { + typedef lambda_functor<Arg> type; +}; + +template<> +struct reference_argument<void> { + typedef void type; +}; + +namespace detail { + +// Array to pointer conversion +template <class T> +struct array_to_pointer { + typedef T type; +}; + +template <class T, int N> +struct array_to_pointer <const T[N]> { + typedef const T* type; +}; +template <class T, int N> +struct array_to_pointer <T[N]> { + typedef T* type; +}; + +template <class T, int N> +struct array_to_pointer <const T (&) [N]> { + typedef const T* type; +}; +template <class T, int N> +struct array_to_pointer <T (&) [N]> { + typedef T* type; +}; + + +// --------------------------------------------------------------------------- +// The call_traits for bind +// Respects the reference_wrapper class. + +// These templates are used outside of bind functions as well. +// the bind_tuple_mapper provides a shorter notation for default +// bound argument storing semantics, if all arguments are treated +// uniformly. + +// from template<class T> foo(const T& t) : bind_traits<const T>::type +// from template<class T> foo(T& t) : bind_traits<T>::type + +// Conversions: +// T -> const T, +// cv T -> cv T, +// T& -> T& +// reference_wrapper<T> -> T& +// const reference_wrapper<T> -> T& +// array -> const ref array + +// make bound arguments const, this is a deliberate design choice, the +// purpose is to prevent side effects to bound arguments that are stored +// as copies +template<class T> +struct bind_traits { + typedef const T type; +}; + +template<class T> +struct bind_traits<T&> { + typedef T& type; +}; + +// null_types are an exception, we always want to store them as non const +// so that other templates can assume that null_type is always without const +template<> +struct bind_traits<null_type> { + typedef null_type type; +}; + +// the bind_tuple_mapper, bind_type_generators may +// introduce const to null_type +template<> +struct bind_traits<const null_type> { + typedef null_type type; +}; + +// Arrays can't be stored as plain types; convert them to references. +// All arrays are converted to const. This is because bind takes its +// parameters as const T& and thus the knowledge of the potential +// non-constness of actual argument is lost. +template<class T, int n> struct bind_traits <T[n]> { + typedef const T (&type)[n]; +}; + +template<class T, int n> +struct bind_traits<const T[n]> { + typedef const T (&type)[n]; +}; + +template<class T, int n> struct bind_traits<volatile T[n]> { + typedef const volatile T (&type)[n]; +}; + +template<class T, int n> +struct bind_traits<const volatile T[n]> { + typedef const volatile T (&type)[n]; +}; + +template<class R> +struct bind_traits<R()> { + typedef R(&type)(); +}; + +template<class R, class Arg1> +struct bind_traits<R(Arg1)> { + typedef R(&type)(Arg1); +}; + +template<class R, class Arg1, class Arg2> +struct bind_traits<R(Arg1, Arg2)> { + typedef R(&type)(Arg1, Arg2); +}; + +template<class R, class Arg1, class Arg2, class Arg3> +struct bind_traits<R(Arg1, Arg2, Arg3)> { + typedef R(&type)(Arg1, Arg2, Arg3); +}; + +template<class R, class Arg1, class Arg2, class Arg3, class Arg4> +struct bind_traits<R(Arg1, Arg2, Arg3, Arg4)> { + typedef R(&type)(Arg1, Arg2, Arg3, Arg4); +}; + +template<class R, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5> +struct bind_traits<R(Arg1, Arg2, Arg3, Arg4, Arg5)> { + typedef R(&type)(Arg1, Arg2, Arg3, Arg4, Arg5); +}; + +template<class R, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6> +struct bind_traits<R(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6)> { + typedef R(&type)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6); +}; + +template<class R, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7> +struct bind_traits<R(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7)> { + typedef R(&type)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7); +}; + +template<class R, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7, class Arg8> +struct bind_traits<R(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8)> { + typedef R(&type)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8); +}; + +template<class R, class Arg1, class Arg2, class Arg3, class Arg4, class Arg5, class Arg6, class Arg7, class Arg8, class Arg9> +struct bind_traits<R(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9)> { + typedef R(&type)(Arg1, Arg2, Arg3, Arg4, Arg5, Arg6, Arg7, Arg8, Arg9); +}; + +template<class T> +struct bind_traits<reference_wrapper<T> >{ + typedef T& type; +}; + +template<class T> +struct bind_traits<const reference_wrapper<T> >{ + typedef T& type; +}; + +template<> +struct bind_traits<void> { + typedef void type; +}; + + + +template < + class T0 = null_type, class T1 = null_type, class T2 = null_type, + class T3 = null_type, class T4 = null_type, class T5 = null_type, + class T6 = null_type, class T7 = null_type, class T8 = null_type, + class T9 = null_type +> +struct bind_tuple_mapper { + typedef + tuple<typename bind_traits<T0>::type, + typename bind_traits<T1>::type, + typename bind_traits<T2>::type, + typename bind_traits<T3>::type, + typename bind_traits<T4>::type, + typename bind_traits<T5>::type, + typename bind_traits<T6>::type, + typename bind_traits<T7>::type, + typename bind_traits<T8>::type, + typename bind_traits<T9>::type> type; +}; + +// bind_traits, except map const T& -> const T + // this is needed e.g. in currying. Const reference arguments can + // refer to temporaries, so it is not safe to store them as references. + template <class T> struct remove_const_reference { + typedef typename bind_traits<T>::type type; + }; + + template <class T> struct remove_const_reference<const T&> { + typedef const T type; + }; + + +// maps the bind argument types to the resulting lambda functor type +template < + class T0 = null_type, class T1 = null_type, class T2 = null_type, + class T3 = null_type, class T4 = null_type, class T5 = null_type, + class T6 = null_type, class T7 = null_type, class T8 = null_type, + class T9 = null_type +> +class bind_type_generator { + + typedef typename + detail::bind_tuple_mapper< + T0, T1, T2, T3, T4, T5, T6, T7, T8, T9 + >::type args_t; + + BOOST_STATIC_CONSTANT(int, nof_elems = boost::tuples::length<args_t>::value); + + typedef + action< + nof_elems, + function_action<nof_elems> + > action_type; + +public: + typedef + lambda_functor< + lambda_functor_base< + action_type, + args_t + > + > type; + +}; + + + +} // detail + +template <class T> inline const T& make_const(const T& t) { return t; } + + +} // end of namespace lambda +} // end of namespace boost + + + +#endif // BOOST_LAMBDA_TRAITS_HPP diff --git a/3rdParty/Boost/src/boost/lambda/detail/member_ptr.hpp b/3rdParty/Boost/src/boost/lambda/detail/member_ptr.hpp new file mode 100644 index 0000000..288f70c --- /dev/null +++ b/3rdParty/Boost/src/boost/lambda/detail/member_ptr.hpp @@ -0,0 +1,737 @@ +// Boost Lambda Library -- member_ptr.hpp --------------------- + +// Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi) +// Copyright (C) 2000 Gary Powell (gary.powell@sierra.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) +// +// For more information, see www.boost.org + +// -------------------------------------------------------------------------- + +#if !defined(BOOST_LAMBDA_MEMBER_PTR_HPP) +#define BOOST_LAMBDA_MEMBER_PTR_HPP + +namespace boost { +namespace lambda { + + +class member_pointer_action {}; + + +namespace detail { + +// the boost type_traits member_pointer traits are not enough, +// need to know more details. +template<class T> +struct member_pointer { + typedef typename boost::add_reference<T>::type type; + typedef detail::unspecified class_type; + typedef detail::unspecified qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = false); +}; + +template<class T, class U> +struct member_pointer<T U::*> { + typedef typename boost::add_reference<T>::type type; + typedef U class_type; + typedef U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = true); + BOOST_STATIC_CONSTANT(bool, is_function_member = false); +}; + +template<class T, class U> +struct member_pointer<const T U::*> { + typedef typename boost::add_reference<const T>::type type; + typedef U class_type; + typedef const U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = true); + BOOST_STATIC_CONSTANT(bool, is_function_member = false); +}; + +template<class T, class U> +struct member_pointer<volatile T U::*> { + typedef typename boost::add_reference<volatile T>::type type; + typedef U class_type; + typedef volatile U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = true); + BOOST_STATIC_CONSTANT(bool, is_function_member = false); +}; + +template<class T, class U> +struct member_pointer<const volatile T U::*> { + typedef typename boost::add_reference<const volatile T>::type type; + typedef U class_type; + typedef const volatile U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = true); + BOOST_STATIC_CONSTANT(bool, is_function_member = false); +}; + +// -- nonconst member functions -- +template<class T, class U> +struct member_pointer<T (U::*)()> { + typedef T type; + typedef U class_type; + typedef U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1> +struct member_pointer<T (U::*)(A1)> { + typedef T type; + typedef U class_type; + typedef U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1, class A2> +struct member_pointer<T (U::*)(A1, A2)> { + typedef T type; + typedef U class_type; + typedef U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1, class A2, class A3> +struct member_pointer<T (U::*)(A1, A2, A3)> { + typedef T type; + typedef U class_type; + typedef U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1, class A2, class A3, class A4> +struct member_pointer<T (U::*)(A1, A2, A3, A4)> { + typedef T type; + typedef U class_type; + typedef U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1, class A2, class A3, class A4, class A5> +struct member_pointer<T (U::*)(A1, A2, A3, A4, A5)> { + typedef T type; + typedef U class_type; + typedef U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1, class A2, class A3, class A4, class A5, + class A6> +struct member_pointer<T (U::*)(A1, A2, A3, A4, A5, A6)> { + typedef T type; + typedef U class_type; + typedef U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1, class A2, class A3, class A4, class A5, + class A6, class A7> +struct member_pointer<T (U::*)(A1, A2, A3, A4, A5, A6, A7)> { + typedef T type; + typedef U class_type; + typedef U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1, class A2, class A3, class A4, class A5, + class A6, class A7, class A8> +struct member_pointer<T (U::*)(A1, A2, A3, A4, A5, A6, A7, A8)> { + typedef T type; + typedef U class_type; + typedef U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1, class A2, class A3, class A4, class A5, + class A6, class A7, class A8, class A9> +struct member_pointer<T (U::*)(A1, A2, A3, A4, A5, A6, A7, A8, A9)> { + typedef T type; + typedef U class_type; + typedef U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +// -- const member functions -- +template<class T, class U> +struct member_pointer<T (U::*)() const> { + typedef T type; + typedef U class_type; + typedef const U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1> +struct member_pointer<T (U::*)(A1) const> { + typedef T type; + typedef U class_type; + typedef const U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1, class A2> +struct member_pointer<T (U::*)(A1, A2) const> { + typedef T type; + typedef U class_type; + typedef const U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1, class A2, class A3> +struct member_pointer<T (U::*)(A1, A2, A3) const> { + typedef T type; + typedef U class_type; + typedef const U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1, class A2, class A3, class A4> +struct member_pointer<T (U::*)(A1, A2, A3, A4) const> { + typedef T type; + typedef U class_type; + typedef const U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1, class A2, class A3, class A4, class A5> +struct member_pointer<T (U::*)(A1, A2, A3, A4, A5) const> { + typedef T type; + typedef U class_type; + typedef const U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1, class A2, class A3, class A4, class A5, + class A6> +struct member_pointer<T (U::*)(A1, A2, A3, A4, A5, A6) const> { + typedef T type; + typedef U class_type; + typedef const U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1, class A2, class A3, class A4, class A5, + class A6, class A7> +struct member_pointer<T (U::*)(A1, A2, A3, A4, A5, A6, A7) const> { + typedef T type; + typedef U class_type; + typedef const U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1, class A2, class A3, class A4, class A5, + class A6, class A7, class A8> +struct member_pointer<T (U::*)(A1, A2, A3, A4, A5, A6, A7, A8) const> { + typedef T type; + typedef U class_type; + typedef const U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1, class A2, class A3, class A4, class A5, + class A6, class A7, class A8, class A9> +struct member_pointer<T (U::*)(A1, A2, A3, A4, A5, A6, A7, A8, A9) const> { + typedef T type; + typedef U class_type; + typedef const U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; + // -- volatile -- +template<class T, class U> +struct member_pointer<T (U::*)() volatile> { + typedef T type; + typedef U class_type; + typedef volatile U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1> +struct member_pointer<T (U::*)(A1) volatile> { + typedef T type; + typedef U class_type; + typedef volatile U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1, class A2> +struct member_pointer<T (U::*)(A1, A2) volatile> { + typedef T type; + typedef U class_type; + typedef volatile U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1, class A2, class A3> +struct member_pointer<T (U::*)(A1, A2, A3) volatile> { + typedef T type; + typedef U class_type; + typedef volatile U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1, class A2, class A3, class A4> +struct member_pointer<T (U::*)(A1, A2, A3, A4) volatile> { + typedef T type; + typedef U class_type; + typedef volatile U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1, class A2, class A3, class A4, class A5> +struct member_pointer<T (U::*)(A1, A2, A3, A4, A5) volatile> { + typedef T type; + typedef U class_type; + typedef volatile U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1, class A2, class A3, class A4, class A5, + class A6> +struct member_pointer<T (U::*)(A1, A2, A3, A4, A5, A6) volatile> { + typedef T type; + typedef U class_type; + typedef volatile U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1, class A2, class A3, class A4, class A5, + class A6, class A7> +struct member_pointer<T (U::*)(A1, A2, A3, A4, A5, A6, A7) volatile> { + typedef T type; + typedef U class_type; + typedef volatile U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1, class A2, class A3, class A4, class A5, + class A6, class A7, class A8> +struct member_pointer<T (U::*)(A1, A2, A3, A4, A5, A6, A7, A8) volatile> { + typedef T type; + typedef U class_type; + typedef volatile U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1, class A2, class A3, class A4, class A5, + class A6, class A7, class A8, class A9> +struct member_pointer<T (U::*)(A1, A2, A3, A4, A5, A6, A7, A8, A9) volatile> { + typedef T type; + typedef U class_type; + typedef volatile U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; + // -- const volatile +template<class T, class U> +struct member_pointer<T (U::*)() const volatile> { + typedef T type; + typedef U class_type; + typedef const volatile U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1> +struct member_pointer<T (U::*)(A1) const volatile> { + typedef T type; + typedef U class_type; + typedef const volatile U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1, class A2> +struct member_pointer<T (U::*)(A1, A2) const volatile> { + typedef T type; + typedef U class_type; + typedef const volatile U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1, class A2, class A3> +struct member_pointer<T (U::*)(A1, A2, A3) const volatile> { + typedef T type; + typedef U class_type; + typedef const volatile U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1, class A2, class A3, class A4> +struct member_pointer<T (U::*)(A1, A2, A3, A4) const volatile> { + typedef T type; + typedef U class_type; + typedef const volatile U qualified_class_type; +}; +template<class T, class U, class A1, class A2, class A3, class A4, class A5> +struct member_pointer<T (U::*)(A1, A2, A3, A4, A5) const volatile> { + typedef T type; + typedef U class_type; + typedef const volatile U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1, class A2, class A3, class A4, class A5, + class A6> +struct member_pointer<T (U::*)(A1, A2, A3, A4, A5, A6) const volatile> { + typedef T type; + typedef U class_type; + typedef const volatile U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1, class A2, class A3, class A4, class A5, + class A6, class A7> +struct member_pointer<T (U::*)(A1, A2, A3, A4, A5, A6, A7) const volatile> { + typedef T type; + typedef U class_type; + typedef const volatile U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1, class A2, class A3, class A4, class A5, + class A6, class A7, class A8> +struct member_pointer<T (U::*)(A1, A2, A3, A4, A5, A6, A7, A8) const volatile> { + typedef T type; + typedef U class_type; + typedef const volatile U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; +template<class T, class U, class A1, class A2, class A3, class A4, class A5, + class A6, class A7, class A8, class A9> +struct member_pointer<T (U::*)(A1, A2, A3, A4, A5, A6, A7, A8, A9) const volatile> { + typedef T type; + typedef U class_type; + typedef const volatile U qualified_class_type; + BOOST_STATIC_CONSTANT(bool, is_data_member = false); + BOOST_STATIC_CONSTANT(bool, is_function_member = true); +}; + +} // detail + +namespace detail { + + // this class holds a pointer to a member function and the object. + // when called, it just calls the member function with the parameters + // provided + + // It would have been possible to use existing lambda_functors to represent + // a bound member function like this, but to have a separate template is + // safer, since now this functor doesn't mix and match with lambda_functors + // only thing you can do with this is to call it + + // note that previously instantiated classes + // (other_action<member_pointer_action> and member_pointer_action_helper + // guarantee, that A and B are + // such types, that for objects a and b of corresponding types, a->*b leads + // to the builtin ->* to be called. So types that would end in a call to + // a user defined ->* do not create a member_pointer_caller object. + +template<class RET, class A, class B> +class member_pointer_caller { + A a; B b; + +public: + member_pointer_caller(const A& aa, const B& bb) : a(aa), b(bb) {} + + RET operator()() const { return (a->*b)(); } + + template<class A1> + RET operator()(const A1& a1) const { return (a->*b)(a1); } + + template<class A1, class A2> + RET operator()(const A1& a1, const A2& a2) const { return (a->*b)(a1, a2); } + + template<class A1, class A2, class A3> + RET operator()(const A1& a1, const A2& a2, const A3& a3) const { + return (a->*b)(a1, a2, a3); + } + + template<class A1, class A2, class A3, class A4> + RET operator()(const A1& a1, const A2& a2, const A3& a3, + const A4& a4) const { + return (a->*b)(a1, a2, a3, a4); + } + + template<class A1, class A2, class A3, class A4, class A5> + RET operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4, + const A5& a5) const { + return (a->*b)(a1, a2, a3, a4, a5); + } + + template<class A1, class A2, class A3, class A4, class A5, class A6> + RET operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4, + const A5& a5, const A6& a6) const { + return (a->*b)(a1, a2, a3, a4, a5, a6); + } + + template<class A1, class A2, class A3, class A4, class A5, class A6, + class A7> + RET operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4, + const A5& a5, const A6& a6, const A7& a7) const { + return (a->*b)(a1, a2, a3, a4, a5, a6, a7); + } + + template<class A1, class A2, class A3, class A4, class A5, class A6, + class A7, class A8> + RET operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4, + const A5& a5, const A6& a6, const A7& a7, + const A8& a8) const { + return (a->*b)(a1, a2, a3, a4, a5, a6, a7, a8); + } + + template<class A1, class A2, class A3, class A4, class A5, class A6, + class A7, class A8, class A9> + RET operator()(const A1& a1, const A2& a2, const A3& a3, const A4& a4, + const A5& a5, const A6& a6, const A7& a7, + const A8& a8, const A9& a9) const { + return (a->*b)(a1, a2, a3, a4, a5, a6, a7, a8, a9); + } + +}; + +// helper templates for return type deduction and action classes +// different cases for data member, function member, neither + +// true-true case +template <bool Is_data_member, bool Is_function_member> +struct member_pointer_action_helper; + // cannot be both, no body provided + + // data member case + // this means, that B is a data member and A is a pointer type, + // so either built-in ->* should be called, or there is an error +template <> +struct member_pointer_action_helper<true, false> { +public: + + template<class RET, class A, class B> + static RET apply(A& a, B& b) { + return a->*b; + } + + template<class A, class B> + struct return_type { + private: + typedef typename detail::remove_reference_and_cv<B>::type plainB; + + typedef typename detail::member_pointer<plainB>::type type0; + // we remove the reference now, as we may have to add cv:s + typedef typename boost::remove_reference<type0>::type type1; + + // A is a reference to pointer + // remove the top level cv qualifiers and reference + typedef typename + detail::remove_reference_and_cv<A>::type non_ref_A; + + // A is a pointer type, so take the type pointed to + typedef typename ::boost::remove_pointer<non_ref_A>::type non_pointer_A; + + public: + // For non-reference types, we must add const and/or volatile if + // the pointer type has these qualifiers + // If the member is a reference, these do not have any effect + // (cv T == T if T is a reference type) + typedef typename detail::IF< + ::boost::is_const<non_pointer_A>::value, + typename ::boost::add_const<type1>::type, + type1 + >::RET type2; + typedef typename detail::IF< + ::boost::is_volatile<non_pointer_A>::value, + typename ::boost::add_volatile<type2>::type, + type2 + >::RET type3; + // add reference back + typedef typename ::boost::add_reference<type3>::type type; + }; +}; + + // neither case +template <> +struct member_pointer_action_helper<false, false> { +public: + template<class RET, class A, class B> + static RET apply(A& a, B& b) { +// not a built in member pointer operator, just call ->* + return a->*b; + } + // an overloaded member pointer operators, user should have specified + // the return type + // At this point we know that there is no matching specialization for + // return_type_2, so try return_type_2_plain + template<class A, class B> + struct return_type { + + typedef typename plain_return_type_2< + other_action<member_pointer_action>, A, B + >::type type; + }; + +}; + + +// member pointer function case +// This is a built in ->* call for a member function, +// the only thing that you can do with that, is to give it some arguments +// note, it is guaranteed that A is a pointer type, and thus it cannot +// be a call to overloaded ->* +template <> +struct member_pointer_action_helper<false, true> { + public: + + template<class RET, class A, class B> + static RET apply(A& a, B& b) { + typedef typename ::boost::remove_cv<B>::type plainB; + typedef typename detail::member_pointer<plainB>::type ret_t; + typedef typename ::boost::remove_cv<A>::type plainA; + + // we always strip cv:s to + // make the two routes (calling and type deduction) + // to give the same results (and the const does not make any functional + // difference) + return detail::member_pointer_caller<ret_t, plainA, plainB>(a, b); + } + + template<class A, class B> + struct return_type { + typedef typename detail::remove_reference_and_cv<B>::type plainB; + typedef typename detail::member_pointer<plainB>::type ret_t; + typedef typename detail::remove_reference_and_cv<A>::type plainA; + + typedef detail::member_pointer_caller<ret_t, plainA, plainB> type; + }; +}; + +} // detail + +template<> class other_action<member_pointer_action> { +public: + template<class RET, class A, class B> + static RET apply(A& a, B& b) { + typedef typename + ::boost::remove_cv<B>::type plainB; + + return detail::member_pointer_action_helper< + boost::is_pointer<A>::value && + detail::member_pointer<plainB>::is_data_member, + boost::is_pointer<A>::value && + detail::member_pointer<plainB>::is_function_member + >::template apply<RET>(a, b); + } +}; + + // return type deduction -- + + // If the right argument is a pointer to data member, + // and the left argument is of compatible pointer to class type + // return type is a reference to the data member type + + // if right argument is a pointer to a member function, and the left + // argument is of a compatible type, the return type is a + // member_pointer_caller (see above) + + // Otherwise, return type deduction fails. There is either an error, + // or the user is trying to call an overloaded ->* + // In such a case either ret<> must be used, or a return_type_2 user + // defined specialization must be provided + + +template<class A, class B> +struct return_type_2<other_action<member_pointer_action>, A, B> { +private: + typedef typename + detail::remove_reference_and_cv<B>::type plainB; +public: + typedef typename + detail::member_pointer_action_helper< + detail::member_pointer<plainB>::is_data_member, + detail::member_pointer<plainB>::is_function_member + >::template return_type<A, B>::type type; +}; + + // this is the way the generic lambda_functor_base functions instantiate + // return type deduction. We turn it into return_type_2, so that the + // user can provide specializations on that level. +template<class Args> +struct return_type_N<other_action<member_pointer_action>, Args> { + typedef typename boost::tuples::element<0, Args>::type A; + typedef typename boost::tuples::element<1, Args>::type B; + typedef typename + return_type_2<other_action<member_pointer_action>, + typename boost::remove_reference<A>::type, + typename boost::remove_reference<B>::type + >::type type; +}; + + +template<class Arg1, class Arg2> +inline const +lambda_functor< + lambda_functor_base< + action<2, other_action<member_pointer_action> >, + tuple<lambda_functor<Arg1>, typename const_copy_argument<Arg2>::type> + > +> +operator->*(const lambda_functor<Arg1>& a1, const Arg2& a2) +{ + return + lambda_functor_base< + action<2, other_action<member_pointer_action> >, + tuple<lambda_functor<Arg1>, typename const_copy_argument<Arg2>::type> + > + (tuple<lambda_functor<Arg1>, + typename const_copy_argument<Arg2>::type>(a1, a2)); +} + +template<class Arg1, class Arg2> +inline const +lambda_functor< + lambda_functor_base< + action<2, other_action<member_pointer_action> >, + tuple<lambda_functor<Arg1>, lambda_functor<Arg2> > + > +> +operator->*(const lambda_functor<Arg1>& a1, const lambda_functor<Arg2>& a2) +{ + return + lambda_functor_base< + action<2, other_action<member_pointer_action> >, + tuple<lambda_functor<Arg1>, lambda_functor<Arg2> > + > + (tuple<lambda_functor<Arg1>, lambda_functor<Arg2> >(a1, a2)); +} + +template<class Arg1, class Arg2> +inline const +lambda_functor< + lambda_functor_base< + action<2, other_action<member_pointer_action> >, + tuple<typename const_copy_argument<Arg1>::type, lambda_functor<Arg2> > + > +> +operator->*(const Arg1& a1, const lambda_functor<Arg2>& a2) +{ + return + lambda_functor_base< + action<2, other_action<member_pointer_action> >, + tuple<typename const_copy_argument<Arg1>::type, lambda_functor<Arg2> > + > + (tuple<typename const_copy_argument<Arg1>::type, + lambda_functor<Arg2> >(a1, a2)); +} + + +} // namespace lambda +} // namespace boost + + +#endif + + + + + + diff --git a/3rdParty/Boost/src/boost/lambda/detail/operator_actions.hpp b/3rdParty/Boost/src/boost/lambda/detail/operator_actions.hpp new file mode 100644 index 0000000..949b40f --- /dev/null +++ b/3rdParty/Boost/src/boost/lambda/detail/operator_actions.hpp @@ -0,0 +1,139 @@ +// -- operator_actions.hpp - Boost Lambda Library ---------------------- + +// Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi) +// +// 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) + +// For more information, see http://lambda.cs.utu.fi + +#ifndef BOOST_LAMBDA_OPERATOR_ACTIONS_HPP +#define BOOST_LAMBDA_OPERATOR_ACTIONS_HPP + +namespace boost { +namespace lambda { + + +// -- artihmetic ---------------------- + +class plus_action {}; +class minus_action {}; +class multiply_action {}; +class divide_action {}; +class remainder_action {}; + +// -- bitwise ------------------- + +class leftshift_action {}; +class rightshift_action {}; +class xor_action {}; + + +// -- bitwise/logical ------------------- + +class and_action {}; +class or_action {}; +class not_action {}; + +// -- relational ------------------------- + +class less_action {}; +class greater_action {}; +class lessorequal_action {}; +class greaterorequal_action {}; +class equal_action {}; +class notequal_action {}; + +// -- increment/decrement ------------------------------ + +class increment_action {}; +class decrement_action {}; + +// -- void return ------------------------------ + +// -- other ------------------------------ + +class addressof_action {}; + // class comma_action {}; // defined in actions.hpp +class contentsof_action {}; +// class member_pointer_action {}; (defined in member_ptr.hpp) + + +// -- actioun group templates -------------------- + +template <class Action> class arithmetic_action; +template <class Action> class bitwise_action; +template <class Action> class logical_action; +template <class Action> class relational_action; +template <class Action> class arithmetic_assignment_action; +template <class Action> class bitwise_assignment_action; +template <class Action> class unary_arithmetic_action; +template <class Action> class pre_increment_decrement_action; +template <class Action> class post_increment_decrement_action; + +// --------------------------------------------------------- + + // actions, for which the existence of protect is checked in return type + // deduction. + +template <class Act> struct is_protectable<arithmetic_action<Act> > { + BOOST_STATIC_CONSTANT(bool, value = true); +}; +template <class Act> struct is_protectable<bitwise_action<Act> > { + BOOST_STATIC_CONSTANT(bool, value = true); +}; +template <class Act> struct is_protectable<logical_action<Act> > { + BOOST_STATIC_CONSTANT(bool, value = true); +}; +template <class Act> struct is_protectable<relational_action<Act> > { + BOOST_STATIC_CONSTANT(bool, value = true); +}; +template <class Act> +struct is_protectable<arithmetic_assignment_action<Act> > { + BOOST_STATIC_CONSTANT(bool, value = true); +}; +template <class Act> struct is_protectable<bitwise_assignment_action<Act> > { + BOOST_STATIC_CONSTANT(bool, value = true); +}; +template <class Act> struct is_protectable<unary_arithmetic_action<Act> > { + BOOST_STATIC_CONSTANT(bool, value = true); +}; +template <class Act> +struct is_protectable<pre_increment_decrement_action<Act> > { + BOOST_STATIC_CONSTANT(bool, value = true); +}; +template <class Act> struct +is_protectable<post_increment_decrement_action<Act> > { + BOOST_STATIC_CONSTANT(bool, value = true); +}; + +template <> struct is_protectable<other_action<addressof_action> > { + BOOST_STATIC_CONSTANT(bool, value = true); +}; +template <> struct is_protectable<other_action<contentsof_action> > { + BOOST_STATIC_CONSTANT(bool, value = true); +}; + +template<> struct is_protectable<other_action<subscript_action> > { + BOOST_STATIC_CONSTANT(bool, value = true); +}; +template<> struct is_protectable<other_action<assignment_action> > { + BOOST_STATIC_CONSTANT(bool, value = true); +}; + +// NOTE: comma action is also protectable, but the specialization is + // in actions.hpp + + +} // namespace lambda +} // namespace boost + +#endif + + + + + + + diff --git a/3rdParty/Boost/src/boost/lambda/detail/operator_lambda_func_base.hpp b/3rdParty/Boost/src/boost/lambda/detail/operator_lambda_func_base.hpp new file mode 100644 index 0000000..12a6d93 --- /dev/null +++ b/3rdParty/Boost/src/boost/lambda/detail/operator_lambda_func_base.hpp @@ -0,0 +1,271 @@ +// Boost Lambda Library - operator_lambda_func_base.hpp ----------------- +// +// Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi) +// +// 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) +// +// For more information, see www.boost.org + +// ------------------------------------------------------------ + +#ifndef BOOST_LAMBDA_OPERATOR_LAMBDA_FUNC_BASE_HPP +#define BOOST_LAMBDA_OPERATOR_LAMBDA_FUNC_BASE_HPP + +namespace boost { +namespace lambda { + + +// These operators cannot be implemented as apply functions of action +// templates + + +// Specialization for comma. +template<class Args> +class lambda_functor_base<other_action<comma_action>, Args> { +public: + Args args; +public: + explicit lambda_functor_base(const Args& a) : args(a) {} + + template<class RET, CALL_TEMPLATE_ARGS> + RET call(CALL_FORMAL_ARGS) const { + return detail::select(boost::tuples::get<0>(args), CALL_ACTUAL_ARGS), + detail::select(boost::tuples::get<1>(args), CALL_ACTUAL_ARGS); + } + + + template<class SigArgs> struct sig { + private: + typedef typename + detail::deduce_argument_types<Args, SigArgs>::type rets_t; + public: + typedef typename return_type_2_comma< // comma needs special handling + typename detail::element_or_null<0, rets_t>::type, + typename detail::element_or_null<1, rets_t>::type + >::type type; + }; + +}; + +namespace detail { + +// helper traits to make the expression shorter, takes binary action +// bound argument tuple, open argument tuple and gives the return type + +template<class Action, class Bound, class Open> class binary_rt { + private: + typedef typename + detail::deduce_argument_types<Bound, Open>::type rets_t; + public: + typedef typename return_type_2_prot< + Action, + typename detail::element_or_null<0, rets_t>::type, + typename detail::element_or_null<1, rets_t>::type + >::type type; +}; + + + // same for unary actions +template<class Action, class Bound, class Open> class unary_rt { + private: + typedef typename + detail::deduce_argument_types<Bound, Open>::type rets_t; + public: + typedef typename return_type_1_prot< + Action, + typename detail::element_or_null<0, rets_t>::type + >::type type; +}; + + +} // end detail + +// Specialization for logical and (to preserve shortcircuiting) +// this could be done with a macro as the others, code used to be different +template<class Args> +class lambda_functor_base<logical_action<and_action>, Args> { +public: + Args args; +public: + explicit lambda_functor_base(const Args& a) : args(a) {} + + template<class RET, CALL_TEMPLATE_ARGS> + RET call(CALL_FORMAL_ARGS) const { + return detail::select(boost::tuples::get<0>(args), CALL_ACTUAL_ARGS) && + detail::select(boost::tuples::get<1>(args), CALL_ACTUAL_ARGS); + } + template<class SigArgs> struct sig { + typedef typename + detail::binary_rt<logical_action<and_action>, Args, SigArgs>::type type; + }; +}; + +// Specialization for logical or (to preserve shortcircuiting) +// this could be done with a macro as the others, code used to be different +template<class Args> +class lambda_functor_base<logical_action< or_action>, Args> { +public: + Args args; +public: + explicit lambda_functor_base(const Args& a) : args(a) {} + + template<class RET, CALL_TEMPLATE_ARGS> + RET call(CALL_FORMAL_ARGS) const { + return detail::select(boost::tuples::get<0>(args), CALL_ACTUAL_ARGS) || + detail::select(boost::tuples::get<1>(args), CALL_ACTUAL_ARGS); + } + + template<class SigArgs> struct sig { + typedef typename + detail::binary_rt<logical_action<or_action>, Args, SigArgs>::type type; + }; +}; + +// Specialization for subscript +template<class Args> +class lambda_functor_base<other_action<subscript_action>, Args> { +public: + Args args; +public: + explicit lambda_functor_base(const Args& a) : args(a) {} + + template<class RET, CALL_TEMPLATE_ARGS> + RET call(CALL_FORMAL_ARGS) const { + return detail::select(boost::tuples::get<0>(args), CALL_ACTUAL_ARGS) + [detail::select(boost::tuples::get<1>(args), CALL_ACTUAL_ARGS)]; + } + + template<class SigArgs> struct sig { + typedef typename + detail::binary_rt<other_action<subscript_action>, Args, SigArgs>::type + type; + }; +}; + + +#define BOOST_LAMBDA_BINARY_ACTION(SYMBOL, ACTION_CLASS) \ +template<class Args> \ +class lambda_functor_base<ACTION_CLASS, Args> { \ +public: \ + Args args; \ +public: \ + explicit lambda_functor_base(const Args& a) : args(a) {} \ + \ + template<class RET, CALL_TEMPLATE_ARGS> \ + RET call(CALL_FORMAL_ARGS) const { \ + return detail::select(boost::tuples::get<0>(args), CALL_ACTUAL_ARGS) \ + SYMBOL \ + detail::select(boost::tuples::get<1>(args), CALL_ACTUAL_ARGS); \ + } \ + template<class SigArgs> struct sig { \ + typedef typename \ + detail::binary_rt<ACTION_CLASS, Args, SigArgs>::type type; \ + }; \ +}; + +#define BOOST_LAMBDA_PREFIX_UNARY_ACTION(SYMBOL, ACTION_CLASS) \ +template<class Args> \ +class lambda_functor_base<ACTION_CLASS, Args> { \ +public: \ + Args args; \ +public: \ + explicit lambda_functor_base(const Args& a) : args(a) {} \ + \ + template<class RET, CALL_TEMPLATE_ARGS> \ + RET call(CALL_FORMAL_ARGS) const { \ + return SYMBOL \ + detail::select(boost::tuples::get<0>(args), CALL_ACTUAL_ARGS); \ + } \ + template<class SigArgs> struct sig { \ + typedef typename \ + detail::unary_rt<ACTION_CLASS, Args, SigArgs>::type type; \ + }; \ +}; + +#define BOOST_LAMBDA_POSTFIX_UNARY_ACTION(SYMBOL, ACTION_CLASS) \ +template<class Args> \ +class lambda_functor_base<ACTION_CLASS, Args> { \ +public: \ + Args args; \ +public: \ + explicit lambda_functor_base(const Args& a) : args(a) {} \ + \ + template<class RET, CALL_TEMPLATE_ARGS> \ + RET call(CALL_FORMAL_ARGS) const { \ + return \ + detail::select(boost::tuples::get<0>(args), CALL_ACTUAL_ARGS) SYMBOL; \ + } \ + template<class SigArgs> struct sig { \ + typedef typename \ + detail::unary_rt<ACTION_CLASS, Args, SigArgs>::type type; \ + }; \ +}; + +BOOST_LAMBDA_BINARY_ACTION(+,arithmetic_action<plus_action>) +BOOST_LAMBDA_BINARY_ACTION(-,arithmetic_action<minus_action>) +BOOST_LAMBDA_BINARY_ACTION(*,arithmetic_action<multiply_action>) +BOOST_LAMBDA_BINARY_ACTION(/,arithmetic_action<divide_action>) +BOOST_LAMBDA_BINARY_ACTION(%,arithmetic_action<remainder_action>) + +BOOST_LAMBDA_BINARY_ACTION(<<,bitwise_action<leftshift_action>) +BOOST_LAMBDA_BINARY_ACTION(>>,bitwise_action<rightshift_action>) +BOOST_LAMBDA_BINARY_ACTION(&,bitwise_action<and_action>) +BOOST_LAMBDA_BINARY_ACTION(|,bitwise_action<or_action>) +BOOST_LAMBDA_BINARY_ACTION(^,bitwise_action<xor_action>) + +BOOST_LAMBDA_BINARY_ACTION(<,relational_action<less_action>) +BOOST_LAMBDA_BINARY_ACTION(>,relational_action<greater_action>) +BOOST_LAMBDA_BINARY_ACTION(<=,relational_action<lessorequal_action>) +BOOST_LAMBDA_BINARY_ACTION(>=,relational_action<greaterorequal_action>) +BOOST_LAMBDA_BINARY_ACTION(==,relational_action<equal_action>) +BOOST_LAMBDA_BINARY_ACTION(!=,relational_action<notequal_action>) + +BOOST_LAMBDA_BINARY_ACTION(+=,arithmetic_assignment_action<plus_action>) +BOOST_LAMBDA_BINARY_ACTION(-=,arithmetic_assignment_action<minus_action>) +BOOST_LAMBDA_BINARY_ACTION(*=,arithmetic_assignment_action<multiply_action>) +BOOST_LAMBDA_BINARY_ACTION(/=,arithmetic_assignment_action<divide_action>) +BOOST_LAMBDA_BINARY_ACTION(%=,arithmetic_assignment_action<remainder_action>) + +BOOST_LAMBDA_BINARY_ACTION(<<=,bitwise_assignment_action<leftshift_action>) +BOOST_LAMBDA_BINARY_ACTION(>>=,bitwise_assignment_action<rightshift_action>) +BOOST_LAMBDA_BINARY_ACTION(&=,bitwise_assignment_action<and_action>) +BOOST_LAMBDA_BINARY_ACTION(|=,bitwise_assignment_action<or_action>) +BOOST_LAMBDA_BINARY_ACTION(^=,bitwise_assignment_action<xor_action>) + +BOOST_LAMBDA_BINARY_ACTION(=,other_action< assignment_action>) + + +BOOST_LAMBDA_PREFIX_UNARY_ACTION(+, unary_arithmetic_action<plus_action>) +BOOST_LAMBDA_PREFIX_UNARY_ACTION(-, unary_arithmetic_action<minus_action>) +BOOST_LAMBDA_PREFIX_UNARY_ACTION(~, bitwise_action<not_action>) +BOOST_LAMBDA_PREFIX_UNARY_ACTION(!, logical_action<not_action>) +BOOST_LAMBDA_PREFIX_UNARY_ACTION(++, pre_increment_decrement_action<increment_action>) +BOOST_LAMBDA_PREFIX_UNARY_ACTION(--, pre_increment_decrement_action<decrement_action>) + +BOOST_LAMBDA_PREFIX_UNARY_ACTION(&,other_action<addressof_action>) +BOOST_LAMBDA_PREFIX_UNARY_ACTION(*,other_action<contentsof_action>) + +BOOST_LAMBDA_POSTFIX_UNARY_ACTION(++, post_increment_decrement_action<increment_action>) +BOOST_LAMBDA_POSTFIX_UNARY_ACTION(--, post_increment_decrement_action<decrement_action>) + + +#undef BOOST_LAMBDA_POSTFIX_UNARY_ACTION +#undef BOOST_LAMBDA_PREFIX_UNARY_ACTION +#undef BOOST_LAMBDA_BINARY_ACTION + +} // namespace lambda +} // namespace boost + +#endif + + + + + + + + + + diff --git a/3rdParty/Boost/src/boost/lambda/detail/operator_return_type_traits.hpp b/3rdParty/Boost/src/boost/lambda/detail/operator_return_type_traits.hpp new file mode 100644 index 0000000..b2d3d3a --- /dev/null +++ b/3rdParty/Boost/src/boost/lambda/detail/operator_return_type_traits.hpp @@ -0,0 +1,917 @@ +// operator_return_type_traits.hpp -- Boost Lambda Library ------------------ + +// Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi) +// +// 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) +// +// For more information, see www.boost.org + +#ifndef BOOST_LAMBDA_OPERATOR_RETURN_TYPE_TRAITS_HPP +#define BOOST_LAMBDA_OPERATOR_RETURN_TYPE_TRAITS_HPP + +#include "boost/lambda/detail/is_instance_of.hpp" +#include "boost/type_traits/same_traits.hpp" + +#include "boost/indirect_reference.hpp" +#include "boost/detail/container_fwd.hpp" + +#include <cstddef> // needed for the ptrdiff_t +#include <iosfwd> // for istream and ostream + +#include <iterator> // needed for operator& + +namespace boost { +namespace lambda { +namespace detail { + +// -- general helper templates for type deduction ------------------ + +// Much of the type deduction code for standard arithmetic types from Gary Powell + +template <class A> struct promote_code { static const int value = -1; }; +// this means that a code is not defined for A + +// -- the next 5 types are needed in if_then_else_return +// the promotion order is not important, but they must have distinct values. +template <> struct promote_code<bool> { static const int value = 10; }; +template <> struct promote_code<char> { static const int value = 20; }; +template <> struct promote_code<unsigned char> { static const int value = 30; }; +template <> struct promote_code<signed char> { static const int value = 40; }; +template <> struct promote_code<short int> { static const int value = 50; }; +// ---------- + +template <> struct promote_code<int> { static const int value = 100; }; +template <> struct promote_code<unsigned int> { static const int value = 200; }; +template <> struct promote_code<long> { static const int value = 300; }; +template <> struct promote_code<unsigned long> { static const int value = 400; }; + +template <> struct promote_code<float> { static const int value = 500; }; +template <> struct promote_code<double> { static const int value = 600; }; +template <> struct promote_code<long double> { static const int value = 700; }; + +// TODO: wchar_t + +// forward delcaration of complex. + +} // namespace detail +} // namespace lambda +} // namespace boost + +namespace boost { +namespace lambda { +namespace detail { + +template <> struct promote_code< std::complex<float> > { static const int value = 800; }; +template <> struct promote_code< std::complex<double> > { static const int value = 900; }; +template <> struct promote_code< std::complex<long double> > { static const int value = 1000; }; + +// -- int promotion ------------------------------------------- +template <class T> struct promote_to_int { typedef T type; }; + +template <> struct promote_to_int<bool> { typedef int type; }; +template <> struct promote_to_int<char> { typedef int type; }; +template <> struct promote_to_int<unsigned char> { typedef int type; }; +template <> struct promote_to_int<signed char> { typedef int type; }; +template <> struct promote_to_int<short int> { typedef int type; }; + +// The unsigned short int promotion rule is this: +// unsigned short int to signed int if a signed int can hold all values +// of unsigned short int, otherwise go to unsigned int. +template <> struct promote_to_int<unsigned short int> +{ + typedef + detail::IF<sizeof(int) <= sizeof(unsigned short int), +// I had the logic reversed but ">" messes up the parsing. + unsigned int, + int>::RET type; +}; + + +// TODO: think, should there be default behaviour for non-standard types? + +} // namespace detail + +// ------------------------------------------ +// Unary actions ---------------------------- +// ------------------------------------------ + +template<class Act, class A> +struct plain_return_type_1 { + typedef detail::unspecified type; +}; + + + +template<class Act, class A> +struct plain_return_type_1<unary_arithmetic_action<Act>, A> { + typedef A type; +}; + +template<class Act, class A> +struct return_type_1<unary_arithmetic_action<Act>, A> { + typedef + typename plain_return_type_1< + unary_arithmetic_action<Act>, + typename detail::remove_reference_and_cv<A>::type + >::type type; +}; + + +template<class A> +struct plain_return_type_1<bitwise_action<not_action>, A> { + typedef A type; +}; + +// bitwise not, operator~() +template<class A> struct return_type_1<bitwise_action<not_action>, A> { + typedef + typename plain_return_type_1< + bitwise_action<not_action>, + typename detail::remove_reference_and_cv<A>::type + >::type type; +}; + + +// prefix increment and decrement operators return +// their argument by default as a non-const reference +template<class Act, class A> +struct plain_return_type_1<pre_increment_decrement_action<Act>, A> { + typedef A& type; +}; + +template<class Act, class A> +struct return_type_1<pre_increment_decrement_action<Act>, A> { + typedef + typename plain_return_type_1< + pre_increment_decrement_action<Act>, + typename detail::remove_reference_and_cv<A>::type + >::type type; +}; + +// post decrement just returns the same plain type. +template<class Act, class A> +struct plain_return_type_1<post_increment_decrement_action<Act>, A> { + typedef A type; +}; + +template<class Act, class A> +struct return_type_1<post_increment_decrement_action<Act>, A> +{ + typedef + typename plain_return_type_1< + post_increment_decrement_action<Act>, + typename detail::remove_reference_and_cv<A>::type + >::type type; +}; + +// logical not, operator!() +template<class A> +struct plain_return_type_1<logical_action<not_action>, A> { + typedef bool type; +}; + +template<class A> +struct return_type_1<logical_action<not_action>, A> { + typedef + typename plain_return_type_1< + logical_action<not_action>, + typename detail::remove_reference_and_cv<A>::type + >::type type; +}; + +// address of action --------------------------------------- + + +template<class A> +struct return_type_1<other_action<addressof_action>, A> { + typedef + typename plain_return_type_1< + other_action<addressof_action>, + typename detail::remove_reference_and_cv<A>::type + >::type type1; + + // If no user defined specialization for A, then return the + // cv qualified pointer to A + typedef typename detail::IF< + boost::is_same<type1, detail::unspecified>::value, + typename boost::remove_reference<A>::type*, + type1 + >::RET type; +}; + +// contentsof action ------------------------------------ + +// TODO: this deduction may lead to fail directly, +// (if A has no specialization for iterator_traits and has no +// typedef A::reference. +// There is no easy way around this, cause there doesn't seem to be a way +// to test whether a class is an iterator or not. + +// The default works with std::iterators. + +namespace detail { + + // A is a nonreference type +template <class A> struct contentsof_type { + typedef typename boost::indirect_reference<A>::type type; +}; + + // this is since the nullary () in lambda_functor is always instantiated +template <> struct contentsof_type<null_type> { + typedef detail::unspecified type; +}; + + +template <class A> struct contentsof_type<const A> { + typedef typename contentsof_type<A>::type type; +}; + +template <class A> struct contentsof_type<volatile A> { + typedef typename contentsof_type<A>::type type; +}; + +template <class A> struct contentsof_type<const volatile A> { + typedef typename contentsof_type<A>::type type; +}; + + // standard iterator traits should take care of the pointer types + // but just to be on the safe side, we have the specializations here: + // these work even if A is cv-qualified. +template <class A> struct contentsof_type<A*> { + typedef A& type; +}; +template <class A> struct contentsof_type<A* const> { + typedef A& type; +}; +template <class A> struct contentsof_type<A* volatile> { + typedef A& type; +}; +template <class A> struct contentsof_type<A* const volatile> { + typedef A& type; +}; + +template<class A, int N> struct contentsof_type<A[N]> { + typedef A& type; +}; +template<class A, int N> struct contentsof_type<const A[N]> { + typedef const A& type; +}; +template<class A, int N> struct contentsof_type<volatile A[N]> { + typedef volatile A& type; +}; +template<class A, int N> struct contentsof_type<const volatile A[N]> { + typedef const volatile A& type; +}; + + + + + +} // end detail + +template<class A> +struct return_type_1<other_action<contentsof_action>, A> { + + typedef + typename plain_return_type_1< + other_action<contentsof_action>, + typename detail::remove_reference_and_cv<A>::type + >::type type1; + + // If no user defined specialization for A, then return the + // cv qualified pointer to A + typedef typename + detail::IF_type< + boost::is_same<type1, detail::unspecified>::value, + detail::contentsof_type< + typename boost::remove_reference<A>::type + >, + detail::identity_mapping<type1> + >::type type; +}; + + +// ------------------------------------------------------------------ +// binary actions --------------------------------------------------- +// ------------------------------------------------------------------ + +// here the default case is: no user defined versions: +template <class Act, class A, class B> +struct plain_return_type_2 { + typedef detail::unspecified type; +}; + +namespace detail { + +// error classes +class illegal_pointer_arithmetic{}; + +// pointer arithmetic type deductions ---------------------- +// value = false means that this is not a pointer arithmetic case +// value = true means, that this can be a pointer arithmetic case, but not necessarily is +// This means, that for user defined operators for pointer types, say for some operator+(X, *Y), +// the deductions must be coded at an earliel level (return_type_2). + +template<class Act, class A, class B> +struct pointer_arithmetic_traits { static const bool value = false; }; + +template<class A, class B> +struct pointer_arithmetic_traits<plus_action, A, B> { + + typedef typename + array_to_pointer<typename boost::remove_reference<A>::type>::type AP; + typedef typename + array_to_pointer<typename boost::remove_reference<B>::type>::type BP; + + static const bool is_pointer_A = boost::is_pointer<AP>::value; + static const bool is_pointer_B = boost::is_pointer<BP>::value; + + static const bool value = is_pointer_A || is_pointer_B; + + // can't add two pointers. + // note, that we do not check wether the other type is valid for + // addition with a pointer. + // the compiler will catch it in the apply function + + typedef typename + detail::IF< + is_pointer_A && is_pointer_B, + detail::return_type_deduction_failure< + detail::illegal_pointer_arithmetic + >, + typename detail::IF<is_pointer_A, AP, BP>::RET + >::RET type; + +}; + +template<class A, class B> +struct pointer_arithmetic_traits<minus_action, A, B> { + typedef typename + array_to_pointer<typename boost::remove_reference<A>::type>::type AP; + typedef typename + array_to_pointer<typename boost::remove_reference<B>::type>::type BP; + + static const bool is_pointer_A = boost::is_pointer<AP>::value; + static const bool is_pointer_B = boost::is_pointer<BP>::value; + + static const bool value = is_pointer_A || is_pointer_B; + + static const bool same_pointer_type = + is_pointer_A && is_pointer_B && + boost::is_same< + typename boost::remove_const< + typename boost::remove_pointer< + typename boost::remove_const<AP>::type + >::type + >::type, + typename boost::remove_const< + typename boost::remove_pointer< + typename boost::remove_const<BP>::type + >::type + >::type + >::value; + + // ptr - ptr has type ptrdiff_t + // note, that we do not check if, in ptr - B, B is + // valid for subtraction with a pointer. + // the compiler will catch it in the apply function + + typedef typename + detail::IF< + same_pointer_type, const std::ptrdiff_t, + typename detail::IF< + is_pointer_A, + AP, + detail::return_type_deduction_failure<detail::illegal_pointer_arithmetic> + >::RET + >::RET type; +}; + +} // namespace detail + +// -- arithmetic actions --------------------------------------------- + +namespace detail { + +template<bool is_pointer_arithmetic, class Act, class A, class B> +struct return_type_2_arithmetic_phase_1; + +template<class A, class B> struct return_type_2_arithmetic_phase_2; +template<class A, class B> struct return_type_2_arithmetic_phase_3; + +} // namespace detail + + +// drop any qualifiers from the argument types within arithmetic_action +template<class A, class B, class Act> +struct return_type_2<arithmetic_action<Act>, A, B> +{ + typedef typename detail::remove_reference_and_cv<A>::type plain_A; + typedef typename detail::remove_reference_and_cv<B>::type plain_B; + + typedef typename + plain_return_type_2<arithmetic_action<Act>, plain_A, plain_B>::type type1; + + // if user defined return type, do not enter the whole arithmetic deductions + typedef typename + detail::IF_type< + boost::is_same<type1, detail::unspecified>::value, + detail::return_type_2_arithmetic_phase_1< + detail::pointer_arithmetic_traits<Act, A, B>::value, Act, A, B + >, + plain_return_type_2<arithmetic_action<Act>, plain_A, plain_B> + >::type type; +}; + +namespace detail { + +// perform integral promotion, no pointer arithmetic +template<bool is_pointer_arithmetic, class Act, class A, class B> +struct return_type_2_arithmetic_phase_1 +{ + typedef typename + return_type_2_arithmetic_phase_2< + typename remove_reference_and_cv<A>::type, + typename remove_reference_and_cv<B>::type + >::type type; +}; + +// pointer_arithmetic +template<class Act, class A, class B> +struct return_type_2_arithmetic_phase_1<true, Act, A, B> +{ + typedef typename + pointer_arithmetic_traits<Act, A, B>::type type; +}; + +template<class A, class B> +struct return_type_2_arithmetic_phase_2 { + typedef typename + return_type_2_arithmetic_phase_3< + typename promote_to_int<A>::type, + typename promote_to_int<B>::type + >::type type; +}; + +// specialization for unsigned int. +// We only have to do these two specialization because the value promotion will +// take care of the other cases. +// The unsigned int promotion rule is this: +// unsigned int to long if a long can hold all values of unsigned int, +// otherwise go to unsigned long. + +// struct so I don't have to type this twice. +struct promotion_of_unsigned_int +{ + typedef + detail::IF<sizeof(long) <= sizeof(unsigned int), + unsigned long, + long>::RET type; +}; + +template<> +struct return_type_2_arithmetic_phase_2<unsigned int, long> +{ + typedef promotion_of_unsigned_int::type type; +}; +template<> +struct return_type_2_arithmetic_phase_2<long, unsigned int> +{ + typedef promotion_of_unsigned_int::type type; +}; + + +template<class A, class B> struct return_type_2_arithmetic_phase_3 { + enum { promote_code_A_value = promote_code<A>::value, + promote_code_B_value = promote_code<B>::value }; // enums for KCC + typedef typename + detail::IF< + promote_code_A_value == -1 || promote_code_B_value == -1, + detail::return_type_deduction_failure<return_type_2_arithmetic_phase_3>, + typename detail::IF< + ((int)promote_code_A_value > (int)promote_code_B_value), + A, + B + >::RET + >::RET type; +}; + +} // namespace detail + +// -- bitwise actions ------------------------------------------- +// note: for integral types deuduction is similar to arithmetic actions. + +// drop any qualifiers from the argument types within arithmetic action +template<class A, class B, class Act> +struct return_type_2<bitwise_action<Act>, A, B> +{ + + typedef typename detail::remove_reference_and_cv<A>::type plain_A; + typedef typename detail::remove_reference_and_cv<B>::type plain_B; + + typedef typename + plain_return_type_2<bitwise_action<Act>, plain_A, plain_B>::type type1; + + // if user defined return type, do not enter type deductions + typedef typename + detail::IF_type< + boost::is_same<type1, detail::unspecified>::value, + return_type_2<arithmetic_action<plus_action>, A, B>, + plain_return_type_2<bitwise_action<Act>, plain_A, plain_B> + >::type type; + + // plus_action is just a random pick, has to be a concrete instance + + // TODO: This check is only valid for built-in types, overloaded types might + // accept floating point operators + + // bitwise operators not defined for floating point types + // these test are not strictly needed here, since the error will be caught in + // the apply function + BOOST_STATIC_ASSERT(!(boost::is_float<plain_A>::value && boost::is_float<plain_B>::value)); + +}; + +namespace detail { + +#ifdef BOOST_NO_TEMPLATED_STREAMS + +template<class A, class B> +struct leftshift_type { + + typedef typename detail::IF< + boost::is_convertible< + typename boost::remove_reference<A>::type*, + std::ostream* + >::value, + std::ostream&, + typename detail::remove_reference_and_cv<A>::type + >::RET type; +}; + +template<class A, class B> +struct rightshift_type { + + typedef typename detail::IF< + + boost::is_convertible< + typename boost::remove_reference<A>::type*, + std::istream* + >::value, + std::istream&, + typename detail::remove_reference_and_cv<A>::type + >::RET type; +}; + +#else + +template <class T> struct get_ostream_type { + typedef std::basic_ostream<typename T::char_type, + typename T::traits_type>& type; +}; + +template <class T> struct get_istream_type { + typedef std::basic_istream<typename T::char_type, + typename T::traits_type>& type; +}; + +template<class A, class B> +struct leftshift_type { +private: + typedef typename boost::remove_reference<A>::type plainA; +public: + typedef typename detail::IF_type< + is_instance_of_2<plainA, std::basic_ostream>::value, + get_ostream_type<plainA>, //reference to the stream + detail::remove_reference_and_cv<A> + >::type type; +}; + +template<class A, class B> +struct rightshift_type { +private: + typedef typename boost::remove_reference<A>::type plainA; +public: + typedef typename detail::IF_type< + is_instance_of_2<plainA, std::basic_istream>::value, + get_istream_type<plainA>, //reference to the stream + detail::remove_reference_and_cv<A> + >::type type; +}; + + +#endif + +} // end detail + +// ostream +template<class A, class B> +struct return_type_2<bitwise_action<leftshift_action>, A, B> +{ + typedef typename detail::remove_reference_and_cv<A>::type plain_A; + typedef typename detail::remove_reference_and_cv<B>::type plain_B; + + typedef typename + plain_return_type_2<bitwise_action<leftshift_action>, plain_A, plain_B>::type type1; + + // if user defined return type, do not enter type deductions + typedef typename + detail::IF_type< + boost::is_same<type1, detail::unspecified>::value, + detail::leftshift_type<A, B>, + plain_return_type_2<bitwise_action<leftshift_action>, plain_A, plain_B> + >::type type; +}; + +// istream +template<class A, class B> +struct return_type_2<bitwise_action<rightshift_action>, A, B> +{ + typedef typename detail::remove_reference_and_cv<A>::type plain_A; + typedef typename detail::remove_reference_and_cv<B>::type plain_B; + + typedef typename + plain_return_type_2<bitwise_action<rightshift_action>, plain_A, plain_B>::type type1; + + // if user defined return type, do not enter type deductions + typedef typename + detail::IF_type< + boost::is_same<type1, detail::unspecified>::value, + detail::rightshift_type<A, B>, + plain_return_type_2<bitwise_action<rightshift_action>, plain_A, plain_B> + >::type type; +}; + +// -- logical actions ---------------------------------------- +// always bool +// NOTE: this may not be true for some weird user-defined types, +template<class A, class B, class Act> +struct plain_return_type_2<logical_action<Act>, A, B> { + typedef bool type; +}; + +template<class A, class B, class Act> +struct return_type_2<logical_action<Act>, A, B> { + + typedef typename detail::remove_reference_and_cv<A>::type plain_A; + typedef typename detail::remove_reference_and_cv<B>::type plain_B; + + typedef typename + plain_return_type_2<logical_action<Act>, plain_A, plain_B>::type type; + +}; + + +// -- relational actions ---------------------------------------- +// always bool +// NOTE: this may not be true for some weird user-defined types, +template<class A, class B, class Act> +struct plain_return_type_2<relational_action<Act>, A, B> { + typedef bool type; +}; + +template<class A, class B, class Act> +struct return_type_2<relational_action<Act>, A, B> { + + typedef typename detail::remove_reference_and_cv<A>::type plain_A; + typedef typename detail::remove_reference_and_cv<B>::type plain_B; + + typedef typename + plain_return_type_2<relational_action<Act>, plain_A, plain_B>::type type; +}; + +// Assingment actions ----------------------------------------------- +// return type is the type of the first argument as reference + +// note that cv-qualifiers are preserved. +// Yes, assignment operator can be const! + +// NOTE: this may not be true for some weird user-defined types, + +template<class A, class B, class Act> +struct return_type_2<arithmetic_assignment_action<Act>, A, B> { + + typedef typename detail::remove_reference_and_cv<A>::type plain_A; + typedef typename detail::remove_reference_and_cv<B>::type plain_B; + + typedef typename + plain_return_type_2< + arithmetic_assignment_action<Act>, plain_A, plain_B + >::type type1; + + typedef typename + detail::IF< + boost::is_same<type1, detail::unspecified>::value, + typename boost::add_reference<A>::type, + type1 + >::RET type; +}; + +template<class A, class B, class Act> +struct return_type_2<bitwise_assignment_action<Act>, A, B> { + + typedef typename detail::remove_reference_and_cv<A>::type plain_A; + typedef typename detail::remove_reference_and_cv<B>::type plain_B; + + typedef typename + plain_return_type_2< + bitwise_assignment_action<Act>, plain_A, plain_B + >::type type1; + + typedef typename + detail::IF< + boost::is_same<type1, detail::unspecified>::value, + typename boost::add_reference<A>::type, + type1 + >::RET type; +}; + +template<class A, class B> +struct return_type_2<other_action<assignment_action>, A, B> { + typedef typename detail::remove_reference_and_cv<A>::type plain_A; + typedef typename detail::remove_reference_and_cv<B>::type plain_B; + + typedef typename + plain_return_type_2< + other_action<assignment_action>, plain_A, plain_B + >::type type1; + + typedef typename + detail::IF< + boost::is_same<type1, detail::unspecified>::value, + typename boost::add_reference<A>::type, + type1 + >::RET type; +}; + +// -- other actions ---------------------------------------- + +// comma action ---------------------------------- +// Note: this may not be true for some weird user-defined types, + +// NOTE! This only tries the plain_return_type_2 layer and gives +// detail::unspecified as default. If no such specialization is found, the +// type rule in the spcecialization of the return_type_2_prot is used +// to give the type of the right argument (which can be a reference too) +// (The built in operator, can return a l- or rvalue). +template<class A, class B> +struct return_type_2<other_action<comma_action>, A, B> { + + typedef typename detail::remove_reference_and_cv<A>::type plain_A; + typedef typename detail::remove_reference_and_cv<B>::type plain_B; + + typedef typename + plain_return_type_2< + other_action<comma_action>, plain_A, plain_B + >::type type; + }; + +// subscript action ----------------------------------------------- + + +namespace detail { + // A and B are nonreference types +template <class A, class B> struct subscript_type { + typedef detail::unspecified type; +}; + +template <class A, class B> struct subscript_type<A*, B> { + typedef A& type; +}; +template <class A, class B> struct subscript_type<A* const, B> { + typedef A& type; +}; +template <class A, class B> struct subscript_type<A* volatile, B> { + typedef A& type; +}; +template <class A, class B> struct subscript_type<A* const volatile, B> { + typedef A& type; +}; + + +template<class A, class B, int N> struct subscript_type<A[N], B> { + typedef A& type; +}; + + // these 3 specializations are needed to make gcc <3 happy +template<class A, class B, int N> struct subscript_type<const A[N], B> { + typedef const A& type; +}; +template<class A, class B, int N> struct subscript_type<volatile A[N], B> { + typedef volatile A& type; +}; +template<class A, class B, int N> struct subscript_type<const volatile A[N], B> { + typedef const volatile A& type; +}; + +} // end detail + +template<class A, class B> +struct return_type_2<other_action<subscript_action>, A, B> { + + typedef typename detail::remove_reference_and_cv<A>::type plain_A; + typedef typename detail::remove_reference_and_cv<B>::type plain_B; + + typedef typename boost::remove_reference<A>::type nonref_A; + typedef typename boost::remove_reference<B>::type nonref_B; + + typedef typename + plain_return_type_2< + other_action<subscript_action>, plain_A, plain_B + >::type type1; + + typedef typename + detail::IF_type< + boost::is_same<type1, detail::unspecified>::value, + detail::subscript_type<nonref_A, nonref_B>, + plain_return_type_2<other_action<subscript_action>, plain_A, plain_B> + >::type type; + +}; + +template<class Key, class T, class Cmp, class Allocator, class B> +struct plain_return_type_2<other_action<subscript_action>, std::map<Key, T, Cmp, Allocator>, B> { + typedef T& type; + // T == std::map<Key, T, Cmp, Allocator>::mapped_type; +}; + +template<class Key, class T, class Cmp, class Allocator, class B> +struct plain_return_type_2<other_action<subscript_action>, std::multimap<Key, T, Cmp, Allocator>, B> { + typedef T& type; + // T == std::map<Key, T, Cmp, Allocator>::mapped_type; +}; + + // deque +template<class T, class Allocator, class B> +struct plain_return_type_2<other_action<subscript_action>, std::deque<T, Allocator>, B> { + typedef typename std::deque<T, Allocator>::reference type; +}; +template<class T, class Allocator, class B> +struct plain_return_type_2<other_action<subscript_action>, const std::deque<T, Allocator>, B> { + typedef typename std::deque<T, Allocator>::const_reference type; +}; + + // vector +template<class T, class Allocator, class B> +struct plain_return_type_2<other_action<subscript_action>, std::vector<T, Allocator>, B> { + typedef typename std::vector<T, Allocator>::reference type; +}; +template<class T, class Allocator, class B> +struct plain_return_type_2<other_action<subscript_action>, const std::vector<T, Allocator>, B> { + typedef typename std::vector<T, Allocator>::const_reference type; +}; + + // basic_string +template<class Char, class Traits, class Allocator, class B> +struct plain_return_type_2<other_action<subscript_action>, std::basic_string<Char, Traits, Allocator>, B> { + typedef typename std::basic_string<Char, Traits, Allocator>::reference type; +}; +template<class Char, class Traits, class Allocator, class B> +struct plain_return_type_2<other_action<subscript_action>, const std::basic_string<Char, Traits, Allocator>, B> { + typedef typename std::basic_string<Char, Traits, Allocator>::const_reference type; +}; + +template<class Char, class Traits, class Allocator> +struct plain_return_type_2<arithmetic_action<plus_action>, + std::basic_string<Char, Traits, Allocator>, + std::basic_string<Char, Traits, Allocator> > { + typedef std::basic_string<Char, Traits, Allocator> type; +}; + +template<class Char, class Traits, class Allocator> +struct plain_return_type_2<arithmetic_action<plus_action>, + const Char*, + std::basic_string<Char, Traits, Allocator> > { + typedef std::basic_string<Char, Traits, Allocator> type; +}; + +template<class Char, class Traits, class Allocator> +struct plain_return_type_2<arithmetic_action<plus_action>, + std::basic_string<Char, Traits, Allocator>, + const Char*> { + typedef std::basic_string<Char, Traits, Allocator> type; +}; + +template<class Char, class Traits, class Allocator, std::size_t N> +struct plain_return_type_2<arithmetic_action<plus_action>, + Char[N], + std::basic_string<Char, Traits, Allocator> > { + typedef std::basic_string<Char, Traits, Allocator> type; +}; + +template<class Char, class Traits, class Allocator, std::size_t N> +struct plain_return_type_2<arithmetic_action<plus_action>, + std::basic_string<Char, Traits, Allocator>, + Char[N]> { + typedef std::basic_string<Char, Traits, Allocator> type; +}; + + +} // namespace lambda +} // namespace boost + +#endif + + diff --git a/3rdParty/Boost/src/boost/lambda/detail/operators.hpp b/3rdParty/Boost/src/boost/lambda/detail/operators.hpp new file mode 100644 index 0000000..149e1ee --- /dev/null +++ b/3rdParty/Boost/src/boost/lambda/detail/operators.hpp @@ -0,0 +1,370 @@ +// Boost Lambda Library - operators.hpp -------------------------------------- + +// Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi) +// +// 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) +// +// For more information, see www.boost.org + +// --------------------------------------------------------------- + +#ifndef BOOST_LAMBDA_OPERATORS_HPP +#define BOOST_LAMBDA_OPERATORS_HPP + +#include "boost/lambda/detail/is_instance_of.hpp" + +namespace boost { +namespace lambda { + +#if defined BOOST_LAMBDA_BE1 +#error "Multiple defines of BOOST_LAMBDA_BE1" +#endif + + // For all BOOSTA_LAMBDA_BE* macros: + + // CONSTA must be either 'A' or 'const A' + // CONSTB must be either 'B' or 'const B' + + // It is stupid to have the names A and B as macro arguments, but it avoids + // the need to pass in emtpy macro arguments, which gives warnings on some + // compilers + +#define BOOST_LAMBDA_BE1(OPER_NAME, ACTION, CONSTA, CONSTB, CONVERSION) \ +template<class Arg, class B> \ +inline const \ +lambda_functor< \ + lambda_functor_base< \ + ACTION, \ + tuple<lambda_functor<Arg>, typename const_copy_argument <CONSTB>::type> \ + > \ +> \ +OPER_NAME (const lambda_functor<Arg>& a, CONSTB& b) { \ + return \ + lambda_functor_base< \ + ACTION, \ + tuple<lambda_functor<Arg>, typename const_copy_argument <CONSTB>::type>\ + > \ + (tuple<lambda_functor<Arg>, typename const_copy_argument <CONSTB>::type>(a, b)); \ +} + + +#if defined BOOST_LAMBDA_BE2 +#error "Multiple defines of BOOST_LAMBDA_BE2" +#endif + +#define BOOST_LAMBDA_BE2(OPER_NAME, ACTION, CONSTA, CONSTB, CONVERSION) \ +template<class A, class Arg> \ +inline const \ +lambda_functor< \ + lambda_functor_base< \ + ACTION, \ + tuple<typename CONVERSION <CONSTA>::type, lambda_functor<Arg> > \ + > \ +> \ +OPER_NAME (CONSTA& a, const lambda_functor<Arg>& b) { \ + return \ + lambda_functor_base< \ + ACTION, \ + tuple<typename CONVERSION <CONSTA>::type, lambda_functor<Arg> > \ + > \ + (tuple<typename CONVERSION <CONSTA>::type, lambda_functor<Arg> >(a, b)); \ +} + + +#if defined BOOST_LAMBDA_BE3 +#error "Multiple defines of BOOST_LAMBDA_BE3" +#endif + +#define BOOST_LAMBDA_BE3(OPER_NAME, ACTION, CONSTA, CONSTB, CONVERSION) \ +template<class ArgA, class ArgB> \ +inline const \ +lambda_functor< \ + lambda_functor_base< \ + ACTION, \ + tuple<lambda_functor<ArgA>, lambda_functor<ArgB> > \ + > \ +> \ +OPER_NAME (const lambda_functor<ArgA>& a, const lambda_functor<ArgB>& b) { \ + return \ + lambda_functor_base< \ + ACTION, \ + tuple<lambda_functor<ArgA>, lambda_functor<ArgB> > \ + > \ + (tuple<lambda_functor<ArgA>, lambda_functor<ArgB> >(a, b)); \ +} + +#if defined BOOST_LAMBDA_BE +#error "Multiple defines of BOOST_LAMBDA_BE" +#endif + +#define BOOST_LAMBDA_BE(OPER_NAME, ACTION, CONSTA, CONSTB, CONST_CONVERSION) \ +BOOST_LAMBDA_BE1(OPER_NAME, ACTION, CONSTA, CONSTB, CONST_CONVERSION) \ +BOOST_LAMBDA_BE2(OPER_NAME, ACTION, CONSTA, CONSTB, CONST_CONVERSION) \ +BOOST_LAMBDA_BE3(OPER_NAME, ACTION, CONSTA, CONSTB, CONST_CONVERSION) + +#define BOOST_LAMBDA_EMPTY() + +BOOST_LAMBDA_BE(operator+, arithmetic_action<plus_action>, const A, const B, const_copy_argument) +BOOST_LAMBDA_BE(operator-, arithmetic_action<minus_action>, const A, const B, const_copy_argument) +BOOST_LAMBDA_BE(operator*, arithmetic_action<multiply_action>, const A, const B, const_copy_argument) +BOOST_LAMBDA_BE(operator/, arithmetic_action<divide_action>, const A, const B, const_copy_argument) +BOOST_LAMBDA_BE(operator%, arithmetic_action<remainder_action>, const A, const B, const_copy_argument) +BOOST_LAMBDA_BE(operator<<, bitwise_action<leftshift_action>, const A, const B, const_copy_argument) +BOOST_LAMBDA_BE(operator>>, bitwise_action<rightshift_action>, const A, const B, const_copy_argument) +BOOST_LAMBDA_BE(operator&, bitwise_action<and_action>, const A, const B, const_copy_argument) +BOOST_LAMBDA_BE(operator|, bitwise_action<or_action>, const A, const B, const_copy_argument) +BOOST_LAMBDA_BE(operator^, bitwise_action<xor_action>, const A, const B, const_copy_argument) +BOOST_LAMBDA_BE(operator&&, logical_action<and_action>, const A, const B, const_copy_argument) +BOOST_LAMBDA_BE(operator||, logical_action<or_action>, const A, const B, const_copy_argument) +BOOST_LAMBDA_BE(operator<, relational_action<less_action>, const A, const B, const_copy_argument) +BOOST_LAMBDA_BE(operator>, relational_action<greater_action>, const A, const B, const_copy_argument) +BOOST_LAMBDA_BE(operator<=, relational_action<lessorequal_action>, const A, const B, const_copy_argument) +BOOST_LAMBDA_BE(operator>=, relational_action<greaterorequal_action>, const A, const B, const_copy_argument) +BOOST_LAMBDA_BE(operator==, relational_action<equal_action>, const A, const B, const_copy_argument) +BOOST_LAMBDA_BE(operator!=, relational_action<notequal_action>, const A, const B, const_copy_argument) + +BOOST_LAMBDA_BE(operator+=, arithmetic_assignment_action<plus_action>, A, const B, reference_argument) +BOOST_LAMBDA_BE(operator-=, arithmetic_assignment_action<minus_action>, A, const B, reference_argument) +BOOST_LAMBDA_BE(operator*=, arithmetic_assignment_action<multiply_action>, A, const B, reference_argument) +BOOST_LAMBDA_BE(operator/=, arithmetic_assignment_action<divide_action>, A, const B, reference_argument) +BOOST_LAMBDA_BE(operator%=, arithmetic_assignment_action<remainder_action>, A, const B, reference_argument) +BOOST_LAMBDA_BE(operator<<=, bitwise_assignment_action<leftshift_action>, A, const B, reference_argument) +BOOST_LAMBDA_BE(operator>>=, bitwise_assignment_action<rightshift_action>, A, const B, reference_argument) +BOOST_LAMBDA_BE(operator&=, bitwise_assignment_action<and_action>, A, const B, reference_argument) +BOOST_LAMBDA_BE(operator|=, bitwise_assignment_action<or_action>, A, const B, reference_argument) +BOOST_LAMBDA_BE(operator^=, bitwise_assignment_action<xor_action>, A, const B, reference_argument) + + +// A special trick for comma operator for correct preprocessing +#if defined BOOST_LAMBDA_COMMA_OPERATOR_NAME +#error "Multiple defines of BOOST_LAMBDA_COMMA_OPERATOR_NAME" +#endif + +#define BOOST_LAMBDA_COMMA_OPERATOR_NAME operator, + +BOOST_LAMBDA_BE1(BOOST_LAMBDA_COMMA_OPERATOR_NAME, other_action<comma_action>, const A, const B, const_copy_argument) +BOOST_LAMBDA_BE2(BOOST_LAMBDA_COMMA_OPERATOR_NAME, other_action<comma_action>, const A, const B, const_copy_argument) +BOOST_LAMBDA_BE3(BOOST_LAMBDA_COMMA_OPERATOR_NAME, other_action<comma_action>, const A, const B, const_copy_argument) + + + +namespace detail { + +// special cases for ostream& << Any and istream& >> Any --------------- +// the actual stream classes may vary and thus a specialisation for, +// say ostream& does not match (the general case above is chosen). +// Therefore we specialise for non-const reference: +// if the left argument is a stream, we store the stream as reference +// if it is something else, we store a const plain by default + +// Note that the overloading is const vs. non-const first argument + +#ifdef BOOST_NO_TEMPLATED_STREAMS +template<class T> struct convert_ostream_to_ref_others_to_c_plain_by_default { + typedef typename detail::IF< + boost::is_convertible<T*, std::ostream*>::value, + T&, + typename const_copy_argument <T>::type + >::RET type; +}; + +template<class T> struct convert_istream_to_ref_others_to_c_plain_by_default { + typedef typename detail::IF< + boost::is_convertible<T*, std::istream*>::value, + T&, + typename const_copy_argument <T>::type + >::RET type; +}; +#else + +template<class T> struct convert_ostream_to_ref_others_to_c_plain_by_default { + typedef typename detail::IF< + is_instance_of_2< + T, std::basic_ostream + >::value, + T&, + typename const_copy_argument <T>::type + >::RET type; +}; + +template<class T> struct convert_istream_to_ref_others_to_c_plain_by_default { + typedef typename detail::IF< + is_instance_of_2< + T, std::basic_istream + >::value, + T&, + typename const_copy_argument <T>::type + >::RET type; +}; +#endif + +} // detail + +BOOST_LAMBDA_BE2(operator<<, bitwise_action< leftshift_action>, A, const B, detail::convert_ostream_to_ref_others_to_c_plain_by_default) +BOOST_LAMBDA_BE2(operator>>, bitwise_action< rightshift_action>, A, const B, detail::convert_istream_to_ref_others_to_c_plain_by_default) + + +// special case for io_manipulators. +// function references cannot be given as arguments to lambda operator +// expressions in general. With << and >> the use of manipulators is +// so common, that specializations are provided to make them work. + +template<class Arg, class Ret, class ManipArg> +inline const +lambda_functor< + lambda_functor_base< + bitwise_action<leftshift_action>, + tuple<lambda_functor<Arg>, Ret(&)(ManipArg)> + > +> +operator<<(const lambda_functor<Arg>& a, Ret(&b)(ManipArg)) +{ + return + lambda_functor_base< + bitwise_action<leftshift_action>, + tuple<lambda_functor<Arg>, Ret(&)(ManipArg)> + > + ( tuple<lambda_functor<Arg>, Ret(&)(ManipArg)>(a, b) ); +} + +template<class Arg, class Ret, class ManipArg> +inline const +lambda_functor< + lambda_functor_base< + bitwise_action<rightshift_action>, + tuple<lambda_functor<Arg>, Ret(&)(ManipArg)> + > +> +operator>>(const lambda_functor<Arg>& a, Ret(&b)(ManipArg)) +{ + return + lambda_functor_base< + bitwise_action<rightshift_action>, + tuple<lambda_functor<Arg>, Ret(&)(ManipArg)> + > + ( tuple<lambda_functor<Arg>, Ret(&)(ManipArg)>(a, b) ); +} + + +// (+ and -) take their arguments as const references. +// This has consquences with pointer artihmetic +// E.g int a[]; ... *a = 1 works but not *(a+1) = 1. +// the result of a+1 would be const +// To make the latter work too, +// non-const arrays are taken as non-const and stored as non-const as well. +#if defined BOOST_LAMBDA_PTR_ARITHMETIC_E1 +#error "Multiple defines of BOOST_LAMBDA_PTR_ARITHMETIC_E1" +#endif + +#define BOOST_LAMBDA_PTR_ARITHMETIC_E1(OPER_NAME, ACTION, CONSTB) \ +template<class Arg, int N, class B> \ +inline const \ +lambda_functor< \ + lambda_functor_base<ACTION, tuple<lambda_functor<Arg>, CONSTB(&)[N]> > \ +> \ +OPER_NAME (const lambda_functor<Arg>& a, CONSTB(&b)[N]) \ +{ \ + return \ + lambda_functor_base<ACTION, tuple<lambda_functor<Arg>, CONSTB(&)[N]> > \ + (tuple<lambda_functor<Arg>, CONSTB(&)[N]>(a, b)); \ +} + + +#if defined BOOST_LAMBDA_PTR_ARITHMETIC_E2 +#error "Multiple defines of BOOST_LAMBDA_PTR_ARITHMETIC_E2" +#endif + +#define BOOST_LAMBDA_PTR_ARITHMETIC_E2(OPER_NAME, ACTION, CONSTA) \ +template<int N, class A, class Arg> \ +inline const \ +lambda_functor< \ + lambda_functor_base<ACTION, tuple<CONSTA(&)[N], lambda_functor<Arg> > > \ +> \ +OPER_NAME (CONSTA(&a)[N], const lambda_functor<Arg>& b) \ +{ \ + return \ + lambda_functor_base<ACTION, tuple<CONSTA(&)[N], lambda_functor<Arg> > > \ + (tuple<CONSTA(&)[N], lambda_functor<Arg> >(a, b)); \ +} + + +BOOST_LAMBDA_PTR_ARITHMETIC_E1(operator+, arithmetic_action<plus_action>, B) +BOOST_LAMBDA_PTR_ARITHMETIC_E2(operator+, arithmetic_action<plus_action>, A) +BOOST_LAMBDA_PTR_ARITHMETIC_E1(operator+, arithmetic_action<plus_action>,const B) +BOOST_LAMBDA_PTR_ARITHMETIC_E2(operator+, arithmetic_action<plus_action>,const A) + + +//BOOST_LAMBDA_PTR_ARITHMETIC_E1(operator-, arithmetic_action<minus_action>) +// This is not needed, since the result of ptr-ptr is an rvalue anyway + +BOOST_LAMBDA_PTR_ARITHMETIC_E2(operator-, arithmetic_action<minus_action>, A) +BOOST_LAMBDA_PTR_ARITHMETIC_E2(operator-, arithmetic_action<minus_action>, const A) + + +#undef BOOST_LAMBDA_BE1 +#undef BOOST_LAMBDA_BE2 +#undef BOOST_LAMBDA_BE3 +#undef BOOST_LAMBDA_BE +#undef BOOST_LAMBDA_COMMA_OPERATOR_NAME + +#undef BOOST_LAMBDA_PTR_ARITHMETIC_E1 +#undef BOOST_LAMBDA_PTR_ARITHMETIC_E2 + + +// --------------------------------------------------------------------- +// unary operators ----------------------------------------------------- +// --------------------------------------------------------------------- + +#if defined BOOST_LAMBDA_UE +#error "Multiple defines of BOOST_LAMBDA_UE" +#endif + +#define BOOST_LAMBDA_UE(OPER_NAME, ACTION) \ +template<class Arg> \ +inline const \ +lambda_functor<lambda_functor_base<ACTION, tuple<lambda_functor<Arg> > > > \ +OPER_NAME (const lambda_functor<Arg>& a) \ +{ \ + return \ + lambda_functor_base<ACTION, tuple<lambda_functor<Arg> > > \ + ( tuple<lambda_functor<Arg> >(a) ); \ +} + + +BOOST_LAMBDA_UE(operator+, unary_arithmetic_action<plus_action>) +BOOST_LAMBDA_UE(operator-, unary_arithmetic_action<minus_action>) +BOOST_LAMBDA_UE(operator~, bitwise_action<not_action>) +BOOST_LAMBDA_UE(operator!, logical_action<not_action>) +BOOST_LAMBDA_UE(operator++, pre_increment_decrement_action<increment_action>) +BOOST_LAMBDA_UE(operator--, pre_increment_decrement_action<decrement_action>) +BOOST_LAMBDA_UE(operator*, other_action<contentsof_action>) +BOOST_LAMBDA_UE(operator&, other_action<addressof_action>) + +#if defined BOOST_LAMBDA_POSTFIX_UE +#error "Multiple defines of BOOST_LAMBDA_POSTFIX_UE" +#endif + +#define BOOST_LAMBDA_POSTFIX_UE(OPER_NAME, ACTION) \ +template<class Arg> \ +inline const \ +lambda_functor<lambda_functor_base<ACTION, tuple<lambda_functor<Arg> > > > \ +OPER_NAME (const lambda_functor<Arg>& a, int) \ +{ \ + return \ + lambda_functor_base<ACTION, tuple<lambda_functor<Arg> > > \ + ( tuple<lambda_functor<Arg> >(a) ); \ +} + + +BOOST_LAMBDA_POSTFIX_UE(operator++, post_increment_decrement_action<increment_action>) +BOOST_LAMBDA_POSTFIX_UE(operator--, post_increment_decrement_action<decrement_action>) + +#undef BOOST_LAMBDA_UE +#undef BOOST_LAMBDA_POSTFIX_UE + +} // namespace lambda +} // namespace boost + +#endif diff --git a/3rdParty/Boost/src/boost/lambda/detail/ret.hpp b/3rdParty/Boost/src/boost/lambda/detail/ret.hpp new file mode 100644 index 0000000..fbd8b3a --- /dev/null +++ b/3rdParty/Boost/src/boost/lambda/detail/ret.hpp @@ -0,0 +1,325 @@ +// Boost Lambda Library ret.hpp ----------------------------------------- + +// Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi) +// +// 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) +// +// For more information, see www.boost.org + + +#ifndef BOOST_LAMBDA_RET_HPP +#define BOOST_LAMBDA_RET_HPP + +namespace boost { +namespace lambda { + + // TODO: + +// Add specializations for function references for ret, protect and unlambda +// e.g void foo(); unlambda(foo); fails, as it would add a const qualifier + // for a function type. + // on the other hand unlambda(*foo) does work + + +// -- ret ------------------------- +// the explicit return type template + + // TODO: It'd be nice to make ret a nop for other than lambda functors + // but causes an ambiguiyty with gcc (not with KCC), check what is the + // right interpretation. + + // // ret for others than lambda functors has no effect + // template <class U, class T> + // inline const T& ret(const T& t) { return t; } + + +template<class RET, class Arg> +inline const +lambda_functor< + lambda_functor_base< + explicit_return_type_action<RET>, + tuple<lambda_functor<Arg> > + > +> +ret(const lambda_functor<Arg>& a1) +{ + return + lambda_functor_base< + explicit_return_type_action<RET>, + tuple<lambda_functor<Arg> > + > + (tuple<lambda_functor<Arg> >(a1)); +} + +// protect ------------------ + + // protecting others than lambda functors has no effect +template <class T> +inline const T& protect(const T& t) { return t; } + +template<class Arg> +inline const +lambda_functor< + lambda_functor_base< + protect_action, + tuple<lambda_functor<Arg> > + > +> +protect(const lambda_functor<Arg>& a1) +{ + return + lambda_functor_base< + protect_action, + tuple<lambda_functor<Arg> > + > + (tuple<lambda_functor<Arg> >(a1)); +} + +// ------------------------------------------------------------------- + +// Hides the lambda functorness of a lambda functor. +// After this, the functor is immune to argument substitution, etc. +// This can be used, e.g. to make it safe to pass lambda functors as +// arguments to functions, which might use them as target functions + +// note, unlambda and protect are different things. Protect hides the lambda +// functor for one application, unlambda for good. + +template <class LambdaFunctor> +class non_lambda_functor +{ + LambdaFunctor lf; +public: + + // This functor defines the result_type typedef. + // The result type must be deducible without knowing the arguments + + template <class SigArgs> struct sig { + typedef typename + LambdaFunctor::inherited:: + template sig<typename SigArgs::tail_type>::type type; + }; + + explicit non_lambda_functor(const LambdaFunctor& a) : lf(a) {} + + typename LambdaFunctor::nullary_return_type + operator()() const { + return lf.template + call<typename LambdaFunctor::nullary_return_type> + (cnull_type(), cnull_type(), cnull_type(), cnull_type()); + } + + template<class A> + typename sig<tuple<const non_lambda_functor, A&> >::type + operator()(A& a) const { + return lf.template call<typename sig<tuple<const non_lambda_functor, A&> >::type >(a, cnull_type(), cnull_type(), cnull_type()); + } + + template<class A, class B> + typename sig<tuple<const non_lambda_functor, A&, B&> >::type + operator()(A& a, B& b) const { + return lf.template call<typename sig<tuple<const non_lambda_functor, A&, B&> >::type >(a, b, cnull_type(), cnull_type()); + } + + template<class A, class B, class C> + typename sig<tuple<const non_lambda_functor, A&, B&, C&> >::type + operator()(A& a, B& b, C& c) const { + return lf.template call<typename sig<tuple<const non_lambda_functor, A&, B&, C&> >::type>(a, b, c, cnull_type()); + } +}; + +template <class Arg> +inline const Arg& unlambda(const Arg& a) { return a; } + +template <class Arg> +inline const non_lambda_functor<lambda_functor<Arg> > +unlambda(const lambda_functor<Arg>& a) +{ + return non_lambda_functor<lambda_functor<Arg> >(a); +} + + // Due to a language restriction, lambda functors cannot be made to + // accept non-const rvalue arguments. Usually iterators do not return + // temporaries, but sometimes they do. That's why a workaround is provided. + // Note, that this potentially breaks const correctness, so be careful! + +// any lambda functor can be turned into a const_incorrect_lambda_functor +// The operator() takes arguments as consts and then casts constness +// away. So this breaks const correctness!!! but is a necessary workaround +// in some cases due to language limitations. +// Note, that this is not a lambda_functor anymore, so it can not be used +// as a sub lambda expression. + +template <class LambdaFunctor> +struct const_incorrect_lambda_functor { + LambdaFunctor lf; +public: + + explicit const_incorrect_lambda_functor(const LambdaFunctor& a) : lf(a) {} + + template <class SigArgs> struct sig { + typedef typename + LambdaFunctor::inherited::template + sig<typename SigArgs::tail_type>::type type; + }; + + // The nullary case is not needed (no arguments, no parameter type problems) + + template<class A> + typename sig<tuple<const const_incorrect_lambda_functor, A&> >::type + operator()(const A& a) const { + return lf.template call<typename sig<tuple<const const_incorrect_lambda_functor, A&> >::type >(const_cast<A&>(a), cnull_type(), cnull_type(), cnull_type()); + } + + template<class A, class B> + typename sig<tuple<const const_incorrect_lambda_functor, A&, B&> >::type + operator()(const A& a, const B& b) const { + return lf.template call<typename sig<tuple<const const_incorrect_lambda_functor, A&, B&> >::type >(const_cast<A&>(a), const_cast<B&>(b), cnull_type(), cnull_type()); + } + + template<class A, class B, class C> + typename sig<tuple<const const_incorrect_lambda_functor, A&, B&, C&> >::type + operator()(const A& a, const B& b, const C& c) const { + return lf.template call<typename sig<tuple<const const_incorrect_lambda_functor, A&, B&, C&> >::type>(const_cast<A&>(a), const_cast<B&>(b), const_cast<C&>(c), cnull_type()); + } +}; + +// ------------------------------------------------------------------------ +// any lambda functor can be turned into a const_parameter_lambda_functor +// The operator() takes arguments as const. +// This is useful if lambda functors are called with non-const rvalues. +// Note, that this is not a lambda_functor anymore, so it can not be used +// as a sub lambda expression. + +template <class LambdaFunctor> +struct const_parameter_lambda_functor { + LambdaFunctor lf; +public: + + explicit const_parameter_lambda_functor(const LambdaFunctor& a) : lf(a) {} + + template <class SigArgs> struct sig { + typedef typename + LambdaFunctor::inherited::template + sig<typename SigArgs::tail_type>::type type; + }; + + // The nullary case is not needed: no arguments, no constness problems. + + template<class A> + typename sig<tuple<const const_parameter_lambda_functor, const A&> >::type + operator()(const A& a) const { + return lf.template call<typename sig<tuple<const const_parameter_lambda_functor, const A&> >::type >(a, cnull_type(), cnull_type(), cnull_type()); + } + + template<class A, class B> + typename sig<tuple<const const_parameter_lambda_functor, const A&, const B&> >::type + operator()(const A& a, const B& b) const { + return lf.template call<typename sig<tuple<const const_parameter_lambda_functor, const A&, const B&> >::type >(a, b, cnull_type(), cnull_type()); + } + + template<class A, class B, class C> + typename sig<tuple<const const_parameter_lambda_functor, const A&, const B&, const C&> +>::type + operator()(const A& a, const B& b, const C& c) const { + return lf.template call<typename sig<tuple<const const_parameter_lambda_functor, const A&, const B&, const C&> >::type>(a, b, c, cnull_type()); + } +}; + +template <class Arg> +inline const const_incorrect_lambda_functor<lambda_functor<Arg> > +break_const(const lambda_functor<Arg>& lf) +{ + return const_incorrect_lambda_functor<lambda_functor<Arg> >(lf); +} + + +template <class Arg> +inline const const_parameter_lambda_functor<lambda_functor<Arg> > +const_parameters(const lambda_functor<Arg>& lf) +{ + return const_parameter_lambda_functor<lambda_functor<Arg> >(lf); +} + +// make void ------------------------------------------------ +// make_void( x ) turns a lambda functor x with some return type y into +// another lambda functor, which has a void return type +// when called, the original return type is discarded + +// we use this action. The action class will be called, which means that +// the wrapped lambda functor is evaluated, but we just don't do anything +// with the result. +struct voidifier_action { + template<class Ret, class A> static void apply(A&) {} +}; + +template<class Args> struct return_type_N<voidifier_action, Args> { + typedef void type; +}; + +template<class Arg1> +inline const +lambda_functor< + lambda_functor_base< + action<1, voidifier_action>, + tuple<lambda_functor<Arg1> > + > +> +make_void(const lambda_functor<Arg1>& a1) { +return + lambda_functor_base< + action<1, voidifier_action>, + tuple<lambda_functor<Arg1> > + > + (tuple<lambda_functor<Arg1> > (a1)); +} + +// for non-lambda functors, make_void does nothing +// (the argument gets evaluated immediately) + +template<class Arg1> +inline const +lambda_functor< + lambda_functor_base<do_nothing_action, null_type> +> +make_void(const Arg1& a1) { +return + lambda_functor_base<do_nothing_action, null_type>(); +} + +// std_functor ----------------------------------------------------- + +// The STL uses the result_type typedef as the convention to let binders know +// the return type of a function object. +// LL uses the sig template. +// To let LL know that the function object has the result_type typedef +// defined, it can be wrapped with the std_functor function. + + +// Just inherit form the template parameter (the standard functor), +// and provide a sig template. So we have a class which is still the +// same functor + the sig template. + +template<class T> +struct result_type_to_sig : public T { + template<class Args> struct sig { typedef typename T::result_type type; }; + result_type_to_sig(const T& t) : T(t) {} +}; + +template<class F> +inline result_type_to_sig<F> std_functor(const F& f) { return f; } + + +} // namespace lambda +} // namespace boost + +#endif + + + + + + + diff --git a/3rdParty/Boost/src/boost/lambda/detail/return_type_traits.hpp b/3rdParty/Boost/src/boost/lambda/detail/return_type_traits.hpp new file mode 100644 index 0000000..bf2394e --- /dev/null +++ b/3rdParty/Boost/src/boost/lambda/detail/return_type_traits.hpp @@ -0,0 +1,282 @@ +// return_type_traits.hpp -- Boost Lambda Library --------------------------- + +// Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi) +// +// 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) +// +// For more information, see www.boost.org + + +#ifndef BOOST_LAMBDA_RETURN_TYPE_TRAITS_HPP +#define BOOST_LAMBDA_RETURN_TYPE_TRAITS_HPP + +#include "boost/mpl/has_xxx.hpp" + +#include <cstddef> // needed for the ptrdiff_t + +namespace boost { +namespace lambda { + +using ::boost::type_traits::ice_and; +using ::boost::type_traits::ice_or; +using ::boost::type_traits::ice_not; + +// Much of the type deduction code for standard arithmetic types +// from Gary Powell + + // different arities: +template <class Act, class A1> struct return_type_1; // 1-ary actions +template <class Act, class A1, class A2> struct return_type_2; // 2-ary +template <class Act, class Args> struct return_type_N; // >3- ary + +template <class Act, class A1> struct return_type_1_prot; +template <class Act, class A1, class A2> struct return_type_2_prot; // 2-ary +template <class Act, class A1> struct return_type_N_prot; // >3-ary + + +namespace detail { + +template<class> class return_type_deduction_failure {}; + + // In some cases return type deduction should fail (an invalid lambda + // expression). Sometimes the lambda expression can be ok, the return type + // just is not deducible (user defined operators). Then return type deduction + // should never be entered at all, and the use of ret<> does this. + // However, for nullary lambda functors, return type deduction is always + // entered, and there seems to be no way around this. + + // (the return type is part of the prototype of the non-template + // operator()(). The prototype is instantiated, even though the body + // is not.) + + // So, in the case the return type deduction should fail, it should not + // fail directly, but rather result in a valid but wrong return type, + // causing a compile time error only if the function is really called. + + + +} // end detail + + + +// return_type_X_prot classes -------------------------------------------- +// These classes are the first layer that gets instantiated from the +// lambda_functor_base sig templates. It will check whether +// the action is protectable and one of arguments is "protected" or its +// evaluation will otherwise result in another lambda functor. +// If this is a case, the result type will be another lambda functor. + +// The arguments are always non-reference types, except for comma action +// where the right argument can be a reference too. This is because it +// matters (in the builtin case) whether the argument is an lvalue or +// rvalue: int i; i, 1 -> rvalue; 1, i -> lvalue + +template <class Act, class A> struct return_type_1_prot { +public: + typedef typename + detail::IF< + // is_protectable<Act>::value && is_lambda_functor<A>::value, + ice_and<is_protectable<Act>::value, is_lambda_functor<A>::value>::value, + lambda_functor< + lambda_functor_base< + Act, + tuple<typename detail::remove_reference_and_cv<A>::type> + > + >, + typename return_type_1<Act, A>::type + >::RET type; +}; + + // take care of the unavoidable instantiation for nullary case +template<class Act> struct return_type_1_prot<Act, null_type> { + typedef null_type type; +}; + +// Unary actions (result from unary operators) +// do not have a default return type. +template<class Act, class A> struct return_type_1 { + typedef typename + detail::return_type_deduction_failure<return_type_1> type; +}; + + +namespace detail { + + template <class T> + class protect_conversion { + typedef typename boost::remove_reference<T>::type non_ref_T; + public: + + // add const to rvalues, so that all rvalues are stored as const in + // the args tuple + typedef typename detail::IF_type< +// boost::is_reference<T>::value && !boost::is_const<non_ref_T>::value, + ice_and<boost::is_reference<T>::value, + ice_not<boost::is_const<non_ref_T>::value>::value>::value, + detail::identity_mapping<T>, + const_copy_argument<non_ref_T> // handles funtion and array + >::type type; // types correctly + }; + +} // end detail + +template <class Act, class A, class B> struct return_type_2_prot { + +// experimental feature + // We may have a lambda functor as a result type of a subexpression + // (if protect) has been used. + // Thus, if one of the parameter types is a lambda functor, the result + // is a lambda functor as well. + // We need to make a conservative choise here. + // The resulting lambda functor stores all const reference arguments as + // const copies. References to non-const are stored as such. + // So if the source of the argument is a const open argument, a bound + // argument stored as a const reference, or a function returning a + // const reference, that information is lost. There is no way of + // telling apart 'real const references' from just 'LL internal + // const references' (or it would be really hard) + + // The return type is a subclass of lambda_functor, which has a converting + // copy constructor. It can copy any lambda functor, that has the same + // action type and code, and a copy compatible argument tuple. + + + typedef typename boost::remove_reference<A>::type non_ref_A; + typedef typename boost::remove_reference<B>::type non_ref_B; + +typedef typename + detail::IF< +// is_protectable<Act>::value && +// (is_lambda_functor<A>::value || is_lambda_functor<B>::value), + ice_and<is_protectable<Act>::value, + ice_or<is_lambda_functor<A>::value, + is_lambda_functor<B>::value>::value>::value, + lambda_functor< + lambda_functor_base< + Act, + tuple<typename detail::protect_conversion<A>::type, + typename detail::protect_conversion<B>::type> + > + >, + typename return_type_2<Act, non_ref_A, non_ref_B>::type + >::RET type; +}; + + // take care of the unavoidable instantiation for nullary case +template<class Act> struct return_type_2_prot<Act, null_type, null_type> { + typedef null_type type; +}; + // take care of the unavoidable instantiation for nullary case +template<class Act, class Other> struct return_type_2_prot<Act, Other, null_type> { + typedef null_type type; +}; + // take care of the unavoidable instantiation for nullary case +template<class Act, class Other> struct return_type_2_prot<Act, null_type, Other> { + typedef null_type type; +}; + + // comma is a special case, as the user defined operator can return + // an lvalue (reference) too, hence it must be handled at this level. +template<class A, class B> +struct return_type_2_comma +{ + typedef typename boost::remove_reference<A>::type non_ref_A; + typedef typename boost::remove_reference<B>::type non_ref_B; + +typedef typename + detail::IF< +// is_protectable<other_action<comma_action> >::value && // it is protectable +// (is_lambda_functor<A>::value || is_lambda_functor<B>::value), + ice_and<is_protectable<other_action<comma_action> >::value, // it is protectable + ice_or<is_lambda_functor<A>::value, + is_lambda_functor<B>::value>::value>::value, + lambda_functor< + lambda_functor_base< + other_action<comma_action>, + tuple<typename detail::protect_conversion<A>::type, + typename detail::protect_conversion<B>::type> + > + >, + typename + return_type_2<other_action<comma_action>, non_ref_A, non_ref_B>::type + >::RET type1; + + // if no user defined return_type_2 (or plain_return_type_2) specialization + // matches, then return the righthand argument + typedef typename + detail::IF< + boost::is_same<type1, detail::unspecified>::value, + B, + type1 + >::RET type; + +}; + + + // currently there are no protectable actions with > 2 args + +template<class Act, class Args> struct return_type_N_prot { + typedef typename return_type_N<Act, Args>::type type; +}; + + // take care of the unavoidable instantiation for nullary case +template<class Act> struct return_type_N_prot<Act, null_type> { + typedef null_type type; +}; + +// handle different kind of actions ------------------------ + + // use the return type given in the bind invocation as bind<Ret>(...) +template<int I, class Args, class Ret> +struct return_type_N<function_action<I, Ret>, Args> { + typedef Ret type; +}; + +// ::result_type support + +namespace detail +{ + +BOOST_MPL_HAS_XXX_TRAIT_DEF(result_type) + +template<class F> struct get_result_type +{ + typedef typename F::result_type type; +}; + +template<class F, class A> struct get_sig +{ + typedef typename function_adaptor<F>::template sig<A>::type type; +}; + +} // namespace detail + + // Ret is detail::unspecified, so try to deduce return type +template<int I, class Args> +struct return_type_N<function_action<I, detail::unspecified>, Args > { + + // in the case of function action, the first element in Args is + // some type of function + typedef typename Args::head_type Func; + typedef typename detail::remove_reference_and_cv<Func>::type plain_Func; + +public: + // pass the function to function_adaptor, and get the return type from + // that + typedef typename detail::IF< + detail::has_result_type<plain_Func>::value, + detail::get_result_type<plain_Func>, + detail::get_sig<plain_Func, Args> + >::RET::type type; +}; + + +} // namespace lambda +} // namespace boost + +#endif + + + diff --git a/3rdParty/Boost/src/boost/lambda/detail/select_functions.hpp b/3rdParty/Boost/src/boost/lambda/detail/select_functions.hpp new file mode 100644 index 0000000..956045c --- /dev/null +++ b/3rdParty/Boost/src/boost/lambda/detail/select_functions.hpp @@ -0,0 +1,74 @@ +// -- select_functions.hpp -- Boost Lambda Library -------------------------- + +// Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi) +// +// 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) +// +// For more information, see http://www.boost.org + + +#ifndef BOOST_LAMBDA_SELECT_FUNCTIONS_HPP +#define BOOST_LAMBDA_SELECT_FUNCTIONS_HPP + +namespace boost { +namespace lambda { +namespace detail { + + +// select functions ------------------------------- +template<class Any, CALL_TEMPLATE_ARGS> +inline Any& select(Any& any, CALL_FORMAL_ARGS) { CALL_USE_ARGS; return any; } + + +template<class Arg, CALL_TEMPLATE_ARGS> +inline typename Arg::template sig<tuple<CALL_REFERENCE_TYPES> >::type +select ( const lambda_functor<Arg>& op, CALL_FORMAL_ARGS ) { + return op.template call< + typename Arg::template sig<tuple<CALL_REFERENCE_TYPES> >::type + >(CALL_ACTUAL_ARGS); +} +template<class Arg, CALL_TEMPLATE_ARGS> +inline typename Arg::template sig<tuple<CALL_REFERENCE_TYPES> >::type +select ( lambda_functor<Arg>& op, CALL_FORMAL_ARGS) { + return op.template call< + typename Arg::template sig<tuple<CALL_REFERENCE_TYPES> >::type + >(CALL_ACTUAL_ARGS); +} + +// ------------------------------------------------------------------------ +// select functions where the return type is explicitly given +// Note: on many functions, this return type is just discarded. +// The select functions are inside a class template, and the return type +// is a class template argument. +// The first implementation used function templates with an explicitly +// specified template parameter. +// However, this resulted in ambiguous calls (at least with gcc 2.95.2 +// and edg 2.44). Not sure whether the compilers were right or wrong. + +template<class RET> struct r_select { + +// Any == RET + template<class Any, CALL_TEMPLATE_ARGS> + static + inline RET go (Any& any, CALL_FORMAL_ARGS) { CALL_USE_ARGS; return any; } + + + template<class Arg, CALL_TEMPLATE_ARGS> + static + inline RET go (const lambda_functor<Arg>& op, CALL_FORMAL_ARGS ) { + return op.template call<RET>(CALL_ACTUAL_ARGS); + } + template<class Arg, CALL_TEMPLATE_ARGS> + static + inline RET go (lambda_functor<Arg>& op, CALL_FORMAL_ARGS ) { + return op.template call<RET>(CALL_ACTUAL_ARGS); + } +}; + +} // namespace detail +} // namespace lambda +} // namespace boost + +#endif diff --git a/3rdParty/Boost/src/boost/lambda/lambda.hpp b/3rdParty/Boost/src/boost/lambda/lambda.hpp new file mode 100644 index 0000000..75b06c7 --- /dev/null +++ b/3rdParty/Boost/src/boost/lambda/lambda.hpp @@ -0,0 +1,34 @@ +// -- lambda.hpp -- Boost Lambda Library ----------------------------------- +// Copyright (C) 1999, 2000 Jaakko Jarvi (jaakko.jarvi@cs.utu.fi) +// +// 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) +// +// For more information, see http://lambda.cs.utu.fi + +#ifndef BOOST_LAMBDA_LAMBDA_HPP +#define BOOST_LAMBDA_LAMBDA_HPP + + +#include "boost/lambda/core.hpp" + +#ifdef BOOST_NO_FDECL_TEMPLATES_AS_TEMPLATE_TEMPLATE_PARAMS +#include <istream> +#include <ostream> +#endif + +#include "boost/lambda/detail/operator_actions.hpp" +#include "boost/lambda/detail/operator_lambda_func_base.hpp" +#include "boost/lambda/detail/operator_return_type_traits.hpp" + + +#include "boost/lambda/detail/operators.hpp" + +#ifndef BOOST_LAMBDA_FAILS_IN_TEMPLATE_KEYWORD_AFTER_SCOPE_OPER +// sorry, member ptr does not work with gcc2.95 +#include "boost/lambda/detail/member_ptr.hpp" +#endif + + +#endif diff --git a/3rdParty/Boost/src/boost/lexical_cast.hpp b/3rdParty/Boost/src/boost/lexical_cast.hpp index d7d9052..c475982 100644 --- a/3rdParty/Boost/src/boost/lexical_cast.hpp +++ b/3rdParty/Boost/src/boost/lexical_cast.hpp @@ -1,6 +1,12 @@ #ifndef BOOST_LEXICAL_CAST_INCLUDED #define BOOST_LEXICAL_CAST_INCLUDED +// MS compatible compilers support #pragma once + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + // Boost lexical_cast.hpp header -------------------------------------------// // // See http://www.boost.org/libs/conversion for documentation. @@ -11,28 +17,43 @@ // enhanced with contributions from Terje Slettebo, // with additional fixes and suggestions from Gennaro Prota, // Beman Dawes, Dave Abrahams, Daryle Walker, Peter Dimov, -// Alexander Nasonov and other Boosters -// when: November 2000, March 2003, June 2005, June 2006 +// Alexander Nasonov, Antony Polukhin, Justin Viiret, Michael Hofmann, +// Cheng Yang, Matthew Bradbury, David W. Birdsall, Pavel Korzh and other Boosters +// when: November 2000, March 2003, June 2005, June 2006, March 2011 - 2012 + +#include <boost/config.hpp> +#if defined(BOOST_NO_STRINGSTREAM) || defined(BOOST_NO_STD_WSTRING) +#define BOOST_LCAST_NO_WCHAR_T +#endif #include <climits> #include <cstddef> -#include <istream> #include <string> +#include <cstring> +#include <cstdio> #include <typeinfo> #include <exception> -#include <boost/config.hpp> #include <boost/limits.hpp> #include <boost/mpl/if.hpp> #include <boost/throw_exception.hpp> +#include <boost/type_traits/ice.hpp> #include <boost/type_traits/is_pointer.hpp> -#include <boost/type_traits/make_unsigned.hpp> -#include <boost/call_traits.hpp> #include <boost/static_assert.hpp> #include <boost/detail/lcast_precision.hpp> #include <boost/detail/workaround.hpp> + #ifndef BOOST_NO_STD_LOCALE -#include <locale> +# include <locale> +#else +# ifndef BOOST_LEXICAL_CAST_ASSUME_C_LOCALE + // Getting error at this point means, that your STL library is old/lame/misconfigured. + // If nothing can be done with STL library, define BOOST_LEXICAL_CAST_ASSUME_C_LOCALE, + // but beware: lexical_cast will understand only 'C' locale delimeters and thousands + // separators. +# error "Unable to use <locale> header. Define BOOST_LEXICAL_CAST_ASSUME_C_LOCALE to force " +# error "boost::lexical_cast to use only 'C' locale during conversions." +# endif #endif #ifdef BOOST_NO_STRINGSTREAM @@ -41,10 +62,6 @@ #include <sstream> #endif -#if defined(BOOST_NO_STRINGSTREAM) || defined(BOOST_NO_STD_WSTRING) -#define BOOST_LCAST_NO_WCHAR_T -#endif - #ifdef BOOST_NO_TYPEID #define BOOST_LCAST_THROW_BAD_CAST(S, T) throw_exception(bad_lexical_cast()) #else @@ -55,7 +72,13 @@ namespace boost { // exception used to indicate runtime lexical_cast failure - class bad_lexical_cast : public std::bad_cast + class BOOST_SYMBOL_VISIBLE bad_lexical_cast : + // workaround MSVC bug with std::bad_cast when _HAS_EXCEPTIONS == 0 +#if defined(BOOST_MSVC) && defined(_HAS_EXCEPTIONS) && !_HAS_EXCEPTIONS + public std::exception +#else + public std::bad_cast +#endif #if defined(__BORLANDC__) && BOOST_WORKAROUND( __BORLANDC__, < 0x560 ) // under bcc32 5.5.1 bad_cast doesn't derive from exception @@ -64,7 +87,7 @@ namespace boost { public: - bad_lexical_cast() : + bad_lexical_cast() BOOST_NOEXCEPT : #ifndef BOOST_NO_TYPEID source(&typeid(void)), target(&typeid(void)) #else @@ -75,7 +98,7 @@ namespace boost bad_lexical_cast( const std::type_info &source_type_arg, - const std::type_info &target_type_arg) : + const std::type_info &target_type_arg) BOOST_NOEXCEPT : source(&source_type_arg), target(&target_type_arg) { } @@ -89,81 +112,222 @@ namespace boost return *target; } +#ifndef BOOST_NO_NOEXCEPT + virtual const char *what() const noexcept +#else virtual const char *what() const throw() +#endif { return "bad lexical cast: " "source type value could not be interpreted as target"; } + +#ifndef BOOST_NO_NOEXCEPT + virtual ~bad_lexical_cast() BOOST_NOEXCEPT +#else virtual ~bad_lexical_cast() throw() - { - } +#endif + {} private: const std::type_info *source; const std::type_info *target; }; - namespace detail // selectors for choosing stream character type + namespace detail // widest_char { - template<typename Type> + template <typename TargetChar, typename SourceChar> + struct widest_char + { + typedef BOOST_DEDUCED_TYPENAME boost::mpl::if_c< + (sizeof(TargetChar) > sizeof(SourceChar)) + , TargetChar + , SourceChar >::type type; + }; + } +} // namespace boost + +#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(__SUNPRO_CC) && !defined(__PGIC__) + +#include <cmath> +#include <istream> + +#if !defined(BOOST_NO_CXX11_HDR_ARRAY) && defined(BOOST_HAS_TR1_ARRAY) +#include <array> +#endif + +#include <boost/array.hpp> +#include <boost/numeric/conversion/cast.hpp> +#include <boost/type_traits/make_unsigned.hpp> +#include <boost/type_traits/is_signed.hpp> +#include <boost/type_traits/is_integral.hpp> +#include <boost/type_traits/is_arithmetic.hpp> +#include <boost/type_traits/remove_pointer.hpp> +#include <boost/math/special_functions/sign.hpp> +#include <boost/math/special_functions/fpclassify.hpp> +#include <boost/range/iterator_range_core.hpp> +#include <boost/container/container_fwd.hpp> +#ifndef BOOST_NO_CWCHAR +# include <cwchar> +#endif + +namespace boost { + namespace detail // widest_char<...> (continuation) + { + struct not_a_character_type{}; + + template <typename CharT> + struct widest_char<not_a_character_type, CharT > + { + typedef CharT type; + }; + + template <typename CharT> + struct widest_char< CharT, not_a_character_type > + { + typedef CharT type; + }; + + template <> + struct widest_char< not_a_character_type, not_a_character_type > + { + typedef char type; + }; + } + + namespace detail // is_char_or_wchar<...> and stream_char<...> templates + { + // returns true, if T is one of the character types + template <typename T> + struct is_char_or_wchar + { + typedef ::boost::type_traits::ice_or< + ::boost::is_same< T, char >::value, + #ifndef BOOST_LCAST_NO_WCHAR_T + ::boost::is_same< T, wchar_t >::value, + #endif + #ifndef BOOST_NO_CHAR16_T + ::boost::is_same< T, char16_t >::value, + #endif + #ifndef BOOST_NO_CHAR32_T + ::boost::is_same< T, char32_t >::value, + #endif + ::boost::is_same< T, unsigned char >::value, + ::boost::is_same< T, signed char >::value + > result_type; + + BOOST_STATIC_CONSTANT(bool, value = (result_type::value) ); + }; + + // selectors for choosing stream character type + // returns one of char, wchar_t, char16_t, char32_t or not_a_character_type types + template <typename Type> struct stream_char { + typedef BOOST_DEDUCED_TYPENAME boost::mpl::if_c< + is_char_or_wchar<Type >::value, + Type, + boost::detail::not_a_character_type + >::type type; + }; + + template <> + struct stream_char<unsigned char> + { + typedef char type; + }; + + template <> + struct stream_char<signed char> + { typedef char type; }; -#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - template<class CharT, class Traits, class Alloc> - struct stream_char< std::basic_string<CharT,Traits,Alloc> > + template <typename CharT> + struct stream_char<CharT*> + { + typedef BOOST_DEDUCED_TYPENAME stream_char<CharT>::type type; + }; + + template <typename CharT> + struct stream_char<const CharT*> + { + typedef BOOST_DEDUCED_TYPENAME stream_char<CharT>::type type; + }; + + template <typename CharT> + struct stream_char<iterator_range<CharT*> > + { + typedef BOOST_DEDUCED_TYPENAME stream_char<CharT*>::type type; + }; + + template <typename CharT> + struct stream_char<iterator_range<const CharT*> > + { + typedef BOOST_DEDUCED_TYPENAME stream_char<const CharT*>::type type; + }; + + template <class CharT, class Traits, class Alloc> + struct stream_char< std::basic_string<CharT, Traits, Alloc> > { typedef CharT type; }; -#endif -#ifndef BOOST_LCAST_NO_WCHAR_T -#ifndef BOOST_NO_INTRINSIC_WCHAR_T - template<> - struct stream_char<wchar_t> + template <class CharT, class Traits, class Alloc> + struct stream_char< ::boost::container::basic_string<CharT, Traits, Alloc> > { - typedef wchar_t type; + typedef CharT type; }; -#endif - template<> - struct stream_char<wchar_t *> + template<typename CharT, std::size_t N> + struct stream_char<boost::array<CharT, N> > { - typedef wchar_t type; + typedef BOOST_DEDUCED_TYPENAME stream_char<CharT>::type type; }; - template<> - struct stream_char<const wchar_t *> + template<typename CharT, std::size_t N> + struct stream_char<boost::array<const CharT, N> > { - typedef wchar_t type; + typedef BOOST_DEDUCED_TYPENAME stream_char<CharT>::type type; + }; + +#if !defined(BOOST_NO_CXX11_HDR_ARRAY) && defined(BOOST_HAS_TR1_ARRAY) + template <typename CharT, std::size_t N> + struct stream_char<std::array<CharT, N> > + { + typedef BOOST_DEDUCED_TYPENAME stream_char<CharT>::type type; }; -#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + template <typename CharT, std::size_t N> + struct stream_char<std::array<const CharT, N> > + { + typedef BOOST_DEDUCED_TYPENAME stream_char<CharT>::type type; + }; +#endif // !defined(BOOST_NO_CXX11_HDR_ARRAY) && defined(BOOST_HAS_TR1_ARRAY) + +#if !defined(BOOST_LCAST_NO_WCHAR_T) && defined(BOOST_NO_INTRINSIC_WCHAR_T) template<> - struct stream_char<std::wstring> + struct stream_char<wchar_t> { - typedef wchar_t type; + typedef boost::detail::not_a_character_type type; }; -#endif -#endif - template<typename TargetChar, typename SourceChar> - struct widest_char + template<> + struct stream_char<wchar_t*> { - typedef TargetChar type; + typedef wchar_t type; }; template<> - struct widest_char<char, wchar_t> + struct stream_char<const wchar_t*> { typedef wchar_t type; }; +#endif } namespace detail // deduce_char_traits template { -#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + template<class CharT, class Target, class Source> struct deduce_char_traits { @@ -188,140 +352,73 @@ namespace boost typedef Traits type; }; - template<class CharT, class Traits, class Alloc1, class Alloc2> + template<class CharT, class Traits, class Alloc, class Source> struct deduce_char_traits< CharT - , std::basic_string<CharT,Traits,Alloc1> - , std::basic_string<CharT,Traits,Alloc2> + , ::boost::container::basic_string<CharT,Traits,Alloc> + , Source > { typedef Traits type; }; -#endif - } - - namespace detail // lcast_src_length - { - // Return max. length of string representation of Source; - // 0 if unlimited (with exceptions for some types, see below). - // Values with limited string representation are placed to - // the buffer locally defined in lexical_cast function. - // 1 is returned for few types such as CharT const* or - // std::basic_string<CharT> that already have an internal - // buffer ready to be reused by lexical_stream_limited_src. - // Each specialization should have a correspondent operator<< - // defined in lexical_stream_limited_src. - template< class CharT // A result of widest_char transformation. - , class Source // Source type of lexical_cast. - > - struct lcast_src_length - { - BOOST_STATIC_CONSTANT(std::size_t, value = 0); - // To check coverage, build the test with - // bjam --v2 profile optimization=off - static void check_coverage() {} - }; - - template<> - struct lcast_src_length<char, bool> - { - BOOST_STATIC_CONSTANT(std::size_t, value = 1); - static void check_coverage() {} - }; - - template<> - struct lcast_src_length<char, char> - { - BOOST_STATIC_CONSTANT(std::size_t, value = 1); - static void check_coverage() {} - }; - - // No specializations for: - // lcast_src_length<char, signed char> - // lcast_src_length<char, unsigned char> - // lcast_src_length<char, signed char*> - // lcast_src_length<char, unsigned char*> - // lcast_src_length<char, signed char const*> - // lcast_src_length<char, unsigned char const*> - -#ifndef BOOST_LCAST_NO_WCHAR_T - template<> - struct lcast_src_length<wchar_t, bool> - { - BOOST_STATIC_CONSTANT(std::size_t, value = 1); - static void check_coverage() {} - }; - - template<> - struct lcast_src_length<wchar_t, char> - { - BOOST_STATIC_CONSTANT(std::size_t, value = 1); - static void check_coverage() {} - }; - -#ifndef BOOST_NO_INTRINSIC_WCHAR_T - template<> - struct lcast_src_length<wchar_t, wchar_t> - { - BOOST_STATIC_CONSTANT(std::size_t, value = 1); - static void check_coverage() {} - }; -#endif -#endif - template<> - struct lcast_src_length<char, char const*> + template<class CharT, class Target, class Traits, class Alloc> + struct deduce_char_traits< CharT + , Target + , ::boost::container::basic_string<CharT,Traits,Alloc> + > { - BOOST_STATIC_CONSTANT(std::size_t, value = 1); - static void check_coverage() {} + typedef Traits type; }; - template<> - struct lcast_src_length<char, char*> + template<class CharT, class Traits, class Alloc1, class Alloc2> + struct deduce_char_traits< CharT + , std::basic_string<CharT,Traits,Alloc1> + , std::basic_string<CharT,Traits,Alloc2> + > { - BOOST_STATIC_CONSTANT(std::size_t, value = 1); - static void check_coverage() {} + typedef Traits type; }; -#ifndef BOOST_LCAST_NO_WCHAR_T - template<> - struct lcast_src_length<wchar_t, wchar_t const*> + template<class CharT, class Traits, class Alloc1, class Alloc2> + struct deduce_char_traits< CharT + , ::boost::container::basic_string<CharT,Traits,Alloc1> + , ::boost::container::basic_string<CharT,Traits,Alloc2> + > { - BOOST_STATIC_CONSTANT(std::size_t, value = 1); - static void check_coverage() {} + typedef Traits type; }; - template<> - struct lcast_src_length<wchar_t, wchar_t*> + template<class CharT, class Traits, class Alloc1, class Alloc2> + struct deduce_char_traits< CharT + , ::boost::container::basic_string<CharT,Traits,Alloc1> + , ::std::basic_string<CharT,Traits,Alloc2> + > { - BOOST_STATIC_CONSTANT(std::size_t, value = 1); - static void check_coverage() {} + typedef Traits type; }; -#endif -#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - template<class CharT, class Traits, class Alloc> - struct lcast_src_length< CharT, std::basic_string<CharT,Traits,Alloc> > - { - BOOST_STATIC_CONSTANT(std::size_t, value = 1); - static void check_coverage() {} - }; -#else - template<> - struct lcast_src_length< char, std::basic_string<char> > + template<class CharT, class Traits, class Alloc1, class Alloc2> + struct deduce_char_traits< CharT + , ::std::basic_string<CharT,Traits,Alloc1> + , ::boost::container::basic_string<CharT,Traits,Alloc2> + > { - BOOST_STATIC_CONSTANT(std::size_t, value = 1); - static void check_coverage() {} + typedef Traits type; }; + } -#ifndef BOOST_LCAST_NO_WCHAR_T - template<> - struct lcast_src_length< wchar_t, std::basic_string<wchar_t> > + namespace detail // lcast_src_length + { + // Return max. length of string representation of Source; + template< class Source // Source type of lexical_cast. + > + struct lcast_src_length { BOOST_STATIC_CONSTANT(std::size_t, value = 1); + // To check coverage, build the test with + // bjam --v2 profile optimization=off static void check_coverage() {} }; -#endif -#endif // Helper for integral types. // Notes on length calculation: @@ -342,7 +439,7 @@ namespace boost #ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS BOOST_STATIC_CONSTANT(std::size_t, value = std::numeric_limits<Source>::is_signed + - std::numeric_limits<Source>::is_specialized + // == 1 + std::numeric_limits<Source>::is_specialized + /* == 1 */ std::numeric_limits<Source>::digits10 * 2 ); #else @@ -351,19 +448,11 @@ namespace boost #endif }; -#define BOOST_LCAST_DEF1(CharT, T) \ - template<> struct lcast_src_length<CharT, T> \ +#define BOOST_LCAST_DEF(T) \ + template<> struct lcast_src_length<T> \ : lcast_src_length_integral<T> \ { static void check_coverage() {} }; -#ifdef BOOST_LCAST_NO_WCHAR_T -#define BOOST_LCAST_DEF(T) BOOST_LCAST_DEF1(char, T) -#else -#define BOOST_LCAST_DEF(T) \ - BOOST_LCAST_DEF1(char, T) \ - BOOST_LCAST_DEF1(wchar_t, T) -#endif - BOOST_LCAST_DEF(short) BOOST_LCAST_DEF(unsigned short) BOOST_LCAST_DEF(int) @@ -379,7 +468,6 @@ namespace boost #endif #undef BOOST_LCAST_DEF -#undef BOOST_LCAST_DEF1 #ifndef BOOST_LCAST_NO_COMPILE_TIME_PRECISION // Helper for floating point types. @@ -405,53 +493,30 @@ namespace boost }; template<> - struct lcast_src_length<char,float> + struct lcast_src_length<float> : lcast_src_length_floating<float> { static void check_coverage() {} }; template<> - struct lcast_src_length<char,double> + struct lcast_src_length<double> : lcast_src_length_floating<double> { static void check_coverage() {} }; template<> - struct lcast_src_length<char,long double> + struct lcast_src_length<long double> : lcast_src_length_floating<long double> { static void check_coverage() {} }; -#ifndef BOOST_LCAST_NO_WCHAR_T - template<> - struct lcast_src_length<wchar_t,float> - : lcast_src_length_floating<float> - { - static void check_coverage() {} - }; - - template<> - struct lcast_src_length<wchar_t,double> - : lcast_src_length_floating<double> - { - static void check_coverage() {} - }; - - template<> - struct lcast_src_length<wchar_t,long double> - : lcast_src_length_floating<long double> - { - static void check_coverage() {} - }; - -#endif // #ifndef BOOST_LCAST_NO_WCHAR_T #endif // #ifndef BOOST_LCAST_NO_COMPILE_TIME_PRECISION } - namespace detail // '0' and '-' constants + namespace detail // '0', '+' and '-' constants { template<typename CharT> struct lcast_char_constants; @@ -460,6 +525,10 @@ namespace boost { BOOST_STATIC_CONSTANT(char, zero = '0'); BOOST_STATIC_CONSTANT(char, minus = '-'); + BOOST_STATIC_CONSTANT(char, plus = '+'); + BOOST_STATIC_CONSTANT(char, lowercase_e = 'e'); + BOOST_STATIC_CONSTANT(char, capital_e = 'E'); + BOOST_STATIC_CONSTANT(char, c_decimal_separator = '.'); }; #ifndef BOOST_LCAST_NO_WCHAR_T @@ -468,15 +537,38 @@ namespace boost { BOOST_STATIC_CONSTANT(wchar_t, zero = L'0'); BOOST_STATIC_CONSTANT(wchar_t, minus = L'-'); + BOOST_STATIC_CONSTANT(wchar_t, plus = L'+'); + BOOST_STATIC_CONSTANT(wchar_t, lowercase_e = L'e'); + BOOST_STATIC_CONSTANT(wchar_t, capital_e = L'E'); + BOOST_STATIC_CONSTANT(wchar_t, c_decimal_separator = L'.'); }; #endif - } - namespace detail // lexical_streambuf_fake - { - struct lexical_streambuf_fake - { +#if !defined(BOOST_NO_CHAR16_T) && !defined(BOOST_NO_UNICODE_LITERALS) + template<> + struct lcast_char_constants<char16_t> + { + BOOST_STATIC_CONSTANT(char16_t, zero = u'0'); + BOOST_STATIC_CONSTANT(char16_t, minus = u'-'); + BOOST_STATIC_CONSTANT(char16_t, plus = u'+'); + BOOST_STATIC_CONSTANT(char16_t, lowercase_e = u'e'); + BOOST_STATIC_CONSTANT(char16_t, capital_e = u'E'); + BOOST_STATIC_CONSTANT(char16_t, c_decimal_separator = u'.'); }; +#endif + +#if !defined(BOOST_NO_CHAR32_T) && !defined(BOOST_NO_UNICODE_LITERALS) + template<> + struct lcast_char_constants<char32_t> + { + BOOST_STATIC_CONSTANT(char32_t, zero = U'0'); + BOOST_STATIC_CONSTANT(char32_t, minus = U'-'); + BOOST_STATIC_CONSTANT(char32_t, plus = U'+'); + BOOST_STATIC_CONSTANT(char32_t, lowercase_e = U'e'); + BOOST_STATIC_CONSTANT(char32_t, capital_e = U'E'); + BOOST_STATIC_CONSTANT(char32_t, c_decimal_separator = U'.'); + }; +#endif } namespace detail // lcast_to_unsigned @@ -490,10 +582,10 @@ namespace boost #endif template<class T> inline - BOOST_DEDUCED_TYPENAME make_unsigned<T>::type lcast_to_unsigned(T value) + BOOST_DEDUCED_TYPENAME make_unsigned<T>::type lcast_to_unsigned(T value) BOOST_NOEXCEPT { typedef BOOST_DEDUCED_TYPENAME make_unsigned<T>::type result_type; - result_type uvalue = static_cast<result_type>(value); + const result_type uvalue = static_cast<result_type>(value); return value < 0 ? -uvalue : uvalue; } #if (defined _MSC_VER) @@ -506,257 +598,1096 @@ namespace boost namespace detail // lcast_put_unsigned { template<class Traits, class T, class CharT> - CharT* lcast_put_unsigned(T n, CharT* finish) + CharT* lcast_put_unsigned(const T n_param, CharT* finish) { #ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS BOOST_STATIC_ASSERT(!std::numeric_limits<T>::is_signed); #endif -#ifndef BOOST_LEXICAL_CAST_ASSUME_C_LOCALE - // TODO: use BOOST_NO_STD_LOCALE - std::locale loc; - typedef std::numpunct<CharT> numpunct; - numpunct const& np = BOOST_USE_FACET(numpunct, loc); - std::string const& grouping = np.grouping(); - std::string::size_type const grouping_size = grouping.size(); - CharT thousands_sep = grouping_size ? np.thousands_sep() : 0; - std::string::size_type group = 0; // current group number - char last_grp_size = grouping[0] <= 0 ? CHAR_MAX : grouping[0]; - // a) Since grouping is const, grouping[grouping.size()] returns 0. - // b) It's safe to assume here and below that CHAR_MAX - // is equivalent to unlimited grouping: -#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS - BOOST_STATIC_ASSERT(std::numeric_limits<T>::digits10 < CHAR_MAX); -#endif - - char left = last_grp_size; -#endif - typedef typename Traits::int_type int_type; CharT const czero = lcast_char_constants<CharT>::zero; int_type const zero = Traits::to_int_type(czero); + BOOST_DEDUCED_TYPENAME boost::mpl::if_c< + (sizeof(int_type) > sizeof(T)) + , int_type + , T + >::type n = n_param; - do - { #ifndef BOOST_LEXICAL_CAST_ASSUME_C_LOCALE - if(left == 0) - { - ++group; - if(group < grouping_size) - { - char const grp_size = grouping[group]; - last_grp_size = grp_size <= 0 ? CHAR_MAX : grp_size; - } + std::locale loc; + if (loc != std::locale::classic()) { + typedef std::numpunct<CharT> numpunct; + numpunct const& np = BOOST_USE_FACET(numpunct, loc); + std::string const grouping = np.grouping(); + std::string::size_type const grouping_size = grouping.size(); - left = last_grp_size; - --finish; - Traits::assign(*finish, thousands_sep); - } + if ( grouping_size && grouping[0] > 0 ) + { - --left; +#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS + // Check that ulimited group is unreachable: + BOOST_STATIC_ASSERT(std::numeric_limits<T>::digits10 < CHAR_MAX); #endif + CharT thousands_sep = np.thousands_sep(); + std::string::size_type group = 0; // current group number + char last_grp_size = grouping[0]; + char left = last_grp_size; - --finish; - int_type const digit = static_cast<int_type>(n % 10U); - Traits::assign(*finish, Traits::to_char_type(zero + digit)); - n /= 10; - } while(n); + do + { + if(left == 0) + { + ++group; + if(group < grouping_size) + { + char const grp_size = grouping[group]; + last_grp_size = grp_size <= 0 ? CHAR_MAX : grp_size; + } + + left = last_grp_size; + --finish; + Traits::assign(*finish, thousands_sep); + } + + --left; + + --finish; + int_type const digit = static_cast<int_type>(n % 10U); + Traits::assign(*finish, Traits::to_char_type(zero + digit)); + n /= 10; + } while(n); + return finish; + } + } +#endif + { + do + { + --finish; + int_type const digit = static_cast<int_type>(n % 10U); + Traits::assign(*finish, Traits::to_char_type(zero + digit)); + n /= 10; + } while(n); + } return finish; } } - namespace detail // stream wrapper for handling lexical conversions + namespace detail // lcast_ret_unsigned { - template<typename Target, typename Source, typename Traits> - class lexical_stream + template<class Traits, class T, class CharT> + inline bool lcast_ret_unsigned(T& value, const CharT* const begin, const CharT* end) { - private: - typedef typename widest_char< - typename stream_char<Target>::type, - typename stream_char<Source>::type>::type char_type; +#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS + BOOST_STATIC_ASSERT(!std::numeric_limits<T>::is_signed); +#endif + typedef typename Traits::int_type int_type; + CharT const czero = lcast_char_constants<CharT>::zero; + --end; + value = 0; - typedef Traits traits_type; + if (begin > end || *end < czero || *end >= czero + 10) + return false; + value = *end - czero; + --end; + T multiplier = 1; + bool multiplier_overflowed = false; - public: - lexical_stream(char_type* = 0, char_type* = 0) - { - stream.unsetf(std::ios::skipws); - lcast_set_precision(stream, static_cast<Source*>(0), static_cast<Target*>(0) ); +#ifndef BOOST_LEXICAL_CAST_ASSUME_C_LOCALE + std::locale loc; + if (loc != std::locale::classic()) { + typedef std::numpunct<CharT> numpunct; + numpunct const& np = BOOST_USE_FACET(numpunct, loc); + std::string const& grouping = np.grouping(); + std::string::size_type const grouping_size = grouping.size(); + + /* According to Programming languages - C++ + * we MUST check for correct grouping + */ + if (grouping_size && grouping[0] > 0) + { + unsigned char current_grouping = 0; + CharT const thousands_sep = np.thousands_sep(); + char remained = grouping[current_grouping] - 1; + bool shall_we_return = true; + + for(;end>=begin; --end) + { + if (remained) { + T const multiplier_10 = multiplier * 10; + if (multiplier_10 / 10 != multiplier) multiplier_overflowed = true; + + T const dig_value = *end - czero; + T const new_sub_value = multiplier_10 * dig_value; + + if (*end < czero || *end >= czero + 10 + /* detecting overflow */ + || (dig_value && new_sub_value / dig_value != multiplier_10) + || static_cast<T>((std::numeric_limits<T>::max)()-new_sub_value) < value + || (multiplier_overflowed && dig_value) + ) + return false; + + value += new_sub_value; + multiplier *= 10; + --remained; + } else { + if ( !Traits::eq(*end, thousands_sep) ) //|| begin == end ) return false; + { + /* + * According to Programming languages - C++ + * Digit grouping is checked. That is, the positions of discarded + * separators is examined for consistency with + * use_facet<numpunct<charT> >(loc ).grouping() + * + * BUT what if there is no separators at all and grouping() + * is not empty? Well, we have no extraced separators, so we + * won`t check them for consistency. This will allow us to + * work with "C" locale from other locales + */ + shall_we_return = false; + break; + } else { + if ( begin == end ) return false; + if (current_grouping < grouping_size-1 ) ++current_grouping; + remained = grouping[current_grouping]; + } + } + } + + if (shall_we_return) return true; + } } - ~lexical_stream() +#endif { - #if defined(BOOST_NO_STRINGSTREAM) - stream.freeze(false); - #endif + while ( begin <= end ) + { + T const multiplier_10 = multiplier * 10; + if (multiplier_10 / 10 != multiplier) multiplier_overflowed = true; + + T const dig_value = *end - czero; + T const new_sub_value = multiplier_10 * dig_value; + + if (*end < czero || *end >= czero + 10 + /* detecting overflow */ + || (dig_value && new_sub_value / dig_value != multiplier_10) + || static_cast<T>((std::numeric_limits<T>::max)()-new_sub_value) < value + || (multiplier_overflowed && dig_value) + ) + return false; + + value += new_sub_value; + multiplier *= 10; + --end; + } } - bool operator<<(const Source &input) - { - return !(stream << input).fail(); + return true; + } + } + + namespace detail + { + template <class CharT> + bool lc_iequal(const CharT* val, const CharT* lcase, const CharT* ucase, unsigned int len) BOOST_NOEXCEPT { + for( unsigned int i=0; i < len; ++i ) { + if ( val[i] != lcase[i] && val[i] != ucase[i] ) return false; } - template<typename InputStreamable> - bool operator>>(InputStreamable &output) + + return true; + } + + /* Returns true and sets the correct value if found NaN or Inf. */ + template <class CharT, class T> + inline bool parse_inf_nan_impl(const CharT* begin, const CharT* end, T& value + , const CharT* lc_NAN, const CharT* lc_nan + , const CharT* lc_INFINITY, const CharT* lc_infinity + , const CharT opening_brace, const CharT closing_brace) BOOST_NOEXCEPT + { + using namespace std; + if (begin == end) return false; + const CharT minus = lcast_char_constants<CharT>::minus; + const CharT plus = lcast_char_constants<CharT>::plus; + const int inifinity_size = 8; + + bool has_minus = false; + /* Parsing +/- */ + if( *begin == minus) { - return !is_pointer<InputStreamable>::value && - stream >> output && - stream.get() == -#if defined(__GNUC__) && (__GNUC__<3) && defined(BOOST_NO_STD_WSTRING) -// GCC 2.9x lacks std::char_traits<>::eof(). -// We use BOOST_NO_STD_WSTRING to filter out STLport and libstdc++-v3 -// configurations, which do provide std::char_traits<>::eof(). - - EOF; -#else - traits_type::eof(); -#endif + ++ begin; + has_minus = true; } + else if( *begin == plus ) ++begin; -#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + if( end-begin < 3 ) return false; + if( lc_iequal(begin, lc_nan, lc_NAN, 3) ) + { + begin += 3; + if (end != begin) /* It is 'nan(...)' or some bad input*/ + { + if(end-begin<2) return false; // bad input + -- end; + if( *begin != opening_brace || *end != closing_brace) return false; // bad input + } - bool operator>>(std::string &output) + if( !has_minus ) value = std::numeric_limits<T>::quiet_NaN(); + else value = (boost::math::changesign) (std::numeric_limits<T>::quiet_NaN()); + return true; + } else + if (( /* 'INF' or 'inf' */ + end-begin==3 + && + lc_iequal(begin, lc_infinity, lc_INFINITY, 3) + ) + || + ( /* 'INFINITY' or 'infinity' */ + end-begin==inifinity_size + && + lc_iequal(begin, lc_infinity, lc_INFINITY, inifinity_size) + ) + ) { - #if defined(BOOST_NO_STRINGSTREAM) - stream << '\0'; - #endif - stream.str().swap(output); + if( !has_minus ) value = std::numeric_limits<T>::infinity(); + else value = (boost::math::changesign) (std::numeric_limits<T>::infinity()); return true; } - #ifndef BOOST_LCAST_NO_WCHAR_T - bool operator>>(std::wstring &output) + + return false; + } + + template <class CharT, class T> + bool put_inf_nan_impl(CharT* begin, CharT*& end, const T& value + , const CharT* lc_nan + , const CharT* lc_infinity) BOOST_NOEXCEPT + { + using namespace std; + const CharT minus = lcast_char_constants<CharT>::minus; + if ( (boost::math::isnan)(value) ) { - stream.str().swap(output); + if ( (boost::math::signbit)(value) ) + { + *begin = minus; + ++ begin; + } + + memcpy(begin, lc_nan, 3 * sizeof(CharT)); + end = begin + 3; + return true; + } else if ( (boost::math::isinf)(value) ) + { + if ( (boost::math::signbit)(value) ) + { + *begin = minus; + ++ begin; + } + + memcpy(begin, lc_infinity, 3 * sizeof(CharT)); + end = begin + 3; return true; } - #endif + return false; + } + + +#ifndef BOOST_LCAST_NO_WCHAR_T + template <class T> + bool parse_inf_nan(const wchar_t* begin, const wchar_t* end, T& value) BOOST_NOEXCEPT + { + return parse_inf_nan_impl(begin, end, value + , L"NAN", L"nan" + , L"INFINITY", L"infinity" + , L'(', L')'); + } + + template <class T> + bool put_inf_nan(wchar_t* begin, wchar_t*& end, const T& value) BOOST_NOEXCEPT + { + return put_inf_nan_impl(begin, end, value, L"nan", L"infinity"); + } + +#endif +#if !defined(BOOST_NO_CHAR16_T) && !defined(BOOST_NO_UNICODE_LITERALS) + template <class T> + bool parse_inf_nan(const char16_t* begin, const char16_t* end, T& value) BOOST_NOEXCEPT + { + return parse_inf_nan_impl(begin, end, value + , u"NAN", u"nan" + , u"INFINITY", u"infinity" + , u'(', u')'); + } + + template <class T> + bool put_inf_nan(char16_t* begin, char16_t*& end, const T& value) BOOST_NOEXCEPT + { + return put_inf_nan_impl(begin, end, value, u"nan", u"infinity"); + } +#endif +#if !defined(BOOST_NO_CHAR32_T) && !defined(BOOST_NO_UNICODE_LITERALS) + template <class T> + bool parse_inf_nan(const char32_t* begin, const char32_t* end, T& value) BOOST_NOEXCEPT + { + return parse_inf_nan_impl(begin, end, value + , U"NAN", U"nan" + , U"INFINITY", U"infinity" + , U'(', U')'); + } + + template <class T> + bool put_inf_nan(char32_t* begin, char32_t*& end, const T& value) BOOST_NOEXCEPT + { + return put_inf_nan_impl(begin, end, value, U"nan", U"infinity"); + } +#endif + + template <class CharT, class T> + bool parse_inf_nan(const CharT* begin, const CharT* end, T& value) BOOST_NOEXCEPT + { + return parse_inf_nan_impl(begin, end, value + , "NAN", "nan" + , "INFINITY", "infinity" + , '(', ')'); + } + + template <class CharT, class T> + bool put_inf_nan(CharT* begin, CharT*& end, const T& value) BOOST_NOEXCEPT + { + return put_inf_nan_impl(begin, end, value, "nan", "infinity"); + } + } + + + namespace detail // lcast_ret_float + { + template <class T> + struct mantissa_holder_type + { + /* Can not be used with this type */ + }; + + template <> + struct mantissa_holder_type<float> + { + typedef unsigned int type; + }; + + template <> + struct mantissa_holder_type<double> + { +#if defined(BOOST_HAS_LONG_LONG) + typedef boost::ulong_long_type type; +#elif defined(BOOST_HAS_MS_INT64) + typedef unsigned __int64 type; +#endif + }; + + template<class Traits, class T, class CharT> + inline bool lcast_ret_float(T& value, const CharT* begin, const CharT* end) + { + +#ifndef BOOST_LEXICAL_CAST_ASSUME_C_LOCALE + std::locale loc; + typedef std::numpunct<CharT> numpunct; + numpunct const& np = BOOST_USE_FACET(numpunct, loc); + std::string const grouping( + (loc == std::locale::classic()) + ? std::string() + : np.grouping() + ); + std::string::size_type const grouping_size = grouping.size(); + CharT const thousands_sep = grouping_size ? np.thousands_sep() : 0; + CharT const decimal_point = np.decimal_point(); + bool found_grouping = false; + std::string::size_type last_grouping_pos = grouping_size - 1; #else - bool operator>>(std::basic_string<char_type,traits_type>& output) - { - stream.str().swap(output); - return true; + CharT const decimal_point = lcast_char_constants<CharT>::c_decimal_separator; +#endif + + CharT const czero = lcast_char_constants<CharT>::zero; + CharT const minus = lcast_char_constants<CharT>::minus; + CharT const plus = lcast_char_constants<CharT>::plus; + CharT const capital_e = lcast_char_constants<CharT>::capital_e; + CharT const lowercase_e = lcast_char_constants<CharT>::lowercase_e; + + value = static_cast<T>(0); + + if (parse_inf_nan(begin, end, value)) return true; + + typedef typename Traits::int_type int_type; + typedef BOOST_DEDUCED_TYPENAME mantissa_holder_type<T>::type mantissa_type; + int_type const zero = Traits::to_int_type(czero); + if (begin == end) return false; + + /* Getting the plus/minus sign */ + bool has_minus = false; + if (Traits::eq(*begin, minus) ) { + ++ begin; + has_minus = true; + if (begin == end) return false; + } else if (Traits::eq(*begin, plus) ) { + ++begin; + if (begin == end) return false; } - template<class Alloc> - bool operator>>(std::basic_string<char_type,traits_type,Alloc>& out) + bool found_decimal = false; + bool found_number_before_exp = false; + int pow_of_10 = 0; + mantissa_type mantissa=0; + bool is_mantissa_full = false; + + char length_since_last_delim = 0; + + while ( begin != end ) { - std::basic_string<char_type,traits_type> str(stream.str()); - out.assign(str.begin(), str.end()); - return true; + if (found_decimal) { + /* We allow no thousand_separators after decimal point */ + + mantissa_type tmp_mantissa = mantissa * 10u; + if (Traits::eq(*begin, lowercase_e) || Traits::eq(*begin, capital_e)) break; + if ( *begin < czero || *begin >= czero + 10 ) return false; + if ( is_mantissa_full + || tmp_mantissa / 10u != mantissa + || (std::numeric_limits<mantissa_type>::max)()-(*begin - zero) < tmp_mantissa + ) { + is_mantissa_full = true; + ++ begin; + continue; + } + + -- pow_of_10; + mantissa = tmp_mantissa; + mantissa += *begin - zero; + + found_number_before_exp = true; + } else { + + if (*begin >= czero && *begin < czero + 10) { + + /* Checking for mantissa overflow. If overflow will + * occur, them we only increase multiplyer + */ + mantissa_type tmp_mantissa = mantissa * 10u; + if( !is_mantissa_full + && tmp_mantissa / 10u == mantissa + && (std::numeric_limits<mantissa_type>::max)()-(*begin - zero) >= tmp_mantissa + ) + { + mantissa = tmp_mantissa; + mantissa += *begin - zero; + } else + { + is_mantissa_full = true; + ++ pow_of_10; + } + + found_number_before_exp = true; + ++ length_since_last_delim; + } else if (Traits::eq(*begin, decimal_point) || Traits::eq(*begin, lowercase_e) || Traits::eq(*begin, capital_e)) { +#ifndef BOOST_LEXICAL_CAST_ASSUME_C_LOCALE + /* If ( we need to check grouping + * and ( grouping missmatches + * or grouping position is incorrect + * or we are using the grouping position 0 twice + * ) + * ) then return error + */ + if( grouping_size && found_grouping + && ( + length_since_last_delim != grouping[0] + || last_grouping_pos>1 + || (last_grouping_pos==0 && grouping_size>1) + ) + ) return false; +#endif + + if(Traits::eq(*begin, decimal_point)) { + ++ begin; + found_decimal = true; + if (!found_number_before_exp && begin==end) return false; + continue; + }else { + if (!found_number_before_exp) return false; + break; + } + } +#ifndef BOOST_LEXICAL_CAST_ASSUME_C_LOCALE + else if (grouping_size && Traits::eq(*begin, thousands_sep)){ + if(found_grouping) + { + /* It is not he first time, when we find thousands separator, + * so we need to chek, is the distance between two groupings + * equal to grouping[last_grouping_pos] */ + + if (length_since_last_delim != grouping[last_grouping_pos] ) + { + if (!last_grouping_pos) return false; + else + { + -- last_grouping_pos; + if (length_since_last_delim != grouping[last_grouping_pos]) return false; + } + } else + /* We are calling the grouping[0] twice, when grouping size is more than 1 */ + if (grouping_size>1u && last_grouping_pos+1<grouping_size) return false; + + } else { + /* Delimiter at the begining ',000' */ + if (!length_since_last_delim) return false; + + found_grouping = true; + if (length_since_last_delim > grouping[last_grouping_pos] ) return false; + } + + length_since_last_delim = 0; + ++ begin; + + /* Delimiter at the end '100,' */ + if (begin == end) return false; + continue; + } +#endif + else return false; + } + + ++begin; } + + // Exponent found + if ( begin != end && (Traits::eq(*begin, lowercase_e) || Traits::eq(*begin, capital_e)) ) { + ++ begin; + if ( begin == end ) return false; + + bool exp_has_minus = false; + if(Traits::eq(*begin, minus)) { + exp_has_minus = true; + ++ begin; + if ( begin == end ) return false; + } else if (Traits::eq(*begin, plus)) { + ++ begin; + if ( begin == end ) return false; + } + + int exp_pow_of_10 = 0; + while ( begin != end ) + { + if ( *begin < czero + || *begin >= czero + 10 + || exp_pow_of_10 * 10 < exp_pow_of_10) /* Overflows are checked lower more precisely*/ + return false; + + exp_pow_of_10 *= 10; + exp_pow_of_10 += *begin - zero; + ++ begin; + }; + + if ( exp_pow_of_10 ) { + /* Overflows are checked lower */ + if ( exp_has_minus ) { + pow_of_10 -= exp_pow_of_10; + } else { + pow_of_10 += exp_pow_of_10; + } + } + } + + /* We need a more accurate algorithm... We can not use current algorithm + * with long doubles (and with doubles if sizeof(double)==sizeof(long double)). + */ + long double result = std::pow(10.0L, pow_of_10) * mantissa; + value = static_cast<T>( has_minus ? (boost::math::changesign)(result) : result); + + if ( (boost::math::isinf)(value) || (boost::math::isnan)(value) ) return false; + + return true; + } + } + + namespace detail // stl_buf_unlocker + { + template< class BufferType, class CharT > + class stl_buf_unlocker: public BufferType{ + public: + typedef BufferType base_class; +#ifndef BOOST_NO_USING_TEMPLATE + using base_class::pptr; + using base_class::pbase; + using base_class::setg; + using base_class::setp; +#else + CharT* pptr() const { return base_class::pptr(); } + CharT* pbase() const { return base_class::pbase(); } + void setg(CharT* gbeg, CharT* gnext, CharT* gend){ return base_class::setg(gbeg, gnext, gend); } + void setp(CharT* pbeg, CharT* pend) { return setp(pbeg, pend); } #endif - private: - #if defined(BOOST_NO_STRINGSTREAM) - std::strstream stream; - #elif defined(BOOST_NO_STD_LOCALE) - std::stringstream stream; - #else - std::basic_stringstream<char_type,traits_type> stream; - #endif }; } + namespace detail + { + struct do_not_construct_out_stream_t{}; + } + namespace detail // optimized stream wrapper { // String representation of Source has an upper limit. template< class CharT // a result of widest_char transformation - , class Base // lexical_streambuf_fake or basic_streambuf<CharT> , class Traits // usually char_traits<CharT> + , bool RequiresStringbuffer > - class lexical_stream_limited_src : public Base + class lexical_stream_limited_src { + +#if defined(BOOST_NO_STRINGSTREAM) + typedef std::ostrstream out_stream_t; + typedef stl_buf_unlocker<std::strstreambuf, char> unlocked_but_t; +#elif defined(BOOST_NO_STD_LOCALE) + typedef std::ostringstream out_stream_t; + typedef stl_buf_unlocker<std::stringbuf, char> unlocked_but_t; +#else + typedef std::basic_ostringstream<CharT, Traits> out_stream_t; + typedef stl_buf_unlocker<std::basic_stringbuf<CharT, Traits>, CharT> unlocked_but_t; +#endif + typedef BOOST_DEDUCED_TYPENAME ::boost::mpl::if_c< + RequiresStringbuffer, + out_stream_t, + do_not_construct_out_stream_t + >::type deduced_out_stream_t; + // A string representation of Source is written to [start, finish). - // Currently, it is assumed that [start, finish) is big enough - // to hold a string representation of any Source value. CharT* start; CharT* finish; + deduced_out_stream_t out_stream; + + public: + lexical_stream_limited_src(CharT* sta, CharT* fin) + : start(sta) + , finish(fin) + {} private: + // Undefined: + lexical_stream_limited_src(lexical_stream_limited_src const&); + void operator=(lexical_stream_limited_src const&); - static void widen_and_assign(char*p, char ch) +/************************************ HELPER FUNCTIONS FOR OPERATORS << ( ... ) ********************************/ + bool shl_char(CharT ch) BOOST_NOEXCEPT { - Traits::assign(*p, ch); + Traits::assign(*start, ch); + finish = start + 1; + return true; } #ifndef BOOST_LCAST_NO_WCHAR_T - static void widen_and_assign(wchar_t* p, char ch) + template <class T> + bool shl_char(T ch) { - // TODO: use BOOST_NO_STD_LOCALE + BOOST_STATIC_ASSERT_MSG(( sizeof(T) <= sizeof(CharT)) , + "boost::lexical_cast does not support narrowing of char types." + "Use boost::locale instead" ); +#ifndef BOOST_LEXICAL_CAST_ASSUME_C_LOCALE std::locale loc; - wchar_t w = BOOST_USE_FACET(std::ctype<wchar_t>, loc).widen(ch); - Traits::assign(*p, w); + CharT const w = BOOST_USE_FACET(std::ctype<CharT>, loc).widen(ch); +#else + CharT const w = ch; +#endif + Traits::assign(*start, w); + finish = start + 1; + return true; } +#endif - static void widen_and_assign(wchar_t* p, wchar_t ch) + bool shl_char_array(CharT const* str) BOOST_NOEXCEPT { - Traits::assign(*p, ch); + start = const_cast<CharT*>(str); + finish = start + Traits::length(str); + return true; } - static void widen_and_assign(char*, wchar_t ch); // undefined -#endif + template <class T> + bool shl_char_array(T const* str) + { + BOOST_STATIC_ASSERT_MSG(( sizeof(T) <= sizeof(CharT)), + "boost::lexical_cast does not support narrowing of char types." + "Use boost::locale instead" ); + return shl_input_streamable(str); + } + + bool shl_char_array_limited(CharT const* str, std::size_t max_size) BOOST_NOEXCEPT + { + start = const_cast<CharT*>(str); + finish = std::find(start, start + max_size, Traits::to_char_type(0)); + return true; + } - template<class OutputStreamable> - bool lcast_put(const OutputStreamable& input) + template<typename InputStreamable> + bool shl_input_streamable(InputStreamable& input) { - this->setp(start, finish); - std::basic_ostream<CharT> stream(static_cast<Base*>(this)); - lcast_set_precision(stream, static_cast<OutputStreamable*>(0)); - bool const result = !(stream << input).fail(); - finish = this->pptr(); +#if defined(BOOST_NO_STRINGSTREAM) || defined(BOOST_NO_STD_LOCALE) + // If you have compilation error at this point, than your STL library + // does not support such conversions. Try updating it. + BOOST_STATIC_ASSERT((boost::is_same<char, CharT>::value)); +#endif + bool const result = !(out_stream << input).fail(); + const unlocked_but_t* const p + = static_cast<unlocked_but_t*>(out_stream.rdbuf()) ; + start = p->pbase(); + finish = p->pptr(); return result; } - // Undefined: - lexical_stream_limited_src(lexical_stream_limited_src const&); - void operator=(lexical_stream_limited_src const&); + template <class T> + inline bool shl_signed(T n) + { + start = lcast_put_unsigned<Traits>(lcast_to_unsigned(n), finish); + if(n < 0) + { + --start; + CharT const minus = lcast_char_constants<CharT>::minus; + Traits::assign(*start, minus); + } + return true; + } - public: + template <class T, class SomeCharT> + bool shl_real_type(const T& val, SomeCharT* begin, SomeCharT*& end) + { + if (put_inf_nan(begin, end, val)) return true; + lcast_set_precision(out_stream, &val); + return shl_input_streamable(val); + } - lexical_stream_limited_src(CharT* sta, CharT* fin) - : start(sta) - , finish(fin) - {} + static bool shl_real_type(float val, char* begin, char*& end) + { using namespace std; + if (put_inf_nan(begin, end, val)) return true; + const double val_as_double = val; + end = begin + +#if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION) + sprintf_s(begin, end-begin, +#else + sprintf(begin, +#endif + "%.*g", static_cast<int>(boost::detail::lcast_get_precision<float>()), val_as_double); + return end > begin; + } + + static bool shl_real_type(double val, char* begin, char*& end) + { using namespace std; + if (put_inf_nan(begin, end, val)) return true; + end = begin + +#if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION) + sprintf_s(begin, end-begin, +#else + sprintf(begin, +#endif + "%.*g", static_cast<int>(boost::detail::lcast_get_precision<double>()), val); + return end > begin; + } - public: // output +#ifndef __MINGW32__ + static bool shl_real_type(long double val, char* begin, char*& end) + { using namespace std; + if (put_inf_nan(begin, end, val)) return true; + end = begin + +#if defined(_MSC_VER) && (_MSC_VER >= 1400) && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION) + sprintf_s(begin, end-begin, +#else + sprintf(begin, +#endif + "%.*Lg", static_cast<int>(boost::detail::lcast_get_precision<long double>()), val ); + return end > begin; + } +#endif + + +#if !defined(BOOST_LCAST_NO_WCHAR_T) && !defined(BOOST_NO_SWPRINTF) && !defined(__MINGW32__) + static bool shl_real_type(float val, wchar_t* begin, wchar_t*& end) + { using namespace std; + if (put_inf_nan(begin, end, val)) return true; + const double val_as_double = val; + end = begin + swprintf(begin, end-begin, + L"%.*g", + static_cast<int>(boost::detail::lcast_get_precision<float >()), + val_as_double ); + return end > begin; + } + static bool shl_real_type(double val, wchar_t* begin, wchar_t*& end) + { using namespace std; + if (put_inf_nan(begin, end, val)) return true; + end = begin + swprintf(begin, end-begin, + L"%.*g", static_cast<int>(boost::detail::lcast_get_precision<double >()), val ); + return end > begin; + } + + static bool shl_real_type(long double val, wchar_t* begin, wchar_t*& end) + { using namespace std; + if (put_inf_nan(begin, end, val)) return true; + end = begin + swprintf(begin, end-begin, + L"%.*Lg", static_cast<int>(boost::detail::lcast_get_precision<long double >()), val ); + return end > begin; + } +#endif + +/************************************ OPERATORS << ( ... ) ********************************/ + public: template<class Alloc> - bool operator<<(std::basic_string<CharT,Traits,Alloc> const& str) + bool operator<<(std::basic_string<CharT,Traits,Alloc> const& str) BOOST_NOEXCEPT { start = const_cast<CharT*>(str.data()); finish = start + str.length(); return true; } - bool operator<<(bool); - bool operator<<(char); -#if !defined(BOOST_LCAST_NO_WCHAR_T) && !defined(BOOST_NO_INTRINSIC_WCHAR_T) - bool operator<<(wchar_t); -#endif - bool operator<<(CharT const*); - bool operator<<(short); - bool operator<<(int); - bool operator<<(long); - bool operator<<(unsigned short); - bool operator<<(unsigned int); - bool operator<<(unsigned long); + template<class Alloc> + bool operator<<(::boost::container::basic_string<CharT,Traits,Alloc> const& str) BOOST_NOEXCEPT + { + start = const_cast<CharT*>(str.data()); + finish = start + str.length(); + return true; + } + + bool operator<<(bool value) BOOST_NOEXCEPT + { + CharT const czero = lcast_char_constants<CharT>::zero; + Traits::assign(*start, Traits::to_char_type(czero + value)); + finish = start + 1; + return true; + } + + bool operator<<(const iterator_range<CharT*>& rng) BOOST_NOEXCEPT + { + start = rng.begin(); + finish = rng.end(); + return true; + } + + bool operator<<(const iterator_range<const CharT*>& rng) BOOST_NOEXCEPT + { + start = const_cast<CharT*>(rng.begin()); + finish = const_cast<CharT*>(rng.end()); + return true; + } + + bool operator<<(const iterator_range<const signed char*>& rng) BOOST_NOEXCEPT + { + return (*this) << iterator_range<char*>( + const_cast<char*>(reinterpret_cast<const char*>(rng.begin())), + const_cast<char*>(reinterpret_cast<const char*>(rng.end())) + ); + } + + bool operator<<(const iterator_range<const unsigned char*>& rng) BOOST_NOEXCEPT + { + return (*this) << iterator_range<char*>( + const_cast<char*>(reinterpret_cast<const char*>(rng.begin())), + const_cast<char*>(reinterpret_cast<const char*>(rng.end())) + ); + } + + bool operator<<(const iterator_range<signed char*>& rng) BOOST_NOEXCEPT + { + return (*this) << iterator_range<char*>( + reinterpret_cast<char*>(rng.begin()), + reinterpret_cast<char*>(rng.end()) + ); + } + + bool operator<<(const iterator_range<unsigned char*>& rng) BOOST_NOEXCEPT + { + return (*this) << iterator_range<char*>( + reinterpret_cast<char*>(rng.begin()), + reinterpret_cast<char*>(rng.end()) + ); + } + + bool operator<<(char ch) { return shl_char(ch); } + bool operator<<(unsigned char ch) { return ((*this) << static_cast<char>(ch)); } + bool operator<<(signed char ch) { return ((*this) << static_cast<char>(ch)); } +#if !defined(BOOST_LCAST_NO_WCHAR_T) + bool operator<<(wchar_t const* str) { return shl_char_array(str); } + bool operator<<(wchar_t * str) { return shl_char_array(str); } +#ifndef BOOST_NO_INTRINSIC_WCHAR_T + bool operator<<(wchar_t ch) { return shl_char(ch); } +#endif +#endif +#if !defined(BOOST_NO_CHAR16_T) && !defined(BOOST_NO_UNICODE_LITERALS) + bool operator<<(char16_t ch) { return shl_char(ch); } + bool operator<<(char16_t * str) { return shl_char_array(str); } + bool operator<<(char16_t const * str) { return shl_char_array(str); } +#endif +#if !defined(BOOST_NO_CHAR32_T) && !defined(BOOST_NO_UNICODE_LITERALS) + bool operator<<(char32_t ch) { return shl_char(ch); } + bool operator<<(char32_t * str) { return shl_char_array(str); } + bool operator<<(char32_t const * str) { return shl_char_array(str); } +#endif + bool operator<<(unsigned char const* ch) { return ((*this) << reinterpret_cast<char const*>(ch)); } + bool operator<<(unsigned char * ch) { return ((*this) << reinterpret_cast<char *>(ch)); } + bool operator<<(signed char const* ch) { return ((*this) << reinterpret_cast<char const*>(ch)); } + bool operator<<(signed char * ch) { return ((*this) << reinterpret_cast<char *>(ch)); } + bool operator<<(char const* str) { return shl_char_array(str); } + bool operator<<(char* str) { return shl_char_array(str); } + bool operator<<(short n) { return shl_signed(n); } + bool operator<<(int n) { return shl_signed(n); } + bool operator<<(long n) { return shl_signed(n); } + bool operator<<(unsigned short n) { start = lcast_put_unsigned<Traits>(n, finish); return true; } + bool operator<<(unsigned int n) { start = lcast_put_unsigned<Traits>(n, finish); return true; } + bool operator<<(unsigned long n) { start = lcast_put_unsigned<Traits>(n, finish); return true; } + #if defined(BOOST_HAS_LONG_LONG) - bool operator<<(boost::ulong_long_type); - bool operator<<(boost::long_long_type ); + bool operator<<(boost::ulong_long_type n) { start = lcast_put_unsigned<Traits>(n, finish); return true; } + bool operator<<(boost::long_long_type n) { return shl_signed(n); } #elif defined(BOOST_HAS_MS_INT64) - bool operator<<(unsigned __int64); - bool operator<<( __int64); + bool operator<<(unsigned __int64 n) { start = lcast_put_unsigned<Traits>(n, finish); return true; } + bool operator<<( __int64 n) { return shl_signed(n); } +#endif + bool operator<<(float val) { return shl_real_type(val, start, finish); } + bool operator<<(double val) { return shl_real_type(val, start, finish); } + bool operator<<(long double val) { +#ifndef __MINGW32__ + return shl_real_type(val, start, finish); +#else + return shl_real_type(static_cast<double>(val), start, finish); #endif - // These three operators use ostream and streambuf. - // lcast_streambuf_for_source<T>::value is true. - bool operator<<(float); - bool operator<<(double); - bool operator<<(long double); + } + + template <std::size_t N> + bool operator<<(boost::array<CharT, N> const& input) BOOST_NOEXCEPT + { return shl_char_array_limited(input.begin(), N); } + + template <std::size_t N> + bool operator<<(boost::array<unsigned char, N> const& input) BOOST_NOEXCEPT + { return ((*this) << reinterpret_cast<boost::array<char, N> const& >(input)); } + + template <std::size_t N> + bool operator<<(boost::array<signed char, N> const& input) BOOST_NOEXCEPT + { return ((*this) << reinterpret_cast<boost::array<char, N> const& >(input)); } + + template <std::size_t N> + bool operator<<(boost::array<const CharT, N> const& input) BOOST_NOEXCEPT + { return shl_char_array_limited(input.begin(), N); } + + template <std::size_t N> + bool operator<<(boost::array<const unsigned char, N> const& input) BOOST_NOEXCEPT + { return ((*this) << reinterpret_cast<boost::array<const char, N> const& >(input)); } + + template <std::size_t N> + bool operator<<(boost::array<const signed char, N> const& input) BOOST_NOEXCEPT + { return ((*this) << reinterpret_cast<boost::array<const char, N> const& >(input)); } + +#if !defined(BOOST_NO_CXX11_HDR_ARRAY) && defined(BOOST_HAS_TR1_ARRAY) + template <std::size_t N> + bool operator<<(std::array<CharT, N> const& input) BOOST_NOEXCEPT + { return shl_char_array_limited(input.begin(), N); } + + template <std::size_t N> + bool operator<<(std::array<unsigned char, N> const& input) BOOST_NOEXCEPT + { return ((*this) << reinterpret_cast<boost::array<char, N> const& >(input)); } + + template <std::size_t N> + bool operator<<(std::array<signed char, N> const& input) BOOST_NOEXCEPT + { return ((*this) << reinterpret_cast<boost::array<char, N> const& >(input)); } + + template <std::size_t N> + bool operator<<(std::array<const CharT, N> const& input) BOOST_NOEXCEPT + { return shl_char_array_limited(input.begin(), N); } + + template <std::size_t N> + bool operator<<(std::array<const unsigned char, N> const& input) BOOST_NOEXCEPT + { return ((*this) << reinterpret_cast<boost::array<const char, N> const& >(input)); } + + template <std::size_t N> + bool operator<<(std::array<const signed char, N> const& input) BOOST_NOEXCEPT + { return ((*this) << reinterpret_cast<boost::array<const char, N> const& >(input)); } +#endif // !defined(BOOST_NO_CXX11_HDR_ARRAY) && defined(BOOST_HAS_TR1_ARRAY) + + template <class InStreamable> + bool operator<<(const InStreamable& input) { return shl_input_streamable(input); } + +/************************************ HELPER FUNCTIONS FOR OPERATORS >> ( ... ) ********************************/ + private: - public: // input + template <typename Type> + bool shr_unsigned(Type& output) + { + if (start == finish) return false; + CharT const minus = lcast_char_constants<CharT>::minus; + CharT const plus = lcast_char_constants<CharT>::plus; + bool has_minus = false; + + /* We won`t use `start' any more, so no need in decrementing it after */ + if ( Traits::eq(minus,*start) ) + { + ++start; + has_minus = true; + } else if ( Traits::eq( plus, *start ) ) + { + ++start; + } + + bool const succeed = lcast_ret_unsigned<Traits>(output, start, finish); +#if (defined _MSC_VER) +# pragma warning( push ) +// C4146: unary minus operator applied to unsigned type, result still unsigned +# pragma warning( disable : 4146 ) +#elif defined( __BORLANDC__ ) +# pragma option push -w-8041 +#endif + if (has_minus) output = static_cast<Type>(-output); +#if (defined _MSC_VER) +# pragma warning( pop ) +#elif defined( __BORLANDC__ ) +# pragma option pop +#endif + return succeed; + } + + template <typename Type> + bool shr_signed(Type& output) + { + if (start == finish) return false; + CharT const minus = lcast_char_constants<CharT>::minus; + CharT const plus = lcast_char_constants<CharT>::plus; + typedef BOOST_DEDUCED_TYPENAME make_unsigned<Type>::type utype; + utype out_tmp =0; + bool has_minus = false; + + /* We won`t use `start' any more, so no need in decrementing it after */ + if ( Traits::eq(minus,*start) ) + { + ++start; + has_minus = true; + } else if ( Traits::eq(plus, *start) ) + { + ++start; + } + + bool succeed = lcast_ret_unsigned<Traits>(out_tmp, start, finish); + if (has_minus) { +#if (defined _MSC_VER) +# pragma warning( push ) +// C4146: unary minus operator applied to unsigned type, result still unsigned +# pragma warning( disable : 4146 ) +#elif defined( __BORLANDC__ ) +# pragma option push -w-8041 +#endif + utype const comp_val = static_cast<utype>(-(std::numeric_limits<Type>::min)()); + succeed = succeed && out_tmp<=comp_val; + output = -out_tmp; +#if (defined _MSC_VER) +# pragma warning( pop ) +#elif defined( __BORLANDC__ ) +# pragma option pop +#endif + } else { + utype const comp_val = static_cast<utype>((std::numeric_limits<Type>::max)()); + succeed = succeed && out_tmp<=comp_val; + output = out_tmp; + } + return succeed; + } - // Generic istream-based algorithm. - // lcast_streambuf_for_target<InputStreamable>::value is true. template<typename InputStreamable> - bool operator>>(InputStreamable& output) + bool shr_using_base_class(InputStreamable& output) { #if (defined _MSC_VER) # pragma warning( push ) @@ -766,8 +1697,22 @@ namespace boost if(is_pointer<InputStreamable>::value) return false; - this->setg(start, start, finish); - std::basic_istream<CharT> stream(static_cast<Base*>(this)); +#if defined(BOOST_NO_STRINGSTREAM) || defined(BOOST_NO_STD_LOCALE) + // If you have compilation error at this point, than your STL library + // unsupports such conversions. Try updating it. + BOOST_STATIC_ASSERT((boost::is_same<char, CharT>::value)); +#endif + +#if defined(BOOST_NO_STRINGSTREAM) + std::istrstream stream(start, finish - start); +#elif defined(BOOST_NO_STD_LOCALE) + std::istringstream stream; +#else + std::basic_istringstream<CharT, Traits> stream; +#endif + static_cast<unlocked_but_t*>(stream.rdbuf()) + ->setg(start, start, finish); + stream.unsetf(std::ios::skipws); lcast_set_precision(stream, static_cast<InputStreamable*>(0)); #if (defined _MSC_VER) @@ -786,395 +1731,741 @@ namespace boost #endif } - bool operator>>(CharT&); - -#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION -// This #if is in sync with lcast_streambuf_for_target - - bool operator>>(std::string&); + template<class T> + inline bool shr_xchar(T& output) + { + BOOST_STATIC_ASSERT_MSG(( sizeof(CharT) == sizeof(T) ), + "boost::lexical_cast does not support narrowing of character types." + "Use boost::locale instead" ); + bool const ok = (finish - start == 1); + if (ok) { + CharT out; + Traits::assign(out, *start); + output = static_cast<T>(out); + } + return ok; + } -#ifndef BOOST_LCAST_NO_WCHAR_T - bool operator>>(std::wstring&); +/************************************ OPERATORS >> ( ... ) ********************************/ + public: + bool operator>>(unsigned short& output) { return shr_unsigned(output); } + bool operator>>(unsigned int& output) { return shr_unsigned(output); } + bool operator>>(unsigned long int& output) { return shr_unsigned(output); } + bool operator>>(short& output) { return shr_signed(output); } + bool operator>>(int& output) { return shr_signed(output); } + bool operator>>(long int& output) { return shr_signed(output); } +#if defined(BOOST_HAS_LONG_LONG) + bool operator>>(boost::ulong_long_type& output) { return shr_unsigned(output); } + bool operator>>(boost::long_long_type& output) { return shr_signed(output); } +#elif defined(BOOST_HAS_MS_INT64) + bool operator>>(unsigned __int64& output) { return shr_unsigned(output); } + bool operator>>(__int64& output) { return shr_signed(output); } #endif + bool operator>>(char& output) { return shr_xchar(output); } + bool operator>>(unsigned char& output) { return shr_xchar(output); } + bool operator>>(signed char& output) { return shr_xchar(output); } +#if !defined(BOOST_LCAST_NO_WCHAR_T) && !defined(BOOST_NO_INTRINSIC_WCHAR_T) + bool operator>>(wchar_t& output) { return shr_xchar(output); } +#endif +#if !defined(BOOST_NO_CHAR16_T) && !defined(BOOST_NO_UNICODE_LITERALS) + bool operator>>(char16_t& output) { return shr_xchar(output); } +#endif +#if !defined(BOOST_NO_CHAR32_T) && !defined(BOOST_NO_UNICODE_LITERALS) + bool operator>>(char32_t& output) { return shr_xchar(output); } +#endif + template<class Alloc> + bool operator>>(std::basic_string<CharT,Traits,Alloc>& str) { str.assign(start, finish); return true; } -#else template<class Alloc> - bool operator>>(std::basic_string<CharT,Traits,Alloc>& str) + bool operator>>(::boost::container::basic_string<CharT,Traits,Alloc>& str) { str.assign(start, finish); return true; } + + + private: + template <std::size_t N, class ArrayT> + bool shr_std_array(ArrayT& output) BOOST_NOEXCEPT { - str.assign(start, finish); + using namespace std; + const std::size_t size = finish - start; + if (size > N - 1) { // `-1` because we need to store \0 at the end + return false; + } + + memcpy(output.begin(), start, size * sizeof(CharT)); + *(output.begin() + size) = Traits::to_char_type(0); return true; } -#endif - }; - template<typename CharT, class Base, class Traits> - inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator<<( - bool value) - { - typedef typename Traits::int_type int_type; - CharT const czero = lcast_char_constants<CharT>::zero; - int_type const zero = Traits::to_int_type(czero); - Traits::assign(*start, Traits::to_char_type(zero + value)); - finish = start + 1; - return true; - } + public: - template<typename CharT, class Base, class Traits> - inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator<<( - char ch) - { - widen_and_assign(start, ch); - finish = start + 1; - return true; - } + template <std::size_t N> + bool operator>>(boost::array<CharT, N>& output) BOOST_NOEXCEPT + { + return shr_std_array<N>(output); + } -#if !defined(BOOST_LCAST_NO_WCHAR_T) && !defined(BOOST_NO_INTRINSIC_WCHAR_T) - template<typename CharT, class Base, class Traits> - inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator<<( - wchar_t ch) - { - widen_and_assign(start, ch); - finish = start + 1; - return true; - } -#endif + template <std::size_t N> + bool operator>>(boost::array<unsigned char, N>& output) + { + return ((*this) >> reinterpret_cast<boost::array<char, N>& >(output)); + } - template<typename CharT, class Base, class Traits> - inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator<<( - short n) - { - start = lcast_put_unsigned<Traits>(lcast_to_unsigned(n), finish); - if(n < 0) - { - --start; - CharT const minus = lcast_char_constants<CharT>::minus; - Traits::assign(*start, minus); + template <std::size_t N> + bool operator>>(boost::array<signed char, N>& output) + { + return ((*this) >> reinterpret_cast<boost::array<char, N>& >(output)); + } + +#if !defined(BOOST_NO_CXX11_HDR_ARRAY) && defined(BOOST_HAS_TR1_ARRAY) + template <std::size_t N> + bool operator>>(std::array<CharT, N>& output) BOOST_NOEXCEPT + { + return shr_std_array<N>(output); } - return true; - } - template<typename CharT, class Base, class Traits> - inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator<<( - int n) - { - start = lcast_put_unsigned<Traits>(lcast_to_unsigned(n), finish); - if(n < 0) - { - --start; - CharT const minus = lcast_char_constants<CharT>::minus; - Traits::assign(*start, minus); + template <std::size_t N> + bool operator>>(std::array<unsigned char, N>& output) + { + return ((*this) >> reinterpret_cast<std::array<char, N>& >(output)); } - return true; - } - template<typename CharT, class Base, class Traits> - inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator<<( - long n) - { - start = lcast_put_unsigned<Traits>(lcast_to_unsigned(n), finish); - if(n < 0) - { - --start; - CharT const minus = lcast_char_constants<CharT>::minus; - Traits::assign(*start, minus); + template <std::size_t N> + bool operator>>(std::array<signed char, N>& in) + { + return ((*this) >> reinterpret_cast<std::array<char, N>& >(output)); } - return true; - } +#endif // !defined(BOOST_NO_CXX11_HDR_ARRAY) && defined(BOOST_HAS_TR1_ARRAY) -#if defined(BOOST_HAS_LONG_LONG) - template<typename CharT, class Base, class Traits> - inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator<<( - boost::long_long_type n) - { - start = lcast_put_unsigned<Traits>(lcast_to_unsigned(n), finish); - if(n < 0) + + /* + * case "-0" || "0" || "+0" : output = false; return true; + * case "1" || "+1": output = true; return true; + * default: return false; + */ + bool operator>>(bool& output) BOOST_NOEXCEPT { - --start; + CharT const zero = lcast_char_constants<CharT>::zero; + CharT const plus = lcast_char_constants<CharT>::plus; CharT const minus = lcast_char_constants<CharT>::minus; - Traits::assign(*start, minus); + + switch(finish-start) + { + case 1: + output = Traits::eq(start[0], zero+1); + return output || Traits::eq(start[0], zero ); + case 2: + if ( Traits::eq( plus, *start) ) + { + ++start; + output = Traits::eq(start[0], zero +1); + return output || Traits::eq(start[0], zero ); + } else + { + output = false; + return Traits::eq( minus, *start) + && Traits::eq( zero, start[1]); + } + default: + output = false; // Suppress warning about uninitalized variable + return false; + } } - return true; - } -#elif defined(BOOST_HAS_MS_INT64) - template<typename CharT, class Base, class Traits> - inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator<<( - __int64 n) - { - start = lcast_put_unsigned<Traits>(lcast_to_unsigned(n), finish); - if(n < 0) - { - --start; + + bool operator>>(float& output) { return lcast_ret_float<Traits>(output,start,finish); } + + private: + // Not optimised converter + template <class T> + bool float_types_converter_internal(T& output, int /*tag*/) { + if (parse_inf_nan(start, finish, output)) return true; + bool return_value = shr_using_base_class(output); + + /* Some compilers and libraries successfully + * parse 'inf', 'INFINITY', '1.0E', '1.0E-'... + * We are trying to provide a unified behaviour, + * so we just forbid such conversions (as some + * of the most popular compilers/libraries do) + * */ CharT const minus = lcast_char_constants<CharT>::minus; - Traits::assign(*start, minus); + CharT const plus = lcast_char_constants<CharT>::plus; + CharT const capital_e = lcast_char_constants<CharT>::capital_e; + CharT const lowercase_e = lcast_char_constants<CharT>::lowercase_e; + if ( return_value && + ( + Traits::eq(*(finish-1), lowercase_e) // 1.0e + || Traits::eq(*(finish-1), capital_e) // 1.0E + || Traits::eq(*(finish-1), minus) // 1.0e- or 1.0E- + || Traits::eq(*(finish-1), plus) // 1.0e+ or 1.0E+ + ) + ) return false; + + return return_value; } - return true; - } + + // Optimised converter + bool float_types_converter_internal(double& output,char /*tag*/) { + return lcast_ret_float<Traits>(output,start,finish); + } + public: + + bool operator>>(double& output) + { + /* + * Some compilers implement long double as double. In that case these types have + * same size, same precision, same max and min values... And it means, + * that current implementation of lcast_ret_float cannot be used for type + * double, because it will give a big precision loss. + * */ + boost::mpl::if_c< +#if defined(BOOST_HAS_LONG_LONG) || defined(BOOST_HAS_MS_INT64) + ::boost::type_traits::ice_eq< sizeof(double), sizeof(long double) >::value, +#else + 0 #endif + int, + char + >::type tag = 0; - template<typename CharT, class Base, class Traits> - inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator<<( - unsigned short n) - { - start = lcast_put_unsigned<Traits>(n, finish); - return true; - } + return float_types_converter_internal(output, tag); + } - template<typename CharT, class Base, class Traits> - inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator<<( - unsigned int n) - { - start = lcast_put_unsigned<Traits>(n, finish); - return true; - } + bool operator>>(long double& output) + { + int tag = 0; + return float_types_converter_internal(output, tag); + } - template<typename CharT, class Base, class Traits> - inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator<<( - unsigned long n) - { - start = lcast_put_unsigned<Traits>(n, finish); - return true; - } + // Generic istream-based algorithm. + // lcast_streambuf_for_target<InputStreamable>::value is true. + template<typename InputStreamable> + bool operator>>(InputStreamable& output) { return shr_using_base_class(output); } + }; + } -#if defined(BOOST_HAS_LONG_LONG) - template<typename CharT, class Base, class Traits> - inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator<<( - boost::ulong_long_type n) - { - start = lcast_put_unsigned<Traits>(n, finish); - return true; - } -#elif defined(BOOST_HAS_MS_INT64) - template<typename CharT, class Base, class Traits> - inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator<<( - unsigned __int64 n) + namespace detail + { + template<class T> + struct array_to_pointer_decay { - start = lcast_put_unsigned<Traits>(n, finish); - return true; - } -#endif + typedef T type; + }; - template<typename CharT, class Base, class Traits> - inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator<<( - float val) + template<class T, std::size_t N> + struct array_to_pointer_decay<T[N]> { - return this->lcast_put(val); - } + typedef const T * type; + }; - template<typename CharT, class Base, class Traits> - inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator<<( - double val) + template<typename T> + struct is_stdstring { - return this->lcast_put(val); - } + BOOST_STATIC_CONSTANT(bool, value = false ); + }; - template<typename CharT, class Base, class Traits> - inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator<<( - long double val) + template<typename CharT, typename Traits, typename Alloc> + struct is_stdstring< std::basic_string<CharT, Traits, Alloc> > { - return this->lcast_put(val); - } + BOOST_STATIC_CONSTANT(bool, value = true ); + }; - template<typename CharT, class Base, class Traits> - inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator<<( - CharT const* str) + template<typename CharT, typename Traits, typename Alloc> + struct is_stdstring< ::boost::container::basic_string<CharT, Traits, Alloc> > { - start = const_cast<CharT*>(str); - finish = start + Traits::length(str); - return true; - } + BOOST_STATIC_CONSTANT(bool, value = true ); + }; - template<typename CharT, class Base, class Traits> - inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator>>( - CharT& output) - { - bool const ok = (finish - start == 1); - if(ok) - Traits::assign(output, *start); - return ok; - } + template<typename Target, typename Source> + struct is_arithmetic_and_not_xchars + { + BOOST_STATIC_CONSTANT(bool, value = + ( + ::boost::type_traits::ice_and< + ::boost::is_arithmetic<Source>::value, + ::boost::is_arithmetic<Target>::value, + ::boost::type_traits::ice_not< + detail::is_char_or_wchar<Target>::value + >::value, + ::boost::type_traits::ice_not< + detail::is_char_or_wchar<Source>::value + >::value + >::value + ) + ); + }; -#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - template<typename CharT, class Base, class Traits> - inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator>>( - std::string& str) - { - str.assign(start, finish); - return true; - } + /* + * is_xchar_to_xchar<Target, Source>::value is true, when + * Target and Souce are the same char types, or when + * Target and Souce are char types of the same size. + */ + template<typename Target, typename Source> + struct is_xchar_to_xchar + { + BOOST_STATIC_CONSTANT(bool, value = + ( + ::boost::type_traits::ice_or< + ::boost::type_traits::ice_and< + is_same<Source,Target>::value, + is_char_or_wchar<Target>::value + >::value, + ::boost::type_traits::ice_and< + ::boost::type_traits::ice_eq< sizeof(char),sizeof(Target)>::value, + ::boost::type_traits::ice_eq< sizeof(char),sizeof(Source)>::value, + is_char_or_wchar<Target>::value, + is_char_or_wchar<Source>::value + >::value + >::value + ) + ); + }; -#ifndef BOOST_LCAST_NO_WCHAR_T - template<typename CharT, class Base, class Traits> - inline bool lexical_stream_limited_src<CharT,Base,Traits>::operator>>( - std::wstring& str) + + // this metafunction evaluates to true, if we have optimized comnversion + // from Float type to Char array. + // Must be in sync with lexical_stream_limited_src<Char, ...>::shl_real_type(...) + template <typename Float, typename Char> + struct is_this_float_conversion_optimized { - str.assign(start, finish); - return true; - } -#endif + typedef ::boost::type_traits::ice_and< + ::boost::is_float<Float>::value, +#if !defined(BOOST_LCAST_NO_WCHAR_T) && !defined(BOOST_NO_SWPRINTF) && !defined(__MINGW32__) + ::boost::type_traits::ice_or< + ::boost::type_traits::ice_eq<sizeof(Char), sizeof(char) >::value, + ::boost::is_same<Char, wchar_t>::value + >::value +#else + ::boost::type_traits::ice_eq<sizeof(Char), sizeof(char) >::value #endif - } + > result_type; - namespace detail // lcast_streambuf_for_source - { - // Returns true if optimized stream wrapper needs ostream for writing. - template<class Source> - struct lcast_streambuf_for_source - { - BOOST_STATIC_CONSTANT(bool, value = false); + BOOST_STATIC_CONSTANT(bool, value = (result_type::value) ); }; - template<> - struct lcast_streambuf_for_source<float> + template<typename Target, typename Source> + struct is_char_array_to_stdstring { - BOOST_STATIC_CONSTANT(bool, value = true); + BOOST_STATIC_CONSTANT(bool, value = false ); }; - - template<> - struct lcast_streambuf_for_source<double> + + template<typename CharT, typename Traits, typename Alloc> + struct is_char_array_to_stdstring< std::basic_string<CharT, Traits, Alloc>, CharT* > { - BOOST_STATIC_CONSTANT(bool, value = true); + BOOST_STATIC_CONSTANT(bool, value = true ); }; - - template<> - struct lcast_streambuf_for_source<long double> + + template<typename CharT, typename Traits, typename Alloc> + struct is_char_array_to_stdstring< std::basic_string<CharT, Traits, Alloc>, const CharT* > { - BOOST_STATIC_CONSTANT(bool, value = true); + BOOST_STATIC_CONSTANT(bool, value = true ); }; - } - namespace detail // lcast_streambuf_for_target - { - // Returns true if optimized stream wrapper needs istream for reading. - template<class Target> - struct lcast_streambuf_for_target + template<typename CharT, typename Traits, typename Alloc> + struct is_char_array_to_stdstring< ::boost::container::basic_string<CharT, Traits, Alloc>, CharT* > { - BOOST_STATIC_CONSTANT(bool, value = true); + BOOST_STATIC_CONSTANT(bool, value = true ); }; - template<> - struct lcast_streambuf_for_target<char> + template<typename CharT, typename Traits, typename Alloc> + struct is_char_array_to_stdstring< ::boost::container::basic_string<CharT, Traits, Alloc>, const CharT* > { - BOOST_STATIC_CONSTANT(bool, value = false); + BOOST_STATIC_CONSTANT(bool, value = true ); }; -#if !defined(BOOST_LCAST_NO_WCHAR_T) && !defined(BOOST_NO_INTRINSIC_WCHAR_T) - template<> - struct lcast_streambuf_for_target<wchar_t> +#if (defined _MSC_VER) +# pragma warning( push ) +# pragma warning( disable : 4701 ) // possible use of ... before initialization +# pragma warning( disable : 4702 ) // unreachable code +# pragma warning( disable : 4267 ) // conversion from 'size_t' to 'unsigned int' +#endif + template<typename Target, typename Source> + struct lexical_cast_do_cast { - BOOST_STATIC_CONSTANT(bool, value = false); + static inline Target lexical_cast_impl(const Source& arg) + { + typedef BOOST_DEDUCED_TYPENAME detail::array_to_pointer_decay<Source>::type src; + typedef BOOST_DEDUCED_TYPENAME ::boost::remove_cv<src>::type no_cv_src; + typedef BOOST_DEDUCED_TYPENAME detail::stream_char<Target>::type target_char_t; + typedef BOOST_DEDUCED_TYPENAME detail::stream_char<no_cv_src>::type src_char_type; + typedef BOOST_DEDUCED_TYPENAME detail::widest_char< + target_char_t, src_char_type + >::type char_type; + +#if !defined(BOOST_NO_CHAR16_T) && defined(BOOST_NO_UNICODE_LITERALS) + BOOST_STATIC_ASSERT_MSG(( !::boost::is_same<char16_t, src_char_type>::value + && !::boost::is_same<char16_t, target_char_t>::value), + "Your compiler does not have full support for char16_t" ); +#endif +#if !defined(BOOST_NO_CHAR32_T) && defined(BOOST_NO_UNICODE_LITERALS) + BOOST_STATIC_ASSERT_MSG(( !::boost::is_same<char32_t, src_char_type>::value + && !::boost::is_same<char32_t, target_char_t>::value), + "Your compiler does not have full support for char32_t" ); +#endif + + typedef BOOST_DEDUCED_TYPENAME ::boost::detail::deduce_char_traits< + char_type, Target, no_cv_src + >::type traits; + + typedef ::boost::type_traits::ice_and< + ::boost::detail::is_char_or_wchar<src_char_type>::value, // source is lexical type + ::boost::detail::is_char_or_wchar<target_char_t>::value, // target is a lexical type + ::boost::is_same<char, src_char_type>::value, // source is not a wide character based type + ::boost::type_traits::ice_ne<sizeof(char), sizeof(target_char_t) >::value // target type is based on wide character + > is_string_widening_required_t; + + typedef ::boost::type_traits::ice_or< + ::boost::is_integral<no_cv_src>::value, + ::boost::detail::is_this_float_conversion_optimized<no_cv_src, char_type >::value, + ::boost::detail::is_char_or_wchar<src_char_type >::value + > is_source_input_optimized_t; + + // Target type must be default constructible + Target result; + + // If we have an optimized conversion for + // Source, we do not need to construct stringbuf. + const bool requires_stringbuf = ::boost::type_traits::ice_or< + is_string_widening_required_t::value, + ::boost::type_traits::ice_not< is_source_input_optimized_t::value >::value + >::value; + + typedef detail::lexical_stream_limited_src<char_type, traits, requires_stringbuf > interpreter_type; + + typedef detail::lcast_src_length<no_cv_src> lcast_src_length; + std::size_t const src_len = lcast_src_length::value; + char_type buf[src_len + 1]; + lcast_src_length::check_coverage(); + + interpreter_type interpreter(buf, buf + src_len); + + // Disabling ADL, by directly specifying operators. + if(!(interpreter.operator <<(arg) && interpreter.operator >>(result))) + BOOST_LCAST_THROW_BAD_CAST(Source, Target); + + return result; + } }; +#if (defined _MSC_VER) +# pragma warning( pop ) #endif -#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION - template<class Traits, class Alloc> - struct lcast_streambuf_for_target< - std::basic_string<char,Traits,Alloc> > + template <typename Source> + struct lexical_cast_copy { - BOOST_STATIC_CONSTANT(bool, value = false); + static inline const Source& lexical_cast_impl(const Source &arg) BOOST_NOEXCEPT + { + return arg; + } }; -#ifndef BOOST_LCAST_NO_WCHAR_T - template<class Traits, class Alloc> - struct lcast_streambuf_for_target< - std::basic_string<wchar_t,Traits,Alloc> > + template <class Source, class Target > + struct detect_precision_loss { - BOOST_STATIC_CONSTANT(bool, value = false); - }; -#endif -#else - template<> - struct lcast_streambuf_for_target<std::string> + typedef boost::numeric::Trunc<Source> Rounder; + typedef Source source_type ; + + typedef BOOST_DEDUCED_TYPENAME mpl::if_< + ::boost::is_arithmetic<Source>, Source, Source const& + >::type argument_type ; + + static source_type nearbyint ( argument_type s ) + { + const source_type orig_div_round = s / Rounder::nearbyint(s); + const source_type eps = std::numeric_limits<source_type>::epsilon(); + + if ((orig_div_round > 1 ? orig_div_round - 1 : 1 - orig_div_round) > eps) + BOOST_LCAST_THROW_BAD_CAST(Source, Target); + + return s ; + } + + typedef typename Rounder::round_style round_style; + } ; + + template <class Source, class Target > + struct nothrow_overflow_handler { - BOOST_STATIC_CONSTANT(bool, value = false); + void operator() ( boost::numeric::range_check_result r ) + { + if (r != boost::numeric::cInRange) + BOOST_LCAST_THROW_BAD_CAST(Source, Target); + } + } ; + + template <typename Target, typename Source> + struct lexical_cast_dynamic_num_not_ignoring_minus + { + static inline Target lexical_cast_impl(const Source &arg) + { + return boost::numeric::converter< + Target, + Source, + boost::numeric::conversion_traits<Target,Source>, + nothrow_overflow_handler<Source, Target>, + detect_precision_loss<Source, Target> + >::convert(arg); + } }; -#ifndef BOOST_LCAST_NO_WCHAR_T - template<> - struct lcast_streambuf_for_target<std::wstring> + template <typename Target, typename Source> + struct lexical_cast_dynamic_num_ignoring_minus { - BOOST_STATIC_CONSTANT(bool, value = false); + static inline Target lexical_cast_impl(const Source &arg) + { + typedef boost::numeric::converter< + Target, + Source, + boost::numeric::conversion_traits<Target,Source>, + nothrow_overflow_handler<Source, Target>, + detect_precision_loss<Source, Target> + > converter_t; + + return ( + arg < 0 ? -converter_t::convert(-arg) : converter_t::convert(arg) + ); + } + }; + + /* + * lexical_cast_dynamic_num follows the rules: + * 1) If Source can be converted to Target without precision loss and + * without overflows, then assign Source to Target and return + * + * 2) If Source is less than 0 and Target is an unsigned integer, + * then negate Source, check the requirements of rule 1) and if + * successful, assign static_casted Source to Target and return + * + * 3) Otherwise throw a bad_lexical_cast exception + * + * + * Rule 2) required because boost::lexical_cast has the behavior of + * stringstream, which uses the rules of scanf for conversions. And + * in the C99 standard for unsigned input value minus sign is + * optional, so if a negative number is read, no errors will arise + * and the result will be the two's complement. + */ + template <typename Target, typename Source> + struct lexical_cast_dynamic_num + { + static inline Target lexical_cast_impl(const Source &arg) + { + typedef BOOST_DEDUCED_TYPENAME ::boost::mpl::if_c< + ::boost::type_traits::ice_and< + ::boost::type_traits::ice_or< + ::boost::is_signed<Source>::value, + ::boost::is_float<Source>::value + >::value, + ::boost::type_traits::ice_not< + ::boost::is_same<Source, bool>::value + >::value, + ::boost::type_traits::ice_not< + ::boost::is_same<Target, bool>::value + >::value, + ::boost::is_unsigned<Target>::value + >::value, + lexical_cast_dynamic_num_ignoring_minus<Target, Source>, + lexical_cast_dynamic_num_not_ignoring_minus<Target, Source> + >::type caster_type; + + return caster_type::lexical_cast_impl(arg); + } }; + } + + template <typename Target, typename Source> + inline Target lexical_cast(const Source &arg) + { + typedef BOOST_DEDUCED_TYPENAME ::boost::detail::array_to_pointer_decay<Source>::type src; + + typedef BOOST_DEDUCED_TYPENAME ::boost::type_traits::ice_or< + ::boost::detail::is_xchar_to_xchar<Target, src >::value, + ::boost::detail::is_char_array_to_stdstring<Target, src >::value, + ::boost::type_traits::ice_and< + ::boost::is_same<Target, src >::value, + ::boost::detail::is_stdstring<Target >::value + >::value + > shall_we_copy_t; + + typedef BOOST_DEDUCED_TYPENAME + ::boost::detail::is_arithmetic_and_not_xchars<Target, src > shall_we_copy_with_dynamic_check_t; + + typedef BOOST_DEDUCED_TYPENAME ::boost::mpl::if_c< + shall_we_copy_t::value, + ::boost::detail::lexical_cast_copy<src >, + BOOST_DEDUCED_TYPENAME ::boost::mpl::if_c< + shall_we_copy_with_dynamic_check_t::value, + ::boost::detail::lexical_cast_dynamic_num<Target, src >, + ::boost::detail::lexical_cast_do_cast<Target, src > + >::type + >::type caster_type; + + return caster_type::lexical_cast_impl(arg); + } + + template <typename Target> + inline Target lexical_cast(const char* chars, std::size_t count) + { + return ::boost::lexical_cast<Target>( + ::boost::iterator_range<const char*>(chars, chars + count) + ); + } + + + template <typename Target> + inline Target lexical_cast(const unsigned char* chars, std::size_t count) + { + return ::boost::lexical_cast<Target>( + ::boost::iterator_range<const unsigned char*>(chars, chars + count) + ); + } + + template <typename Target> + inline Target lexical_cast(const signed char* chars, std::size_t count) + { + return ::boost::lexical_cast<Target>( + ::boost::iterator_range<const signed char*>(chars, chars + count) + ); + } + +#ifndef BOOST_LCAST_NO_WCHAR_T + template <typename Target> + inline Target lexical_cast(const wchar_t* chars, std::size_t count) + { + return ::boost::lexical_cast<Target>( + ::boost::iterator_range<const wchar_t*>(chars, chars + count) + ); + } #endif +#ifndef BOOST_NO_CHAR16_T + template <typename Target> + inline Target lexical_cast(const char16_t* chars, std::size_t count) + { + return ::boost::lexical_cast<Target>( + ::boost::iterator_range<const char16_t*>(chars, chars + count) + ); + } #endif +#ifndef BOOST_NO_CHAR32_T + template <typename Target> + inline Target lexical_cast(const char32_t* chars, std::size_t count) + { + return ::boost::lexical_cast<Target>( + ::boost::iterator_range<const char32_t*>(chars, chars + count) + ); } +#endif - #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +} // namespace boost - // call-by-const reference version +#else // #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +namespace boost { namespace detail { - template<class T> - struct array_to_pointer_decay + + // selectors for choosing stream character type + template<typename Type> + struct stream_char { - typedef T type; + typedef char type; }; - template<class T, std::size_t N> - struct array_to_pointer_decay<T[N]> +#ifndef BOOST_LCAST_NO_WCHAR_T +#ifndef BOOST_NO_INTRINSIC_WCHAR_T + template<> + struct stream_char<wchar_t> { - typedef const T * type; + typedef wchar_t type; }; +#endif -#if (defined _MSC_VER) -# pragma warning( push ) -# pragma warning( disable : 4701 ) // possible use of ... before initialization -# pragma warning( disable : 4702 ) // unreachable code + template<> + struct stream_char<wchar_t *> + { + typedef wchar_t type; + }; + + template<> + struct stream_char<const wchar_t *> + { + typedef wchar_t type; + }; + + template<> + struct stream_char<std::wstring> + { + typedef wchar_t type; + }; #endif - template< typename Target - , typename Source - , bool Unlimited // string representation of Source is unlimited - , typename CharT - > - Target lexical_cast( - BOOST_DEDUCED_TYPENAME boost::call_traits<Source>::param_type arg, - CharT* buf, std::size_t src_len) + // stream wrapper for handling lexical conversions + template<typename Target, typename Source, typename Traits> + class lexical_stream { - typedef BOOST_DEDUCED_TYPENAME - deduce_char_traits<CharT,Target,Source>::type traits; + private: + typedef typename widest_char< + typename stream_char<Target>::type, + typename stream_char<Source>::type>::type char_type; - typedef BOOST_DEDUCED_TYPENAME boost::mpl::if_c< - lcast_streambuf_for_target<Target>::value || - lcast_streambuf_for_source<Source>::value - , std::basic_streambuf<CharT> - , lexical_streambuf_fake - >::type base; + typedef Traits traits_type; - BOOST_DEDUCED_TYPENAME boost::mpl::if_c< - Unlimited - , detail::lexical_stream<Target,Source,traits> - , detail::lexical_stream_limited_src<CharT,base,traits> - >::type interpreter(buf, buf + src_len); + public: + lexical_stream(char_type* = 0, char_type* = 0) + { + stream.unsetf(std::ios::skipws); + lcast_set_precision(stream, static_cast<Source*>(0), static_cast<Target*>(0) ); + } + ~lexical_stream() + { + #if defined(BOOST_NO_STRINGSTREAM) + stream.freeze(false); + #endif + } + bool operator<<(const Source &input) + { + return !(stream << input).fail(); + } + template<typename InputStreamable> + bool operator>>(InputStreamable &output) + { + return !is_pointer<InputStreamable>::value && + stream >> output && + stream.get() == +#if defined(__GNUC__) && (__GNUC__<3) && defined(BOOST_NO_STD_WSTRING) +// GCC 2.9x lacks std::char_traits<>::eof(). +// We use BOOST_NO_STD_WSTRING to filter out STLport and libstdc++-v3 +// configurations, which do provide std::char_traits<>::eof(). - Target result; - if(!(interpreter << arg && interpreter >> result)) - BOOST_LCAST_THROW_BAD_CAST(Source, Target); - return result; - } -#if (defined _MSC_VER) -# pragma warning( pop ) + EOF; +#else + traits_type::eof(); #endif - } + } - template<typename Target, typename Source> - inline Target lexical_cast(const Source &arg) - { - typedef typename detail::array_to_pointer_decay<Source>::type src; - - typedef typename detail::widest_char< - typename detail::stream_char<Target>::type - , typename detail::stream_char<src>::type - >::type char_type; - - typedef detail::lcast_src_length<char_type, src> lcast_src_length; - std::size_t const src_len = lcast_src_length::value; - char_type buf[src_len + 1]; - lcast_src_length::check_coverage(); - return detail::lexical_cast<Target, src, !src_len>(arg, buf, src_len); - } + bool operator>>(std::string &output) + { + #if defined(BOOST_NO_STRINGSTREAM) + stream << '\0'; + #endif + stream.str().swap(output); + return true; + } + #ifndef BOOST_LCAST_NO_WCHAR_T + bool operator>>(std::wstring &output) + { + stream.str().swap(output); + return true; + } + #endif - #else + private: + #if defined(BOOST_NO_STRINGSTREAM) + std::strstream stream; + #elif defined(BOOST_NO_STD_LOCALE) + std::stringstream stream; + #else + std::basic_stringstream<char_type,traits_type> stream; + #endif + }; + } // call-by-value fallback version (deprecated) @@ -1191,23 +2482,24 @@ namespace boost Target result; if(!(interpreter << arg && interpreter >> result)) -#ifndef BOOST_NO_TYPEID - throw_exception(bad_lexical_cast(typeid(Source), typeid(Target))); -#else - throw_exception(bad_lexical_cast()); -#endif + BOOST_LCAST_THROW_BAD_CAST(Source, Target); return result; } - #endif -} +} // namespace boost + +#endif // Copyright Kevlin Henney, 2000-2005. -// Copyright Alexander Nasonov, 2006-2007. +// Copyright Alexander Nasonov, 2006-2010. +// Copyright Antony Polukhin, 2011-2012. // // 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) +#undef BOOST_LCAST_THROW_BAD_CAST #undef BOOST_LCAST_NO_WCHAR_T -#endif + +#endif // BOOST_LEXICAL_CAST_INCLUDED + diff --git a/3rdParty/Boost/src/boost/logic/tribool.hpp b/3rdParty/Boost/src/boost/logic/tribool.hpp index 229feb4..90cba3e 100644 --- a/3rdParty/Boost/src/boost/logic/tribool.hpp +++ b/3rdParty/Boost/src/boost/logic/tribool.hpp @@ -93,7 +93,7 @@ public: * * \throws nothrow */ - tribool(bool value) : value(value? true_value : false_value) {} + tribool(bool initial_value) : value(initial_value? true_value : false_value) {} /** * Construct a new 3-state boolean value with an indeterminate value. @@ -452,7 +452,7 @@ namespace boost { #define BOOST_TRIBOOL_THIRD_STATE(Name) \ inline bool \ Name(boost::logic::tribool x, \ - boost::logic::detail::indeterminate_t dummy = \ + boost::logic::detail::indeterminate_t = \ boost::logic::detail::indeterminate_t()) \ { return x.value == boost::logic::tribool::indeterminate_value; } diff --git a/3rdParty/Boost/src/boost/make_shared.hpp b/3rdParty/Boost/src/boost/make_shared.hpp new file mode 100644 index 0000000..c04938f --- /dev/null +++ b/3rdParty/Boost/src/boost/make_shared.hpp @@ -0,0 +1,17 @@ +#ifndef BOOST_MAKE_SHARED_HPP_INCLUDED +#define BOOST_MAKE_SHARED_HPP_INCLUDED + +// make_shared.hpp +// +// Copyright (c) 2007, 2008 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 +// +// See http://www.boost.org/libs/smart_ptr/make_shared.html +// for documentation. + +#include <boost/smart_ptr/make_shared.hpp> + +#endif // #ifndef BOOST_MAKE_SHARED_HPP_INCLUDED diff --git a/3rdParty/Boost/src/boost/math/common_factor_ct.hpp b/3rdParty/Boost/src/boost/math/common_factor_ct.hpp new file mode 100644 index 0000000..848c925 --- /dev/null +++ b/3rdParty/Boost/src/boost/math/common_factor_ct.hpp @@ -0,0 +1,180 @@ +// Boost common_factor_ct.hpp header file ----------------------------------// + +// (C) Copyright Daryle Walker and Stephen Cleary 2001-2002. +// 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) + +// See http://www.boost.org for updates, documentation, and revision history. + +#ifndef BOOST_MATH_COMMON_FACTOR_CT_HPP +#define BOOST_MATH_COMMON_FACTOR_CT_HPP + +#include <boost/math_fwd.hpp> // self include +#include <boost/config.hpp> // for BOOST_STATIC_CONSTANT, etc. +#include <boost/mpl/integral_c.hpp> + +namespace boost +{ +namespace math +{ + +// Implementation details --------------------------------------------------// + +namespace detail +{ +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + // Build GCD with Euclid's recursive algorithm + template < static_gcd_type Value1, static_gcd_type Value2 > + struct static_gcd_helper_t + { + private: + BOOST_STATIC_CONSTANT( static_gcd_type, new_value1 = Value2 ); + BOOST_STATIC_CONSTANT( static_gcd_type, new_value2 = Value1 % Value2 ); + + #ifndef __BORLANDC__ + #define BOOST_DETAIL_GCD_HELPER_VAL(Value) static_cast<static_gcd_type>(Value) + #else + typedef static_gcd_helper_t self_type; + #define BOOST_DETAIL_GCD_HELPER_VAL(Value) (self_type:: Value ) + #endif + + typedef static_gcd_helper_t< BOOST_DETAIL_GCD_HELPER_VAL(new_value1), + BOOST_DETAIL_GCD_HELPER_VAL(new_value2) > next_step_type; + + #undef BOOST_DETAIL_GCD_HELPER_VAL + + public: + BOOST_STATIC_CONSTANT( static_gcd_type, value = next_step_type::value ); + }; + + // Non-recursive case + template < static_gcd_type Value1 > + struct static_gcd_helper_t< Value1, 0UL > + { + BOOST_STATIC_CONSTANT( static_gcd_type, value = Value1 ); + }; +#else + // Use inner class template workaround from Peter Dimov + template < static_gcd_type Value1 > + struct static_gcd_helper2_t + { + template < static_gcd_type Value2 > + struct helper + { + BOOST_STATIC_CONSTANT( static_gcd_type, value + = static_gcd_helper2_t<Value2>::BOOST_NESTED_TEMPLATE + helper<Value1 % Value2>::value ); + }; + + template < > + struct helper< 0UL > + { + BOOST_STATIC_CONSTANT( static_gcd_type, value = Value1 ); + }; + }; + + // Special case + template < > + struct static_gcd_helper2_t< 0UL > + { + template < static_gcd_type Value2 > + struct helper + { + BOOST_STATIC_CONSTANT( static_gcd_type, value = Value2 ); + }; + }; + + // Build the GCD from the above template(s) + template < static_gcd_type Value1, static_gcd_type Value2 > + struct static_gcd_helper_t + { + BOOST_STATIC_CONSTANT( static_gcd_type, value + = static_gcd_helper2_t<Value1>::BOOST_NESTED_TEMPLATE + helper<Value2>::value ); + }; +#endif + +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + // Build the LCM from the GCD + template < static_gcd_type Value1, static_gcd_type Value2 > + struct static_lcm_helper_t + { + typedef static_gcd_helper_t<Value1, Value2> gcd_type; + + BOOST_STATIC_CONSTANT( static_gcd_type, value = Value1 / gcd_type::value + * Value2 ); + }; + + // Special case for zero-GCD values + template < > + struct static_lcm_helper_t< 0UL, 0UL > + { + BOOST_STATIC_CONSTANT( static_gcd_type, value = 0UL ); + }; +#else + // Adapt GCD's inner class template workaround for LCM + template < static_gcd_type Value1 > + struct static_lcm_helper2_t + { + template < static_gcd_type Value2 > + struct helper + { + typedef static_gcd_helper_t<Value1, Value2> gcd_type; + + BOOST_STATIC_CONSTANT( static_gcd_type, value = Value1 + / gcd_type::value * Value2 ); + }; + + template < > + struct helper< 0UL > + { + BOOST_STATIC_CONSTANT( static_gcd_type, value = 0UL ); + }; + }; + + // Special case + template < > + struct static_lcm_helper2_t< 0UL > + { + template < static_gcd_type Value2 > + struct helper + { + BOOST_STATIC_CONSTANT( static_gcd_type, value = 0UL ); + }; + }; + + // Build the LCM from the above template(s) + template < static_gcd_type Value1, static_gcd_type Value2 > + struct static_lcm_helper_t + { + BOOST_STATIC_CONSTANT( static_gcd_type, value + = static_lcm_helper2_t<Value1>::BOOST_NESTED_TEMPLATE + helper<Value2>::value ); + }; +#endif + +} // namespace detail + + +// Compile-time greatest common divisor evaluator class declaration --------// + +template < static_gcd_type Value1, static_gcd_type Value2 > +struct static_gcd : public mpl::integral_c<static_gcd_type, (detail::static_gcd_helper_t<Value1, Value2>::value) > +{ +}; // boost::math::static_gcd + + +// Compile-time least common multiple evaluator class declaration ----------// + +template < static_gcd_type Value1, static_gcd_type Value2 > +struct static_lcm : public mpl::integral_c<static_gcd_type, (detail::static_lcm_helper_t<Value1, Value2>::value) > +{ +}; // boost::math::static_lcm + + +} // namespace math +} // namespace boost + + +#endif // BOOST_MATH_COMMON_FACTOR_CT_HPP diff --git a/3rdParty/Boost/src/boost/math/common_factor_rt.hpp b/3rdParty/Boost/src/boost/math/common_factor_rt.hpp new file mode 100644 index 0000000..4582a96 --- /dev/null +++ b/3rdParty/Boost/src/boost/math/common_factor_rt.hpp @@ -0,0 +1,530 @@ +// Boost common_factor_rt.hpp header file ----------------------------------// + +// (C) Copyright Daryle Walker and Paul Moore 2001-2002. Permission to copy, +// use, modify, sell and distribute this software is granted provided this +// copyright notice appears in all copies. This software is provided "as is" +// without express or implied warranty, and with no claim as to its suitability +// for any purpose. + +// boostinspect:nolicense (don't complain about the lack of a Boost license) +// (Paul Moore hasn't been in contact for years, so there's no way to change the +// license.) + +// See http://www.boost.org for updates, documentation, and revision history. + +#ifndef BOOST_MATH_COMMON_FACTOR_RT_HPP +#define BOOST_MATH_COMMON_FACTOR_RT_HPP + +#include <boost/math_fwd.hpp> // self include + +#include <boost/config.hpp> // for BOOST_NESTED_TEMPLATE, etc. +#include <boost/limits.hpp> // for std::numeric_limits +#include <climits> // for CHAR_MIN +#include <boost/detail/workaround.hpp> + +#ifdef BOOST_MSVC +#pragma warning(push) +#pragma warning(disable:4127 4244) // Conditional expression is constant +#endif + +namespace boost +{ +namespace math +{ + + +// Forward declarations for function templates -----------------------------// + +template < typename IntegerType > + IntegerType gcd( IntegerType const &a, IntegerType const &b ); + +template < typename IntegerType > + IntegerType lcm( IntegerType const &a, IntegerType const &b ); + + +// Greatest common divisor evaluator class declaration ---------------------// + +template < typename IntegerType > +class gcd_evaluator +{ +public: + // Types + typedef IntegerType result_type, first_argument_type, second_argument_type; + + // Function object interface + result_type operator ()( first_argument_type const &a, + second_argument_type const &b ) const; + +}; // boost::math::gcd_evaluator + + +// Least common multiple evaluator class declaration -----------------------// + +template < typename IntegerType > +class lcm_evaluator +{ +public: + // Types + typedef IntegerType result_type, first_argument_type, second_argument_type; + + // Function object interface + result_type operator ()( first_argument_type const &a, + second_argument_type const &b ) const; + +}; // boost::math::lcm_evaluator + + +// Implementation details --------------------------------------------------// + +namespace detail +{ + // Greatest common divisor for rings (including unsigned integers) + template < typename RingType > + RingType + gcd_euclidean + ( + RingType a, + RingType b + ) + { + // Avoid repeated construction + #ifndef __BORLANDC__ + RingType const zero = static_cast<RingType>( 0 ); + #else + RingType zero = static_cast<RingType>( 0 ); + #endif + + // Reduce by GCD-remainder property [GCD(a,b) == GCD(b,a MOD b)] + while ( true ) + { + if ( a == zero ) + return b; + b %= a; + + if ( b == zero ) + return a; + a %= b; + } + } + + // Greatest common divisor for (signed) integers + template < typename IntegerType > + inline + IntegerType + gcd_integer + ( + IntegerType const & a, + IntegerType const & b + ) + { + // Avoid repeated construction + IntegerType const zero = static_cast<IntegerType>( 0 ); + IntegerType const result = gcd_euclidean( a, b ); + + return ( result < zero ) ? static_cast<IntegerType>(-result) : result; + } + + // Greatest common divisor for unsigned binary integers + template < typename BuiltInUnsigned > + BuiltInUnsigned + gcd_binary + ( + BuiltInUnsigned u, + BuiltInUnsigned v + ) + { + if ( u && v ) + { + // Shift out common factors of 2 + unsigned shifts = 0; + + while ( !(u & 1u) && !(v & 1u) ) + { + ++shifts; + u >>= 1; + v >>= 1; + } + + // Start with the still-even one, if any + BuiltInUnsigned r[] = { u, v }; + unsigned which = static_cast<bool>( u & 1u ); + + // Whittle down the values via their differences + do + { +#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582)) + while ( !(r[ which ] & 1u) ) + { + r[ which ] = (r[which] >> 1); + } +#else + // Remove factors of two from the even one + while ( !(r[ which ] & 1u) ) + { + r[ which ] >>= 1; + } +#endif + + // Replace the larger of the two with their difference + if ( r[!which] > r[which] ) + { + which ^= 1u; + } + + r[ which ] -= r[ !which ]; + } + while ( r[which] ); + + // Shift-in the common factor of 2 to the residues' GCD + return r[ !which ] << shifts; + } + else + { + // At least one input is zero, return the other + // (adding since zero is the additive identity) + // or zero if both are zero. + return u + v; + } + } + + // Least common multiple for rings (including unsigned integers) + template < typename RingType > + inline + RingType + lcm_euclidean + ( + RingType const & a, + RingType const & b + ) + { + RingType const zero = static_cast<RingType>( 0 ); + RingType const temp = gcd_euclidean( a, b ); + + return ( temp != zero ) ? ( a / temp * b ) : zero; + } + + // Least common multiple for (signed) integers + template < typename IntegerType > + inline + IntegerType + lcm_integer + ( + IntegerType const & a, + IntegerType const & b + ) + { + // Avoid repeated construction + IntegerType const zero = static_cast<IntegerType>( 0 ); + IntegerType const result = lcm_euclidean( a, b ); + + return ( result < zero ) ? static_cast<IntegerType>(-result) : result; + } + + // Function objects to find the best way of computing GCD or LCM +#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + template < typename T, bool IsSpecialized, bool IsSigned > + struct gcd_optimal_evaluator_helper_t + { + T operator ()( T const &a, T const &b ) + { + return gcd_euclidean( a, b ); + } + }; + + template < typename T > + struct gcd_optimal_evaluator_helper_t< T, true, true > + { + T operator ()( T const &a, T const &b ) + { + return gcd_integer( a, b ); + } + }; +#else + template < bool IsSpecialized, bool IsSigned > + struct gcd_optimal_evaluator_helper2_t + { + template < typename T > + struct helper + { + T operator ()( T const &a, T const &b ) + { + return gcd_euclidean( a, b ); + } + }; + }; + + template < > + struct gcd_optimal_evaluator_helper2_t< true, true > + { + template < typename T > + struct helper + { + T operator ()( T const &a, T const &b ) + { + return gcd_integer( a, b ); + } + }; + }; + + template < typename T, bool IsSpecialized, bool IsSigned > + struct gcd_optimal_evaluator_helper_t + : gcd_optimal_evaluator_helper2_t<IsSpecialized, IsSigned> + ::BOOST_NESTED_TEMPLATE helper<T> + { + }; +#endif + + template < typename T > + struct gcd_optimal_evaluator + { + T operator ()( T const &a, T const &b ) + { + typedef ::std::numeric_limits<T> limits_type; + + typedef gcd_optimal_evaluator_helper_t<T, + limits_type::is_specialized, limits_type::is_signed> helper_type; + + helper_type solver; + + return solver( a, b ); + } + }; +#else // BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS + template < typename T > + struct gcd_optimal_evaluator + { + T operator ()( T const &a, T const &b ) + { + return gcd_integer( a, b ); + } + }; +#endif + + // Specialize for the built-in integers +#define BOOST_PRIVATE_GCD_UF( Ut ) \ + template < > struct gcd_optimal_evaluator<Ut> \ + { Ut operator ()( Ut a, Ut b ) const { return gcd_binary( a, b ); } } + + BOOST_PRIVATE_GCD_UF( unsigned char ); + BOOST_PRIVATE_GCD_UF( unsigned short ); + BOOST_PRIVATE_GCD_UF( unsigned ); + BOOST_PRIVATE_GCD_UF( unsigned long ); + +#ifdef BOOST_HAS_LONG_LONG + BOOST_PRIVATE_GCD_UF( boost::ulong_long_type ); +#elif defined(BOOST_HAS_MS_INT64) + BOOST_PRIVATE_GCD_UF( unsigned __int64 ); +#endif + +#if CHAR_MIN == 0 + BOOST_PRIVATE_GCD_UF( char ); // char is unsigned +#endif + +#undef BOOST_PRIVATE_GCD_UF + +#define BOOST_PRIVATE_GCD_SF( St, Ut ) \ + template < > struct gcd_optimal_evaluator<St> \ + { St operator ()( St a, St b ) const { Ut const a_abs = \ + static_cast<Ut>( a < 0 ? -a : +a ), b_abs = static_cast<Ut>( \ + b < 0 ? -b : +b ); return static_cast<St>( \ + gcd_optimal_evaluator<Ut>()(a_abs, b_abs) ); } } + + BOOST_PRIVATE_GCD_SF( signed char, unsigned char ); + BOOST_PRIVATE_GCD_SF( short, unsigned short ); + BOOST_PRIVATE_GCD_SF( int, unsigned ); + BOOST_PRIVATE_GCD_SF( long, unsigned long ); + +#if CHAR_MIN < 0 + BOOST_PRIVATE_GCD_SF( char, unsigned char ); // char is signed +#endif + +#ifdef BOOST_HAS_LONG_LONG + BOOST_PRIVATE_GCD_SF( boost::long_long_type, boost::ulong_long_type ); +#elif defined(BOOST_HAS_MS_INT64) + BOOST_PRIVATE_GCD_SF( __int64, unsigned __int64 ); +#endif + +#undef BOOST_PRIVATE_GCD_SF + +#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + template < typename T, bool IsSpecialized, bool IsSigned > + struct lcm_optimal_evaluator_helper_t + { + T operator ()( T const &a, T const &b ) + { + return lcm_euclidean( a, b ); + } + }; + + template < typename T > + struct lcm_optimal_evaluator_helper_t< T, true, true > + { + T operator ()( T const &a, T const &b ) + { + return lcm_integer( a, b ); + } + }; +#else + template < bool IsSpecialized, bool IsSigned > + struct lcm_optimal_evaluator_helper2_t + { + template < typename T > + struct helper + { + T operator ()( T const &a, T const &b ) + { + return lcm_euclidean( a, b ); + } + }; + }; + + template < > + struct lcm_optimal_evaluator_helper2_t< true, true > + { + template < typename T > + struct helper + { + T operator ()( T const &a, T const &b ) + { + return lcm_integer( a, b ); + } + }; + }; + + template < typename T, bool IsSpecialized, bool IsSigned > + struct lcm_optimal_evaluator_helper_t + : lcm_optimal_evaluator_helper2_t<IsSpecialized, IsSigned> + ::BOOST_NESTED_TEMPLATE helper<T> + { + }; +#endif + + template < typename T > + struct lcm_optimal_evaluator + { + T operator ()( T const &a, T const &b ) + { + typedef ::std::numeric_limits<T> limits_type; + + typedef lcm_optimal_evaluator_helper_t<T, + limits_type::is_specialized, limits_type::is_signed> helper_type; + + helper_type solver; + + return solver( a, b ); + } + }; +#else // BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS + template < typename T > + struct lcm_optimal_evaluator + { + T operator ()( T const &a, T const &b ) + { + return lcm_integer( a, b ); + } + }; +#endif + + // Functions to find the GCD or LCM in the best way + template < typename T > + inline + T + gcd_optimal + ( + T const & a, + T const & b + ) + { + gcd_optimal_evaluator<T> solver; + + return solver( a, b ); + } + + template < typename T > + inline + T + lcm_optimal + ( + T const & a, + T const & b + ) + { + lcm_optimal_evaluator<T> solver; + + return solver( a, b ); + } + +} // namespace detail + + +// Greatest common divisor evaluator member function definition ------------// + +template < typename IntegerType > +inline +typename gcd_evaluator<IntegerType>::result_type +gcd_evaluator<IntegerType>::operator () +( + first_argument_type const & a, + second_argument_type const & b +) const +{ + return detail::gcd_optimal( a, b ); +} + + +// Least common multiple evaluator member function definition --------------// + +template < typename IntegerType > +inline +typename lcm_evaluator<IntegerType>::result_type +lcm_evaluator<IntegerType>::operator () +( + first_argument_type const & a, + second_argument_type const & b +) const +{ + return detail::lcm_optimal( a, b ); +} + + +// Greatest common divisor and least common multiple function definitions --// + +template < typename IntegerType > +inline +IntegerType +gcd +( + IntegerType const & a, + IntegerType const & b +) +{ + gcd_evaluator<IntegerType> solver; + + return solver( a, b ); +} + +template < typename IntegerType > +inline +IntegerType +lcm +( + IntegerType const & a, + IntegerType const & b +) +{ + lcm_evaluator<IntegerType> solver; + + return solver( a, b ); +} + + +} // namespace math +} // namespace boost + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +#endif // BOOST_MATH_COMMON_FACTOR_RT_HPP diff --git a/3rdParty/Boost/src/boost/math/policies/policy.hpp b/3rdParty/Boost/src/boost/math/policies/policy.hpp new file mode 100644 index 0000000..01fe3d0 --- /dev/null +++ b/3rdParty/Boost/src/boost/math/policies/policy.hpp @@ -0,0 +1,982 @@ +// Copyright John Maddock 2007. +// 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) + +#ifndef BOOST_MATH_POLICY_HPP +#define BOOST_MATH_POLICY_HPP + +#include <boost/mpl/list.hpp> +#include <boost/mpl/contains.hpp> +#include <boost/mpl/if.hpp> +#include <boost/mpl/find_if.hpp> +#include <boost/mpl/remove_if.hpp> +#include <boost/mpl/vector.hpp> +#include <boost/mpl/push_back.hpp> +#include <boost/mpl/at.hpp> +#include <boost/mpl/size.hpp> +#include <boost/mpl/comparison.hpp> +#include <boost/type_traits/is_same.hpp> +#include <boost/static_assert.hpp> +#include <boost/assert.hpp> +#include <boost/math/tools/config.hpp> +#include <limits> +// Sadly we do need the .h versions of these to be sure of getting +// FLT_MANT_DIG etc. +#include <limits.h> +#include <stdlib.h> +#include <stddef.h> +#include <math.h> + +namespace boost{ namespace math{ + +namespace tools{ + +template <class T> +int digits(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)); +template <class T> +T epsilon(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)); + +} + +namespace policies{ + +// +// Define macros for our default policies, if they're not defined already: +// +#ifndef BOOST_MATH_DOMAIN_ERROR_POLICY +#define BOOST_MATH_DOMAIN_ERROR_POLICY throw_on_error +#endif +#ifndef BOOST_MATH_POLE_ERROR_POLICY +#define BOOST_MATH_POLE_ERROR_POLICY throw_on_error +#endif +#ifndef BOOST_MATH_OVERFLOW_ERROR_POLICY +#define BOOST_MATH_OVERFLOW_ERROR_POLICY throw_on_error +#endif +#ifndef BOOST_MATH_EVALUATION_ERROR_POLICY +#define BOOST_MATH_EVALUATION_ERROR_POLICY throw_on_error +#endif +#ifndef BOOST_MATH_ROUNDING_ERROR_POLICY +#define BOOST_MATH_ROUNDING_ERROR_POLICY throw_on_error +#endif +#ifndef BOOST_MATH_UNDERFLOW_ERROR_POLICY +#define BOOST_MATH_UNDERFLOW_ERROR_POLICY ignore_error +#endif +#ifndef BOOST_MATH_DENORM_ERROR_POLICY +#define BOOST_MATH_DENORM_ERROR_POLICY ignore_error +#endif +#ifndef BOOST_MATH_INDETERMINATE_RESULT_ERROR_POLICY +#define BOOST_MATH_INDETERMINATE_RESULT_ERROR_POLICY ignore_error +#endif +#ifndef BOOST_MATH_DIGITS10_POLICY +#define BOOST_MATH_DIGITS10_POLICY 0 +#endif +#ifndef BOOST_MATH_PROMOTE_FLOAT_POLICY +#define BOOST_MATH_PROMOTE_FLOAT_POLICY true +#endif +#ifndef BOOST_MATH_PROMOTE_DOUBLE_POLICY +#ifdef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS +#define BOOST_MATH_PROMOTE_DOUBLE_POLICY false +#else +#define BOOST_MATH_PROMOTE_DOUBLE_POLICY true +#endif +#endif +#ifndef BOOST_MATH_DISCRETE_QUANTILE_POLICY +#define BOOST_MATH_DISCRETE_QUANTILE_POLICY integer_round_outwards +#endif +#ifndef BOOST_MATH_ASSERT_UNDEFINED_POLICY +#define BOOST_MATH_ASSERT_UNDEFINED_POLICY true +#endif +#ifndef BOOST_MATH_MAX_SERIES_ITERATION_POLICY +#define BOOST_MATH_MAX_SERIES_ITERATION_POLICY 1000000 +#endif +#ifndef BOOST_MATH_MAX_ROOT_ITERATION_POLICY +#define BOOST_MATH_MAX_ROOT_ITERATION_POLICY 200 +#endif + +#if !defined(__BORLANDC__) \ + && !(defined(__GNUC__) && (__GNUC__ == 3) && (__GNUC_MINOR__ <= 2)) +#define BOOST_MATH_META_INT(type, name, Default)\ + template <type N = Default> struct name : public boost::mpl::int_<N>{};\ + namespace detail{\ + template <type N>\ + char test_is_valid_arg(const name<N>*);\ + char test_is_default_arg(const name<Default>*);\ + template <class T> struct is_##name##_imp\ + {\ + template <type N> static char test(const name<N>*);\ + static double test(...);\ + BOOST_STATIC_CONSTANT(bool, value = sizeof(test(static_cast<T*>(0))) == 1);\ + };\ + }\ + template <class T> struct is_##name : public boost::mpl::bool_< ::boost::math::policies::detail::is_##name##_imp<T>::value>{}; + +#define BOOST_MATH_META_BOOL(name, Default)\ + template <bool N = Default> struct name : public boost::mpl::bool_<N>{};\ + namespace detail{\ + template <bool N>\ + char test_is_valid_arg(const name<N>*);\ + char test_is_default_arg(const name<Default>*);\ + template <class T> struct is_##name##_imp\ + {\ + template <bool N> static char test(const name<N>*);\ + static double test(...);\ + BOOST_STATIC_CONSTANT(bool, value = sizeof(test(static_cast<T*>(0))) == 1);\ + };\ + }\ + template <class T> struct is_##name : public boost::mpl::bool_< ::boost::math::policies::detail::is_##name##_imp<T>::value>{}; +#else +#define BOOST_MATH_META_INT(Type, name, Default)\ + template <Type N = Default> struct name : public boost::mpl::int_<N>{};\ + namespace detail{\ + template <Type N>\ + char test_is_valid_arg(const name<N>*);\ + char test_is_default_arg(const name<Default>*);\ + template <class T> struct is_##name##_tester\ + {\ + template <Type N> static char test(const name<N>&);\ + static double test(...);\ + };\ + template <class T> struct is_##name##_imp\ + {\ + static T inst;\ + BOOST_STATIC_CONSTANT(bool, value = sizeof( ::boost::math::policies::detail::is_##name##_tester<T>::test(inst)) == 1);\ + };\ + }\ + template <class T> struct is_##name : public boost::mpl::bool_< ::boost::math::policies::detail::is_##name##_imp<T>::value>\ + {\ + template <class U> struct apply{ typedef is_##name<U> type; };\ + }; + +#define BOOST_MATH_META_BOOL(name, Default)\ + template <bool N = Default> struct name : public boost::mpl::bool_<N>{};\ + namespace detail{\ + template <bool N>\ + char test_is_valid_arg(const name<N>*);\ + char test_is_default_arg(const name<Default>*);\ + template <class T> struct is_##name##_tester\ + {\ + template <bool N> static char test(const name<N>&);\ + static double test(...);\ + };\ + template <class T> struct is_##name##_imp\ + {\ + static T inst;\ + BOOST_STATIC_CONSTANT(bool, value = sizeof( ::boost::math::policies::detail::is_##name##_tester<T>::test(inst)) == 1);\ + };\ + }\ + template <class T> struct is_##name : public boost::mpl::bool_< ::boost::math::policies::detail::is_##name##_imp<T>::value>\ + {\ + template <class U> struct apply{ typedef is_##name<U> type; };\ + }; +#endif +// +// Begin by defining policy types for error handling: +// +enum error_policy_type +{ + throw_on_error = 0, + errno_on_error = 1, + ignore_error = 2, + user_error = 3 +}; + +BOOST_MATH_META_INT(error_policy_type, domain_error, BOOST_MATH_DOMAIN_ERROR_POLICY) +BOOST_MATH_META_INT(error_policy_type, pole_error, BOOST_MATH_POLE_ERROR_POLICY) +BOOST_MATH_META_INT(error_policy_type, overflow_error, BOOST_MATH_OVERFLOW_ERROR_POLICY) +BOOST_MATH_META_INT(error_policy_type, underflow_error, BOOST_MATH_UNDERFLOW_ERROR_POLICY) +BOOST_MATH_META_INT(error_policy_type, denorm_error, BOOST_MATH_DENORM_ERROR_POLICY) +BOOST_MATH_META_INT(error_policy_type, evaluation_error, BOOST_MATH_EVALUATION_ERROR_POLICY) +BOOST_MATH_META_INT(error_policy_type, rounding_error, BOOST_MATH_ROUNDING_ERROR_POLICY) +BOOST_MATH_META_INT(error_policy_type, indeterminate_result_error, BOOST_MATH_INDETERMINATE_RESULT_ERROR_POLICY) + +// +// Policy types for internal promotion: +// +BOOST_MATH_META_BOOL(promote_float, BOOST_MATH_PROMOTE_FLOAT_POLICY) +BOOST_MATH_META_BOOL(promote_double, BOOST_MATH_PROMOTE_DOUBLE_POLICY) +BOOST_MATH_META_BOOL(assert_undefined, BOOST_MATH_ASSERT_UNDEFINED_POLICY) +// +// Policy types for discrete quantiles: +// +enum discrete_quantile_policy_type +{ + real, + integer_round_outwards, + integer_round_inwards, + integer_round_down, + integer_round_up, + integer_round_nearest +}; + +BOOST_MATH_META_INT(discrete_quantile_policy_type, discrete_quantile, BOOST_MATH_DISCRETE_QUANTILE_POLICY) +// +// Precision: +// +BOOST_MATH_META_INT(int, digits10, BOOST_MATH_DIGITS10_POLICY) +BOOST_MATH_META_INT(int, digits2, 0) +// +// Iterations: +// +BOOST_MATH_META_INT(unsigned long, max_series_iterations, BOOST_MATH_MAX_SERIES_ITERATION_POLICY) +BOOST_MATH_META_INT(unsigned long, max_root_iterations, BOOST_MATH_MAX_ROOT_ITERATION_POLICY) +// +// Define the names for each possible policy: +// +#define BOOST_MATH_PARAMETER(name)\ + BOOST_PARAMETER_TEMPLATE_KEYWORD(name##_name)\ + BOOST_PARAMETER_NAME(name##_name) + +struct default_policy{}; + +namespace detail{ +// +// Trait to work out bits precision from digits10 and digits2: +// +template <class Digits10, class Digits2> +struct precision +{ + // + // Now work out the precision: + // + typedef typename mpl::if_c< + (Digits10::value == 0), + digits2<0>, + digits2<((Digits10::value + 1) * 1000L) / 301L> + >::type digits2_type; +public: +#ifdef __BORLANDC__ + typedef typename mpl::if_c< + (Digits2::value > ::boost::math::policies::detail::precision<Digits10,Digits2>::digits2_type::value), + Digits2, digits2_type>::type type; +#else + typedef typename mpl::if_c< + (Digits2::value > digits2_type::value), + Digits2, digits2_type>::type type; +#endif +}; + +template <class A, class B, bool b> +struct select_result +{ + typedef A type; +}; +template <class A, class B> +struct select_result<A, B, false> +{ + typedef typename mpl::deref<B>::type type; +}; + +template <class Seq, class Pred, class DefaultType> +struct find_arg +{ +private: + typedef typename mpl::find_if<Seq, Pred>::type iter; + typedef typename mpl::end<Seq>::type end_type; +public: + typedef typename select_result< + DefaultType, iter, + ::boost::is_same<iter, end_type>::value>::type type; +}; + +double test_is_valid_arg(...); +double test_is_default_arg(...); +char test_is_valid_arg(const default_policy*); +char test_is_default_arg(const default_policy*); + +template <class T> +struct is_valid_policy_imp +{ + BOOST_STATIC_CONSTANT(bool, value = sizeof(::boost::math::policies::detail::test_is_valid_arg(static_cast<T*>(0))) == 1); +}; + +template <class T> +struct is_default_policy_imp +{ + BOOST_STATIC_CONSTANT(bool, value = sizeof(::boost::math::policies::detail::test_is_default_arg(static_cast<T*>(0))) == 1); +}; + +template <class T> struct is_valid_policy +: public mpl::bool_< + ::boost::math::policies::detail::is_valid_policy_imp<T>::value> +{}; + +template <class T> struct is_default_policy +: public mpl::bool_< + ::boost::math::policies::detail::is_default_policy_imp<T>::value> +{ + template <class U> + struct apply + { + typedef is_default_policy<U> type; + }; +}; + +template <class Seq, class T, int N> +struct append_N +{ + typedef typename mpl::push_back<Seq, T>::type new_seq; + typedef typename append_N<new_seq, T, N-1>::type type; +}; + +template <class Seq, class T> +struct append_N<Seq, T, 0> +{ + typedef Seq type; +}; + +// +// Traits class to work out what template parameters our default +// policy<> class will have when modified for forwarding: +// +template <bool f, bool d> +struct default_args +{ + typedef promote_float<false> arg1; + typedef promote_double<false> arg2; +}; + +template <> +struct default_args<false, false> +{ + typedef default_policy arg1; + typedef default_policy arg2; +}; + +template <> +struct default_args<true, false> +{ + typedef promote_float<false> arg1; + typedef default_policy arg2; +}; + +template <> +struct default_args<false, true> +{ + typedef promote_double<false> arg1; + typedef default_policy arg2; +}; + +typedef default_args<BOOST_MATH_PROMOTE_FLOAT_POLICY, BOOST_MATH_PROMOTE_DOUBLE_POLICY>::arg1 forwarding_arg1; +typedef default_args<BOOST_MATH_PROMOTE_FLOAT_POLICY, BOOST_MATH_PROMOTE_DOUBLE_POLICY>::arg2 forwarding_arg2; + +} // detail +// +// Now define the policy type with enough arguments to handle all +// the policies: +// +template <class A1 = default_policy, + class A2 = default_policy, + class A3 = default_policy, + class A4 = default_policy, + class A5 = default_policy, + class A6 = default_policy, + class A7 = default_policy, + class A8 = default_policy, + class A9 = default_policy, + class A10 = default_policy, + class A11 = default_policy, + class A12 = default_policy, + class A13 = default_policy> +struct policy +{ +private: + // + // Validate all our arguments: + // + BOOST_STATIC_ASSERT(::boost::math::policies::detail::is_valid_policy<A1>::value); + BOOST_STATIC_ASSERT(::boost::math::policies::detail::is_valid_policy<A2>::value); + BOOST_STATIC_ASSERT(::boost::math::policies::detail::is_valid_policy<A3>::value); + BOOST_STATIC_ASSERT(::boost::math::policies::detail::is_valid_policy<A4>::value); + BOOST_STATIC_ASSERT(::boost::math::policies::detail::is_valid_policy<A5>::value); + BOOST_STATIC_ASSERT(::boost::math::policies::detail::is_valid_policy<A6>::value); + BOOST_STATIC_ASSERT(::boost::math::policies::detail::is_valid_policy<A7>::value); + BOOST_STATIC_ASSERT(::boost::math::policies::detail::is_valid_policy<A8>::value); + BOOST_STATIC_ASSERT(::boost::math::policies::detail::is_valid_policy<A9>::value); + BOOST_STATIC_ASSERT(::boost::math::policies::detail::is_valid_policy<A10>::value); + BOOST_STATIC_ASSERT(::boost::math::policies::detail::is_valid_policy<A11>::value); + BOOST_STATIC_ASSERT(::boost::math::policies::detail::is_valid_policy<A12>::value); + BOOST_STATIC_ASSERT(::boost::math::policies::detail::is_valid_policy<A13>::value); + // + // Typelist of the arguments: + // + typedef mpl::list<A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13> arg_list; + +public: + typedef typename detail::find_arg<arg_list, is_domain_error<mpl::_1>, domain_error<> >::type domain_error_type; + typedef typename detail::find_arg<arg_list, is_pole_error<mpl::_1>, pole_error<> >::type pole_error_type; + typedef typename detail::find_arg<arg_list, is_overflow_error<mpl::_1>, overflow_error<> >::type overflow_error_type; + typedef typename detail::find_arg<arg_list, is_underflow_error<mpl::_1>, underflow_error<> >::type underflow_error_type; + typedef typename detail::find_arg<arg_list, is_denorm_error<mpl::_1>, denorm_error<> >::type denorm_error_type; + typedef typename detail::find_arg<arg_list, is_evaluation_error<mpl::_1>, evaluation_error<> >::type evaluation_error_type; + typedef typename detail::find_arg<arg_list, is_rounding_error<mpl::_1>, rounding_error<> >::type rounding_error_type; + typedef typename detail::find_arg<arg_list, is_indeterminate_result_error<mpl::_1>, indeterminate_result_error<> >::type indeterminate_result_error_type; +private: + // + // Now work out the precision: + // + typedef typename detail::find_arg<arg_list, is_digits10<mpl::_1>, digits10<> >::type digits10_type; + typedef typename detail::find_arg<arg_list, is_digits2<mpl::_1>, digits2<> >::type bits_precision_type; +public: + typedef typename detail::precision<digits10_type, bits_precision_type>::type precision_type; + // + // Internal promotion: + // + typedef typename detail::find_arg<arg_list, is_promote_float<mpl::_1>, promote_float<> >::type promote_float_type; + typedef typename detail::find_arg<arg_list, is_promote_double<mpl::_1>, promote_double<> >::type promote_double_type; + // + // Discrete quantiles: + // + typedef typename detail::find_arg<arg_list, is_discrete_quantile<mpl::_1>, discrete_quantile<> >::type discrete_quantile_type; + // + // Mathematically undefined properties: + // + typedef typename detail::find_arg<arg_list, is_assert_undefined<mpl::_1>, assert_undefined<> >::type assert_undefined_type; + // + // Max iterations: + // + typedef typename detail::find_arg<arg_list, is_max_series_iterations<mpl::_1>, max_series_iterations<> >::type max_series_iterations_type; + typedef typename detail::find_arg<arg_list, is_max_root_iterations<mpl::_1>, max_root_iterations<> >::type max_root_iterations_type; +}; +// +// These full specializations are defined to reduce the amount of +// template instantiations that have to take place when using the default +// policies, they have quite a large impact on compile times: +// +template <> +struct policy<default_policy, default_policy, default_policy, default_policy, default_policy, default_policy, default_policy, default_policy, default_policy, default_policy, default_policy> +{ +public: + typedef domain_error<> domain_error_type; + typedef pole_error<> pole_error_type; + typedef overflow_error<> overflow_error_type; + typedef underflow_error<> underflow_error_type; + typedef denorm_error<> denorm_error_type; + typedef evaluation_error<> evaluation_error_type; + typedef rounding_error<> rounding_error_type; + typedef indeterminate_result_error<> indeterminate_result_error_type; +#if BOOST_MATH_DIGITS10_POLICY == 0 + typedef digits2<> precision_type; +#else + typedef detail::precision<digits10<>, digits2<> >::type precision_type; +#endif + typedef promote_float<> promote_float_type; + typedef promote_double<> promote_double_type; + typedef discrete_quantile<> discrete_quantile_type; + typedef assert_undefined<> assert_undefined_type; + typedef max_series_iterations<> max_series_iterations_type; + typedef max_root_iterations<> max_root_iterations_type; +}; + +template <> +struct policy<detail::forwarding_arg1, detail::forwarding_arg2, default_policy, default_policy, default_policy, default_policy, default_policy, default_policy, default_policy, default_policy, default_policy> +{ +public: + typedef domain_error<> domain_error_type; + typedef pole_error<> pole_error_type; + typedef overflow_error<> overflow_error_type; + typedef underflow_error<> underflow_error_type; + typedef denorm_error<> denorm_error_type; + typedef evaluation_error<> evaluation_error_type; + typedef rounding_error<> rounding_error_type; + typedef indeterminate_result_error<> indeterminate_result_error_type; +#if BOOST_MATH_DIGITS10_POLICY == 0 + typedef digits2<> precision_type; +#else + typedef detail::precision<digits10<>, digits2<> >::type precision_type; +#endif + typedef promote_float<false> promote_float_type; + typedef promote_double<false> promote_double_type; + typedef discrete_quantile<> discrete_quantile_type; + typedef assert_undefined<> assert_undefined_type; + typedef max_series_iterations<> max_series_iterations_type; + typedef max_root_iterations<> max_root_iterations_type; +}; + +template <class Policy, + class A1 = default_policy, + class A2 = default_policy, + class A3 = default_policy, + class A4 = default_policy, + class A5 = default_policy, + class A6 = default_policy, + class A7 = default_policy, + class A8 = default_policy, + class A9 = default_policy, + class A10 = default_policy, + class A11 = default_policy, + class A12 = default_policy, + class A13 = default_policy> +struct normalise +{ +private: + typedef mpl::list<A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,A13> arg_list; + typedef typename detail::find_arg<arg_list, is_domain_error<mpl::_1>, typename Policy::domain_error_type >::type domain_error_type; + typedef typename detail::find_arg<arg_list, is_pole_error<mpl::_1>, typename Policy::pole_error_type >::type pole_error_type; + typedef typename detail::find_arg<arg_list, is_overflow_error<mpl::_1>, typename Policy::overflow_error_type >::type overflow_error_type; + typedef typename detail::find_arg<arg_list, is_underflow_error<mpl::_1>, typename Policy::underflow_error_type >::type underflow_error_type; + typedef typename detail::find_arg<arg_list, is_denorm_error<mpl::_1>, typename Policy::denorm_error_type >::type denorm_error_type; + typedef typename detail::find_arg<arg_list, is_evaluation_error<mpl::_1>, typename Policy::evaluation_error_type >::type evaluation_error_type; + typedef typename detail::find_arg<arg_list, is_rounding_error<mpl::_1>, typename Policy::rounding_error_type >::type rounding_error_type; + typedef typename detail::find_arg<arg_list, is_indeterminate_result_error<mpl::_1>, typename Policy::indeterminate_result_error_type >::type indeterminate_result_error_type; + // + // Now work out the precision: + // + typedef typename detail::find_arg<arg_list, is_digits10<mpl::_1>, digits10<> >::type digits10_type; + typedef typename detail::find_arg<arg_list, is_digits2<mpl::_1>, typename Policy::precision_type >::type bits_precision_type; + typedef typename detail::precision<digits10_type, bits_precision_type>::type precision_type; + // + // Internal promotion: + // + typedef typename detail::find_arg<arg_list, is_promote_float<mpl::_1>, typename Policy::promote_float_type >::type promote_float_type; + typedef typename detail::find_arg<arg_list, is_promote_double<mpl::_1>, typename Policy::promote_double_type >::type promote_double_type; + // + // Discrete quantiles: + // + typedef typename detail::find_arg<arg_list, is_discrete_quantile<mpl::_1>, typename Policy::discrete_quantile_type >::type discrete_quantile_type; + // + // Mathematically undefined properties: + // + typedef typename detail::find_arg<arg_list, is_assert_undefined<mpl::_1>, typename Policy::assert_undefined_type >::type assert_undefined_type; + // + // Max iterations: + // + typedef typename detail::find_arg<arg_list, is_max_series_iterations<mpl::_1>, typename Policy::max_series_iterations_type>::type max_series_iterations_type; + typedef typename detail::find_arg<arg_list, is_max_root_iterations<mpl::_1>, typename Policy::max_root_iterations_type>::type max_root_iterations_type; + // + // Define a typelist of the policies: + // + typedef mpl::vector< + domain_error_type, + pole_error_type, + overflow_error_type, + underflow_error_type, + denorm_error_type, + evaluation_error_type, + rounding_error_type, + indeterminate_result_error_type, + precision_type, + promote_float_type, + promote_double_type, + discrete_quantile_type, + assert_undefined_type, + max_series_iterations_type, + max_root_iterations_type> result_list; + // + // Remove all the policies that are the same as the default: + // + typedef typename mpl::remove_if<result_list, detail::is_default_policy<mpl::_> >::type reduced_list; + // + // Pad out the list with defaults: + // + typedef typename detail::append_N<reduced_list, default_policy, (14 - ::boost::mpl::size<reduced_list>::value)>::type result_type; +public: + typedef policy< + typename mpl::at<result_type, mpl::int_<0> >::type, + typename mpl::at<result_type, mpl::int_<1> >::type, + typename mpl::at<result_type, mpl::int_<2> >::type, + typename mpl::at<result_type, mpl::int_<3> >::type, + typename mpl::at<result_type, mpl::int_<4> >::type, + typename mpl::at<result_type, mpl::int_<5> >::type, + typename mpl::at<result_type, mpl::int_<6> >::type, + typename mpl::at<result_type, mpl::int_<7> >::type, + typename mpl::at<result_type, mpl::int_<8> >::type, + typename mpl::at<result_type, mpl::int_<9> >::type, + typename mpl::at<result_type, mpl::int_<10> >::type, + typename mpl::at<result_type, mpl::int_<11> >::type, + typename mpl::at<result_type, mpl::int_<12> >::type > type; +}; +// +// Full specialisation to speed up compilation of the common case: +// +template <> +struct normalise<policy<>, + promote_float<false>, + promote_double<false>, + discrete_quantile<>, + assert_undefined<>, + default_policy, + default_policy, + default_policy, + default_policy, + default_policy, + default_policy, + default_policy> +{ + typedef policy<detail::forwarding_arg1, detail::forwarding_arg2> type; +}; + +template <> +struct normalise<policy<detail::forwarding_arg1, detail::forwarding_arg2>, + promote_float<false>, + promote_double<false>, + discrete_quantile<>, + assert_undefined<>, + default_policy, + default_policy, + default_policy, + default_policy, + default_policy, + default_policy, + default_policy> +{ + typedef policy<detail::forwarding_arg1, detail::forwarding_arg2> type; +}; + +inline policy<> make_policy() +{ return policy<>(); } + +template <class A1> +inline typename normalise<policy<>, A1>::type make_policy(const A1&) +{ + typedef typename normalise<policy<>, A1>::type result_type; + return result_type(); +} + +template <class A1, class A2> +inline typename normalise<policy<>, A1, A2>::type make_policy(const A1&, const A2&) +{ + typedef typename normalise<policy<>, A1, A2>::type result_type; + return result_type(); +} + +template <class A1, class A2, class A3> +inline typename normalise<policy<>, A1, A2, A3>::type make_policy(const A1&, const A2&, const A3&) +{ + typedef typename normalise<policy<>, A1, A2, A3>::type result_type; + return result_type(); +} + +template <class A1, class A2, class A3, class A4> +inline typename normalise<policy<>, A1, A2, A3, A4>::type make_policy(const A1&, const A2&, const A3&, const A4&) +{ + typedef typename normalise<policy<>, A1, A2, A3, A4>::type result_type; + return result_type(); +} + +template <class A1, class A2, class A3, class A4, class A5> +inline typename normalise<policy<>, A1, A2, A3, A4, A5>::type make_policy(const A1&, const A2&, const A3&, const A4&, const A5&) +{ + typedef typename normalise<policy<>, A1, A2, A3, A4, A5>::type result_type; + return result_type(); +} + +template <class A1, class A2, class A3, class A4, class A5, class A6> +inline typename normalise<policy<>, A1, A2, A3, A4, A5, A6>::type make_policy(const A1&, const A2&, const A3&, const A4&, const A5&, const A6&) +{ + typedef typename normalise<policy<>, A1, A2, A3, A4, A5, A6>::type result_type; + return result_type(); +} + +template <class A1, class A2, class A3, class A4, class A5, class A6, class A7> +inline typename normalise<policy<>, A1, A2, A3, A4, A5, A6, A7>::type make_policy(const A1&, const A2&, const A3&, const A4&, const A5&, const A6&, const A7&) +{ + typedef typename normalise<policy<>, A1, A2, A3, A4, A5, A6, A7>::type result_type; + return result_type(); +} + +template <class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8> +inline typename normalise<policy<>, A1, A2, A3, A4, A5, A6, A7, A8>::type make_policy(const A1&, const A2&, const A3&, const A4&, const A5&, const A6&, const A7&, const A8&) +{ + typedef typename normalise<policy<>, A1, A2, A3, A4, A5, A6, A7, A8>::type result_type; + return result_type(); +} + +template <class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9> +inline typename normalise<policy<>, A1, A2, A3, A4, A5, A6, A7, A8, A9>::type make_policy(const A1&, const A2&, const A3&, const A4&, const A5&, const A6&, const A7&, const A8&, const A9&) +{ + typedef typename normalise<policy<>, A1, A2, A3, A4, A5, A6, A7, A8, A9>::type result_type; + return result_type(); +} + +template <class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9, class A10> +inline typename normalise<policy<>, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10>::type make_policy(const A1&, const A2&, const A3&, const A4&, const A5&, const A6&, const A7&, const A8&, const A9&, const A10&) +{ + typedef typename normalise<policy<>, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10>::type result_type; + return result_type(); +} + +template <class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9, class A10, class A11> +inline typename normalise<policy<>, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11>::type make_policy(const A1&, const A2&, const A3&, const A4&, const A5&, const A6&, const A7&, const A8&, const A9&, const A10&, const A11&) +{ + typedef typename normalise<policy<>, A1, A2, A3, A4, A5, A6, A7, A8, A9, A10, A11>::type result_type; + return result_type(); +} + +// +// Traits class to handle internal promotion: +// +template <class Real, class Policy> +struct evaluation +{ + typedef Real type; +}; + +template <class Policy> +struct evaluation<float, Policy> +{ + typedef typename mpl::if_<typename Policy::promote_float_type, double, float>::type type; +}; + +template <class Policy> +struct evaluation<double, Policy> +{ + typedef typename mpl::if_<typename Policy::promote_double_type, long double, double>::type type; +}; + +#ifdef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS + +template <class Real> +struct basic_digits : public mpl::int_<0>{ }; +template <> +struct basic_digits<float> : public mpl::int_<FLT_MANT_DIG>{ }; +template <> +struct basic_digits<double> : public mpl::int_<DBL_MANT_DIG>{ }; +template <> +struct basic_digits<long double> : public mpl::int_<LDBL_MANT_DIG>{ }; + +template <class Real, class Policy> +struct precision +{ + BOOST_STATIC_ASSERT( ::std::numeric_limits<Real>::radix == 2); + typedef typename Policy::precision_type precision_type; + typedef basic_digits<Real> digits_t; + typedef typename mpl::if_< + mpl::equal_to<digits_t, mpl::int_<0> >, + // Possibly unknown precision: + precision_type, + typename mpl::if_< + mpl::or_<mpl::less_equal<digits_t, precision_type>, mpl::less_equal<precision_type, mpl::int_<0> > >, + // Default case, full precision for RealType: + digits2< ::std::numeric_limits<Real>::digits>, + // User customised precision: + precision_type + >::type + >::type type; +}; + +template <class Policy> +struct precision<float, Policy> +{ + typedef digits2<FLT_MANT_DIG> type; +}; +template <class Policy> +struct precision<double, Policy> +{ + typedef digits2<DBL_MANT_DIG> type; +}; +template <class Policy> +struct precision<long double, Policy> +{ + typedef digits2<LDBL_MANT_DIG> type; +}; + +#else + +template <class Real, class Policy> +struct precision +{ + BOOST_STATIC_ASSERT((::std::numeric_limits<Real>::radix == 2) || ((::std::numeric_limits<Real>::is_specialized == 0) || (::std::numeric_limits<Real>::digits == 0))); +#ifndef __BORLANDC__ + typedef typename Policy::precision_type precision_type; + typedef typename mpl::if_c< + ((::std::numeric_limits<Real>::is_specialized == 0) || (::std::numeric_limits<Real>::digits == 0)), + // Possibly unknown precision: + precision_type, + typename mpl::if_c< + ((::std::numeric_limits<Real>::digits <= precision_type::value) + || (Policy::precision_type::value <= 0)), + // Default case, full precision for RealType: + digits2< ::std::numeric_limits<Real>::digits>, + // User customised precision: + precision_type + >::type + >::type type; +#else + typedef typename Policy::precision_type precision_type; + typedef mpl::int_< ::std::numeric_limits<Real>::digits> digits_t; + typedef mpl::bool_< ::std::numeric_limits<Real>::is_specialized> spec_t; + typedef typename mpl::if_< + mpl::or_<mpl::equal_to<spec_t, mpl::false_>, mpl::equal_to<digits_t, mpl::int_<0> > >, + // Possibly unknown precision: + precision_type, + typename mpl::if_< + mpl::or_<mpl::less_equal<digits_t, precision_type>, mpl::less_equal<precision_type, mpl::int_<0> > >, + // Default case, full precision for RealType: + digits2< ::std::numeric_limits<Real>::digits>, + // User customised precision: + precision_type + >::type + >::type type; +#endif +}; + +#endif + +namespace detail{ + +template <class T, class Policy> +inline int digits_imp(mpl::true_ const&) +{ +#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS + BOOST_STATIC_ASSERT( ::std::numeric_limits<T>::is_specialized); +#else + BOOST_ASSERT(::std::numeric_limits<T>::is_specialized); +#endif + typedef typename boost::math::policies::precision<T, Policy>::type p_t; + return p_t::value; +} + +template <class T, class Policy> +inline int digits_imp(mpl::false_ const&) +{ + return tools::digits<T>(); +} + +} // namespace detail + +template <class T, class Policy> +inline int digits(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) +{ + typedef mpl::bool_< std::numeric_limits<T>::is_specialized > tag_type; + return detail::digits_imp<T, Policy>(tag_type()); +} + +template <class Policy> +inline unsigned long get_max_series_iterations() +{ + typedef typename Policy::max_series_iterations_type iter_type; + return iter_type::value; +} + +template <class Policy> +inline unsigned long get_max_root_iterations() +{ + typedef typename Policy::max_root_iterations_type iter_type; + return iter_type::value; +} + +namespace detail{ + +template <class T, class Digits, class Small, class Default> +struct series_factor_calc +{ + static T get() + { + return ldexp(T(1.0), 1 - Digits::value); + } +}; + +template <class T, class Digits> +struct series_factor_calc<T, Digits, mpl::true_, mpl::true_> +{ + static T get() + { + return boost::math::tools::epsilon<T>(); + } +}; +template <class T, class Digits> +struct series_factor_calc<T, Digits, mpl::true_, mpl::false_> +{ + static T get() + { + static const boost::uintmax_t v = static_cast<boost::uintmax_t>(1u) << (Digits::value - 1); + return 1 / static_cast<T>(v); + } +}; +template <class T, class Digits> +struct series_factor_calc<T, Digits, mpl::false_, mpl::true_> +{ + static T get() + { + return boost::math::tools::epsilon<T>(); + } +}; + +template <class T, class Policy> +inline T get_epsilon_imp(mpl::true_ const&) +{ +#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS + BOOST_STATIC_ASSERT( ::std::numeric_limits<T>::is_specialized); + BOOST_STATIC_ASSERT( ::std::numeric_limits<T>::radix == 2); +#else + BOOST_ASSERT(::std::numeric_limits<T>::is_specialized); + BOOST_ASSERT(::std::numeric_limits<T>::radix == 2); +#endif + typedef typename boost::math::policies::precision<T, Policy>::type p_t; + typedef mpl::bool_<p_t::value <= std::numeric_limits<boost::uintmax_t>::digits> is_small_int; + typedef mpl::bool_<p_t::value >= std::numeric_limits<T>::digits> is_default_value; + return series_factor_calc<T, p_t, is_small_int, is_default_value>::get(); +} + +template <class T, class Policy> +inline T get_epsilon_imp(mpl::false_ const&) +{ + return tools::epsilon<T>(); +} + +} // namespace detail + +template <class T, class Policy> +inline T get_epsilon(BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(T)) +{ + typedef mpl::bool_< (std::numeric_limits<T>::is_specialized && (std::numeric_limits<T>::radix == 2)) > tag_type; + return detail::get_epsilon_imp<T, Policy>(tag_type()); +} + +namespace detail{ + +template <class A1, + class A2, + class A3, + class A4, + class A5, + class A6, + class A7, + class A8, + class A9, + class A10, + class A11> +char test_is_policy(const policy<A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11>*); +double test_is_policy(...); + +template <class P> +struct is_policy_imp +{ + BOOST_STATIC_CONSTANT(bool, value = (sizeof(::boost::math::policies::detail::test_is_policy(static_cast<P*>(0))) == 1)); +}; + +} + +template <class P> +struct is_policy : public mpl::bool_< ::boost::math::policies::detail::is_policy_imp<P>::value> {}; + +// +// Helper traits class for distribution error handling: +// +template <class Policy> +struct constructor_error_check +{ + typedef typename Policy::domain_error_type domain_error_type; + typedef typename mpl::if_c< + (domain_error_type::value == throw_on_error) || (domain_error_type::value == user_error), + mpl::true_, + mpl::false_>::type type; +}; + +template <class Policy> +struct method_error_check +{ + typedef typename Policy::domain_error_type domain_error_type; + typedef typename mpl::if_c< + (domain_error_type::value == throw_on_error) && (domain_error_type::value != user_error), + mpl::false_, + mpl::true_>::type type; +}; + +}}} // namespaces + +#endif // BOOST_MATH_POLICY_HPP + + + diff --git a/3rdParty/Boost/src/boost/math/special_functions/detail/fp_traits.hpp b/3rdParty/Boost/src/boost/math/special_functions/detail/fp_traits.hpp new file mode 100644 index 0000000..50c034d --- /dev/null +++ b/3rdParty/Boost/src/boost/math/special_functions/detail/fp_traits.hpp @@ -0,0 +1,570 @@ +// fp_traits.hpp + +#ifndef BOOST_MATH_FP_TRAITS_HPP +#define BOOST_MATH_FP_TRAITS_HPP + +// Copyright (c) 2006 Johan Rade + +// 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) + +/* +To support old compilers, care has been taken to avoid partial template +specialization and meta function forwarding. +With these techniques, the code could be simplified. +*/ + +#if defined(__vms) && defined(__DECCXX) && !__IEEE_FLOAT +// The VAX floating point formats are used (for float and double) +# define BOOST_FPCLASSIFY_VAX_FORMAT +#endif + +#include <cstring> + +#include <boost/assert.hpp> +#include <boost/cstdint.hpp> +#include <boost/detail/endian.hpp> +#include <boost/static_assert.hpp> +#include <boost/type_traits/is_floating_point.hpp> + +#ifdef BOOST_NO_STDC_NAMESPACE + namespace std{ using ::memcpy; } +#endif + +#ifndef FP_NORMAL + +#define FP_ZERO 0 +#define FP_NORMAL 1 +#define FP_INFINITE 2 +#define FP_NAN 3 +#define FP_SUBNORMAL 4 + +#else + +#define BOOST_HAS_FPCLASSIFY + +#ifndef fpclassify +# if (defined(__GLIBCPP__) || defined(__GLIBCXX__)) \ + && defined(_GLIBCXX_USE_C99_MATH) \ + && !(defined(_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC) \ + && (_GLIBCXX_USE_C99_FP_MACROS_DYNAMIC != 0)) +# ifdef _STLP_VENDOR_CSTD +# if _STLPORT_VERSION >= 0x520 +# define BOOST_FPCLASSIFY_PREFIX ::__std_alias:: +# else +# define BOOST_FPCLASSIFY_PREFIX ::_STLP_VENDOR_CSTD:: +# endif +# else +# define BOOST_FPCLASSIFY_PREFIX ::std:: +# endif +# else +# undef BOOST_HAS_FPCLASSIFY +# define BOOST_FPCLASSIFY_PREFIX +# endif +#elif (defined(__HP_aCC) && !defined(__hppa)) +// aCC 6 appears to do "#define fpclassify fpclassify" which messes us up a bit! +# define BOOST_FPCLASSIFY_PREFIX :: +#else +# define BOOST_FPCLASSIFY_PREFIX +#endif + +#ifdef __MINGW32__ +# undef BOOST_HAS_FPCLASSIFY +#endif + +#endif + + +//------------------------------------------------------------------------------ + +namespace boost { +namespace math { +namespace detail { + +//------------------------------------------------------------------------------ + +/* +The following classes are used to tag the different methods that are used +for floating point classification +*/ + +struct native_tag {}; +template <bool has_limits> +struct generic_tag {}; +struct ieee_tag {}; +struct ieee_copy_all_bits_tag : public ieee_tag {}; +struct ieee_copy_leading_bits_tag : public ieee_tag {}; + +#ifdef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS +// +// These helper functions are used only when numeric_limits<> +// members are not compile time constants: +// +inline bool is_generic_tag_false(const generic_tag<false>*) +{ + return true; +} +inline bool is_generic_tag_false(const void*) +{ + return false; +} +#endif + +//------------------------------------------------------------------------------ + +/* +Most processors support three different floating point precisions: +single precision (32 bits), double precision (64 bits) +and extended double precision (80 - 128 bits, depending on the processor) + +Note that the C++ type long double can be implemented +both as double precision and extended double precision. +*/ + +struct unknown_precision{}; +struct single_precision {}; +struct double_precision {}; +struct extended_double_precision {}; + +// native_tag version -------------------------------------------------------------- + +template<class T> struct fp_traits_native +{ + typedef native_tag method; +}; + +// generic_tag version ------------------------------------------------------------- + +template<class T, class U> struct fp_traits_non_native +{ +#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS + typedef generic_tag<std::numeric_limits<T>::is_specialized> method; +#else + typedef generic_tag<false> method; +#endif +}; + +// ieee_tag versions --------------------------------------------------------------- + +/* +These specializations of fp_traits_non_native contain information needed +to "parse" the binary representation of a floating point number. + +Typedef members: + + bits -- the target type when copying the leading bytes of a floating + point number. It is a typedef for uint32_t or uint64_t. + + method -- tells us whether all bytes are copied or not. + It is a typedef for ieee_copy_all_bits_tag or ieee_copy_leading_bits_tag. + +Static data members: + + sign, exponent, flag, significand -- bit masks that give the meaning of the + bits in the leading bytes. + +Static function members: + + get_bits(), set_bits() -- provide access to the leading bytes. + +*/ + +// ieee_tag version, float (32 bits) ----------------------------------------------- + +#ifndef BOOST_FPCLASSIFY_VAX_FORMAT + +template<> struct fp_traits_non_native<float, single_precision> +{ + typedef ieee_copy_all_bits_tag method; + + BOOST_STATIC_CONSTANT(uint32_t, sign = 0x80000000u); + BOOST_STATIC_CONSTANT(uint32_t, exponent = 0x7f800000); + BOOST_STATIC_CONSTANT(uint32_t, flag = 0x00000000); + BOOST_STATIC_CONSTANT(uint32_t, significand = 0x007fffff); + + typedef uint32_t bits; + static void get_bits(float x, uint32_t& a) { std::memcpy(&a, &x, 4); } + static void set_bits(float& x, uint32_t a) { std::memcpy(&x, &a, 4); } +}; + +// ieee_tag version, double (64 bits) ---------------------------------------------- + +#if defined(BOOST_NO_INT64_T) || defined(BOOST_NO_INCLASS_MEMBER_INITIALIZATION) \ + || defined(__BORLANDC__) || defined(__CODEGEAR__) + +template<> struct fp_traits_non_native<double, double_precision> +{ + typedef ieee_copy_leading_bits_tag method; + + BOOST_STATIC_CONSTANT(uint32_t, sign = 0x80000000u); + BOOST_STATIC_CONSTANT(uint32_t, exponent = 0x7ff00000); + BOOST_STATIC_CONSTANT(uint32_t, flag = 0); + BOOST_STATIC_CONSTANT(uint32_t, significand = 0x000fffff); + + typedef uint32_t bits; + + static void get_bits(double x, uint32_t& a) + { + std::memcpy(&a, reinterpret_cast<const unsigned char*>(&x) + offset_, 4); + } + + static void set_bits(double& x, uint32_t a) + { + std::memcpy(reinterpret_cast<unsigned char*>(&x) + offset_, &a, 4); + } + +private: + +#if defined(BOOST_BIG_ENDIAN) + BOOST_STATIC_CONSTANT(int, offset_ = 0); +#elif defined(BOOST_LITTLE_ENDIAN) + BOOST_STATIC_CONSTANT(int, offset_ = 4); +#else + BOOST_STATIC_ASSERT(false); +#endif +}; + +//.............................................................................. + +#else + +template<> struct fp_traits_non_native<double, double_precision> +{ + typedef ieee_copy_all_bits_tag method; + + static const uint64_t sign = ((uint64_t)0x80000000u) << 32; + static const uint64_t exponent = ((uint64_t)0x7ff00000) << 32; + static const uint64_t flag = 0; + static const uint64_t significand + = (((uint64_t)0x000fffff) << 32) + ((uint64_t)0xffffffffu); + + typedef uint64_t bits; + static void get_bits(double x, uint64_t& a) { std::memcpy(&a, &x, 8); } + static void set_bits(double& x, uint64_t a) { std::memcpy(&x, &a, 8); } +}; + +#endif + +#endif // #ifndef BOOST_FPCLASSIFY_VAX_FORMAT + +// long double (64 bits) ------------------------------------------------------- + +#if defined(BOOST_NO_INT64_T) || defined(BOOST_NO_INCLASS_MEMBER_INITIALIZATION)\ + || defined(__BORLANDC__) || defined(__CODEGEAR__) + +template<> struct fp_traits_non_native<long double, double_precision> +{ + typedef ieee_copy_leading_bits_tag method; + + BOOST_STATIC_CONSTANT(uint32_t, sign = 0x80000000u); + BOOST_STATIC_CONSTANT(uint32_t, exponent = 0x7ff00000); + BOOST_STATIC_CONSTANT(uint32_t, flag = 0); + BOOST_STATIC_CONSTANT(uint32_t, significand = 0x000fffff); + + typedef uint32_t bits; + + static void get_bits(long double x, uint32_t& a) + { + std::memcpy(&a, reinterpret_cast<const unsigned char*>(&x) + offset_, 4); + } + + static void set_bits(long double& x, uint32_t a) + { + std::memcpy(reinterpret_cast<unsigned char*>(&x) + offset_, &a, 4); + } + +private: + +#if defined(BOOST_BIG_ENDIAN) + BOOST_STATIC_CONSTANT(int, offset_ = 0); +#elif defined(BOOST_LITTLE_ENDIAN) + BOOST_STATIC_CONSTANT(int, offset_ = 4); +#else + BOOST_STATIC_ASSERT(false); +#endif +}; + +//.............................................................................. + +#else + +template<> struct fp_traits_non_native<long double, double_precision> +{ + typedef ieee_copy_all_bits_tag method; + + static const uint64_t sign = (uint64_t)0x80000000u << 32; + static const uint64_t exponent = (uint64_t)0x7ff00000 << 32; + static const uint64_t flag = 0; + static const uint64_t significand + = ((uint64_t)0x000fffff << 32) + (uint64_t)0xffffffffu; + + typedef uint64_t bits; + static void get_bits(long double x, uint64_t& a) { std::memcpy(&a, &x, 8); } + static void set_bits(long double& x, uint64_t a) { std::memcpy(&x, &a, 8); } +}; + +#endif + + +// long double (>64 bits), x86 and x64 ----------------------------------------- + +#if defined(__i386) || defined(__i386__) || defined(_M_IX86) \ + || defined(__amd64) || defined(__amd64__) || defined(_M_AMD64) \ + || defined(__x86_64) || defined(__x86_64__) || defined(_M_X64) + +// Intel extended double precision format (80 bits) + +template<> +struct fp_traits_non_native<long double, extended_double_precision> +{ + typedef ieee_copy_leading_bits_tag method; + + BOOST_STATIC_CONSTANT(uint32_t, sign = 0x80000000u); + BOOST_STATIC_CONSTANT(uint32_t, exponent = 0x7fff0000); + BOOST_STATIC_CONSTANT(uint32_t, flag = 0x00008000); + BOOST_STATIC_CONSTANT(uint32_t, significand = 0x00007fff); + + typedef uint32_t bits; + + static void get_bits(long double x, uint32_t& a) + { + std::memcpy(&a, reinterpret_cast<const unsigned char*>(&x) + 6, 4); + } + + static void set_bits(long double& x, uint32_t a) + { + std::memcpy(reinterpret_cast<unsigned char*>(&x) + 6, &a, 4); + } +}; + + +// long double (>64 bits), Itanium --------------------------------------------- + +#elif defined(__ia64) || defined(__ia64__) || defined(_M_IA64) + +// The floating point format is unknown at compile time +// No template specialization is provided. +// The generic_tag definition is used. + +// The Itanium supports both +// the Intel extended double precision format (80 bits) and +// the IEEE extended double precision format with 15 exponent bits (128 bits). + + +// long double (>64 bits), PowerPC --------------------------------------------- + +#elif defined(__powerpc) || defined(__powerpc__) || defined(__POWERPC__) \ + || defined(__ppc) || defined(__ppc__) || defined(__PPC__) + +// PowerPC extended double precision format (128 bits) + +template<> +struct fp_traits_non_native<long double, extended_double_precision> +{ + typedef ieee_copy_leading_bits_tag method; + + BOOST_STATIC_CONSTANT(uint32_t, sign = 0x80000000u); + BOOST_STATIC_CONSTANT(uint32_t, exponent = 0x7ff00000); + BOOST_STATIC_CONSTANT(uint32_t, flag = 0x00000000); + BOOST_STATIC_CONSTANT(uint32_t, significand = 0x000fffff); + + typedef uint32_t bits; + + static void get_bits(long double x, uint32_t& a) + { + std::memcpy(&a, reinterpret_cast<const unsigned char*>(&x) + offset_, 4); + } + + static void set_bits(long double& x, uint32_t a) + { + std::memcpy(reinterpret_cast<unsigned char*>(&x) + offset_, &a, 4); + } + +private: + +#if defined(BOOST_BIG_ENDIAN) + BOOST_STATIC_CONSTANT(int, offset_ = 0); +#elif defined(BOOST_LITTLE_ENDIAN) + BOOST_STATIC_CONSTANT(int, offset_ = 12); +#else + BOOST_STATIC_ASSERT(false); +#endif +}; + + +// long double (>64 bits), Motorola 68K ---------------------------------------- + +#elif defined(__m68k) || defined(__m68k__) \ + || defined(__mc68000) || defined(__mc68000__) \ + +// Motorola extended double precision format (96 bits) + +// It is the same format as the Intel extended double precision format, +// except that 1) it is big-endian, 2) the 3rd and 4th byte are padding, and +// 3) the flag bit is not set for infinity + +template<> +struct fp_traits_non_native<long double, extended_double_precision> +{ + typedef ieee_copy_leading_bits_tag method; + + BOOST_STATIC_CONSTANT(uint32_t, sign = 0x80000000u); + BOOST_STATIC_CONSTANT(uint32_t, exponent = 0x7fff0000); + BOOST_STATIC_CONSTANT(uint32_t, flag = 0x00008000); + BOOST_STATIC_CONSTANT(uint32_t, significand = 0x00007fff); + + // copy 1st, 2nd, 5th and 6th byte. 3rd and 4th byte are padding. + + typedef uint32_t bits; + + static void get_bits(long double x, uint32_t& a) + { + std::memcpy(&a, &x, 2); + std::memcpy(reinterpret_cast<unsigned char*>(&a) + 2, + reinterpret_cast<const unsigned char*>(&x) + 4, 2); + } + + static void set_bits(long double& x, uint32_t a) + { + std::memcpy(&x, &a, 2); + std::memcpy(reinterpret_cast<unsigned char*>(&x) + 4, + reinterpret_cast<const unsigned char*>(&a) + 2, 2); + } +}; + + +// long double (>64 bits), All other processors -------------------------------- + +#else + +// IEEE extended double precision format with 15 exponent bits (128 bits) + +template<> +struct fp_traits_non_native<long double, extended_double_precision> +{ + typedef ieee_copy_leading_bits_tag method; + + BOOST_STATIC_CONSTANT(uint32_t, sign = 0x80000000u); + BOOST_STATIC_CONSTANT(uint32_t, exponent = 0x7fff0000); + BOOST_STATIC_CONSTANT(uint32_t, flag = 0x00000000); + BOOST_STATIC_CONSTANT(uint32_t, significand = 0x0000ffff); + + typedef uint32_t bits; + + static void get_bits(long double x, uint32_t& a) + { + std::memcpy(&a, reinterpret_cast<const unsigned char*>(&x) + offset_, 4); + } + + static void set_bits(long double& x, uint32_t a) + { + std::memcpy(reinterpret_cast<unsigned char*>(&x) + offset_, &a, 4); + } + +private: + +#if defined(BOOST_BIG_ENDIAN) + BOOST_STATIC_CONSTANT(int, offset_ = 0); +#elif defined(BOOST_LITTLE_ENDIAN) + BOOST_STATIC_CONSTANT(int, offset_ = 12); +#else + BOOST_STATIC_ASSERT(false); +#endif +}; + +#endif + +//------------------------------------------------------------------------------ + +// size_to_precision is a type switch for converting a C++ floating point type +// to the corresponding precision type. + +template<int n, bool fp> struct size_to_precision +{ + typedef unknown_precision type; +}; + +template<> struct size_to_precision<4, true> +{ + typedef single_precision type; +}; + +template<> struct size_to_precision<8, true> +{ + typedef double_precision type; +}; + +template<> struct size_to_precision<10, true> +{ + typedef extended_double_precision type; +}; + +template<> struct size_to_precision<12, true> +{ + typedef extended_double_precision type; +}; + +template<> struct size_to_precision<16, true> +{ + typedef extended_double_precision type; +}; + +//------------------------------------------------------------------------------ +// +// Figure out whether to use native classification functions based on +// whether T is a built in floating point type or not: +// +template <class T> +struct select_native +{ + typedef BOOST_DEDUCED_TYPENAME size_to_precision<sizeof(T), ::boost::is_floating_point<T>::value>::type precision; + typedef fp_traits_non_native<T, precision> type; +}; +template<> +struct select_native<float> +{ + typedef fp_traits_native<float> type; +}; +template<> +struct select_native<double> +{ + typedef fp_traits_native<double> type; +}; +template<> +struct select_native<long double> +{ + typedef fp_traits_native<long double> type; +}; + +//------------------------------------------------------------------------------ + +// fp_traits is a type switch that selects the right fp_traits_non_native + +#if (defined(BOOST_MATH_USE_C99) && !(defined(__GNUC__) && (__GNUC__ < 4))) \ + && !defined(__hpux) \ + && !defined(__DECCXX)\ + && !defined(__osf__) \ + && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION)\ + && !defined(BOOST_MATH_DISABLE_STD_FPCLASSIFY) +# define BOOST_MATH_USE_STD_FPCLASSIFY +#endif + +template<class T> struct fp_traits +{ + typedef BOOST_DEDUCED_TYPENAME size_to_precision<sizeof(T), ::boost::is_floating_point<T>::value>::type precision; +#if defined(BOOST_MATH_USE_STD_FPCLASSIFY) && !defined(BOOST_MATH_DISABLE_STD_FPCLASSIFY) + typedef typename select_native<T>::type type; +#else + typedef fp_traits_non_native<T, precision> type; +#endif + typedef fp_traits_non_native<T, precision> sign_change_type; +}; + +//------------------------------------------------------------------------------ + +} // namespace detail +} // namespace math +} // namespace boost + +#endif diff --git a/3rdParty/Boost/src/boost/math/special_functions/detail/round_fwd.hpp b/3rdParty/Boost/src/boost/math/special_functions/detail/round_fwd.hpp new file mode 100644 index 0000000..952259a --- /dev/null +++ b/3rdParty/Boost/src/boost/math/special_functions/detail/round_fwd.hpp @@ -0,0 +1,80 @@ +// Copyright John Maddock 2008. + +// 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) + +#ifndef BOOST_MATH_SPECIAL_ROUND_FWD_HPP +#define BOOST_MATH_SPECIAL_ROUND_FWD_HPP + +#include <boost/config.hpp> + +#ifdef _MSC_VER +#pragma once +#endif + +namespace boost +{ + namespace math + { + + template <class T, class Policy> + T trunc(const T& v, const Policy& pol); + template <class T> + T trunc(const T& v); + template <class T, class Policy> + int itrunc(const T& v, const Policy& pol); + template <class T> + int itrunc(const T& v); + template <class T, class Policy> + long ltrunc(const T& v, const Policy& pol); + template <class T> + long ltrunc(const T& v); +#ifdef BOOST_HAS_LONG_LONG + template <class T, class Policy> + boost::long_long_type lltrunc(const T& v, const Policy& pol); + template <class T> + boost::long_long_type lltrunc(const T& v); +#endif + template <class T, class Policy> + T round(const T& v, const Policy& pol); + template <class T> + T round(const T& v); + template <class T, class Policy> + int iround(const T& v, const Policy& pol); + template <class T> + int iround(const T& v); + template <class T, class Policy> + long lround(const T& v, const Policy& pol); + template <class T> + long lround(const T& v); +#ifdef BOOST_HAS_LONG_LONG + template <class T, class Policy> + boost::long_long_type llround(const T& v, const Policy& pol); + template <class T> + boost::long_long_type llround(const T& v); +#endif + template <class T, class Policy> + T modf(const T& v, T* ipart, const Policy& pol); + template <class T> + T modf(const T& v, T* ipart); + template <class T, class Policy> + T modf(const T& v, int* ipart, const Policy& pol); + template <class T> + T modf(const T& v, int* ipart); + template <class T, class Policy> + T modf(const T& v, long* ipart, const Policy& pol); + template <class T> + T modf(const T& v, long* ipart); +#ifdef BOOST_HAS_LONG_LONG + template <class T, class Policy> + T modf(const T& v, boost::long_long_type* ipart, const Policy& pol); + template <class T> + T modf(const T& v, boost::long_long_type* ipart); +#endif + + } +} +#endif // BOOST_MATH_SPECIAL_ROUND_FWD_HPP + diff --git a/3rdParty/Boost/src/boost/math/special_functions/fpclassify.hpp b/3rdParty/Boost/src/boost/math/special_functions/fpclassify.hpp new file mode 100644 index 0000000..6f92d18 --- /dev/null +++ b/3rdParty/Boost/src/boost/math/special_functions/fpclassify.hpp @@ -0,0 +1,537 @@ +// Copyright John Maddock 2005-2008. +// Copyright (c) 2006-2008 Johan Rade +// 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) + +#ifndef BOOST_MATH_FPCLASSIFY_HPP +#define BOOST_MATH_FPCLASSIFY_HPP + +#ifdef _MSC_VER +#pragma once +#endif + +#include <math.h> +#include <boost/config/no_tr1/cmath.hpp> +#include <boost/limits.hpp> +#include <boost/math/tools/real_cast.hpp> +#include <boost/type_traits/is_floating_point.hpp> +#include <boost/math/special_functions/math_fwd.hpp> +#include <boost/math/special_functions/detail/fp_traits.hpp> +/*! + \file fpclassify.hpp + \brief Classify floating-point value as normal, subnormal, zero, infinite, or NaN. + \version 1.0 + \author John Maddock + */ + +/* + +1. If the platform is C99 compliant, then the native floating point +classification functions are used. However, note that we must only +define the functions which call std::fpclassify etc if that function +really does exist: otherwise a compiler may reject the code even though +the template is never instantiated. + +2. If the platform is not C99 compliant, and the binary format for +a floating point type (float, double or long double) can be determined +at compile time, then the following algorithm is used: + + If all exponent bits, the flag bit (if there is one), + and all significand bits are 0, then the number is zero. + + If all exponent bits and the flag bit (if there is one) are 0, + and at least one significand bit is 1, then the number is subnormal. + + If all exponent bits are 1 and all significand bits are 0, + then the number is infinity. + + If all exponent bits are 1 and at least one significand bit is 1, + then the number is a not-a-number. + + Otherwise the number is normal. + + This algorithm works for the IEEE 754 representation, + and also for several non IEEE 754 formats. + + Most formats have the structure + sign bit + exponent bits + significand bits. + + A few have the structure + sign bit + exponent bits + flag bit + significand bits. + The flag bit is 0 for zero and subnormal numbers, + and 1 for normal numbers and NaN. + It is 0 (Motorola 68K) or 1 (Intel) for infinity. + + To get the bits, the four or eight most significant bytes are copied + into an uint32_t or uint64_t and bit masks are applied. + This covers all the exponent bits and the flag bit (if there is one), + but not always all the significand bits. + Some of the functions below have two implementations, + depending on whether all the significand bits are copied or not. + +3. If the platform is not C99 compliant, and the binary format for +a floating point type (float, double or long double) can not be determined +at compile time, then comparison with std::numeric_limits values +is used. + +*/ + +#if defined(_MSC_VER) || defined(__BORLANDC__) +#include <float.h> +#endif + +#ifdef BOOST_NO_STDC_NAMESPACE + namespace std{ using ::abs; using ::fabs; } +#endif + +namespace boost{ + +// +// This must not be located in any namespace under boost::math +// otherwise we can get into an infinite loop if isnan is +// a #define for "isnan" ! +// +namespace math_detail{ + +template <class T> +inline bool is_nan_helper(T t, const boost::true_type&) +{ +#ifdef isnan + return isnan(t); +#elif defined(BOOST_MATH_DISABLE_STD_FPCLASSIFY) || !defined(BOOST_HAS_FPCLASSIFY) + return false; +#else // BOOST_HAS_FPCLASSIFY + return (BOOST_FPCLASSIFY_PREFIX fpclassify(t) == (int)FP_NAN); +#endif +} + +template <class T> +inline bool is_nan_helper(T, const boost::false_type&) +{ + return false; +} + +} + +namespace math{ + +namespace detail{ + +#ifdef BOOST_MATH_USE_STD_FPCLASSIFY +template <class T> +inline int fpclassify_imp BOOST_NO_MACRO_EXPAND(T t, const native_tag&) +{ + return (std::fpclassify)(t); +} +#endif + +template <class T> +inline int fpclassify_imp BOOST_NO_MACRO_EXPAND(T t, const generic_tag<true>&) +{ + BOOST_MATH_INSTRUMENT_VARIABLE(t); + + // whenever possible check for Nan's first: +#if defined(BOOST_HAS_FPCLASSIFY) && !defined(BOOST_MATH_DISABLE_STD_FPCLASSIFY) + if(::boost::math_detail::is_nan_helper(t, ::boost::is_floating_point<T>())) + return FP_NAN; +#elif defined(isnan) + if(boost::math_detail::is_nan_helper(t, ::boost::is_floating_point<T>())) + return FP_NAN; +#elif defined(_MSC_VER) || defined(__BORLANDC__) + if(::_isnan(boost::math::tools::real_cast<double>(t))) + return FP_NAN; +#endif + // std::fabs broken on a few systems especially for long long!!!! + T at = (t < T(0)) ? -t : t; + + // Use a process of exclusion to figure out + // what kind of type we have, this relies on + // IEEE conforming reals that will treat + // Nan's as unordered. Some compilers + // don't do this once optimisations are + // turned on, hence the check for nan's above. + if(at <= (std::numeric_limits<T>::max)()) + { + if(at >= (std::numeric_limits<T>::min)()) + return FP_NORMAL; + return (at != 0) ? FP_SUBNORMAL : FP_ZERO; + } + else if(at > (std::numeric_limits<T>::max)()) + return FP_INFINITE; + return FP_NAN; +} + +template <class T> +inline int fpclassify_imp BOOST_NO_MACRO_EXPAND(T t, const generic_tag<false>&) +{ +#ifdef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS + if(std::numeric_limits<T>::is_specialized) + return fpclassify_imp(t, generic_tag<true>()); +#endif + // + // An unknown type with no numeric_limits support, + // so what are we supposed to do we do here? + // + BOOST_MATH_INSTRUMENT_VARIABLE(t); + + return t == 0 ? FP_ZERO : FP_NORMAL; +} + +template<class T> +int fpclassify_imp BOOST_NO_MACRO_EXPAND(T x, ieee_copy_all_bits_tag) +{ + typedef BOOST_DEDUCED_TYPENAME fp_traits<T>::type traits; + + BOOST_MATH_INSTRUMENT_VARIABLE(x); + + BOOST_DEDUCED_TYPENAME traits::bits a; + traits::get_bits(x,a); + BOOST_MATH_INSTRUMENT_VARIABLE(a); + a &= traits::exponent | traits::flag | traits::significand; + BOOST_MATH_INSTRUMENT_VARIABLE((traits::exponent | traits::flag | traits::significand)); + BOOST_MATH_INSTRUMENT_VARIABLE(a); + + if(a <= traits::significand) { + if(a == 0) + return FP_ZERO; + else + return FP_SUBNORMAL; + } + + if(a < traits::exponent) return FP_NORMAL; + + a &= traits::significand; + if(a == 0) return FP_INFINITE; + + return FP_NAN; +} + +template<class T> +int fpclassify_imp BOOST_NO_MACRO_EXPAND(T x, ieee_copy_leading_bits_tag) +{ + typedef BOOST_DEDUCED_TYPENAME fp_traits<T>::type traits; + + BOOST_MATH_INSTRUMENT_VARIABLE(x); + + BOOST_DEDUCED_TYPENAME traits::bits a; + traits::get_bits(x,a); + a &= traits::exponent | traits::flag | traits::significand; + + if(a <= traits::significand) { + if(x == 0) + return FP_ZERO; + else + return FP_SUBNORMAL; + } + + if(a < traits::exponent) return FP_NORMAL; + + a &= traits::significand; + traits::set_bits(x,a); + if(x == 0) return FP_INFINITE; + + return FP_NAN; +} + +#if defined(BOOST_MATH_USE_STD_FPCLASSIFY) && defined(BOOST_MATH_NO_NATIVE_LONG_DOUBLE_FP_CLASSIFY) +template <> +inline int fpclassify_imp<long double> BOOST_NO_MACRO_EXPAND(long double t, const native_tag&) +{ + return boost::math::detail::fpclassify_imp(t, generic_tag<true>()); +} +#endif + +} // namespace detail + +template <class T> +inline int fpclassify BOOST_NO_MACRO_EXPAND(T t) +{ + typedef typename detail::fp_traits<T>::type traits; + typedef typename traits::method method; + typedef typename tools::promote_args<T>::type value_type; +#ifdef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS + if(std::numeric_limits<T>::is_specialized && detail::is_generic_tag_false(static_cast<method*>(0))) + return detail::fpclassify_imp(static_cast<value_type>(t), detail::generic_tag<true>()); + return detail::fpclassify_imp(static_cast<value_type>(t), method()); +#else + return detail::fpclassify_imp(static_cast<value_type>(t), method()); +#endif +} + +namespace detail { + +#ifdef BOOST_MATH_USE_STD_FPCLASSIFY + template<class T> + inline bool isfinite_impl(T x, native_tag const&) + { + return (std::isfinite)(x); + } +#endif + + template<class T> + inline bool isfinite_impl(T x, generic_tag<true> const&) + { + return x >= -(std::numeric_limits<T>::max)() + && x <= (std::numeric_limits<T>::max)(); + } + + template<class T> + inline bool isfinite_impl(T x, generic_tag<false> const&) + { +#ifdef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS + if(std::numeric_limits<T>::is_specialized) + return isfinite_impl(x, generic_tag<true>()); +#endif + (void)x; // warning supression. + return true; + } + + template<class T> + inline bool isfinite_impl(T x, ieee_tag const&) + { + typedef BOOST_DEDUCED_TYPENAME detail::fp_traits<T>::type traits; + BOOST_DEDUCED_TYPENAME traits::bits a; + traits::get_bits(x,a); + a &= traits::exponent; + return a != traits::exponent; + } + +#if defined(BOOST_MATH_USE_STD_FPCLASSIFY) && defined(BOOST_MATH_NO_NATIVE_LONG_DOUBLE_FP_CLASSIFY) +template <> +inline bool isfinite_impl<long double> BOOST_NO_MACRO_EXPAND(long double t, const native_tag&) +{ + return boost::math::detail::isfinite_impl(t, generic_tag<true>()); +} +#endif + +} + +template<class T> +inline bool (isfinite)(T x) +{ //!< \brief return true if floating-point type t is finite. + typedef typename detail::fp_traits<T>::type traits; + typedef typename traits::method method; + typedef typename boost::is_floating_point<T>::type fp_tag; + typedef typename tools::promote_args<T>::type value_type; + return detail::isfinite_impl(static_cast<value_type>(x), method()); +} + +//------------------------------------------------------------------------------ + +namespace detail { + +#ifdef BOOST_MATH_USE_STD_FPCLASSIFY + template<class T> + inline bool isnormal_impl(T x, native_tag const&) + { + return (std::isnormal)(x); + } +#endif + + template<class T> + inline bool isnormal_impl(T x, generic_tag<true> const&) + { + if(x < 0) x = -x; + return x >= (std::numeric_limits<T>::min)() + && x <= (std::numeric_limits<T>::max)(); + } + + template<class T> + inline bool isnormal_impl(T x, generic_tag<false> const&) + { +#ifdef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS + if(std::numeric_limits<T>::is_specialized) + return isnormal_impl(x, generic_tag<true>()); +#endif + return !(x == 0); + } + + template<class T> + inline bool isnormal_impl(T x, ieee_tag const&) + { + typedef BOOST_DEDUCED_TYPENAME detail::fp_traits<T>::type traits; + BOOST_DEDUCED_TYPENAME traits::bits a; + traits::get_bits(x,a); + a &= traits::exponent | traits::flag; + return (a != 0) && (a < traits::exponent); + } + +#if defined(BOOST_MATH_USE_STD_FPCLASSIFY) && defined(BOOST_MATH_NO_NATIVE_LONG_DOUBLE_FP_CLASSIFY) +template <> +inline bool isnormal_impl<long double> BOOST_NO_MACRO_EXPAND(long double t, const native_tag&) +{ + return boost::math::detail::isnormal_impl(t, generic_tag<true>()); +} +#endif + +} + +template<class T> +inline bool (isnormal)(T x) +{ + typedef typename detail::fp_traits<T>::type traits; + typedef typename traits::method method; + typedef typename boost::is_floating_point<T>::type fp_tag; + typedef typename tools::promote_args<T>::type value_type; + return detail::isnormal_impl(static_cast<value_type>(x), method()); +} + +//------------------------------------------------------------------------------ + +namespace detail { + +#ifdef BOOST_MATH_USE_STD_FPCLASSIFY + template<class T> + inline bool isinf_impl(T x, native_tag const&) + { + return (std::isinf)(x); + } +#endif + + template<class T> + inline bool isinf_impl(T x, generic_tag<true> const&) + { + (void)x; // in case the compiler thinks that x is unused because std::numeric_limits<T>::has_infinity is false + return std::numeric_limits<T>::has_infinity + && ( x == std::numeric_limits<T>::infinity() + || x == -std::numeric_limits<T>::infinity()); + } + + template<class T> + inline bool isinf_impl(T x, generic_tag<false> const&) + { +#ifdef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS + if(std::numeric_limits<T>::is_specialized) + return isinf_impl(x, generic_tag<true>()); +#endif + (void)x; // warning supression. + return false; + } + + template<class T> + inline bool isinf_impl(T x, ieee_copy_all_bits_tag const&) + { + typedef BOOST_DEDUCED_TYPENAME fp_traits<T>::type traits; + + BOOST_DEDUCED_TYPENAME traits::bits a; + traits::get_bits(x,a); + a &= traits::exponent | traits::significand; + return a == traits::exponent; + } + + template<class T> + inline bool isinf_impl(T x, ieee_copy_leading_bits_tag const&) + { + typedef BOOST_DEDUCED_TYPENAME fp_traits<T>::type traits; + + BOOST_DEDUCED_TYPENAME traits::bits a; + traits::get_bits(x,a); + a &= traits::exponent | traits::significand; + if(a != traits::exponent) + return false; + + traits::set_bits(x,0); + return x == 0; + } + +#if defined(BOOST_MATH_USE_STD_FPCLASSIFY) && defined(BOOST_MATH_NO_NATIVE_LONG_DOUBLE_FP_CLASSIFY) +template <> +inline bool isinf_impl<long double> BOOST_NO_MACRO_EXPAND(long double t, const native_tag&) +{ + return boost::math::detail::isinf_impl(t, generic_tag<true>()); +} +#endif + +} // namespace detail + +template<class T> +inline bool (isinf)(T x) +{ + typedef typename detail::fp_traits<T>::type traits; + typedef typename traits::method method; + typedef typename boost::is_floating_point<T>::type fp_tag; + typedef typename tools::promote_args<T>::type value_type; + return detail::isinf_impl(static_cast<value_type>(x), method()); +} + +//------------------------------------------------------------------------------ + +namespace detail { + +#ifdef BOOST_MATH_USE_STD_FPCLASSIFY + template<class T> + inline bool isnan_impl(T x, native_tag const&) + { + return (std::isnan)(x); + } +#endif + + template<class T> + inline bool isnan_impl(T x, generic_tag<true> const&) + { + return std::numeric_limits<T>::has_infinity + ? !(x <= std::numeric_limits<T>::infinity()) + : x != x; + } + + template<class T> + inline bool isnan_impl(T x, generic_tag<false> const&) + { +#ifdef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS + if(std::numeric_limits<T>::is_specialized) + return isnan_impl(x, generic_tag<true>()); +#endif + (void)x; // warning supression + return false; + } + + template<class T> + inline bool isnan_impl(T x, ieee_copy_all_bits_tag const&) + { + typedef BOOST_DEDUCED_TYPENAME fp_traits<T>::type traits; + + BOOST_DEDUCED_TYPENAME traits::bits a; + traits::get_bits(x,a); + a &= traits::exponent | traits::significand; + return a > traits::exponent; + } + + template<class T> + inline bool isnan_impl(T x, ieee_copy_leading_bits_tag const&) + { + typedef BOOST_DEDUCED_TYPENAME fp_traits<T>::type traits; + + BOOST_DEDUCED_TYPENAME traits::bits a; + traits::get_bits(x,a); + + a &= traits::exponent | traits::significand; + if(a < traits::exponent) + return false; + + a &= traits::significand; + traits::set_bits(x,a); + return x != 0; + } + +} // namespace detail + +template<class T> bool (isnan)(T x) +{ //!< \brief return true if floating-point type t is NaN (Not A Number). + typedef typename detail::fp_traits<T>::type traits; + typedef typename traits::method method; + typedef typename boost::is_floating_point<T>::type fp_tag; + return detail::isnan_impl(x, method()); +} + +#ifdef isnan +template <> inline bool isnan BOOST_NO_MACRO_EXPAND<float>(float t){ return ::boost::math_detail::is_nan_helper(t, boost::true_type()); } +template <> inline bool isnan BOOST_NO_MACRO_EXPAND<double>(double t){ return ::boost::math_detail::is_nan_helper(t, boost::true_type()); } +template <> inline bool isnan BOOST_NO_MACRO_EXPAND<long double>(long double t){ return ::boost::math_detail::is_nan_helper(t, boost::true_type()); } +#endif + +} // namespace math +} // namespace boost + +#endif // BOOST_MATH_FPCLASSIFY_HPP + diff --git a/3rdParty/Boost/src/boost/math/special_functions/math_fwd.hpp b/3rdParty/Boost/src/boost/math/special_functions/math_fwd.hpp new file mode 100644 index 0000000..6669e3f --- /dev/null +++ b/3rdParty/Boost/src/boost/math/special_functions/math_fwd.hpp @@ -0,0 +1,1296 @@ +// math_fwd.hpp + +// TODO revise completely for new distribution classes. + +// Copyright Paul A. Bristow 2006. +// Copyright John Maddock 2006. + +// 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) + +// Omnibus list of forward declarations of math special functions. + +// IT = Integer type. +// RT = Real type (built-in floating-point types, float, double, long double) & User Defined Types +// AT = Integer or Real type + +#ifndef BOOST_MATH_SPECIAL_MATH_FWD_HPP +#define BOOST_MATH_SPECIAL_MATH_FWD_HPP + +#ifdef _MSC_VER +#pragma once +#endif + +#include <boost/math/special_functions/detail/round_fwd.hpp> +#include <boost/math/tools/promotion.hpp> // for argument promotion. +#include <boost/math/policies/policy.hpp> +#include <boost/mpl/comparison.hpp> +#include <boost/config/no_tr1/complex.hpp> + +#define BOOST_NO_MACRO_EXPAND /**/ + +namespace boost +{ + namespace math + { // Math functions (in roughly alphabetic order). + + // Beta functions. + template <class RT1, class RT2> + typename tools::promote_args<RT1, RT2>::type + beta(RT1 a, RT2 b); // Beta function (2 arguments). + + template <class RT1, class RT2, class A> + typename tools::promote_args<RT1, RT2, A>::type + beta(RT1 a, RT2 b, A x); // Beta function (3 arguments). + + template <class RT1, class RT2, class RT3, class Policy> + typename tools::promote_args<RT1, RT2, RT3>::type + beta(RT1 a, RT2 b, RT3 x, const Policy& pol); // Beta function (3 arguments). + + template <class RT1, class RT2, class RT3> + typename tools::promote_args<RT1, RT2, RT3>::type + betac(RT1 a, RT2 b, RT3 x); + + template <class RT1, class RT2, class RT3, class Policy> + typename tools::promote_args<RT1, RT2, RT3>::type + betac(RT1 a, RT2 b, RT3 x, const Policy& pol); + + template <class RT1, class RT2, class RT3> + typename tools::promote_args<RT1, RT2, RT3>::type + ibeta(RT1 a, RT2 b, RT3 x); // Incomplete beta function. + + template <class RT1, class RT2, class RT3, class Policy> + typename tools::promote_args<RT1, RT2, RT3>::type + ibeta(RT1 a, RT2 b, RT3 x, const Policy& pol); // Incomplete beta function. + + template <class RT1, class RT2, class RT3> + typename tools::promote_args<RT1, RT2, RT3>::type + ibetac(RT1 a, RT2 b, RT3 x); // Incomplete beta complement function. + + template <class RT1, class RT2, class RT3, class Policy> + typename tools::promote_args<RT1, RT2, RT3>::type + ibetac(RT1 a, RT2 b, RT3 x, const Policy& pol); // Incomplete beta complement function. + + template <class T1, class T2, class T3, class T4> + typename tools::promote_args<T1, T2, T3, T4>::type + ibeta_inv(T1 a, T2 b, T3 p, T4* py); + + template <class T1, class T2, class T3, class T4, class Policy> + typename tools::promote_args<T1, T2, T3, T4>::type + ibeta_inv(T1 a, T2 b, T3 p, T4* py, const Policy& pol); + + template <class RT1, class RT2, class RT3> + typename tools::promote_args<RT1, RT2, RT3>::type + ibeta_inv(RT1 a, RT2 b, RT3 p); // Incomplete beta inverse function. + + template <class RT1, class RT2, class RT3, class Policy> + typename tools::promote_args<RT1, RT2, RT3>::type + ibeta_inv(RT1 a, RT2 b, RT3 p, const Policy&); // Incomplete beta inverse function. + + template <class RT1, class RT2, class RT3> + typename tools::promote_args<RT1, RT2, RT3>::type + ibeta_inva(RT1 a, RT2 b, RT3 p); // Incomplete beta inverse function. + + template <class RT1, class RT2, class RT3, class Policy> + typename tools::promote_args<RT1, RT2, RT3>::type + ibeta_inva(RT1 a, RT2 b, RT3 p, const Policy&); // Incomplete beta inverse function. + + template <class RT1, class RT2, class RT3> + typename tools::promote_args<RT1, RT2, RT3>::type + ibeta_invb(RT1 a, RT2 b, RT3 p); // Incomplete beta inverse function. + + template <class RT1, class RT2, class RT3, class Policy> + typename tools::promote_args<RT1, RT2, RT3>::type + ibeta_invb(RT1 a, RT2 b, RT3 p, const Policy&); // Incomplete beta inverse function. + + template <class T1, class T2, class T3, class T4> + typename tools::promote_args<T1, T2, T3, T4>::type + ibetac_inv(T1 a, T2 b, T3 q, T4* py); + + template <class T1, class T2, class T3, class T4, class Policy> + typename tools::promote_args<T1, T2, T3, T4>::type + ibetac_inv(T1 a, T2 b, T3 q, T4* py, const Policy& pol); + + template <class RT1, class RT2, class RT3> + typename tools::promote_args<RT1, RT2, RT3>::type + ibetac_inv(RT1 a, RT2 b, RT3 q); // Incomplete beta complement inverse function. + + template <class RT1, class RT2, class RT3, class Policy> + typename tools::promote_args<RT1, RT2, RT3>::type + ibetac_inv(RT1 a, RT2 b, RT3 q, const Policy&); // Incomplete beta complement inverse function. + + template <class RT1, class RT2, class RT3> + typename tools::promote_args<RT1, RT2, RT3>::type + ibetac_inva(RT1 a, RT2 b, RT3 q); // Incomplete beta complement inverse function. + + template <class RT1, class RT2, class RT3, class Policy> + typename tools::promote_args<RT1, RT2, RT3>::type + ibetac_inva(RT1 a, RT2 b, RT3 q, const Policy&); // Incomplete beta complement inverse function. + + template <class RT1, class RT2, class RT3> + typename tools::promote_args<RT1, RT2, RT3>::type + ibetac_invb(RT1 a, RT2 b, RT3 q); // Incomplete beta complement inverse function. + + template <class RT1, class RT2, class RT3, class Policy> + typename tools::promote_args<RT1, RT2, RT3>::type + ibetac_invb(RT1 a, RT2 b, RT3 q, const Policy&); // Incomplete beta complement inverse function. + + template <class RT1, class RT2, class RT3> + typename tools::promote_args<RT1, RT2, RT3>::type + ibeta_derivative(RT1 a, RT2 b, RT3 x); // derivative of incomplete beta + + template <class RT1, class RT2, class RT3, class Policy> + typename tools::promote_args<RT1, RT2, RT3>::type + ibeta_derivative(RT1 a, RT2 b, RT3 x, const Policy& pol); // derivative of incomplete beta + + // erf & erfc error functions. + template <class RT> // Error function. + typename tools::promote_args<RT>::type erf(RT z); + template <class RT, class Policy> // Error function. + typename tools::promote_args<RT>::type erf(RT z, const Policy&); + + template <class RT>// Error function complement. + typename tools::promote_args<RT>::type erfc(RT z); + template <class RT, class Policy>// Error function complement. + typename tools::promote_args<RT>::type erfc(RT z, const Policy&); + + template <class RT>// Error function inverse. + typename tools::promote_args<RT>::type erf_inv(RT z); + template <class RT, class Policy>// Error function inverse. + typename tools::promote_args<RT>::type erf_inv(RT z, const Policy& pol); + + template <class RT>// Error function complement inverse. + typename tools::promote_args<RT>::type erfc_inv(RT z); + template <class RT, class Policy>// Error function complement inverse. + typename tools::promote_args<RT>::type erfc_inv(RT z, const Policy& pol); + + // Polynomials: + template <class T1, class T2, class T3> + typename tools::promote_args<T1, T2, T3>::type + legendre_next(unsigned l, T1 x, T2 Pl, T3 Plm1); + + template <class T> + typename tools::promote_args<T>::type + legendre_p(int l, T x); + + template <class T, class Policy> + typename tools::promote_args<T>::type + legendre_p(int l, T x, const Policy& pol); + + template <class T> + typename tools::promote_args<T>::type + legendre_q(unsigned l, T x); + + template <class T, class Policy> + typename tools::promote_args<T>::type + legendre_q(unsigned l, T x, const Policy& pol); + + template <class T1, class T2, class T3> + typename tools::promote_args<T1, T2, T3>::type + legendre_next(unsigned l, unsigned m, T1 x, T2 Pl, T3 Plm1); + + template <class T> + typename tools::promote_args<T>::type + legendre_p(int l, int m, T x); + + template <class T, class Policy> + typename tools::promote_args<T>::type + legendre_p(int l, int m, T x, const Policy& pol); + + template <class T1, class T2, class T3> + typename tools::promote_args<T1, T2, T3>::type + laguerre_next(unsigned n, T1 x, T2 Ln, T3 Lnm1); + + template <class T1, class T2, class T3> + typename tools::promote_args<T1, T2, T3>::type + laguerre_next(unsigned n, unsigned l, T1 x, T2 Pl, T3 Plm1); + + template <class T> + typename tools::promote_args<T>::type + laguerre(unsigned n, T x); + + template <class T, class Policy> + typename tools::promote_args<T>::type + laguerre(unsigned n, unsigned m, T x, const Policy& pol); + + template <class T1, class T2> + struct laguerre_result + { + typedef typename mpl::if_< + policies::is_policy<T2>, + typename tools::promote_args<T1>::type, + typename tools::promote_args<T2>::type + >::type type; + }; + + template <class T1, class T2> + typename laguerre_result<T1, T2>::type + laguerre(unsigned n, T1 m, T2 x); + + template <class T> + typename tools::promote_args<T>::type + hermite(unsigned n, T x); + + template <class T, class Policy> + typename tools::promote_args<T>::type + hermite(unsigned n, T x, const Policy& pol); + + template <class T1, class T2, class T3> + typename tools::promote_args<T1, T2, T3>::type + hermite_next(unsigned n, T1 x, T2 Hn, T3 Hnm1); + + template <class T1, class T2> + std::complex<typename tools::promote_args<T1, T2>::type> + spherical_harmonic(unsigned n, int m, T1 theta, T2 phi); + + template <class T1, class T2, class Policy> + std::complex<typename tools::promote_args<T1, T2>::type> + spherical_harmonic(unsigned n, int m, T1 theta, T2 phi, const Policy& pol); + + template <class T1, class T2> + typename tools::promote_args<T1, T2>::type + spherical_harmonic_r(unsigned n, int m, T1 theta, T2 phi); + + template <class T1, class T2, class Policy> + typename tools::promote_args<T1, T2>::type + spherical_harmonic_r(unsigned n, int m, T1 theta, T2 phi, const Policy& pol); + + template <class T1, class T2> + typename tools::promote_args<T1, T2>::type + spherical_harmonic_i(unsigned n, int m, T1 theta, T2 phi); + + template <class T1, class T2, class Policy> + typename tools::promote_args<T1, T2>::type + spherical_harmonic_i(unsigned n, int m, T1 theta, T2 phi, const Policy& pol); + + // Elliptic integrals: + template <class T1, class T2, class T3> + typename tools::promote_args<T1, T2, T3>::type + ellint_rf(T1 x, T2 y, T3 z); + + template <class T1, class T2, class T3, class Policy> + typename tools::promote_args<T1, T2, T3>::type + ellint_rf(T1 x, T2 y, T3 z, const Policy& pol); + + template <class T1, class T2, class T3> + typename tools::promote_args<T1, T2, T3>::type + ellint_rd(T1 x, T2 y, T3 z); + + template <class T1, class T2, class T3, class Policy> + typename tools::promote_args<T1, T2, T3>::type + ellint_rd(T1 x, T2 y, T3 z, const Policy& pol); + + template <class T1, class T2> + typename tools::promote_args<T1, T2>::type + ellint_rc(T1 x, T2 y); + + template <class T1, class T2, class Policy> + typename tools::promote_args<T1, T2>::type + ellint_rc(T1 x, T2 y, const Policy& pol); + + template <class T1, class T2, class T3, class T4> + typename tools::promote_args<T1, T2, T3, T4>::type + ellint_rj(T1 x, T2 y, T3 z, T4 p); + + template <class T1, class T2, class T3, class T4, class Policy> + typename tools::promote_args<T1, T2, T3, T4>::type + ellint_rj(T1 x, T2 y, T3 z, T4 p, const Policy& pol); + + template <typename T> + typename tools::promote_args<T>::type ellint_2(T k); + + template <class T1, class T2> + typename tools::promote_args<T1, T2>::type ellint_2(T1 k, T2 phi); + + template <class T1, class T2, class Policy> + typename tools::promote_args<T1, T2>::type ellint_2(T1 k, T2 phi, const Policy& pol); + + template <typename T> + typename tools::promote_args<T>::type ellint_1(T k); + + template <class T1, class T2> + typename tools::promote_args<T1, T2>::type ellint_1(T1 k, T2 phi); + + template <class T1, class T2, class Policy> + typename tools::promote_args<T1, T2>::type ellint_1(T1 k, T2 phi, const Policy& pol); + + namespace detail{ + + template <class T, class U, class V> + struct ellint_3_result + { + typedef typename mpl::if_< + policies::is_policy<V>, + typename tools::promote_args<T, U>::type, + typename tools::promote_args<T, U, V>::type + >::type type; + }; + + } // namespace detail + + + template <class T1, class T2, class T3> + typename detail::ellint_3_result<T1, T2, T3>::type ellint_3(T1 k, T2 v, T3 phi); + + template <class T1, class T2, class T3, class Policy> + typename tools::promote_args<T1, T2, T3>::type ellint_3(T1 k, T2 v, T3 phi, const Policy& pol); + + template <class T1, class T2> + typename tools::promote_args<T1, T2>::type ellint_3(T1 k, T2 v); + + // Factorial functions. + // Note: not for integral types, at present. + template <class RT> + struct max_factorial; + template <class RT> + RT factorial(unsigned int); + template <class RT, class Policy> + RT factorial(unsigned int, const Policy& pol); + template <class RT> + RT unchecked_factorial(unsigned int BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(RT)); + template <class RT> + RT double_factorial(unsigned i); + template <class RT, class Policy> + RT double_factorial(unsigned i, const Policy& pol); + + template <class RT> + typename tools::promote_args<RT>::type falling_factorial(RT x, unsigned n); + + template <class RT, class Policy> + typename tools::promote_args<RT>::type falling_factorial(RT x, unsigned n, const Policy& pol); + + template <class RT> + typename tools::promote_args<RT>::type rising_factorial(RT x, int n); + + template <class RT, class Policy> + typename tools::promote_args<RT>::type rising_factorial(RT x, int n, const Policy& pol); + + // Gamma functions. + template <class RT> + typename tools::promote_args<RT>::type tgamma(RT z); + + template <class RT> + typename tools::promote_args<RT>::type tgamma1pm1(RT z); + + template <class RT, class Policy> + typename tools::promote_args<RT>::type tgamma1pm1(RT z, const Policy& pol); + + template <class RT1, class RT2> + typename tools::promote_args<RT1, RT2>::type tgamma(RT1 a, RT2 z); + + template <class RT1, class RT2, class Policy> + typename tools::promote_args<RT1, RT2>::type tgamma(RT1 a, RT2 z, const Policy& pol); + + template <class RT> + typename tools::promote_args<RT>::type lgamma(RT z, int* sign); + + template <class RT, class Policy> + typename tools::promote_args<RT>::type lgamma(RT z, int* sign, const Policy& pol); + + template <class RT> + typename tools::promote_args<RT>::type lgamma(RT x); + + template <class RT, class Policy> + typename tools::promote_args<RT>::type lgamma(RT x, const Policy& pol); + + template <class RT1, class RT2> + typename tools::promote_args<RT1, RT2>::type tgamma_lower(RT1 a, RT2 z); + + template <class RT1, class RT2, class Policy> + typename tools::promote_args<RT1, RT2>::type tgamma_lower(RT1 a, RT2 z, const Policy&); + + template <class RT1, class RT2> + typename tools::promote_args<RT1, RT2>::type gamma_q(RT1 a, RT2 z); + + template <class RT1, class RT2, class Policy> + typename tools::promote_args<RT1, RT2>::type gamma_q(RT1 a, RT2 z, const Policy&); + + template <class RT1, class RT2> + typename tools::promote_args<RT1, RT2>::type gamma_p(RT1 a, RT2 z); + + template <class RT1, class RT2, class Policy> + typename tools::promote_args<RT1, RT2>::type gamma_p(RT1 a, RT2 z, const Policy&); + + template <class T1, class T2> + typename tools::promote_args<T1, T2>::type tgamma_delta_ratio(T1 z, T2 delta); + + template <class T1, class T2, class Policy> + typename tools::promote_args<T1, T2>::type tgamma_delta_ratio(T1 z, T2 delta, const Policy&); + + template <class T1, class T2> + typename tools::promote_args<T1, T2>::type tgamma_ratio(T1 a, T2 b); + + template <class T1, class T2, class Policy> + typename tools::promote_args<T1, T2>::type tgamma_ratio(T1 a, T2 b, const Policy&); + + template <class T1, class T2> + typename tools::promote_args<T1, T2>::type gamma_p_derivative(T1 a, T2 x); + + template <class T1, class T2, class Policy> + typename tools::promote_args<T1, T2>::type gamma_p_derivative(T1 a, T2 x, const Policy&); + + // gamma inverse. + template <class T1, class T2> + typename tools::promote_args<T1, T2>::type gamma_p_inv(T1 a, T2 p); + + template <class T1, class T2, class Policy> + typename tools::promote_args<T1, T2>::type gamma_p_inva(T1 a, T2 p, const Policy&); + + template <class T1, class T2> + typename tools::promote_args<T1, T2>::type gamma_p_inva(T1 a, T2 p); + + template <class T1, class T2, class Policy> + typename tools::promote_args<T1, T2>::type gamma_p_inv(T1 a, T2 p, const Policy&); + + template <class T1, class T2> + typename tools::promote_args<T1, T2>::type gamma_q_inv(T1 a, T2 q); + + template <class T1, class T2, class Policy> + typename tools::promote_args<T1, T2>::type gamma_q_inv(T1 a, T2 q, const Policy&); + + template <class T1, class T2> + typename tools::promote_args<T1, T2>::type gamma_q_inva(T1 a, T2 q); + + template <class T1, class T2, class Policy> + typename tools::promote_args<T1, T2>::type gamma_q_inva(T1 a, T2 q, const Policy&); + + // digamma: + template <class T> + typename tools::promote_args<T>::type digamma(T x); + + template <class T, class Policy> + typename tools::promote_args<T>::type digamma(T x, const Policy&); + + // Hypotenuse function sqrt(x ^ 2 + y ^ 2). + template <class T1, class T2> + typename tools::promote_args<T1, T2>::type + hypot(T1 x, T2 y); + + template <class T1, class T2, class Policy> + typename tools::promote_args<T1, T2>::type + hypot(T1 x, T2 y, const Policy&); + + // cbrt - cube root. + template <class RT> + typename tools::promote_args<RT>::type cbrt(RT z); + + template <class RT, class Policy> + typename tools::promote_args<RT>::type cbrt(RT z, const Policy&); + + // log1p is log(x + 1) + template <class T> + typename tools::promote_args<T>::type log1p(T); + + template <class T, class Policy> + typename tools::promote_args<T>::type log1p(T, const Policy&); + + // log1pmx is log(x + 1) - x + template <class T> + typename tools::promote_args<T>::type log1pmx(T); + + template <class T, class Policy> + typename tools::promote_args<T>::type log1pmx(T, const Policy&); + + // Exp (x) minus 1 functions. + template <class T> + typename tools::promote_args<T>::type expm1(T); + + template <class T, class Policy> + typename tools::promote_args<T>::type expm1(T, const Policy&); + + // Power - 1 + template <class T1, class T2> + typename tools::promote_args<T1, T2>::type + powm1(const T1 a, const T2 z); + + template <class T1, class T2, class Policy> + typename tools::promote_args<T1, T2>::type + powm1(const T1 a, const T2 z, const Policy&); + + // sqrt(1+x) - 1 + template <class T> + typename tools::promote_args<T>::type sqrt1pm1(const T& val); + + template <class T, class Policy> + typename tools::promote_args<T>::type sqrt1pm1(const T& val, const Policy&); + + // sinus cardinals: + template <class T> + typename tools::promote_args<T>::type sinc_pi(T x); + + template <class T, class Policy> + typename tools::promote_args<T>::type sinc_pi(T x, const Policy&); + + template <class T> + typename tools::promote_args<T>::type sinhc_pi(T x); + + template <class T, class Policy> + typename tools::promote_args<T>::type sinhc_pi(T x, const Policy&); + + // inverse hyperbolics: + template<typename T> + typename tools::promote_args<T>::type asinh(T x); + + template<typename T, class Policy> + typename tools::promote_args<T>::type asinh(T x, const Policy&); + + template<typename T> + typename tools::promote_args<T>::type acosh(T x); + + template<typename T, class Policy> + typename tools::promote_args<T>::type acosh(T x, const Policy&); + + template<typename T> + typename tools::promote_args<T>::type atanh(T x); + + template<typename T, class Policy> + typename tools::promote_args<T>::type atanh(T x, const Policy&); + + namespace detail{ + + typedef mpl::int_<0> bessel_no_int_tag; // No integer optimisation possible. + typedef mpl::int_<1> bessel_maybe_int_tag; // Maybe integer optimisation. + typedef mpl::int_<2> bessel_int_tag; // Definite integer optimistaion. + + template <class T1, class T2, class Policy> + struct bessel_traits + { + typedef typename tools::promote_args< + T1, T2 + >::type result_type; + + typedef typename policies::precision<result_type, Policy>::type precision_type; + + typedef typename mpl::if_< + mpl::or_< + mpl::less_equal<precision_type, mpl::int_<0> >, + mpl::greater<precision_type, mpl::int_<64> > >, + bessel_no_int_tag, + typename mpl::if_< + is_integral<T1>, + bessel_int_tag, + bessel_maybe_int_tag + >::type + >::type optimisation_tag; + }; + } // detail + + // Bessel functions: + template <class T1, class T2, class Policy> + typename detail::bessel_traits<T1, T2, Policy>::result_type cyl_bessel_j(T1 v, T2 x, const Policy& pol); + + template <class T1, class T2> + typename detail::bessel_traits<T1, T2, policies::policy<> >::result_type cyl_bessel_j(T1 v, T2 x); + + template <class T, class Policy> + typename detail::bessel_traits<T, T, Policy>::result_type sph_bessel(unsigned v, T x, const Policy& pol); + + template <class T> + typename detail::bessel_traits<T, T, policies::policy<> >::result_type sph_bessel(unsigned v, T x); + + template <class T1, class T2, class Policy> + typename detail::bessel_traits<T1, T2, Policy>::result_type cyl_bessel_i(T1 v, T2 x, const Policy& pol); + + template <class T1, class T2> + typename detail::bessel_traits<T1, T2, policies::policy<> >::result_type cyl_bessel_i(T1 v, T2 x); + + template <class T1, class T2, class Policy> + typename detail::bessel_traits<T1, T2, Policy>::result_type cyl_bessel_k(T1 v, T2 x, const Policy& pol); + + template <class T1, class T2> + typename detail::bessel_traits<T1, T2, policies::policy<> >::result_type cyl_bessel_k(T1 v, T2 x); + + template <class T1, class T2, class Policy> + typename detail::bessel_traits<T1, T2, Policy>::result_type cyl_neumann(T1 v, T2 x, const Policy& pol); + + template <class T1, class T2> + typename detail::bessel_traits<T1, T2, policies::policy<> >::result_type cyl_neumann(T1 v, T2 x); + + template <class T, class Policy> + typename detail::bessel_traits<T, T, Policy>::result_type sph_neumann(unsigned v, T x, const Policy& pol); + + template <class T> + typename detail::bessel_traits<T, T, policies::policy<> >::result_type sph_neumann(unsigned v, T x); + + template <class T1, class T2, class Policy> + std::complex<typename detail::bessel_traits<T1, T2, Policy>::result_type> cyl_hankel_1(T1 v, T2 x, const Policy& pol); + + template <class T1, class T2> + std::complex<typename detail::bessel_traits<T1, T2, policies::policy<> >::result_type> cyl_hankel_1(T1 v, T2 x); + + template <class T1, class T2, class Policy> + std::complex<typename detail::bessel_traits<T1, T2, Policy>::result_type> cyl_hankel_2(T1 v, T2 x, const Policy& pol); + + template <class T1, class T2> + std::complex<typename detail::bessel_traits<T1, T2, policies::policy<> >::result_type> cyl_hankel_2(T1 v, T2 x); + + template <class T1, class T2, class Policy> + std::complex<typename detail::bessel_traits<T1, T2, Policy>::result_type> sph_hankel_1(T1 v, T2 x, const Policy& pol); + + template <class T1, class T2> + std::complex<typename detail::bessel_traits<T1, T2, policies::policy<> >::result_type> sph_hankel_1(T1 v, T2 x); + + template <class T1, class T2, class Policy> + std::complex<typename detail::bessel_traits<T1, T2, Policy>::result_type> sph_hankel_2(T1 v, T2 x, const Policy& pol); + + template <class T1, class T2> + std::complex<typename detail::bessel_traits<T1, T2, policies::policy<> >::result_type> sph_hankel_2(T1 v, T2 x); + + template <class T, class Policy> + typename tools::promote_args<T>::type airy_ai(T x, const Policy&); + + template <class T> + typename tools::promote_args<T>::type airy_ai(T x); + + template <class T, class Policy> + typename tools::promote_args<T>::type airy_bi(T x, const Policy&); + + template <class T> + typename tools::promote_args<T>::type airy_bi(T x); + + template <class T, class Policy> + typename tools::promote_args<T>::type airy_ai_prime(T x, const Policy&); + + template <class T> + typename tools::promote_args<T>::type airy_ai_prime(T x); + + template <class T, class Policy> + typename tools::promote_args<T>::type airy_bi_prime(T x, const Policy&); + + template <class T> + typename tools::promote_args<T>::type airy_bi_prime(T x); + + template <class T, class Policy> + typename tools::promote_args<T>::type sin_pi(T x, const Policy&); + + template <class T> + typename tools::promote_args<T>::type sin_pi(T x); + + template <class T, class Policy> + typename tools::promote_args<T>::type cos_pi(T x, const Policy&); + + template <class T> + typename tools::promote_args<T>::type cos_pi(T x); + + template <class T> + int fpclassify BOOST_NO_MACRO_EXPAND(T t); + + template <class T> + bool isfinite BOOST_NO_MACRO_EXPAND(T z); + + template <class T> + bool isinf BOOST_NO_MACRO_EXPAND(T t); + + template <class T> + bool isnan BOOST_NO_MACRO_EXPAND(T t); + + template <class T> + bool isnormal BOOST_NO_MACRO_EXPAND(T t); + + template<class T> + int signbit BOOST_NO_MACRO_EXPAND(T x); + + template <class T> + int sign BOOST_NO_MACRO_EXPAND(const T& z); + + template <class T> + T copysign BOOST_NO_MACRO_EXPAND(const T& x, const T& y); + + template <class T> + T changesign BOOST_NO_MACRO_EXPAND(const T& z); + + // Exponential integrals: + namespace detail{ + + template <class T, class U> + struct expint_result + { + typedef typename mpl::if_< + policies::is_policy<U>, + typename tools::promote_args<T>::type, + typename tools::promote_args<U>::type + >::type type; + }; + + } // namespace detail + + template <class T, class Policy> + typename tools::promote_args<T>::type expint(unsigned n, T z, const Policy&); + + template <class T, class U> + typename detail::expint_result<T, U>::type expint(T const z, U const u); + + template <class T> + typename tools::promote_args<T>::type expint(T z); + + // Zeta: + template <class T, class Policy> + typename tools::promote_args<T>::type zeta(T s, const Policy&); + + // Owen's T function: + template <class T1, class T2, class Policy> + typename tools::promote_args<T1, T2>::type owens_t(T1 h, T2 a, const Policy& pol); + + template <class T1, class T2> + typename tools::promote_args<T1, T2>::type owens_t(T1 h, T2 a); + + // Jacobi Functions: + template <class T, class Policy> + typename tools::promote_args<T>::type jacobi_elliptic(T k, T theta, T* pcn, T* pdn, const Policy&); + + template <class T> + typename tools::promote_args<T>::type jacobi_elliptic(T k, T theta, T* pcn = 0, T* pdn = 0); + + template <class U, class T, class Policy> + typename tools::promote_args<T, U>::type jacobi_sn(U k, T theta, const Policy& pol); + + template <class U, class T> + typename tools::promote_args<T, U>::type jacobi_sn(U k, T theta); + + template <class T, class U, class Policy> + typename tools::promote_args<T, U>::type jacobi_cn(T k, U theta, const Policy& pol); + + template <class T, class U> + typename tools::promote_args<T, U>::type jacobi_cn(T k, U theta); + + template <class T, class U, class Policy> + typename tools::promote_args<T, U>::type jacobi_dn(T k, U theta, const Policy& pol); + + template <class T, class U> + typename tools::promote_args<T, U>::type jacobi_dn(T k, U theta); + + template <class T, class U, class Policy> + typename tools::promote_args<T, U>::type jacobi_cd(T k, U theta, const Policy& pol); + + template <class T, class U> + typename tools::promote_args<T, U>::type jacobi_cd(T k, U theta); + + template <class T, class U, class Policy> + typename tools::promote_args<T, U>::type jacobi_dc(T k, U theta, const Policy& pol); + + template <class T, class U> + typename tools::promote_args<T, U>::type jacobi_dc(T k, U theta); + + template <class T, class U, class Policy> + typename tools::promote_args<T, U>::type jacobi_ns(T k, U theta, const Policy& pol); + + template <class T, class U> + typename tools::promote_args<T, U>::type jacobi_ns(T k, U theta); + + template <class T, class U, class Policy> + typename tools::promote_args<T, U>::type jacobi_sd(T k, U theta, const Policy& pol); + + template <class T, class U> + typename tools::promote_args<T, U>::type jacobi_sd(T k, U theta); + + template <class T, class U, class Policy> + typename tools::promote_args<T, U>::type jacobi_ds(T k, U theta, const Policy& pol); + + template <class T, class U> + typename tools::promote_args<T, U>::type jacobi_ds(T k, U theta); + + template <class T, class U, class Policy> + typename tools::promote_args<T, U>::type jacobi_nc(T k, U theta, const Policy& pol); + + template <class T, class U> + typename tools::promote_args<T, U>::type jacobi_nc(T k, U theta); + + template <class T, class U, class Policy> + typename tools::promote_args<T, U>::type jacobi_nd(T k, U theta, const Policy& pol); + + template <class T, class U> + typename tools::promote_args<T, U>::type jacobi_nd(T k, U theta); + + template <class T, class U, class Policy> + typename tools::promote_args<T, U>::type jacobi_sc(T k, U theta, const Policy& pol); + + template <class T, class U> + typename tools::promote_args<T, U>::type jacobi_sc(T k, U theta); + + template <class T, class U, class Policy> + typename tools::promote_args<T, U>::type jacobi_cs(T k, U theta, const Policy& pol); + + template <class T, class U> + typename tools::promote_args<T, U>::type jacobi_cs(T k, U theta); + + + template <class T> + typename tools::promote_args<T>::type zeta(T s); + + // pow: + template <int N, typename T, class Policy> + typename tools::promote_args<T>::type pow(T base, const Policy& policy); + + template <int N, typename T> + typename tools::promote_args<T>::type pow(T base); + + // next: + template <class T, class Policy> + T nextafter(const T&, const T&, const Policy&); + template <class T> + T nextafter(const T&, const T&); + template <class T, class Policy> + T float_next(const T&, const Policy&); + template <class T> + T float_next(const T&); + template <class T, class Policy> + T float_prior(const T&, const Policy&); + template <class T> + T float_prior(const T&); + template <class T, class Policy> + T float_distance(const T&, const T&, const Policy&); + template <class T> + T float_distance(const T&, const T&); + + } // namespace math +} // namespace boost + +#ifdef BOOST_HAS_LONG_LONG +#define BOOST_MATH_DETAIL_LL_FUNC(Policy)\ + \ + template <class T>\ + inline T modf(const T& v, boost::long_long_type* ipart){ using boost::math::modf; return modf(v, ipart, Policy()); }\ + \ + template <class T>\ + inline boost::long_long_type lltrunc(const T& v){ using boost::math::lltrunc; return lltrunc(v, Policy()); }\ + \ + template <class T>\ + inline boost::long_long_type llround(const T& v){ using boost::math::llround; return llround(v, Policy()); }\ + +#else +#define BOOST_MATH_DETAIL_LL_FUNC(Policy) +#endif + +#define BOOST_MATH_DECLARE_SPECIAL_FUNCTIONS(Policy)\ + \ + BOOST_MATH_DETAIL_LL_FUNC(Policy)\ + \ + template <class RT1, class RT2>\ + inline typename boost::math::tools::promote_args<RT1, RT2>::type \ + beta(RT1 a, RT2 b) { return ::boost::math::beta(a, b, Policy()); }\ +\ + template <class RT1, class RT2, class A>\ + inline typename boost::math::tools::promote_args<RT1, RT2, A>::type \ + beta(RT1 a, RT2 b, A x){ return ::boost::math::beta(a, b, x, Policy()); }\ +\ + template <class RT1, class RT2, class RT3>\ + inline typename boost::math::tools::promote_args<RT1, RT2, RT3>::type \ + betac(RT1 a, RT2 b, RT3 x) { return ::boost::math::betac(a, b, x, Policy()); }\ +\ + template <class RT1, class RT2, class RT3>\ + inline typename boost::math::tools::promote_args<RT1, RT2, RT3>::type \ + ibeta(RT1 a, RT2 b, RT3 x){ return ::boost::math::ibeta(a, b, x, Policy()); }\ +\ + template <class RT1, class RT2, class RT3>\ + inline typename boost::math::tools::promote_args<RT1, RT2, RT3>::type \ + ibetac(RT1 a, RT2 b, RT3 x){ return ::boost::math::ibetac(a, b, x, Policy()); }\ +\ + template <class T1, class T2, class T3, class T4>\ + inline typename boost::math::tools::promote_args<T1, T2, T3, T4>::type \ + ibeta_inv(T1 a, T2 b, T3 p, T4* py){ return ::boost::math::ibeta_inv(a, b, p, py, Policy()); }\ +\ + template <class RT1, class RT2, class RT3>\ + inline typename boost::math::tools::promote_args<RT1, RT2, RT3>::type \ + ibeta_inv(RT1 a, RT2 b, RT3 p){ return ::boost::math::ibeta_inv(a, b, p, Policy()); }\ +\ + template <class T1, class T2, class T3, class T4>\ + inline typename boost::math::tools::promote_args<T1, T2, T3, T4>::type \ + ibetac_inv(T1 a, T2 b, T3 q, T4* py){ return ::boost::math::ibetac_inv(a, b, q, py, Policy()); }\ +\ + template <class RT1, class RT2, class RT3>\ + inline typename boost::math::tools::promote_args<RT1, RT2, RT3>::type \ + ibeta_inva(RT1 a, RT2 b, RT3 p){ return ::boost::math::ibeta_inva(a, b, p, Policy()); }\ +\ + template <class T1, class T2, class T3>\ + inline typename boost::math::tools::promote_args<T1, T2, T3>::type \ + ibetac_inva(T1 a, T2 b, T3 q){ return ::boost::math::ibetac_inva(a, b, q, Policy()); }\ +\ + template <class RT1, class RT2, class RT3>\ + inline typename boost::math::tools::promote_args<RT1, RT2, RT3>::type \ + ibeta_invb(RT1 a, RT2 b, RT3 p){ return ::boost::math::ibeta_invb(a, b, p, Policy()); }\ +\ + template <class T1, class T2, class T3>\ + inline typename boost::math::tools::promote_args<T1, T2, T3>::type \ + ibetac_invb(T1 a, T2 b, T3 q){ return ::boost::math::ibetac_invb(a, b, q, Policy()); }\ +\ + template <class RT1, class RT2, class RT3>\ + inline typename boost::math::tools::promote_args<RT1, RT2, RT3>::type \ + ibetac_inv(RT1 a, RT2 b, RT3 q){ return ::boost::math::ibetac_inv(a, b, q, Policy()); }\ +\ + template <class RT1, class RT2, class RT3>\ + inline typename boost::math::tools::promote_args<RT1, RT2, RT3>::type \ + ibeta_derivative(RT1 a, RT2 b, RT3 x){ return ::boost::math::ibeta_derivative(a, b, x, Policy()); }\ +\ + template <class RT>\ + inline typename boost::math::tools::promote_args<RT>::type erf(RT z) { return ::boost::math::erf(z, Policy()); }\ +\ + template <class RT>\ + inline typename boost::math::tools::promote_args<RT>::type erfc(RT z){ return ::boost::math::erfc(z, Policy()); }\ +\ + template <class RT>\ + inline typename boost::math::tools::promote_args<RT>::type erf_inv(RT z) { return ::boost::math::erf_inv(z, Policy()); }\ +\ + template <class RT>\ + inline typename boost::math::tools::promote_args<RT>::type erfc_inv(RT z){ return ::boost::math::erfc_inv(z, Policy()); }\ +\ + using boost::math::legendre_next;\ +\ + template <class T>\ + inline typename boost::math::tools::promote_args<T>::type \ + legendre_p(int l, T x){ return ::boost::math::legendre_p(l, x, Policy()); }\ +\ + template <class T>\ + inline typename boost::math::tools::promote_args<T>::type \ + legendre_q(unsigned l, T x){ return ::boost::math::legendre_q(l, x, Policy()); }\ +\ + using ::boost::math::legendre_next;\ +\ + template <class T>\ + inline typename boost::math::tools::promote_args<T>::type \ + legendre_p(int l, int m, T x){ return ::boost::math::legendre_p(l, m, x, Policy()); }\ +\ + using ::boost::math::laguerre_next;\ +\ + template <class T>\ + inline typename boost::math::tools::promote_args<T>::type \ + laguerre(unsigned n, T x){ return ::boost::math::laguerre(n, x, Policy()); }\ +\ + template <class T1, class T2>\ + inline typename boost::math::laguerre_result<T1, T2>::type \ + laguerre(unsigned n, T1 m, T2 x) { return ::boost::math::laguerre(n, m, x, Policy()); }\ +\ + template <class T>\ + inline typename boost::math::tools::promote_args<T>::type \ + hermite(unsigned n, T x){ return ::boost::math::hermite(n, x, Policy()); }\ +\ + using boost::math::hermite_next;\ +\ + template <class T1, class T2>\ + inline std::complex<typename boost::math::tools::promote_args<T1, T2>::type> \ + spherical_harmonic(unsigned n, int m, T1 theta, T2 phi){ return boost::math::spherical_harmonic(n, m, theta, phi, Policy()); }\ +\ + template <class T1, class T2>\ + inline typename boost::math::tools::promote_args<T1, T2>::type \ + spherical_harmonic_r(unsigned n, int m, T1 theta, T2 phi){ return ::boost::math::spherical_harmonic_r(n, m, theta, phi, Policy()); }\ +\ + template <class T1, class T2>\ + inline typename boost::math::tools::promote_args<T1, T2>::type \ + spherical_harmonic_i(unsigned n, int m, T1 theta, T2 phi){ return boost::math::spherical_harmonic_i(n, m, theta, phi, Policy()); }\ +\ + template <class T1, class T2, class Policy>\ + inline typename boost::math::tools::promote_args<T1, T2>::type \ + spherical_harmonic_i(unsigned n, int m, T1 theta, T2 phi, const Policy& pol);\ +\ + template <class T1, class T2, class T3>\ + inline typename boost::math::tools::promote_args<T1, T2, T3>::type \ + ellint_rf(T1 x, T2 y, T3 z){ return ::boost::math::ellint_rf(x, y, z, Policy()); }\ +\ + template <class T1, class T2, class T3>\ + inline typename boost::math::tools::promote_args<T1, T2, T3>::type \ + ellint_rd(T1 x, T2 y, T3 z){ return ::boost::math::ellint_rd(x, y, z, Policy()); }\ +\ + template <class T1, class T2>\ + inline typename boost::math::tools::promote_args<T1, T2>::type \ + ellint_rc(T1 x, T2 y){ return ::boost::math::ellint_rc(x, y, Policy()); }\ +\ + template <class T1, class T2, class T3, class T4>\ + inline typename boost::math::tools::promote_args<T1, T2, T3, T4>::type \ + ellint_rj(T1 x, T2 y, T3 z, T4 p){ return boost::math::ellint_rj(x, y, z, p, Policy()); }\ +\ + template <typename T>\ + inline typename boost::math::tools::promote_args<T>::type ellint_2(T k){ return boost::math::ellint_2(k, Policy()); }\ +\ + template <class T1, class T2>\ + inline typename boost::math::tools::promote_args<T1, T2>::type ellint_2(T1 k, T2 phi){ return boost::math::ellint_2(k, phi, Policy()); }\ +\ + template <typename T>\ + inline typename boost::math::tools::promote_args<T>::type ellint_1(T k){ return boost::math::ellint_1(k, Policy()); }\ +\ + template <class T1, class T2>\ + inline typename boost::math::tools::promote_args<T1, T2>::type ellint_1(T1 k, T2 phi){ return boost::math::ellint_1(k, phi, Policy()); }\ +\ + template <class T1, class T2, class T3>\ + inline typename boost::math::tools::promote_args<T1, T2, T3>::type ellint_3(T1 k, T2 v, T3 phi){ return boost::math::ellint_3(k, v, phi, Policy()); }\ +\ + template <class T1, class T2>\ + inline typename boost::math::tools::promote_args<T1, T2>::type ellint_3(T1 k, T2 v){ return boost::math::ellint_3(k, v, Policy()); }\ +\ + using boost::math::max_factorial;\ + template <class RT>\ + inline RT factorial(unsigned int i) { return boost::math::factorial<RT>(i, Policy()); }\ + using boost::math::unchecked_factorial;\ + template <class RT>\ + inline RT double_factorial(unsigned i){ return boost::math::double_factorial<RT>(i, Policy()); }\ + template <class RT>\ + inline typename boost::math::tools::promote_args<RT>::type falling_factorial(RT x, unsigned n){ return boost::math::falling_factorial(x, n, Policy()); }\ + template <class RT>\ + inline typename boost::math::tools::promote_args<RT>::type rising_factorial(RT x, unsigned n){ return boost::math::rising_factorial(x, n, Policy()); }\ +\ + template <class RT>\ + inline typename boost::math::tools::promote_args<RT>::type tgamma(RT z){ return boost::math::tgamma(z, Policy()); }\ +\ + template <class RT>\ + inline typename boost::math::tools::promote_args<RT>::type tgamma1pm1(RT z){ return boost::math::tgamma1pm1(z, Policy()); }\ +\ + template <class RT1, class RT2>\ + inline typename boost::math::tools::promote_args<RT1, RT2>::type tgamma(RT1 a, RT2 z){ return boost::math::tgamma(a, z, Policy()); }\ +\ + template <class RT>\ + inline typename boost::math::tools::promote_args<RT>::type lgamma(RT z, int* sign){ return boost::math::lgamma(z, sign, Policy()); }\ +\ + template <class RT>\ + inline typename boost::math::tools::promote_args<RT>::type lgamma(RT x){ return boost::math::lgamma(x, Policy()); }\ +\ + template <class RT1, class RT2>\ + inline typename boost::math::tools::promote_args<RT1, RT2>::type tgamma_lower(RT1 a, RT2 z){ return boost::math::tgamma_lower(a, z, Policy()); }\ +\ + template <class RT1, class RT2>\ + inline typename boost::math::tools::promote_args<RT1, RT2>::type gamma_q(RT1 a, RT2 z){ return boost::math::gamma_q(a, z, Policy()); }\ +\ + template <class RT1, class RT2>\ + inline typename boost::math::tools::promote_args<RT1, RT2>::type gamma_p(RT1 a, RT2 z){ return boost::math::gamma_p(a, z, Policy()); }\ +\ + template <class T1, class T2>\ + inline typename boost::math::tools::promote_args<T1, T2>::type tgamma_delta_ratio(T1 z, T2 delta){ return boost::math::tgamma_delta_ratio(z, delta, Policy()); }\ +\ + template <class T1, class T2>\ + inline typename boost::math::tools::promote_args<T1, T2>::type tgamma_ratio(T1 a, T2 b) { return boost::math::tgamma_ratio(a, b, Policy()); }\ +\ + template <class T1, class T2>\ + inline typename boost::math::tools::promote_args<T1, T2>::type gamma_p_derivative(T1 a, T2 x){ return boost::math::gamma_p_derivative(a, x, Policy()); }\ +\ + template <class T1, class T2>\ + inline typename boost::math::tools::promote_args<T1, T2>::type gamma_p_inv(T1 a, T2 p){ return boost::math::gamma_p_inv(a, p, Policy()); }\ +\ + template <class T1, class T2>\ + inline typename boost::math::tools::promote_args<T1, T2>::type gamma_p_inva(T1 a, T2 p){ return boost::math::gamma_p_inva(a, p, Policy()); }\ +\ + template <class T1, class T2>\ + inline typename boost::math::tools::promote_args<T1, T2>::type gamma_q_inv(T1 a, T2 q){ return boost::math::gamma_q_inv(a, q, Policy()); }\ +\ + template <class T1, class T2>\ + inline typename boost::math::tools::promote_args<T1, T2>::type gamma_q_inva(T1 a, T2 q){ return boost::math::gamma_q_inva(a, q, Policy()); }\ +\ + template <class T>\ + inline typename boost::math::tools::promote_args<T>::type digamma(T x){ return boost::math::digamma(x, Policy()); }\ +\ + template <class T1, class T2>\ + inline typename boost::math::tools::promote_args<T1, T2>::type \ + hypot(T1 x, T2 y){ return boost::math::hypot(x, y, Policy()); }\ +\ + template <class RT>\ + inline typename boost::math::tools::promote_args<RT>::type cbrt(RT z){ return boost::math::cbrt(z, Policy()); }\ +\ + template <class T>\ + inline typename boost::math::tools::promote_args<T>::type log1p(T x){ return boost::math::log1p(x, Policy()); }\ +\ + template <class T>\ + inline typename boost::math::tools::promote_args<T>::type log1pmx(T x){ return boost::math::log1pmx(x, Policy()); }\ +\ + template <class T>\ + inline typename boost::math::tools::promote_args<T>::type expm1(T x){ return boost::math::expm1(x, Policy()); }\ +\ + template <class T1, class T2>\ + inline typename boost::math::tools::promote_args<T1, T2>::type \ + powm1(const T1 a, const T2 z){ return boost::math::powm1(a, z, Policy()); }\ +\ + template <class T>\ + inline typename boost::math::tools::promote_args<T>::type sqrt1pm1(const T& val){ return boost::math::sqrt1pm1(val, Policy()); }\ +\ + template <class T>\ + inline typename boost::math::tools::promote_args<T>::type sinc_pi(T x){ return boost::math::sinc_pi(x, Policy()); }\ +\ + template <class T>\ + inline typename boost::math::tools::promote_args<T>::type sinhc_pi(T x){ return boost::math::sinhc_pi(x, Policy()); }\ +\ + template<typename T>\ + inline typename boost::math::tools::promote_args<T>::type asinh(const T x){ return boost::math::asinh(x, Policy()); }\ +\ + template<typename T>\ + inline typename boost::math::tools::promote_args<T>::type acosh(const T x){ return boost::math::acosh(x, Policy()); }\ +\ + template<typename T>\ + inline typename boost::math::tools::promote_args<T>::type atanh(const T x){ return boost::math::atanh(x, Policy()); }\ +\ + template <class T1, class T2>\ + inline typename boost::math::detail::bessel_traits<T1, T2, Policy >::result_type cyl_bessel_j(T1 v, T2 x)\ + { return boost::math::cyl_bessel_j(v, x, Policy()); }\ +\ + template <class T>\ + inline typename boost::math::detail::bessel_traits<T, T, Policy >::result_type sph_bessel(unsigned v, T x)\ + { return boost::math::sph_bessel(v, x, Policy()); }\ +\ + template <class T1, class T2>\ + inline typename boost::math::detail::bessel_traits<T1, T2, Policy >::result_type \ + cyl_bessel_i(T1 v, T2 x) { return boost::math::cyl_bessel_i(v, x, Policy()); }\ +\ + template <class T1, class T2>\ + inline typename boost::math::detail::bessel_traits<T1, T2, Policy >::result_type \ + cyl_bessel_k(T1 v, T2 x) { return boost::math::cyl_bessel_k(v, x, Policy()); }\ +\ + template <class T1, class T2>\ + inline typename boost::math::detail::bessel_traits<T1, T2, Policy >::result_type \ + cyl_neumann(T1 v, T2 x){ return boost::math::cyl_neumann(v, x, Policy()); }\ +\ + template <class T>\ + inline typename boost::math::detail::bessel_traits<T, T, Policy >::result_type \ + sph_neumann(unsigned v, T x){ return boost::math::sph_neumann(v, x, Policy()); }\ +\ + template <class T>\ + inline typename boost::math::tools::promote_args<T>::type sin_pi(T x){ return boost::math::sin_pi(x); }\ +\ + template <class T>\ + inline typename boost::math::tools::promote_args<T>::type cos_pi(T x){ return boost::math::cos_pi(x); }\ +\ + using boost::math::fpclassify;\ + using boost::math::isfinite;\ + using boost::math::isinf;\ + using boost::math::isnan;\ + using boost::math::isnormal;\ + using boost::math::signbit;\ + using boost::math::sign;\ + using boost::math::copysign;\ + using boost::math::changesign;\ + \ + template <class T, class U>\ + inline typename boost::math::tools::promote_args<T,U>::type expint(T const& z, U const& u)\ + { return boost::math::expint(z, u, Policy()); }\ + \ + template <class T>\ + inline typename boost::math::tools::promote_args<T>::type expint(T z){ return boost::math::expint(z, Policy()); }\ + \ + template <class T>\ + inline typename boost::math::tools::promote_args<T>::type zeta(T s){ return boost::math::zeta(s, Policy()); }\ + \ + template <class T>\ + inline T round(const T& v){ using boost::math::round; return round(v, Policy()); }\ + \ + template <class T>\ + inline int iround(const T& v){ using boost::math::iround; return iround(v, Policy()); }\ + \ + template <class T>\ + inline long lround(const T& v){ using boost::math::lround; return lround(v, Policy()); }\ + \ + template <class T>\ + inline T trunc(const T& v){ using boost::math::trunc; return trunc(v, Policy()); }\ + \ + template <class T>\ + inline int itrunc(const T& v){ using boost::math::itrunc; return itrunc(v, Policy()); }\ + \ + template <class T>\ + inline long ltrunc(const T& v){ using boost::math::ltrunc; return ltrunc(v, Policy()); }\ + \ + template <class T>\ + inline T modf(const T& v, T* ipart){ using boost::math::modf; return modf(v, ipart, Policy()); }\ + \ + template <class T>\ + inline T modf(const T& v, int* ipart){ using boost::math::modf; return modf(v, ipart, Policy()); }\ + \ + template <class T>\ + inline T modf(const T& v, long* ipart){ using boost::math::modf; return modf(v, ipart, Policy()); }\ + \ + template <int N, class T>\ + inline typename boost::math::tools::promote_args<T>::type pow(T v){ return boost::math::pow<N>(v, Policy()); }\ + \ + template <class T> T nextafter(const T& a, const T& b){ return boost::math::nextafter(a, b, Policy()); }\ + template <class T> T float_next(const T& a){ return boost::math::float_next(a, Policy()); }\ + template <class T> T float_prior(const T& a){ return boost::math::float_prior(a, Policy()); }\ + template <class T> T float_distance(const T& a, const T& b){ return boost::math::float_distance(a, b, Policy()); }\ + \ + template <class RT1, class RT2>\ + inline typename boost::math::tools::promote_args<RT1, RT2>::type owens_t(RT1 a, RT2 z){ return boost::math::owens_t(a, z, Policy()); }\ + \ + template <class T1, class T2>\ + inline std::complex<typename boost::math::detail::bessel_traits<T1, T2, Policy >::result_type> cyl_hankel_1(T1 v, T2 x)\ + { return boost::math::cyl_hankel_1(v, x, Policy()); }\ + \ + template <class T1, class T2>\ + inline std::complex<typename boost::math::detail::bessel_traits<T1, T2, Policy >::result_type> cyl_hankel_2(T1 v, T2 x)\ + { return boost::math::cyl_hankel_2(v, x, Policy()); }\ + \ + template <class T1, class T2>\ + inline std::complex<typename boost::math::detail::bessel_traits<T1, T2, Policy >::result_type> sph_hankel_1(T1 v, T2 x)\ + { return boost::math::sph_hankel_1(v, x, Policy()); }\ + \ + template <class T1, class T2>\ + inline std::complex<typename boost::math::detail::bessel_traits<T1, T2, Policy >::result_type> sph_hankel_2(T1 v, T2 x)\ + { return boost::math::sph_hankel_2(v, x, Policy()); }\ + \ + template <class T>\ + inline typename boost::math::tools::promote_args<T>::type jacobi_elliptic(T k, T theta, T* pcn, T* pdn)\ + { return boost::math::jacobi_elliptic(k, theta, pcn, pdn, Policy()); }\ + \ + template <class U, class T>\ + inline typename boost::math::tools::promote_args<T, U>::type jacobi_sn(U k, T theta)\ + { return boost::math::jacobi_sn(k, theta, Policy()); }\ + \ + template <class T, class U>\ + inline typename boost::math::tools::promote_args<T, U>::type jacobi_cn(T k, U theta)\ + { return boost::math::jacobi_cn(k, theta, Policy()); }\ + \ + template <class T, class U>\ + inline typename boost::math::tools::promote_args<T, U>::type jacobi_dn(T k, U theta)\ + { return boost::math::jacobi_dn(k, theta, Policy()); }\ + \ + template <class T, class U>\ + inline typename boost::math::tools::promote_args<T, U>::type jacobi_cd(T k, U theta)\ + { return boost::math::jacobi_cd(k, theta, Policy()); }\ + \ + template <class T, class U>\ + inline typename boost::math::tools::promote_args<T, U>::type jacobi_dc(T k, U theta)\ + { return boost::math::jacobi_dc(k, theta, Policy()); }\ + \ + template <class T, class U>\ + inline typename boost::math::tools::promote_args<T, U>::type jacobi_ns(T k, U theta)\ + { return boost::math::jacobi_ns(k, theta, Policy()); }\ + \ + template <class T, class U>\ + inline typename boost::math::tools::promote_args<T, U>::type jacobi_sd(T k, U theta)\ + { return boost::math::jacobi_sd(k, theta, Policy()); }\ + \ + template <class T, class U>\ + inline typename boost::math::tools::promote_args<T, U>::type jacobi_ds(T k, U theta)\ + { return boost::math::jacobi_ds(k, theta, Policy()); }\ + \ + template <class T, class U>\ + inline typename boost::math::tools::promote_args<T, U>::type jacobi_nc(T k, U theta)\ + { return boost::math::jacobi_nc(k, theta, Policy()); }\ + \ + template <class T, class U>\ + inline typename boost::math::tools::promote_args<T, U>::type jacobi_nd(T k, U theta)\ + { return boost::math::jacobi_nd(k, theta, Policy()); }\ + \ + template <class T, class U>\ + inline typename boost::math::tools::promote_args<T, U>::type jacobi_sc(T k, U theta)\ + { return boost::math::jacobi_sc(k, theta, Policy()); }\ + \ + template <class T, class U>\ + inline typename boost::math::tools::promote_args<T, U>::type jacobi_cs(T k, U theta)\ + { return boost::math::jacobi_cs(k, theta, Policy()); }\ + \ + template <class T>\ + inline typename boost::math::tools::promote_args<T>::type airy_ai(T x)\ + { return boost::math::airy_ai(x, Policy()); }\ + \ + template <class T>\ + inline typename boost::math::tools::promote_args<T>::type airy_bi(T x)\ + { return boost::math::airy_bi(x, Policy()); }\ + \ + template <class T>\ + inline typename boost::math::tools::promote_args<T>::type airy_ai_prime(T x)\ + { return boost::math::airy_ai_prime(x, Policy()); }\ + \ + template <class T>\ + inline typename boost::math::tools::promote_args<T>::type airy_bi_prime(T x)\ + { return boost::math::airy_bi_prime(x, Policy()); }\ + \ + + + + + +#endif // BOOST_MATH_SPECIAL_MATH_FWD_HPP + + diff --git a/3rdParty/Boost/src/boost/math/special_functions/sign.hpp b/3rdParty/Boost/src/boost/math/special_functions/sign.hpp new file mode 100644 index 0000000..6de88b2 --- /dev/null +++ b/3rdParty/Boost/src/boost/math/special_functions/sign.hpp @@ -0,0 +1,145 @@ +// (C) Copyright John Maddock 2006. +// (C) Copyright Johan Rade 2006. +// (C) Copyright Paul A. Bristow 2011 (added changesign). + +// 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) + +#ifndef BOOST_MATH_TOOLS_SIGN_HPP +#define BOOST_MATH_TOOLS_SIGN_HPP + +#ifdef _MSC_VER +#pragma once +#endif + +#include <boost/math/tools/config.hpp> +#include <boost/math/special_functions/math_fwd.hpp> +#include <boost/math/special_functions/detail/fp_traits.hpp> + +namespace boost{ namespace math{ + +namespace detail { + + // signbit + +#ifdef BOOST_MATH_USE_STD_FPCLASSIFY + template<class T> + inline int signbit_impl(T x, native_tag const&) + { + return (std::signbit)(x); + } +#endif + + template<class T> + inline int signbit_impl(T x, generic_tag<true> const&) + { + return x < 0; + } + + template<class T> + inline int signbit_impl(T x, generic_tag<false> const&) + { + return x < 0; + } + + template<class T> + inline int signbit_impl(T x, ieee_copy_all_bits_tag const&) + { + typedef BOOST_DEDUCED_TYPENAME fp_traits<T>::type traits; + + BOOST_DEDUCED_TYPENAME traits::bits a; + traits::get_bits(x,a); + return a & traits::sign ? 1 : 0; + } + + template<class T> + inline int signbit_impl(T x, ieee_copy_leading_bits_tag const&) + { + typedef BOOST_DEDUCED_TYPENAME fp_traits<T>::type traits; + + BOOST_DEDUCED_TYPENAME traits::bits a; + traits::get_bits(x,a); + + return a & traits::sign ? 1 : 0; + } + + // Changesign + + template<class T> + inline T (changesign_impl)(T x, generic_tag<true> const&) + { + return -x; + } + + template<class T> + inline T (changesign_impl)(T x, generic_tag<false> const&) + { + return -x; + } + + + template<class T> + inline T changesign_impl(T x, ieee_copy_all_bits_tag const&) + { + typedef BOOST_DEDUCED_TYPENAME fp_traits<T>::sign_change_type traits; + + BOOST_DEDUCED_TYPENAME traits::bits a; + traits::get_bits(x,a); + a ^= traits::sign; + traits::set_bits(x,a); + return x; + } + + template<class T> + inline T (changesign_impl)(T x, ieee_copy_leading_bits_tag const&) + { + typedef BOOST_DEDUCED_TYPENAME fp_traits<T>::sign_change_type traits; + + BOOST_DEDUCED_TYPENAME traits::bits a; + traits::get_bits(x,a); + a ^= traits::sign; + traits::set_bits(x,a); + return x; + } + + +} // namespace detail + +template<class T> int (signbit)(T x) +{ + typedef typename detail::fp_traits<T>::type traits; + typedef typename traits::method method; + typedef typename boost::is_floating_point<T>::type fp_tag; + return detail::signbit_impl(x, method()); +} + +template <class T> +inline int sign BOOST_NO_MACRO_EXPAND(const T& z) +{ + return (z == 0) ? 0 : (boost::math::signbit)(z) ? -1 : 1; +} + +template<class T> T (changesign)(const T& x) +{ //!< \brief return unchanged binary pattern of x, except for change of sign bit. + typedef typename detail::fp_traits<T>::sign_change_type traits; + typedef typename traits::method method; + typedef typename boost::is_floating_point<T>::type fp_tag; + + return detail::changesign_impl(x, method()); +} + +template <class T> +inline T copysign BOOST_NO_MACRO_EXPAND(const T& x, const T& y) +{ + BOOST_MATH_STD_USING + return (boost::math::signbit)(x) != (boost::math::signbit)(y) ? (boost::math::changesign)(x) : x; +} + +} // namespace math +} // namespace boost + + +#endif // BOOST_MATH_TOOLS_SIGN_HPP + + diff --git a/3rdParty/Boost/src/boost/math/tools/config.hpp b/3rdParty/Boost/src/boost/math/tools/config.hpp new file mode 100644 index 0000000..b1fcd13 --- /dev/null +++ b/3rdParty/Boost/src/boost/math/tools/config.hpp @@ -0,0 +1,330 @@ +// Copyright (c) 2006-7 John Maddock +// 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) + +#ifndef BOOST_MATH_TOOLS_CONFIG_HPP +#define BOOST_MATH_TOOLS_CONFIG_HPP + +#ifdef _MSC_VER +#pragma once +#endif + +#include <boost/config.hpp> +#include <boost/cstdint.hpp> // for boost::uintmax_t +#include <boost/detail/workaround.hpp> +#include <algorithm> // for min and max +#include <boost/config/no_tr1/cmath.hpp> +#include <climits> +#include <cfloat> +#if (defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)) +# include <math.h> +#endif + +#include <boost/math/tools/user.hpp> +#include <boost/math/special_functions/detail/round_fwd.hpp> + +#if (defined(__CYGWIN__) || defined(__FreeBSD__) || defined(__NetBSD__) \ + || (defined(__hppa) && !defined(__OpenBSD__)) || (defined(__NO_LONG_DOUBLE_MATH) && (DBL_MANT_DIG != LDBL_MANT_DIG))) \ + && !defined(BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS) +# define BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS +#endif +#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x582)) +// +// Borland post 5.8.2 uses Dinkumware's std C lib which +// doesn't have true long double precision. Earlier +// versions are problematic too: +// +# define BOOST_MATH_NO_REAL_CONCEPT_TESTS +# define BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS +# define BOOST_MATH_CONTROL_FP _control87(MCW_EM,MCW_EM) +# include <float.h> +#endif +#ifdef __IBMCPP__ +// +// For reasons I don't unserstand, the tests with IMB's compiler all +// pass at long double precision, but fail with real_concept, those tests +// are disabled for now. (JM 2012). +# define BOOST_MATH_NO_REAL_CONCEPT_TESTS +#endif +#if (defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)) && ((LDBL_MANT_DIG == 106) || (__LDBL_MANT_DIG__ == 106)) && !defined(BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS) +// +// Darwin's rather strange "double double" is rather hard to +// support, it should be possible given enough effort though... +// +# define BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS +#endif +#if defined(unix) && defined(__INTEL_COMPILER) && (__INTEL_COMPILER <= 1000) && !defined(BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS) +// +// Intel compiler prior to version 10 has sporadic problems +// calling the long double overloads of the std lib math functions: +// calling ::powl is OK, but std::pow(long double, long double) +// may segfault depending upon the value of the arguments passed +// and the specific Linux distribution. +// +// We'll be conservative and disable long double support for this compiler. +// +// Comment out this #define and try building the tests to determine whether +// your Intel compiler version has this issue or not. +// +# define BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS +#endif +#if defined(unix) && defined(__INTEL_COMPILER) +// +// Intel compiler has sporadic issues compiling std::fpclassify depending on +// the exact OS version used. Use our own code for this as we know it works +// well on Intel processors: +// +#define BOOST_MATH_DISABLE_STD_FPCLASSIFY +#endif + +#if defined(BOOST_MSVC) && !defined(_WIN32_WCE) + // Better safe than sorry, our tests don't support hardware exceptions: +# define BOOST_MATH_CONTROL_FP _control87(MCW_EM,MCW_EM) +#endif + +#ifdef __IBMCPP__ +# define BOOST_MATH_NO_DEDUCED_FUNCTION_POINTERS +#endif + +#if (defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901)) +# define BOOST_MATH_USE_C99 +#endif + +#if (defined(__hpux) && !defined(__hppa)) +# define BOOST_MATH_USE_C99 +#endif + +#if defined(__GNUC__) && defined(_GLIBCXX_USE_C99) +# define BOOST_MATH_USE_C99 +#endif + +#if defined(__CYGWIN__) || defined(__HP_aCC) || defined(BOOST_INTEL) \ + || defined(BOOST_NO_NATIVE_LONG_DOUBLE_FP_CLASSIFY) \ + || (defined(__GNUC__) && !defined(BOOST_MATH_USE_C99)) +# define BOOST_MATH_NO_NATIVE_LONG_DOUBLE_FP_CLASSIFY +#endif + +#if defined(BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS) || BOOST_WORKAROUND(__SUNPRO_CC, <= 0x590) + +# include "boost/type.hpp" +# include "boost/non_type.hpp" + +# define BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(t) boost::type<t>* = 0 +# define BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(t) boost::type<t>* +# define BOOST_MATH_EXPLICIT_TEMPLATE_NON_TYPE(t, v) boost::non_type<t, v>* = 0 +# define BOOST_MATH_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v) boost::non_type<t, v>* + +# define BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(t) \ + , BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(t) +# define BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(t) \ + , BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(t) +# define BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(t, v) \ + , BOOST_MATH_EXPLICIT_TEMPLATE_NON_TYPE(t, v) +# define BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v) \ + , BOOST_MATH_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v) + +#else + +// no workaround needed: expand to nothing + +# define BOOST_MATH_EXPLICIT_TEMPLATE_TYPE(t) +# define BOOST_MATH_EXPLICIT_TEMPLATE_TYPE_SPEC(t) +# define BOOST_MATH_EXPLICIT_TEMPLATE_NON_TYPE(t, v) +# define BOOST_MATH_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v) + +# define BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE(t) +# define BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_TYPE_SPEC(t) +# define BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_NON_TYPE(t, v) +# define BOOST_MATH_APPEND_EXPLICIT_TEMPLATE_NON_TYPE_SPEC(t, v) + + +#endif // defined BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS + +#if (defined(__SUNPRO_CC) || defined(__hppa) || defined(__GNUC__)) && !defined(BOOST_MATH_SMALL_CONSTANT) +// Sun's compiler emits a hard error if a constant underflows, +// as does aCC on PA-RISC, while gcc issues a large number of warnings: +# define BOOST_MATH_SMALL_CONSTANT(x) 0 +#else +# define BOOST_MATH_SMALL_CONSTANT(x) x +#endif + + +#if BOOST_WORKAROUND(BOOST_MSVC, < 1400) +// +// Define if constants too large for a float cause "bad" +// values to be stored in the data, rather than infinity +// or a suitably large value. +// +# define BOOST_MATH_BUGGY_LARGE_FLOAT_CONSTANTS +#endif +// +// Tune performance options for specific compilers: +// +#ifdef BOOST_MSVC +# define BOOST_MATH_POLY_METHOD 2 +#elif defined(BOOST_INTEL) +# define BOOST_MATH_POLY_METHOD 2 +# define BOOST_MATH_RATIONAL_METHOD 2 +#elif defined(__GNUC__) +# define BOOST_MATH_POLY_METHOD 3 +# define BOOST_MATH_RATIONAL_METHOD 3 +# define BOOST_MATH_INT_TABLE_TYPE(RT, IT) RT +# define BOOST_MATH_INT_VALUE_SUFFIX(RV, SUF) RV##.0L +#endif + +#if defined(BOOST_NO_LONG_LONG) && !defined(BOOST_MATH_INT_TABLE_TYPE) +# define BOOST_MATH_INT_TABLE_TYPE(RT, IT) RT +# define BOOST_MATH_INT_VALUE_SUFFIX(RV, SUF) RV##.0L +#endif + +// +// The maximum order of polynomial that will be evaluated +// via an unrolled specialisation: +// +#ifndef BOOST_MATH_MAX_POLY_ORDER +# define BOOST_MATH_MAX_POLY_ORDER 17 +#endif +// +// Set the method used to evaluate polynomials and rationals: +// +#ifndef BOOST_MATH_POLY_METHOD +# define BOOST_MATH_POLY_METHOD 1 +#endif +#ifndef BOOST_MATH_RATIONAL_METHOD +# define BOOST_MATH_RATIONAL_METHOD 0 +#endif +// +// decide whether to store constants as integers or reals: +// +#ifndef BOOST_MATH_INT_TABLE_TYPE +# define BOOST_MATH_INT_TABLE_TYPE(RT, IT) IT +#endif +#ifndef BOOST_MATH_INT_VALUE_SUFFIX +# define BOOST_MATH_INT_VALUE_SUFFIX(RV, SUF) RV##SUF +#endif + +// +// Helper macro for controlling the FP behaviour: +// +#ifndef BOOST_MATH_CONTROL_FP +# define BOOST_MATH_CONTROL_FP +#endif +// +// Helper macro for using statements: +// +#define BOOST_MATH_STD_USING \ + using std::abs;\ + using std::acos;\ + using std::cos;\ + using std::fmod;\ + using std::modf;\ + using std::tan;\ + using std::asin;\ + using std::cosh;\ + using std::frexp;\ + using std::pow;\ + using std::tanh;\ + using std::atan;\ + using std::exp;\ + using std::ldexp;\ + using std::sin;\ + using std::atan2;\ + using std::fabs;\ + using std::log;\ + using std::sinh;\ + using std::ceil;\ + using std::floor;\ + using std::log10;\ + using std::sqrt;\ + using boost::math::round;\ + using boost::math::iround;\ + using boost::math::lround;\ + using boost::math::trunc;\ + using boost::math::itrunc;\ + using boost::math::ltrunc;\ + using boost::math::modf; + + +namespace boost{ namespace math{ +namespace tools +{ + +template <class T> +inline T max BOOST_PREVENT_MACRO_SUBSTITUTION(T a, T b, T c) +{ + return (std::max)((std::max)(a, b), c); +} + +template <class T> +inline T max BOOST_PREVENT_MACRO_SUBSTITUTION(T a, T b, T c, T d) +{ + return (std::max)((std::max)(a, b), (std::max)(c, d)); +} + +} // namespace tools + +template <class T> +void suppress_unused_variable_warning(const T&) +{ +} + +}} // namespace boost namespace math + +#if ((defined(__linux__) && !defined(__UCLIBC__)) || defined(__QNX__) || defined(__IBMCPP__)) && !defined(BOOST_NO_FENV_H) + + #include <boost/detail/fenv.hpp> + +# ifdef FE_ALL_EXCEPT + +namespace boost{ namespace math{ + namespace detail + { + struct fpu_guard + { + fpu_guard() + { + fegetexceptflag(&m_flags, FE_ALL_EXCEPT); + feclearexcept(FE_ALL_EXCEPT); + } + ~fpu_guard() + { + fesetexceptflag(&m_flags, FE_ALL_EXCEPT); + } + private: + fexcept_t m_flags; + }; + + } // namespace detail + }} // namespaces + +# define BOOST_FPU_EXCEPTION_GUARD boost::math::detail::fpu_guard local_guard_object; +# define BOOST_MATH_INSTRUMENT_FPU do{ fexcept_t cpu_flags; fegetexceptflag(&cpu_flags, FE_ALL_EXCEPT); BOOST_MATH_INSTRUMENT_VARIABLE(cpu_flags); } while(0); + +# else + +# define BOOST_FPU_EXCEPTION_GUARD +# define BOOST_MATH_INSTRUMENT_FPU + +# endif + +#else // All other platforms. +# define BOOST_FPU_EXCEPTION_GUARD +# define BOOST_MATH_INSTRUMENT_FPU +#endif + +#ifdef BOOST_MATH_INSTRUMENT +#define BOOST_MATH_INSTRUMENT_CODE(x) \ + std::cout << std::setprecision(35) << __FILE__ << ":" << __LINE__ << " " << x << std::endl; +#define BOOST_MATH_INSTRUMENT_VARIABLE(name) BOOST_MATH_INSTRUMENT_CODE(BOOST_STRINGIZE(name) << " = " << name) +#else +#define BOOST_MATH_INSTRUMENT_CODE(x) +#define BOOST_MATH_INSTRUMENT_VARIABLE(name) +#endif + +#endif // BOOST_MATH_TOOLS_CONFIG_HPP + + + + + diff --git a/3rdParty/Boost/src/boost/math/tools/promotion.hpp b/3rdParty/Boost/src/boost/math/tools/promotion.hpp new file mode 100644 index 0000000..728aaf1 --- /dev/null +++ b/3rdParty/Boost/src/boost/math/tools/promotion.hpp @@ -0,0 +1,150 @@ +// boost\math\tools\promotion.hpp + +// Copyright John Maddock 2006. +// Copyright Paul A. Bristow 2006. + +// 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) + +// Promote arguments functions to allow math functions to have arguments +// provided as integer OR real (floating-point, built-in or UDT) +// (called ArithmeticType in functions that use promotion) +// that help to reduce the risk of creating multiple instantiations. +// Allows creation of an inline wrapper that forwards to a foo(RT, RT) function, +// so you never get to instantiate any mixed foo(RT, IT) functions. + +#ifndef BOOST_MATH_PROMOTION_HPP +#define BOOST_MATH_PROMOTION_HPP + +#ifdef _MSC_VER +#pragma once +#endif + +// Boost type traits: +#include <boost/math/tools/config.hpp> +#include <boost/type_traits/is_floating_point.hpp> // for boost::is_floating_point; +#include <boost/type_traits/is_integral.hpp> // for boost::is_integral +#include <boost/type_traits/is_convertible.hpp> // for boost::is_convertible +#include <boost/type_traits/is_same.hpp>// for boost::is_same +#include <boost/type_traits/remove_cv.hpp>// for boost::remove_cv +// Boost Template meta programming: +#include <boost/mpl/if.hpp> // for boost::mpl::if_c. +#include <boost/mpl/and.hpp> // for boost::mpl::if_c. +#include <boost/mpl/or.hpp> // for boost::mpl::if_c. +#include <boost/mpl/not.hpp> // for boost::mpl::if_c. + +#ifdef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS +#include <boost/static_assert.hpp> +#endif + +namespace boost +{ + namespace math + { + namespace tools + { + // If either T1 or T2 is an integer type, + // pretend it was a double (for the purposes of further analysis). + // Then pick the wider of the two floating-point types + // as the actual signature to forward to. + // For example: + // foo(int, short) -> double foo(double, double); + // foo(int, float) -> double foo(double, double); + // Note: NOT float foo(float, float) + // foo(int, double) -> foo(double, double); + // foo(double, float) -> double foo(double, double); + // foo(double, float) -> double foo(double, double); + // foo(any-int-or-float-type, long double) -> foo(long double, long double); + // but ONLY float foo(float, float) is unchanged. + // So the only way to get an entirely float version is to call foo(1.F, 2.F), + // But since most (all?) the math functions convert to double internally, + // probably there would not be the hoped-for gain by using float here. + + // This follows the C-compatible conversion rules of pow, etc + // where pow(int, float) is converted to pow(double, double). + + template <class T> + struct promote_arg + { // If T is integral type, then promote to double. + typedef typename mpl::if_<is_integral<T>, double, T>::type type; + }; + // These full specialisations reduce mpl::if_ usage and speed up + // compilation: + template <> struct promote_arg<float> { typedef float type; }; + template <> struct promote_arg<double>{ typedef double type; }; + template <> struct promote_arg<long double> { typedef long double type; }; + template <> struct promote_arg<int> { typedef double type; }; + + template <class T1, class T2> + struct promote_args_2 + { // Promote, if necessary, & pick the wider of the two floating-point types. + // for both parameter types, if integral promote to double. + typedef typename promote_arg<T1>::type T1P; // T1 perhaps promoted. + typedef typename promote_arg<T2>::type T2P; // T2 perhaps promoted. + + typedef typename mpl::if_< + typename mpl::and_<is_floating_point<T1P>, is_floating_point<T2P> >::type, // both T1P and T2P are floating-point? + typename mpl::if_< typename mpl::or_<is_same<long double, T1P>, is_same<long double, T2P> >::type, // either long double? + long double, // then result type is long double. + typename mpl::if_< typename mpl::or_<is_same<double, T1P>, is_same<double, T2P> >::type, // either double? + double, // result type is double. + float // else result type is float. + >::type + >::type, + // else one or the other is a user-defined type: + typename mpl::if_< typename mpl::and_<mpl::not_<is_floating_point<T2P> >, ::boost::is_convertible<T1P, T2P> >, T2P, T1P>::type>::type type; + }; // promote_arg2 + // These full specialisations reduce mpl::if_ usage and speed up + // compilation: + template <> struct promote_args_2<float, float> { typedef float type; }; + template <> struct promote_args_2<double, double>{ typedef double type; }; + template <> struct promote_args_2<long double, long double> { typedef long double type; }; + template <> struct promote_args_2<int, int> { typedef double type; }; + template <> struct promote_args_2<int, float> { typedef double type; }; + template <> struct promote_args_2<float, int> { typedef double type; }; + template <> struct promote_args_2<int, double> { typedef double type; }; + template <> struct promote_args_2<double, int> { typedef double type; }; + template <> struct promote_args_2<int, long double> { typedef long double type; }; + template <> struct promote_args_2<long double, int> { typedef long double type; }; + template <> struct promote_args_2<float, double> { typedef double type; }; + template <> struct promote_args_2<double, float> { typedef double type; }; + template <> struct promote_args_2<float, long double> { typedef long double type; }; + template <> struct promote_args_2<long double, float> { typedef long double type; }; + template <> struct promote_args_2<double, long double> { typedef long double type; }; + template <> struct promote_args_2<long double, double> { typedef long double type; }; + + template <class T1, class T2=float, class T3=float, class T4=float, class T5=float, class T6=float> + struct promote_args + { + typedef typename promote_args_2< + typename remove_cv<T1>::type, + typename promote_args_2< + typename remove_cv<T2>::type, + typename promote_args_2< + typename remove_cv<T3>::type, + typename promote_args_2< + typename remove_cv<T4>::type, + typename promote_args_2< + typename remove_cv<T5>::type, typename remove_cv<T6>::type + >::type + >::type + >::type + >::type + >::type type; + +#ifdef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS + // + // Guard against use of long double if it's not supported: + // + BOOST_STATIC_ASSERT((0 == ::boost::is_same<type, long double>::value)); +#endif + }; + + } // namespace tools + } // namespace math +} // namespace boost + +#endif // BOOST_MATH_PROMOTION_HPP + diff --git a/3rdParty/Boost/src/boost/math/tools/real_cast.hpp b/3rdParty/Boost/src/boost/math/tools/real_cast.hpp new file mode 100644 index 0000000..9b854e3 --- /dev/null +++ b/3rdParty/Boost/src/boost/math/tools/real_cast.hpp @@ -0,0 +1,29 @@ +// Copyright John Maddock 2006. +// 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) + +#ifndef BOOST_MATH_TOOLS_REAL_CAST_HPP +#define BOOST_MATH_TOOLS_REAL_CAST_HPP + +#ifdef _MSC_VER +#pragma once +#endif + +namespace boost{ namespace math +{ + namespace tools + { + template <class To, class T> + inline To real_cast(T t) + { + return static_cast<To>(t); + } + } // namespace tools +} // namespace math +} // namespace boost + +#endif // BOOST_MATH_TOOLS_REAL_CAST_HPP + + + diff --git a/3rdParty/Boost/src/boost/math/tools/user.hpp b/3rdParty/Boost/src/boost/math/tools/user.hpp new file mode 100644 index 0000000..c1bdaf7 --- /dev/null +++ b/3rdParty/Boost/src/boost/math/tools/user.hpp @@ -0,0 +1,97 @@ +// Copyright John Maddock 2007. +// Copyright Paul A. Bristow 2007. + +// 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) + +#ifndef BOOST_MATH_TOOLS_USER_HPP +#define BOOST_MATH_TOOLS_USER_HPP + +#ifdef _MSC_VER +#pragma once +#endif + +// This file can be modified by the user to change the default policies. +// See "Changing the Policy Defaults" in documentation. + +// define this if the platform has no long double functions, +// or if the long double versions have only double precision: +// +// #define BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS +// +// Performance tuning options: +// +// #define BOOST_MATH_POLY_METHOD 3 +// #define BOOST_MATH_RATIONAL_METHOD 3 +// +// The maximum order of polynomial that will be evaluated +// via an unrolled specialisation: +// +// #define BOOST_MATH_MAX_POLY_ORDER 17 +// +// decide whether to store constants as integers or reals: +// +// #define BOOST_MATH_INT_TABLE_TYPE(RT, IT) IT + +// +// Default policies follow: +// +// Domain errors: +// +// #define BOOST_MATH_DOMAIN_ERROR_POLICY throw_on_error +// +// Pole errors: +// +// #define BOOST_MATH_POLE_ERROR_POLICY throw_on_error +// +// Overflow Errors: +// +// #define BOOST_MATH_OVERFLOW_ERROR_POLICY throw_on_error +// +// Internal Evaluation Errors: +// +// #define BOOST_MATH_EVALUATION_ERROR_POLICY throw_on_error +// +// Underfow: +// +// #define BOOST_MATH_UNDERFLOW_ERROR_POLICY ignore_error +// +// Denorms: +// +// #define BOOST_MATH_DENORM_ERROR_POLICY ignore_error +// +// Max digits to use for internal calculations: +// +// #define BOOST_MATH_DIGITS10_POLICY 0 +// +// Promote floats to doubles internally? +// +// #define BOOST_MATH_PROMOTE_FLOAT_POLICY true +// +// Promote doubles to long double internally: +// +// #define BOOST_MATH_PROMOTE_DOUBLE_POLICY true +// +// What do discrete quantiles return? +// +// #define BOOST_MATH_DISCRETE_QUANTILE_POLICY integer_round_outwards +// +// If a function is mathematically undefined +// (for example the Cauchy distribution has no mean), +// then do we stop the code from compiling? +// +// #define BOOST_MATH_ASSERT_UNDEFINED_POLICY true +// +// Maximum series iterstions permitted: +// +// #define BOOST_MATH_MAX_SERIES_ITERATION_POLICY 1000000 +// +// Maximum root finding steps permitted: +// +// define BOOST_MATH_MAX_ROOT_ITERATION_POLICY 200 + +#endif // BOOST_MATH_TOOLS_USER_HPP + + diff --git a/3rdParty/Boost/src/boost/math_fwd.hpp b/3rdParty/Boost/src/boost/math_fwd.hpp new file mode 100644 index 0000000..f9b7915 --- /dev/null +++ b/3rdParty/Boost/src/boost/math_fwd.hpp @@ -0,0 +1,108 @@ +// Boost math_fwd.hpp header file ------------------------------------------// + +// (C) Copyright Hubert Holin and Daryle Walker 2001-2002. 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) + +// See http://www.boost.org/libs/math for documentation. + +#ifndef BOOST_MATH_FWD_HPP +#define BOOST_MATH_FWD_HPP + +#include <boost/cstdint.hpp> + +namespace boost +{ +namespace math +{ + + +// From <boost/math/quaternion.hpp> ----------------------------------------// + +template < typename T > + class quaternion; + +template < > + class quaternion< float >; +template < > + class quaternion< double >; +template < > + class quaternion< long double >; + +// Also has many function templates (including operators) + + +// From <boost/math/octonion.hpp> ------------------------------------------// + +template < typename T > + class octonion; + +template < > + class octonion< float >; +template < > + class octonion< double >; +template < > + class octonion< long double >; + +// Also has many function templates (including operators) + + +// From <boost/math/special_functions/acosh.hpp> ---------------------------// + +// Only has function template + + +// From <boost/math/special_functions/asinh.hpp> ---------------------------// + +// Only has function template + + +// From <boost/math/special_functions/atanh.hpp> ---------------------------// + +// Only has function template + + +// From <boost/math/special_functions/sinc.hpp> ----------------------------// + +// Only has function templates + + +// From <boost/math/special_functions/sinhc.hpp> ---------------------------// + +// Only has function templates + + +// From <boost/math/common_factor.hpp> -------------------------------------// + +// Only #includes other headers + + +// From <boost/math/common_factor_ct.hpp> ----------------------------------// + +#ifdef BOOST_NO_INTEGRAL_INT64_T + typedef unsigned long static_gcd_type; +#else + typedef boost::uintmax_t static_gcd_type; +#endif + +template < static_gcd_type Value1, static_gcd_type Value2 > + struct static_gcd; +template < static_gcd_type Value1, static_gcd_type Value2 > + struct static_lcm; + + +// From <boost/math/common_factor_rt.hpp> ----------------------------------// + +template < typename IntegerType > + class gcd_evaluator; +template < typename IntegerType > + class lcm_evaluator; + +// Also has a couple of function templates + + +} // namespace math +} // namespace boost + + +#endif // BOOST_MATH_FWD_HPP diff --git a/3rdParty/Boost/src/boost/move/move.hpp b/3rdParty/Boost/src/boost/move/move.hpp new file mode 100644 index 0000000..6029d6d --- /dev/null +++ b/3rdParty/Boost/src/boost/move/move.hpp @@ -0,0 +1,1273 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright David Abrahams, Vicente Botet 2009. +// (C) Copyright Ion Gaztanaga 2009-2010. +// 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) +// +// See http://www.boost.org/libs/move for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +//! \file + +#ifndef BOOST_MOVE_MOVE_HPP +#define BOOST_MOVE_MOVE_HPP + +#if !defined(BOOST_MOVE_DOXYGEN_INVOKED) + +/// @cond + +#include <boost/config.hpp> + +#ifdef BOOST_MSVC + #ifndef _CRT_SECURE_NO_DEPRECATE + #define BOOST_INTERPROCESS_CRT_SECURE_NO_DEPRECATE + #define _CRT_SECURE_NO_DEPRECATE + #endif + #ifndef _SCL_SECURE_NO_WARNINGS + #define BOOST_INTERPROCESS_SCL_SECURE_NO_WARNINGS + #define _SCL_SECURE_NO_WARNINGS + #endif + #pragma warning (push) + #pragma warning(disable:4996) +#endif + +#include <algorithm> //copy, copy_backward +#include <memory> //uninitialized_copy +#include <iterator> //std::iterator + +#define BOOST_MOVE_AVOID_BOOST_DEPENDENCIES + +//If boost dependencies are avoided include all machinery +#if !defined(BOOST_MOVE_AVOID_BOOST_DEPENDENCIES) + #include <boost/utility/enable_if.hpp> + #include <boost/utility/addressof.hpp> + #include <boost/mpl/if.hpp> + #include <boost/mpl/bool.hpp> + #include <boost/mpl/and.hpp> + #include <boost/mpl/not.hpp> + #include <boost/mpl/identity.hpp> + #include <boost/type_traits/is_class.hpp> + #include <boost/type_traits/is_convertible.hpp> + #include <boost/type_traits/has_trivial_destructor.hpp> + #include <boost/type_traits/integral_constant.hpp> + + #define BOOST_MOVE_MPL_NS ::boost::mpl + #define BOOST_MOVE_BOOST_NS ::boost +#else + #define BOOST_MOVE_MPL_NS ::boost::move_detail + #define BOOST_MOVE_BOOST_NS ::boost::move_detail +#endif //#ifdef BOOST_MOVE_AVOID_BOOST_DEPENDENCIES + +//Small meta-typetraits to support move +#ifdef BOOST_MOVE_AVOID_BOOST_DEPENDENCIES + + namespace boost { + namespace move_detail { + + //if_ + template<bool C, typename T1, typename T2> + struct if_c + { + typedef T1 type; + }; + + template<typename T1, typename T2> + struct if_c<false,T1,T2> + { + typedef T2 type; + }; + + template<typename T1, typename T2, typename T3> + struct if_ + { + typedef typename if_c<0 != T1::value, T2, T3>::type type; + }; + + //enable_if_ + template <bool B, class T = void> + struct enable_if_c + { + typedef T type; + }; + + template <class T> + struct enable_if_c<false, T> {}; + + template <class Cond, class T = void> + struct enable_if : public enable_if_c<Cond::value, T> {}; + + template <class Cond, class T = void> + struct disable_if : public enable_if_c<!Cond::value, T> {}; + + //integral_constant + template<class T, T v> + struct integral_constant + { + static const T value = v; + typedef T value_type; + typedef integral_constant<T, v> type; + }; + + //identity + template <class T> + struct identity + { + typedef T type; + }; + + //is_convertible + template <class T, class U> + class is_convertible + { + typedef char true_t; + class false_t { char dummy[2]; }; + static true_t dispatch(U); + static false_t dispatch(...); + static T &trigger(); + public: + enum { value = sizeof(dispatch(trigger())) == sizeof(true_t) }; + }; + + //and_ not_ + template <typename Condition1, typename Condition2, typename Condition3 = integral_constant<bool, true> > + struct and_ + : public integral_constant<bool, Condition1::value && Condition2::value && Condition3::value> + {}; + + template <typename Boolean> + struct not_ + : public integral_constant<bool, !Boolean::value> + {}; + + //is_lvalue_reference + template<class T> + struct is_lvalue_reference + : public integral_constant<bool, false> + {}; + + template<class T> + struct is_lvalue_reference<T&> + : public integral_constant<bool, true> + {}; + + //has_trivial_destructor + template<class T> + struct has_trivial_destructor + : public integral_constant<bool, false> + {}; + + //addressof + template<class T> struct addr_impl_ref + { + T & v_; + inline addr_impl_ref( T & v ): v_( v ) {} + inline operator T& () const { return v_; } + + private: + addr_impl_ref & operator=(const addr_impl_ref &); + }; + + template<class T> struct addressof_impl + { + static inline T * f( T & v, long ) + { + return reinterpret_cast<T*>( + &const_cast<char&>(reinterpret_cast<const volatile char &>(v))); + } + + static inline T * f( T * v, int ) + { return v; } + }; + + template<class T> + inline T * addressof( T & v ) + { + return ::boost::move_detail::addressof_impl<T>::f + ( ::boost::move_detail::addr_impl_ref<T>( v ), 0 ); + } + + } //namespace move_detail { + } //namespace boost { + +#endif //BOOST_MOVE_AVOID_BOOST_DEPENDENCIES + +//Compiler workaround detection +#if !defined(BOOST_NO_RVALUE_REFERENCES) + + #if defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ < 5) && !defined(__clang__) + //Pre-standard rvalue binding rules + #define BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES + #elif defined(_MSC_VER) && (_MSC_VER == 1600) + //Standard rvalue binding rules but with some bugs + #define BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG + //Use standard library for MSVC to avoid namespace issues as + //some move calls in the STL are not fully qualified. + //#define BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE + #endif + +#endif + +/// @endcond + +#endif //#if !defined(BOOST_MOVE_DOXYGEN_INVOKED) + +#if defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_MOVE_DOXYGEN_INVOKED) + + //Move emulation rv breaks standard aliasing rules so add workarounds for some compilers + #if defined(__GNUC__) && (__GNUC__ >= 4) + #define BOOST_MOVE_ATTRIBUTE_MAY_ALIAS __attribute__((__may_alias__)) + #else + #define BOOST_MOVE_ATTRIBUTE_MAY_ALIAS + #endif + + namespace boost { + + namespace move_detail { + template<class T> + struct is_class_or_union + { + struct twochar { char _[2]; }; + template <class U> + static char is_class_or_union_tester(void(U::*)(void)); + template <class U> + static twochar is_class_or_union_tester(...); + static const bool value = sizeof(is_class_or_union_tester<T>(0)) == sizeof(char); + }; + struct empty{}; + } + + ////////////////////////////////////////////////////////////////////////////// + // + // struct rv + // + ////////////////////////////////////////////////////////////////////////////// + template <class T> + class rv + : public BOOST_MOVE_MPL_NS::if_c + < ::boost::move_detail::is_class_or_union<T>::value + , T + , ::boost::move_detail::empty + >::type + { + rv(); + ~rv(); + rv(rv const&); + void operator=(rv const&); + } BOOST_MOVE_ATTRIBUTE_MAY_ALIAS; + + + + ////////////////////////////////////////////////////////////////////////////// + // + // move_detail::is_rv + // + ////////////////////////////////////////////////////////////////////////////// + + namespace move_detail { + + template <class T> + struct is_rv + : BOOST_MOVE_BOOST_NS::integral_constant<bool, false> + {}; + + template <class T> + struct is_rv< rv<T> > + : BOOST_MOVE_BOOST_NS::integral_constant<bool, true> + {}; + + template <class T> + struct is_rv< const rv<T> > + : BOOST_MOVE_BOOST_NS::integral_constant<bool, true> + {}; + + } //namespace move_detail { + + ////////////////////////////////////////////////////////////////////////////// + // + // has_move_emulation_enabled + // + ////////////////////////////////////////////////////////////////////////////// + template<class T> + struct has_move_emulation_enabled + : BOOST_MOVE_BOOST_NS::is_convertible< T, ::boost::rv<T>& > + {}; + + template<class T> + struct has_move_emulation_enabled<T&> + : BOOST_MOVE_BOOST_NS::integral_constant<bool, false> + {}; + + template<class T> + struct has_move_emulation_enabled< ::boost::rv<T> > + : BOOST_MOVE_BOOST_NS::integral_constant<bool, false> + {}; + + template <class T> + struct has_move_emulation_enabled_aux + : has_move_emulation_enabled<T> {}; + + template <class T> + struct has_nothrow_move + : public BOOST_MOVE_BOOST_NS::integral_constant<bool, false> + {}; + + ////////////////////////////////////////////////////////////////////////////// + // + // move() + // + ////////////////////////////////////////////////////////////////////////////// + + template <class T> + inline typename BOOST_MOVE_BOOST_NS::disable_if<has_move_emulation_enabled_aux<T>, T&>::type move(T& x) + { + return x; + } + + template <class T> + inline typename BOOST_MOVE_BOOST_NS::enable_if<has_move_emulation_enabled<T>, rv<T>&>::type move(T& x) + { + return *static_cast<rv<T>* >(BOOST_MOVE_BOOST_NS::addressof(x)); + } + + template <class T> + inline typename BOOST_MOVE_BOOST_NS::enable_if<has_move_emulation_enabled<T>, rv<T>&>::type move(rv<T>& x) + { + return x; + } + + #define BOOST_RV_REF(TYPE)\ + ::boost::rv< TYPE >& \ + // + + #define BOOST_RV_REF_2_TEMPL_ARGS(TYPE, ARG1, ARG2)\ + ::boost::rv< TYPE<ARG1, ARG2> >& \ + // + + #define BOOST_RV_REF_3_TEMPL_ARGS(TYPE, ARG1, ARG2, ARG3)\ + ::boost::rv< TYPE<ARG1, ARG2, ARG3> >& \ + // + + #define BOOST_RV_REF_BEG\ + ::boost::rv< \ + // + + #define BOOST_RV_REF_END\ + >& \ + // + + + + #define BOOST_FWD_REF(TYPE)\ + const TYPE & \ + // + + #define BOOST_CATCH_CONST_RLVALUE(TYPE)\ + const ::boost::rv< TYPE >& \ + // + + #define BOOST_COPY_ASSIGN_REF(TYPE)\ + const ::boost::rv< TYPE >& \ + // + + #define BOOST_COPY_ASSIGN_REF_BEG \ + const ::boost::rv< \ + // + + #define BOOST_COPY_ASSIGN_REF_END \ + >& \ + // + + #define BOOST_MOVE_COPY_ASSIGN_REF_2_TEMPL_ARGS(TYPE, ARG1, ARG2)\ + const ::boost::rv< TYPE<ARG1, ARG2> >& \ + // + + #define BOOST_MOVE_COPY_ASSIGN_REF_3_TEMPL_ARGS(TYPE, ARG1, ARG2, ARG3)\ + const ::boost::rv< TYPE<ARG1, ARG2, ARG3> >& \ + // + + ////////////////////////////////////////////////////////////////////////////// + // + // forward() + // + ////////////////////////////////////////////////////////////////////////////// + + template <class T> + inline typename BOOST_MOVE_BOOST_NS::enable_if< ::boost::move_detail::is_rv<T>, T &>::type + forward(const typename BOOST_MOVE_MPL_NS::identity<T>::type &x) + { + return const_cast<T&>(x); + } + + template <class T> + inline typename BOOST_MOVE_BOOST_NS::disable_if< ::boost::move_detail::is_rv<T>, const T &>::type + forward(const typename BOOST_MOVE_MPL_NS::identity<T>::type &x) + { + return x; + } + + ////////////////////////////////////////////////////////////////////////////// + // + // BOOST_MOVABLE_BUT_NOT_COPYABLE + // + ////////////////////////////////////////////////////////////////////////////// + #define BOOST_MOVABLE_BUT_NOT_COPYABLE(TYPE)\ + private:\ + TYPE(TYPE &);\ + TYPE& operator=(TYPE &);\ + public:\ + operator ::boost::rv<TYPE>&() \ + { return *static_cast< ::boost::rv<TYPE>* >(this); }\ + operator const ::boost::rv<TYPE>&() const \ + { return *static_cast<const ::boost::rv<TYPE>* >(this); }\ + private:\ + // + + ////////////////////////////////////////////////////////////////////////////// + // + // BOOST_COPYABLE_AND_MOVABLE + // + ////////////////////////////////////////////////////////////////////////////// + + #define BOOST_COPYABLE_AND_MOVABLE(TYPE)\ + public:\ + TYPE& operator=(TYPE &t)\ + { this->operator=(static_cast<const ::boost::rv<TYPE> &>(const_cast<const TYPE &>(t))); return *this;}\ + public:\ + operator ::boost::rv<TYPE>&() \ + { return *static_cast< ::boost::rv<TYPE>* >(this); }\ + operator const ::boost::rv<TYPE>&() const \ + { return *static_cast<const ::boost::rv<TYPE>* >(this); }\ + private:\ + // + + #define BOOST_COPYABLE_AND_MOVABLE_ALT(TYPE)\ + public:\ + operator ::boost::rv<TYPE>&() \ + { return *static_cast< ::boost::rv<TYPE>* >(this); }\ + operator const ::boost::rv<TYPE>&() const \ + { return *static_cast<const ::boost::rv<TYPE>* >(this); }\ + private:\ + // + + } //namespace boost + +#else //BOOST_NO_RVALUE_REFERENCES + + namespace boost{ + + //! By default this traits returns false. Classes with non-throwing move constructor + //! and assignment should specialize this trait to obtain some performance improvements. + template <class T> + struct has_nothrow_move + : public BOOST_MOVE_MPL_NS::integral_constant<bool, false> + {}; + + } // namespace boost{ + + #if defined(BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE) + #include <utility> + + namespace boost{ + + using ::std::move; + using ::std::forward; + using ::std::move_backward; + + } //namespace boost + + #else //!BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE + + #include <boost/type_traits/remove_reference.hpp> + + namespace boost { + + ////////////////////////////////////////////////////////////////////////////// + // + // move + // + ////////////////////////////////////////////////////////////////////////////// + + #if defined(BOOST_MOVE_DOXYGEN_INVOKED) + //! This function provides a way to convert a reference into a rvalue reference + //! in compilers with rvalue references. For other compilers converts T & into + //! <i>::boost::rv<T> &</i> so that move emulation is activated. + template <class T> + rvalue_reference move (input_reference); + + #elif defined(BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES) + + //Old move approach, lvalues could bind to rvalue references + template <class T> + inline typename remove_reference<T>::type && move(T&& t) + { return t; } + + #else //Old move + + template <class T> + inline typename remove_reference<T>::type && move(T&& t) + { return static_cast<typename remove_reference<T>::type &&>(t); } + + #endif //Old move + + ////////////////////////////////////////////////////////////////////////////// + // + // forward + // + ////////////////////////////////////////////////////////////////////////////// + + + #if defined(BOOST_MOVE_DOXYGEN_INVOKED) + //! This function provides limited form of forwarding that is usually enough for + //! in-place construction and avoids the exponential overloading necessary for + //! perfect forwarding in C++03. + //! + //! For compilers with rvalue references this function provides perfect forwarding. + //! + //! Otherwise: + //! * If input_reference binds to const ::boost::rv<T> & then it output_reference is + //! ::boost::rev<T> & + //! + //! * Else, input_reference is equal to output_reference is equal to input_reference. + template <class T> output_reference forward(input_reference); + #elif defined(BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES) + + //Old move approach, lvalues could bind to rvalue references + + template <class T> + inline T&& forward (typename BOOST_MOVE_MPL_NS::identity<T>::type&& t) + { return t; } + + #else //Old move + + //Implementation #5 from N2951, thanks to Howard Hinnant + + template <class T, class U> + inline T&& forward(U&& t + , typename BOOST_MOVE_BOOST_NS::enable_if_c< + move_detail::is_lvalue_reference<T>::value ? move_detail::is_lvalue_reference<U>::value : true>::type * = 0/* + , typename BOOST_MOVE_BOOST_NS::enable_if_c< + move_detail::is_convertible + <typename remove_reference<U>::type*, typename remove_reference<T>::type*>::value>::type * = 0*/) + { return static_cast<T&&>(t); } + + #endif //BOOST_MOVE_DOXYGEN_INVOKED + + } //namespace boost { + + #endif //#if defined(BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE) + + //! This macro marks a type as movable but not copyable, disabling copy construction + //! and assignment. The user will need to write a move constructor/assignment as explained + //! in the documentation to fully write a movable but not copyable class. + #define BOOST_MOVABLE_BUT_NOT_COPYABLE(TYPE)\ + public:\ + typedef int boost_move_emulation_t;\ + private:\ + TYPE(const TYPE &);\ + TYPE& operator=(const TYPE &);\ + // + + //! This macro marks a type as copyable and movable. + //! The user will need to write a move constructor/assignment and a copy assignment + //! as explained in the documentation to fully write a copyable and movable class. + #define BOOST_COPYABLE_AND_MOVABLE(TYPE)\ + // + + #define BOOST_COPYABLE_AND_MOVABLE_ALT(TYPE)\ + // + + //!This macro is used to achieve portable syntax in move + //!constructors and assignments for classes marked as + //!BOOST_COPYABLE_AND_MOVABLE or BOOST_MOVABLE_BUT_NOT_COPYABLE + #define BOOST_RV_REF(TYPE)\ + TYPE && \ + // + + //!This macro is used to achieve portable syntax in move + //!constructors and assignments for template classes marked as + //!BOOST_COPYABLE_AND_MOVABLE or BOOST_MOVABLE_BUT_NOT_COPYABLE. + //!As macros have problem with comma-separatd template arguments, + //!the template argument must be preceded with BOOST_RV_REF_START + //!and ended with BOOST_RV_REF_END + #define BOOST_RV_REF_BEG\ + \ + // + + //!This macro is used to achieve portable syntax in move + //!constructors and assignments for template classes marked as + //!BOOST_COPYABLE_AND_MOVABLE or BOOST_MOVABLE_BUT_NOT_COPYABLE. + //!As macros have problem with comma-separatd template arguments, + //!the template argument must be preceded with BOOST_RV_REF_START + //!and ended with BOOST_RV_REF_END + #define BOOST_RV_REF_END\ + && \ + + //!This macro is used to achieve portable syntax in copy + //!assignment for classes marked as BOOST_COPYABLE_AND_MOVABLE. + #define BOOST_COPY_ASSIGN_REF(TYPE)\ + const TYPE & \ + // + + //! This macro is used to implement portable perfect forwarding + //! as explained in the documentation. + #define BOOST_FWD_REF(TYPE)\ + TYPE && \ + // + + + #if !defined(BOOST_MOVE_DOXYGEN_INVOKED) + /// @cond + + #define BOOST_RV_REF_2_TEMPL_ARGS(TYPE, ARG1, ARG2)\ + TYPE<ARG1, ARG2> && \ + // + + #define BOOST_RV_REF_3_TEMPL_ARGS(TYPE, ARG1, ARG2, ARG3)\ + TYPE<ARG1, ARG2, ARG3> && \ + // + + #define BOOST_COPY_REF_2_TEMPL_ARGS(TYPE, ARG1, ARG2)\ + const TYPE<ARG1, ARG2> & \ + // + + #define BOOST_COPY_REF_3_TEMPL_ARGS(TYPE, ARG1, ARG2, ARG3)\ + TYPE<ARG1, ARG2, ARG3>& \ + // + + #define BOOST_CATCH_CONST_RLVALUE(TYPE)\ + const TYPE & \ + // + + /// @endcond + + #endif //#if !defined(BOOST_MOVE_DOXYGEN_INVOKED) + +#endif //BOOST_NO_RVALUE_REFERENCES + +namespace boost { + +////////////////////////////////////////////////////////////////////////////// +// +// move_iterator +// +////////////////////////////////////////////////////////////////////////////// + +//! Class template move_iterator is an iterator adaptor with the same behavior +//! as the underlying iterator except that its dereference operator implicitly +//! converts the value returned by the underlying iterator's dereference operator +//! to an rvalue reference. Some generic algorithms can be called with move +//! iterators to replace copying with moving. +template <class It> +class move_iterator +{ + public: + typedef It iterator_type; + typedef typename std::iterator_traits<iterator_type>::value_type value_type; + #if !defined(BOOST_NO_RVALUE_REFERENCES) || defined(BOOST_MOVE_DOXYGEN_INVOKED) + typedef value_type && reference; + #else + typedef typename BOOST_MOVE_MPL_NS::if_ + < ::boost::has_move_emulation_enabled<value_type> + , ::boost::rv<value_type>& + , value_type & >::type reference; + #endif + typedef It pointer; + typedef typename std::iterator_traits<iterator_type>::difference_type difference_type; + typedef typename std::iterator_traits<iterator_type>::iterator_category iterator_category; + + move_iterator() + {} + + explicit move_iterator(It i) + : m_it(i) + {} + + template <class U> + move_iterator(const move_iterator<U>& u) + : m_it(u.base()) + {} + + iterator_type base() const + { return m_it; } + + reference operator*() const + { + #if defined(BOOST_NO_RVALUE_REFERENCES) || defined(BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES) + return *m_it; + #else + return ::boost::move(*m_it); + #endif + } + + pointer operator->() const + { return m_it; } + + move_iterator& operator++() + { ++m_it; return *this; } + + move_iterator<iterator_type> operator++(int) + { move_iterator<iterator_type> tmp(*this); ++(*this); return tmp; } + + move_iterator& operator--() + { --m_it; return *this; } + + move_iterator<iterator_type> operator--(int) + { move_iterator<iterator_type> tmp(*this); --(*this); return tmp; } + + move_iterator<iterator_type> operator+ (difference_type n) const + { return move_iterator<iterator_type>(m_it + n); } + + move_iterator& operator+=(difference_type n) + { m_it += n; return *this; } + + move_iterator<iterator_type> operator- (difference_type n) const + { return move_iterator<iterator_type>(m_it - n); } + + move_iterator& operator-=(difference_type n) + { m_it -= n; return *this; } + + reference operator[](difference_type n) const + { + #if defined(BOOST_NO_RVALUE_REFERENCES) || defined(BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES) + return m_it[n]; + #else + return ::boost::move(m_it[n]); + #endif + } + + friend bool operator==(const move_iterator& x, const move_iterator& y) + { return x.base() == y.base(); } + + friend bool operator!=(const move_iterator& x, const move_iterator& y) + { return x.base() != y.base(); } + + friend bool operator< (const move_iterator& x, const move_iterator& y) + { return x.base() < y.base(); } + + friend bool operator<=(const move_iterator& x, const move_iterator& y) + { return x.base() <= y.base(); } + + friend bool operator> (const move_iterator& x, const move_iterator& y) + { return x.base() > y.base(); } + + friend bool operator>=(const move_iterator& x, const move_iterator& y) + { return x.base() >= y.base(); } + + friend difference_type operator-(const move_iterator& x, const move_iterator& y) + { return x.base() - y.base(); } + + friend move_iterator operator+(difference_type n, const move_iterator& x) + { return move_iterator(x.base() + n); } + + private: + It m_it; +}; + + +//is_move_iterator +namespace move_detail { + +template <class I> +struct is_move_iterator + : public BOOST_MOVE_BOOST_NS::integral_constant<bool, false> +{ +}; + +template <class I> +struct is_move_iterator< ::boost::move_iterator<I> > + : public BOOST_MOVE_BOOST_NS::integral_constant<bool, true> +{ +}; + +} //namespace move_detail { + +////////////////////////////////////////////////////////////////////////////// +// +// move_iterator +// +////////////////////////////////////////////////////////////////////////////// + +//! +//! <b>Returns</b>: move_iterator<It>(i). +template<class It> +inline move_iterator<It> make_move_iterator(const It &it) +{ return move_iterator<It>(it); } + +////////////////////////////////////////////////////////////////////////////// +// +// back_move_insert_iterator +// +////////////////////////////////////////////////////////////////////////////// + + +//! A move insert iterator that move constructs elements at the +//! back of a container +template <typename C> // C models Container +class back_move_insert_iterator + : public std::iterator<std::output_iterator_tag, void, void, void, void> +{ + C* container_m; + + public: + typedef C container_type; + typedef typename C::value_type value_type; + typedef typename C::reference reference; + + explicit back_move_insert_iterator(C& x) : container_m(&x) { } + + back_move_insert_iterator& operator=(reference x) + { container_m->push_back(boost::move(x)); return *this; } + + back_move_insert_iterator& operator=(BOOST_RV_REF(value_type) x) + { reference rx = x; return this->operator=(rx); } + + back_move_insert_iterator& operator*() { return *this; } + back_move_insert_iterator& operator++() { return *this; } + back_move_insert_iterator& operator++(int) { return *this; } +}; + +//! +//! <b>Returns</b>: back_move_insert_iterator<C>(x). +template <typename C> // C models Container +inline back_move_insert_iterator<C> back_move_inserter(C& x) +{ + return back_move_insert_iterator<C>(x); +} + +////////////////////////////////////////////////////////////////////////////// +// +// front_move_insert_iterator +// +////////////////////////////////////////////////////////////////////////////// + +//! A move insert iterator that move constructs elements int the +//! front of a container +template <typename C> // C models Container +class front_move_insert_iterator + : public std::iterator<std::output_iterator_tag, void, void, void, void> +{ + C* container_m; + +public: + typedef C container_type; + typedef typename C::value_type value_type; + typedef typename C::reference reference; + + explicit front_move_insert_iterator(C& x) : container_m(&x) { } + + front_move_insert_iterator& operator=(reference x) + { container_m->push_front(boost::move(x)); return *this; } + + front_move_insert_iterator& operator=(BOOST_RV_REF(value_type) x) + { reference rx = x; return this->operator=(rx); } + + front_move_insert_iterator& operator*() { return *this; } + front_move_insert_iterator& operator++() { return *this; } + front_move_insert_iterator& operator++(int) { return *this; } +}; + +//! +//! <b>Returns</b>: front_move_insert_iterator<C>(x). +template <typename C> // C models Container +inline front_move_insert_iterator<C> front_move_inserter(C& x) +{ + return front_move_insert_iterator<C>(x); +} + +////////////////////////////////////////////////////////////////////////////// +// +// insert_move_iterator +// +////////////////////////////////////////////////////////////////////////////// +template <typename C> // C models Container +class move_insert_iterator + : public std::iterator<std::output_iterator_tag, void, void, void, void> +{ + C* container_m; + typename C::iterator pos_; + + public: + typedef C container_type; + typedef typename C::value_type value_type; + typedef typename C::reference reference; + + explicit move_insert_iterator(C& x, typename C::iterator pos) + : container_m(&x), pos_(pos) + {} + + move_insert_iterator& operator=(reference x) + { + pos_ = container_m->insert(pos_, ::boost::move(x)); + ++pos_; + return *this; + } + + move_insert_iterator& operator=(BOOST_RV_REF(value_type) x) + { reference rx = x; return this->operator=(rx); } + + move_insert_iterator& operator*() { return *this; } + move_insert_iterator& operator++() { return *this; } + move_insert_iterator& operator++(int) { return *this; } +}; + +//! +//! <b>Returns</b>: move_insert_iterator<C>(x, it). +template <typename C> // C models Container +inline move_insert_iterator<C> move_inserter(C& x, typename C::iterator it) +{ + return move_insert_iterator<C>(x, it); +} + +////////////////////////////////////////////////////////////////////////////// +// +// move +// +////////////////////////////////////////////////////////////////////////////// + +#if !defined(BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE) + + //! <b>Effects</b>: Moves elements in the range [first,last) into the range [result,result + (last - + //! first)) starting from first and proceeding to last. For each non-negative integer n < (last-first), + //! performs *(result + n) = ::boost::move (*(first + n)). + //! + //! <b>Effects</b>: result + (last - first). + //! + //! <b>Requires</b>: result shall not be in the range [first,last). + //! + //! <b>Complexity</b>: Exactly last - first move assignments. + template <typename I, // I models InputIterator + typename O> // O models OutputIterator + O move(I f, I l, O result) + { + while (f != l) { + *result = ::boost::move(*f); + ++f; ++result; + } + return result; + } + + ////////////////////////////////////////////////////////////////////////////// + // + // move_backward + // + ////////////////////////////////////////////////////////////////////////////// + + //! <b>Effects</b>: Moves elements in the range [first,last) into the range + //! [result - (last-first),result) starting from last - 1 and proceeding to + //! first. For each positive integer n <= (last - first), + //! performs *(result - n) = ::boost::move(*(last - n)). + //! + //! <b>Requires</b>: result shall not be in the range [first,last). + //! + //! <b>Returns</b>: result - (last - first). + //! + //! <b>Complexity</b>: Exactly last - first assignments. + template <typename I, // I models BidirectionalIterator + typename O> // O models BidirectionalIterator + O move_backward(I f, I l, O result) + { + while (f != l) { + --l; --result; + *result = ::boost::move(*l); + } + return result; + } + +#endif //!defined(BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE) + +////////////////////////////////////////////////////////////////////////////// +// +// uninitialized_move +// +////////////////////////////////////////////////////////////////////////////// + +//! <b>Effects</b>: +//! \code +//! for (; first != last; ++result, ++first) +//! new (static_cast<void*>(&*result)) +//! typename iterator_traits<ForwardIterator>::value_type(boost::move(*first)); +//! \endcode +//! +//! <b>Returns</b>: result +template + <typename I, // I models InputIterator + typename F> // F models ForwardIterator +F uninitialized_move(I f, I l, F r + /// @cond +// ,typename BOOST_MOVE_BOOST_NS::enable_if<has_move_emulation_enabled<typename std::iterator_traits<I>::value_type> >::type* = 0 + /// @endcond + ) +{ + typedef typename std::iterator_traits<I>::value_type input_value_type; + while (f != l) { + ::new(static_cast<void*>(&*r)) input_value_type(boost::move(*f)); + ++f; ++r; + } + return r; +} + +/// @cond +/* +template + <typename I, // I models InputIterator + typename F> // F models ForwardIterator +F uninitialized_move(I f, I l, F r, + typename BOOST_MOVE_BOOST_NS::disable_if<has_move_emulation_enabled<typename std::iterator_traits<I>::value_type> >::type* = 0) +{ + return std::uninitialized_copy(f, l, r); +} +*/ + +////////////////////////////////////////////////////////////////////////////// +// +// uninitialized_copy_or_move +// +////////////////////////////////////////////////////////////////////////////// + +namespace move_detail { + +template +<typename I, // I models InputIterator +typename F> // F models ForwardIterator +inline F uninitialized_move_move_iterator(I f, I l, F r +// ,typename BOOST_MOVE_BOOST_NS::enable_if< has_move_emulation_enabled<typename I::value_type> >::type* = 0 +) +{ + return ::boost::uninitialized_move(f, l, r); +} +/* +template +<typename I, // I models InputIterator +typename F> // F models ForwardIterator +F uninitialized_move_move_iterator(I f, I l, F r, + typename BOOST_MOVE_BOOST_NS::disable_if< has_move_emulation_enabled<typename I::value_type> >::type* = 0) +{ + return std::uninitialized_copy(f.base(), l.base(), r); +} +*/ +} //namespace move_detail { + +template +<typename I, // I models InputIterator +typename F> // F models ForwardIterator +inline F uninitialized_copy_or_move(I f, I l, F r, + typename BOOST_MOVE_BOOST_NS::enable_if< move_detail::is_move_iterator<I> >::type* = 0) +{ + return ::boost::move_detail::uninitialized_move_move_iterator(f, l, r); +} + +////////////////////////////////////////////////////////////////////////////// +// +// copy_or_move +// +////////////////////////////////////////////////////////////////////////////// + +namespace move_detail { + +template +<typename I, // I models InputIterator +typename F> // F models ForwardIterator +inline F move_move_iterator(I f, I l, F r +// ,typename BOOST_MOVE_BOOST_NS::enable_if< has_move_emulation_enabled<typename I::value_type> >::type* = 0 +) +{ + return ::boost::move(f, l, r); +} +/* +template +<typename I, // I models InputIterator +typename F> // F models ForwardIterator +F move_move_iterator(I f, I l, F r, + typename BOOST_MOVE_BOOST_NS::disable_if< has_move_emulation_enabled<typename I::value_type> >::type* = 0) +{ + return std::copy(f.base(), l.base(), r); +} +*/ + +} //namespace move_detail { + +template +<typename I, // I models InputIterator +typename F> // F models ForwardIterator +inline F copy_or_move(I f, I l, F r, + typename BOOST_MOVE_BOOST_NS::enable_if< move_detail::is_move_iterator<I> >::type* = 0) +{ + return ::boost::move_detail::move_move_iterator(f, l, r); +} + +/// @endcond + +//! <b>Effects</b>: +//! \code +//! for (; first != last; ++result, ++first) +//! new (static_cast<void*>(&*result)) +//! typename iterator_traits<ForwardIterator>::value_type(*first); +//! \endcode +//! +//! <b>Returns</b>: result +//! +//! <b>Note</b>: This function is provided because +//! <i>std::uninitialized_copy</i> from some STL implementations +//! is not compatible with <i>move_iterator</i> +template +<typename I, // I models InputIterator +typename F> // F models ForwardIterator +inline F uninitialized_copy_or_move(I f, I l, F r + /// @cond + ,typename BOOST_MOVE_BOOST_NS::disable_if< move_detail::is_move_iterator<I> >::type* = 0 + /// @endcond + ) +{ + return std::uninitialized_copy(f, l, r); +} + +//! <b>Effects</b>: +//! \code +//! for (; first != last; ++result, ++first) +//! *result = *first; +//! \endcode +//! +//! <b>Returns</b>: result +//! +//! <b>Note</b>: This function is provided because +//! <i>std::uninitialized_copy</i> from some STL implementations +//! is not compatible with <i>move_iterator</i> +template +<typename I, // I models InputIterator +typename F> // F models ForwardIterator +inline F copy_or_move(I f, I l, F r + /// @cond + ,typename BOOST_MOVE_BOOST_NS::disable_if< move_detail::is_move_iterator<I> >::type* = 0 + /// @endcond + ) +{ + return std::copy(f, l, r); +} + +//! If this trait yields to true +//! (<i>has_trivial_destructor_after_move <T>::value == true</i>) +//! means that if T is used as argument of a move construction/assignment, +//! there is no need to call T's destructor. +//! This optimization tipically is used to improve containers' performance. +//! +//! By default this trait is true if the type has trivial destructor, +//! every class should specialize this trait if it wants to improve performance +//! when inserted in containers. +template <class T> +struct has_trivial_destructor_after_move + : BOOST_MOVE_BOOST_NS::has_trivial_destructor<T> +{}; + + + +namespace move_detail { + +// Code from Jeffrey Lee Hellrung, many thanks + +#ifndef BOOST_NO_RVALUE_REFERENCES + template< class T> struct forward_type { typedef T type; }; +#else // #ifndef BOOST_NO_RVALUE_REFERENCES + template< class T> + struct forward_type + { typedef const T &type; }; + + template< class T> + struct forward_type< boost::rv<T> > + { typedef T type; }; +#endif // #ifndef BOOST_NO_RVALUE_REFERENCES + + + +// Code from Jeffrey Lee Hellrung, many thanks + +template< class T > struct is_rvalue_reference : BOOST_MOVE_BOOST_NS::integral_constant<bool, false> { }; +#ifndef BOOST_NO_RVALUE_REFERENCES + template< class T > struct is_rvalue_reference< T&& > : BOOST_MOVE_BOOST_NS::integral_constant<bool, true> { }; +#else // #ifndef BOOST_NO_RVALUE_REFERENCES + template< class T > struct is_rvalue_reference< boost::rv<T>& > + : BOOST_MOVE_BOOST_NS::integral_constant<bool, true> + {}; + + template< class T > struct is_rvalue_reference< const boost::rv<T>& > + : BOOST_MOVE_BOOST_NS::integral_constant<bool, true> + {}; +#endif // #ifndef BOOST_NO_RVALUE_REFERENCES + +#ifndef BOOST_NO_RVALUE_REFERENCES + template< class T > struct add_rvalue_reference { typedef T&& type; }; +#else // #ifndef BOOST_NO_RVALUE_REFERENCES + namespace detail_add_rvalue_reference + { + template< class T + , bool emulation = ::boost::has_move_emulation_enabled<T>::value + , bool rv = ::boost::move_detail::is_rv<T>::value > + struct add_rvalue_reference_impl { typedef T type; }; + + template< class T, bool emulation> + struct add_rvalue_reference_impl< T, emulation, true > { typedef T & type; }; + + template< class T, bool rv > + struct add_rvalue_reference_impl< T, true, rv > { typedef ::boost::rv<T>& type; }; + } // namespace detail_add_rvalue_reference + + template< class T > + struct add_rvalue_reference + : detail_add_rvalue_reference::add_rvalue_reference_impl<T> + { }; + + template< class T > + struct add_rvalue_reference<T &> + { typedef T & type; }; + +#endif // #ifndef BOOST_NO_RVALUE_REFERENCES + +template< class T > struct remove_rvalue_reference { typedef T type; }; + +#ifndef BOOST_NO_RVALUE_REFERENCES + template< class T > struct remove_rvalue_reference< T&& > { typedef T type; }; +#else // #ifndef BOOST_NO_RVALUE_REFERENCES + template< class T > struct remove_rvalue_reference< rv<T> > { typedef T type; }; + template< class T > struct remove_rvalue_reference< const rv<T> > { typedef T type; }; + template< class T > struct remove_rvalue_reference< volatile rv<T> > { typedef T type; }; + template< class T > struct remove_rvalue_reference< const volatile rv<T> > { typedef T type; }; + template< class T > struct remove_rvalue_reference< rv<T>& > { typedef T type; }; + template< class T > struct remove_rvalue_reference< const rv<T>& > { typedef T type; }; + template< class T > struct remove_rvalue_reference< volatile rv<T>& > { typedef T type; }; + template< class T > struct remove_rvalue_reference< const volatile rv<T>& >{ typedef T type; }; +#endif // #ifndef BOOST_NO_RVALUE_REFERENCES + +template <typename T> +typename boost::move_detail::add_rvalue_reference<T>::type declval(); + +} +// Ideas from Boost.Move review, Jeffrey Lee Hellrung: +// +//- TypeTraits metafunctions is_lvalue_reference, add_lvalue_reference, and remove_lvalue_reference ? +// Perhaps add_reference and remove_reference can be modified so that they behave wrt emulated rvalue +// references the same as wrt real rvalue references, i.e., add_reference< rv<T>& > -> T& rather than +// rv<T>& (since T&& & -> T&). +// +//- Add'l TypeTraits has_[trivial_]move_{constructor,assign}...? +// +//- An as_lvalue(T& x) function, which amounts to an identity operation in C++0x, but strips emulated +// rvalue references in C++03. This may be necessary to prevent "accidental moves". + +} //namespace boost { + +#if defined BOOST_MSVC + #pragma warning (pop) + #ifdef BOOST_INTERPROCESS_CRT_SECURE_NO_DEPRECATE + #undef BOOST_INTERPROCESS_CRT_SECURE_NO_DEPRECATE + #undef _CRT_SECURE_NO_DEPRECATE + #endif + + #ifdef BOOST_INTERPROCESS_SCL_SECURE_NO_WARNINGS + #undef BOOST_INTERPROCESS_SCL_SECURE_NO_WARNINGS + #undef _SCL_SECURE_NO_WARNINGS + #endif +#endif + +#endif //#ifndef BOOST_MOVE_MOVE_HPP diff --git a/3rdParty/Boost/src/boost/mpl/O1_size.hpp b/3rdParty/Boost/src/boost/mpl/O1_size.hpp index 84ba521..8baaa79 100644 --- a/3rdParty/Boost/src/boost/mpl/O1_size.hpp +++ b/3rdParty/Boost/src/boost/mpl/O1_size.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: O1_size.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/O1_size_fwd.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/O1_size_fwd.hpp b/3rdParty/Boost/src/boost/mpl/O1_size_fwd.hpp index 281fcaf..d975382 100644 --- a/3rdParty/Boost/src/boost/mpl/O1_size_fwd.hpp +++ b/3rdParty/Boost/src/boost/mpl/O1_size_fwd.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: O1_size_fwd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ namespace boost { namespace mpl { diff --git a/3rdParty/Boost/src/boost/mpl/advance.hpp b/3rdParty/Boost/src/boost/mpl/advance.hpp index c8b5ae8..d811a80 100644 --- a/3rdParty/Boost/src/boost/mpl/advance.hpp +++ b/3rdParty/Boost/src/boost/mpl/advance.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: advance.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/advance_fwd.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/advance_fwd.hpp b/3rdParty/Boost/src/boost/mpl/advance_fwd.hpp index daf0c91..08ba5fc 100644 --- a/3rdParty/Boost/src/boost/mpl/advance_fwd.hpp +++ b/3rdParty/Boost/src/boost/mpl/advance_fwd.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: advance_fwd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/common_name_wknd.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/always.hpp b/3rdParty/Boost/src/boost/mpl/always.hpp index f984231..5094b3e 100644 --- a/3rdParty/Boost/src/boost/mpl/always.hpp +++ b/3rdParty/Boost/src/boost/mpl/always.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: always.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/preprocessor/def_params_tail.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/and.hpp b/3rdParty/Boost/src/boost/mpl/and.hpp index 1b3ede2..da257c8 100644 --- a/3rdParty/Boost/src/boost/mpl/and.hpp +++ b/3rdParty/Boost/src/boost/mpl/and.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: and.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/config/use_preprocessed.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/apply.hpp b/3rdParty/Boost/src/boost/mpl/apply.hpp index 944619e..b0455bc 100644 --- a/3rdParty/Boost/src/boost/mpl/apply.hpp +++ b/3rdParty/Boost/src/boost/mpl/apply.hpp @@ -15,7 +15,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: apply.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) diff --git a/3rdParty/Boost/src/boost/mpl/apply_fwd.hpp b/3rdParty/Boost/src/boost/mpl/apply_fwd.hpp index a78ae8b..8cbdfaf 100644 --- a/3rdParty/Boost/src/boost/mpl/apply_fwd.hpp +++ b/3rdParty/Boost/src/boost/mpl/apply_fwd.hpp @@ -15,7 +15,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: apply_fwd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) diff --git a/3rdParty/Boost/src/boost/mpl/apply_wrap.hpp b/3rdParty/Boost/src/boost/mpl/apply_wrap.hpp index b3cb12b..5c5c6df 100644 --- a/3rdParty/Boost/src/boost/mpl/apply_wrap.hpp +++ b/3rdParty/Boost/src/boost/mpl/apply_wrap.hpp @@ -15,7 +15,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: apply_wrap.hpp 49272 2008-10-11 06:50:46Z agurtovoy $ -// $Date: 2008-10-11 02:50:46 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:50:46 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49272 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) diff --git a/3rdParty/Boost/src/boost/mpl/arg.hpp b/3rdParty/Boost/src/boost/mpl/arg.hpp index c1c7072..c323a1a 100644 --- a/3rdParty/Boost/src/boost/mpl/arg.hpp +++ b/3rdParty/Boost/src/boost/mpl/arg.hpp @@ -16,7 +16,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: arg.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) diff --git a/3rdParty/Boost/src/boost/mpl/arg_fwd.hpp b/3rdParty/Boost/src/boost/mpl/arg_fwd.hpp index c96b48f..f79e056 100644 --- a/3rdParty/Boost/src/boost/mpl/arg_fwd.hpp +++ b/3rdParty/Boost/src/boost/mpl/arg_fwd.hpp @@ -12,7 +12,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: arg_fwd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/adl_barrier.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/assert.hpp b/3rdParty/Boost/src/boost/mpl/assert.hpp index 33b82f3..acc3954 100644 --- a/3rdParty/Boost/src/boost/mpl/assert.hpp +++ b/3rdParty/Boost/src/boost/mpl/assert.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: assert.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/not.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/at.hpp b/3rdParty/Boost/src/boost/mpl/at.hpp index caa3462..d247d71 100644 --- a/3rdParty/Boost/src/boost/mpl/at.hpp +++ b/3rdParty/Boost/src/boost/mpl/at.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: at.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/at_fwd.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/at_fwd.hpp b/3rdParty/Boost/src/boost/mpl/at_fwd.hpp index 6bce275..a4825f0 100644 --- a/3rdParty/Boost/src/boost/mpl/at_fwd.hpp +++ b/3rdParty/Boost/src/boost/mpl/at_fwd.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: at_fwd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ namespace boost { namespace mpl { diff --git a/3rdParty/Boost/src/boost/mpl/aux_/O1_size_impl.hpp b/3rdParty/Boost/src/boost/mpl/aux_/O1_size_impl.hpp index df408f0..614730d 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/O1_size_impl.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/O1_size_impl.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: O1_size_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/O1_size_fwd.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/adl_barrier.hpp b/3rdParty/Boost/src/boost/mpl/aux_/adl_barrier.hpp index 7d9eaea..077f46f 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/adl_barrier.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/adl_barrier.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: adl_barrier.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/config/adl.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/advance_backward.hpp b/3rdParty/Boost/src/boost/mpl/aux_/advance_backward.hpp index 169202a..d44c59f 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/advance_backward.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/advance_backward.hpp @@ -15,7 +15,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: advance_backward.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) diff --git a/3rdParty/Boost/src/boost/mpl/aux_/advance_forward.hpp b/3rdParty/Boost/src/boost/mpl/aux_/advance_forward.hpp index 058f765..4edd3ea 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/advance_forward.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/advance_forward.hpp @@ -15,7 +15,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: advance_forward.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) diff --git a/3rdParty/Boost/src/boost/mpl/aux_/arg_typedef.hpp b/3rdParty/Boost/src/boost/mpl/aux_/arg_typedef.hpp index e4737b9..ed5e5bd 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/arg_typedef.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/arg_typedef.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: arg_typedef.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/config/lambda.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/arithmetic_op.hpp b/3rdParty/Boost/src/boost/mpl/aux_/arithmetic_op.hpp index 9546e8e..0a310b7 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/arithmetic_op.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/arithmetic_op.hpp @@ -10,7 +10,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: arithmetic_op.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) diff --git a/3rdParty/Boost/src/boost/mpl/aux_/arity.hpp b/3rdParty/Boost/src/boost/mpl/aux_/arity.hpp index f639a10..adedcc6 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/arity.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/arity.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: arity.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/config/dtp.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/arity_spec.hpp b/3rdParty/Boost/src/boost/mpl/aux_/arity_spec.hpp index ea164a6..6ae5cc7 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/arity_spec.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/arity_spec.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: arity_spec.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/int.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/at_impl.hpp b/3rdParty/Boost/src/boost/mpl/aux_/at_impl.hpp index 120738f..4af7cfe 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/at_impl.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/at_impl.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: at_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/begin_end.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/begin_end_impl.hpp b/3rdParty/Boost/src/boost/mpl/aux_/begin_end_impl.hpp index d3b9682..1a220a2 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/begin_end_impl.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/begin_end_impl.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: begin_end_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/begin_end_fwd.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/clear_impl.hpp b/3rdParty/Boost/src/boost/mpl/aux_/clear_impl.hpp index 84da54b..3850086 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/clear_impl.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/clear_impl.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: clear_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/clear_fwd.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/common_name_wknd.hpp b/3rdParty/Boost/src/boost/mpl/aux_/common_name_wknd.hpp index 9d0b4b4..a6c7898 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/common_name_wknd.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/common_name_wknd.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: common_name_wknd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/config/workaround.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/comparison_op.hpp b/3rdParty/Boost/src/boost/mpl/aux_/comparison_op.hpp index 7d0fa20..f0850a4 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/comparison_op.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/comparison_op.hpp @@ -10,7 +10,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: comparison_op.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) diff --git a/3rdParty/Boost/src/boost/mpl/aux_/config/adl.hpp b/3rdParty/Boost/src/boost/mpl/aux_/config/adl.hpp index 130ee9f..d6ead71 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/config/adl.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/config/adl.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: adl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/config/msvc.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/config/arrays.hpp b/3rdParty/Boost/src/boost/mpl/aux_/config/arrays.hpp index 56ee0a3..d801cf7 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/config/arrays.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/config/arrays.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: arrays.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/config/msvc.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/config/bind.hpp b/3rdParty/Boost/src/boost/mpl/aux_/config/bind.hpp index d0450e6..02a7814 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/config/bind.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/config/bind.hpp @@ -12,7 +12,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: bind.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/config/msvc.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/config/compiler.hpp b/3rdParty/Boost/src/boost/mpl/aux_/config/compiler.hpp index 3238963..e80ccde 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/config/compiler.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/config/compiler.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: compiler.hpp 53189 2009-05-22 20:07:55Z hkaiser $ -// $Date: 2009-05-22 16:07:55 -0400 (Fri, 22 May 2009) $ +// $Date: 2009-05-22 13:07:55 -0700 (Fri, 22 May 2009) $ // $Revision: 53189 $ #if !defined(BOOST_MPL_CFG_COMPILER_DIR) diff --git a/3rdParty/Boost/src/boost/mpl/aux_/config/ctps.hpp b/3rdParty/Boost/src/boost/mpl/aux_/config/ctps.hpp index b908cee..9a4aaf7 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/config/ctps.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/config/ctps.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: ctps.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/config/workaround.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/config/dependent_nttp.hpp b/3rdParty/Boost/src/boost/mpl/aux_/config/dependent_nttp.hpp new file mode 100644 index 0000000..3b5a288 --- /dev/null +++ b/3rdParty/Boost/src/boost/mpl/aux_/config/dependent_nttp.hpp @@ -0,0 +1,35 @@ + +#ifndef BOOST_MPL_AUX_CONFIG_DEPENDENT_NTTP_HPP_INCLUDED +#define BOOST_MPL_AUX_CONFIG_DEPENDENT_NTTP_HPP_INCLUDED + +// Copyright Aleksey Gurtovoy 2002-2004 +// +// 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) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id: dependent_nttp.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ +// $Revision: 49267 $ + +#include <boost/mpl/aux_/config/gcc.hpp> +#include <boost/mpl/aux_/config/workaround.hpp> + +// GCC and EDG-based compilers incorrectly reject the following code: +// template< typename T, T n > struct a; +// template< typename T > struct b; +// template< typename T, T n > struct b< a<T,n> > {}; + +#if !defined(BOOST_MPL_CFG_NO_DEPENDENT_NONTYPE_PARAMETER_IN_PARTIAL_SPEC) \ + && !defined(BOOST_MPL_PREPROCESSING_MODE) \ + && ( BOOST_WORKAROUND(__EDG_VERSION__, BOOST_TESTED_AT(300)) \ + || BOOST_WORKAROUND(BOOST_MPL_CFG_GCC, BOOST_TESTED_AT(0x0302)) \ + ) + +# define BOOST_MPL_CFG_NO_DEPENDENT_NONTYPE_PARAMETER_IN_PARTIAL_SPEC + +#endif + +#endif // BOOST_MPL_AUX_CONFIG_DEPENDENT_NTTP_HPP_INCLUDED diff --git a/3rdParty/Boost/src/boost/mpl/aux_/config/dmc_ambiguous_ctps.hpp b/3rdParty/Boost/src/boost/mpl/aux_/config/dmc_ambiguous_ctps.hpp index 682770e..f5f53f7 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/config/dmc_ambiguous_ctps.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/config/dmc_ambiguous_ctps.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: dmc_ambiguous_ctps.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/config/workaround.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/config/dtp.hpp b/3rdParty/Boost/src/boost/mpl/aux_/config/dtp.hpp index 8f03a83..e53929b 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/config/dtp.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/config/dtp.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: dtp.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/config/workaround.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/config/eti.hpp b/3rdParty/Boost/src/boost/mpl/aux_/config/eti.hpp index 7328b6d..c3fd1c6 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/config/eti.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/config/eti.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: eti.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/config/msvc.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/config/forwarding.hpp b/3rdParty/Boost/src/boost/mpl/aux_/config/forwarding.hpp index 2390bd7..0919d07 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/config/forwarding.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/config/forwarding.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: forwarding.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/config/workaround.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/config/gcc.hpp b/3rdParty/Boost/src/boost/mpl/aux_/config/gcc.hpp index 3380d61..b9d8f7d 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/config/gcc.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/config/gcc.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: gcc.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #if defined(__GNUC__) && !defined(__EDG_VERSION__) diff --git a/3rdParty/Boost/src/boost/mpl/aux_/config/has_apply.hpp b/3rdParty/Boost/src/boost/mpl/aux_/config/has_apply.hpp index fc9176f..cc52eba 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/config/has_apply.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/config/has_apply.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: has_apply.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/config/has_xxx.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/config/has_xxx.hpp b/3rdParty/Boost/src/boost/mpl/aux_/config/has_xxx.hpp index e03fe11..1139b68 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/config/has_xxx.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/config/has_xxx.hpp @@ -12,7 +12,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: has_xxx.hpp 63518 2010-07-02 08:32:03Z agurtovoy $ -// $Date: 2010-07-02 04:32:03 -0400 (Fri, 02 Jul 2010) $ +// $Date: 2010-07-02 01:32:03 -0700 (Fri, 02 Jul 2010) $ // $Revision: 63518 $ #include <boost/mpl/aux_/config/overload_resolution.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/config/integral.hpp b/3rdParty/Boost/src/boost/mpl/aux_/config/integral.hpp index 4dec725..6a89160 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/config/integral.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/config/integral.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: integral.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/config/msvc.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/config/intel.hpp b/3rdParty/Boost/src/boost/mpl/aux_/config/intel.hpp index 8f1de76..141a952 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/config/intel.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/config/intel.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: intel.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ diff --git a/3rdParty/Boost/src/boost/mpl/aux_/config/lambda.hpp b/3rdParty/Boost/src/boost/mpl/aux_/config/lambda.hpp index a46b46a..7be16bf 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/config/lambda.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/config/lambda.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: lambda.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/config/ttp.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/config/msvc.hpp b/3rdParty/Boost/src/boost/mpl/aux_/config/msvc.hpp index 18bed83..fe89cda 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/config/msvc.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/config/msvc.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: msvc.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ diff --git a/3rdParty/Boost/src/boost/mpl/aux_/config/msvc_typename.hpp b/3rdParty/Boost/src/boost/mpl/aux_/config/msvc_typename.hpp index 042c804..603e275 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/config/msvc_typename.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/config/msvc_typename.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: msvc_typename.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/config/msvc.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/config/nttp.hpp b/3rdParty/Boost/src/boost/mpl/aux_/config/nttp.hpp index 4873e20..f8bd39e 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/config/nttp.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/config/nttp.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: nttp.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/config/msvc.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/config/overload_resolution.hpp b/3rdParty/Boost/src/boost/mpl/aux_/config/overload_resolution.hpp index 88c3d53..9de579f 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/config/overload_resolution.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/config/overload_resolution.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: overload_resolution.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/config/workaround.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/config/pp_counter.hpp b/3rdParty/Boost/src/boost/mpl/aux_/config/pp_counter.hpp index a4d0715..4592272 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/config/pp_counter.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/config/pp_counter.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: pp_counter.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #if !defined(BOOST_MPL_AUX_PP_COUNTER) diff --git a/3rdParty/Boost/src/boost/mpl/aux_/config/preprocessor.hpp b/3rdParty/Boost/src/boost/mpl/aux_/config/preprocessor.hpp index 52229cd..39190c4 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/config/preprocessor.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/config/preprocessor.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: preprocessor.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/config/workaround.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/config/static_constant.hpp b/3rdParty/Boost/src/boost/mpl/aux_/config/static_constant.hpp index 855d22f..02cf9c4 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/config/static_constant.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/config/static_constant.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: static_constant.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) diff --git a/3rdParty/Boost/src/boost/mpl/aux_/config/ttp.hpp b/3rdParty/Boost/src/boost/mpl/aux_/config/ttp.hpp index a5a0c2c..879ec1d 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/config/ttp.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/config/ttp.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: ttp.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/config/msvc.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/config/typeof.hpp b/3rdParty/Boost/src/boost/mpl/aux_/config/typeof.hpp index aeff9c1..2244d2c 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/config/typeof.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/config/typeof.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: typeof.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/config/gcc.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/config/use_preprocessed.hpp b/3rdParty/Boost/src/boost/mpl/aux_/config/use_preprocessed.hpp index 3bbc229..4494366 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/config/use_preprocessed.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/config/use_preprocessed.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: use_preprocessed.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ // #define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS diff --git a/3rdParty/Boost/src/boost/mpl/aux_/config/workaround.hpp b/3rdParty/Boost/src/boost/mpl/aux_/config/workaround.hpp index 337bcf7..8ec172f 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/config/workaround.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/config/workaround.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: workaround.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/detail/workaround.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/contains_impl.hpp b/3rdParty/Boost/src/boost/mpl/aux_/contains_impl.hpp index 2ee4056..2dcb609 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/contains_impl.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/contains_impl.hpp @@ -12,7 +12,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: contains_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/contains_fwd.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/count_args.hpp b/3rdParty/Boost/src/boost/mpl/aux_/count_args.hpp index 85107dd..1ab000d 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/count_args.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/count_args.hpp @@ -10,7 +10,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: count_args.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/preprocessor/expr_if.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/empty_impl.hpp b/3rdParty/Boost/src/boost/mpl/aux_/empty_impl.hpp index 9a553a7..0b4b979 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/empty_impl.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/empty_impl.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: empty_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/empty_fwd.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/fold_impl.hpp b/3rdParty/Boost/src/boost/mpl/aux_/fold_impl.hpp index 89e42f8..cc64022 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/fold_impl.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/fold_impl.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: fold_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) diff --git a/3rdParty/Boost/src/boost/mpl/aux_/fold_impl_body.hpp b/3rdParty/Boost/src/boost/mpl/aux_/fold_impl_body.hpp index 41f80b4..0750990 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/fold_impl_body.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/fold_impl_body.hpp @@ -12,7 +12,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: fold_impl_body.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ # include <boost/mpl/limits/unrolling.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/front_impl.hpp b/3rdParty/Boost/src/boost/mpl/aux_/front_impl.hpp index 9bfa643..a666e67 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/front_impl.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/front_impl.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: front_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/front_fwd.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/full_lambda.hpp b/3rdParty/Boost/src/boost/mpl/aux_/full_lambda.hpp index dfaaedb..e931199 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/full_lambda.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/full_lambda.hpp @@ -15,7 +15,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: full_lambda.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) diff --git a/3rdParty/Boost/src/boost/mpl/aux_/has_apply.hpp b/3rdParty/Boost/src/boost/mpl/aux_/has_apply.hpp index b77b561..cfb496e 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/has_apply.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/has_apply.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: has_apply.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/has_xxx.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/has_begin.hpp b/3rdParty/Boost/src/boost/mpl/aux_/has_begin.hpp index e7403d2..c2b3bdb 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/has_begin.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/has_begin.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: has_begin.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/has_xxx.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/has_rebind.hpp b/3rdParty/Boost/src/boost/mpl/aux_/has_rebind.hpp index 32cdb83..f07e79e 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/has_rebind.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/has_rebind.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: has_rebind.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/config/msvc.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/has_size.hpp b/3rdParty/Boost/src/boost/mpl/aux_/has_size.hpp index 3f72c44..23588af 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/has_size.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/has_size.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: has_size.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/has_xxx.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/has_tag.hpp b/3rdParty/Boost/src/boost/mpl/aux_/has_tag.hpp index c016ec5..915a8b6 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/has_tag.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/has_tag.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: has_tag.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/has_xxx.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/has_type.hpp b/3rdParty/Boost/src/boost/mpl/aux_/has_type.hpp index 1d301a2..4f05072 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/has_type.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/has_type.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: has_type.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/has_xxx.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/include_preprocessed.hpp b/3rdParty/Boost/src/boost/mpl/aux_/include_preprocessed.hpp index b214eeb..162b05c 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/include_preprocessed.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/include_preprocessed.hpp @@ -10,7 +10,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: include_preprocessed.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/config/compiler.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/inserter_algorithm.hpp b/3rdParty/Boost/src/boost/mpl/aux_/inserter_algorithm.hpp index a6f340c..2d7e1d9 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/inserter_algorithm.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/inserter_algorithm.hpp @@ -12,7 +12,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: inserter_algorithm.hpp 55648 2009-08-18 05:16:53Z agurtovoy $ -// $Date: 2009-08-18 01:16:53 -0400 (Tue, 18 Aug 2009) $ +// $Date: 2009-08-17 22:16:53 -0700 (Mon, 17 Aug 2009) $ // $Revision: 55648 $ #include <boost/mpl/back_inserter.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/integral_wrapper.hpp b/3rdParty/Boost/src/boost/mpl/aux_/integral_wrapper.hpp index 963a738..d36e7cb 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/integral_wrapper.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/integral_wrapper.hpp @@ -8,7 +8,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: integral_wrapper.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ // NO INCLUDE GUARDS, THE HEADER IS INTENDED FOR MULTIPLE INCLUSION! diff --git a/3rdParty/Boost/src/boost/mpl/aux_/is_msvc_eti_arg.hpp b/3rdParty/Boost/src/boost/mpl/aux_/is_msvc_eti_arg.hpp index 322a22e..917b57c 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/is_msvc_eti_arg.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/is_msvc_eti_arg.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: is_msvc_eti_arg.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/yes_no.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/iter_apply.hpp b/3rdParty/Boost/src/boost/mpl/aux_/iter_apply.hpp index fc21f73..fee4d81 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/iter_apply.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/iter_apply.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: iter_apply.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/apply.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/iter_fold_if_impl.hpp b/3rdParty/Boost/src/boost/mpl/aux_/iter_fold_if_impl.hpp index e7c47ea..ad80250 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/iter_fold_if_impl.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/iter_fold_if_impl.hpp @@ -12,7 +12,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: iter_fold_if_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) diff --git a/3rdParty/Boost/src/boost/mpl/aux_/iter_fold_impl.hpp b/3rdParty/Boost/src/boost/mpl/aux_/iter_fold_impl.hpp index 0ea86c3..7bc5720 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/iter_fold_impl.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/iter_fold_impl.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: iter_fold_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) diff --git a/3rdParty/Boost/src/boost/mpl/aux_/lambda_arity_param.hpp b/3rdParty/Boost/src/boost/mpl/aux_/lambda_arity_param.hpp index 720918e..5418f2c 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/lambda_arity_param.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/lambda_arity_param.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: lambda_arity_param.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/config/ttp.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/lambda_no_ctps.hpp b/3rdParty/Boost/src/boost/mpl/aux_/lambda_no_ctps.hpp index cd55fc7..1c383b4 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/lambda_no_ctps.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/lambda_no_ctps.hpp @@ -15,7 +15,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: lambda_no_ctps.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) diff --git a/3rdParty/Boost/src/boost/mpl/aux_/lambda_spec.hpp b/3rdParty/Boost/src/boost/mpl/aux_/lambda_spec.hpp index f167479..52b1dcd 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/lambda_spec.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/lambda_spec.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: lambda_spec.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/void.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/lambda_support.hpp b/3rdParty/Boost/src/boost/mpl/aux_/lambda_support.hpp index fa000d8..2d25348 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/lambda_support.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/lambda_support.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: lambda_support.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/config/lambda.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/largest_int.hpp b/3rdParty/Boost/src/boost/mpl/aux_/largest_int.hpp index 89e987a..1b9f1cf 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/largest_int.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/largest_int.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: largest_int.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/if.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/logical_op.hpp b/3rdParty/Boost/src/boost/mpl/aux_/logical_op.hpp index e4689c9..d964049 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/logical_op.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/logical_op.hpp @@ -8,7 +8,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: logical_op.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ // NO INCLUDE GUARDS, THE HEADER IS INTENDED FOR MULTIPLE INCLUSION! diff --git a/3rdParty/Boost/src/boost/mpl/aux_/msvc_dtw.hpp b/3rdParty/Boost/src/boost/mpl/aux_/msvc_dtw.hpp index 222c477..b8953f5 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/msvc_dtw.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/msvc_dtw.hpp @@ -8,7 +8,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: msvc_dtw.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ // NO INCLUDE GUARDS, THE HEADER IS INTENDED FOR MULTIPLE INCLUSION! diff --git a/3rdParty/Boost/src/boost/mpl/aux_/msvc_eti_base.hpp b/3rdParty/Boost/src/boost/mpl/aux_/msvc_eti_base.hpp index 2c1ada5..61bd38a 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/msvc_eti_base.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/msvc_eti_base.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: msvc_eti_base.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/is_msvc_eti_arg.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/msvc_is_class.hpp b/3rdParty/Boost/src/boost/mpl/aux_/msvc_is_class.hpp index e0ccb38..54a2c57 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/msvc_is_class.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/msvc_is_class.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: msvc_is_class.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/if.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/msvc_never_true.hpp b/3rdParty/Boost/src/boost/mpl/aux_/msvc_never_true.hpp index 93da72e..ca35adc 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/msvc_never_true.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/msvc_never_true.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: msvc_never_true.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/config/msvc.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/msvc_type.hpp b/3rdParty/Boost/src/boost/mpl/aux_/msvc_type.hpp index ab662db..643fd83 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/msvc_type.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/msvc_type.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: msvc_type.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/config/eti.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/na.hpp b/3rdParty/Boost/src/boost/mpl/aux_/na.hpp index 314250c..b75fcdd 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/na.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/na.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: na.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/bool.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/na_assert.hpp b/3rdParty/Boost/src/boost/mpl/aux_/na_assert.hpp index ece7f4c..df88ba3 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/na_assert.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/na_assert.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: na_assert.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/na.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/na_fwd.hpp b/3rdParty/Boost/src/boost/mpl/aux_/na_fwd.hpp index dd64fc1..2409fc8 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/na_fwd.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/na_fwd.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: na_fwd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/adl_barrier.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/na_spec.hpp b/3rdParty/Boost/src/boost/mpl/aux_/na_spec.hpp index 92b2e5a..6cd7721 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/na_spec.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/na_spec.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: na_spec.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) diff --git a/3rdParty/Boost/src/boost/mpl/aux_/nested_type_wknd.hpp b/3rdParty/Boost/src/boost/mpl/aux_/nested_type_wknd.hpp index cee3831..cc46286 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/nested_type_wknd.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/nested_type_wknd.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: nested_type_wknd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/config/gcc.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/nttp_decl.hpp b/3rdParty/Boost/src/boost/mpl/aux_/nttp_decl.hpp index 0fa254d..65e2929 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/nttp_decl.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/nttp_decl.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: nttp_decl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/config/nttp.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/numeric_cast_utils.hpp b/3rdParty/Boost/src/boost/mpl/aux_/numeric_cast_utils.hpp index cc5ea91..11f04ed 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/numeric_cast_utils.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/numeric_cast_utils.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: numeric_cast_utils.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/numeric_cast.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/numeric_op.hpp b/3rdParty/Boost/src/boost/mpl/aux_/numeric_op.hpp index 2b0d6eb..896935c 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/numeric_op.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/numeric_op.hpp @@ -14,7 +14,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: numeric_op.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) diff --git a/3rdParty/Boost/src/boost/mpl/aux_/preprocessor/add.hpp b/3rdParty/Boost/src/boost/mpl/aux_/preprocessor/add.hpp index 9cf4a9a..26a70e7 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/preprocessor/add.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/preprocessor/add.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: add.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/config/preprocessor.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/preprocessor/def_params_tail.hpp b/3rdParty/Boost/src/boost/mpl/aux_/preprocessor/def_params_tail.hpp index 7b0b0af..c51636e 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/preprocessor/def_params_tail.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/preprocessor/def_params_tail.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: def_params_tail.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/limits/arity.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/preprocessor/default_params.hpp b/3rdParty/Boost/src/boost/mpl/aux_/preprocessor/default_params.hpp index 63cf92e..66d6d03 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/preprocessor/default_params.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/preprocessor/default_params.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: default_params.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/config/preprocessor.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/preprocessor/enum.hpp b/3rdParty/Boost/src/boost/mpl/aux_/preprocessor/enum.hpp index a7f95e3..11541a0 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/preprocessor/enum.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/preprocessor/enum.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: enum.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/config/preprocessor.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/preprocessor/ext_params.hpp b/3rdParty/Boost/src/boost/mpl/aux_/preprocessor/ext_params.hpp index 6bbb111..a89535d 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/preprocessor/ext_params.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/preprocessor/ext_params.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: ext_params.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/config/preprocessor.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/preprocessor/filter_params.hpp b/3rdParty/Boost/src/boost/mpl/aux_/preprocessor/filter_params.hpp index 38f3cbf..fefd984 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/preprocessor/filter_params.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/preprocessor/filter_params.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: filter_params.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #define BOOST_MPL_PP_FILTER_PARAMS_0(p1,p2,p3,p4,p5,p6,p7,p8,p9) diff --git a/3rdParty/Boost/src/boost/mpl/aux_/preprocessor/params.hpp b/3rdParty/Boost/src/boost/mpl/aux_/preprocessor/params.hpp index 410a8d0..ac861ec 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/preprocessor/params.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/preprocessor/params.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: params.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/config/preprocessor.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/preprocessor/partial_spec_params.hpp b/3rdParty/Boost/src/boost/mpl/aux_/preprocessor/partial_spec_params.hpp index 346d9cd..e2e1fa9 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/preprocessor/partial_spec_params.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/preprocessor/partial_spec_params.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: partial_spec_params.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/limits/arity.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/preprocessor/range.hpp b/3rdParty/Boost/src/boost/mpl/aux_/preprocessor/range.hpp index cd4c511..e69a9e1 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/preprocessor/range.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/preprocessor/range.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: range.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/preprocessor/seq/subseq.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/preprocessor/repeat.hpp b/3rdParty/Boost/src/boost/mpl/aux_/preprocessor/repeat.hpp index cfebe04..2c314ec 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/preprocessor/repeat.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/preprocessor/repeat.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: repeat.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/config/preprocessor.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/preprocessor/sub.hpp b/3rdParty/Boost/src/boost/mpl/aux_/preprocessor/sub.hpp index 8ba8132..7f5e291 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/preprocessor/sub.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/preprocessor/sub.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: sub.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/config/preprocessor.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/preprocessor/tuple.hpp b/3rdParty/Boost/src/boost/mpl/aux_/preprocessor/tuple.hpp index f46d0e9..ed59407 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/preprocessor/tuple.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/preprocessor/tuple.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: tuple.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #define BOOST_MPL_PP_TUPLE_11_ELEM_0(e0,e1,e2,e3,e4,e5,e6,e7,e8,e9,e10) e0 diff --git a/3rdParty/Boost/src/boost/mpl/aux_/push_back_impl.hpp b/3rdParty/Boost/src/boost/mpl/aux_/push_back_impl.hpp index 2f839cb..732c43c 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/push_back_impl.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/push_back_impl.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: push_back_impl.hpp 55679 2009-08-20 07:50:16Z agurtovoy $ -// $Date: 2009-08-20 03:50:16 -0400 (Thu, 20 Aug 2009) $ +// $Date: 2009-08-20 00:50:16 -0700 (Thu, 20 Aug 2009) $ // $Revision: 55679 $ #include <boost/mpl/push_back_fwd.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/push_front_impl.hpp b/3rdParty/Boost/src/boost/mpl/aux_/push_front_impl.hpp index 6723ea3..ae1bc22 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/push_front_impl.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/push_front_impl.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: push_front_impl.hpp 55679 2009-08-20 07:50:16Z agurtovoy $ -// $Date: 2009-08-20 03:50:16 -0400 (Thu, 20 Aug 2009) $ +// $Date: 2009-08-20 00:50:16 -0700 (Thu, 20 Aug 2009) $ // $Revision: 55679 $ #include <boost/mpl/push_front_fwd.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/reverse_fold_impl.hpp b/3rdParty/Boost/src/boost/mpl/aux_/reverse_fold_impl.hpp index b8e2308..9c17c01 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/reverse_fold_impl.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/reverse_fold_impl.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: reverse_fold_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) diff --git a/3rdParty/Boost/src/boost/mpl/aux_/reverse_fold_impl_body.hpp b/3rdParty/Boost/src/boost/mpl/aux_/reverse_fold_impl_body.hpp index 7bd5618..c815e0a 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/reverse_fold_impl_body.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/reverse_fold_impl_body.hpp @@ -12,7 +12,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: reverse_fold_impl_body.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ # include <boost/mpl/limits/unrolling.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/sequence_wrapper.hpp b/3rdParty/Boost/src/boost/mpl/aux_/sequence_wrapper.hpp index 3f9f8ca..8b49c74 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/sequence_wrapper.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/sequence_wrapper.hpp @@ -14,7 +14,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: sequence_wrapper.hpp 49271 2008-10-11 06:46:00Z agurtovoy $ -// $Date: 2008-10-11 02:46:00 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:46:00 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49271 $ # include <boost/mpl/aux_/config/ctps.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/size_impl.hpp b/3rdParty/Boost/src/boost/mpl/aux_/size_impl.hpp index 0e4885d..73dc50d 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/size_impl.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/size_impl.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: size_impl.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/size_fwd.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/static_cast.hpp b/3rdParty/Boost/src/boost/mpl/aux_/static_cast.hpp index 133730d..8c12128 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/static_cast.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/static_cast.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: static_cast.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/config/workaround.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/template_arity.hpp b/3rdParty/Boost/src/boost/mpl/aux_/template_arity.hpp index ed26ea2..5e3f6e0 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/template_arity.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/template_arity.hpp @@ -15,7 +15,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: template_arity.hpp 61584 2010-04-26 18:48:26Z agurtovoy $ -// $Date: 2010-04-26 14:48:26 -0400 (Mon, 26 Apr 2010) $ +// $Date: 2010-04-26 11:48:26 -0700 (Mon, 26 Apr 2010) $ // $Revision: 61584 $ #include <boost/mpl/aux_/config/ttp.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/template_arity_fwd.hpp b/3rdParty/Boost/src/boost/mpl/aux_/template_arity_fwd.hpp index 4b7c8b8..44bc9d2 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/template_arity_fwd.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/template_arity_fwd.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: template_arity_fwd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ namespace boost { namespace mpl { namespace aux { diff --git a/3rdParty/Boost/src/boost/mpl/aux_/traits_lambda_spec.hpp b/3rdParty/Boost/src/boost/mpl/aux_/traits_lambda_spec.hpp index f312f6d..c9b60fe 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/traits_lambda_spec.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/traits_lambda_spec.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: traits_lambda_spec.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/sequence_tag_fwd.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/type_wrapper.hpp b/3rdParty/Boost/src/boost/mpl/aux_/type_wrapper.hpp index 0583f72..6d6091b 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/type_wrapper.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/type_wrapper.hpp @@ -12,7 +12,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: type_wrapper.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/config/ctps.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/value_wknd.hpp b/3rdParty/Boost/src/boost/mpl/aux_/value_wknd.hpp index 9de1103..7baa8bf 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/value_wknd.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/value_wknd.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: value_wknd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/static_cast.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/aux_/yes_no.hpp b/3rdParty/Boost/src/boost/mpl/aux_/yes_no.hpp index c3f567d..ebcb00d 100644 --- a/3rdParty/Boost/src/boost/mpl/aux_/yes_no.hpp +++ b/3rdParty/Boost/src/boost/mpl/aux_/yes_no.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: yes_no.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/nttp_decl.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/back_fwd.hpp b/3rdParty/Boost/src/boost/mpl/back_fwd.hpp index cc01e33..c8b1fe9 100644 --- a/3rdParty/Boost/src/boost/mpl/back_fwd.hpp +++ b/3rdParty/Boost/src/boost/mpl/back_fwd.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: back_fwd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ namespace boost { namespace mpl { diff --git a/3rdParty/Boost/src/boost/mpl/back_inserter.hpp b/3rdParty/Boost/src/boost/mpl/back_inserter.hpp index fa4ede8..ce2a284 100644 --- a/3rdParty/Boost/src/boost/mpl/back_inserter.hpp +++ b/3rdParty/Boost/src/boost/mpl/back_inserter.hpp @@ -12,7 +12,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: back_inserter.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/push_back.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/begin_end.hpp b/3rdParty/Boost/src/boost/mpl/begin_end.hpp index 7d8d9eb..6c3accc 100644 --- a/3rdParty/Boost/src/boost/mpl/begin_end.hpp +++ b/3rdParty/Boost/src/boost/mpl/begin_end.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: begin_end.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/begin_end_fwd.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/begin_end_fwd.hpp b/3rdParty/Boost/src/boost/mpl/begin_end_fwd.hpp index 1ac62c6..d1edaca 100644 --- a/3rdParty/Boost/src/boost/mpl/begin_end_fwd.hpp +++ b/3rdParty/Boost/src/boost/mpl/begin_end_fwd.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: begin_end_fwd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ namespace boost { namespace mpl { diff --git a/3rdParty/Boost/src/boost/mpl/bind.hpp b/3rdParty/Boost/src/boost/mpl/bind.hpp index 5d851ef..25e46b4 100644 --- a/3rdParty/Boost/src/boost/mpl/bind.hpp +++ b/3rdParty/Boost/src/boost/mpl/bind.hpp @@ -16,7 +16,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: bind.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) diff --git a/3rdParty/Boost/src/boost/mpl/bind_fwd.hpp b/3rdParty/Boost/src/boost/mpl/bind_fwd.hpp index 18ac881..35795ac 100644 --- a/3rdParty/Boost/src/boost/mpl/bind_fwd.hpp +++ b/3rdParty/Boost/src/boost/mpl/bind_fwd.hpp @@ -15,7 +15,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: bind_fwd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) diff --git a/3rdParty/Boost/src/boost/mpl/bool.hpp b/3rdParty/Boost/src/boost/mpl/bool.hpp index a815ac5..cabf22f 100644 --- a/3rdParty/Boost/src/boost/mpl/bool.hpp +++ b/3rdParty/Boost/src/boost/mpl/bool.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: bool.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/bool_fwd.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/bool_fwd.hpp b/3rdParty/Boost/src/boost/mpl/bool_fwd.hpp index 080d876..e71ab9c 100644 --- a/3rdParty/Boost/src/boost/mpl/bool_fwd.hpp +++ b/3rdParty/Boost/src/boost/mpl/bool_fwd.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: bool_fwd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/adl_barrier.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/clear.hpp b/3rdParty/Boost/src/boost/mpl/clear.hpp index c27f4b3..9cf16fa 100644 --- a/3rdParty/Boost/src/boost/mpl/clear.hpp +++ b/3rdParty/Boost/src/boost/mpl/clear.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: clear.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/clear_fwd.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/clear_fwd.hpp b/3rdParty/Boost/src/boost/mpl/clear_fwd.hpp index da5a6eb..e660bc2 100644 --- a/3rdParty/Boost/src/boost/mpl/clear_fwd.hpp +++ b/3rdParty/Boost/src/boost/mpl/clear_fwd.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: clear_fwd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ namespace boost { namespace mpl { diff --git a/3rdParty/Boost/src/boost/mpl/comparison.hpp b/3rdParty/Boost/src/boost/mpl/comparison.hpp new file mode 100644 index 0000000..223b9ef --- /dev/null +++ b/3rdParty/Boost/src/boost/mpl/comparison.hpp @@ -0,0 +1,24 @@ + +#ifndef BOOST_MPL_COMPARISON_HPP_INCLUDED +#define BOOST_MPL_COMPARISON_HPP_INCLUDED + +// Copyright Aleksey Gurtovoy 2000-2004 +// +// 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) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id: comparison.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ +// $Revision: 49267 $ + +#include <boost/mpl/equal_to.hpp> +#include <boost/mpl/not_equal_to.hpp> +#include <boost/mpl/less.hpp> +#include <boost/mpl/greater.hpp> +#include <boost/mpl/less_equal.hpp> +#include <boost/mpl/greater_equal.hpp> + +#endif // BOOST_MPL_COMPARISON_HPP_INCLUDED diff --git a/3rdParty/Boost/src/boost/mpl/contains.hpp b/3rdParty/Boost/src/boost/mpl/contains.hpp index 68e50bb..620fe41 100644 --- a/3rdParty/Boost/src/boost/mpl/contains.hpp +++ b/3rdParty/Boost/src/boost/mpl/contains.hpp @@ -12,7 +12,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: contains.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/contains_fwd.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/contains_fwd.hpp b/3rdParty/Boost/src/boost/mpl/contains_fwd.hpp index 57ae63f..af7721a 100644 --- a/3rdParty/Boost/src/boost/mpl/contains_fwd.hpp +++ b/3rdParty/Boost/src/boost/mpl/contains_fwd.hpp @@ -12,7 +12,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: contains_fwd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ namespace boost { namespace mpl { diff --git a/3rdParty/Boost/src/boost/mpl/copy.hpp b/3rdParty/Boost/src/boost/mpl/copy.hpp index 77376d0..6849ec8 100644 --- a/3rdParty/Boost/src/boost/mpl/copy.hpp +++ b/3rdParty/Boost/src/boost/mpl/copy.hpp @@ -12,7 +12,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: copy.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/fold.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/deref.hpp b/3rdParty/Boost/src/boost/mpl/deref.hpp index fedf79e..15479e1 100644 --- a/3rdParty/Boost/src/boost/mpl/deref.hpp +++ b/3rdParty/Boost/src/boost/mpl/deref.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: deref.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/msvc_type.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/distance.hpp b/3rdParty/Boost/src/boost/mpl/distance.hpp index 9a180ab..8ecd3c1 100644 --- a/3rdParty/Boost/src/boost/mpl/distance.hpp +++ b/3rdParty/Boost/src/boost/mpl/distance.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: distance.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/distance_fwd.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/distance_fwd.hpp b/3rdParty/Boost/src/boost/mpl/distance_fwd.hpp index ddd8698..766ceb4 100644 --- a/3rdParty/Boost/src/boost/mpl/distance_fwd.hpp +++ b/3rdParty/Boost/src/boost/mpl/distance_fwd.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: distance_fwd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/common_name_wknd.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/empty.hpp b/3rdParty/Boost/src/boost/mpl/empty.hpp index adb3c76..e25c04c 100644 --- a/3rdParty/Boost/src/boost/mpl/empty.hpp +++ b/3rdParty/Boost/src/boost/mpl/empty.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: empty.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/empty_fwd.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/empty_fwd.hpp b/3rdParty/Boost/src/boost/mpl/empty_fwd.hpp index 28b2263..4bf6868 100644 --- a/3rdParty/Boost/src/boost/mpl/empty_fwd.hpp +++ b/3rdParty/Boost/src/boost/mpl/empty_fwd.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: empty_fwd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ namespace boost { namespace mpl { diff --git a/3rdParty/Boost/src/boost/mpl/equal.hpp b/3rdParty/Boost/src/boost/mpl/equal.hpp new file mode 100644 index 0000000..09e26db --- /dev/null +++ b/3rdParty/Boost/src/boost/mpl/equal.hpp @@ -0,0 +1,112 @@ + +#ifndef BOOST_MPL_EQUAL_HPP_INCLUDED +#define BOOST_MPL_EQUAL_HPP_INCLUDED + +// Copyright Aleksey Gurtovoy 2000-2004 +// +// 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) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id: equal.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ +// $Revision: 49267 $ + +#include <boost/mpl/aux_/iter_fold_if_impl.hpp> +#include <boost/mpl/aux_/iter_apply.hpp> +#include <boost/mpl/and.hpp> +#include <boost/mpl/not.hpp> +#include <boost/mpl/begin_end.hpp> +#include <boost/mpl/next.hpp> +#include <boost/mpl/always.hpp> +#include <boost/mpl/bool.hpp> +#include <boost/mpl/lambda.hpp> +#include <boost/mpl/bind.hpp> +#include <boost/mpl/apply.hpp> +#include <boost/mpl/void.hpp> +#include <boost/mpl/aux_/na_spec.hpp> +#include <boost/mpl/aux_/lambda_support.hpp> +#include <boost/mpl/aux_/msvc_eti_base.hpp> + +#include <boost/type_traits/is_same.hpp> + +namespace boost { namespace mpl { + +namespace aux { + +template< + typename Predicate + , typename LastIterator1 + , typename LastIterator2 + > +struct equal_pred +{ + template< + typename Iterator2 + , typename Iterator1 + > + struct apply + { + typedef typename and_< + not_< is_same<Iterator1,LastIterator1> > + , not_< is_same<Iterator2,LastIterator2> > + , aux::iter_apply2<Predicate,Iterator1,Iterator2> + >::type type; + }; +}; + +template< + typename Sequence1 + , typename Sequence2 + , typename Predicate + > +struct equal_impl +{ + typedef typename begin<Sequence1>::type first1_; + typedef typename begin<Sequence2>::type first2_; + typedef typename end<Sequence1>::type last1_; + typedef typename end<Sequence2>::type last2_; + + typedef aux::iter_fold_if_impl< + first1_ + , first2_ + , next<> + , protect< aux::equal_pred<Predicate,last1_,last2_> > + , void_ + , always<false_> + > fold_; + + typedef typename fold_::iterator iter1_; + typedef typename fold_::state iter2_; + typedef and_< + is_same<iter1_,last1_> + , is_same<iter2_,last2_> + > result_; + + typedef typename result_::type type; +}; + + +} // namespace aux + + +template< + typename BOOST_MPL_AUX_NA_PARAM(Sequence1) + , typename BOOST_MPL_AUX_NA_PARAM(Sequence2) + , typename Predicate = is_same<_,_> + > +struct equal + : aux::msvc_eti_base< + typename aux::equal_impl<Sequence1,Sequence2,Predicate>::type + >::type +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT(2,equal,(Sequence1,Sequence2)) +}; + +BOOST_MPL_AUX_NA_SPEC(2, equal) + +}} + +#endif // BOOST_MPL_EQUAL_HPP_INCLUDED diff --git a/3rdParty/Boost/src/boost/mpl/equal_to.hpp b/3rdParty/Boost/src/boost/mpl/equal_to.hpp index dee5f59..359031c 100644 --- a/3rdParty/Boost/src/boost/mpl/equal_to.hpp +++ b/3rdParty/Boost/src/boost/mpl/equal_to.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: equal_to.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #define AUX778076_OP_NAME equal_to diff --git a/3rdParty/Boost/src/boost/mpl/eval_if.hpp b/3rdParty/Boost/src/boost/mpl/eval_if.hpp index d483c72..f1a5b70 100644 --- a/3rdParty/Boost/src/boost/mpl/eval_if.hpp +++ b/3rdParty/Boost/src/boost/mpl/eval_if.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: eval_if.hpp 61921 2010-05-11 21:33:24Z neilgroves $ -// $Date: 2010-05-11 17:33:24 -0400 (Tue, 11 May 2010) $ +// $Date: 2010-05-11 14:33:24 -0700 (Tue, 11 May 2010) $ // $Revision: 61921 $ #include <boost/mpl/if.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/find.hpp b/3rdParty/Boost/src/boost/mpl/find.hpp index 6d71a88..7b09423 100644 --- a/3rdParty/Boost/src/boost/mpl/find.hpp +++ b/3rdParty/Boost/src/boost/mpl/find.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: find.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/find_if.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/find_if.hpp b/3rdParty/Boost/src/boost/mpl/find_if.hpp index b1d41b7..a066e71 100644 --- a/3rdParty/Boost/src/boost/mpl/find_if.hpp +++ b/3rdParty/Boost/src/boost/mpl/find_if.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: find_if.hpp 49274 2008-10-11 07:22:05Z agurtovoy $ -// $Date: 2008-10-11 03:22:05 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-11 00:22:05 -0700 (Sat, 11 Oct 2008) $ // $Revision: 49274 $ #include <boost/mpl/aux_/find_if_pred.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/fold.hpp b/3rdParty/Boost/src/boost/mpl/fold.hpp index 9645681..e5e02bd 100644 --- a/3rdParty/Boost/src/boost/mpl/fold.hpp +++ b/3rdParty/Boost/src/boost/mpl/fold.hpp @@ -12,7 +12,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: fold.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/begin_end.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/front.hpp b/3rdParty/Boost/src/boost/mpl/front.hpp index 3ad64e4..b2c5678 100644 --- a/3rdParty/Boost/src/boost/mpl/front.hpp +++ b/3rdParty/Boost/src/boost/mpl/front.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: front.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/front_fwd.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/front_fwd.hpp b/3rdParty/Boost/src/boost/mpl/front_fwd.hpp index 65ffcf2..6275001 100644 --- a/3rdParty/Boost/src/boost/mpl/front_fwd.hpp +++ b/3rdParty/Boost/src/boost/mpl/front_fwd.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: front_fwd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ namespace boost { namespace mpl { diff --git a/3rdParty/Boost/src/boost/mpl/front_inserter.hpp b/3rdParty/Boost/src/boost/mpl/front_inserter.hpp index ee754cf..7220f76 100644 --- a/3rdParty/Boost/src/boost/mpl/front_inserter.hpp +++ b/3rdParty/Boost/src/boost/mpl/front_inserter.hpp @@ -12,7 +12,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: front_inserter.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/push_front.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/greater.hpp b/3rdParty/Boost/src/boost/mpl/greater.hpp new file mode 100644 index 0000000..c73276b --- /dev/null +++ b/3rdParty/Boost/src/boost/mpl/greater.hpp @@ -0,0 +1,21 @@ + +#ifndef BOOST_MPL_GREATER_HPP_INCLUDED +#define BOOST_MPL_GREATER_HPP_INCLUDED + +// Copyright Aleksey Gurtovoy 2000-2004 +// +// 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) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id: greater.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ +// $Revision: 49267 $ + +#define AUX778076_OP_NAME greater +#define AUX778076_OP_TOKEN > +#include <boost/mpl/aux_/comparison_op.hpp> + +#endif // BOOST_MPL_GREATER_HPP_INCLUDED diff --git a/3rdParty/Boost/src/boost/mpl/greater_equal.hpp b/3rdParty/Boost/src/boost/mpl/greater_equal.hpp new file mode 100644 index 0000000..119710f --- /dev/null +++ b/3rdParty/Boost/src/boost/mpl/greater_equal.hpp @@ -0,0 +1,21 @@ + +#ifndef BOOST_MPL_GREATER_EQUAL_HPP_INCLUDED +#define BOOST_MPL_GREATER_EQUAL_HPP_INCLUDED + +// Copyright Aleksey Gurtovoy 2000-2004 +// +// 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) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id: greater_equal.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ +// $Revision: 49267 $ + +#define AUX778076_OP_NAME greater_equal +#define AUX778076_OP_TOKEN >= +#include <boost/mpl/aux_/comparison_op.hpp> + +#endif // BOOST_MPL_GREATER_EQUAL_HPP_INCLUDED diff --git a/3rdParty/Boost/src/boost/mpl/has_xxx.hpp b/3rdParty/Boost/src/boost/mpl/has_xxx.hpp index 9258759..121bc48 100644 --- a/3rdParty/Boost/src/boost/mpl/has_xxx.hpp +++ b/3rdParty/Boost/src/boost/mpl/has_xxx.hpp @@ -13,7 +13,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: has_xxx.hpp 64146 2010-07-19 00:46:31Z djwalker $ -// $Date: 2010-07-18 20:46:31 -0400 (Sun, 18 Jul 2010) $ +// $Date: 2010-07-18 17:46:31 -0700 (Sun, 18 Jul 2010) $ // $Revision: 64146 $ #include <boost/mpl/bool.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/identity.hpp b/3rdParty/Boost/src/boost/mpl/identity.hpp index d72540b..5424f71 100644 --- a/3rdParty/Boost/src/boost/mpl/identity.hpp +++ b/3rdParty/Boost/src/boost/mpl/identity.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: identity.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/na_spec.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/if.hpp b/3rdParty/Boost/src/boost/mpl/if.hpp index aa14d88..245c993 100644 --- a/3rdParty/Boost/src/boost/mpl/if.hpp +++ b/3rdParty/Boost/src/boost/mpl/if.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: if.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/value_wknd.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/inserter.hpp b/3rdParty/Boost/src/boost/mpl/inserter.hpp index 8e2c676..0c014d1 100644 --- a/3rdParty/Boost/src/boost/mpl/inserter.hpp +++ b/3rdParty/Boost/src/boost/mpl/inserter.hpp @@ -12,7 +12,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: inserter.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ namespace boost { namespace mpl { diff --git a/3rdParty/Boost/src/boost/mpl/int.hpp b/3rdParty/Boost/src/boost/mpl/int.hpp index 971ca90..14db548 100644 --- a/3rdParty/Boost/src/boost/mpl/int.hpp +++ b/3rdParty/Boost/src/boost/mpl/int.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: int.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/int_fwd.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/int_fwd.hpp b/3rdParty/Boost/src/boost/mpl/int_fwd.hpp index 0a0140f..87b043c 100644 --- a/3rdParty/Boost/src/boost/mpl/int_fwd.hpp +++ b/3rdParty/Boost/src/boost/mpl/int_fwd.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: int_fwd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/adl_barrier.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/integral_c.hpp b/3rdParty/Boost/src/boost/mpl/integral_c.hpp index 6c4d2bc..e270dc5 100644 --- a/3rdParty/Boost/src/boost/mpl/integral_c.hpp +++ b/3rdParty/Boost/src/boost/mpl/integral_c.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: integral_c.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/integral_c_fwd.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/integral_c_fwd.hpp b/3rdParty/Boost/src/boost/mpl/integral_c_fwd.hpp index 46da935..7fcbfd5 100644 --- a/3rdParty/Boost/src/boost/mpl/integral_c_fwd.hpp +++ b/3rdParty/Boost/src/boost/mpl/integral_c_fwd.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: integral_c_fwd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/config/workaround.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/integral_c_tag.hpp b/3rdParty/Boost/src/boost/mpl/integral_c_tag.hpp index 2b43e79..27da563 100644 --- a/3rdParty/Boost/src/boost/mpl/integral_c_tag.hpp +++ b/3rdParty/Boost/src/boost/mpl/integral_c_tag.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: integral_c_tag.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ diff --git a/3rdParty/Boost/src/boost/mpl/is_placeholder.hpp b/3rdParty/Boost/src/boost/mpl/is_placeholder.hpp index 5b28b47..565df89 100644 --- a/3rdParty/Boost/src/boost/mpl/is_placeholder.hpp +++ b/3rdParty/Boost/src/boost/mpl/is_placeholder.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: is_placeholder.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/arg_fwd.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/is_sequence.hpp b/3rdParty/Boost/src/boost/mpl/is_sequence.hpp index 0c1f67b..4e61fcf 100644 --- a/3rdParty/Boost/src/boost/mpl/is_sequence.hpp +++ b/3rdParty/Boost/src/boost/mpl/is_sequence.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: is_sequence.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/not.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/iter_fold.hpp b/3rdParty/Boost/src/boost/mpl/iter_fold.hpp index cb24707..1b52dd4 100644 --- a/3rdParty/Boost/src/boost/mpl/iter_fold.hpp +++ b/3rdParty/Boost/src/boost/mpl/iter_fold.hpp @@ -12,7 +12,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: iter_fold.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/begin_end.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/iter_fold_if.hpp b/3rdParty/Boost/src/boost/mpl/iter_fold_if.hpp index da80564..01847ef 100644 --- a/3rdParty/Boost/src/boost/mpl/iter_fold_if.hpp +++ b/3rdParty/Boost/src/boost/mpl/iter_fold_if.hpp @@ -12,7 +12,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: iter_fold_if.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/begin_end.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/iterator_category.hpp b/3rdParty/Boost/src/boost/mpl/iterator_category.hpp index 084c32f..6ccc1b1 100644 --- a/3rdParty/Boost/src/boost/mpl/iterator_category.hpp +++ b/3rdParty/Boost/src/boost/mpl/iterator_category.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: iterator_category.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/na_spec.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/iterator_range.hpp b/3rdParty/Boost/src/boost/mpl/iterator_range.hpp index d3fd43b..995ddc0 100644 --- a/3rdParty/Boost/src/boost/mpl/iterator_range.hpp +++ b/3rdParty/Boost/src/boost/mpl/iterator_range.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: iterator_range.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/na_spec.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/iterator_tags.hpp b/3rdParty/Boost/src/boost/mpl/iterator_tags.hpp index 46431a3..fce2734 100644 --- a/3rdParty/Boost/src/boost/mpl/iterator_tags.hpp +++ b/3rdParty/Boost/src/boost/mpl/iterator_tags.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: iterator_tags.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/int.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/lambda.hpp b/3rdParty/Boost/src/boost/mpl/lambda.hpp index 165135f..05c2716 100644 --- a/3rdParty/Boost/src/boost/mpl/lambda.hpp +++ b/3rdParty/Boost/src/boost/mpl/lambda.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: lambda.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/lambda_fwd.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/lambda_fwd.hpp b/3rdParty/Boost/src/boost/mpl/lambda_fwd.hpp index f02837b..16c73e4 100644 --- a/3rdParty/Boost/src/boost/mpl/lambda_fwd.hpp +++ b/3rdParty/Boost/src/boost/mpl/lambda_fwd.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: lambda_fwd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/void_fwd.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/less.hpp b/3rdParty/Boost/src/boost/mpl/less.hpp index 11d860d..33a570c 100644 --- a/3rdParty/Boost/src/boost/mpl/less.hpp +++ b/3rdParty/Boost/src/boost/mpl/less.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: less.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #define AUX778076_OP_NAME less diff --git a/3rdParty/Boost/src/boost/mpl/less_equal.hpp b/3rdParty/Boost/src/boost/mpl/less_equal.hpp new file mode 100644 index 0000000..8b9a4ff --- /dev/null +++ b/3rdParty/Boost/src/boost/mpl/less_equal.hpp @@ -0,0 +1,21 @@ + +#ifndef BOOST_MPL_LESS_EQUAL_HPP_INCLUDED +#define BOOST_MPL_LESS_EQUAL_HPP_INCLUDED + +// Copyright Aleksey Gurtovoy 2000-2004 +// +// 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) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id: less_equal.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ +// $Revision: 49267 $ + +#define AUX778076_OP_NAME less_equal +#define AUX778076_OP_TOKEN <= +#include <boost/mpl/aux_/comparison_op.hpp> + +#endif // BOOST_MPL_LESS_EQUAL_HPP_INCLUDED diff --git a/3rdParty/Boost/src/boost/mpl/limits/arity.hpp b/3rdParty/Boost/src/boost/mpl/limits/arity.hpp index 91e4606..9da70ab 100644 --- a/3rdParty/Boost/src/boost/mpl/limits/arity.hpp +++ b/3rdParty/Boost/src/boost/mpl/limits/arity.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: arity.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #if !defined(BOOST_MPL_LIMIT_METAFUNCTION_ARITY) diff --git a/3rdParty/Boost/src/boost/mpl/limits/list.hpp b/3rdParty/Boost/src/boost/mpl/limits/list.hpp index ee9c7aa..6ae7387 100644 --- a/3rdParty/Boost/src/boost/mpl/limits/list.hpp +++ b/3rdParty/Boost/src/boost/mpl/limits/list.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: list.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #if !defined(BOOST_MPL_LIMIT_LIST_SIZE) diff --git a/3rdParty/Boost/src/boost/mpl/limits/unrolling.hpp b/3rdParty/Boost/src/boost/mpl/limits/unrolling.hpp index 4ba3efb..3914f0a 100644 --- a/3rdParty/Boost/src/boost/mpl/limits/unrolling.hpp +++ b/3rdParty/Boost/src/boost/mpl/limits/unrolling.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: unrolling.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #if !defined(BOOST_MPL_LIMIT_UNROLLING) diff --git a/3rdParty/Boost/src/boost/mpl/limits/vector.hpp b/3rdParty/Boost/src/boost/mpl/limits/vector.hpp index 9a0accf..5de3811 100644 --- a/3rdParty/Boost/src/boost/mpl/limits/vector.hpp +++ b/3rdParty/Boost/src/boost/mpl/limits/vector.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: vector.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #if !defined(BOOST_MPL_LIMIT_VECTOR_SIZE) diff --git a/3rdParty/Boost/src/boost/mpl/list.hpp b/3rdParty/Boost/src/boost/mpl/list.hpp index 838b8f4..6d96831 100644 --- a/3rdParty/Boost/src/boost/mpl/list.hpp +++ b/3rdParty/Boost/src/boost/mpl/list.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: list.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) diff --git a/3rdParty/Boost/src/boost/mpl/list/aux_/O1_size.hpp b/3rdParty/Boost/src/boost/mpl/list/aux_/O1_size.hpp index 6ef2cf7..0d93dab 100644 --- a/3rdParty/Boost/src/boost/mpl/list/aux_/O1_size.hpp +++ b/3rdParty/Boost/src/boost/mpl/list/aux_/O1_size.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: O1_size.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/O1_size_fwd.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/list/aux_/begin_end.hpp b/3rdParty/Boost/src/boost/mpl/list/aux_/begin_end.hpp index dab60f3..7fbddad 100644 --- a/3rdParty/Boost/src/boost/mpl/list/aux_/begin_end.hpp +++ b/3rdParty/Boost/src/boost/mpl/list/aux_/begin_end.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: begin_end.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/begin_end_fwd.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/list/aux_/clear.hpp b/3rdParty/Boost/src/boost/mpl/list/aux_/clear.hpp index 247a4de..3deafe7 100644 --- a/3rdParty/Boost/src/boost/mpl/list/aux_/clear.hpp +++ b/3rdParty/Boost/src/boost/mpl/list/aux_/clear.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: clear.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/clear_fwd.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/list/aux_/empty.hpp b/3rdParty/Boost/src/boost/mpl/list/aux_/empty.hpp index 6ab60cf..c282cfe 100644 --- a/3rdParty/Boost/src/boost/mpl/list/aux_/empty.hpp +++ b/3rdParty/Boost/src/boost/mpl/list/aux_/empty.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: empty.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/empty_fwd.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/list/aux_/front.hpp b/3rdParty/Boost/src/boost/mpl/list/aux_/front.hpp index 8defa99..eb0b689 100644 --- a/3rdParty/Boost/src/boost/mpl/list/aux_/front.hpp +++ b/3rdParty/Boost/src/boost/mpl/list/aux_/front.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: front.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/front_fwd.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/list/aux_/include_preprocessed.hpp b/3rdParty/Boost/src/boost/mpl/list/aux_/include_preprocessed.hpp index 431b51f..4e7f6e4 100644 --- a/3rdParty/Boost/src/boost/mpl/list/aux_/include_preprocessed.hpp +++ b/3rdParty/Boost/src/boost/mpl/list/aux_/include_preprocessed.hpp @@ -8,7 +8,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: include_preprocessed.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ // NO INCLUDE GUARDS, THE HEADER IS INTENDED FOR MULTIPLE INCLUSION! diff --git a/3rdParty/Boost/src/boost/mpl/list/aux_/item.hpp b/3rdParty/Boost/src/boost/mpl/list/aux_/item.hpp index 37ddff7..24b5e40 100644 --- a/3rdParty/Boost/src/boost/mpl/list/aux_/item.hpp +++ b/3rdParty/Boost/src/boost/mpl/list/aux_/item.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: item.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/long.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/list/aux_/iterator.hpp b/3rdParty/Boost/src/boost/mpl/list/aux_/iterator.hpp index b94126c..4d0431f 100644 --- a/3rdParty/Boost/src/boost/mpl/list/aux_/iterator.hpp +++ b/3rdParty/Boost/src/boost/mpl/list/aux_/iterator.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: iterator.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/iterator_tags.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/list/aux_/numbered.hpp b/3rdParty/Boost/src/boost/mpl/list/aux_/numbered.hpp index de8d404..7b661e5 100644 --- a/3rdParty/Boost/src/boost/mpl/list/aux_/numbered.hpp +++ b/3rdParty/Boost/src/boost/mpl/list/aux_/numbered.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: numbered.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #if defined(BOOST_PP_IS_ITERATING) diff --git a/3rdParty/Boost/src/boost/mpl/list/aux_/numbered_c.hpp b/3rdParty/Boost/src/boost/mpl/list/aux_/numbered_c.hpp index f304382..0c8e9f6 100644 --- a/3rdParty/Boost/src/boost/mpl/list/aux_/numbered_c.hpp +++ b/3rdParty/Boost/src/boost/mpl/list/aux_/numbered_c.hpp @@ -10,7 +10,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: numbered_c.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #if defined(BOOST_PP_IS_ITERATING) diff --git a/3rdParty/Boost/src/boost/mpl/list/aux_/pop_front.hpp b/3rdParty/Boost/src/boost/mpl/list/aux_/pop_front.hpp index e053391..9c72228 100644 --- a/3rdParty/Boost/src/boost/mpl/list/aux_/pop_front.hpp +++ b/3rdParty/Boost/src/boost/mpl/list/aux_/pop_front.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: pop_front.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/pop_front_fwd.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/list/aux_/push_back.hpp b/3rdParty/Boost/src/boost/mpl/list/aux_/push_back.hpp index 6adb7db..8e9c34b 100644 --- a/3rdParty/Boost/src/boost/mpl/list/aux_/push_back.hpp +++ b/3rdParty/Boost/src/boost/mpl/list/aux_/push_back.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: push_back.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/push_back_fwd.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/list/aux_/push_front.hpp b/3rdParty/Boost/src/boost/mpl/list/aux_/push_front.hpp index a601fea..942508b 100644 --- a/3rdParty/Boost/src/boost/mpl/list/aux_/push_front.hpp +++ b/3rdParty/Boost/src/boost/mpl/list/aux_/push_front.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: push_front.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/push_front_fwd.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/list/aux_/size.hpp b/3rdParty/Boost/src/boost/mpl/list/aux_/size.hpp index 4ecbab8..9d7191f 100644 --- a/3rdParty/Boost/src/boost/mpl/list/aux_/size.hpp +++ b/3rdParty/Boost/src/boost/mpl/list/aux_/size.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: size.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/size_fwd.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/list/aux_/tag.hpp b/3rdParty/Boost/src/boost/mpl/list/aux_/tag.hpp index d44bfe4..e1a7533 100644 --- a/3rdParty/Boost/src/boost/mpl/list/aux_/tag.hpp +++ b/3rdParty/Boost/src/boost/mpl/list/aux_/tag.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: tag.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ namespace boost { namespace mpl { namespace aux { diff --git a/3rdParty/Boost/src/boost/mpl/list/list0.hpp b/3rdParty/Boost/src/boost/mpl/list/list0.hpp index 58e93cf..3ecdac3 100644 --- a/3rdParty/Boost/src/boost/mpl/list/list0.hpp +++ b/3rdParty/Boost/src/boost/mpl/list/list0.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: list0.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/long.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/list/list0_c.hpp b/3rdParty/Boost/src/boost/mpl/list/list0_c.hpp index ed9bca5..066661f 100644 --- a/3rdParty/Boost/src/boost/mpl/list/list0_c.hpp +++ b/3rdParty/Boost/src/boost/mpl/list/list0_c.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: list0_c.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/list/list0.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/list/list10.hpp b/3rdParty/Boost/src/boost/mpl/list/list10.hpp index 4a4ee19..2354694 100644 --- a/3rdParty/Boost/src/boost/mpl/list/list10.hpp +++ b/3rdParty/Boost/src/boost/mpl/list/list10.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: list10.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) diff --git a/3rdParty/Boost/src/boost/mpl/list/list10_c.hpp b/3rdParty/Boost/src/boost/mpl/list/list10_c.hpp index e05ef87..b1c8e1b 100644 --- a/3rdParty/Boost/src/boost/mpl/list/list10_c.hpp +++ b/3rdParty/Boost/src/boost/mpl/list/list10_c.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: list10_c.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) diff --git a/3rdParty/Boost/src/boost/mpl/list/list20.hpp b/3rdParty/Boost/src/boost/mpl/list/list20.hpp index 9321192..29f7d5d 100644 --- a/3rdParty/Boost/src/boost/mpl/list/list20.hpp +++ b/3rdParty/Boost/src/boost/mpl/list/list20.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: list20.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) diff --git a/3rdParty/Boost/src/boost/mpl/list/list20_c.hpp b/3rdParty/Boost/src/boost/mpl/list/list20_c.hpp index bc807e6..d7f772c 100644 --- a/3rdParty/Boost/src/boost/mpl/list/list20_c.hpp +++ b/3rdParty/Boost/src/boost/mpl/list/list20_c.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: list20_c.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) diff --git a/3rdParty/Boost/src/boost/mpl/list/list30.hpp b/3rdParty/Boost/src/boost/mpl/list/list30.hpp index f736f8c..704cbdf 100644 --- a/3rdParty/Boost/src/boost/mpl/list/list30.hpp +++ b/3rdParty/Boost/src/boost/mpl/list/list30.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: list30.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) diff --git a/3rdParty/Boost/src/boost/mpl/list/list30_c.hpp b/3rdParty/Boost/src/boost/mpl/list/list30_c.hpp index e682086..54fd22f 100644 --- a/3rdParty/Boost/src/boost/mpl/list/list30_c.hpp +++ b/3rdParty/Boost/src/boost/mpl/list/list30_c.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: list30_c.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) diff --git a/3rdParty/Boost/src/boost/mpl/list/list40.hpp b/3rdParty/Boost/src/boost/mpl/list/list40.hpp index 8560d8f..11d12e3 100644 --- a/3rdParty/Boost/src/boost/mpl/list/list40.hpp +++ b/3rdParty/Boost/src/boost/mpl/list/list40.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: list40.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) diff --git a/3rdParty/Boost/src/boost/mpl/list/list40_c.hpp b/3rdParty/Boost/src/boost/mpl/list/list40_c.hpp index 5c5bfdf..0ae99fc 100644 --- a/3rdParty/Boost/src/boost/mpl/list/list40_c.hpp +++ b/3rdParty/Boost/src/boost/mpl/list/list40_c.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: list40_c.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) diff --git a/3rdParty/Boost/src/boost/mpl/list/list50.hpp b/3rdParty/Boost/src/boost/mpl/list/list50.hpp index dcaf18e..4050a81 100644 --- a/3rdParty/Boost/src/boost/mpl/list/list50.hpp +++ b/3rdParty/Boost/src/boost/mpl/list/list50.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: list50.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) diff --git a/3rdParty/Boost/src/boost/mpl/list/list50_c.hpp b/3rdParty/Boost/src/boost/mpl/list/list50_c.hpp index 0f38e07..4b5b654 100644 --- a/3rdParty/Boost/src/boost/mpl/list/list50_c.hpp +++ b/3rdParty/Boost/src/boost/mpl/list/list50_c.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: list50_c.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) diff --git a/3rdParty/Boost/src/boost/mpl/logical.hpp b/3rdParty/Boost/src/boost/mpl/logical.hpp index 256ea32..f8b8fc3 100644 --- a/3rdParty/Boost/src/boost/mpl/logical.hpp +++ b/3rdParty/Boost/src/boost/mpl/logical.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: logical.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/or.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/long.hpp b/3rdParty/Boost/src/boost/mpl/long.hpp index a3e35b1..1c79afd 100644 --- a/3rdParty/Boost/src/boost/mpl/long.hpp +++ b/3rdParty/Boost/src/boost/mpl/long.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: long.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/long_fwd.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/long_fwd.hpp b/3rdParty/Boost/src/boost/mpl/long_fwd.hpp index 4c1b604..17accd3 100644 --- a/3rdParty/Boost/src/boost/mpl/long_fwd.hpp +++ b/3rdParty/Boost/src/boost/mpl/long_fwd.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: long_fwd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/adl_barrier.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/max_element.hpp b/3rdParty/Boost/src/boost/mpl/max_element.hpp index 6d16dfc..cbfb711 100644 --- a/3rdParty/Boost/src/boost/mpl/max_element.hpp +++ b/3rdParty/Boost/src/boost/mpl/max_element.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: max_element.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/less.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/min_max.hpp b/3rdParty/Boost/src/boost/mpl/min_max.hpp index 944b776..97261bb 100644 --- a/3rdParty/Boost/src/boost/mpl/min_max.hpp +++ b/3rdParty/Boost/src/boost/mpl/min_max.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: min_max.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/less.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/minus.hpp b/3rdParty/Boost/src/boost/mpl/minus.hpp index a737185..123b8af 100644 --- a/3rdParty/Boost/src/boost/mpl/minus.hpp +++ b/3rdParty/Boost/src/boost/mpl/minus.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: minus.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #define AUX778076_OP_NAME minus diff --git a/3rdParty/Boost/src/boost/mpl/multiplies.hpp b/3rdParty/Boost/src/boost/mpl/multiplies.hpp index 772b7bd..1c0ec9f 100644 --- a/3rdParty/Boost/src/boost/mpl/multiplies.hpp +++ b/3rdParty/Boost/src/boost/mpl/multiplies.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: multiplies.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/times.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/negate.hpp b/3rdParty/Boost/src/boost/mpl/negate.hpp index bb8bcdd..3d51caf 100644 --- a/3rdParty/Boost/src/boost/mpl/negate.hpp +++ b/3rdParty/Boost/src/boost/mpl/negate.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: negate.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/integral_c.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/next.hpp b/3rdParty/Boost/src/boost/mpl/next.hpp index 3d4e711..fcfb01b 100644 --- a/3rdParty/Boost/src/boost/mpl/next.hpp +++ b/3rdParty/Boost/src/boost/mpl/next.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: next.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/next_prior.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/next_prior.hpp b/3rdParty/Boost/src/boost/mpl/next_prior.hpp index 4a9655b..c65d4c4 100644 --- a/3rdParty/Boost/src/boost/mpl/next_prior.hpp +++ b/3rdParty/Boost/src/boost/mpl/next_prior.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: next_prior.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/common_name_wknd.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/not.hpp b/3rdParty/Boost/src/boost/mpl/not.hpp index 2abc0db..9886d7d 100644 --- a/3rdParty/Boost/src/boost/mpl/not.hpp +++ b/3rdParty/Boost/src/boost/mpl/not.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: not.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/bool.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/not_equal_to.hpp b/3rdParty/Boost/src/boost/mpl/not_equal_to.hpp new file mode 100644 index 0000000..b6997df --- /dev/null +++ b/3rdParty/Boost/src/boost/mpl/not_equal_to.hpp @@ -0,0 +1,21 @@ + +#ifndef BOOST_MPL_NOT_EQUAL_TO_HPP_INCLUDED +#define BOOST_MPL_NOT_EQUAL_TO_HPP_INCLUDED + +// Copyright Aleksey Gurtovoy 2000-2004 +// +// 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) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id: not_equal_to.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ +// $Revision: 49267 $ + +#define AUX778076_OP_NAME not_equal_to +#define AUX778076_OP_TOKEN != +#include <boost/mpl/aux_/comparison_op.hpp> + +#endif // BOOST_MPL_NOT_EQUAL_TO_HPP_INCLUDED diff --git a/3rdParty/Boost/src/boost/mpl/numeric_cast.hpp b/3rdParty/Boost/src/boost/mpl/numeric_cast.hpp index 808ede0..f890e44 100644 --- a/3rdParty/Boost/src/boost/mpl/numeric_cast.hpp +++ b/3rdParty/Boost/src/boost/mpl/numeric_cast.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: numeric_cast.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/config/msvc.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/or.hpp b/3rdParty/Boost/src/boost/mpl/or.hpp index 4706449..16b42c1 100644 --- a/3rdParty/Boost/src/boost/mpl/or.hpp +++ b/3rdParty/Boost/src/boost/mpl/or.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: or.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/config/use_preprocessed.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/pair.hpp b/3rdParty/Boost/src/boost/mpl/pair.hpp index b3fb026..9336ca1 100644 --- a/3rdParty/Boost/src/boost/mpl/pair.hpp +++ b/3rdParty/Boost/src/boost/mpl/pair.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: pair.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/msvc_eti_base.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/pair_view.hpp b/3rdParty/Boost/src/boost/mpl/pair_view.hpp index 43430f5..06f6bac 100644 --- a/3rdParty/Boost/src/boost/mpl/pair_view.hpp +++ b/3rdParty/Boost/src/boost/mpl/pair_view.hpp @@ -12,7 +12,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: pair_view.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/begin_end.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/placeholders.hpp b/3rdParty/Boost/src/boost/mpl/placeholders.hpp index c1a38d9..891a818 100644 --- a/3rdParty/Boost/src/boost/mpl/placeholders.hpp +++ b/3rdParty/Boost/src/boost/mpl/placeholders.hpp @@ -16,7 +16,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: placeholders.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ diff --git a/3rdParty/Boost/src/boost/mpl/plus.hpp b/3rdParty/Boost/src/boost/mpl/plus.hpp index 79642eb..9f68c49 100644 --- a/3rdParty/Boost/src/boost/mpl/plus.hpp +++ b/3rdParty/Boost/src/boost/mpl/plus.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: plus.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #define AUX778076_OP_NAME plus diff --git a/3rdParty/Boost/src/boost/mpl/pop_back_fwd.hpp b/3rdParty/Boost/src/boost/mpl/pop_back_fwd.hpp index 4fba829..c8209a7 100644 --- a/3rdParty/Boost/src/boost/mpl/pop_back_fwd.hpp +++ b/3rdParty/Boost/src/boost/mpl/pop_back_fwd.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: pop_back_fwd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ namespace boost { namespace mpl { diff --git a/3rdParty/Boost/src/boost/mpl/pop_front_fwd.hpp b/3rdParty/Boost/src/boost/mpl/pop_front_fwd.hpp index 64d4c58..eb78347 100644 --- a/3rdParty/Boost/src/boost/mpl/pop_front_fwd.hpp +++ b/3rdParty/Boost/src/boost/mpl/pop_front_fwd.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: pop_front_fwd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ namespace boost { namespace mpl { diff --git a/3rdParty/Boost/src/boost/mpl/prior.hpp b/3rdParty/Boost/src/boost/mpl/prior.hpp index e08d967..b8f0dff 100644 --- a/3rdParty/Boost/src/boost/mpl/prior.hpp +++ b/3rdParty/Boost/src/boost/mpl/prior.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: prior.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/next_prior.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/protect.hpp b/3rdParty/Boost/src/boost/mpl/protect.hpp index 4fad835..e3daa4f 100644 --- a/3rdParty/Boost/src/boost/mpl/protect.hpp +++ b/3rdParty/Boost/src/boost/mpl/protect.hpp @@ -12,7 +12,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: protect.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/arity.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/push_back.hpp b/3rdParty/Boost/src/boost/mpl/push_back.hpp index 96389a3..2e8ad06 100644 --- a/3rdParty/Boost/src/boost/mpl/push_back.hpp +++ b/3rdParty/Boost/src/boost/mpl/push_back.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: push_back.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/push_back_fwd.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/push_back_fwd.hpp b/3rdParty/Boost/src/boost/mpl/push_back_fwd.hpp index 381aa29..ef04ff5 100644 --- a/3rdParty/Boost/src/boost/mpl/push_back_fwd.hpp +++ b/3rdParty/Boost/src/boost/mpl/push_back_fwd.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: push_back_fwd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ namespace boost { namespace mpl { diff --git a/3rdParty/Boost/src/boost/mpl/push_front.hpp b/3rdParty/Boost/src/boost/mpl/push_front.hpp index 3c4283c..ca943bb 100644 --- a/3rdParty/Boost/src/boost/mpl/push_front.hpp +++ b/3rdParty/Boost/src/boost/mpl/push_front.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: push_front.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/push_front_fwd.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/push_front_fwd.hpp b/3rdParty/Boost/src/boost/mpl/push_front_fwd.hpp index 11123bf..fa3667c 100644 --- a/3rdParty/Boost/src/boost/mpl/push_front_fwd.hpp +++ b/3rdParty/Boost/src/boost/mpl/push_front_fwd.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: push_front_fwd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ namespace boost { namespace mpl { diff --git a/3rdParty/Boost/src/boost/mpl/quote.hpp b/3rdParty/Boost/src/boost/mpl/quote.hpp index 52f67bf..53b5712 100644 --- a/3rdParty/Boost/src/boost/mpl/quote.hpp +++ b/3rdParty/Boost/src/boost/mpl/quote.hpp @@ -15,7 +15,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: quote.hpp 49272 2008-10-11 06:50:46Z agurtovoy $ -// $Date: 2008-10-11 02:50:46 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:50:46 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49272 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) diff --git a/3rdParty/Boost/src/boost/mpl/remove_if.hpp b/3rdParty/Boost/src/boost/mpl/remove_if.hpp new file mode 100644 index 0000000..1275bd4 --- /dev/null +++ b/3rdParty/Boost/src/boost/mpl/remove_if.hpp @@ -0,0 +1,83 @@ + +#ifndef BOOST_MPL_REMOVE_IF_HPP_INCLUDED +#define BOOST_MPL_REMOVE_IF_HPP_INCLUDED + +// Copyright Aleksey Gurtovoy 2000-2004 +// Copyright David Abrahams 2003-2004 +// +// 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) +// +// See http://www.boost.org/libs/mpl for documentation. + +// $Id: remove_if.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ +// $Revision: 49267 $ + +#include <boost/mpl/fold.hpp> +#include <boost/mpl/reverse_fold.hpp> +#include <boost/mpl/eval_if.hpp> +#include <boost/mpl/identity.hpp> +#include <boost/mpl/protect.hpp> +#include <boost/mpl/lambda.hpp> +#include <boost/mpl/apply.hpp> +#include <boost/mpl/aux_/inserter_algorithm.hpp> + +namespace boost { namespace mpl { + +namespace aux { + +template< typename Pred, typename InsertOp > struct remove_if_helper +{ + template< typename Sequence, typename U > struct apply + { + typedef typename eval_if< + typename apply1<Pred,U>::type + , identity<Sequence> + , apply2<InsertOp,Sequence,U> + >::type type; + }; +}; + +template< + typename Sequence + , typename Predicate + , typename Inserter + > +struct remove_if_impl + : fold< + Sequence + , typename Inserter::state + , protect< aux::remove_if_helper< + typename lambda<Predicate>::type + , typename Inserter::operation + > > + > +{ +}; + +template< + typename Sequence + , typename Predicate + , typename Inserter + > +struct reverse_remove_if_impl + : reverse_fold< + Sequence + , typename Inserter::state + , protect< aux::remove_if_helper< + typename lambda<Predicate>::type + , typename Inserter::operation + > > + > +{ +}; + +} // namespace aux + +BOOST_MPL_AUX_INSERTER_ALGORITHM_DEF(3, remove_if) + +}} + +#endif // BOOST_MPL_REMOVE_IF_HPP_INCLUDED diff --git a/3rdParty/Boost/src/boost/mpl/reverse_fold.hpp b/3rdParty/Boost/src/boost/mpl/reverse_fold.hpp index 79b6ec7..bcf3157 100644 --- a/3rdParty/Boost/src/boost/mpl/reverse_fold.hpp +++ b/3rdParty/Boost/src/boost/mpl/reverse_fold.hpp @@ -12,7 +12,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: reverse_fold.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/begin_end.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/same_as.hpp b/3rdParty/Boost/src/boost/mpl/same_as.hpp index e95d55f..c82cfd7 100644 --- a/3rdParty/Boost/src/boost/mpl/same_as.hpp +++ b/3rdParty/Boost/src/boost/mpl/same_as.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: same_as.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/not.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/sequence_tag.hpp b/3rdParty/Boost/src/boost/mpl/sequence_tag.hpp index 41450ed..479175e 100644 --- a/3rdParty/Boost/src/boost/mpl/sequence_tag.hpp +++ b/3rdParty/Boost/src/boost/mpl/sequence_tag.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: sequence_tag.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/sequence_tag_fwd.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/sequence_tag_fwd.hpp b/3rdParty/Boost/src/boost/mpl/sequence_tag_fwd.hpp index 07d54a4..07a6707 100644 --- a/3rdParty/Boost/src/boost/mpl/sequence_tag_fwd.hpp +++ b/3rdParty/Boost/src/boost/mpl/sequence_tag_fwd.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: sequence_tag_fwd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ namespace boost { namespace mpl { diff --git a/3rdParty/Boost/src/boost/mpl/size.hpp b/3rdParty/Boost/src/boost/mpl/size.hpp index 6ff2e65..54b13cb 100644 --- a/3rdParty/Boost/src/boost/mpl/size.hpp +++ b/3rdParty/Boost/src/boost/mpl/size.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: size.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/size_fwd.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/size_fwd.hpp b/3rdParty/Boost/src/boost/mpl/size_fwd.hpp index 2bab816..8702da7 100644 --- a/3rdParty/Boost/src/boost/mpl/size_fwd.hpp +++ b/3rdParty/Boost/src/boost/mpl/size_fwd.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: size_fwd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ namespace boost { namespace mpl { diff --git a/3rdParty/Boost/src/boost/mpl/size_t.hpp b/3rdParty/Boost/src/boost/mpl/size_t.hpp index e72d77f..54a05c6 100644 --- a/3rdParty/Boost/src/boost/mpl/size_t.hpp +++ b/3rdParty/Boost/src/boost/mpl/size_t.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: size_t.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/size_t_fwd.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/size_t_fwd.hpp b/3rdParty/Boost/src/boost/mpl/size_t_fwd.hpp index 84e903b..396a521 100644 --- a/3rdParty/Boost/src/boost/mpl/size_t_fwd.hpp +++ b/3rdParty/Boost/src/boost/mpl/size_t_fwd.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: size_t_fwd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/adl_barrier.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/sizeof.hpp b/3rdParty/Boost/src/boost/mpl/sizeof.hpp index 8ad9d24..018f826 100644 --- a/3rdParty/Boost/src/boost/mpl/sizeof.hpp +++ b/3rdParty/Boost/src/boost/mpl/sizeof.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: sizeof.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/size_t.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/tag.hpp b/3rdParty/Boost/src/boost/mpl/tag.hpp index 747646c..fc0aee2 100644 --- a/3rdParty/Boost/src/boost/mpl/tag.hpp +++ b/3rdParty/Boost/src/boost/mpl/tag.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: tag.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/eval_if.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/times.hpp b/3rdParty/Boost/src/boost/mpl/times.hpp index ea61eaf..c73256d 100644 --- a/3rdParty/Boost/src/boost/mpl/times.hpp +++ b/3rdParty/Boost/src/boost/mpl/times.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: times.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #define AUX778076_OP_NAME times diff --git a/3rdParty/Boost/src/boost/mpl/transform.hpp b/3rdParty/Boost/src/boost/mpl/transform.hpp index f367207..cb2b64e 100644 --- a/3rdParty/Boost/src/boost/mpl/transform.hpp +++ b/3rdParty/Boost/src/boost/mpl/transform.hpp @@ -12,7 +12,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: transform.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/fold.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/vector.hpp b/3rdParty/Boost/src/boost/mpl/vector.hpp index 94858ff..833f193 100644 --- a/3rdParty/Boost/src/boost/mpl/vector.hpp +++ b/3rdParty/Boost/src/boost/mpl/vector.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: vector.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) diff --git a/3rdParty/Boost/src/boost/mpl/vector/aux_/O1_size.hpp b/3rdParty/Boost/src/boost/mpl/vector/aux_/O1_size.hpp index 7697a24..3ca8d21 100644 --- a/3rdParty/Boost/src/boost/mpl/vector/aux_/O1_size.hpp +++ b/3rdParty/Boost/src/boost/mpl/vector/aux_/O1_size.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: O1_size.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/O1_size_fwd.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/vector/aux_/at.hpp b/3rdParty/Boost/src/boost/mpl/vector/aux_/at.hpp index c859f2d..9da0595 100644 --- a/3rdParty/Boost/src/boost/mpl/vector/aux_/at.hpp +++ b/3rdParty/Boost/src/boost/mpl/vector/aux_/at.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: at.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/at_fwd.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/vector/aux_/back.hpp b/3rdParty/Boost/src/boost/mpl/vector/aux_/back.hpp index 4969e62..ce84c7a 100644 --- a/3rdParty/Boost/src/boost/mpl/vector/aux_/back.hpp +++ b/3rdParty/Boost/src/boost/mpl/vector/aux_/back.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: back.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/back_fwd.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/vector/aux_/begin_end.hpp b/3rdParty/Boost/src/boost/mpl/vector/aux_/begin_end.hpp index f2bedf3..d79ef9a 100644 --- a/3rdParty/Boost/src/boost/mpl/vector/aux_/begin_end.hpp +++ b/3rdParty/Boost/src/boost/mpl/vector/aux_/begin_end.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: begin_end.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/config/typeof.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/vector/aux_/clear.hpp b/3rdParty/Boost/src/boost/mpl/vector/aux_/clear.hpp index 5a5d2d0..3308518 100644 --- a/3rdParty/Boost/src/boost/mpl/vector/aux_/clear.hpp +++ b/3rdParty/Boost/src/boost/mpl/vector/aux_/clear.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: clear.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/clear_fwd.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/vector/aux_/empty.hpp b/3rdParty/Boost/src/boost/mpl/vector/aux_/empty.hpp index 8e76c3e..84c8792 100644 --- a/3rdParty/Boost/src/boost/mpl/vector/aux_/empty.hpp +++ b/3rdParty/Boost/src/boost/mpl/vector/aux_/empty.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: empty.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/empty_fwd.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/vector/aux_/front.hpp b/3rdParty/Boost/src/boost/mpl/vector/aux_/front.hpp index 74b4c50..ff2414e 100644 --- a/3rdParty/Boost/src/boost/mpl/vector/aux_/front.hpp +++ b/3rdParty/Boost/src/boost/mpl/vector/aux_/front.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: front.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/front_fwd.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/vector/aux_/include_preprocessed.hpp b/3rdParty/Boost/src/boost/mpl/vector/aux_/include_preprocessed.hpp index 247b6ed..5c16008 100644 --- a/3rdParty/Boost/src/boost/mpl/vector/aux_/include_preprocessed.hpp +++ b/3rdParty/Boost/src/boost/mpl/vector/aux_/include_preprocessed.hpp @@ -10,7 +10,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: include_preprocessed.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/config/typeof.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/vector/aux_/item.hpp b/3rdParty/Boost/src/boost/mpl/vector/aux_/item.hpp index 96002b9..da2b01b 100644 --- a/3rdParty/Boost/src/boost/mpl/vector/aux_/item.hpp +++ b/3rdParty/Boost/src/boost/mpl/vector/aux_/item.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: item.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/long.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/vector/aux_/iterator.hpp b/3rdParty/Boost/src/boost/mpl/vector/aux_/iterator.hpp index 5864aff..770ed15 100644 --- a/3rdParty/Boost/src/boost/mpl/vector/aux_/iterator.hpp +++ b/3rdParty/Boost/src/boost/mpl/vector/aux_/iterator.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: iterator.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/vector/aux_/at.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/vector/aux_/numbered.hpp b/3rdParty/Boost/src/boost/mpl/vector/aux_/numbered.hpp index 0e5acc0..04265a3 100644 --- a/3rdParty/Boost/src/boost/mpl/vector/aux_/numbered.hpp +++ b/3rdParty/Boost/src/boost/mpl/vector/aux_/numbered.hpp @@ -12,7 +12,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: numbered.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/preprocessor/enum_params.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/vector/aux_/numbered_c.hpp b/3rdParty/Boost/src/boost/mpl/vector/aux_/numbered_c.hpp index dc13497..6a7cf40 100644 --- a/3rdParty/Boost/src/boost/mpl/vector/aux_/numbered_c.hpp +++ b/3rdParty/Boost/src/boost/mpl/vector/aux_/numbered_c.hpp @@ -12,7 +12,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: numbered_c.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/preprocessor/enum_params.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/vector/aux_/pop_back.hpp b/3rdParty/Boost/src/boost/mpl/vector/aux_/pop_back.hpp index aa90216..a43a3a6 100644 --- a/3rdParty/Boost/src/boost/mpl/vector/aux_/pop_back.hpp +++ b/3rdParty/Boost/src/boost/mpl/vector/aux_/pop_back.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: pop_back.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/pop_back_fwd.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/vector/aux_/pop_front.hpp b/3rdParty/Boost/src/boost/mpl/vector/aux_/pop_front.hpp index 854d1e7..a448d25 100644 --- a/3rdParty/Boost/src/boost/mpl/vector/aux_/pop_front.hpp +++ b/3rdParty/Boost/src/boost/mpl/vector/aux_/pop_front.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: pop_front.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/pop_front_fwd.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/vector/aux_/push_back.hpp b/3rdParty/Boost/src/boost/mpl/vector/aux_/push_back.hpp index b51c770..d8783cc 100644 --- a/3rdParty/Boost/src/boost/mpl/vector/aux_/push_back.hpp +++ b/3rdParty/Boost/src/boost/mpl/vector/aux_/push_back.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: push_back.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/push_back_fwd.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/vector/aux_/push_front.hpp b/3rdParty/Boost/src/boost/mpl/vector/aux_/push_front.hpp index efa2aae..26b5f00 100644 --- a/3rdParty/Boost/src/boost/mpl/vector/aux_/push_front.hpp +++ b/3rdParty/Boost/src/boost/mpl/vector/aux_/push_front.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: push_front.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/push_front_fwd.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/vector/aux_/size.hpp b/3rdParty/Boost/src/boost/mpl/vector/aux_/size.hpp index bd40b54..41b7be6 100644 --- a/3rdParty/Boost/src/boost/mpl/vector/aux_/size.hpp +++ b/3rdParty/Boost/src/boost/mpl/vector/aux_/size.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: size.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/size_fwd.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/vector/aux_/tag.hpp b/3rdParty/Boost/src/boost/mpl/vector/aux_/tag.hpp index 77d627b..0f37e92 100644 --- a/3rdParty/Boost/src/boost/mpl/vector/aux_/tag.hpp +++ b/3rdParty/Boost/src/boost/mpl/vector/aux_/tag.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: tag.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/config/typeof.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/vector/aux_/vector0.hpp b/3rdParty/Boost/src/boost/mpl/vector/aux_/vector0.hpp index 65c5544..b3bb13b 100644 --- a/3rdParty/Boost/src/boost/mpl/vector/aux_/vector0.hpp +++ b/3rdParty/Boost/src/boost/mpl/vector/aux_/vector0.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: vector0.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/long.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/vector/vector0.hpp b/3rdParty/Boost/src/boost/mpl/vector/vector0.hpp index 249ecbb..9d18104 100644 --- a/3rdParty/Boost/src/boost/mpl/vector/vector0.hpp +++ b/3rdParty/Boost/src/boost/mpl/vector/vector0.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: vector0.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/vector/aux_/at.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/vector/vector0_c.hpp b/3rdParty/Boost/src/boost/mpl/vector/vector0_c.hpp index 630af92..eb1dcf9 100644 --- a/3rdParty/Boost/src/boost/mpl/vector/vector0_c.hpp +++ b/3rdParty/Boost/src/boost/mpl/vector/vector0_c.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: vector0_c.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/vector/vector0.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/vector/vector10.hpp b/3rdParty/Boost/src/boost/mpl/vector/vector10.hpp index 344c92c..848dd82 100644 --- a/3rdParty/Boost/src/boost/mpl/vector/vector10.hpp +++ b/3rdParty/Boost/src/boost/mpl/vector/vector10.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: vector10.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) diff --git a/3rdParty/Boost/src/boost/mpl/vector/vector10_c.hpp b/3rdParty/Boost/src/boost/mpl/vector/vector10_c.hpp index 05e97ad..4e6cf3b 100644 --- a/3rdParty/Boost/src/boost/mpl/vector/vector10_c.hpp +++ b/3rdParty/Boost/src/boost/mpl/vector/vector10_c.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: vector10_c.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) diff --git a/3rdParty/Boost/src/boost/mpl/vector/vector20.hpp b/3rdParty/Boost/src/boost/mpl/vector/vector20.hpp index ffa867e..173eacf 100644 --- a/3rdParty/Boost/src/boost/mpl/vector/vector20.hpp +++ b/3rdParty/Boost/src/boost/mpl/vector/vector20.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: vector20.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) diff --git a/3rdParty/Boost/src/boost/mpl/vector/vector20_c.hpp b/3rdParty/Boost/src/boost/mpl/vector/vector20_c.hpp index cc13d51..c6b7187 100644 --- a/3rdParty/Boost/src/boost/mpl/vector/vector20_c.hpp +++ b/3rdParty/Boost/src/boost/mpl/vector/vector20_c.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: vector20_c.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) diff --git a/3rdParty/Boost/src/boost/mpl/vector/vector30.hpp b/3rdParty/Boost/src/boost/mpl/vector/vector30.hpp index f54c61c..476ec35 100644 --- a/3rdParty/Boost/src/boost/mpl/vector/vector30.hpp +++ b/3rdParty/Boost/src/boost/mpl/vector/vector30.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: vector30.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) diff --git a/3rdParty/Boost/src/boost/mpl/vector/vector30_c.hpp b/3rdParty/Boost/src/boost/mpl/vector/vector30_c.hpp index a8e3e60..c20d8f9 100644 --- a/3rdParty/Boost/src/boost/mpl/vector/vector30_c.hpp +++ b/3rdParty/Boost/src/boost/mpl/vector/vector30_c.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: vector30_c.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) diff --git a/3rdParty/Boost/src/boost/mpl/vector/vector40.hpp b/3rdParty/Boost/src/boost/mpl/vector/vector40.hpp index 2d24b6d..69203d0 100644 --- a/3rdParty/Boost/src/boost/mpl/vector/vector40.hpp +++ b/3rdParty/Boost/src/boost/mpl/vector/vector40.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: vector40.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) diff --git a/3rdParty/Boost/src/boost/mpl/vector/vector40_c.hpp b/3rdParty/Boost/src/boost/mpl/vector/vector40_c.hpp index 9179b26..bd7310c 100644 --- a/3rdParty/Boost/src/boost/mpl/vector/vector40_c.hpp +++ b/3rdParty/Boost/src/boost/mpl/vector/vector40_c.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: vector40_c.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) diff --git a/3rdParty/Boost/src/boost/mpl/vector/vector50.hpp b/3rdParty/Boost/src/boost/mpl/vector/vector50.hpp index 0050483..4c3e231 100644 --- a/3rdParty/Boost/src/boost/mpl/vector/vector50.hpp +++ b/3rdParty/Boost/src/boost/mpl/vector/vector50.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: vector50.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) diff --git a/3rdParty/Boost/src/boost/mpl/vector/vector50_c.hpp b/3rdParty/Boost/src/boost/mpl/vector/vector50_c.hpp index 0496742..2d2e705 100644 --- a/3rdParty/Boost/src/boost/mpl/vector/vector50_c.hpp +++ b/3rdParty/Boost/src/boost/mpl/vector/vector50_c.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: vector50_c.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #if !defined(BOOST_MPL_PREPROCESSING_MODE) diff --git a/3rdParty/Boost/src/boost/mpl/void.hpp b/3rdParty/Boost/src/boost/mpl/void.hpp index f464acb..ad5aa56 100644 --- a/3rdParty/Boost/src/boost/mpl/void.hpp +++ b/3rdParty/Boost/src/boost/mpl/void.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: void.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/void_fwd.hpp> diff --git a/3rdParty/Boost/src/boost/mpl/void_fwd.hpp b/3rdParty/Boost/src/boost/mpl/void_fwd.hpp index 0dcd639..9643dec 100644 --- a/3rdParty/Boost/src/boost/mpl/void_fwd.hpp +++ b/3rdParty/Boost/src/boost/mpl/void_fwd.hpp @@ -11,7 +11,7 @@ // See http://www.boost.org/libs/mpl for documentation. // $Id: void_fwd.hpp 49267 2008-10-11 06:19:02Z agurtovoy $ -// $Date: 2008-10-11 02:19:02 -0400 (Sat, 11 Oct 2008) $ +// $Date: 2008-10-10 23:19:02 -0700 (Fri, 10 Oct 2008) $ // $Revision: 49267 $ #include <boost/mpl/aux_/adl_barrier.hpp> diff --git a/3rdParty/Boost/src/boost/none.hpp b/3rdParty/Boost/src/boost/none.hpp index bd342da..e9fc062 100644 --- a/3rdParty/Boost/src/boost/none.hpp +++ b/3rdParty/Boost/src/boost/none.hpp @@ -20,7 +20,7 @@ namespace boost { -none_t const none = ((none_t)0) ; +none_t const none = (static_cast<none_t>(0)) ; } // namespace boost diff --git a/3rdParty/Boost/src/boost/numeric/conversion/cast.hpp b/3rdParty/Boost/src/boost/numeric/conversion/cast.hpp index aa518e8..1ee0251 100644 --- a/3rdParty/Boost/src/boost/numeric/conversion/cast.hpp +++ b/3rdParty/Boost/src/boost/numeric/conversion/cast.hpp @@ -16,6 +16,7 @@ // 30 Oct 2001 Some fixes suggested by Daryle Walker (Fernando Cacciola) // 25 Oct 2001 Initial boostification (Fernando Cacciola) // 23 Jan 2004 Inital add to cvs (post review)s +// 22 Jun 2011 Added support for specializing cast policies via numeric_cast_traits (Brandon Kohn). // #ifndef BOOST_NUMERIC_CONVERSION_CAST_25OCT2001_HPP #define BOOST_NUMERIC_CONVERSION_CAST_25OCT2001_HPP @@ -30,22 +31,31 @@ #include <boost/type.hpp> #include <boost/numeric/conversion/converter.hpp> +#include <boost/numeric/conversion/numeric_cast_traits.hpp> namespace boost { - template<typename Target, typename Source> - inline - Target numeric_cast ( Source arg ) - { - typedef boost::numeric::converter<Target,Source> Converter ; - return Converter::convert(arg); - } - - using numeric::bad_numeric_cast; - + template <typename Target, typename Source> + inline Target numeric_cast( Source arg ) + { + typedef numeric::conversion_traits<Target, Source> conv_traits; + typedef numeric::numeric_cast_traits<Target, Source> cast_traits; + typedef boost::numeric::converter + < + Target, + Source, + conv_traits, + typename cast_traits::overflow_policy, + typename cast_traits::rounding_policy, + boost::numeric::raw_converter< conv_traits >, + typename cast_traits::range_checking_policy + > converter; + return converter::convert(arg); + } + + using numeric::bad_numeric_cast; } // namespace boost #endif - #endif diff --git a/3rdParty/Boost/src/boost/numeric/conversion/converter_policies.hpp b/3rdParty/Boost/src/boost/numeric/conversion/converter_policies.hpp index b0d741b..e7a5e67 100644 --- a/3rdParty/Boost/src/boost/numeric/conversion/converter_policies.hpp +++ b/3rdParty/Boost/src/boost/numeric/conversion/converter_policies.hpp @@ -13,6 +13,7 @@ #include <typeinfo> // for std::bad_cast #include <boost/config/no_tr1/cmath.hpp> // for std::floor and std::ceil +#include <boost/throw_exception.hpp> #include <functional> @@ -158,10 +159,17 @@ struct def_overflow_handler { void operator() ( range_check_result r ) // throw(negative_overflow,positive_overflow) { +#ifndef BOOST_NO_EXCEPTIONS if ( r == cNegOverflow ) throw negative_overflow() ; else if ( r == cPosOverflow ) throw positive_overflow() ; +#else + if ( r == cNegOverflow ) + ::boost::throw_exception(negative_overflow()) ; + else if ( r == cPosOverflow ) + ::boost::throw_exception(positive_overflow()) ; +#endif } } ; diff --git a/3rdParty/Boost/src/boost/numeric/conversion/detail/numeric_cast_traits.hpp b/3rdParty/Boost/src/boost/numeric/conversion/detail/numeric_cast_traits.hpp new file mode 100644 index 0000000..150490d --- /dev/null +++ b/3rdParty/Boost/src/boost/numeric/conversion/detail/numeric_cast_traits.hpp @@ -0,0 +1,138 @@ +// +//! Copyright (c) 2011-2012 +//! Brandon Kohn +// +// 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_NUMERIC_CONVERSION_DONT_USE_PREPROCESSED_FILES) + + #include <boost/numeric/conversion/detail/preprocessed/numeric_cast_traits_common.hpp> + + #if !defined(BOOST_NO_LONG_LONG) + #include <boost/numeric/conversion/detail/preprocessed/numeric_cast_traits_long_long.hpp> + #endif + +#else +#if !BOOST_PP_IS_ITERATING + + #include <boost/preprocessor/seq/elem.hpp> + #include <boost/preprocessor/seq/size.hpp> + #include <boost/preprocessor/iteration/iterate.hpp> + + #if defined(__WAVE__) && defined(BOOST_NUMERIC_CONVERSION_CREATE_PREPROCESSED_FILES) + #pragma wave option(preserve: 2, line: 0, output: "preprocessed/numeric_cast_traits_common.hpp") + #endif +// +//! Copyright (c) 2011-2012 +//! Brandon Kohn +// +// 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(__WAVE__) && defined(BOOST_NUMERIC_CONVERSION_CREATE_PREPROCESSED_FILES) + #pragma wave option(preserve: 1) + #endif + + //! These are the assumed common built in fundamental types (not typedefs/macros.) + #define BOOST_NUMERIC_CONVERSION_BASE_BUILTIN_TYPES() \ + (char) \ + (signed char) \ + (unsigned char) \ + (short) \ + (unsigned short) \ + (int) \ + (unsigned int) \ + (long) \ + (unsigned long) \ + (float) \ + (double) \ + (long double) \ + /***/ + + #define BOOST_NUMERIC_CONVERSION_SEQ_A() BOOST_NUMERIC_CONVERSION_BASE_BUILTIN_TYPES() + #define BOOST_NUMERIC_CONVERSION_SEQ_B() BOOST_NUMERIC_CONVERSION_BASE_BUILTIN_TYPES() + +namespace boost { namespace numeric { + + #define BOOST_PP_ITERATION_PARAMS_1 (3, (0, BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(BOOST_NUMERIC_CONVERSION_SEQ_A())), <boost/numeric/conversion/detail/numeric_cast_traits.hpp>)) + #include BOOST_PP_ITERATE() + +}}//namespace boost::numeric; + + #if defined(__WAVE__) && defined(BOOST_NUMERIC_CONVERSION_CREATE_PREPROCESSED_FILES) + #pragma wave option(output: null) + #endif + + #if ( defined(__WAVE__) && defined(BOOST_NUMERIC_CONVERSION_CREATE_PREPROCESSED_FILES) ) || !defined(BOOST_NO_LONG_LONG) + + #undef BOOST_NUMERIC_CONVERSION_SEQ_A + #undef BOOST_NUMERIC_CONVERSION_SEQ_B + + #if defined(__WAVE__) && defined(BOOST_NUMERIC_CONVERSION_CREATE_PREPROCESSED_FILES) + #pragma wave option(preserve: 2, line: 0, output: "preprocessed/numeric_cast_traits_long_long.hpp") + #endif + +// +//! Copyright (c) 2011-2012 +//! Brandon Kohn +// +// 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(__WAVE__) && defined(BOOST_NUMERIC_CONVERSION_CREATE_PREPROCESSED_FILES) + #pragma wave option(preserve: 1) + #endif + +namespace boost { namespace numeric { + + #define BOOST_NUMERIC_CONVERSION_SEQ_A() BOOST_NUMERIC_CONVERSION_BASE_BUILTIN_TYPES()(boost::long_long_type)(boost::ulong_long_type) + #define BOOST_NUMERIC_CONVERSION_SEQ_B() (boost::long_long_type)(boost::ulong_long_type) + + #define BOOST_PP_ITERATION_PARAMS_1 (3, (0, BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(BOOST_NUMERIC_CONVERSION_SEQ_A())), <boost/numeric/conversion/detail/numeric_cast_traits.hpp>)) + #include BOOST_PP_ITERATE() + +}}//namespace boost::numeric; + + #if defined(__WAVE__) && defined(BOOST_NUMERIC_CONVERSION_CREATE_PREPROCESSED_FILES) + #pragma wave option(output: null) + #endif + + #endif + + #undef BOOST_NUMERIC_CONVERSION_BASE_BUILTIN_TYPES + #undef BOOST_NUMERIC_CONVERSION_SEQ_A + #undef BOOST_NUMERIC_CONVERSION_SEQ_B + +#elif BOOST_PP_ITERATION_DEPTH() == 1 + + #define BOOST_PP_ITERATION_PARAMS_2 (3, (0, BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(BOOST_NUMERIC_CONVERSION_SEQ_B())), <boost/numeric/conversion/detail/numeric_cast_traits.hpp>)) + #include BOOST_PP_ITERATE() + +#elif BOOST_PP_ITERATION_DEPTH() == 2 + + //! Generate default traits for the specified source and target. + #define BOOST_NUMERIC_CONVERSION_A BOOST_PP_FRAME_ITERATION(1) + #define BOOST_NUMERIC_CONVERSION_B BOOST_PP_FRAME_ITERATION(2) + + template <> + struct numeric_cast_traits + < + BOOST_PP_SEQ_ELEM(BOOST_NUMERIC_CONVERSION_A, BOOST_NUMERIC_CONVERSION_SEQ_A()) + , BOOST_PP_SEQ_ELEM(BOOST_NUMERIC_CONVERSION_B, BOOST_NUMERIC_CONVERSION_SEQ_B()) + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<BOOST_PP_SEQ_ELEM(BOOST_NUMERIC_CONVERSION_B, BOOST_NUMERIC_CONVERSION_SEQ_B())> rounding_policy; + }; + + #undef BOOST_NUMERIC_CONVERSION_A + #undef BOOST_NUMERIC_CONVERSION_B + +#endif//! Depth 2. +#endif// BOOST_NUMERIC_CONVERSION_DONT_USE_PREPROCESSED_FILES diff --git a/3rdParty/Boost/src/boost/numeric/conversion/detail/preprocessed/numeric_cast_traits_common.hpp b/3rdParty/Boost/src/boost/numeric/conversion/detail/preprocessed/numeric_cast_traits_common.hpp new file mode 100644 index 0000000..01dc932 --- /dev/null +++ b/3rdParty/Boost/src/boost/numeric/conversion/detail/preprocessed/numeric_cast_traits_common.hpp @@ -0,0 +1,1741 @@ +// +//! Copyright (c) 2011-2012 +//! Brandon Kohn +// +// 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) +// + + + +namespace boost { namespace numeric { + + template <> + struct numeric_cast_traits + < + char + , char + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<char> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + char + , signed char + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<signed char> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + char + , unsigned char + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<unsigned char> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + char + , short + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<short> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + char + , unsigned short + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<unsigned short> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + char + , int + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<int> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + char + , unsigned int + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<unsigned int> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + char + , long + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<long> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + char + , unsigned long + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<unsigned long> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + char + , float + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<float> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + char + , double + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<double> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + char + , long double + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<long double> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + signed char + , char + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<char> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + signed char + , signed char + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<signed char> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + signed char + , unsigned char + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<unsigned char> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + signed char + , short + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<short> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + signed char + , unsigned short + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<unsigned short> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + signed char + , int + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<int> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + signed char + , unsigned int + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<unsigned int> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + signed char + , long + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<long> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + signed char + , unsigned long + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<unsigned long> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + signed char + , float + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<float> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + signed char + , double + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<double> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + signed char + , long double + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<long double> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + unsigned char + , char + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<char> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + unsigned char + , signed char + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<signed char> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + unsigned char + , unsigned char + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<unsigned char> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + unsigned char + , short + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<short> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + unsigned char + , unsigned short + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<unsigned short> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + unsigned char + , int + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<int> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + unsigned char + , unsigned int + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<unsigned int> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + unsigned char + , long + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<long> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + unsigned char + , unsigned long + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<unsigned long> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + unsigned char + , float + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<float> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + unsigned char + , double + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<double> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + unsigned char + , long double + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<long double> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + short + , char + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<char> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + short + , signed char + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<signed char> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + short + , unsigned char + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<unsigned char> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + short + , short + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<short> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + short + , unsigned short + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<unsigned short> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + short + , int + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<int> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + short + , unsigned int + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<unsigned int> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + short + , long + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<long> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + short + , unsigned long + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<unsigned long> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + short + , float + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<float> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + short + , double + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<double> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + short + , long double + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<long double> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + unsigned short + , char + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<char> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + unsigned short + , signed char + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<signed char> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + unsigned short + , unsigned char + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<unsigned char> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + unsigned short + , short + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<short> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + unsigned short + , unsigned short + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<unsigned short> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + unsigned short + , int + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<int> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + unsigned short + , unsigned int + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<unsigned int> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + unsigned short + , long + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<long> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + unsigned short + , unsigned long + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<unsigned long> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + unsigned short + , float + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<float> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + unsigned short + , double + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<double> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + unsigned short + , long double + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<long double> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + int + , char + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<char> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + int + , signed char + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<signed char> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + int + , unsigned char + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<unsigned char> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + int + , short + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<short> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + int + , unsigned short + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<unsigned short> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + int + , int + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<int> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + int + , unsigned int + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<unsigned int> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + int + , long + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<long> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + int + , unsigned long + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<unsigned long> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + int + , float + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<float> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + int + , double + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<double> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + int + , long double + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<long double> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + unsigned int + , char + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<char> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + unsigned int + , signed char + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<signed char> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + unsigned int + , unsigned char + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<unsigned char> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + unsigned int + , short + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<short> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + unsigned int + , unsigned short + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<unsigned short> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + unsigned int + , int + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<int> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + unsigned int + , unsigned int + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<unsigned int> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + unsigned int + , long + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<long> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + unsigned int + , unsigned long + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<unsigned long> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + unsigned int + , float + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<float> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + unsigned int + , double + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<double> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + unsigned int + , long double + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<long double> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + long + , char + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<char> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + long + , signed char + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<signed char> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + long + , unsigned char + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<unsigned char> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + long + , short + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<short> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + long + , unsigned short + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<unsigned short> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + long + , int + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<int> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + long + , unsigned int + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<unsigned int> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + long + , long + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<long> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + long + , unsigned long + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<unsigned long> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + long + , float + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<float> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + long + , double + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<double> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + long + , long double + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<long double> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + unsigned long + , char + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<char> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + unsigned long + , signed char + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<signed char> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + unsigned long + , unsigned char + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<unsigned char> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + unsigned long + , short + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<short> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + unsigned long + , unsigned short + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<unsigned short> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + unsigned long + , int + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<int> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + unsigned long + , unsigned int + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<unsigned int> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + unsigned long + , long + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<long> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + unsigned long + , unsigned long + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<unsigned long> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + unsigned long + , float + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<float> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + unsigned long + , double + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<double> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + unsigned long + , long double + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<long double> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + float + , char + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<char> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + float + , signed char + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<signed char> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + float + , unsigned char + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<unsigned char> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + float + , short + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<short> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + float + , unsigned short + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<unsigned short> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + float + , int + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<int> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + float + , unsigned int + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<unsigned int> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + float + , long + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<long> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + float + , unsigned long + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<unsigned long> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + float + , float + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<float> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + float + , double + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<double> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + float + , long double + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<long double> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + double + , char + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<char> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + double + , signed char + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<signed char> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + double + , unsigned char + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<unsigned char> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + double + , short + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<short> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + double + , unsigned short + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<unsigned short> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + double + , int + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<int> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + double + , unsigned int + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<unsigned int> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + double + , long + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<long> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + double + , unsigned long + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<unsigned long> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + double + , float + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<float> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + double + , double + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<double> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + double + , long double + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<long double> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + long double + , char + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<char> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + long double + , signed char + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<signed char> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + long double + , unsigned char + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<unsigned char> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + long double + , short + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<short> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + long double + , unsigned short + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<unsigned short> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + long double + , int + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<int> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + long double + , unsigned int + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<unsigned int> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + long double + , long + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<long> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + long double + , unsigned long + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<unsigned long> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + long double + , float + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<float> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + long double + , double + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<double> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + long double + , long double + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<long double> rounding_policy; + }; +}} diff --git a/3rdParty/Boost/src/boost/numeric/conversion/detail/preprocessed/numeric_cast_traits_long_long.hpp b/3rdParty/Boost/src/boost/numeric/conversion/detail/preprocessed/numeric_cast_traits_long_long.hpp new file mode 100644 index 0000000..b358b9c --- /dev/null +++ b/3rdParty/Boost/src/boost/numeric/conversion/detail/preprocessed/numeric_cast_traits_long_long.hpp @@ -0,0 +1,347 @@ +// +//! Copyright (c) 2011-2012 +//! Brandon Kohn +// +// 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) +// +namespace boost { namespace numeric { + + + template <> + struct numeric_cast_traits + < + char + , boost::long_long_type + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<boost::long_long_type> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + char + , boost::ulong_long_type + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<boost::ulong_long_type> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + signed char + , boost::long_long_type + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<boost::long_long_type> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + signed char + , boost::ulong_long_type + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<boost::ulong_long_type> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + unsigned char + , boost::long_long_type + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<boost::long_long_type> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + unsigned char + , boost::ulong_long_type + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<boost::ulong_long_type> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + short + , boost::long_long_type + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<boost::long_long_type> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + short + , boost::ulong_long_type + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<boost::ulong_long_type> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + unsigned short + , boost::long_long_type + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<boost::long_long_type> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + unsigned short + , boost::ulong_long_type + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<boost::ulong_long_type> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + int + , boost::long_long_type + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<boost::long_long_type> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + int + , boost::ulong_long_type + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<boost::ulong_long_type> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + unsigned int + , boost::long_long_type + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<boost::long_long_type> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + unsigned int + , boost::ulong_long_type + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<boost::ulong_long_type> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + long + , boost::long_long_type + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<boost::long_long_type> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + long + , boost::ulong_long_type + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<boost::ulong_long_type> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + unsigned long + , boost::long_long_type + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<boost::long_long_type> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + unsigned long + , boost::ulong_long_type + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<boost::ulong_long_type> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + float + , boost::long_long_type + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<boost::long_long_type> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + float + , boost::ulong_long_type + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<boost::ulong_long_type> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + double + , boost::long_long_type + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<boost::long_long_type> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + double + , boost::ulong_long_type + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<boost::ulong_long_type> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + long double + , boost::long_long_type + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<boost::long_long_type> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + long double + , boost::ulong_long_type + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<boost::ulong_long_type> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + boost::long_long_type + , boost::long_long_type + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<boost::long_long_type> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + boost::long_long_type + , boost::ulong_long_type + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<boost::ulong_long_type> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + boost::ulong_long_type + , boost::long_long_type + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<boost::long_long_type> rounding_policy; + }; + + template <> + struct numeric_cast_traits + < + boost::ulong_long_type + , boost::ulong_long_type + > + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<boost::ulong_long_type> rounding_policy; + }; +}} diff --git a/3rdParty/Boost/src/boost/numeric/conversion/numeric_cast_traits.hpp b/3rdParty/Boost/src/boost/numeric/conversion/numeric_cast_traits.hpp new file mode 100644 index 0000000..e24296b --- /dev/null +++ b/3rdParty/Boost/src/boost/numeric/conversion/numeric_cast_traits.hpp @@ -0,0 +1,31 @@ +// +//! Copyright (c) 2011 +//! Brandon Kohn +// +// 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_NUMERIC_CAST_TRAITS_HPP +#define BOOST_NUMERIC_CAST_TRAITS_HPP + +#include <boost/numeric/conversion/converter_policies.hpp> + +namespace boost { namespace numeric { + + template <typename Target, typename Source, typename EnableIf = void> + struct numeric_cast_traits + { + typedef def_overflow_handler overflow_policy; + typedef UseInternalRangeChecker range_checking_policy; + typedef Trunc<Source> rounding_policy; + }; + +}}//namespace boost::numeric; + +#if !defined( BOOST_NUMERIC_CONVERSION_RELAX_BUILT_IN_CAST_TRAITS ) +#include <boost/cstdint.hpp> +#include <boost/numeric/conversion/detail/numeric_cast_traits.hpp> +#endif//!defined BOOST_NUMERIC_CONVERSION_RELAX_BUILT_IN_CAST_TRAITS + +#endif//BOOST_NUMERIC_CAST_TRAITS_HPP diff --git a/3rdParty/Boost/src/boost/operators.hpp b/3rdParty/Boost/src/boost/operators.hpp index 4b47ba4..b524cee 100644 --- a/3rdParty/Boost/src/boost/operators.hpp +++ b/3rdParty/Boost/src/boost/operators.hpp @@ -8,6 +8,8 @@ // See http://www.boost.org/libs/utility/operators.htm for documentation. // Revision History +// 16 Dec 10 Limit warning suppression for 4284 to older versions of VC++ +// (Matthew Bradbury, fixes #4432) // 07 Aug 08 Added "euclidean" spelling. (Daniel Frey) // 03 Apr 08 Make sure "convertible to bool" is sufficient // for T::operator<, etc. (Daniel Frey) @@ -88,7 +90,7 @@ # pragma set woff 1234 #endif -#if defined(BOOST_MSVC) +#if BOOST_WORKAROUND(BOOST_MSVC, < 1600) # pragma warning( disable : 4284 ) // complaint about return type of #endif // operator-> not begin a UDT diff --git a/3rdParty/Boost/src/boost/optional/optional.hpp b/3rdParty/Boost/src/boost/optional/optional.hpp index ec9006e..0d6dba4 100644 --- a/3rdParty/Boost/src/boost/optional/optional.hpp +++ b/3rdParty/Boost/src/boost/optional/optional.hpp @@ -890,12 +890,12 @@ bool operator >= ( optional<T> const& x, none_t y ) template<class T> inline -bool operator == ( none_t x, optional<T> const& y ) +bool operator == ( none_t , optional<T> const& y ) { return equal_pointees(optional<T>() ,y); } template<class T> inline -bool operator < ( none_t x, optional<T> const& y ) +bool operator < ( none_t , optional<T> const& y ) { return less_pointees(optional<T>() ,y); } template<class T> diff --git a/3rdParty/Boost/src/boost/optional/optional_fwd.hpp b/3rdParty/Boost/src/boost/optional/optional_fwd.hpp index dcde233..388cc1c 100644 --- a/3rdParty/Boost/src/boost/optional/optional_fwd.hpp +++ b/3rdParty/Boost/src/boost/optional/optional_fwd.hpp @@ -1,4 +1,4 @@ -// Copyright (C) 2003, Fernando Luis Cacciola Carballal. +// Copyright (C) 2003, 2008 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 @@ -9,6 +9,9 @@ // You are welcome to contact the author at: // fernando_cacciola@hotmail.com // +// Revisions: +// 10 May 2008 (added swap related forward declaration) Niels Dekker +// #ifndef BOOST_OPTIONAL_OPTIONAL_FWD_FLC_19NOV2002_HPP #define BOOST_OPTIONAL_OPTIONAL_FWD_FLC_19NOV2002_HPP @@ -16,6 +19,10 @@ namespace boost { template<class T> class optional ; +template<class T> void swap ( optional<T>& , optional<T>& ) ; + +template<class T> struct optional_swap_should_use_default_constructor ; + } // namespace boost #endif diff --git a/3rdParty/Boost/src/boost/pending/integer_log2.hpp b/3rdParty/Boost/src/boost/pending/integer_log2.hpp new file mode 100644 index 0000000..f4bc846 --- /dev/null +++ b/3rdParty/Boost/src/boost/pending/integer_log2.hpp @@ -0,0 +1,112 @@ +// ----------------------------------------------------------- +// integer_log2.hpp +// +// Gives the integer part of the logarithm, in base 2, of a +// given number. Behavior is undefined if the argument is <= 0. +// +// Copyright (c) 2003-2004, 2008 Gennaro Prota +// +// 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_INTEGER_LOG2_HPP_GP_20030301 +#define BOOST_INTEGER_LOG2_HPP_GP_20030301 + +#include <assert.h> +#ifdef __BORLANDC__ +#include <climits> +#endif +#include "boost/limits.hpp" +#include "boost/config.hpp" + + +namespace boost { + namespace detail { + + template <typename T> + int integer_log2_impl(T x, int n) { + + int result = 0; + + while (x != 1) { + + const T t = static_cast<T>(x >> n); + if (t) { + result += n; + x = t; + } + n /= 2; + + } + + return result; + } + + + + // helper to find the maximum power of two + // less than p (more involved than necessary, + // to avoid PTS) + // + template <int p, int n> + struct max_pow2_less { + + enum { c = 2*n < p }; + + BOOST_STATIC_CONSTANT(int, value = + c ? (max_pow2_less< c*p, 2*c*n>::value) : n); + + }; + + template <> + struct max_pow2_less<0, 0> { + + BOOST_STATIC_CONSTANT(int, value = 0); + }; + + // this template is here just for Borland :( + // we could simply rely on numeric_limits but sometimes + // Borland tries to use numeric_limits<const T>, because + // of its usual const-related problems in argument deduction + // - gps + template <typename T> + struct width { + +#ifdef __BORLANDC__ + BOOST_STATIC_CONSTANT(int, value = sizeof(T) * CHAR_BIT); +#else + BOOST_STATIC_CONSTANT(int, value = (std::numeric_limits<T>::digits)); +#endif + + }; + + } // detail + + + // --------- + // integer_log2 + // --------------- + // + template <typename T> + int integer_log2(T x) { + + assert(x > 0); + + const int n = detail::max_pow2_less< + detail::width<T> :: value, 4 + > :: value; + + return detail::integer_log2_impl(x, n); + + } + + + +} + + + +#endif // include guard diff --git a/3rdParty/Boost/src/boost/pointee.hpp b/3rdParty/Boost/src/boost/pointee.hpp new file mode 100644 index 0000000..9794b8e --- /dev/null +++ b/3rdParty/Boost/src/boost/pointee.hpp @@ -0,0 +1,74 @@ +#ifndef POINTEE_DWA200415_HPP +# define POINTEE_DWA200415_HPP + +// +// Copyright David Abrahams 2004. 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) +// +// typename pointee<P>::type provides the pointee type of P. +// +// For example, it is T for T* and X for shared_ptr<X>. +// +// http://www.boost.org/libs/iterator/doc/pointee.html +// + +# include <boost/detail/is_incrementable.hpp> +# include <boost/iterator/iterator_traits.hpp> +# include <boost/type_traits/add_const.hpp> +# include <boost/type_traits/remove_cv.hpp> +# include <boost/mpl/if.hpp> +# include <boost/mpl/eval_if.hpp> + +namespace boost { + +namespace detail +{ + template <class P> + struct smart_ptr_pointee + { + typedef typename P::element_type type; + }; + + template <class Iterator> + struct iterator_pointee + { + typedef typename iterator_traits<Iterator>::value_type value_type; + + struct impl + { + template <class T> + static char test(T const&); + + static char (& test(value_type&) )[2]; + + static Iterator& x; + }; + + BOOST_STATIC_CONSTANT(bool, is_constant = sizeof(impl::test(*impl::x)) == 1); + + typedef typename mpl::if_c< +# if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) + ::boost::detail::iterator_pointee<Iterator>::is_constant +# else + is_constant +# endif + , typename add_const<value_type>::type + , value_type + >::type type; + }; +} + +template <class P> +struct pointee + : mpl::eval_if< + detail::is_incrementable<P> + , detail::iterator_pointee<P> + , detail::smart_ptr_pointee<P> + > +{ +}; + +} // namespace boost + +#endif // POINTEE_DWA200415_HPP diff --git a/3rdParty/Boost/src/boost/pointer_to_other.hpp b/3rdParty/Boost/src/boost/pointer_to_other.hpp new file mode 100644 index 0000000..8516734 --- /dev/null +++ b/3rdParty/Boost/src/boost/pointer_to_other.hpp @@ -0,0 +1,55 @@ +#ifndef BOOST_POINTER_TO_OTHER_HPP_INCLUDED +#define BOOST_POINTER_TO_OTHER_HPP_INCLUDED + +// +// pointer_to_other.hpp +// +// (C) Copyright Ion Gaztanaga 2005. +// Copyright (c) 2005 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) +// +// See http://www.boost.org/libs/smart_ptr/pointer_to_other.html +// + +namespace boost +{ + +// Defines the same pointer type (raw or smart) to another pointee type + +template<class T, class U> +struct pointer_to_other; + +template<class T, class U, + template<class> class Sp> +struct pointer_to_other< Sp<T>, U > +{ + typedef Sp<U> type; +}; + +template<class T, class T2, class U, + template<class, class> class Sp> +struct pointer_to_other< Sp<T, T2>, U > +{ + typedef Sp<U, T2> type; +}; + +template<class T, class T2, class T3, class U, + template<class, class, class> class Sp> +struct pointer_to_other< Sp<T, T2, T3>, U > +{ + typedef Sp<U, T2, T3> type; +}; + +template<class T, class U> +struct pointer_to_other< T*, U > +{ + typedef U* type; +}; + +} // namespace boost + +#endif // #ifndef BOOST_POINTER_TO_OTHER_HPP_INCLUDED diff --git a/3rdParty/Boost/src/boost/preprocessor/cat.hpp b/3rdParty/Boost/src/boost/preprocessor/cat.hpp index b2a82c0..5e52850 100644 --- a/3rdParty/Boost/src/boost/preprocessor/cat.hpp +++ b/3rdParty/Boost/src/boost/preprocessor/cat.hpp @@ -28,8 +28,8 @@ # if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC() # define BOOST_PP_CAT_I(a, b) a ## b # else -# define BOOST_PP_CAT_I(a, b) BOOST_PP_CAT_II(a ## b) -# define BOOST_PP_CAT_II(res) res +# define BOOST_PP_CAT_I(a, b) BOOST_PP_CAT_II(~, a ## b) +# define BOOST_PP_CAT_II(p, res) res # endif # # endif diff --git a/3rdParty/Boost/src/boost/preprocessor/config/config.hpp b/3rdParty/Boost/src/boost/preprocessor/config/config.hpp index dd0f713..d02eb58 100644 --- a/3rdParty/Boost/src/boost/preprocessor/config/config.hpp +++ b/3rdParty/Boost/src/boost/preprocessor/config/config.hpp @@ -1,9 +1,10 @@ # /* ************************************************************************** # * * -# * (C) Copyright Paul Mensonides 2002. -# * 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) +# * (C) Copyright Paul Mensonides 2002-2011. * +# * (C) Copyright Edward Diener 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) * # * * # ************************************************************************** */ # @@ -67,4 +68,38 @@ # endif # endif # +# /* BOOST_PP_VARIADICS */ +# +# if !defined BOOST_PP_VARIADICS +# /* variadic support explicitly disabled for all untested compilers */ +# if defined __GCCXML__ || defined __CUDACC__ || defined __PATHSCALE__ || defined __clang__ || defined __DMC__ || defined __CODEGEARC__ || defined __BORLANDC__ || defined __MWERKS__ || defined __SUNPRO_CC || defined __HP_aCC && !defined __EDG__ || defined __MRC__ || defined __SC__ || defined __IBMCPP__ || defined __PGI +# define BOOST_PP_VARIADICS 0 +# /* VC++ (C/C++) */ +# elif defined _MSC_VER && _MSC_VER >= 1400 && !defined __EDG__ +# if _MSC_VER >= 1400 +# define BOOST_PP_VARIADICS 1 +# define BOOST_PP_VARIADICS_MSVC 1 +# else +# define BOOST_PP_VARIADICS 0 +# endif +# /* Wave (C/C++), GCC (C++) */ +# elif defined __WAVE__ && __WAVE_HAS_VARIADICS__ || defined __GNUC__ && __GXX_EXPERIMENTAL_CXX0X__ +# define BOOST_PP_VARIADICS 1 +# /* EDG-based (C/C++), GCC (C), and unknown (C/C++) */ +# elif !defined __cplusplus && __STDC_VERSION__ >= 199901L || __cplusplus >= 201103L +# define BOOST_PP_VARIADICS 1 +# else +# define BOOST_PP_VARIADICS 0 +# endif +# elif !BOOST_PP_VARIADICS + 1 < 2 +# undef BOOST_PP_VARIADICS +# define BOOST_PP_VARIADICS 1 +# if defined _MSC_VER && _MSC_VER >= 1400 && !(defined __EDG__ || defined __GCCXML__ || defined __CUDACC__ || defined __PATHSCALE__ || defined __clang__ || defined __DMC__ || defined __CODEGEARC__ || defined __BORLANDC__ || defined __MWERKS__ || defined __SUNPRO_CC || defined __HP_aCC || defined __MRC__ || defined __SC__ || defined __IBMCPP__ || defined __PGI) +# define BOOST_PP_VARIADICS_MSVC 1 +# endif +# else +# undef BOOST_PP_VARIADICS +# define BOOST_PP_VARIADICS 0 +# endif +# # endif diff --git a/3rdParty/Boost/src/boost/preprocessor/facilities/overload.hpp b/3rdParty/Boost/src/boost/preprocessor/facilities/overload.hpp new file mode 100644 index 0000000..1576316 --- /dev/null +++ b/3rdParty/Boost/src/boost/preprocessor/facilities/overload.hpp @@ -0,0 +1,25 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Paul Mensonides 2011. * +# * (C) Copyright Edward Diener 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) * +# * * +# ************************************************************************** */ +# +# /* See http://www.boost.org for most recent version. */ +# +# ifndef BOOST_PREPROCESSOR_FACILITIES_OVERLOAD_HPP +# define BOOST_PREPROCESSOR_FACILITIES_OVERLOAD_HPP +# +# include <boost/preprocessor/cat.hpp> +# include <boost/preprocessor/variadic/size.hpp> +# +# /* BOOST_PP_OVERLOAD */ +# +# if BOOST_PP_VARIADICS +# define BOOST_PP_OVERLOAD(prefix, ...) BOOST_PP_CAT(prefix, BOOST_PP_VARIADIC_SIZE(__VA_ARGS__)) +# endif +# +# endif diff --git a/3rdParty/Boost/src/boost/preprocessor/iteration/detail/iter/forward1.hpp b/3rdParty/Boost/src/boost/preprocessor/iteration/detail/iter/forward1.hpp index 3f41ba1..3c6a458 100644 --- a/3rdParty/Boost/src/boost/preprocessor/iteration/detail/iter/forward1.hpp +++ b/3rdParty/Boost/src/boost/preprocessor/iteration/detail/iter/forward1.hpp @@ -17,7 +17,7 @@ # include <boost/preprocessor/iteration/detail/bounds/lower1.hpp> # define BOOST_PP_VALUE BOOST_PP_TUPLE_ELEM(2, 1, BOOST_PP_ITERATION_LIMITS) # include <boost/preprocessor/iteration/detail/bounds/upper1.hpp> -# define BOOST_PP_ITERATION_FLAGS_1 0 +# define BOOST_PP_ITERATION_FLAGS_1() 0 # undef BOOST_PP_ITERATION_LIMITS # elif defined(BOOST_PP_ITERATION_PARAMS_1) # define BOOST_PP_VALUE BOOST_PP_ARRAY_ELEM(0, BOOST_PP_ITERATION_PARAMS_1) @@ -26,9 +26,9 @@ # include <boost/preprocessor/iteration/detail/bounds/upper1.hpp> # define BOOST_PP_FILENAME_1 BOOST_PP_ARRAY_ELEM(2, BOOST_PP_ITERATION_PARAMS_1) # if BOOST_PP_ARRAY_SIZE(BOOST_PP_ITERATION_PARAMS_1) >= 4 -# define BOOST_PP_ITERATION_FLAGS_1 BOOST_PP_ARRAY_ELEM(3, BOOST_PP_ITERATION_PARAMS_1) +# define BOOST_PP_ITERATION_FLAGS_1() BOOST_PP_ARRAY_ELEM(3, BOOST_PP_ITERATION_PARAMS_1) # else -# define BOOST_PP_ITERATION_FLAGS_1 0 +# define BOOST_PP_ITERATION_FLAGS_1() 0 # endif # else # error BOOST_PP_ERROR: depth #1 iteration boundaries or filename not defined diff --git a/3rdParty/Boost/src/boost/preprocessor/iteration/detail/iter/forward2.hpp b/3rdParty/Boost/src/boost/preprocessor/iteration/detail/iter/forward2.hpp index b689f63..e61a329 100644 --- a/3rdParty/Boost/src/boost/preprocessor/iteration/detail/iter/forward2.hpp +++ b/3rdParty/Boost/src/boost/preprocessor/iteration/detail/iter/forward2.hpp @@ -17,7 +17,7 @@ # include <boost/preprocessor/iteration/detail/bounds/lower2.hpp> # define BOOST_PP_VALUE BOOST_PP_TUPLE_ELEM(2, 1, BOOST_PP_ITERATION_LIMITS) # include <boost/preprocessor/iteration/detail/bounds/upper2.hpp> -# define BOOST_PP_ITERATION_FLAGS_2 0 +# define BOOST_PP_ITERATION_FLAGS_2() 0 # undef BOOST_PP_ITERATION_LIMITS # elif defined(BOOST_PP_ITERATION_PARAMS_2) # define BOOST_PP_VALUE BOOST_PP_ARRAY_ELEM(0, BOOST_PP_ITERATION_PARAMS_2) @@ -26,9 +26,9 @@ # include <boost/preprocessor/iteration/detail/bounds/upper2.hpp> # define BOOST_PP_FILENAME_2 BOOST_PP_ARRAY_ELEM(2, BOOST_PP_ITERATION_PARAMS_2) # if BOOST_PP_ARRAY_SIZE(BOOST_PP_ITERATION_PARAMS_2) >= 4 -# define BOOST_PP_ITERATION_FLAGS_2 BOOST_PP_ARRAY_ELEM(3, BOOST_PP_ITERATION_PARAMS_2) +# define BOOST_PP_ITERATION_FLAGS_2() BOOST_PP_ARRAY_ELEM(3, BOOST_PP_ITERATION_PARAMS_2) # else -# define BOOST_PP_ITERATION_FLAGS_2 0 +# define BOOST_PP_ITERATION_FLAGS_2() 0 # endif # else # error BOOST_PP_ERROR: depth #2 iteration boundaries or filename not defined diff --git a/3rdParty/Boost/src/boost/preprocessor/iteration/detail/iter/forward3.hpp b/3rdParty/Boost/src/boost/preprocessor/iteration/detail/iter/forward3.hpp index a25d0de..e68966f 100644 --- a/3rdParty/Boost/src/boost/preprocessor/iteration/detail/iter/forward3.hpp +++ b/3rdParty/Boost/src/boost/preprocessor/iteration/detail/iter/forward3.hpp @@ -17,7 +17,7 @@ # include <boost/preprocessor/iteration/detail/bounds/lower3.hpp> # define BOOST_PP_VALUE BOOST_PP_TUPLE_ELEM(2, 1, BOOST_PP_ITERATION_LIMITS) # include <boost/preprocessor/iteration/detail/bounds/upper3.hpp> -# define BOOST_PP_ITERATION_FLAGS_3 0 +# define BOOST_PP_ITERATION_FLAGS_3() 0 # undef BOOST_PP_ITERATION_LIMITS # elif defined(BOOST_PP_ITERATION_PARAMS_3) # define BOOST_PP_VALUE BOOST_PP_ARRAY_ELEM(0, BOOST_PP_ITERATION_PARAMS_3) @@ -26,9 +26,9 @@ # include <boost/preprocessor/iteration/detail/bounds/upper3.hpp> # define BOOST_PP_FILENAME_3 BOOST_PP_ARRAY_ELEM(2, BOOST_PP_ITERATION_PARAMS_3) # if BOOST_PP_ARRAY_SIZE(BOOST_PP_ITERATION_PARAMS_3) >= 4 -# define BOOST_PP_ITERATION_FLAGS_3 BOOST_PP_ARRAY_ELEM(3, BOOST_PP_ITERATION_PARAMS_3) +# define BOOST_PP_ITERATION_FLAGS_3() BOOST_PP_ARRAY_ELEM(3, BOOST_PP_ITERATION_PARAMS_3) # else -# define BOOST_PP_ITERATION_FLAGS_3 0 +# define BOOST_PP_ITERATION_FLAGS_3() 0 # endif # else # error BOOST_PP_ERROR: depth #3 iteration boundaries or filename not defined diff --git a/3rdParty/Boost/src/boost/preprocessor/iteration/detail/iter/forward4.hpp b/3rdParty/Boost/src/boost/preprocessor/iteration/detail/iter/forward4.hpp index 6a6e543..1b4f588 100644 --- a/3rdParty/Boost/src/boost/preprocessor/iteration/detail/iter/forward4.hpp +++ b/3rdParty/Boost/src/boost/preprocessor/iteration/detail/iter/forward4.hpp @@ -17,7 +17,7 @@ # include <boost/preprocessor/iteration/detail/bounds/lower4.hpp> # define BOOST_PP_VALUE BOOST_PP_TUPLE_ELEM(2, 1, BOOST_PP_ITERATION_LIMITS) # include <boost/preprocessor/iteration/detail/bounds/upper4.hpp> -# define BOOST_PP_ITERATION_FLAGS_4 0 +# define BOOST_PP_ITERATION_FLAGS_4() 0 # undef BOOST_PP_ITERATION_LIMITS # elif defined(BOOST_PP_ITERATION_PARAMS_4) # define BOOST_PP_VALUE BOOST_PP_ARRAY_ELEM(0, BOOST_PP_ITERATION_PARAMS_4) @@ -26,9 +26,9 @@ # include <boost/preprocessor/iteration/detail/bounds/upper4.hpp> # define BOOST_PP_FILENAME_4 BOOST_PP_ARRAY_ELEM(2, BOOST_PP_ITERATION_PARAMS_4) # if BOOST_PP_ARRAY_SIZE(BOOST_PP_ITERATION_PARAMS_4) >= 4 -# define BOOST_PP_ITERATION_FLAGS_4 BOOST_PP_ARRAY_ELEM(3, BOOST_PP_ITERATION_PARAMS_4) +# define BOOST_PP_ITERATION_FLAGS_4() BOOST_PP_ARRAY_ELEM(3, BOOST_PP_ITERATION_PARAMS_4) # else -# define BOOST_PP_ITERATION_FLAGS_4 0 +# define BOOST_PP_ITERATION_FLAGS_4() 0 # endif # else # error BOOST_PP_ERROR: depth #4 iteration boundaries or filename not defined diff --git a/3rdParty/Boost/src/boost/preprocessor/iteration/detail/iter/forward5.hpp b/3rdParty/Boost/src/boost/preprocessor/iteration/detail/iter/forward5.hpp index a16e207..7617607 100644 --- a/3rdParty/Boost/src/boost/preprocessor/iteration/detail/iter/forward5.hpp +++ b/3rdParty/Boost/src/boost/preprocessor/iteration/detail/iter/forward5.hpp @@ -17,7 +17,7 @@ # include <boost/preprocessor/iteration/detail/bounds/lower5.hpp> # define BOOST_PP_VALUE BOOST_PP_TUPLE_ELEM(2, 1, BOOST_PP_ITERATION_LIMITS) # include <boost/preprocessor/iteration/detail/bounds/upper5.hpp> -# define BOOST_PP_ITERATION_FLAGS_5 0 +# define BOOST_PP_ITERATION_FLAGS_5() 0 # undef BOOST_PP_ITERATION_LIMITS # elif defined(BOOST_PP_ITERATION_PARAMS_5) # define BOOST_PP_VALUE BOOST_PP_ARRAY_ELEM(0, BOOST_PP_ITERATION_PARAMS_5) @@ -26,9 +26,9 @@ # include <boost/preprocessor/iteration/detail/bounds/upper5.hpp> # define BOOST_PP_FILENAME_5 BOOST_PP_ARRAY_ELEM(2, BOOST_PP_ITERATION_PARAMS_5) # if BOOST_PP_ARRAY_SIZE(BOOST_PP_ITERATION_PARAMS_5) >= 4 -# define BOOST_PP_ITERATION_FLAGS_5 BOOST_PP_ARRAY_ELEM(3, BOOST_PP_ITERATION_PARAMS_5) +# define BOOST_PP_ITERATION_FLAGS_5() BOOST_PP_ARRAY_ELEM(3, BOOST_PP_ITERATION_PARAMS_5) # else -# define BOOST_PP_ITERATION_FLAGS_5 0 +# define BOOST_PP_ITERATION_FLAGS_5() 0 # endif # else # error BOOST_PP_ERROR: depth #5 iteration boundaries or filename not defined diff --git a/3rdParty/Boost/src/boost/preprocessor/iteration/iterate.hpp b/3rdParty/Boost/src/boost/preprocessor/iteration/iterate.hpp index aa0af67..8f861e7 100644 --- a/3rdParty/Boost/src/boost/preprocessor/iteration/iterate.hpp +++ b/3rdParty/Boost/src/boost/preprocessor/iteration/iterate.hpp @@ -35,7 +35,7 @@ # # /* BOOST_PP_ITERATION_FLAGS */ # -# define BOOST_PP_ITERATION_FLAGS() (BOOST_PP_CAT(BOOST_PP_ITERATION_FLAGS_, BOOST_PP_ITERATION_DEPTH())) +# define BOOST_PP_ITERATION_FLAGS() (BOOST_PP_CAT(BOOST_PP_ITERATION_FLAGS_, BOOST_PP_ITERATION_DEPTH())()) # # /* BOOST_PP_FRAME_ITERATION */ # @@ -48,7 +48,7 @@ # # /* BOOST_PP_FRAME_FLAGS */ # -# define BOOST_PP_FRAME_FLAGS(i) (BOOST_PP_CAT(BOOST_PP_ITERATION_FLAGS_, i)) +# define BOOST_PP_FRAME_FLAGS(i) (BOOST_PP_CAT(BOOST_PP_ITERATION_FLAGS_, i)()) # # /* BOOST_PP_RELATIVE_ITERATION */ # @@ -67,7 +67,7 @@ # # /* BOOST_PP_RELATIVE_FLAGS */ # -# define BOOST_PP_RELATIVE_FLAGS(i) (BOOST_PP_CAT(BOOST_PP_RELATIVE_, i)(BOOST_PP_ITERATION_FLAGS_)) +# define BOOST_PP_RELATIVE_FLAGS(i) (BOOST_PP_CAT(BOOST_PP_RELATIVE_, i)(BOOST_PP_ITERATION_FLAGS_)()) # # /* BOOST_PP_ITERATE */ # diff --git a/3rdParty/Boost/src/boost/preprocessor/punctuation/paren_if.hpp b/3rdParty/Boost/src/boost/preprocessor/punctuation/paren_if.hpp new file mode 100644 index 0000000..1239ec1 --- /dev/null +++ b/3rdParty/Boost/src/boost/preprocessor/punctuation/paren_if.hpp @@ -0,0 +1,38 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Paul Mensonides 2002. +# * 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) +# * * +# ************************************************************************** */ +# +# /* See http://www.boost.org for most recent version. */ +# +# ifndef BOOST_PREPROCESSOR_PUNCTUATION_PAREN_IF_HPP +# define BOOST_PREPROCESSOR_PUNCTUATION_PAREN_IF_HPP +# +# include <boost/preprocessor/config/config.hpp> +# include <boost/preprocessor/control/if.hpp> +# include <boost/preprocessor/facilities/empty.hpp> +# include <boost/preprocessor/punctuation/paren.hpp> +# +# /* BOOST_PP_LPAREN_IF */ +# +# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() +# define BOOST_PP_LPAREN_IF(cond) BOOST_PP_IF(cond, BOOST_PP_LPAREN, BOOST_PP_EMPTY)() +# else +# define BOOST_PP_LPAREN_IF(cond) BOOST_PP_LPAREN_IF_I(cond) +# define BOOST_PP_LPAREN_IF_I(cond) BOOST_PP_IF(cond, BOOST_PP_LPAREN, BOOST_PP_EMPTY)() +# endif +# +# /* BOOST_PP_RPAREN_IF */ +# +# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() +# define BOOST_PP_RPAREN_IF(cond) BOOST_PP_IF(cond, BOOST_PP_RPAREN, BOOST_PP_EMPTY)() +# else +# define BOOST_PP_RPAREN_IF(cond) BOOST_PP_RPAREN_IF_I(cond) +# define BOOST_PP_RPAREN_IF_I(cond) BOOST_PP_IF(cond, BOOST_PP_RPAREN, BOOST_PP_EMPTY)() +# endif +# +# endif diff --git a/3rdParty/Boost/src/boost/preprocessor/repeat_2nd.hpp b/3rdParty/Boost/src/boost/preprocessor/repeat_2nd.hpp new file mode 100644 index 0000000..030c432 --- /dev/null +++ b/3rdParty/Boost/src/boost/preprocessor/repeat_2nd.hpp @@ -0,0 +1,17 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Paul Mensonides 2002. +# * 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) +# * * +# ************************************************************************** */ +# +# /* See http://www.boost.org for most recent version. */ +# +# ifndef BOOST_PREPROCESSOR_REPEAT_2ND_HPP +# define BOOST_PREPROCESSOR_REPEAT_2ND_HPP +# +# include <boost/preprocessor/repetition/repeat.hpp> +# +# endif diff --git a/3rdParty/Boost/src/boost/preprocessor/repetition/enum_shifted.hpp b/3rdParty/Boost/src/boost/preprocessor/repetition/enum_shifted.hpp new file mode 100644 index 0000000..d5b006f --- /dev/null +++ b/3rdParty/Boost/src/boost/preprocessor/repetition/enum_shifted.hpp @@ -0,0 +1,68 @@ +# /* Copyright (C) 2001 +# * Housemarque Oy +# * http://www.housemarque.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) +# */ +# +# /* Revised by Paul Mensonides (2002) */ +# +# /* See http://www.boost.org for most recent version. */ +# +# ifndef BOOST_PREPROCESSOR_REPETITION_ENUM_SHIFTED_HPP +# define BOOST_PREPROCESSOR_REPETITION_ENUM_SHIFTED_HPP +# +# include <boost/preprocessor/cat.hpp> +# include <boost/preprocessor/arithmetic/dec.hpp> +# include <boost/preprocessor/arithmetic/inc.hpp> +# include <boost/preprocessor/config/config.hpp> +# include <boost/preprocessor/debug/error.hpp> +# include <boost/preprocessor/detail/auto_rec.hpp> +# include <boost/preprocessor/punctuation/comma_if.hpp> +# include <boost/preprocessor/repetition/repeat.hpp> +# include <boost/preprocessor/tuple/elem.hpp> +# include <boost/preprocessor/tuple/rem.hpp> +# +# /* BOOST_PP_ENUM_SHIFTED */ +# +# if 0 +# define BOOST_PP_ENUM_SHIFTED(count, macro, data) +# endif +# +# define BOOST_PP_ENUM_SHIFTED BOOST_PP_CAT(BOOST_PP_ENUM_SHIFTED_, BOOST_PP_AUTO_REC(BOOST_PP_REPEAT_P, 4)) +# +# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() +# define BOOST_PP_ENUM_SHIFTED_1(c, m, d) BOOST_PP_REPEAT_1(BOOST_PP_DEC(c), BOOST_PP_ENUM_SHIFTED_M_1, (m, d)) +# define BOOST_PP_ENUM_SHIFTED_2(c, m, d) BOOST_PP_REPEAT_2(BOOST_PP_DEC(c), BOOST_PP_ENUM_SHIFTED_M_2, (m, d)) +# define BOOST_PP_ENUM_SHIFTED_3(c, m, d) BOOST_PP_REPEAT_3(BOOST_PP_DEC(c), BOOST_PP_ENUM_SHIFTED_M_3, (m, d)) +# else +# define BOOST_PP_ENUM_SHIFTED_1(c, m, d) BOOST_PP_ENUM_SHIFTED_1_I(c, m, d) +# define BOOST_PP_ENUM_SHIFTED_2(c, m, d) BOOST_PP_ENUM_SHIFTED_1_2(c, m, d) +# define BOOST_PP_ENUM_SHIFTED_3(c, m, d) BOOST_PP_ENUM_SHIFTED_1_3(c, m, d) +# define BOOST_PP_ENUM_SHIFTED_1_I(c, m, d) BOOST_PP_REPEAT_1(BOOST_PP_DEC(c), BOOST_PP_ENUM_SHIFTED_M_1, (m, d)) +# define BOOST_PP_ENUM_SHIFTED_2_I(c, m, d) BOOST_PP_REPEAT_2(BOOST_PP_DEC(c), BOOST_PP_ENUM_SHIFTED_M_2, (m, d)) +# define BOOST_PP_ENUM_SHIFTED_3_I(c, m, d) BOOST_PP_REPEAT_3(BOOST_PP_DEC(c), BOOST_PP_ENUM_SHIFTED_M_3, (m, d)) +# endif +# +# define BOOST_PP_ENUM_SHIFTED_4(c, m, d) BOOST_PP_ERROR(0x0003) +# +# if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_STRICT() +# define BOOST_PP_ENUM_SHIFTED_M_1(z, n, md) BOOST_PP_ENUM_SHIFTED_M_1_IM(z, n, BOOST_PP_TUPLE_REM_2 md) +# define BOOST_PP_ENUM_SHIFTED_M_2(z, n, md) BOOST_PP_ENUM_SHIFTED_M_2_IM(z, n, BOOST_PP_TUPLE_REM_2 md) +# define BOOST_PP_ENUM_SHIFTED_M_3(z, n, md) BOOST_PP_ENUM_SHIFTED_M_3_IM(z, n, BOOST_PP_TUPLE_REM_2 md) +# define BOOST_PP_ENUM_SHIFTED_M_1_IM(z, n, im) BOOST_PP_ENUM_SHIFTED_M_1_I(z, n, im) +# define BOOST_PP_ENUM_SHIFTED_M_2_IM(z, n, im) BOOST_PP_ENUM_SHIFTED_M_2_I(z, n, im) +# define BOOST_PP_ENUM_SHIFTED_M_3_IM(z, n, im) BOOST_PP_ENUM_SHIFTED_M_3_I(z, n, im) +# else +# define BOOST_PP_ENUM_SHIFTED_M_1(z, n, md) BOOST_PP_ENUM_SHIFTED_M_1_I(z, n, BOOST_PP_TUPLE_ELEM(2, 0, md), BOOST_PP_TUPLE_ELEM(2, 1, md)) +# define BOOST_PP_ENUM_SHIFTED_M_2(z, n, md) BOOST_PP_ENUM_SHIFTED_M_2_I(z, n, BOOST_PP_TUPLE_ELEM(2, 0, md), BOOST_PP_TUPLE_ELEM(2, 1, md)) +# define BOOST_PP_ENUM_SHIFTED_M_3(z, n, md) BOOST_PP_ENUM_SHIFTED_M_3_I(z, n, BOOST_PP_TUPLE_ELEM(2, 0, md), BOOST_PP_TUPLE_ELEM(2, 1, md)) +# endif +# +# define BOOST_PP_ENUM_SHIFTED_M_1_I(z, n, m, d) BOOST_PP_COMMA_IF(n) m(z, BOOST_PP_INC(n), d) +# define BOOST_PP_ENUM_SHIFTED_M_2_I(z, n, m, d) BOOST_PP_COMMA_IF(n) m(z, BOOST_PP_INC(n), d) +# define BOOST_PP_ENUM_SHIFTED_M_3_I(z, n, m, d) BOOST_PP_COMMA_IF(n) m(z, BOOST_PP_INC(n), d) +# +# endif diff --git a/3rdParty/Boost/src/boost/preprocessor/seq/cat.hpp b/3rdParty/Boost/src/boost/preprocessor/seq/cat.hpp index 0efd8e5..b6b09ff 100644 --- a/3rdParty/Boost/src/boost/preprocessor/seq/cat.hpp +++ b/3rdParty/Boost/src/boost/preprocessor/seq/cat.hpp @@ -26,7 +26,7 @@ BOOST_PP_IF( \ BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(seq)), \ BOOST_PP_SEQ_CAT_I, \ - BOOST_PP_SEQ_HEAD(seq) BOOST_PP_TUPLE_EAT_1 \ + BOOST_PP_SEQ_HEAD \ )(seq) \ /**/ # define BOOST_PP_SEQ_CAT_I(seq) BOOST_PP_SEQ_FOLD_LEFT(BOOST_PP_SEQ_CAT_O, BOOST_PP_SEQ_HEAD(seq), BOOST_PP_SEQ_TAIL(seq)) @@ -39,10 +39,11 @@ # define BOOST_PP_SEQ_CAT_S(s, seq) \ BOOST_PP_IF( \ BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(seq)), \ - BOOST_PP_SEQ_CAT_S_I, \ - BOOST_PP_SEQ_HEAD(seq) BOOST_PP_TUPLE_EAT_2 \ + BOOST_PP_SEQ_CAT_S_I_A, \ + BOOST_PP_SEQ_CAT_S_I_B \ )(s, seq) \ /**/ -# define BOOST_PP_SEQ_CAT_S_I(s, seq) BOOST_PP_SEQ_FOLD_LEFT_ ## s(BOOST_PP_SEQ_CAT_O, BOOST_PP_SEQ_HEAD(seq), BOOST_PP_SEQ_TAIL(seq)) +# define BOOST_PP_SEQ_CAT_S_I_A(s, seq) BOOST_PP_SEQ_FOLD_LEFT_ ## s(BOOST_PP_SEQ_CAT_O, BOOST_PP_SEQ_HEAD(seq), BOOST_PP_SEQ_TAIL(seq)) +# define BOOST_PP_SEQ_CAT_S_I_B(s, seq) BOOST_PP_SEQ_HEAD(seq) # # endif diff --git a/3rdParty/Boost/src/boost/preprocessor/seq/size.hpp b/3rdParty/Boost/src/boost/preprocessor/seq/size.hpp index 2f7b70e..385c00a 100644 --- a/3rdParty/Boost/src/boost/preprocessor/seq/size.hpp +++ b/3rdParty/Boost/src/boost/preprocessor/seq/size.hpp @@ -14,7 +14,6 @@ # # include <boost/preprocessor/cat.hpp> # include <boost/preprocessor/config/config.hpp> -# include <boost/preprocessor/tuple/eat.hpp> # # if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC() # define BOOST_PP_SEQ_SIZE(seq) BOOST_PP_SEQ_SIZE_I((seq)) diff --git a/3rdParty/Boost/src/boost/preprocessor/tuple/eat.hpp b/3rdParty/Boost/src/boost/preprocessor/tuple/eat.hpp index 82e8ffc..708015e 100644 --- a/3rdParty/Boost/src/boost/preprocessor/tuple/eat.hpp +++ b/3rdParty/Boost/src/boost/preprocessor/tuple/eat.hpp @@ -7,7 +7,8 @@ # * http://www.boost.org/LICENSE_1_0.txt) # */ # -# /* Revised by Paul Mensonides (2002) */ +# /* Revised by Paul Mensonides (2002-2011) */ +# /* Revised by Edward Diener (2011) */ # # /* See http://www.boost.org for most recent version. */ # @@ -16,42 +17,90 @@ # # include <boost/preprocessor/config/config.hpp> # -# /* BOOST_PP_TUPLE_EAT */ +# /* BOOST_PP_EAT */ # -# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC() -# define BOOST_PP_TUPLE_EAT(size) BOOST_PP_TUPLE_EAT_I(size) +# if BOOST_PP_VARIADICS +# define BOOST_PP_EAT(...) # else -# define BOOST_PP_TUPLE_EAT(size) BOOST_PP_TUPLE_EAT_OO((size)) -# define BOOST_PP_TUPLE_EAT_OO(par) BOOST_PP_TUPLE_EAT_I ## par +# define BOOST_PP_EAT(x) # endif # -# define BOOST_PP_TUPLE_EAT_I(size) BOOST_PP_TUPLE_EAT_ ## size -# -# define BOOST_PP_TUPLE_EAT_0() -# define BOOST_PP_TUPLE_EAT_1(a) -# define BOOST_PP_TUPLE_EAT_2(a, b) -# define BOOST_PP_TUPLE_EAT_3(a, b, c) -# define BOOST_PP_TUPLE_EAT_4(a, b, c, d) -# define BOOST_PP_TUPLE_EAT_5(a, b, c, d, e) -# define BOOST_PP_TUPLE_EAT_6(a, b, c, d, e, f) -# define BOOST_PP_TUPLE_EAT_7(a, b, c, d, e, f, g) -# define BOOST_PP_TUPLE_EAT_8(a, b, c, d, e, f, g, h) -# define BOOST_PP_TUPLE_EAT_9(a, b, c, d, e, f, g, h, i) -# define BOOST_PP_TUPLE_EAT_10(a, b, c, d, e, f, g, h, i, j) -# define BOOST_PP_TUPLE_EAT_11(a, b, c, d, e, f, g, h, i, j, k) -# define BOOST_PP_TUPLE_EAT_12(a, b, c, d, e, f, g, h, i, j, k, l) -# define BOOST_PP_TUPLE_EAT_13(a, b, c, d, e, f, g, h, i, j, k, l, m) -# define BOOST_PP_TUPLE_EAT_14(a, b, c, d, e, f, g, h, i, j, k, l, m, n) -# define BOOST_PP_TUPLE_EAT_15(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) -# define BOOST_PP_TUPLE_EAT_16(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) -# define BOOST_PP_TUPLE_EAT_17(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) -# define BOOST_PP_TUPLE_EAT_18(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) -# define BOOST_PP_TUPLE_EAT_19(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) -# define BOOST_PP_TUPLE_EAT_20(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) -# define BOOST_PP_TUPLE_EAT_21(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) -# define BOOST_PP_TUPLE_EAT_22(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) -# define BOOST_PP_TUPLE_EAT_23(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) -# define BOOST_PP_TUPLE_EAT_24(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) -# define BOOST_PP_TUPLE_EAT_25(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) +# /* BOOST_PP_TUPLE_EAT */ +# +# if BOOST_PP_VARIADICS +# define BOOST_PP_TUPLE_EAT(size) BOOST_PP_EAT +# else +# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC() +# define BOOST_PP_TUPLE_EAT(size) BOOST_PP_TUPLE_EAT_I(size) +# else +# define BOOST_PP_TUPLE_EAT(size) BOOST_PP_TUPLE_EAT_OO((size)) +# define BOOST_PP_TUPLE_EAT_OO(par) BOOST_PP_TUPLE_EAT_I ## par +# endif +# define BOOST_PP_TUPLE_EAT_I(size) BOOST_PP_TUPLE_EAT_ ## size +# endif +# define BOOST_PP_TUPLE_EAT_1(e0) +# define BOOST_PP_TUPLE_EAT_2(e0, e1) +# define BOOST_PP_TUPLE_EAT_3(e0, e1, e2) +# define BOOST_PP_TUPLE_EAT_4(e0, e1, e2, e3) +# define BOOST_PP_TUPLE_EAT_5(e0, e1, e2, e3, e4) +# define BOOST_PP_TUPLE_EAT_6(e0, e1, e2, e3, e4, e5) +# define BOOST_PP_TUPLE_EAT_7(e0, e1, e2, e3, e4, e5, e6) +# define BOOST_PP_TUPLE_EAT_8(e0, e1, e2, e3, e4, e5, e6, e7) +# define BOOST_PP_TUPLE_EAT_9(e0, e1, e2, e3, e4, e5, e6, e7, e8) +# define BOOST_PP_TUPLE_EAT_10(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9) +# define BOOST_PP_TUPLE_EAT_11(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10) +# define BOOST_PP_TUPLE_EAT_12(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11) +# define BOOST_PP_TUPLE_EAT_13(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12) +# define BOOST_PP_TUPLE_EAT_14(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13) +# define BOOST_PP_TUPLE_EAT_15(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14) +# define BOOST_PP_TUPLE_EAT_16(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15) +# define BOOST_PP_TUPLE_EAT_17(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16) +# define BOOST_PP_TUPLE_EAT_18(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17) +# define BOOST_PP_TUPLE_EAT_19(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18) +# define BOOST_PP_TUPLE_EAT_20(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19) +# define BOOST_PP_TUPLE_EAT_21(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20) +# define BOOST_PP_TUPLE_EAT_22(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21) +# define BOOST_PP_TUPLE_EAT_23(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22) +# define BOOST_PP_TUPLE_EAT_24(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23) +# define BOOST_PP_TUPLE_EAT_25(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24) +# define BOOST_PP_TUPLE_EAT_26(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25) +# define BOOST_PP_TUPLE_EAT_27(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26) +# define BOOST_PP_TUPLE_EAT_28(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27) +# define BOOST_PP_TUPLE_EAT_29(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28) +# define BOOST_PP_TUPLE_EAT_30(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29) +# define BOOST_PP_TUPLE_EAT_31(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30) +# define BOOST_PP_TUPLE_EAT_32(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31) +# define BOOST_PP_TUPLE_EAT_33(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32) +# define BOOST_PP_TUPLE_EAT_34(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33) +# define BOOST_PP_TUPLE_EAT_35(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34) +# define BOOST_PP_TUPLE_EAT_36(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35) +# define BOOST_PP_TUPLE_EAT_37(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36) +# define BOOST_PP_TUPLE_EAT_38(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37) +# define BOOST_PP_TUPLE_EAT_39(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38) +# define BOOST_PP_TUPLE_EAT_40(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39) +# define BOOST_PP_TUPLE_EAT_41(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40) +# define BOOST_PP_TUPLE_EAT_42(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41) +# define BOOST_PP_TUPLE_EAT_43(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42) +# define BOOST_PP_TUPLE_EAT_44(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43) +# define BOOST_PP_TUPLE_EAT_45(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44) +# define BOOST_PP_TUPLE_EAT_46(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45) +# define BOOST_PP_TUPLE_EAT_47(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46) +# define BOOST_PP_TUPLE_EAT_48(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47) +# define BOOST_PP_TUPLE_EAT_49(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48) +# define BOOST_PP_TUPLE_EAT_50(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49) +# define BOOST_PP_TUPLE_EAT_51(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50) +# define BOOST_PP_TUPLE_EAT_52(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51) +# define BOOST_PP_TUPLE_EAT_53(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52) +# define BOOST_PP_TUPLE_EAT_54(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53) +# define BOOST_PP_TUPLE_EAT_55(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54) +# define BOOST_PP_TUPLE_EAT_56(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55) +# define BOOST_PP_TUPLE_EAT_57(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56) +# define BOOST_PP_TUPLE_EAT_58(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57) +# define BOOST_PP_TUPLE_EAT_59(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58) +# define BOOST_PP_TUPLE_EAT_60(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59) +# define BOOST_PP_TUPLE_EAT_61(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60) +# define BOOST_PP_TUPLE_EAT_62(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61) +# define BOOST_PP_TUPLE_EAT_63(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62) +# define BOOST_PP_TUPLE_EAT_64(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) # # endif diff --git a/3rdParty/Boost/src/boost/preprocessor/tuple/elem.hpp b/3rdParty/Boost/src/boost/preprocessor/tuple/elem.hpp index 2e225ae..3eba1c5 100644 --- a/3rdParty/Boost/src/boost/preprocessor/tuple/elem.hpp +++ b/3rdParty/Boost/src/boost/preprocessor/tuple/elem.hpp @@ -7,30 +7,177 @@ # * http://www.boost.org/LICENSE_1_0.txt) # */ # -# /* Revised by Paul Mensonides (2002) */ +# /* Revised by Paul Mensonides (2002-2011) */ +# /* Revised by Edward Diener (2011) */ # # /* See http://www.boost.org for most recent version. */ # # ifndef BOOST_PREPROCESSOR_TUPLE_ELEM_HPP # define BOOST_PREPROCESSOR_TUPLE_ELEM_HPP # +# include <boost/preprocessor/cat.hpp> # include <boost/preprocessor/config/config.hpp> -# -# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC() -# define BOOST_PP_TUPLE_ELEM(size, index, tuple) BOOST_PP_TUPLE_ELEM_I(size, index, tuple) +# include <boost/preprocessor/facilities/overload.hpp> +# include <boost/preprocessor/tuple/rem.hpp> +# include <boost/preprocessor/variadic/elem.hpp> +# +# if BOOST_PP_VARIADICS +# if BOOST_PP_VARIADICS_MSVC +# define BOOST_PP_TUPLE_ELEM(...) BOOST_PP_TUPLE_ELEM_I(BOOST_PP_OVERLOAD(BOOST_PP_TUPLE_ELEM_O_, __VA_ARGS__), (__VA_ARGS__)) +# define BOOST_PP_TUPLE_ELEM_I(m, args) BOOST_PP_TUPLE_ELEM_II(m, args) +# define BOOST_PP_TUPLE_ELEM_II(m, args) BOOST_PP_CAT(m ## args,) +# else +# define BOOST_PP_TUPLE_ELEM(...) BOOST_PP_OVERLOAD(BOOST_PP_TUPLE_ELEM_O_, __VA_ARGS__)(__VA_ARGS__) +# endif +# define BOOST_PP_TUPLE_ELEM_O_2(n, tuple) BOOST_PP_VARIADIC_ELEM(n, BOOST_PP_REM tuple) +# define BOOST_PP_TUPLE_ELEM_O_3(size, n, tuple) BOOST_PP_TUPLE_ELEM_O_2(n, tuple) # else -# define BOOST_PP_TUPLE_ELEM(size, index, tuple) BOOST_PP_TUPLE_ELEM_OO((size, index, tuple)) -# define BOOST_PP_TUPLE_ELEM_OO(par) BOOST_PP_TUPLE_ELEM_I ## par +# if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC() +# define BOOST_PP_TUPLE_ELEM(size, n, tuple) BOOST_PP_TUPLE_ELEM_I(BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM_, n), BOOST_PP_CAT(BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM_E_, size), tuple)) +# define BOOST_PP_TUPLE_ELEM_I(m, args) BOOST_PP_TUPLE_ELEM_II(m, args) +# define BOOST_PP_TUPLE_ELEM_II(m, args) BOOST_PP_CAT(m ## args,) +# elif BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC() +# define BOOST_PP_TUPLE_ELEM(size, n, tuple) BOOST_PP_TUPLE_ELEM_I_OO((size, n, tuple)) +# define BOOST_PP_TUPLE_ELEM_I_OO(par) BOOST_PP_TUPLE_ELEM_I ## par +# define BOOST_PP_TUPLE_ELEM_I(size, n, tuple) BOOST_PP_TUPLE_ELEM_II((n, BOOST_PP_TUPLE_ELEM_E_ ## size ## tuple)) +# define BOOST_PP_TUPLE_ELEM_II(par) BOOST_PP_TUPLE_ELEM_III_OO(par) +# define BOOST_PP_TUPLE_ELEM_III_OO(par) BOOST_PP_TUPLE_ELEM_III ## par +# define BOOST_PP_TUPLE_ELEM_III(n, etuple) BOOST_PP_TUPLE_ELEM_ ## n ## etuple +# else +# define BOOST_PP_TUPLE_ELEM(size, n, tuple) BOOST_PP_TUPLE_ELEM_I(BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM_, n) BOOST_PP_CAT(BOOST_PP_TUPLE_ELEM_E_, size) tuple) +# define BOOST_PP_TUPLE_ELEM_I(x) x +# endif +# define BOOST_PP_TUPLE_ELEM_E_1(e0) (e0, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) +# define BOOST_PP_TUPLE_ELEM_E_2(e0, e1) (e0, e1, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) +# define BOOST_PP_TUPLE_ELEM_E_3(e0, e1, e2) (e0, e1, e2, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) +# define BOOST_PP_TUPLE_ELEM_E_4(e0, e1, e2, e3) (e0, e1, e2, e3, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) +# define BOOST_PP_TUPLE_ELEM_E_5(e0, e1, e2, e3, e4) (e0, e1, e2, e3, e4, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) +# define BOOST_PP_TUPLE_ELEM_E_6(e0, e1, e2, e3, e4, e5) (e0, e1, e2, e3, e4, e5, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) +# define BOOST_PP_TUPLE_ELEM_E_7(e0, e1, e2, e3, e4, e5, e6) (e0, e1, e2, e3, e4, e5, e6, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) +# define BOOST_PP_TUPLE_ELEM_E_8(e0, e1, e2, e3, e4, e5, e6, e7) (e0, e1, e2, e3, e4, e5, e6, e7, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) +# define BOOST_PP_TUPLE_ELEM_E_9(e0, e1, e2, e3, e4, e5, e6, e7, e8) (e0, e1, e2, e3, e4, e5, e6, e7, e8, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) +# define BOOST_PP_TUPLE_ELEM_E_10(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) +# define BOOST_PP_TUPLE_ELEM_E_11(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) +# define BOOST_PP_TUPLE_ELEM_E_12(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) +# define BOOST_PP_TUPLE_ELEM_E_13(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) +# define BOOST_PP_TUPLE_ELEM_E_14(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) +# define BOOST_PP_TUPLE_ELEM_E_15(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) +# define BOOST_PP_TUPLE_ELEM_E_16(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) +# define BOOST_PP_TUPLE_ELEM_E_17(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) +# define BOOST_PP_TUPLE_ELEM_E_18(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) +# define BOOST_PP_TUPLE_ELEM_E_19(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) +# define BOOST_PP_TUPLE_ELEM_E_20(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) +# define BOOST_PP_TUPLE_ELEM_E_21(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) +# define BOOST_PP_TUPLE_ELEM_E_22(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) +# define BOOST_PP_TUPLE_ELEM_E_23(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) +# define BOOST_PP_TUPLE_ELEM_E_24(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) +# define BOOST_PP_TUPLE_ELEM_E_25(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) +# define BOOST_PP_TUPLE_ELEM_E_26(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) +# define BOOST_PP_TUPLE_ELEM_E_27(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) +# define BOOST_PP_TUPLE_ELEM_E_28(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) +# define BOOST_PP_TUPLE_ELEM_E_29(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) +# define BOOST_PP_TUPLE_ELEM_E_30(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) +# define BOOST_PP_TUPLE_ELEM_E_31(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) +# define BOOST_PP_TUPLE_ELEM_E_32(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) +# define BOOST_PP_TUPLE_ELEM_E_33(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) +# define BOOST_PP_TUPLE_ELEM_E_34(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) +# define BOOST_PP_TUPLE_ELEM_E_35(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) +# define BOOST_PP_TUPLE_ELEM_E_36(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) +# define BOOST_PP_TUPLE_ELEM_E_37(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) +# define BOOST_PP_TUPLE_ELEM_E_38(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) +# define BOOST_PP_TUPLE_ELEM_E_39(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) +# define BOOST_PP_TUPLE_ELEM_E_40(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) +# define BOOST_PP_TUPLE_ELEM_E_41(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) +# define BOOST_PP_TUPLE_ELEM_E_42(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) +# define BOOST_PP_TUPLE_ELEM_E_43(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) +# define BOOST_PP_TUPLE_ELEM_E_44(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) +# define BOOST_PP_TUPLE_ELEM_E_45(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) +# define BOOST_PP_TUPLE_ELEM_E_46(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) +# define BOOST_PP_TUPLE_ELEM_E_47(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) +# define BOOST_PP_TUPLE_ELEM_E_48(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) +# define BOOST_PP_TUPLE_ELEM_E_49(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) +# define BOOST_PP_TUPLE_ELEM_E_50(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) +# define BOOST_PP_TUPLE_ELEM_E_51(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) +# define BOOST_PP_TUPLE_ELEM_E_52(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) +# define BOOST_PP_TUPLE_ELEM_E_53(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) +# define BOOST_PP_TUPLE_ELEM_E_54(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) +# define BOOST_PP_TUPLE_ELEM_E_55(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, ?, ?, ?, ?, ?, ?, ?, ?, ?) +# define BOOST_PP_TUPLE_ELEM_E_56(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, ?, ?, ?, ?, ?, ?, ?, ?) +# define BOOST_PP_TUPLE_ELEM_E_57(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, ?, ?, ?, ?, ?, ?, ?) +# define BOOST_PP_TUPLE_ELEM_E_58(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, ?, ?, ?, ?, ?, ?) +# define BOOST_PP_TUPLE_ELEM_E_59(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, ?, ?, ?, ?, ?) +# define BOOST_PP_TUPLE_ELEM_E_60(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, ?, ?, ?, ?) +# define BOOST_PP_TUPLE_ELEM_E_61(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, ?, ?, ?) +# define BOOST_PP_TUPLE_ELEM_E_62(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, ?, ?) +# define BOOST_PP_TUPLE_ELEM_E_63(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62) (e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, ?) +# define BOOST_PP_TUPLE_ELEM_E_64 +# define BOOST_PP_TUPLE_ELEM_0(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) e0 +# define BOOST_PP_TUPLE_ELEM_1(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) e1 +# define BOOST_PP_TUPLE_ELEM_2(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) e2 +# define BOOST_PP_TUPLE_ELEM_3(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) e3 +# define BOOST_PP_TUPLE_ELEM_4(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) e4 +# define BOOST_PP_TUPLE_ELEM_5(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) e5 +# define BOOST_PP_TUPLE_ELEM_6(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) e6 +# define BOOST_PP_TUPLE_ELEM_7(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) e7 +# define BOOST_PP_TUPLE_ELEM_8(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) e8 +# define BOOST_PP_TUPLE_ELEM_9(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) e9 +# define BOOST_PP_TUPLE_ELEM_10(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) e10 +# define BOOST_PP_TUPLE_ELEM_11(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) e11 +# define BOOST_PP_TUPLE_ELEM_12(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) e12 +# define BOOST_PP_TUPLE_ELEM_13(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) e13 +# define BOOST_PP_TUPLE_ELEM_14(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) e14 +# define BOOST_PP_TUPLE_ELEM_15(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) e15 +# define BOOST_PP_TUPLE_ELEM_16(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) e16 +# define BOOST_PP_TUPLE_ELEM_17(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) e17 +# define BOOST_PP_TUPLE_ELEM_18(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) e18 +# define BOOST_PP_TUPLE_ELEM_19(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) e19 +# define BOOST_PP_TUPLE_ELEM_20(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) e20 +# define BOOST_PP_TUPLE_ELEM_21(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) e21 +# define BOOST_PP_TUPLE_ELEM_22(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) e22 +# define BOOST_PP_TUPLE_ELEM_23(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) e23 +# define BOOST_PP_TUPLE_ELEM_24(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) e24 +# define BOOST_PP_TUPLE_ELEM_25(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) e25 +# define BOOST_PP_TUPLE_ELEM_26(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) e26 +# define BOOST_PP_TUPLE_ELEM_27(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) e27 +# define BOOST_PP_TUPLE_ELEM_28(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) e28 +# define BOOST_PP_TUPLE_ELEM_29(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) e29 +# define BOOST_PP_TUPLE_ELEM_30(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) e30 +# define BOOST_PP_TUPLE_ELEM_31(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) e31 +# define BOOST_PP_TUPLE_ELEM_32(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) e32 +# define BOOST_PP_TUPLE_ELEM_33(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) e33 +# define BOOST_PP_TUPLE_ELEM_34(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) e34 +# define BOOST_PP_TUPLE_ELEM_35(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) e35 +# define BOOST_PP_TUPLE_ELEM_36(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) e36 +# define BOOST_PP_TUPLE_ELEM_37(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) e37 +# define BOOST_PP_TUPLE_ELEM_38(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) e38 +# define BOOST_PP_TUPLE_ELEM_39(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) e39 +# define BOOST_PP_TUPLE_ELEM_40(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) e40 +# define BOOST_PP_TUPLE_ELEM_41(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) e41 +# define BOOST_PP_TUPLE_ELEM_42(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) e42 +# define BOOST_PP_TUPLE_ELEM_43(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) e43 +# define BOOST_PP_TUPLE_ELEM_44(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) e44 +# define BOOST_PP_TUPLE_ELEM_45(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) e45 +# define BOOST_PP_TUPLE_ELEM_46(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) e46 +# define BOOST_PP_TUPLE_ELEM_47(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) e47 +# define BOOST_PP_TUPLE_ELEM_48(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) e48 +# define BOOST_PP_TUPLE_ELEM_49(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) e49 +# define BOOST_PP_TUPLE_ELEM_50(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) e50 +# define BOOST_PP_TUPLE_ELEM_51(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) e51 +# define BOOST_PP_TUPLE_ELEM_52(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) e52 +# define BOOST_PP_TUPLE_ELEM_53(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) e53 +# define BOOST_PP_TUPLE_ELEM_54(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) e54 +# define BOOST_PP_TUPLE_ELEM_55(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) e55 +# define BOOST_PP_TUPLE_ELEM_56(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) e56 +# define BOOST_PP_TUPLE_ELEM_57(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) e57 +# define BOOST_PP_TUPLE_ELEM_58(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) e58 +# define BOOST_PP_TUPLE_ELEM_59(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) e59 +# define BOOST_PP_TUPLE_ELEM_60(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) e60 +# define BOOST_PP_TUPLE_ELEM_61(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) e61 +# define BOOST_PP_TUPLE_ELEM_62(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) e62 +# define BOOST_PP_TUPLE_ELEM_63(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) e63 # endif # -# if BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC() -# define BOOST_PP_TUPLE_ELEM_I(s, i, t) BOOST_PP_TUPLE_ELEM_ ## s ## _ ## i ## t -# elif BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC() -# define BOOST_PP_TUPLE_ELEM_I(s, i, t) BOOST_PP_TUPLE_ELEM_II(BOOST_PP_TUPLE_ELEM_ ## s ## _ ## i t) -# define BOOST_PP_TUPLE_ELEM_II(res) res -# else -# define BOOST_PP_TUPLE_ELEM_I(s, i, t) BOOST_PP_TUPLE_ELEM_ ## s ## _ ## i t -# endif +# /* directly used elsewhere in Boost... */ # # define BOOST_PP_TUPLE_ELEM_1_0(a) a # @@ -41,345 +188,4 @@ # define BOOST_PP_TUPLE_ELEM_3_1(a, b, c) b # define BOOST_PP_TUPLE_ELEM_3_2(a, b, c) c # -# define BOOST_PP_TUPLE_ELEM_4_0(a, b, c, d) a -# define BOOST_PP_TUPLE_ELEM_4_1(a, b, c, d) b -# define BOOST_PP_TUPLE_ELEM_4_2(a, b, c, d) c -# define BOOST_PP_TUPLE_ELEM_4_3(a, b, c, d) d -# -# define BOOST_PP_TUPLE_ELEM_5_0(a, b, c, d, e) a -# define BOOST_PP_TUPLE_ELEM_5_1(a, b, c, d, e) b -# define BOOST_PP_TUPLE_ELEM_5_2(a, b, c, d, e) c -# define BOOST_PP_TUPLE_ELEM_5_3(a, b, c, d, e) d -# define BOOST_PP_TUPLE_ELEM_5_4(a, b, c, d, e) e -# -# define BOOST_PP_TUPLE_ELEM_6_0(a, b, c, d, e, f) a -# define BOOST_PP_TUPLE_ELEM_6_1(a, b, c, d, e, f) b -# define BOOST_PP_TUPLE_ELEM_6_2(a, b, c, d, e, f) c -# define BOOST_PP_TUPLE_ELEM_6_3(a, b, c, d, e, f) d -# define BOOST_PP_TUPLE_ELEM_6_4(a, b, c, d, e, f) e -# define BOOST_PP_TUPLE_ELEM_6_5(a, b, c, d, e, f) f -# -# define BOOST_PP_TUPLE_ELEM_7_0(a, b, c, d, e, f, g) a -# define BOOST_PP_TUPLE_ELEM_7_1(a, b, c, d, e, f, g) b -# define BOOST_PP_TUPLE_ELEM_7_2(a, b, c, d, e, f, g) c -# define BOOST_PP_TUPLE_ELEM_7_3(a, b, c, d, e, f, g) d -# define BOOST_PP_TUPLE_ELEM_7_4(a, b, c, d, e, f, g) e -# define BOOST_PP_TUPLE_ELEM_7_5(a, b, c, d, e, f, g) f -# define BOOST_PP_TUPLE_ELEM_7_6(a, b, c, d, e, f, g) g -# -# define BOOST_PP_TUPLE_ELEM_8_0(a, b, c, d, e, f, g, h) a -# define BOOST_PP_TUPLE_ELEM_8_1(a, b, c, d, e, f, g, h) b -# define BOOST_PP_TUPLE_ELEM_8_2(a, b, c, d, e, f, g, h) c -# define BOOST_PP_TUPLE_ELEM_8_3(a, b, c, d, e, f, g, h) d -# define BOOST_PP_TUPLE_ELEM_8_4(a, b, c, d, e, f, g, h) e -# define BOOST_PP_TUPLE_ELEM_8_5(a, b, c, d, e, f, g, h) f -# define BOOST_PP_TUPLE_ELEM_8_6(a, b, c, d, e, f, g, h) g -# define BOOST_PP_TUPLE_ELEM_8_7(a, b, c, d, e, f, g, h) h -# -# define BOOST_PP_TUPLE_ELEM_9_0(a, b, c, d, e, f, g, h, i) a -# define BOOST_PP_TUPLE_ELEM_9_1(a, b, c, d, e, f, g, h, i) b -# define BOOST_PP_TUPLE_ELEM_9_2(a, b, c, d, e, f, g, h, i) c -# define BOOST_PP_TUPLE_ELEM_9_3(a, b, c, d, e, f, g, h, i) d -# define BOOST_PP_TUPLE_ELEM_9_4(a, b, c, d, e, f, g, h, i) e -# define BOOST_PP_TUPLE_ELEM_9_5(a, b, c, d, e, f, g, h, i) f -# define BOOST_PP_TUPLE_ELEM_9_6(a, b, c, d, e, f, g, h, i) g -# define BOOST_PP_TUPLE_ELEM_9_7(a, b, c, d, e, f, g, h, i) h -# define BOOST_PP_TUPLE_ELEM_9_8(a, b, c, d, e, f, g, h, i) i -# -# define BOOST_PP_TUPLE_ELEM_10_0(a, b, c, d, e, f, g, h, i, j) a -# define BOOST_PP_TUPLE_ELEM_10_1(a, b, c, d, e, f, g, h, i, j) b -# define BOOST_PP_TUPLE_ELEM_10_2(a, b, c, d, e, f, g, h, i, j) c -# define BOOST_PP_TUPLE_ELEM_10_3(a, b, c, d, e, f, g, h, i, j) d -# define BOOST_PP_TUPLE_ELEM_10_4(a, b, c, d, e, f, g, h, i, j) e -# define BOOST_PP_TUPLE_ELEM_10_5(a, b, c, d, e, f, g, h, i, j) f -# define BOOST_PP_TUPLE_ELEM_10_6(a, b, c, d, e, f, g, h, i, j) g -# define BOOST_PP_TUPLE_ELEM_10_7(a, b, c, d, e, f, g, h, i, j) h -# define BOOST_PP_TUPLE_ELEM_10_8(a, b, c, d, e, f, g, h, i, j) i -# define BOOST_PP_TUPLE_ELEM_10_9(a, b, c, d, e, f, g, h, i, j) j -# -# define BOOST_PP_TUPLE_ELEM_11_0(a, b, c, d, e, f, g, h, i, j, k) a -# define BOOST_PP_TUPLE_ELEM_11_1(a, b, c, d, e, f, g, h, i, j, k) b -# define BOOST_PP_TUPLE_ELEM_11_2(a, b, c, d, e, f, g, h, i, j, k) c -# define BOOST_PP_TUPLE_ELEM_11_3(a, b, c, d, e, f, g, h, i, j, k) d -# define BOOST_PP_TUPLE_ELEM_11_4(a, b, c, d, e, f, g, h, i, j, k) e -# define BOOST_PP_TUPLE_ELEM_11_5(a, b, c, d, e, f, g, h, i, j, k) f -# define BOOST_PP_TUPLE_ELEM_11_6(a, b, c, d, e, f, g, h, i, j, k) g -# define BOOST_PP_TUPLE_ELEM_11_7(a, b, c, d, e, f, g, h, i, j, k) h -# define BOOST_PP_TUPLE_ELEM_11_8(a, b, c, d, e, f, g, h, i, j, k) i -# define BOOST_PP_TUPLE_ELEM_11_9(a, b, c, d, e, f, g, h, i, j, k) j -# define BOOST_PP_TUPLE_ELEM_11_10(a, b, c, d, e, f, g, h, i, j, k) k -# -# define BOOST_PP_TUPLE_ELEM_12_0(a, b, c, d, e, f, g, h, i, j, k, l) a -# define BOOST_PP_TUPLE_ELEM_12_1(a, b, c, d, e, f, g, h, i, j, k, l) b -# define BOOST_PP_TUPLE_ELEM_12_2(a, b, c, d, e, f, g, h, i, j, k, l) c -# define BOOST_PP_TUPLE_ELEM_12_3(a, b, c, d, e, f, g, h, i, j, k, l) d -# define BOOST_PP_TUPLE_ELEM_12_4(a, b, c, d, e, f, g, h, i, j, k, l) e -# define BOOST_PP_TUPLE_ELEM_12_5(a, b, c, d, e, f, g, h, i, j, k, l) f -# define BOOST_PP_TUPLE_ELEM_12_6(a, b, c, d, e, f, g, h, i, j, k, l) g -# define BOOST_PP_TUPLE_ELEM_12_7(a, b, c, d, e, f, g, h, i, j, k, l) h -# define BOOST_PP_TUPLE_ELEM_12_8(a, b, c, d, e, f, g, h, i, j, k, l) i -# define BOOST_PP_TUPLE_ELEM_12_9(a, b, c, d, e, f, g, h, i, j, k, l) j -# define BOOST_PP_TUPLE_ELEM_12_10(a, b, c, d, e, f, g, h, i, j, k, l) k -# define BOOST_PP_TUPLE_ELEM_12_11(a, b, c, d, e, f, g, h, i, j, k, l) l -# -# define BOOST_PP_TUPLE_ELEM_13_0(a, b, c, d, e, f, g, h, i, j, k, l, m) a -# define BOOST_PP_TUPLE_ELEM_13_1(a, b, c, d, e, f, g, h, i, j, k, l, m) b -# define BOOST_PP_TUPLE_ELEM_13_2(a, b, c, d, e, f, g, h, i, j, k, l, m) c -# define BOOST_PP_TUPLE_ELEM_13_3(a, b, c, d, e, f, g, h, i, j, k, l, m) d -# define BOOST_PP_TUPLE_ELEM_13_4(a, b, c, d, e, f, g, h, i, j, k, l, m) e -# define BOOST_PP_TUPLE_ELEM_13_5(a, b, c, d, e, f, g, h, i, j, k, l, m) f -# define BOOST_PP_TUPLE_ELEM_13_6(a, b, c, d, e, f, g, h, i, j, k, l, m) g -# define BOOST_PP_TUPLE_ELEM_13_7(a, b, c, d, e, f, g, h, i, j, k, l, m) h -# define BOOST_PP_TUPLE_ELEM_13_8(a, b, c, d, e, f, g, h, i, j, k, l, m) i -# define BOOST_PP_TUPLE_ELEM_13_9(a, b, c, d, e, f, g, h, i, j, k, l, m) j -# define BOOST_PP_TUPLE_ELEM_13_10(a, b, c, d, e, f, g, h, i, j, k, l, m) k -# define BOOST_PP_TUPLE_ELEM_13_11(a, b, c, d, e, f, g, h, i, j, k, l, m) l -# define BOOST_PP_TUPLE_ELEM_13_12(a, b, c, d, e, f, g, h, i, j, k, l, m) m -# -# define BOOST_PP_TUPLE_ELEM_14_0(a, b, c, d, e, f, g, h, i, j, k, l, m, n) a -# define BOOST_PP_TUPLE_ELEM_14_1(a, b, c, d, e, f, g, h, i, j, k, l, m, n) b -# define BOOST_PP_TUPLE_ELEM_14_2(a, b, c, d, e, f, g, h, i, j, k, l, m, n) c -# define BOOST_PP_TUPLE_ELEM_14_3(a, b, c, d, e, f, g, h, i, j, k, l, m, n) d -# define BOOST_PP_TUPLE_ELEM_14_4(a, b, c, d, e, f, g, h, i, j, k, l, m, n) e -# define BOOST_PP_TUPLE_ELEM_14_5(a, b, c, d, e, f, g, h, i, j, k, l, m, n) f -# define BOOST_PP_TUPLE_ELEM_14_6(a, b, c, d, e, f, g, h, i, j, k, l, m, n) g -# define BOOST_PP_TUPLE_ELEM_14_7(a, b, c, d, e, f, g, h, i, j, k, l, m, n) h -# define BOOST_PP_TUPLE_ELEM_14_8(a, b, c, d, e, f, g, h, i, j, k, l, m, n) i -# define BOOST_PP_TUPLE_ELEM_14_9(a, b, c, d, e, f, g, h, i, j, k, l, m, n) j -# define BOOST_PP_TUPLE_ELEM_14_10(a, b, c, d, e, f, g, h, i, j, k, l, m, n) k -# define BOOST_PP_TUPLE_ELEM_14_11(a, b, c, d, e, f, g, h, i, j, k, l, m, n) l -# define BOOST_PP_TUPLE_ELEM_14_12(a, b, c, d, e, f, g, h, i, j, k, l, m, n) m -# define BOOST_PP_TUPLE_ELEM_14_13(a, b, c, d, e, f, g, h, i, j, k, l, m, n) n -# -# define BOOST_PP_TUPLE_ELEM_15_0(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) a -# define BOOST_PP_TUPLE_ELEM_15_1(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) b -# define BOOST_PP_TUPLE_ELEM_15_2(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) c -# define BOOST_PP_TUPLE_ELEM_15_3(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) d -# define BOOST_PP_TUPLE_ELEM_15_4(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) e -# define BOOST_PP_TUPLE_ELEM_15_5(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) f -# define BOOST_PP_TUPLE_ELEM_15_6(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) g -# define BOOST_PP_TUPLE_ELEM_15_7(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) h -# define BOOST_PP_TUPLE_ELEM_15_8(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) i -# define BOOST_PP_TUPLE_ELEM_15_9(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) j -# define BOOST_PP_TUPLE_ELEM_15_10(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) k -# define BOOST_PP_TUPLE_ELEM_15_11(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) l -# define BOOST_PP_TUPLE_ELEM_15_12(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) m -# define BOOST_PP_TUPLE_ELEM_15_13(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) n -# define BOOST_PP_TUPLE_ELEM_15_14(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) o -# -# define BOOST_PP_TUPLE_ELEM_16_0(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) a -# define BOOST_PP_TUPLE_ELEM_16_1(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) b -# define BOOST_PP_TUPLE_ELEM_16_2(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) c -# define BOOST_PP_TUPLE_ELEM_16_3(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) d -# define BOOST_PP_TUPLE_ELEM_16_4(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) e -# define BOOST_PP_TUPLE_ELEM_16_5(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) f -# define BOOST_PP_TUPLE_ELEM_16_6(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) g -# define BOOST_PP_TUPLE_ELEM_16_7(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) h -# define BOOST_PP_TUPLE_ELEM_16_8(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) i -# define BOOST_PP_TUPLE_ELEM_16_9(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) j -# define BOOST_PP_TUPLE_ELEM_16_10(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) k -# define BOOST_PP_TUPLE_ELEM_16_11(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) l -# define BOOST_PP_TUPLE_ELEM_16_12(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) m -# define BOOST_PP_TUPLE_ELEM_16_13(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) n -# define BOOST_PP_TUPLE_ELEM_16_14(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) o -# define BOOST_PP_TUPLE_ELEM_16_15(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) p -# -# define BOOST_PP_TUPLE_ELEM_17_0(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) a -# define BOOST_PP_TUPLE_ELEM_17_1(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) b -# define BOOST_PP_TUPLE_ELEM_17_2(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) c -# define BOOST_PP_TUPLE_ELEM_17_3(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) d -# define BOOST_PP_TUPLE_ELEM_17_4(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) e -# define BOOST_PP_TUPLE_ELEM_17_5(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) f -# define BOOST_PP_TUPLE_ELEM_17_6(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) g -# define BOOST_PP_TUPLE_ELEM_17_7(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) h -# define BOOST_PP_TUPLE_ELEM_17_8(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) i -# define BOOST_PP_TUPLE_ELEM_17_9(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) j -# define BOOST_PP_TUPLE_ELEM_17_10(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) k -# define BOOST_PP_TUPLE_ELEM_17_11(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) l -# define BOOST_PP_TUPLE_ELEM_17_12(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) m -# define BOOST_PP_TUPLE_ELEM_17_13(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) n -# define BOOST_PP_TUPLE_ELEM_17_14(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) o -# define BOOST_PP_TUPLE_ELEM_17_15(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) p -# define BOOST_PP_TUPLE_ELEM_17_16(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) q -# -# define BOOST_PP_TUPLE_ELEM_18_0(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) a -# define BOOST_PP_TUPLE_ELEM_18_1(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) b -# define BOOST_PP_TUPLE_ELEM_18_2(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) c -# define BOOST_PP_TUPLE_ELEM_18_3(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) d -# define BOOST_PP_TUPLE_ELEM_18_4(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) e -# define BOOST_PP_TUPLE_ELEM_18_5(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) f -# define BOOST_PP_TUPLE_ELEM_18_6(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) g -# define BOOST_PP_TUPLE_ELEM_18_7(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) h -# define BOOST_PP_TUPLE_ELEM_18_8(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) i -# define BOOST_PP_TUPLE_ELEM_18_9(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) j -# define BOOST_PP_TUPLE_ELEM_18_10(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) k -# define BOOST_PP_TUPLE_ELEM_18_11(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) l -# define BOOST_PP_TUPLE_ELEM_18_12(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) m -# define BOOST_PP_TUPLE_ELEM_18_13(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) n -# define BOOST_PP_TUPLE_ELEM_18_14(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) o -# define BOOST_PP_TUPLE_ELEM_18_15(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) p -# define BOOST_PP_TUPLE_ELEM_18_16(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) q -# define BOOST_PP_TUPLE_ELEM_18_17(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) r -# -# define BOOST_PP_TUPLE_ELEM_19_0(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) a -# define BOOST_PP_TUPLE_ELEM_19_1(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) b -# define BOOST_PP_TUPLE_ELEM_19_2(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) c -# define BOOST_PP_TUPLE_ELEM_19_3(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) d -# define BOOST_PP_TUPLE_ELEM_19_4(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) e -# define BOOST_PP_TUPLE_ELEM_19_5(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) f -# define BOOST_PP_TUPLE_ELEM_19_6(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) g -# define BOOST_PP_TUPLE_ELEM_19_7(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) h -# define BOOST_PP_TUPLE_ELEM_19_8(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) i -# define BOOST_PP_TUPLE_ELEM_19_9(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) j -# define BOOST_PP_TUPLE_ELEM_19_10(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) k -# define BOOST_PP_TUPLE_ELEM_19_11(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) l -# define BOOST_PP_TUPLE_ELEM_19_12(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) m -# define BOOST_PP_TUPLE_ELEM_19_13(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) n -# define BOOST_PP_TUPLE_ELEM_19_14(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) o -# define BOOST_PP_TUPLE_ELEM_19_15(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) p -# define BOOST_PP_TUPLE_ELEM_19_16(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) q -# define BOOST_PP_TUPLE_ELEM_19_17(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) r -# define BOOST_PP_TUPLE_ELEM_19_18(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) s -# -# define BOOST_PP_TUPLE_ELEM_20_0(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) a -# define BOOST_PP_TUPLE_ELEM_20_1(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) b -# define BOOST_PP_TUPLE_ELEM_20_2(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) c -# define BOOST_PP_TUPLE_ELEM_20_3(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) d -# define BOOST_PP_TUPLE_ELEM_20_4(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) e -# define BOOST_PP_TUPLE_ELEM_20_5(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) f -# define BOOST_PP_TUPLE_ELEM_20_6(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) g -# define BOOST_PP_TUPLE_ELEM_20_7(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) h -# define BOOST_PP_TUPLE_ELEM_20_8(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) i -# define BOOST_PP_TUPLE_ELEM_20_9(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) j -# define BOOST_PP_TUPLE_ELEM_20_10(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) k -# define BOOST_PP_TUPLE_ELEM_20_11(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) l -# define BOOST_PP_TUPLE_ELEM_20_12(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) m -# define BOOST_PP_TUPLE_ELEM_20_13(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) n -# define BOOST_PP_TUPLE_ELEM_20_14(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) o -# define BOOST_PP_TUPLE_ELEM_20_15(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) p -# define BOOST_PP_TUPLE_ELEM_20_16(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) q -# define BOOST_PP_TUPLE_ELEM_20_17(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) r -# define BOOST_PP_TUPLE_ELEM_20_18(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) s -# define BOOST_PP_TUPLE_ELEM_20_19(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) t -# -# define BOOST_PP_TUPLE_ELEM_21_0(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) a -# define BOOST_PP_TUPLE_ELEM_21_1(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) b -# define BOOST_PP_TUPLE_ELEM_21_2(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) c -# define BOOST_PP_TUPLE_ELEM_21_3(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) d -# define BOOST_PP_TUPLE_ELEM_21_4(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) e -# define BOOST_PP_TUPLE_ELEM_21_5(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) f -# define BOOST_PP_TUPLE_ELEM_21_6(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) g -# define BOOST_PP_TUPLE_ELEM_21_7(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) h -# define BOOST_PP_TUPLE_ELEM_21_8(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) i -# define BOOST_PP_TUPLE_ELEM_21_9(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) j -# define BOOST_PP_TUPLE_ELEM_21_10(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) k -# define BOOST_PP_TUPLE_ELEM_21_11(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) l -# define BOOST_PP_TUPLE_ELEM_21_12(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) m -# define BOOST_PP_TUPLE_ELEM_21_13(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) n -# define BOOST_PP_TUPLE_ELEM_21_14(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) o -# define BOOST_PP_TUPLE_ELEM_21_15(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) p -# define BOOST_PP_TUPLE_ELEM_21_16(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) q -# define BOOST_PP_TUPLE_ELEM_21_17(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) r -# define BOOST_PP_TUPLE_ELEM_21_18(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) s -# define BOOST_PP_TUPLE_ELEM_21_19(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) t -# define BOOST_PP_TUPLE_ELEM_21_20(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) u -# -# define BOOST_PP_TUPLE_ELEM_22_0(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) a -# define BOOST_PP_TUPLE_ELEM_22_1(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) b -# define BOOST_PP_TUPLE_ELEM_22_2(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) c -# define BOOST_PP_TUPLE_ELEM_22_3(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) d -# define BOOST_PP_TUPLE_ELEM_22_4(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) e -# define BOOST_PP_TUPLE_ELEM_22_5(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) f -# define BOOST_PP_TUPLE_ELEM_22_6(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) g -# define BOOST_PP_TUPLE_ELEM_22_7(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) h -# define BOOST_PP_TUPLE_ELEM_22_8(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) i -# define BOOST_PP_TUPLE_ELEM_22_9(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) j -# define BOOST_PP_TUPLE_ELEM_22_10(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) k -# define BOOST_PP_TUPLE_ELEM_22_11(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) l -# define BOOST_PP_TUPLE_ELEM_22_12(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) m -# define BOOST_PP_TUPLE_ELEM_22_13(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) n -# define BOOST_PP_TUPLE_ELEM_22_14(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) o -# define BOOST_PP_TUPLE_ELEM_22_15(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) p -# define BOOST_PP_TUPLE_ELEM_22_16(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) q -# define BOOST_PP_TUPLE_ELEM_22_17(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) r -# define BOOST_PP_TUPLE_ELEM_22_18(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) s -# define BOOST_PP_TUPLE_ELEM_22_19(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) t -# define BOOST_PP_TUPLE_ELEM_22_20(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) u -# define BOOST_PP_TUPLE_ELEM_22_21(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) v -# -# define BOOST_PP_TUPLE_ELEM_23_0(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) a -# define BOOST_PP_TUPLE_ELEM_23_1(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) b -# define BOOST_PP_TUPLE_ELEM_23_2(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) c -# define BOOST_PP_TUPLE_ELEM_23_3(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) d -# define BOOST_PP_TUPLE_ELEM_23_4(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) e -# define BOOST_PP_TUPLE_ELEM_23_5(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) f -# define BOOST_PP_TUPLE_ELEM_23_6(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) g -# define BOOST_PP_TUPLE_ELEM_23_7(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) h -# define BOOST_PP_TUPLE_ELEM_23_8(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) i -# define BOOST_PP_TUPLE_ELEM_23_9(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) j -# define BOOST_PP_TUPLE_ELEM_23_10(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) k -# define BOOST_PP_TUPLE_ELEM_23_11(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) l -# define BOOST_PP_TUPLE_ELEM_23_12(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) m -# define BOOST_PP_TUPLE_ELEM_23_13(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) n -# define BOOST_PP_TUPLE_ELEM_23_14(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) o -# define BOOST_PP_TUPLE_ELEM_23_15(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) p -# define BOOST_PP_TUPLE_ELEM_23_16(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) q -# define BOOST_PP_TUPLE_ELEM_23_17(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) r -# define BOOST_PP_TUPLE_ELEM_23_18(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) s -# define BOOST_PP_TUPLE_ELEM_23_19(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) t -# define BOOST_PP_TUPLE_ELEM_23_20(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) u -# define BOOST_PP_TUPLE_ELEM_23_21(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) v -# define BOOST_PP_TUPLE_ELEM_23_22(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) w -# -# define BOOST_PP_TUPLE_ELEM_24_0(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) a -# define BOOST_PP_TUPLE_ELEM_24_1(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) b -# define BOOST_PP_TUPLE_ELEM_24_2(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) c -# define BOOST_PP_TUPLE_ELEM_24_3(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) d -# define BOOST_PP_TUPLE_ELEM_24_4(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) e -# define BOOST_PP_TUPLE_ELEM_24_5(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) f -# define BOOST_PP_TUPLE_ELEM_24_6(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) g -# define BOOST_PP_TUPLE_ELEM_24_7(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) h -# define BOOST_PP_TUPLE_ELEM_24_8(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) i -# define BOOST_PP_TUPLE_ELEM_24_9(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) j -# define BOOST_PP_TUPLE_ELEM_24_10(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) k -# define BOOST_PP_TUPLE_ELEM_24_11(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) l -# define BOOST_PP_TUPLE_ELEM_24_12(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) m -# define BOOST_PP_TUPLE_ELEM_24_13(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) n -# define BOOST_PP_TUPLE_ELEM_24_14(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) o -# define BOOST_PP_TUPLE_ELEM_24_15(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) p -# define BOOST_PP_TUPLE_ELEM_24_16(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) q -# define BOOST_PP_TUPLE_ELEM_24_17(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) r -# define BOOST_PP_TUPLE_ELEM_24_18(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) s -# define BOOST_PP_TUPLE_ELEM_24_19(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) t -# define BOOST_PP_TUPLE_ELEM_24_20(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) u -# define BOOST_PP_TUPLE_ELEM_24_21(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) v -# define BOOST_PP_TUPLE_ELEM_24_22(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) w -# define BOOST_PP_TUPLE_ELEM_24_23(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) x -# -# define BOOST_PP_TUPLE_ELEM_25_0(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) a -# define BOOST_PP_TUPLE_ELEM_25_1(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) b -# define BOOST_PP_TUPLE_ELEM_25_2(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) c -# define BOOST_PP_TUPLE_ELEM_25_3(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) d -# define BOOST_PP_TUPLE_ELEM_25_4(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) e -# define BOOST_PP_TUPLE_ELEM_25_5(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) f -# define BOOST_PP_TUPLE_ELEM_25_6(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) g -# define BOOST_PP_TUPLE_ELEM_25_7(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) h -# define BOOST_PP_TUPLE_ELEM_25_8(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) i -# define BOOST_PP_TUPLE_ELEM_25_9(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) j -# define BOOST_PP_TUPLE_ELEM_25_10(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) k -# define BOOST_PP_TUPLE_ELEM_25_11(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) l -# define BOOST_PP_TUPLE_ELEM_25_12(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) m -# define BOOST_PP_TUPLE_ELEM_25_13(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) n -# define BOOST_PP_TUPLE_ELEM_25_14(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) o -# define BOOST_PP_TUPLE_ELEM_25_15(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) p -# define BOOST_PP_TUPLE_ELEM_25_16(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) q -# define BOOST_PP_TUPLE_ELEM_25_17(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) r -# define BOOST_PP_TUPLE_ELEM_25_18(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) s -# define BOOST_PP_TUPLE_ELEM_25_19(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) t -# define BOOST_PP_TUPLE_ELEM_25_20(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) u -# define BOOST_PP_TUPLE_ELEM_25_21(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) v -# define BOOST_PP_TUPLE_ELEM_25_22(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) w -# define BOOST_PP_TUPLE_ELEM_25_23(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) x -# define BOOST_PP_TUPLE_ELEM_25_24(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) y -# # endif diff --git a/3rdParty/Boost/src/boost/preprocessor/tuple/rem.hpp b/3rdParty/Boost/src/boost/preprocessor/tuple/rem.hpp index 9b76df9..4e3362c 100644 --- a/3rdParty/Boost/src/boost/preprocessor/tuple/rem.hpp +++ b/3rdParty/Boost/src/boost/preprocessor/tuple/rem.hpp @@ -1,9 +1,10 @@ # /* ************************************************************************** # * * -# * (C) Copyright Paul Mensonides 2002. -# * 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) +# * (C) Copyright Paul Mensonides 2002-2011. * +# * (C) Copyright Edward Diener 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) * # * * # ************************************************************************** */ # @@ -12,61 +13,122 @@ # ifndef BOOST_PREPROCESSOR_TUPLE_REM_HPP # define BOOST_PREPROCESSOR_TUPLE_REM_HPP # +# include <boost/preprocessor/cat.hpp> # include <boost/preprocessor/config/config.hpp> +# include <boost/preprocessor/facilities/overload.hpp> # -# /* BOOST_PP_TUPLE_REM */ +# /* BOOST_PP_REM */ # -# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC() -# define BOOST_PP_TUPLE_REM(size) BOOST_PP_TUPLE_REM_I(size) +# if BOOST_PP_VARIADICS +# define BOOST_PP_REM(...) __VA_ARGS__ # else -# define BOOST_PP_TUPLE_REM(size) BOOST_PP_TUPLE_REM_OO((size)) -# define BOOST_PP_TUPLE_REM_OO(par) BOOST_PP_TUPLE_REM_I ## par +# define BOOST_PP_REM(x) x # endif # -# define BOOST_PP_TUPLE_REM_I(size) BOOST_PP_TUPLE_REM_ ## size -# -# define BOOST_PP_TUPLE_REM_0() -# define BOOST_PP_TUPLE_REM_1(a) a -# define BOOST_PP_TUPLE_REM_2(a, b) a, b -# define BOOST_PP_TUPLE_REM_3(a, b, c) a, b, c -# define BOOST_PP_TUPLE_REM_4(a, b, c, d) a, b, c, d -# define BOOST_PP_TUPLE_REM_5(a, b, c, d, e) a, b, c, d, e -# define BOOST_PP_TUPLE_REM_6(a, b, c, d, e, f) a, b, c, d, e, f -# define BOOST_PP_TUPLE_REM_7(a, b, c, d, e, f, g) a, b, c, d, e, f, g -# define BOOST_PP_TUPLE_REM_8(a, b, c, d, e, f, g, h) a, b, c, d, e, f, g, h -# define BOOST_PP_TUPLE_REM_9(a, b, c, d, e, f, g, h, i) a, b, c, d, e, f, g, h, i -# define BOOST_PP_TUPLE_REM_10(a, b, c, d, e, f, g, h, i, j) a, b, c, d, e, f, g, h, i, j -# define BOOST_PP_TUPLE_REM_11(a, b, c, d, e, f, g, h, i, j, k) a, b, c, d, e, f, g, h, i, j, k -# define BOOST_PP_TUPLE_REM_12(a, b, c, d, e, f, g, h, i, j, k, l) a, b, c, d, e, f, g, h, i, j, k, l -# define BOOST_PP_TUPLE_REM_13(a, b, c, d, e, f, g, h, i, j, k, l, m) a, b, c, d, e, f, g, h, i, j, k, l, m -# define BOOST_PP_TUPLE_REM_14(a, b, c, d, e, f, g, h, i, j, k, l, m, n) a, b, c, d, e, f, g, h, i, j, k, l, m, n -# define BOOST_PP_TUPLE_REM_15(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) a, b, c, d, e, f, g, h, i, j, k, l, m, n, o -# define BOOST_PP_TUPLE_REM_16(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p -# define BOOST_PP_TUPLE_REM_17(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q -# define BOOST_PP_TUPLE_REM_18(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r -# define BOOST_PP_TUPLE_REM_19(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s -# define BOOST_PP_TUPLE_REM_20(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t -# define BOOST_PP_TUPLE_REM_21(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u -# define BOOST_PP_TUPLE_REM_22(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v -# define BOOST_PP_TUPLE_REM_23(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w -# define BOOST_PP_TUPLE_REM_24(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x -# define BOOST_PP_TUPLE_REM_25(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y -# -# /* BOOST_PP_TUPLE_REM_CTOR */ +# /* BOOST_PP_TUPLE_REM */ # -# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() -# define BOOST_PP_TUPLE_REM_CTOR(size, tuple) BOOST_PP_TUPLE_REM_CTOR_I(BOOST_PP_TUPLE_REM(size), tuple) +# if BOOST_PP_VARIADICS +# define BOOST_PP_TUPLE_REM(size) BOOST_PP_REM # else -# define BOOST_PP_TUPLE_REM_CTOR(size, tuple) BOOST_PP_TUPLE_REM_CTOR_D(size, tuple) -# define BOOST_PP_TUPLE_REM_CTOR_D(size, tuple) BOOST_PP_TUPLE_REM_CTOR_I(BOOST_PP_TUPLE_REM(size), tuple) +# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC() +# define BOOST_PP_TUPLE_REM(size) BOOST_PP_TUPLE_REM_I(size) +# else +# define BOOST_PP_TUPLE_REM(size) BOOST_PP_TUPLE_REM_OO((size)) +# define BOOST_PP_TUPLE_REM_OO(par) BOOST_PP_TUPLE_REM_I ## par +# endif +# define BOOST_PP_TUPLE_REM_I(size) BOOST_PP_TUPLE_REM_ ## size # endif +# define BOOST_PP_TUPLE_REM_1(e0) e0 +# define BOOST_PP_TUPLE_REM_2(e0, e1) e0, e1 +# define BOOST_PP_TUPLE_REM_3(e0, e1, e2) e0, e1, e2 +# define BOOST_PP_TUPLE_REM_4(e0, e1, e2, e3) e0, e1, e2, e3 +# define BOOST_PP_TUPLE_REM_5(e0, e1, e2, e3, e4) e0, e1, e2, e3, e4 +# define BOOST_PP_TUPLE_REM_6(e0, e1, e2, e3, e4, e5) e0, e1, e2, e3, e4, e5 +# define BOOST_PP_TUPLE_REM_7(e0, e1, e2, e3, e4, e5, e6) e0, e1, e2, e3, e4, e5, e6 +# define BOOST_PP_TUPLE_REM_8(e0, e1, e2, e3, e4, e5, e6, e7) e0, e1, e2, e3, e4, e5, e6, e7 +# define BOOST_PP_TUPLE_REM_9(e0, e1, e2, e3, e4, e5, e6, e7, e8) e0, e1, e2, e3, e4, e5, e6, e7, e8 +# define BOOST_PP_TUPLE_REM_10(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9) e0, e1, e2, e3, e4, e5, e6, e7, e8, e9 +# define BOOST_PP_TUPLE_REM_11(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10) e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10 +# define BOOST_PP_TUPLE_REM_12(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11) e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11 +# define BOOST_PP_TUPLE_REM_13(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12) e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12 +# define BOOST_PP_TUPLE_REM_14(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13) e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13 +# define BOOST_PP_TUPLE_REM_15(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14) e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14 +# define BOOST_PP_TUPLE_REM_16(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15) e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15 +# define BOOST_PP_TUPLE_REM_17(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16) e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16 +# define BOOST_PP_TUPLE_REM_18(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17) e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17 +# define BOOST_PP_TUPLE_REM_19(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18) e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18 +# define BOOST_PP_TUPLE_REM_20(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19) e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19 +# define BOOST_PP_TUPLE_REM_21(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20) e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20 +# define BOOST_PP_TUPLE_REM_22(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21) e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21 +# define BOOST_PP_TUPLE_REM_23(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22) e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22 +# define BOOST_PP_TUPLE_REM_24(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23) e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23 +# define BOOST_PP_TUPLE_REM_25(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24) e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24 +# define BOOST_PP_TUPLE_REM_26(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25) e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25 +# define BOOST_PP_TUPLE_REM_27(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26) e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26 +# define BOOST_PP_TUPLE_REM_28(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27) e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27 +# define BOOST_PP_TUPLE_REM_29(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28) e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28 +# define BOOST_PP_TUPLE_REM_30(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29) e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29 +# define BOOST_PP_TUPLE_REM_31(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30) e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30 +# define BOOST_PP_TUPLE_REM_32(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31) e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31 +# define BOOST_PP_TUPLE_REM_33(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32) e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32 +# define BOOST_PP_TUPLE_REM_34(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33) e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33 +# define BOOST_PP_TUPLE_REM_35(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34) e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34 +# define BOOST_PP_TUPLE_REM_36(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35) e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35 +# define BOOST_PP_TUPLE_REM_37(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36) e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36 +# define BOOST_PP_TUPLE_REM_38(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37) e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37 +# define BOOST_PP_TUPLE_REM_39(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38) e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38 +# define BOOST_PP_TUPLE_REM_40(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39) e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39 +# define BOOST_PP_TUPLE_REM_41(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40) e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40 +# define BOOST_PP_TUPLE_REM_42(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41) e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41 +# define BOOST_PP_TUPLE_REM_43(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42) e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42 +# define BOOST_PP_TUPLE_REM_44(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43) e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43 +# define BOOST_PP_TUPLE_REM_45(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44) e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44 +# define BOOST_PP_TUPLE_REM_46(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45) e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45 +# define BOOST_PP_TUPLE_REM_47(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46) e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46 +# define BOOST_PP_TUPLE_REM_48(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47) e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47 +# define BOOST_PP_TUPLE_REM_49(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48) e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48 +# define BOOST_PP_TUPLE_REM_50(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49) e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49 +# define BOOST_PP_TUPLE_REM_51(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50) e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50 +# define BOOST_PP_TUPLE_REM_52(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51) e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51 +# define BOOST_PP_TUPLE_REM_53(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52) e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52 +# define BOOST_PP_TUPLE_REM_54(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53) e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53 +# define BOOST_PP_TUPLE_REM_55(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54) e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54 +# define BOOST_PP_TUPLE_REM_56(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55) e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55 +# define BOOST_PP_TUPLE_REM_57(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56) e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56 +# define BOOST_PP_TUPLE_REM_58(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57) e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57 +# define BOOST_PP_TUPLE_REM_59(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58) e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58 +# define BOOST_PP_TUPLE_REM_60(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59) e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59 +# define BOOST_PP_TUPLE_REM_61(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60) e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60 +# define BOOST_PP_TUPLE_REM_62(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61) e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61 +# define BOOST_PP_TUPLE_REM_63(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62) e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62 +# define BOOST_PP_TUPLE_REM_64(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63 +# +# /* BOOST_PP_TUPLE_REM_CTOR */ # -# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC() -# define BOOST_PP_TUPLE_REM_CTOR_I(ext, tuple) ext tuple +# if BOOST_PP_VARIADICS +# if BOOST_PP_VARIADICS_MSVC +# define BOOST_PP_TUPLE_REM_CTOR(...) BOOST_PP_TUPLE_REM_CTOR_I(BOOST_PP_OVERLOAD(BOOST_PP_TUPLE_REM_CTOR_O_, __VA_ARGS__), (__VA_ARGS__)) +# define BOOST_PP_TUPLE_REM_CTOR_I(m, args) BOOST_PP_TUPLE_REM_CTOR_II(m, args) +# define BOOST_PP_TUPLE_REM_CTOR_II(m, args) BOOST_PP_CAT(m ## args,) +# else +# define BOOST_PP_TUPLE_REM_CTOR(...) BOOST_PP_OVERLOAD(BOOST_PP_TUPLE_REM_CTOR_O_, __VA_ARGS__)(__VA_ARGS__) +# endif +# define BOOST_PP_TUPLE_REM_CTOR_O_1(tuple) BOOST_PP_REM tuple +# define BOOST_PP_TUPLE_REM_CTOR_O_2(size, tuple) BOOST_PP_TUPLE_REM_CTOR_O_1(tuple) # else -# define BOOST_PP_TUPLE_REM_CTOR_I(ext, tuple) BOOST_PP_TUPLE_REM_CTOR_OO((ext, tuple)) -# define BOOST_PP_TUPLE_REM_CTOR_OO(par) BOOST_PP_TUPLE_REM_CTOR_II ## par -# define BOOST_PP_TUPLE_REM_CTOR_II(ext, tuple) ext ## tuple +# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_EDG() +# define BOOST_PP_TUPLE_REM_CTOR(size, tuple) BOOST_PP_TUPLE_REM_CTOR_I(BOOST_PP_TUPLE_REM(size), tuple) +# else +# define BOOST_PP_TUPLE_REM_CTOR(size, tuple) BOOST_PP_TUPLE_REM_CTOR_D(size, tuple) +# define BOOST_PP_TUPLE_REM_CTOR_D(size, tuple) BOOST_PP_TUPLE_REM_CTOR_I(BOOST_PP_TUPLE_REM(size), tuple) +# endif +# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC() +# define BOOST_PP_TUPLE_REM_CTOR_I(ext, tuple) ext tuple +# else +# define BOOST_PP_TUPLE_REM_CTOR_I(ext, tuple) BOOST_PP_TUPLE_REM_CTOR_OO((ext, tuple)) +# define BOOST_PP_TUPLE_REM_CTOR_OO(par) BOOST_PP_TUPLE_REM_CTOR_II ## par +# define BOOST_PP_TUPLE_REM_CTOR_II(ext, tuple) ext ## tuple +# endif # endif # # endif diff --git a/3rdParty/Boost/src/boost/preprocessor/tuple/to_list.hpp b/3rdParty/Boost/src/boost/preprocessor/tuple/to_list.hpp index e8af8dd..2a9d6fe 100644 --- a/3rdParty/Boost/src/boost/preprocessor/tuple/to_list.hpp +++ b/3rdParty/Boost/src/boost/preprocessor/tuple/to_list.hpp @@ -7,56 +7,110 @@ # * http://www.boost.org/LICENSE_1_0.txt) # */ # -# /* Revised by Paul Mensonides (2002) */ +# /* Revised by Paul Mensonides (2002-2011) */ +# /* Revised by Edward Diener (2011) */ # # /* See http://www.boost.org for most recent version. */ # # ifndef BOOST_PREPROCESSOR_TUPLE_TO_LIST_HPP # define BOOST_PREPROCESSOR_TUPLE_TO_LIST_HPP # +# include <boost/preprocessor/cat.hpp> # include <boost/preprocessor/config/config.hpp> +# include <boost/preprocessor/facilities/overload.hpp> +# include <boost/preprocessor/variadic/size.hpp> # # /* BOOST_PP_TUPLE_TO_LIST */ # -# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC() -# define BOOST_PP_TUPLE_TO_LIST(size, tuple) BOOST_PP_TUPLE_TO_LIST_I(size, tuple) -# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC() -# define BOOST_PP_TUPLE_TO_LIST_I(s, t) BOOST_PP_TUPLE_TO_LIST_ ## s t +# if BOOST_PP_VARIADICS +# if BOOST_PP_VARIADICS_MSVC +# define BOOST_PP_TUPLE_TO_LIST(...) BOOST_PP_TUPLE_TO_LIST_I(BOOST_PP_OVERLOAD(BOOST_PP_TUPLE_TO_LIST_O_, __VA_ARGS__), (__VA_ARGS__)) +# define BOOST_PP_TUPLE_TO_LIST_I(m, args) BOOST_PP_TUPLE_TO_LIST_II(m, args) +# define BOOST_PP_TUPLE_TO_LIST_II(m, args) BOOST_PP_CAT(m ## args,) # else -# define BOOST_PP_TUPLE_TO_LIST_I(s, t) BOOST_PP_TUPLE_TO_LIST_II(BOOST_PP_TUPLE_TO_LIST_ ## s t) -# define BOOST_PP_TUPLE_TO_LIST_II(res) res +# define BOOST_PP_TUPLE_TO_LIST(...) BOOST_PP_OVERLOAD(BOOST_PP_TUPLE_TO_LIST_O_, __VA_ARGS__)(__VA_ARGS__) # endif +# define BOOST_PP_TUPLE_TO_LIST_O_1(tuple) BOOST_PP_CAT(BOOST_PP_TUPLE_TO_LIST_, BOOST_PP_VARIADIC_SIZE tuple) tuple +# define BOOST_PP_TUPLE_TO_LIST_O_2(size, tuple) BOOST_PP_TUPLE_TO_LIST_O_1(tuple) # else -# define BOOST_PP_TUPLE_TO_LIST(size, tuple) BOOST_PP_TUPLE_TO_LIST_OO((size, tuple)) -# define BOOST_PP_TUPLE_TO_LIST_OO(par) BOOST_PP_TUPLE_TO_LIST_I ## par -# define BOOST_PP_TUPLE_TO_LIST_I(s, t) BOOST_PP_TUPLE_TO_LIST_ ## s ## t +# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MWCC() +# define BOOST_PP_TUPLE_TO_LIST(size, tuple) BOOST_PP_TUPLE_TO_LIST_I(size, tuple) +# if ~BOOST_PP_CONFIG_FLAGS() & BOOST_PP_CONFIG_MSVC() +# define BOOST_PP_TUPLE_TO_LIST_I(s, t) BOOST_PP_TUPLE_TO_LIST_ ## s t +# else +# define BOOST_PP_TUPLE_TO_LIST_I(s, t) BOOST_PP_TUPLE_TO_LIST_II(BOOST_PP_TUPLE_TO_LIST_ ## s t) +# define BOOST_PP_TUPLE_TO_LIST_II(res) res +# endif +# else +# define BOOST_PP_TUPLE_TO_LIST(size, tuple) BOOST_PP_TUPLE_TO_LIST_OO((size, tuple)) +# define BOOST_PP_TUPLE_TO_LIST_OO(par) BOOST_PP_TUPLE_TO_LIST_I ## par +# define BOOST_PP_TUPLE_TO_LIST_I(s, t) BOOST_PP_TUPLE_TO_LIST_ ## s ## t +# endif # endif # -# define BOOST_PP_TUPLE_TO_LIST_0() BOOST_PP_NIL -# define BOOST_PP_TUPLE_TO_LIST_1(a) (a, BOOST_PP_NIL) -# define BOOST_PP_TUPLE_TO_LIST_2(a, b) (a, (b, BOOST_PP_NIL)) -# define BOOST_PP_TUPLE_TO_LIST_3(a, b, c) (a, (b, (c, BOOST_PP_NIL))) -# define BOOST_PP_TUPLE_TO_LIST_4(a, b, c, d) (a, (b, (c, (d, BOOST_PP_NIL)))) -# define BOOST_PP_TUPLE_TO_LIST_5(a, b, c, d, e) (a, (b, (c, (d, (e, BOOST_PP_NIL))))) -# define BOOST_PP_TUPLE_TO_LIST_6(a, b, c, d, e, f) (a, (b, (c, (d, (e, (f, BOOST_PP_NIL)))))) -# define BOOST_PP_TUPLE_TO_LIST_7(a, b, c, d, e, f, g) (a, (b, (c, (d, (e, (f, (g, BOOST_PP_NIL))))))) -# define BOOST_PP_TUPLE_TO_LIST_8(a, b, c, d, e, f, g, h) (a, (b, (c, (d, (e, (f, (g, (h, BOOST_PP_NIL)))))))) -# define BOOST_PP_TUPLE_TO_LIST_9(a, b, c, d, e, f, g, h, i) (a, (b, (c, (d, (e, (f, (g, (h, (i, BOOST_PP_NIL))))))))) -# define BOOST_PP_TUPLE_TO_LIST_10(a, b, c, d, e, f, g, h, i, j) (a, (b, (c, (d, (e, (f, (g, (h, (i, (j, BOOST_PP_NIL)))))))))) -# define BOOST_PP_TUPLE_TO_LIST_11(a, b, c, d, e, f, g, h, i, j, k) (a, (b, (c, (d, (e, (f, (g, (h, (i, (j, (k, BOOST_PP_NIL))))))))))) -# define BOOST_PP_TUPLE_TO_LIST_12(a, b, c, d, e, f, g, h, i, j, k, l) (a, (b, (c, (d, (e, (f, (g, (h, (i, (j, (k, (l, BOOST_PP_NIL)))))))))))) -# define BOOST_PP_TUPLE_TO_LIST_13(a, b, c, d, e, f, g, h, i, j, k, l, m) (a, (b, (c, (d, (e, (f, (g, (h, (i, (j, (k, (l, (m, BOOST_PP_NIL))))))))))))) -# define BOOST_PP_TUPLE_TO_LIST_14(a, b, c, d, e, f, g, h, i, j, k, l, m, n) (a, (b, (c, (d, (e, (f, (g, (h, (i, (j, (k, (l, (m, (n, BOOST_PP_NIL)))))))))))))) -# define BOOST_PP_TUPLE_TO_LIST_15(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o) (a, (b, (c, (d, (e, (f, (g, (h, (i, (j, (k, (l, (m, (n, (o, BOOST_PP_NIL))))))))))))))) -# define BOOST_PP_TUPLE_TO_LIST_16(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p) (a, (b, (c, (d, (e, (f, (g, (h, (i, (j, (k, (l, (m, (n, (o, (p, BOOST_PP_NIL)))))))))))))))) -# define BOOST_PP_TUPLE_TO_LIST_17(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q) (a, (b, (c, (d, (e, (f, (g, (h, (i, (j, (k, (l, (m, (n, (o, (p, (q, BOOST_PP_NIL))))))))))))))))) -# define BOOST_PP_TUPLE_TO_LIST_18(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r) (a, (b, (c, (d, (e, (f, (g, (h, (i, (j, (k, (l, (m, (n, (o, (p, (q, (r, BOOST_PP_NIL)))))))))))))))))) -# define BOOST_PP_TUPLE_TO_LIST_19(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s) (a, (b, (c, (d, (e, (f, (g, (h, (i, (j, (k, (l, (m, (n, (o, (p, (q, (r, (s, BOOST_PP_NIL))))))))))))))))))) -# define BOOST_PP_TUPLE_TO_LIST_20(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t) (a, (b, (c, (d, (e, (f, (g, (h, (i, (j, (k, (l, (m, (n, (o, (p, (q, (r, (s, (t, BOOST_PP_NIL)))))))))))))))))))) -# define BOOST_PP_TUPLE_TO_LIST_21(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u) (a, (b, (c, (d, (e, (f, (g, (h, (i, (j, (k, (l, (m, (n, (o, (p, (q, (r, (s, (t, (u, BOOST_PP_NIL))))))))))))))))))))) -# define BOOST_PP_TUPLE_TO_LIST_22(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v) (a, (b, (c, (d, (e, (f, (g, (h, (i, (j, (k, (l, (m, (n, (o, (p, (q, (r, (s, (t, (u, (v, BOOST_PP_NIL)))))))))))))))))))))) -# define BOOST_PP_TUPLE_TO_LIST_23(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w) (a, (b, (c, (d, (e, (f, (g, (h, (i, (j, (k, (l, (m, (n, (o, (p, (q, (r, (s, (t, (u, (v, (w, BOOST_PP_NIL))))))))))))))))))))))) -# define BOOST_PP_TUPLE_TO_LIST_24(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x) (a, (b, (c, (d, (e, (f, (g, (h, (i, (j, (k, (l, (m, (n, (o, (p, (q, (r, (s, (t, (u, (v, (w, (x, BOOST_PP_NIL)))))))))))))))))))))))) -# define BOOST_PP_TUPLE_TO_LIST_25(a, b, c, d, e, f, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u, v, w, x, y) (a, (b, (c, (d, (e, (f, (g, (h, (i, (j, (k, (l, (m, (n, (o, (p, (q, (r, (s, (t, (u, (v, (w, (x, (y, BOOST_PP_NIL))))))))))))))))))))))))) +# define BOOST_PP_TUPLE_TO_LIST_1(e0) (e0, BOOST_PP_NIL) +# define BOOST_PP_TUPLE_TO_LIST_2(e0, e1) (e0, (e1, BOOST_PP_NIL)) +# define BOOST_PP_TUPLE_TO_LIST_3(e0, e1, e2) (e0, (e1, (e2, BOOST_PP_NIL))) +# define BOOST_PP_TUPLE_TO_LIST_4(e0, e1, e2, e3) (e0, (e1, (e2, (e3, BOOST_PP_NIL)))) +# define BOOST_PP_TUPLE_TO_LIST_5(e0, e1, e2, e3, e4) (e0, (e1, (e2, (e3, (e4, BOOST_PP_NIL))))) +# define BOOST_PP_TUPLE_TO_LIST_6(e0, e1, e2, e3, e4, e5) (e0, (e1, (e2, (e3, (e4, (e5, BOOST_PP_NIL)))))) +# define BOOST_PP_TUPLE_TO_LIST_7(e0, e1, e2, e3, e4, e5, e6) (e0, (e1, (e2, (e3, (e4, (e5, (e6, BOOST_PP_NIL))))))) +# define BOOST_PP_TUPLE_TO_LIST_8(e0, e1, e2, e3, e4, e5, e6, e7) (e0, (e1, (e2, (e3, (e4, (e5, (e6, (e7, BOOST_PP_NIL)))))))) +# define BOOST_PP_TUPLE_TO_LIST_9(e0, e1, e2, e3, e4, e5, e6, e7, e8) (e0, (e1, (e2, (e3, (e4, (e5, (e6, (e7, (e8, BOOST_PP_NIL))))))))) +# define BOOST_PP_TUPLE_TO_LIST_10(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9) (e0, (e1, (e2, (e3, (e4, (e5, (e6, (e7, (e8, (e9, BOOST_PP_NIL)))))))))) +# define BOOST_PP_TUPLE_TO_LIST_11(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10) (e0, (e1, (e2, (e3, (e4, (e5, (e6, (e7, (e8, (e9, (e10, BOOST_PP_NIL))))))))))) +# define BOOST_PP_TUPLE_TO_LIST_12(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11) (e0, (e1, (e2, (e3, (e4, (e5, (e6, (e7, (e8, (e9, (e10, (e11, BOOST_PP_NIL)))))))))))) +# define BOOST_PP_TUPLE_TO_LIST_13(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12) (e0, (e1, (e2, (e3, (e4, (e5, (e6, (e7, (e8, (e9, (e10, (e11, (e12, BOOST_PP_NIL))))))))))))) +# define BOOST_PP_TUPLE_TO_LIST_14(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13) (e0, (e1, (e2, (e3, (e4, (e5, (e6, (e7, (e8, (e9, (e10, (e11, (e12, (e13, BOOST_PP_NIL)))))))))))))) +# define BOOST_PP_TUPLE_TO_LIST_15(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14) (e0, (e1, (e2, (e3, (e4, (e5, (e6, (e7, (e8, (e9, (e10, (e11, (e12, (e13, (e14, BOOST_PP_NIL))))))))))))))) +# define BOOST_PP_TUPLE_TO_LIST_16(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15) (e0, (e1, (e2, (e3, (e4, (e5, (e6, (e7, (e8, (e9, (e10, (e11, (e12, (e13, (e14, (e15, BOOST_PP_NIL)))))))))))))))) +# define BOOST_PP_TUPLE_TO_LIST_17(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16) (e0, (e1, (e2, (e3, (e4, (e5, (e6, (e7, (e8, (e9, (e10, (e11, (e12, (e13, (e14, (e15, (e16, BOOST_PP_NIL))))))))))))))))) +# define BOOST_PP_TUPLE_TO_LIST_18(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17) (e0, (e1, (e2, (e3, (e4, (e5, (e6, (e7, (e8, (e9, (e10, (e11, (e12, (e13, (e14, (e15, (e16, (e17, BOOST_PP_NIL)))))))))))))))))) +# define BOOST_PP_TUPLE_TO_LIST_19(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18) (e0, (e1, (e2, (e3, (e4, (e5, (e6, (e7, (e8, (e9, (e10, (e11, (e12, (e13, (e14, (e15, (e16, (e17, (e18, BOOST_PP_NIL))))))))))))))))))) +# define BOOST_PP_TUPLE_TO_LIST_20(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19) (e0, (e1, (e2, (e3, (e4, (e5, (e6, (e7, (e8, (e9, (e10, (e11, (e12, (e13, (e14, (e15, (e16, (e17, (e18, (e19, BOOST_PP_NIL)))))))))))))))))))) +# define BOOST_PP_TUPLE_TO_LIST_21(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20) (e0, (e1, (e2, (e3, (e4, (e5, (e6, (e7, (e8, (e9, (e10, (e11, (e12, (e13, (e14, (e15, (e16, (e17, (e18, (e19, (e20, BOOST_PP_NIL))))))))))))))))))))) +# define BOOST_PP_TUPLE_TO_LIST_22(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21) (e0, (e1, (e2, (e3, (e4, (e5, (e6, (e7, (e8, (e9, (e10, (e11, (e12, (e13, (e14, (e15, (e16, (e17, (e18, (e19, (e20, (e21, BOOST_PP_NIL)))))))))))))))))))))) +# define BOOST_PP_TUPLE_TO_LIST_23(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22) (e0, (e1, (e2, (e3, (e4, (e5, (e6, (e7, (e8, (e9, (e10, (e11, (e12, (e13, (e14, (e15, (e16, (e17, (e18, (e19, (e20, (e21, (e22, BOOST_PP_NIL))))))))))))))))))))))) +# define BOOST_PP_TUPLE_TO_LIST_24(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23) (e0, (e1, (e2, (e3, (e4, (e5, (e6, (e7, (e8, (e9, (e10, (e11, (e12, (e13, (e14, (e15, (e16, (e17, (e18, (e19, (e20, (e21, (e22, (e23, BOOST_PP_NIL)))))))))))))))))))))))) +# define BOOST_PP_TUPLE_TO_LIST_25(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24) (e0, (e1, (e2, (e3, (e4, (e5, (e6, (e7, (e8, (e9, (e10, (e11, (e12, (e13, (e14, (e15, (e16, (e17, (e18, (e19, (e20, (e21, (e22, (e23, (e24, BOOST_PP_NIL))))))))))))))))))))))))) +# define BOOST_PP_TUPLE_TO_LIST_26(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25) (e0, (e1, (e2, (e3, (e4, (e5, (e6, (e7, (e8, (e9, (e10, (e11, (e12, (e13, (e14, (e15, (e16, (e17, (e18, (e19, (e20, (e21, (e22, (e23, (e24, (e25, BOOST_PP_NIL)))))))))))))))))))))))))) +# define BOOST_PP_TUPLE_TO_LIST_27(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26) (e0, (e1, (e2, (e3, (e4, (e5, (e6, (e7, (e8, (e9, (e10, (e11, (e12, (e13, (e14, (e15, (e16, (e17, (e18, (e19, (e20, (e21, (e22, (e23, (e24, (e25, (e26, BOOST_PP_NIL))))))))))))))))))))))))))) +# define BOOST_PP_TUPLE_TO_LIST_28(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27) (e0, (e1, (e2, (e3, (e4, (e5, (e6, (e7, (e8, (e9, (e10, (e11, (e12, (e13, (e14, (e15, (e16, (e17, (e18, (e19, (e20, (e21, (e22, (e23, (e24, (e25, (e26, (e27, BOOST_PP_NIL)))))))))))))))))))))))))))) +# define BOOST_PP_TUPLE_TO_LIST_29(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28) (e0, (e1, (e2, (e3, (e4, (e5, (e6, (e7, (e8, (e9, (e10, (e11, (e12, (e13, (e14, (e15, (e16, (e17, (e18, (e19, (e20, (e21, (e22, (e23, (e24, (e25, (e26, (e27, (e28, BOOST_PP_NIL))))))))))))))))))))))))))))) +# define BOOST_PP_TUPLE_TO_LIST_30(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29) (e0, (e1, (e2, (e3, (e4, (e5, (e6, (e7, (e8, (e9, (e10, (e11, (e12, (e13, (e14, (e15, (e16, (e17, (e18, (e19, (e20, (e21, (e22, (e23, (e24, (e25, (e26, (e27, (e28, (e29, BOOST_PP_NIL)))))))))))))))))))))))))))))) +# define BOOST_PP_TUPLE_TO_LIST_31(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30) (e0, (e1, (e2, (e3, (e4, (e5, (e6, (e7, (e8, (e9, (e10, (e11, (e12, (e13, (e14, (e15, (e16, (e17, (e18, (e19, (e20, (e21, (e22, (e23, (e24, (e25, (e26, (e27, (e28, (e29, (e30, BOOST_PP_NIL))))))))))))))))))))))))))))))) +# define BOOST_PP_TUPLE_TO_LIST_32(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31) (e0, (e1, (e2, (e3, (e4, (e5, (e6, (e7, (e8, (e9, (e10, (e11, (e12, (e13, (e14, (e15, (e16, (e17, (e18, (e19, (e20, (e21, (e22, (e23, (e24, (e25, (e26, (e27, (e28, (e29, (e30, (e31, BOOST_PP_NIL)))))))))))))))))))))))))))))))) +# define BOOST_PP_TUPLE_TO_LIST_33(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32) (e0, (e1, (e2, (e3, (e4, (e5, (e6, (e7, (e8, (e9, (e10, (e11, (e12, (e13, (e14, (e15, (e16, (e17, (e18, (e19, (e20, (e21, (e22, (e23, (e24, (e25, (e26, (e27, (e28, (e29, (e30, (e31, (e32, BOOST_PP_NIL))))))))))))))))))))))))))))))))) +# define BOOST_PP_TUPLE_TO_LIST_34(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33) (e0, (e1, (e2, (e3, (e4, (e5, (e6, (e7, (e8, (e9, (e10, (e11, (e12, (e13, (e14, (e15, (e16, (e17, (e18, (e19, (e20, (e21, (e22, (e23, (e24, (e25, (e26, (e27, (e28, (e29, (e30, (e31, (e32, (e33, BOOST_PP_NIL)))))))))))))))))))))))))))))))))) +# define BOOST_PP_TUPLE_TO_LIST_35(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34) (e0, (e1, (e2, (e3, (e4, (e5, (e6, (e7, (e8, (e9, (e10, (e11, (e12, (e13, (e14, (e15, (e16, (e17, (e18, (e19, (e20, (e21, (e22, (e23, (e24, (e25, (e26, (e27, (e28, (e29, (e30, (e31, (e32, (e33, (e34, BOOST_PP_NIL))))))))))))))))))))))))))))))))))) +# define BOOST_PP_TUPLE_TO_LIST_36(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35) (e0, (e1, (e2, (e3, (e4, (e5, (e6, (e7, (e8, (e9, (e10, (e11, (e12, (e13, (e14, (e15, (e16, (e17, (e18, (e19, (e20, (e21, (e22, (e23, (e24, (e25, (e26, (e27, (e28, (e29, (e30, (e31, (e32, (e33, (e34, (e35, BOOST_PP_NIL)))))))))))))))))))))))))))))))))))) +# define BOOST_PP_TUPLE_TO_LIST_37(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36) (e0, (e1, (e2, (e3, (e4, (e5, (e6, (e7, (e8, (e9, (e10, (e11, (e12, (e13, (e14, (e15, (e16, (e17, (e18, (e19, (e20, (e21, (e22, (e23, (e24, (e25, (e26, (e27, (e28, (e29, (e30, (e31, (e32, (e33, (e34, (e35, (e36, BOOST_PP_NIL))))))))))))))))))))))))))))))))))))) +# define BOOST_PP_TUPLE_TO_LIST_38(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37) (e0, (e1, (e2, (e3, (e4, (e5, (e6, (e7, (e8, (e9, (e10, (e11, (e12, (e13, (e14, (e15, (e16, (e17, (e18, (e19, (e20, (e21, (e22, (e23, (e24, (e25, (e26, (e27, (e28, (e29, (e30, (e31, (e32, (e33, (e34, (e35, (e36, (e37, BOOST_PP_NIL)))))))))))))))))))))))))))))))))))))) +# define BOOST_PP_TUPLE_TO_LIST_39(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38) (e0, (e1, (e2, (e3, (e4, (e5, (e6, (e7, (e8, (e9, (e10, (e11, (e12, (e13, (e14, (e15, (e16, (e17, (e18, (e19, (e20, (e21, (e22, (e23, (e24, (e25, (e26, (e27, (e28, (e29, (e30, (e31, (e32, (e33, (e34, (e35, (e36, (e37, (e38, BOOST_PP_NIL))))))))))))))))))))))))))))))))))))))) +# define BOOST_PP_TUPLE_TO_LIST_40(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39) (e0, (e1, (e2, (e3, (e4, (e5, (e6, (e7, (e8, (e9, (e10, (e11, (e12, (e13, (e14, (e15, (e16, (e17, (e18, (e19, (e20, (e21, (e22, (e23, (e24, (e25, (e26, (e27, (e28, (e29, (e30, (e31, (e32, (e33, (e34, (e35, (e36, (e37, (e38, (e39, BOOST_PP_NIL)))))))))))))))))))))))))))))))))))))))) +# define BOOST_PP_TUPLE_TO_LIST_41(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40) (e0, (e1, (e2, (e3, (e4, (e5, (e6, (e7, (e8, (e9, (e10, (e11, (e12, (e13, (e14, (e15, (e16, (e17, (e18, (e19, (e20, (e21, (e22, (e23, (e24, (e25, (e26, (e27, (e28, (e29, (e30, (e31, (e32, (e33, (e34, (e35, (e36, (e37, (e38, (e39, (e40, BOOST_PP_NIL))))))))))))))))))))))))))))))))))))))))) +# define BOOST_PP_TUPLE_TO_LIST_42(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41) (e0, (e1, (e2, (e3, (e4, (e5, (e6, (e7, (e8, (e9, (e10, (e11, (e12, (e13, (e14, (e15, (e16, (e17, (e18, (e19, (e20, (e21, (e22, (e23, (e24, (e25, (e26, (e27, (e28, (e29, (e30, (e31, (e32, (e33, (e34, (e35, (e36, (e37, (e38, (e39, (e40, (e41, BOOST_PP_NIL)))))))))))))))))))))))))))))))))))))))))) +# define BOOST_PP_TUPLE_TO_LIST_43(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42) (e0, (e1, (e2, (e3, (e4, (e5, (e6, (e7, (e8, (e9, (e10, (e11, (e12, (e13, (e14, (e15, (e16, (e17, (e18, (e19, (e20, (e21, (e22, (e23, (e24, (e25, (e26, (e27, (e28, (e29, (e30, (e31, (e32, (e33, (e34, (e35, (e36, (e37, (e38, (e39, (e40, (e41, (e42, BOOST_PP_NIL))))))))))))))))))))))))))))))))))))))))))) +# define BOOST_PP_TUPLE_TO_LIST_44(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43) (e0, (e1, (e2, (e3, (e4, (e5, (e6, (e7, (e8, (e9, (e10, (e11, (e12, (e13, (e14, (e15, (e16, (e17, (e18, (e19, (e20, (e21, (e22, (e23, (e24, (e25, (e26, (e27, (e28, (e29, (e30, (e31, (e32, (e33, (e34, (e35, (e36, (e37, (e38, (e39, (e40, (e41, (e42, (e43, BOOST_PP_NIL)))))))))))))))))))))))))))))))))))))))))))) +# define BOOST_PP_TUPLE_TO_LIST_45(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44) (e0, (e1, (e2, (e3, (e4, (e5, (e6, (e7, (e8, (e9, (e10, (e11, (e12, (e13, (e14, (e15, (e16, (e17, (e18, (e19, (e20, (e21, (e22, (e23, (e24, (e25, (e26, (e27, (e28, (e29, (e30, (e31, (e32, (e33, (e34, (e35, (e36, (e37, (e38, (e39, (e40, (e41, (e42, (e43, (e44, BOOST_PP_NIL))))))))))))))))))))))))))))))))))))))))))))) +# define BOOST_PP_TUPLE_TO_LIST_46(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45) (e0, (e1, (e2, (e3, (e4, (e5, (e6, (e7, (e8, (e9, (e10, (e11, (e12, (e13, (e14, (e15, (e16, (e17, (e18, (e19, (e20, (e21, (e22, (e23, (e24, (e25, (e26, (e27, (e28, (e29, (e30, (e31, (e32, (e33, (e34, (e35, (e36, (e37, (e38, (e39, (e40, (e41, (e42, (e43, (e44, (e45, BOOST_PP_NIL)))))))))))))))))))))))))))))))))))))))))))))) +# define BOOST_PP_TUPLE_TO_LIST_47(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46) (e0, (e1, (e2, (e3, (e4, (e5, (e6, (e7, (e8, (e9, (e10, (e11, (e12, (e13, (e14, (e15, (e16, (e17, (e18, (e19, (e20, (e21, (e22, (e23, (e24, (e25, (e26, (e27, (e28, (e29, (e30, (e31, (e32, (e33, (e34, (e35, (e36, (e37, (e38, (e39, (e40, (e41, (e42, (e43, (e44, (e45, (e46, BOOST_PP_NIL))))))))))))))))))))))))))))))))))))))))))))))) +# define BOOST_PP_TUPLE_TO_LIST_48(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47) (e0, (e1, (e2, (e3, (e4, (e5, (e6, (e7, (e8, (e9, (e10, (e11, (e12, (e13, (e14, (e15, (e16, (e17, (e18, (e19, (e20, (e21, (e22, (e23, (e24, (e25, (e26, (e27, (e28, (e29, (e30, (e31, (e32, (e33, (e34, (e35, (e36, (e37, (e38, (e39, (e40, (e41, (e42, (e43, (e44, (e45, (e46, (e47, BOOST_PP_NIL)))))))))))))))))))))))))))))))))))))))))))))))) +# define BOOST_PP_TUPLE_TO_LIST_49(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48) (e0, (e1, (e2, (e3, (e4, (e5, (e6, (e7, (e8, (e9, (e10, (e11, (e12, (e13, (e14, (e15, (e16, (e17, (e18, (e19, (e20, (e21, (e22, (e23, (e24, (e25, (e26, (e27, (e28, (e29, (e30, (e31, (e32, (e33, (e34, (e35, (e36, (e37, (e38, (e39, (e40, (e41, (e42, (e43, (e44, (e45, (e46, (e47, (e48, BOOST_PP_NIL))))))))))))))))))))))))))))))))))))))))))))))))) +# define BOOST_PP_TUPLE_TO_LIST_50(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49) (e0, (e1, (e2, (e3, (e4, (e5, (e6, (e7, (e8, (e9, (e10, (e11, (e12, (e13, (e14, (e15, (e16, (e17, (e18, (e19, (e20, (e21, (e22, (e23, (e24, (e25, (e26, (e27, (e28, (e29, (e30, (e31, (e32, (e33, (e34, (e35, (e36, (e37, (e38, (e39, (e40, (e41, (e42, (e43, (e44, (e45, (e46, (e47, (e48, (e49, BOOST_PP_NIL)))))))))))))))))))))))))))))))))))))))))))))))))) +# define BOOST_PP_TUPLE_TO_LIST_51(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50) (e0, (e1, (e2, (e3, (e4, (e5, (e6, (e7, (e8, (e9, (e10, (e11, (e12, (e13, (e14, (e15, (e16, (e17, (e18, (e19, (e20, (e21, (e22, (e23, (e24, (e25, (e26, (e27, (e28, (e29, (e30, (e31, (e32, (e33, (e34, (e35, (e36, (e37, (e38, (e39, (e40, (e41, (e42, (e43, (e44, (e45, (e46, (e47, (e48, (e49, (e50, BOOST_PP_NIL))))))))))))))))))))))))))))))))))))))))))))))))))) +# define BOOST_PP_TUPLE_TO_LIST_52(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51) (e0, (e1, (e2, (e3, (e4, (e5, (e6, (e7, (e8, (e9, (e10, (e11, (e12, (e13, (e14, (e15, (e16, (e17, (e18, (e19, (e20, (e21, (e22, (e23, (e24, (e25, (e26, (e27, (e28, (e29, (e30, (e31, (e32, (e33, (e34, (e35, (e36, (e37, (e38, (e39, (e40, (e41, (e42, (e43, (e44, (e45, (e46, (e47, (e48, (e49, (e50, (e51, BOOST_PP_NIL)))))))))))))))))))))))))))))))))))))))))))))))))))) +# define BOOST_PP_TUPLE_TO_LIST_53(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52) (e0, (e1, (e2, (e3, (e4, (e5, (e6, (e7, (e8, (e9, (e10, (e11, (e12, (e13, (e14, (e15, (e16, (e17, (e18, (e19, (e20, (e21, (e22, (e23, (e24, (e25, (e26, (e27, (e28, (e29, (e30, (e31, (e32, (e33, (e34, (e35, (e36, (e37, (e38, (e39, (e40, (e41, (e42, (e43, (e44, (e45, (e46, (e47, (e48, (e49, (e50, (e51, (e52, BOOST_PP_NIL))))))))))))))))))))))))))))))))))))))))))))))))))))) +# define BOOST_PP_TUPLE_TO_LIST_54(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53) (e0, (e1, (e2, (e3, (e4, (e5, (e6, (e7, (e8, (e9, (e10, (e11, (e12, (e13, (e14, (e15, (e16, (e17, (e18, (e19, (e20, (e21, (e22, (e23, (e24, (e25, (e26, (e27, (e28, (e29, (e30, (e31, (e32, (e33, (e34, (e35, (e36, (e37, (e38, (e39, (e40, (e41, (e42, (e43, (e44, (e45, (e46, (e47, (e48, (e49, (e50, (e51, (e52, (e53, BOOST_PP_NIL)))))))))))))))))))))))))))))))))))))))))))))))))))))) +# define BOOST_PP_TUPLE_TO_LIST_55(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54) (e0, (e1, (e2, (e3, (e4, (e5, (e6, (e7, (e8, (e9, (e10, (e11, (e12, (e13, (e14, (e15, (e16, (e17, (e18, (e19, (e20, (e21, (e22, (e23, (e24, (e25, (e26, (e27, (e28, (e29, (e30, (e31, (e32, (e33, (e34, (e35, (e36, (e37, (e38, (e39, (e40, (e41, (e42, (e43, (e44, (e45, (e46, (e47, (e48, (e49, (e50, (e51, (e52, (e53, (e54, BOOST_PP_NIL))))))))))))))))))))))))))))))))))))))))))))))))))))))) +# define BOOST_PP_TUPLE_TO_LIST_56(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55) (e0, (e1, (e2, (e3, (e4, (e5, (e6, (e7, (e8, (e9, (e10, (e11, (e12, (e13, (e14, (e15, (e16, (e17, (e18, (e19, (e20, (e21, (e22, (e23, (e24, (e25, (e26, (e27, (e28, (e29, (e30, (e31, (e32, (e33, (e34, (e35, (e36, (e37, (e38, (e39, (e40, (e41, (e42, (e43, (e44, (e45, (e46, (e47, (e48, (e49, (e50, (e51, (e52, (e53, (e54, (e55, BOOST_PP_NIL)))))))))))))))))))))))))))))))))))))))))))))))))))))))) +# define BOOST_PP_TUPLE_TO_LIST_57(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56) (e0, (e1, (e2, (e3, (e4, (e5, (e6, (e7, (e8, (e9, (e10, (e11, (e12, (e13, (e14, (e15, (e16, (e17, (e18, (e19, (e20, (e21, (e22, (e23, (e24, (e25, (e26, (e27, (e28, (e29, (e30, (e31, (e32, (e33, (e34, (e35, (e36, (e37, (e38, (e39, (e40, (e41, (e42, (e43, (e44, (e45, (e46, (e47, (e48, (e49, (e50, (e51, (e52, (e53, (e54, (e55, (e56, BOOST_PP_NIL))))))))))))))))))))))))))))))))))))))))))))))))))))))))) +# define BOOST_PP_TUPLE_TO_LIST_58(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57) (e0, (e1, (e2, (e3, (e4, (e5, (e6, (e7, (e8, (e9, (e10, (e11, (e12, (e13, (e14, (e15, (e16, (e17, (e18, (e19, (e20, (e21, (e22, (e23, (e24, (e25, (e26, (e27, (e28, (e29, (e30, (e31, (e32, (e33, (e34, (e35, (e36, (e37, (e38, (e39, (e40, (e41, (e42, (e43, (e44, (e45, (e46, (e47, (e48, (e49, (e50, (e51, (e52, (e53, (e54, (e55, (e56, (e57, BOOST_PP_NIL)))))))))))))))))))))))))))))))))))))))))))))))))))))))))) +# define BOOST_PP_TUPLE_TO_LIST_59(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58) (e0, (e1, (e2, (e3, (e4, (e5, (e6, (e7, (e8, (e9, (e10, (e11, (e12, (e13, (e14, (e15, (e16, (e17, (e18, (e19, (e20, (e21, (e22, (e23, (e24, (e25, (e26, (e27, (e28, (e29, (e30, (e31, (e32, (e33, (e34, (e35, (e36, (e37, (e38, (e39, (e40, (e41, (e42, (e43, (e44, (e45, (e46, (e47, (e48, (e49, (e50, (e51, (e52, (e53, (e54, (e55, (e56, (e57, (e58, BOOST_PP_NIL))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) +# define BOOST_PP_TUPLE_TO_LIST_60(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59) (e0, (e1, (e2, (e3, (e4, (e5, (e6, (e7, (e8, (e9, (e10, (e11, (e12, (e13, (e14, (e15, (e16, (e17, (e18, (e19, (e20, (e21, (e22, (e23, (e24, (e25, (e26, (e27, (e28, (e29, (e30, (e31, (e32, (e33, (e34, (e35, (e36, (e37, (e38, (e39, (e40, (e41, (e42, (e43, (e44, (e45, (e46, (e47, (e48, (e49, (e50, (e51, (e52, (e53, (e54, (e55, (e56, (e57, (e58, (e59, BOOST_PP_NIL)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) +# define BOOST_PP_TUPLE_TO_LIST_61(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60) (e0, (e1, (e2, (e3, (e4, (e5, (e6, (e7, (e8, (e9, (e10, (e11, (e12, (e13, (e14, (e15, (e16, (e17, (e18, (e19, (e20, (e21, (e22, (e23, (e24, (e25, (e26, (e27, (e28, (e29, (e30, (e31, (e32, (e33, (e34, (e35, (e36, (e37, (e38, (e39, (e40, (e41, (e42, (e43, (e44, (e45, (e46, (e47, (e48, (e49, (e50, (e51, (e52, (e53, (e54, (e55, (e56, (e57, (e58, (e59, (e60, BOOST_PP_NIL))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) +# define BOOST_PP_TUPLE_TO_LIST_62(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61) (e0, (e1, (e2, (e3, (e4, (e5, (e6, (e7, (e8, (e9, (e10, (e11, (e12, (e13, (e14, (e15, (e16, (e17, (e18, (e19, (e20, (e21, (e22, (e23, (e24, (e25, (e26, (e27, (e28, (e29, (e30, (e31, (e32, (e33, (e34, (e35, (e36, (e37, (e38, (e39, (e40, (e41, (e42, (e43, (e44, (e45, (e46, (e47, (e48, (e49, (e50, (e51, (e52, (e53, (e54, (e55, (e56, (e57, (e58, (e59, (e60, (e61, BOOST_PP_NIL)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) +# define BOOST_PP_TUPLE_TO_LIST_63(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62) (e0, (e1, (e2, (e3, (e4, (e5, (e6, (e7, (e8, (e9, (e10, (e11, (e12, (e13, (e14, (e15, (e16, (e17, (e18, (e19, (e20, (e21, (e22, (e23, (e24, (e25, (e26, (e27, (e28, (e29, (e30, (e31, (e32, (e33, (e34, (e35, (e36, (e37, (e38, (e39, (e40, (e41, (e42, (e43, (e44, (e45, (e46, (e47, (e48, (e49, (e50, (e51, (e52, (e53, (e54, (e55, (e56, (e57, (e58, (e59, (e60, (e61, (e62, BOOST_PP_NIL))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) +# define BOOST_PP_TUPLE_TO_LIST_64(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63) (e0, (e1, (e2, (e3, (e4, (e5, (e6, (e7, (e8, (e9, (e10, (e11, (e12, (e13, (e14, (e15, (e16, (e17, (e18, (e19, (e20, (e21, (e22, (e23, (e24, (e25, (e26, (e27, (e28, (e29, (e30, (e31, (e32, (e33, (e34, (e35, (e36, (e37, (e38, (e39, (e40, (e41, (e42, (e43, (e44, (e45, (e46, (e47, (e48, (e49, (e50, (e51, (e52, (e53, (e54, (e55, (e56, (e57, (e58, (e59, (e60, (e61, (e62, (e63, BOOST_PP_NIL)))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))))) # # endif diff --git a/3rdParty/Boost/src/boost/preprocessor/variadic/elem.hpp b/3rdParty/Boost/src/boost/preprocessor/variadic/elem.hpp new file mode 100644 index 0000000..be38a94 --- /dev/null +++ b/3rdParty/Boost/src/boost/preprocessor/variadic/elem.hpp @@ -0,0 +1,94 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2011. * +# * (C) Copyright Paul Mensonides 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) * +# * * +# ************************************************************************** */ +# +# /* See http://www.boost.org for most recent version. */ +# +# ifndef BOOST_PREPROCESSOR_VARIADIC_ELEM_HPP +# define BOOST_PREPROCESSOR_VARIADIC_ELEM_HPP +# +# include <boost/preprocessor/cat.hpp> +# include <boost/preprocessor/config/config.hpp> +# +# /* BOOST_PP_VARIADIC_ELEM */ +# +# if BOOST_PP_VARIADICS +# if BOOST_PP_VARIADICS_MSVC +# define BOOST_PP_VARIADIC_ELEM(n, ...) BOOST_PP_VARIADIC_ELEM_I(n,__VA_ARGS__) +# define BOOST_PP_VARIADIC_ELEM_I(n, ...) BOOST_PP_CAT(BOOST_PP_CAT(BOOST_PP_VARIADIC_ELEM_, n)(__VA_ARGS__,),) +# else +# define BOOST_PP_VARIADIC_ELEM(n, ...) BOOST_PP_CAT(BOOST_PP_VARIADIC_ELEM_, n)(__VA_ARGS__,) +# endif +# define BOOST_PP_VARIADIC_ELEM_0(e0, ...) e0 +# define BOOST_PP_VARIADIC_ELEM_1(e0, e1, ...) e1 +# define BOOST_PP_VARIADIC_ELEM_2(e0, e1, e2, ...) e2 +# define BOOST_PP_VARIADIC_ELEM_3(e0, e1, e2, e3, ...) e3 +# define BOOST_PP_VARIADIC_ELEM_4(e0, e1, e2, e3, e4, ...) e4 +# define BOOST_PP_VARIADIC_ELEM_5(e0, e1, e2, e3, e4, e5, ...) e5 +# define BOOST_PP_VARIADIC_ELEM_6(e0, e1, e2, e3, e4, e5, e6, ...) e6 +# define BOOST_PP_VARIADIC_ELEM_7(e0, e1, e2, e3, e4, e5, e6, e7, ...) e7 +# define BOOST_PP_VARIADIC_ELEM_8(e0, e1, e2, e3, e4, e5, e6, e7, e8, ...) e8 +# define BOOST_PP_VARIADIC_ELEM_9(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, ...) e9 +# define BOOST_PP_VARIADIC_ELEM_10(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, ...) e10 +# define BOOST_PP_VARIADIC_ELEM_11(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, ...) e11 +# define BOOST_PP_VARIADIC_ELEM_12(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, ...) e12 +# define BOOST_PP_VARIADIC_ELEM_13(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, ...) e13 +# define BOOST_PP_VARIADIC_ELEM_14(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, ...) e14 +# define BOOST_PP_VARIADIC_ELEM_15(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, ...) e15 +# define BOOST_PP_VARIADIC_ELEM_16(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, ...) e16 +# define BOOST_PP_VARIADIC_ELEM_17(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, ...) e17 +# define BOOST_PP_VARIADIC_ELEM_18(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, ...) e18 +# define BOOST_PP_VARIADIC_ELEM_19(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, ...) e19 +# define BOOST_PP_VARIADIC_ELEM_20(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, ...) e20 +# define BOOST_PP_VARIADIC_ELEM_21(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, ...) e21 +# define BOOST_PP_VARIADIC_ELEM_22(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, ...) e22 +# define BOOST_PP_VARIADIC_ELEM_23(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, ...) e23 +# define BOOST_PP_VARIADIC_ELEM_24(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, ...) e24 +# define BOOST_PP_VARIADIC_ELEM_25(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, ...) e25 +# define BOOST_PP_VARIADIC_ELEM_26(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, ...) e26 +# define BOOST_PP_VARIADIC_ELEM_27(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, ...) e27 +# define BOOST_PP_VARIADIC_ELEM_28(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, ...) e28 +# define BOOST_PP_VARIADIC_ELEM_29(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, ...) e29 +# define BOOST_PP_VARIADIC_ELEM_30(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, ...) e30 +# define BOOST_PP_VARIADIC_ELEM_31(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, ...) e31 +# define BOOST_PP_VARIADIC_ELEM_32(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, ...) e32 +# define BOOST_PP_VARIADIC_ELEM_33(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, ...) e33 +# define BOOST_PP_VARIADIC_ELEM_34(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, ...) e34 +# define BOOST_PP_VARIADIC_ELEM_35(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, ...) e35 +# define BOOST_PP_VARIADIC_ELEM_36(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, ...) e36 +# define BOOST_PP_VARIADIC_ELEM_37(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, ...) e37 +# define BOOST_PP_VARIADIC_ELEM_38(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, ...) e38 +# define BOOST_PP_VARIADIC_ELEM_39(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, ...) e39 +# define BOOST_PP_VARIADIC_ELEM_40(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, ...) e40 +# define BOOST_PP_VARIADIC_ELEM_41(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, ...) e41 +# define BOOST_PP_VARIADIC_ELEM_42(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, ...) e42 +# define BOOST_PP_VARIADIC_ELEM_43(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, ...) e43 +# define BOOST_PP_VARIADIC_ELEM_44(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, ...) e44 +# define BOOST_PP_VARIADIC_ELEM_45(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, ...) e45 +# define BOOST_PP_VARIADIC_ELEM_46(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, ...) e46 +# define BOOST_PP_VARIADIC_ELEM_47(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, ...) e47 +# define BOOST_PP_VARIADIC_ELEM_48(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, ...) e48 +# define BOOST_PP_VARIADIC_ELEM_49(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, ...) e49 +# define BOOST_PP_VARIADIC_ELEM_50(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, ...) e50 +# define BOOST_PP_VARIADIC_ELEM_51(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, ...) e51 +# define BOOST_PP_VARIADIC_ELEM_52(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, ...) e52 +# define BOOST_PP_VARIADIC_ELEM_53(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, ...) e53 +# define BOOST_PP_VARIADIC_ELEM_54(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, ...) e54 +# define BOOST_PP_VARIADIC_ELEM_55(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, ...) e55 +# define BOOST_PP_VARIADIC_ELEM_56(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, ...) e56 +# define BOOST_PP_VARIADIC_ELEM_57(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, ...) e57 +# define BOOST_PP_VARIADIC_ELEM_58(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, ...) e58 +# define BOOST_PP_VARIADIC_ELEM_59(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, ...) e59 +# define BOOST_PP_VARIADIC_ELEM_60(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, ...) e60 +# define BOOST_PP_VARIADIC_ELEM_61(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, ...) e61 +# define BOOST_PP_VARIADIC_ELEM_62(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, ...) e62 +# define BOOST_PP_VARIADIC_ELEM_63(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63, ...) e63 +# endif +# +# endif diff --git a/3rdParty/Boost/src/boost/preprocessor/variadic/size.hpp b/3rdParty/Boost/src/boost/preprocessor/variadic/size.hpp new file mode 100644 index 0000000..b92a5ff --- /dev/null +++ b/3rdParty/Boost/src/boost/preprocessor/variadic/size.hpp @@ -0,0 +1,30 @@ +# /* ************************************************************************** +# * * +# * (C) Copyright Edward Diener 2011. * +# * (C) Copyright Paul Mensonides 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) * +# * * +# ************************************************************************** */ +# +# /* See http://www.boost.org for most recent version. */ +# +# ifndef BOOST_PREPROCESSOR_VARIADIC_SIZE_HPP +# define BOOST_PREPROCESSOR_VARIADIC_SIZE_HPP +# +# include <boost/preprocessor/cat.hpp> +# include <boost/preprocessor/config/config.hpp> +# +# /* BOOST_PP_VARIADIC_SIZE */ +# +# if BOOST_PP_VARIADICS +# if BOOST_PP_VARIADICS_MSVC +# define BOOST_PP_VARIADIC_SIZE(...) BOOST_PP_CAT(BOOST_PP_VARIADIC_SIZE_I(__VA_ARGS__, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1,),) +# else +# define BOOST_PP_VARIADIC_SIZE(...) BOOST_PP_VARIADIC_SIZE_I(__VA_ARGS__, 64, 63, 62, 61, 60, 59, 58, 57, 56, 55, 54, 53, 52, 51, 50, 49, 48, 47, 46, 45, 44, 43, 42, 41, 40, 39, 38, 37, 36, 35, 34, 33, 32, 31, 30, 29, 28, 27, 26, 25, 24, 23, 22, 21, 20, 19, 18, 17, 16, 15, 14, 13, 12, 11, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1,) +# endif +# define BOOST_PP_VARIADIC_SIZE_I(e0, e1, e2, e3, e4, e5, e6, e7, e8, e9, e10, e11, e12, e13, e14, e15, e16, e17, e18, e19, e20, e21, e22, e23, e24, e25, e26, e27, e28, e29, e30, e31, e32, e33, e34, e35, e36, e37, e38, e39, e40, e41, e42, e43, e44, e45, e46, e47, e48, e49, e50, e51, e52, e53, e54, e55, e56, e57, e58, e59, e60, e61, e62, e63, size, ...) size +# endif +# +# endif diff --git a/3rdParty/Boost/src/boost/program_options/config.hpp b/3rdParty/Boost/src/boost/program_options/config.hpp index 0c69c14..8b70521 100644 --- a/3rdParty/Boost/src/boost/program_options/config.hpp +++ b/3rdParty/Boost/src/boost/program_options/config.hpp @@ -34,17 +34,14 @@ #endif // BOOST_VERSION /////////////////////////////////////////////////////////////////////////////// -// Windows DLL suport -#ifdef BOOST_HAS_DECLSPEC #if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_PROGRAM_OPTIONS_DYN_LINK) // export if this is our own source, otherwise import: #ifdef BOOST_PROGRAM_OPTIONS_SOURCE -# define BOOST_PROGRAM_OPTIONS_DECL __declspec(dllexport) +# define BOOST_PROGRAM_OPTIONS_DECL BOOST_SYMBOL_EXPORT #else -# define BOOST_PROGRAM_OPTIONS_DECL __declspec(dllimport) +# define BOOST_PROGRAM_OPTIONS_DECL BOOST_SYMBOL_IMPORT #endif // BOOST_PROGRAM_OPTIONS_SOURCE #endif // DYN_LINK -#endif // BOOST_HAS_DECLSPEC #ifndef BOOST_PROGRAM_OPTIONS_DECL #define BOOST_PROGRAM_OPTIONS_DECL diff --git a/3rdParty/Boost/src/boost/program_options/detail/cmdline.hpp b/3rdParty/Boost/src/boost/program_options/detail/cmdline.hpp index 7c43152..8e3bcc6 100644 --- a/3rdParty/Boost/src/boost/program_options/detail/cmdline.hpp +++ b/3rdParty/Boost/src/boost/program_options/detail/cmdline.hpp @@ -81,6 +81,18 @@ namespace boost { namespace program_options { namespace detail { cmdline(int argc, const char*const * argv); void style(int style); + + /** returns the canonical option prefix associated with the command_line_style + * In order of precedence: + * allow_long : allow_long + * allow_long_disguise : allow_long_disguise + * allow_dash_for_short : allow_short | allow_dash_for_short + * allow_slash_for_short: allow_short | allow_slash_for_short + * + * This is mainly used for the diagnostic messages in exceptions + */ + int get_canonical_option_prefix(); + void allow_unregistered(); void set_options_description(const options_description& desc); diff --git a/3rdParty/Boost/src/boost/program_options/detail/config_file.hpp b/3rdParty/Boost/src/boost/program_options/detail/config_file.hpp index 91caac7..4c2c15b 100644 --- a/3rdParty/Boost/src/boost/program_options/detail/config_file.hpp +++ b/3rdParty/Boost/src/boost/program_options/detail/config_file.hpp @@ -17,9 +17,7 @@ #include <boost/program_options/eof_iterator.hpp> #include <boost/detail/workaround.hpp> -#if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3202)) #include <boost/program_options/detail/convert.hpp> -#endif #if BOOST_WORKAROUND(__DECCXX_VER, BOOST_TESTED_AT(60590042)) #include <istream> // std::getline diff --git a/3rdParty/Boost/src/boost/program_options/detail/parsers.hpp b/3rdParty/Boost/src/boost/program_options/detail/parsers.hpp index a1124b2..af240c6 100644 --- a/3rdParty/Boost/src/boost/program_options/detail/parsers.hpp +++ b/3rdParty/Boost/src/boost/program_options/detail/parsers.hpp @@ -100,7 +100,11 @@ namespace boost { namespace program_options { basic_parsed_options<charT> basic_command_line_parser<charT>::run() { - parsed_options result(m_desc); + // save the canonical prefixes which were used by this cmdline parser + // eventually inside the parsed results + // This will be handy to format recognisable options + // for diagnostic messages if everything blows up much later on + parsed_options result(m_desc, detail::cmdline::get_canonical_option_prefix()); result.options = detail::cmdline::run(); // Presense of parsed_options -> wparsed_options conversion diff --git a/3rdParty/Boost/src/boost/program_options/detail/value_semantic.hpp b/3rdParty/Boost/src/boost/program_options/detail/value_semantic.hpp index e4b15d7..814a3db 100644 --- a/3rdParty/Boost/src/boost/program_options/detail/value_semantic.hpp +++ b/3rdParty/Boost/src/boost/program_options/detail/value_semantic.hpp @@ -16,16 +16,17 @@ namespace boost { namespace program_options { std::string typed_value<T, charT>::name() const { + std::string const& var = (m_value_name.empty() ? arg : m_value_name); if (!m_implicit_value.empty() && !m_implicit_value_as_text.empty()) { - std::string msg = "[=arg(=" + m_implicit_value_as_text + ")]"; + std::string msg = "[=" + var + "(=" + m_implicit_value_as_text + ")]"; if (!m_default_value.empty() && !m_default_value_as_text.empty()) msg += " (=" + m_default_value_as_text + ")"; return msg; } else if (!m_default_value.empty() && !m_default_value_as_text.empty()) { - return arg + " (=" + m_default_value_as_text + ")"; + return var + " (=" + m_default_value_as_text + ")"; } else { - return arg; + return var; } } diff --git a/3rdParty/Boost/src/boost/program_options/errors.hpp b/3rdParty/Boost/src/boost/program_options/errors.hpp index ff6bc7f..addb8d6 100644 --- a/3rdParty/Boost/src/boost/program_options/errors.hpp +++ b/3rdParty/Boost/src/boost/program_options/errors.hpp @@ -12,6 +12,8 @@ #include <string> #include <stdexcept> #include <vector> +#include <map> + #if defined(BOOST_MSVC) # pragma warning (push) @@ -21,126 +23,338 @@ namespace boost { namespace program_options { + inline std::string strip_prefixes(const std::string& text) + { + return text.substr(text.find_last_of("-/") + 1); + } + /** Base class for all errors in the library. */ class BOOST_PROGRAM_OPTIONS_DECL error : public std::logic_error { public: error(const std::string& xwhat) : std::logic_error(xwhat) {} }; - class BOOST_PROGRAM_OPTIONS_DECL invalid_syntax : public error { + + /** Class thrown when there are too many positional options. + This is a programming error. + */ + class BOOST_PROGRAM_OPTIONS_DECL too_many_positional_options_error : public error { public: - enum kind_t { - long_not_allowed = 30, - long_adjacent_not_allowed, - short_adjacent_not_allowed, - empty_adjacent_parameter, - missing_parameter, - extra_parameter, - unrecognized_line - }; - - invalid_syntax(const std::string& tokens, kind_t kind); + too_many_positional_options_error() + : error("too many positional options have been specified on the command line") + {} + }; + + /** Class thrown when there are programming error related to style */ + class BOOST_PROGRAM_OPTIONS_DECL invalid_command_line_style : public error { + public: + invalid_command_line_style(const std::string& msg) + : error(msg) + {} + }; + + /** Class thrown if config file can not be read */ + class BOOST_PROGRAM_OPTIONS_DECL reading_file : public error { + public: + reading_file(const char* filename) + : error(std::string("can not read options configuration file '").append(filename).append("'")) + {} + }; + + + /** Base class for most exceptions in the library. + * + * Substitutes the values for the parameter name + * placeholders in the template to create the human + * readable error message + * + * Placeholders are surrounded by % signs: %example% + * Poor man's version of boost::format + * + * If a parameter name is absent, perform default substitutions + * instead so ugly placeholders are never left in-place. + * + * Options are displayed in "canonical" form + * This is the most unambiguous form of the + * *parsed* option name and would correspond to + * option_description::format_name() + * i.e. what is shown by print_usage() + * + * The "canonical" form depends on whether the option is + * specified in short or long form, using dashes or slashes + * or without a prefix (from a configuration file) + * + * */ + class BOOST_PROGRAM_OPTIONS_DECL error_with_option_name : public error { - // gcc says that throw specification on dtor is loosened - // without this line - ~invalid_syntax() throw() {} - - kind_t kind() const; - - const std::string& tokens() const; - protected: - /** Used to convert kind_t to a related error text */ - static std::string error_message(kind_t kind); + /** can be + * 0 = no prefix (config file options) + * allow_long + * allow_dash_for_short + * allow_slash_for_short + * allow_long_disguise */ + int m_option_style; - private: - // TODO: copy ctor might throw - std::string m_tokens; - kind_t m_kind; + /** substitutions + * from placeholders to values */ + std::map<std::string, std::string> m_substitutions; + typedef std::pair<std::string, std::string> string_pair; + std::map<std::string, string_pair > m_substitution_defaults; + + public: + /** template with placeholders */ + std::string m_error_template; + + error_with_option_name(const std::string& template_, + const std::string& option_name = "", + const std::string& original_token = "", + int option_style = 0); + + /** gcc says that throw specification on dtor is loosened + * without this line + * */ + ~error_with_option_name() throw() {} + + + //void dump() const + //{ + // std::cerr << "m_substitution_defaults:\n"; + // for (std::map<std::string, string_pair>::const_iterator iter = m_substitution_defaults.begin(); + // iter != m_substitution_defaults.end(); ++iter) + // std::cerr << "\t" << iter->first << ":" << iter->second.first << "=" << iter->second.second << "\n"; + // std::cerr << "m_substitutions:\n"; + // for (std::map<std::string, std::string>::const_iterator iter = m_substitutions.begin(); + // iter != m_substitutions.end(); ++iter) + // std::cerr << "\t" << iter->first << "=" << iter->second << "\n"; + // std::cerr << "m_error_template:\n"; + // std::cerr << "\t" << m_error_template << "\n"; + // std::cerr << "canonical_option_prefix:[" << get_canonical_option_prefix() << "]\n"; + // std::cerr << "canonical_option_name:[" << get_canonical_option_name() <<"]\n"; + // std::cerr << "what:[" << what() << "]\n"; + //} + + /** Substitute + * parameter_name->value to create the error message from + * the error template */ + void set_substitute(const std::string& parameter_name, const std::string& value) + { m_substitutions[parameter_name] = value; } + + /** If the parameter is missing, then make the + * from->to substitution instead */ + void set_substitute_default(const std::string& parameter_name, + const std::string& from, + const std::string& to) + { + m_substitution_defaults[parameter_name] = std::make_pair(from, to); + } + + + /** Add context to an exception */ + void add_context(const std::string& option_name, + const std::string& original_token, + int option_style) + { + set_option_name(option_name); + set_original_token(original_token); + set_prefix(option_style); + } + + void set_prefix(int option_style) + { m_option_style = option_style;} + + /** Overridden in error_with_no_option_name */ + virtual void set_option_name(const std::string& option_name) + { set_substitute("option", option_name);} + + std::string get_option_name() const throw() + { return get_canonical_option_name(); } + + void set_original_token(const std::string& original_token) + { set_substitute("original_token", original_token);} + + + /** Creates the error_message on the fly + * Currently a thin wrapper for substitute_placeholders() */ + virtual const char* what() const throw(); + + protected: + /** Used to hold the error text returned by what() */ + mutable std::string m_message; // For on-demand formatting in 'what' + + /** Makes all substitutions using the template */ + virtual void substitute_placeholders(const std::string& error_template) const; + + // helper function for substitute_placeholders + void replace_token(const std::string& from, const std::string& to) const; + + /** Construct option name in accordance with the appropriate + * prefix style: i.e. long dash or short slash etc */ + std::string get_canonical_option_name() const; + std::string get_canonical_option_prefix() const; + }; + + + /** Class thrown when there are several option values, but + user called a method which cannot return them all. */ + class BOOST_PROGRAM_OPTIONS_DECL multiple_values : public error_with_option_name { + public: + multiple_values() + : error_with_option_name("option '%canonical_option%' only takes a single argument"){} + + ~multiple_values() throw() {} + }; + + /** Class thrown when there are several occurrences of an + option, but user called a method which cannot return + them all. */ + class BOOST_PROGRAM_OPTIONS_DECL multiple_occurrences : public error_with_option_name { + public: + multiple_occurrences() + : error_with_option_name("option '%canonical_option%' cannot be specified more than once"){} + + ~multiple_occurrences() throw() {} + + }; + + /** Class thrown when a required/mandatory option is missing */ + class BOOST_PROGRAM_OPTIONS_DECL required_option : public error_with_option_name { + public: + // option name is constructed by the option_descriptor and never on the fly + required_option(const std::string& option_name) + : error_with_option_name("the option '%canonical_option%' is required but missing", "", option_name) + { + } + + ~required_option() throw() {} + }; + + /** Base class of unparsable options, + * when the desired option cannot be identified. + * + * + * It makes no sense to have an option name, when we can't match an option to the + * parameter + * + * Having this a part of the error_with_option_name hierachy makes error handling + * a lot easier, even if the name indicates some sort of conceptual dissonance! + * + * */ + class BOOST_PROGRAM_OPTIONS_DECL error_with_no_option_name : public error_with_option_name { + public: + error_with_no_option_name(const std::string& template_, + const std::string& original_token = "") + : error_with_option_name(template_, "", original_token) + { + } + + /** Does NOT set option name, because no option name makes sense */ + virtual void set_option_name(const std::string& option_name){} + + ~error_with_no_option_name() throw() {} }; + /** Class thrown when option name is not recognized. */ - class BOOST_PROGRAM_OPTIONS_DECL unknown_option : public error { + class BOOST_PROGRAM_OPTIONS_DECL unknown_option : public error_with_no_option_name { public: - unknown_option(const std::string& name) - : error(std::string("unknown option ").append(name)), - m_option_name(name) - {} + unknown_option(const std::string& original_token = "") + : error_with_no_option_name("unrecognised option '%canonical_option%'", original_token) + { + } - // gcc says that throw specification on dtor is loosened - // without this line ~unknown_option() throw() {} - - const std::string& get_option_name() const throw(); - - private: - std::string m_option_name; }; + + /** Class thrown when there's ambiguity amoung several possible options. */ - class BOOST_PROGRAM_OPTIONS_DECL ambiguous_option : public error { + class BOOST_PROGRAM_OPTIONS_DECL ambiguous_option : public error_with_no_option_name { public: - ambiguous_option(const std::string& name, - const std::vector<std::string>& xalternatives) - : error(std::string("ambiguous option ").append(name)) - , m_alternatives(xalternatives) - , m_option_name(name) + ambiguous_option(const std::vector<std::string>& xalternatives) + : error_with_no_option_name("option '%canonical_option%' is ambiguous"), + m_alternatives(xalternatives) {} ~ambiguous_option() throw() {} - - const std::string& get_option_name() const throw(); - - const std::vector<std::string>& alternatives() const throw(); + const std::vector<std::string>& alternatives() const throw() {return m_alternatives;} + + protected: + /** Makes all substitutions using the template */ + virtual void substitute_placeholders(const std::string& error_template) const; private: // TODO: copy ctor might throw std::vector<std::string> m_alternatives; - std::string m_option_name; }; - /** Class thrown when there are several option values, but - user called a method which cannot return them all. */ - class BOOST_PROGRAM_OPTIONS_DECL multiple_values : public error { + + /** Class thrown when there's syntax error either for command + * line or config file options. See derived children for + * concrete classes. */ + class BOOST_PROGRAM_OPTIONS_DECL invalid_syntax : public error_with_option_name { public: - multiple_values() - : error("multiple values") - , m_option_name() {} - - ~multiple_values() throw() {} - - void set_option_name(const std::string& option); - - const std::string& get_option_name() const throw(); - - private: - std::string m_option_name; // The name of the option which - // caused the exception. + enum kind_t { + long_not_allowed = 30, + long_adjacent_not_allowed, + short_adjacent_not_allowed, + empty_adjacent_parameter, + missing_parameter, + extra_parameter, + unrecognized_line + }; + + invalid_syntax(kind_t kind, + const std::string& option_name = "", + const std::string& original_token = "", + int option_style = 0): + error_with_option_name(get_template(kind), option_name, original_token, option_style), + m_kind(kind) + { + } + + ~invalid_syntax() throw() {} + + kind_t kind() const {return m_kind;} + + /** Convenience functions for backwards compatibility */ + virtual std::string tokens() const {return get_option_name(); } + protected: + /** Used to convert kind_t to a related error text */ + std::string get_template(kind_t kind); + kind_t m_kind; }; - /** Class thrown when there are several occurrences of an - option, but user called a method which cannot return - them all. */ - class BOOST_PROGRAM_OPTIONS_DECL multiple_occurrences : public error { + class BOOST_PROGRAM_OPTIONS_DECL invalid_config_file_syntax : public invalid_syntax { public: - multiple_occurrences() - : error("multiple occurrences") - , m_option_name() {} - - ~multiple_occurrences() throw() {} - - void set_option_name(const std::string& option); - - const std::string& get_option_name() const throw(); + invalid_config_file_syntax(const std::string& invalid_line, kind_t kind): + invalid_syntax(kind) + { + m_substitutions["invalid_line"] = invalid_line; + } + + ~invalid_config_file_syntax() throw() {} + + /** Convenience functions for backwards compatibility */ + virtual std::string tokens() const {return m_substitutions.find("invalid_line")->second; } + }; + - private: - std::string m_option_name; // The name of the option which - // caused the exception. + /** Class thrown when there are syntax errors in given command line */ + class BOOST_PROGRAM_OPTIONS_DECL invalid_command_line_syntax : public invalid_syntax { + public: + invalid_command_line_syntax(kind_t kind, + const std::string& option_name = "", + const std::string& original_token = "", + int option_style = 0): + invalid_syntax(kind, option_name, original_token, option_style) {} + ~invalid_command_line_syntax() throw() {} }; + /** Class thrown when value of option is incorrect. */ - class BOOST_PROGRAM_OPTIONS_DECL validation_error : public error { + class BOOST_PROGRAM_OPTIONS_DECL validation_error : public error_with_option_name { public: enum kind_t { multiple_values_not_allowed = 30, @@ -150,32 +364,24 @@ namespace boost { namespace program_options { invalid_option }; + public: validation_error(kind_t kind, - const std::string& option_value = "", - const std::string& option_name = ""); - + const std::string& option_name = "", + const std::string& original_token = "", + int option_style = 0): + error_with_option_name(get_template(kind), option_name, original_token, option_style) + { + } + ~validation_error() throw() {} - void set_option_name(const std::string& option); - - const std::string& get_option_name() const throw(); - - const char* what() const throw(); - protected: /** Used to convert kind_t to a related error text */ - static std::string error_message(kind_t kind); - - private: + std::string get_template(kind_t kind); kind_t m_kind; - std::string m_option_name; // The name of the option which - // caused the exception. - std::string m_option_value; // Optional: value of the option m_options_name - mutable std::string m_message; // For on-demand formatting in 'what' - }; - /** Class thrown if there is an invalid option value givenn */ + /** Class thrown if there is an invalid option value given */ class BOOST_PROGRAM_OPTIONS_DECL invalid_option_value : public validation_error { @@ -186,54 +392,20 @@ namespace boost { namespace program_options { #endif }; - /** Class thrown when there are too many positional options. - This is a programming error. - */ - class BOOST_PROGRAM_OPTIONS_DECL too_many_positional_options_error : public error { + /** Class thrown if there is an invalid bool value given */ + class BOOST_PROGRAM_OPTIONS_DECL invalid_bool_value + : public validation_error + { public: - too_many_positional_options_error() - : error("too many positional options") - {} + invalid_bool_value(const std::string& value); }; - /** Class thrown when there are syntax errors in given command line */ - class BOOST_PROGRAM_OPTIONS_DECL invalid_command_line_syntax : public invalid_syntax { - public: - invalid_command_line_syntax(const std::string& tokens, kind_t kind); - }; - /** Class thrown when there are programming error related to style */ - class BOOST_PROGRAM_OPTIONS_DECL invalid_command_line_style : public error { - public: - invalid_command_line_style(const std::string& msg) - : error(msg) - {} - }; - /** Class thrown if config file can not be read */ - class BOOST_PROGRAM_OPTIONS_DECL reading_file : public error { - public: - reading_file(const char* filename) - : error(std::string("can not read file ").append(filename)) - {} - }; + + - /** Class thrown when a required/mandatory option is missing */ - class BOOST_PROGRAM_OPTIONS_DECL required_option : public error { - public: - required_option(const std::string& name) - : error(std::string("missing required option ").append(name)) - , m_option_name(name) - {} - - ~required_option() throw() {} - const std::string& get_option_name() const throw(); - - private: - std::string m_option_name; // The name of the option which - // caused the exception. - }; }} #if defined(BOOST_MSVC) diff --git a/3rdParty/Boost/src/boost/program_options/options_description.hpp b/3rdParty/Boost/src/boost/program_options/options_description.hpp index eff1f90..62530b2 100644 --- a/3rdParty/Boost/src/boost/program_options/options_description.hpp +++ b/3rdParty/Boost/src/boost/program_options/options_description.hpp @@ -102,6 +102,16 @@ namespace program_options { */ const std::string& key(const std::string& option) const; + + /** Returns the canonical name for the option description to enable the user to + recognised a matching option. + 1) For short options ('-', '/'), returns the short name prefixed. + 2) For long options ('--' / '-') returns the long name prefixed + 3) All other cases, returns the long name (if present) or the short name, + unprefixed. + */ + std::string canonical_display_name(int canonical_option_style = 0) const; + const std::string& long_name() const; /// Explanation of this option diff --git a/3rdParty/Boost/src/boost/program_options/parsers.hpp b/3rdParty/Boost/src/boost/program_options/parsers.hpp index c57b971..96f38f2 100644 --- a/3rdParty/Boost/src/boost/program_options/parsers.hpp +++ b/3rdParty/Boost/src/boost/program_options/parsers.hpp @@ -36,8 +36,8 @@ namespace boost { namespace program_options { template<class charT> class basic_parsed_options { public: - explicit basic_parsed_options(const options_description* xdescription) - : description(xdescription) {} + explicit basic_parsed_options(const options_description* xdescription, int options_prefix = 0) + : description(xdescription), m_options_prefix(options_prefix) {} /** Options found in the source. */ std::vector< basic_option<charT> > options; /** Options description that was used for parsing. @@ -46,6 +46,17 @@ namespace boost { namespace program_options { up to the caller. Can be NULL. */ const options_description* description; + + /** Mainly used for the diagnostic messages in exceptions. + * The canonical option prefix for the parser which generated these results, + * depending on the settings for basic_command_line_parser::style() or + * cmdline::style(). In order of precedence of command_line_style enums: + * allow_long + * allow_long_disguise + * allow_dash_for_short + * allow_slash_for_short + */ + int m_options_prefix; }; /** Specialization of basic_parsed_options which: @@ -64,6 +75,17 @@ namespace boost { namespace program_options { /** Stores UTF8 encoded options that were passed to constructor, to avoid reverse conversion in some cases. */ basic_parsed_options<char> utf8_encoded_options; + + /** Mainly used for the diagnostic messages in exceptions. + * The canonical option prefix for the parser which generated these results, + * depending on the settings for basic_command_line_parser::style() or + * cmdline::style(). In order of precedence of command_line_style enums: + * allow_long + * allow_long_disguise + * allow_dash_for_short + * allow_slash_for_short + */ + int m_options_prefix; }; typedef basic_parsed_options<char> parsed_options; @@ -260,6 +282,10 @@ namespace boost { namespace program_options { }} +#if defined(BOOST_MSVC) +# pragma warning (pop) +#endif + #undef DECL #include "boost/program_options/detail/parsers.hpp" diff --git a/3rdParty/Boost/src/boost/program_options/value_semantic.hpp b/3rdParty/Boost/src/boost/program_options/value_semantic.hpp index 033009e..081e997 100644 --- a/3rdParty/Boost/src/boost/program_options/value_semantic.hpp +++ b/3rdParty/Boost/src/boost/program_options/value_semantic.hpp @@ -227,6 +227,13 @@ namespace boost { namespace program_options { return this; } + /** Specifies the name used to to the value in help message. */ + typed_value* value_name(const std::string& name) + { + m_value_name = name; + return this; + } + /** Specifies an implicit value, which will be used if the option is given, but without an adjacent value. Using this implies that an explicit value is optional, but if @@ -261,13 +268,21 @@ namespace boost { namespace program_options { return this; } - /** Specifies that the value can span multiple tokens. */ + /** Specifies that the value can span multiple tokens. + */ typed_value* multitoken() { m_multitoken = true; return this; } + /** Specifies that no tokens may be provided as the value of + this option, which means that only presense of the option + is significant. For such option to be useful, either the + 'validate' function should be specialized, or the + 'implicit_value' method should be also used. In most + cases, you can use the 'bool_switch' function instead of + using this method. */ typed_value* zero_tokens() { m_zero_tokens = true; @@ -346,6 +361,7 @@ namespace boost { namespace program_options { // Default value is stored as boost::any and not // as boost::optional to avoid unnecessary instantiations. + std::string m_value_name; boost::any m_default_value; std::string m_default_value_as_text; boost::any m_implicit_value; diff --git a/3rdParty/Boost/src/boost/program_options/variables_map.hpp b/3rdParty/Boost/src/boost/program_options/variables_map.hpp index 9621e05..be0a4b6 100644 --- a/3rdParty/Boost/src/boost/program_options/variables_map.hpp +++ b/3rdParty/Boost/src/boost/program_options/variables_map.hpp @@ -153,6 +153,9 @@ namespace boost { namespace program_options { // Resolve conflict between inherited operators. const variable_value& operator[](const std::string& name) const { return abstract_variables_map::operator[](name); } + + // Override to clear some extra fields. + void clear(); void notify(); @@ -171,8 +174,10 @@ namespace boost { namespace program_options { bool utf8); /** Names of required options, filled by parser which has - access to options_description. */ - std::set<std::string> m_required; + access to options_description. + The map values are the "canonical" names for each corresponding option. + This is useful in creating diagnostic messages when the option is absent. */ + std::map<std::string, std::string> m_required; }; @@ -208,4 +213,8 @@ namespace boost { namespace program_options { }} +#if defined(BOOST_MSVC) +# pragma warning (pop) +#endif + #endif diff --git a/3rdParty/Boost/src/boost/random/detail/const_mod.hpp b/3rdParty/Boost/src/boost/random/detail/const_mod.hpp index e0a8839..9778f55 100644 --- a/3rdParty/Boost/src/boost/random/detail/const_mod.hpp +++ b/3rdParty/Boost/src/boost/random/detail/const_mod.hpp @@ -7,7 +7,7 @@ * * See http://www.boost.org for most recent version including documentation. * - * $Id: const_mod.hpp 58649 2010-01-02 21:23:17Z steven_watanabe $ + * $Id: const_mod.hpp 71018 2011-04-05 21:27:52Z steven_watanabe $ * * Revision history * 2001-02-18 moved to individual header files @@ -16,113 +16,101 @@ #ifndef BOOST_RANDOM_CONST_MOD_HPP #define BOOST_RANDOM_CONST_MOD_HPP -#include <cassert> +#include <boost/assert.hpp> #include <boost/static_assert.hpp> -#include <boost/cstdint.hpp> #include <boost/integer_traits.hpp> -#include <boost/detail/workaround.hpp> +#include <boost/type_traits/make_unsigned.hpp> +#include <boost/random/detail/large_arithmetic.hpp> #include <boost/random/detail/disable_warnings.hpp> namespace boost { namespace random { -/* - * Some random number generators require modular arithmetic. Put - * everything we need here. - * IntType must be an integral type. - */ - -namespace detail { - - template<bool is_signed> - struct do_add - { }; - - template<> - struct do_add<true> - { - template<class IntType> - static IntType add(IntType m, IntType x, IntType c) - { - if (x < m - c) - return x + c; - else - return x - (m-c); - } - }; - - template<> - struct do_add<false> - { - template<class IntType> - static IntType add(IntType, IntType, IntType) - { - // difficult - assert(!"const_mod::add with c too large"); - return 0; - } - }; -} // namespace detail - -#if !(defined(__BORLANDC__) && (__BORLANDC__ == 0x560)) - template<class IntType, IntType m> class const_mod { public: + static IntType apply(IntType x) + { + if(((unsigned_m() - 1) & unsigned_m()) == 0) + return (unsigned_type(x)) & (unsigned_m() - 1); + else { + IntType supress_warnings = (m == 0); + BOOST_ASSERT(supress_warnings == 0); + return x % (m + supress_warnings); + } + } + static IntType add(IntType x, IntType c) { - if(c == 0) + if(((unsigned_m() - 1) & unsigned_m()) == 0) + return (unsigned_type(x) + unsigned_type(c)) & (unsigned_m() - 1); + else if(c == 0) return x; - else if(c <= traits::const_max - m) // i.e. m+c < max - return add_small(x, c); + else if(x < m - c) + return x + c; else - return detail::do_add<traits::is_signed>::add(m, x, c); + return x - (m - c); } static IntType mult(IntType a, IntType x) { - if(a == 1) + if(((unsigned_m() - 1) & unsigned_m()) == 0) + return unsigned_type(a) * unsigned_type(x) & (unsigned_m() - 1); + else if(a == 0) + return 0; + else if(a == 1) return x; else if(m <= traits::const_max/a) // i.e. a*m <= max return mult_small(a, x); else if(traits::is_signed && (m%a < m/a)) return mult_schrage(a, x); - else { - // difficult - assert(!"const_mod::mult with a too large"); - return 0; - } + else + return mult_general(a, x); } static IntType mult_add(IntType a, IntType x, IntType c) { - if(m <= (traits::const_max-c)/a) // i.e. a*m+c <= max - return (a*x+c) % m; - else + if(((unsigned_m() - 1) & unsigned_m()) == 0) + return (unsigned_type(a) * unsigned_type(x) + unsigned_type(c)) & (unsigned_m() - 1); + else if(a == 0) + return c; + else if(m <= (traits::const_max-c)/a) { // i.e. a*m+c <= max + IntType supress_warnings = (m == 0); + BOOST_ASSERT(supress_warnings == 0); + return (a*x+c) % (m + supress_warnings); + } else return add(mult(a, x), c); } + static IntType pow(IntType a, boost::uintmax_t exponent) + { + IntType result = 1; + while(exponent != 0) { + if(exponent % 2 == 1) { + result = mult(result, a); + } + a = mult(a, a); + exponent /= 2; + } + return result; + } + static IntType invert(IntType x) - { return x == 0 ? 0 : invert_euclidian(x); } + { return x == 0 ? 0 : (m == 0? invert_euclidian0(x) : invert_euclidian(x)); } private: typedef integer_traits<IntType> traits; + typedef typename make_unsigned<IntType>::type unsigned_type; const_mod(); // don't instantiate - static IntType add_small(IntType x, IntType c) - { - x += c; - if(x >= m) - x -= m; - return x; - } - static IntType mult_small(IntType a, IntType x) { - return a*x % m; + IntType supress_warnings = (m == 0); + BOOST_ASSERT(supress_warnings == 0); + return a*x % (m + supress_warnings); } static IntType mult_schrage(IntType a, IntType value) @@ -130,231 +118,96 @@ private: const IntType q = m / a; const IntType r = m % a; - assert(r < q); // check that overflow cannot happen + BOOST_ASSERT(r < q); // check that overflow cannot happen - value = a*(value%q) - r*(value/q); - // An optimizer bug in the SGI MIPSpro 7.3.1.x compiler requires this - // convoluted formulation of the loop (Synge Todo) - for(;;) { - if (value > 0) - break; - value += m; + return sub(a*(value%q), r*(value/q)); + } + + static IntType mult_general(IntType a, IntType b) + { + IntType suppress_warnings = (m == 0); + BOOST_ASSERT(suppress_warnings == 0); + IntType modulus = m + suppress_warnings; + BOOST_ASSERT(modulus == m); + if(::boost::uintmax_t(modulus) <= + (::std::numeric_limits< ::boost::uintmax_t>::max)() / modulus) + { + return static_cast<IntType>(boost::uintmax_t(a) * b % modulus); + } else { + return static_cast<IntType>(detail::mulmod(a, b, modulus)); } - return value; + } + + static IntType sub(IntType a, IntType b) + { + if(a < b) + return m - (b - a); + else + return a - b; + } + + static unsigned_type unsigned_m() + { + if(m == 0) { + return unsigned_type((std::numeric_limits<IntType>::max)()) + 1; + } else { + return unsigned_type(m); + } } // invert c in the finite field (mod m) (m must be prime) static IntType invert_euclidian(IntType c) { // we are interested in the gcd factor for c, because this is our inverse - BOOST_STATIC_ASSERT(m > 0); -#if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3003)) - assert(boost::integer_traits<IntType>::is_signed); -#elif !defined(BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS) - BOOST_STATIC_ASSERT(boost::integer_traits<IntType>::is_signed); -#endif - assert(c > 0); + BOOST_ASSERT(c > 0); IntType l1 = 0; IntType l2 = 1; IntType n = c; IntType p = m; for(;;) { IntType q = p / n; - l1 -= q * l2; // this requires a signed IntType! + l1 += q * l2; p -= q * n; if(p == 0) - return (l2 < 1 ? l2 + m : l2); + return l2; IntType q2 = n / p; - l2 -= q2 * l1; + l2 += q2 * l1; n -= q2 * p; if(n == 0) - return (l1 < 1 ? l1 + m : l1); + return m - l1; } } -}; - -// The modulus is exactly the word size: rely on machine overflow handling. -// Due to a GCC bug, we cannot partially specialize in the presence of -// template value parameters. -template<> -class const_mod<unsigned int, 0> -{ - typedef unsigned int IntType; -public: - static IntType add(IntType x, IntType c) { return x+c; } - static IntType mult(IntType a, IntType x) { return a*x; } - static IntType mult_add(IntType a, IntType x, IntType c) { return a*x+c; } - - // m is not prime, thus invert is not useful -private: // don't instantiate - const_mod(); -}; - -template<> -class const_mod<unsigned long, 0> -{ - typedef unsigned long IntType; -public: - static IntType add(IntType x, IntType c) { return x+c; } - static IntType mult(IntType a, IntType x) { return a*x; } - static IntType mult_add(IntType a, IntType x, IntType c) { return a*x+c; } - - // m is not prime, thus invert is not useful -private: // don't instantiate - const_mod(); -}; - -// the modulus is some power of 2: rely partly on machine overflow handling -// we only specialize for rand48 at the moment -#ifndef BOOST_NO_INT64_T -template<> -class const_mod<uint64_t, uint64_t(1) << 48> -{ - typedef uint64_t IntType; -public: - static IntType add(IntType x, IntType c) { return c == 0 ? x : mod(x+c); } - static IntType mult(IntType a, IntType x) { return mod(a*x); } - static IntType mult_add(IntType a, IntType x, IntType c) - { return mod(a*x+c); } - static IntType mod(IntType x) { return x &= ((uint64_t(1) << 48)-1); } - - // m is not prime, thus invert is not useful -private: // don't instantiate - const_mod(); -}; -#endif /* !BOOST_NO_INT64_T */ - -#else - -// -// for some reason Borland C++ Builder 6 has problems with -// the full specialisations of const_mod, define a generic version -// instead, the compiler will optimise away the const-if statements: -// -template<class IntType, IntType m> -class const_mod -{ -public: - static IntType add(IntType x, IntType c) - { - if(0 == m) - { - return x+c; - } - else - { - if(c == 0) - return x; - else if(c <= traits::const_max - m) // i.e. m+c < max - return add_small(x, c); - else - return detail::do_add<traits::is_signed>::add(m, x, c); - } - } - - static IntType mult(IntType a, IntType x) - { - if(x == 0) - { - return a*x; - } - else - { - if(a == 1) - return x; - else if(m <= traits::const_max/a) // i.e. a*m <= max - return mult_small(a, x); - else if(traits::is_signed && (m%a < m/a)) - return mult_schrage(a, x); - else { - // difficult - assert(!"const_mod::mult with a too large"); - return 0; - } - } - } - - static IntType mult_add(IntType a, IntType x, IntType c) - { - if(m == 0) - { - return a*x+c; - } - else - { - if(m <= (traits::const_max-c)/a) // i.e. a*m+c <= max - return (a*x+c) % m; - else - return add(mult(a, x), c); - } - } - - static IntType invert(IntType x) - { return x == 0 ? 0 : invert_euclidian(x); } - -private: - typedef integer_traits<IntType> traits; - - const_mod(); // don't instantiate - - static IntType add_small(IntType x, IntType c) - { - x += c; - if(x >= m) - x -= m; - return x; - } - - static IntType mult_small(IntType a, IntType x) - { - return a*x % m; - } - - static IntType mult_schrage(IntType a, IntType value) - { - const IntType q = m / a; - const IntType r = m % a; - - assert(r < q); // check that overflow cannot happen - - value = a*(value%q) - r*(value/q); - while(value <= 0) - value += m; - return value; - } - - // invert c in the finite field (mod m) (m must be prime) - static IntType invert_euclidian(IntType c) + // invert c in the finite field (mod m) (c must be relatively prime to m) + static IntType invert_euclidian0(IntType c) { // we are interested in the gcd factor for c, because this is our inverse - BOOST_STATIC_ASSERT(m > 0); -#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS - BOOST_STATIC_ASSERT(boost::integer_traits<IntType>::is_signed); -#endif - assert(c > 0); + BOOST_ASSERT(c > 0); + if(c == 1) return 1; IntType l1 = 0; IntType l2 = 1; IntType n = c; IntType p = m; + IntType max = (std::numeric_limits<IntType>::max)(); + IntType q = max / n; + BOOST_ASSERT(max % n != n - 1 && "c must be relatively prime to m."); + l1 += q * l2; + p = max - q * n + 1; for(;;) { - IntType q = p / n; - l1 -= q * l2; // this requires a signed IntType! - p -= q * n; if(p == 0) - return (l2 < 1 ? l2 + m : l2); + return l2; IntType q2 = n / p; - l2 -= q2 * l1; + l2 += q2 * l1; n -= q2 * p; if(n == 0) - return (l1 < 1 ? l1 + m : l1); + return m - l1; + q = p / n; + l1 += q * l2; + p -= q * n; } } }; - -#endif - } // namespace random } // namespace boost diff --git a/3rdParty/Boost/src/boost/random/detail/generator_bits.hpp b/3rdParty/Boost/src/boost/random/detail/generator_bits.hpp new file mode 100644 index 0000000..44b4248 --- /dev/null +++ b/3rdParty/Boost/src/boost/random/detail/generator_bits.hpp @@ -0,0 +1,36 @@ +/* boost random/detail/generator_bits.hpp header file + * + * Copyright Steven Watanabe 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) + * + * See http://www.boost.org for most recent version including documentation. + * + * $Id: generator_bits.hpp 72951 2011-07-07 04:57:37Z steven_watanabe $ + * + */ + +#ifndef BOOST_RANDOM_DETAIL_GENERATOR_BITS_HPP +#define BOOST_RANDOM_DETAIL_GENERATOR_BITS_HPP + +#include <boost/limits.hpp> + +namespace boost { +namespace random { +namespace detail { + +// This is a temporary measure that retains backwards +// compatibility. +template<class URNG> +struct generator_bits { + static std::size_t value() { + return std::numeric_limits<typename URNG::result_type>::digits; + } +}; + +} // namespace detail +} // namespace random +} // namespace boost + +#endif // BOOST_RANDOM_DETAIL_GENERATOR_BITS_HPP diff --git a/3rdParty/Boost/src/boost/random/detail/generator_seed_seq.hpp b/3rdParty/Boost/src/boost/random/detail/generator_seed_seq.hpp new file mode 100644 index 0000000..6aaf98f --- /dev/null +++ b/3rdParty/Boost/src/boost/random/detail/generator_seed_seq.hpp @@ -0,0 +1,40 @@ +/* boost random/mersenne_twister.hpp header file + * + * Copyright Jens Maurer 2000-2001 + * Copyright Steven Watanabe 2010 + * 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) + * + * See http://www.boost.org for most recent version including documentation. + * + * $Id: generator_seed_seq.hpp 71018 2011-04-05 21:27:52Z steven_watanabe $ + * + */ + +#ifndef BOOST_RANDOM_DETAIL_GENERATOR_SEED_SEQ_HPP_INCLUDED +#define BOOST_RANDOM_DETAIL_GENERATOR_SEED_SEQ_HPP_INCLUDED + +namespace boost { +namespace random { +namespace detail { + +template<class Generator> +class generator_seed_seq { +public: + generator_seed_seq(Generator& g) : gen(&g) {} + template<class It> + void generate(It first, It last) { + for(; first != last; ++first) { + *first = (*gen)(); + } + } +private: + Generator* gen; +}; + +} +} +} + +#endif diff --git a/3rdParty/Boost/src/boost/random/detail/integer_log2.hpp b/3rdParty/Boost/src/boost/random/detail/integer_log2.hpp new file mode 100644 index 0000000..baee426 --- /dev/null +++ b/3rdParty/Boost/src/boost/random/detail/integer_log2.hpp @@ -0,0 +1,84 @@ +/* boost random/detail/integer_log2.hpp header file + * + * Copyright Steven Watanabe 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) + * + * See http://www.boost.org for most recent version including documentation. + * + * $Id: integer_log2.hpp 76145 2011-12-24 19:05:17Z danieljames $ + * + */ + +#ifndef BOOST_RANDOM_DETAIL_INTEGER_LOG2_HPP +#define BOOST_RANDOM_DETAIL_INTEGER_LOG2_HPP + +#include <boost/config.hpp> +#include <boost/limits.hpp> +#include <boost/pending/integer_log2.hpp> + +namespace boost { +namespace random { +namespace detail { + +#if !defined(BOOST_NO_CONSTEXPR) +#define BOOST_RANDOM_DETAIL_CONSTEXPR constexpr +#elif defined(BOOST_MSVC) +#define BOOST_RANDOM_DETAIL_CONSTEXPR __forceinline +#elif defined(__GNUC__) && __GNUC__ >= 4 +#define BOOST_RANDOM_DETAIL_CONSTEXPR __attribute__((const)) __attribute__((always_inline)) +#else +#define BOOST_RANDOM_DETAIL_CONSTEXPR inline +#endif + +template<int Shift> +struct integer_log2_impl +{ +#if defined(BOOST_NO_CONSTEXPR) + template<class T> + BOOST_RANDOM_DETAIL_CONSTEXPR static int apply(T t, int accum) + { + int update = ((t >> Shift) != 0) * Shift; + return integer_log2_impl<Shift / 2>::apply(t >> update, accum + update); + } +#else + template<class T> + BOOST_RANDOM_DETAIL_CONSTEXPR static int apply2(T t, int accum, int update) + { + return integer_log2_impl<Shift / 2>::apply(t >> update, accum + update); + } + + template<class T> + BOOST_RANDOM_DETAIL_CONSTEXPR static int apply(T t, int accum) + { + return apply2(t, accum, ((t >> Shift) != 0) * Shift); + } +#endif +}; + +template<> +struct integer_log2_impl<1> +{ + template<class T> + BOOST_RANDOM_DETAIL_CONSTEXPR static int apply(T t, int accum) + { + return int(t >> 1) + accum; + } +}; + +template<class T> +BOOST_RANDOM_DETAIL_CONSTEXPR int integer_log2(T t) +{ + return integer_log2_impl< + ::boost::detail::max_pow2_less< + ::std::numeric_limits<T>::digits, 4 + >::value + >::apply(t, 0); +} + +} // namespace detail +} // namespace random +} // namespace boost + +#endif // BOOST_RANDOM_DETAIL_INTEGER_LOG2_HPP diff --git a/3rdParty/Boost/src/boost/random/detail/large_arithmetic.hpp b/3rdParty/Boost/src/boost/random/detail/large_arithmetic.hpp new file mode 100644 index 0000000..24177dc --- /dev/null +++ b/3rdParty/Boost/src/boost/random/detail/large_arithmetic.hpp @@ -0,0 +1,122 @@ +/* boost random/detail/large_arithmetic.hpp header file + * + * Copyright Steven Watanabe 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) + * + * See http://www.boost.org for most recent version including documentation. + * + * $Id: large_arithmetic.hpp 71018 2011-04-05 21:27:52Z steven_watanabe $ + */ + +#ifndef BOOST_RANDOM_DETAIL_LARGE_ARITHMETIC_HPP +#define BOOST_RANDOM_DETAIL_LARGE_ARITHMETIC_HPP + +#include <boost/cstdint.hpp> +#include <boost/integer.hpp> +#include <boost/limits.hpp> +#include <boost/random/detail/integer_log2.hpp> + +#include <boost/random/detail/disable_warnings.hpp> + +namespace boost { +namespace random { +namespace detail { + +struct div_t { + boost::uintmax_t quotient; + boost::uintmax_t remainder; +}; + +inline div_t muldivmod(boost::uintmax_t a, boost::uintmax_t b, boost::uintmax_t m) +{ + static const int bits = + ::std::numeric_limits< ::boost::uintmax_t>::digits / 2; + static const ::boost::uintmax_t mask = (::boost::uintmax_t(1) << bits) - 1; + typedef ::boost::uint_t<bits>::fast digit_t; + + int shift = std::numeric_limits< ::boost::uintmax_t>::digits - 1 + - detail::integer_log2(m); + + a <<= shift; + m <<= shift; + + digit_t product[4] = { 0, 0, 0, 0 }; + digit_t a_[2] = { digit_t(a & mask), digit_t((a >> bits) & mask) }; + digit_t b_[2] = { digit_t(b & mask), digit_t((b >> bits) & mask) }; + digit_t m_[2] = { digit_t(m & mask), digit_t((m >> bits) & mask) }; + + // multiply a * b + for(int i = 0; i < 2; ++i) { + digit_t carry = 0; + for(int j = 0; j < 2; ++j) { + ::boost::uint64_t temp = ::boost::uintmax_t(a_[i]) * b_[j] + + carry + product[i + j]; + product[i + j] = digit_t(temp & mask); + carry = digit_t(temp >> bits); + } + if(carry != 0) { + product[i + 2] += carry; + } + } + + digit_t quotient[2]; + + if(m == 0) { + div_t result = { + ((::boost::uintmax_t(product[3]) << bits) | product[2]), + ((::boost::uintmax_t(product[1]) << bits) | product[0]) >> shift, + }; + return result; + } + + // divide product / m + for(int i = 3; i >= 2; --i) { + ::boost::uintmax_t temp = + ::boost::uintmax_t(product[i]) << bits | product[i - 1]; + + digit_t q = digit_t((product[i] == m_[1]) ? mask : temp / m_[1]); + + ::boost::uintmax_t rem = + ((temp - ::boost::uintmax_t(q) * m_[1]) << bits) + product[i - 2]; + + ::boost::uintmax_t diff = m_[0] * ::boost::uintmax_t(q); + + int error = 0; + if(diff > rem) { + if(diff - rem > m) { + error = 2; + } else { + error = 1; + } + } + q -= error; + rem = rem + error * m - diff; + + quotient[i - 2] = q; + product[i] = 0; + product[i-1] = (rem >> bits) & mask; + product[i-2] = rem & mask; + } + + div_t result = { + ((::boost::uintmax_t(quotient[1]) << bits) | quotient[0]), + ((::boost::uintmax_t(product[1]) << bits) | product[0]) >> shift, + }; + return result; +} + +inline boost::uintmax_t muldiv(boost::uintmax_t a, boost::uintmax_t b, boost::uintmax_t m) +{ return detail::muldivmod(a, b, m).quotient; } + +inline boost::uintmax_t mulmod(boost::uintmax_t a, boost::uintmax_t b, boost::uintmax_t m) +{ return detail::muldivmod(a, b, m).remainder; } + +} // namespace detail +} // namespace random +} // namespace boost + +#include <boost/random/detail/enable_warnings.hpp> + +#endif // BOOST_RANDOM_DETAIL_LARGE_ARITHMETIC_HPP diff --git a/3rdParty/Boost/src/boost/random/detail/operators.hpp b/3rdParty/Boost/src/boost/random/detail/operators.hpp new file mode 100644 index 0000000..f27839a --- /dev/null +++ b/3rdParty/Boost/src/boost/random/detail/operators.hpp @@ -0,0 +1,84 @@ +/* boost random/detail/operators.hpp header file + * + * Copyright Steven Watanabe 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) + * + * See http://www.boost.org for most recent version including documentation. + * + * $Id: operators.hpp 71018 2011-04-05 21:27:52Z steven_watanabe $ + */ + +#ifndef BOOST_RANDOM_DETAIL_OPERATORS_HPP +#define BOOST_RANDOM_DETAIL_OPERATORS_HPP + +#include <boost/random/detail/config.hpp> +#include <boost/detail/workaround.hpp> + +#if BOOST_WORKAROUND(BOOST_MSVC, <= 1310) \ + || BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x5100)) + +#define BOOST_RANDOM_DETAIL_OSTREAM_OPERATOR(os, T, t) \ + template<class CharT, class Traits> \ + friend std::basic_ostream<CharT,Traits>& \ + operator<<(std::basic_ostream<CharT,Traits>& os, const T& t) { \ + t.print(os, t); \ + return os; \ + } \ + template<class CharT, class Traits> \ + static std::basic_ostream<CharT,Traits>& \ + print(std::basic_ostream<CharT,Traits>& os, const T& t) + +#define BOOST_RANDOM_DETAIL_ISTREAM_OPERATOR(is, T, t) \ + template<class CharT, class Traits> \ + friend std::basic_istream<CharT,Traits>& \ + operator>>(std::basic_istream<CharT,Traits>& is, T& t) { \ + t.read(is, t); \ + return is; \ + } \ + template<class CharT, class Traits> \ + static std::basic_istream<CharT,Traits>& \ + read(std::basic_istream<CharT,Traits>& is, T& t) + +#endif + +#if defined(__BORLANDC__) + +#define BOOST_RANDOM_DETAIL_EQUALITY_OPERATOR(T, lhs, rhs) \ + bool operator==(const T& rhs) const \ + { return T::is_equal(*this, rhs); } \ + static bool is_equal(const T& lhs, const T& rhs) + +#define BOOST_RANDOM_DETAIL_INEQUALITY_OPERATOR(T) \ + bool operator!=(const T& rhs) const \ + { return !T::is_equal(*this, rhs); } + +#endif + +#ifndef BOOST_RANDOM_DETAIL_OSTREAM_OPERATOR +#define BOOST_RANDOM_DETAIL_OSTREAM_OPERATOR(os, T, t) \ + template<class CharT, class Traits> \ + friend std::basic_ostream<CharT,Traits>& \ + operator<<(std::basic_ostream<CharT,Traits>& os, const T& t) +#endif + +#ifndef BOOST_RANDOM_DETAIL_ISTREAM_OPERATOR +#define BOOST_RANDOM_DETAIL_ISTREAM_OPERATOR(is, T, t) \ + template<class CharT, class Traits> \ + friend std::basic_istream<CharT,Traits>& \ + operator>>(std::basic_istream<CharT,Traits>& is, T& t) +#endif + +#ifndef BOOST_RANDOM_DETAIL_EQUALITY_OPERATOR +#define BOOST_RANDOM_DETAIL_EQUALITY_OPERATOR(T, lhs, rhs) \ + friend bool operator==(const T& lhs, const T& rhs) +#endif + +#ifndef BOOST_RANDOM_DETAIL_INEQUALITY_OPERATOR +#define BOOST_RANDOM_DETAIL_INEQUALITY_OPERATOR(T) \ + friend bool operator!=(const T& lhs, const T& rhs) \ + { return !(lhs == rhs); } +#endif + +#endif diff --git a/3rdParty/Boost/src/boost/random/detail/pass_through_engine.hpp b/3rdParty/Boost/src/boost/random/detail/pass_through_engine.hpp deleted file mode 100644 index 468427c..0000000 --- a/3rdParty/Boost/src/boost/random/detail/pass_through_engine.hpp +++ /dev/null @@ -1,100 +0,0 @@ -/* boost random/detail/uniform_int_float.hpp header file - * - * Copyright Jens Maurer 2000-2001 - * 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) - * - * See http://www.boost.org for most recent version including documentation. - * - * $Id: pass_through_engine.hpp 58649 2010-01-02 21:23:17Z steven_watanabe $ - * - */ - -#ifndef BOOST_RANDOM_DETAIL_PASS_THROUGH_ENGINE_HPP -#define BOOST_RANDOM_DETAIL_PASS_THROUGH_ENGINE_HPP - -#include <boost/config.hpp> -#include <boost/random/detail/ptr_helper.hpp> -#include <boost/random/detail/disable_warnings.hpp> - -namespace boost { -namespace random { -namespace detail { - -template<class UniformRandomNumberGenerator> -class pass_through_engine -{ -private: - typedef ptr_helper<UniformRandomNumberGenerator> helper_type; - -public: - typedef typename helper_type::value_type base_type; - typedef typename base_type::result_type result_type; - - explicit pass_through_engine(UniformRandomNumberGenerator rng) - // make argument an rvalue to avoid matching Generator& constructor - : _rng(static_cast<typename helper_type::rvalue_type>(rng)) - { } - - result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return (base().min)(); } - result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return (base().max)(); } - base_type& base() { return helper_type::ref(_rng); } - const base_type& base() const { return helper_type::ref(_rng); } - - result_type operator()() { return base()(); } - -private: - UniformRandomNumberGenerator _rng; -}; - -#ifndef BOOST_NO_STD_LOCALE - -template<class UniformRandomNumberGenerator, class CharT, class Traits> -std::basic_ostream<CharT,Traits>& -operator<<( - std::basic_ostream<CharT,Traits>& os - , const pass_through_engine<UniformRandomNumberGenerator>& ud - ) -{ - return os << ud.base(); -} - -template<class UniformRandomNumberGenerator, class CharT, class Traits> -std::basic_istream<CharT,Traits>& -operator>>( - std::basic_istream<CharT,Traits>& is - , const pass_through_engine<UniformRandomNumberGenerator>& ud - ) -{ - return is >> ud.base(); -} - -#else // no new streams - -template<class UniformRandomNumberGenerator> -inline std::ostream& -operator<<(std::ostream& os, - const pass_through_engine<UniformRandomNumberGenerator>& ud) -{ - return os << ud.base(); -} - -template<class UniformRandomNumberGenerator> -inline std::istream& -operator>>(std::istream& is, - const pass_through_engine<UniformRandomNumberGenerator>& ud) -{ - return is >> ud.base(); -} - -#endif - -} // namespace detail -} // namespace random -} // namespace boost - -#include <boost/random/detail/enable_warnings.hpp> - -#endif // BOOST_RANDOM_DETAIL_PASS_THROUGH_ENGINE_HPP - diff --git a/3rdParty/Boost/src/boost/random/detail/seed.hpp b/3rdParty/Boost/src/boost/random/detail/seed.hpp index 48cc17e..979db29 100644 --- a/3rdParty/Boost/src/boost/random/detail/seed.hpp +++ b/3rdParty/Boost/src/boost/random/detail/seed.hpp @@ -7,7 +7,7 @@ * * See http://www.boost.org for most recent version including documentation. * - * $Id: seed.hpp 60755 2010-03-22 00:45:06Z steven_watanabe $ + * $Id: seed.hpp 71018 2011-04-05 21:27:52Z steven_watanabe $ */ #ifndef BOOST_RANDOM_DETAIL_SEED_HPP @@ -43,12 +43,19 @@ struct disable_constructor<Engine, Engine> {}; template<class Generator> \ void seed(Generator& gen, typename ::boost::random::detail::disable_seed<Generator>::type* = 0) +#define BOOST_RANDOM_DETAIL_SEED_SEQ_CONSTRUCTOR(Self, SeedSeq, seq) \ + template<class SeedSeq> \ + explicit Self(SeedSeq& seq, typename ::boost::random::detail::disable_constructor<Self, SeedSeq>::type* = 0) + +#define BOOST_RANDOM_DETAIL_SEED_SEQ_SEED(Self, SeedSeq, seq) \ + template<class SeedSeq> \ + void seed(SeedSeq& seq, typename ::boost::random::detail::disable_seed<SeedSeq>::type* = 0) + #define BOOST_RANDOM_DETAIL_ARITHMETIC_CONSTRUCTOR(Self, T, x) \ explicit Self(const T& x) #define BOOST_RANDOM_DETAIL_ARITHMETIC_SEED(Self, T, x) \ void seed(const T& x) - } } } @@ -76,6 +83,24 @@ struct disable_constructor<Engine, Engine> {}; template<class Generator>\ void boost_random_seed_impl(Generator& gen, ::boost::mpl::false_) +#define BOOST_RANDOM_DETAIL_SEED_SEQ_CONSTRUCTOR(Self, SeedSeq, seq) \ + Self(Self& other) { *this = other; } \ + Self(const Self& other) { *this = other; } \ + template<class SeedSeq> \ + explicit Self(SeedSeq& seq) { \ + boost_random_constructor_impl(seq, ::boost::is_arithmetic<SeedSeq>());\ + } \ + template<class SeedSeq> \ + void boost_random_constructor_impl(SeedSeq& seq, ::boost::mpl::false_) + +#define BOOST_RANDOM_DETAIL_SEED_SEQ_SEED(Self, SeedSeq, seq) \ + template<class SeedSeq> \ + void seed(SeedSeq& seq) { \ + boost_random_seed_impl(seq, ::boost::is_arithmetic<SeedSeq>()); \ + } \ + template<class SeedSeq> \ + void boost_random_seed_impl(SeedSeq& seq, ::boost::mpl::false_) + #define BOOST_RANDOM_DETAIL_ARITHMETIC_CONSTRUCTOR(Self, T, x) \ explicit Self(const T& x) { boost_random_constructor_impl(x, ::boost::mpl::true_()); }\ void boost_random_constructor_impl(const T& x, ::boost::mpl::true_) diff --git a/3rdParty/Boost/src/boost/random/detail/seed_impl.hpp b/3rdParty/Boost/src/boost/random/detail/seed_impl.hpp new file mode 100644 index 0000000..e044d45 --- /dev/null +++ b/3rdParty/Boost/src/boost/random/detail/seed_impl.hpp @@ -0,0 +1,397 @@ +/* boost random/detail/seed.hpp header file + * + * Copyright Steven Watanabe 2009 + * 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) + * + * See http://www.boost.org for most recent version including documentation. + * + * $Id: seed_impl.hpp 72951 2011-07-07 04:57:37Z steven_watanabe $ + */ + +#ifndef BOOST_RANDOM_DETAIL_SEED_IMPL_HPP +#define BOOST_RANDOM_DETAIL_SEED_IMPL_HPP + +#include <stdexcept> +#include <boost/cstdint.hpp> +#include <boost/config/no_tr1/cmath.hpp> +#include <boost/integer/integer_mask.hpp> +#include <boost/integer/static_log2.hpp> +#include <boost/type_traits/is_signed.hpp> +#include <boost/type_traits/is_integral.hpp> +#include <boost/type_traits/make_unsigned.hpp> +#include <boost/mpl/bool.hpp> +#include <boost/mpl/if.hpp> +#include <boost/mpl/int.hpp> +#include <boost/random/detail/const_mod.hpp> +#include <boost/random/detail/integer_log2.hpp> +#include <boost/random/detail/signed_unsigned_tools.hpp> +#include <boost/random/detail/generator_bits.hpp> + +#include <boost/random/detail/disable_warnings.hpp> + +namespace boost { +namespace random { +namespace detail { + +// finds the seed type of an engine, given its +// result_type. If the result_type is integral +// the seed type is the same. If the result_type +// is floating point, the seed type is uint32_t +template<class T> +struct seed_type +{ + typedef typename boost::mpl::if_<boost::is_integral<T>, + T, + boost::uint32_t + >::type type; +}; + +template<int N> +struct const_pow_impl +{ + template<class T> + static T call(T arg, int n, T result) + { + return const_pow_impl<N / 2>::call(arg * arg, n / 2, + n%2 == 0? result : result * arg); + } +}; + +template<> +struct const_pow_impl<0> +{ + template<class T> + static T call(T, int, T result) + { + return result; + } +}; + +// requires N is an upper bound on n +template<int N, class T> +inline T const_pow(T arg, int n) { return const_pow_impl<N>::call(arg, n, T(1)); } + +template<class T> +inline T pow2(int n) +{ + typedef unsigned int_type; + const int max_bits = std::numeric_limits<int_type>::digits; + T multiplier = T(int_type(1) << (max_bits - 1)) * 2; + return (int_type(1) << (n % max_bits)) * + const_pow<std::numeric_limits<T>::digits / max_bits>(multiplier, n / max_bits); +} + +template<class Engine, class Iter> +void generate_from_real(Engine& eng, Iter begin, Iter end) +{ + using std::fmod; + typedef typename Engine::result_type RealType; + const int Bits = detail::generator_bits<Engine>::value(); + int remaining_bits = 0; + boost::uint_least32_t saved_bits = 0; + RealType multiplier = pow2<RealType>( Bits); + RealType mult32 = RealType(4294967296.0); // 2^32 + while(true) { + RealType val = eng() * multiplier; + int available_bits = Bits; + // Make sure the compiler can optimize this out + // if it isn't possible. + if(Bits < 32 && available_bits < 32 - remaining_bits) { + saved_bits |= boost::uint_least32_t(val) << remaining_bits; + remaining_bits += Bits; + } else { + // If Bits < 32, then remaining_bits != 0, since + // if remaining_bits == 0, available_bits < 32 - 0, + // and we won't get here to begin with. + if(Bits < 32 || remaining_bits != 0) { + boost::uint_least32_t divisor = + (boost::uint_least32_t(1) << (32 - remaining_bits)); + boost::uint_least32_t extra_bits = boost::uint_least32_t(fmod(val, mult32)) & (divisor - 1); + val = val / divisor; + *begin++ = saved_bits | (extra_bits << remaining_bits); + if(begin == end) return; + available_bits -= 32 - remaining_bits; + remaining_bits = 0; + } + // If Bits < 32 we should never enter this loop + if(Bits >= 32) { + for(; available_bits >= 32; available_bits -= 32) { + boost::uint_least32_t word = boost::uint_least32_t(fmod(val, mult32)); + val /= mult32; + *begin++ = word; + if(begin == end) return; + } + } + remaining_bits = available_bits; + saved_bits = static_cast<boost::uint_least32_t>(val); + } + } +} + +template<class Engine, class Iter> +void generate_from_int(Engine& eng, Iter begin, Iter end) +{ + typedef typename Engine::result_type IntType; + typedef typename boost::make_unsigned<IntType>::type unsigned_type; + int remaining_bits = 0; + boost::uint_least32_t saved_bits = 0; + unsigned_type range = boost::random::detail::subtract<IntType>()((eng.max)(), (eng.min)()); + + int bits = + (range == (std::numeric_limits<unsigned_type>::max)()) ? + std::numeric_limits<unsigned_type>::digits : + detail::integer_log2(range + 1); + + { + int discarded_bits = detail::integer_log2(bits); + unsigned_type excess = (range + 1) >> (bits - discarded_bits); + if(excess != 0) { + int extra_bits = detail::integer_log2((excess - 1) ^ excess); + bits = bits - discarded_bits + extra_bits; + } + } + + unsigned_type mask = (static_cast<unsigned_type>(2) << (bits - 1)) - 1; + unsigned_type limit = ((range + 1) & ~mask) - 1; + + while(true) { + unsigned_type val; + do { + val = boost::random::detail::subtract<IntType>()(eng(), (eng.min)()); + } while(limit != range && val > limit); + val &= mask; + int available_bits = bits; + if(available_bits == 32) { + *begin++ = static_cast<boost::uint_least32_t>(val) & 0xFFFFFFFFu; + if(begin == end) return; + } else if(available_bits % 32 == 0) { + for(int i = 0; i < available_bits / 32; ++i) { + boost::uint_least32_t word = boost::uint_least32_t(val) & 0xFFFFFFFFu; + int supress_warning = (bits >= 32); + BOOST_ASSERT(supress_warning == 1); + val >>= (32 * supress_warning); + *begin++ = word; + if(begin == end) return; + } + } else if(bits < 32 && available_bits < 32 - remaining_bits) { + saved_bits |= boost::uint_least32_t(val) << remaining_bits; + remaining_bits += bits; + } else { + if(bits < 32 || remaining_bits != 0) { + boost::uint_least32_t extra_bits = boost::uint_least32_t(val) & ((boost::uint_least32_t(1) << (32 - remaining_bits)) - 1); + val >>= 32 - remaining_bits; + *begin++ = saved_bits | (extra_bits << remaining_bits); + if(begin == end) return; + available_bits -= 32 - remaining_bits; + remaining_bits = 0; + } + if(bits >= 32) { + for(; available_bits >= 32; available_bits -= 32) { + boost::uint_least32_t word = boost::uint_least32_t(val) & 0xFFFFFFFFu; + int supress_warning = (bits >= 32); + BOOST_ASSERT(supress_warning == 1); + val >>= (32 * supress_warning); + *begin++ = word; + if(begin == end) return; + } + } + remaining_bits = available_bits; + saved_bits = static_cast<boost::uint_least32_t>(val); + } + } +} + +template<class Engine, class Iter> +void generate_impl(Engine& eng, Iter first, Iter last, boost::mpl::true_) +{ + return detail::generate_from_int(eng, first, last); +} + +template<class Engine, class Iter> +void generate_impl(Engine& eng, Iter first, Iter last, boost::mpl::false_) +{ + return detail::generate_from_real(eng, first, last); +} + +template<class Engine, class Iter> +void generate(Engine& eng, Iter first, Iter last) +{ + return detail::generate_impl(eng, first, last, boost::is_integral<typename Engine::result_type>()); +} + + + +template<class IntType, IntType m, class SeedSeq> +IntType seed_one_int(SeedSeq& seq) +{ + static const int log = ::boost::mpl::if_c<(m == 0), + ::boost::mpl::int_<(::std::numeric_limits<IntType>::digits)>, + ::boost::static_log2<m> >::type::value; + static const int k = + (log + ((~(static_cast<IntType>(2) << (log - 1)) & m)? 32 : 31)) / 32; + ::boost::uint_least32_t array[log / 32 + 4]; + seq.generate(&array[0], &array[0] + k + 3); + IntType s = 0; + for(int j = 0; j < k; ++j) { + IntType digit = const_mod<IntType, m>::apply(IntType(array[j+3])); + IntType mult = IntType(1) << 32*j; + s = const_mod<IntType, m>::mult_add(mult, digit, s); + } + return s; +} + +template<class IntType, IntType m, class Iter> +IntType get_one_int(Iter& first, Iter last) +{ + static const int log = ::boost::mpl::if_c<(m == 0), + ::boost::mpl::int_<(::std::numeric_limits<IntType>::digits)>, + ::boost::static_log2<m> >::type::value; + static const int k = + (log + ((~(static_cast<IntType>(2) << (log - 1)) & m)? 32 : 31)) / 32; + IntType s = 0; + for(int j = 0; j < k; ++j) { + if(first == last) { + throw ::std::invalid_argument("Not enough elements in call to seed."); + } + IntType digit = const_mod<IntType, m>::apply(IntType(*first++)); + IntType mult = IntType(1) << 32*j; + s = const_mod<IntType, m>::mult_add(mult, digit, s); + } + return s; +} + +// TODO: work in-place whenever possible +template<int w, std::size_t n, class SeedSeq, class UIntType> +void seed_array_int_impl(SeedSeq& seq, UIntType (&x)[n]) +{ + boost::uint_least32_t storage[((w+31)/32) * n]; + seq.generate(&storage[0], &storage[0] + ((w+31)/32) * n); + for(std::size_t j = 0; j < n; j++) { + UIntType val = 0; + for(std::size_t k = 0; k < (w+31)/32; ++k) { + val += static_cast<UIntType>(storage[(w+31)/32*j + k]) << 32*k; + } + x[j] = val & ::boost::low_bits_mask_t<w>::sig_bits; + } +} + +template<int w, std::size_t n, class SeedSeq, class IntType> +inline void seed_array_int_impl(SeedSeq& seq, IntType (&x)[n], boost::mpl::true_) +{ + typedef typename boost::make_unsigned<IntType>::type unsigned_array[n]; + seed_array_int_impl<w>(seq, reinterpret_cast<unsigned_array&>(x)); +} + +template<int w, std::size_t n, class SeedSeq, class IntType> +inline void seed_array_int_impl(SeedSeq& seq, IntType (&x)[n], boost::mpl::false_) +{ + seed_array_int_impl<w>(seq, x); +} + +template<int w, std::size_t n, class SeedSeq, class IntType> +inline void seed_array_int(SeedSeq& seq, IntType (&x)[n]) +{ + seed_array_int_impl<w>(seq, x, boost::is_signed<IntType>()); +} + +template<int w, std::size_t n, class Iter, class UIntType> +void fill_array_int_impl(Iter& first, Iter last, UIntType (&x)[n]) +{ + for(std::size_t j = 0; j < n; j++) { + UIntType val = 0; + for(std::size_t k = 0; k < (w+31)/32; ++k) { + if(first == last) { + throw std::invalid_argument("Not enough elements in call to seed."); + } + val += static_cast<UIntType>(*first++) << 32*k; + } + x[j] = val & ::boost::low_bits_mask_t<w>::sig_bits; + } +} + +template<int w, std::size_t n, class Iter, class IntType> +inline void fill_array_int_impl(Iter& first, Iter last, IntType (&x)[n], boost::mpl::true_) +{ + typedef typename boost::make_unsigned<IntType>::type unsigned_array[n]; + fill_array_int_impl<w>(first, last, reinterpret_cast<unsigned_array&>(x)); +} + +template<int w, std::size_t n, class Iter, class IntType> +inline void fill_array_int_impl(Iter& first, Iter last, IntType (&x)[n], boost::mpl::false_) +{ + fill_array_int_impl<w>(first, last, x); +} + +template<int w, std::size_t n, class Iter, class IntType> +inline void fill_array_int(Iter& first, Iter last, IntType (&x)[n]) +{ + fill_array_int_impl<w>(first, last, x, boost::is_signed<IntType>()); +} + +template<int w, std::size_t n, class RealType> +void seed_array_real_impl(const boost::uint_least32_t* storage, RealType (&x)[n]) +{ + boost::uint_least32_t mask = ~((~boost::uint_least32_t(0)) << (w%32)); + RealType two32 = 4294967296.0; + const RealType divisor = RealType(1)/detail::pow2<RealType>(w); + unsigned int j; + for(j = 0; j < n; ++j) { + RealType val = RealType(0); + RealType mult = divisor; + for(int k = 0; k < w/32; ++k) { + val += *storage++ * mult; + mult *= two32; + } + if(mask != 0) { + val += (*storage++ & mask) * mult; + } + BOOST_ASSERT(val >= 0); + BOOST_ASSERT(val < 1); + x[j] = val; + } +} + +template<int w, std::size_t n, class SeedSeq, class RealType> +void seed_array_real(SeedSeq& seq, RealType (&x)[n]) +{ + using std::pow; + boost::uint_least32_t storage[((w+31)/32) * n]; + seq.generate(&storage[0], &storage[0] + ((w+31)/32) * n); + seed_array_real_impl<w>(storage, x); +} + +template<int w, std::size_t n, class Iter, class RealType> +void fill_array_real(Iter& first, Iter last, RealType (&x)[n]) +{ + boost::uint_least32_t mask = ~((~boost::uint_least32_t(0)) << (w%32)); + RealType two32 = 4294967296.0; + const RealType divisor = RealType(1)/detail::pow2<RealType>(w); + unsigned int j; + for(j = 0; j < n; ++j) { + RealType val = RealType(0); + RealType mult = divisor; + for(int k = 0; k < w/32; ++k, ++first) { + if(first == last) throw std::invalid_argument("Not enough elements in call to seed."); + val += *first * mult; + mult *= two32; + } + if(mask != 0) { + if(first == last) throw std::invalid_argument("Not enough elements in call to seed."); + val += (*first & mask) * mult; + ++first; + } + BOOST_ASSERT(val >= 0); + BOOST_ASSERT(val < 1); + x[j] = val; + } +} + +} +} +} + +#include <boost/random/detail/enable_warnings.hpp> + +#endif diff --git a/3rdParty/Boost/src/boost/random/detail/signed_unsigned_tools.hpp b/3rdParty/Boost/src/boost/random/detail/signed_unsigned_tools.hpp index 3c81cf4..988cfb8 100644 --- a/3rdParty/Boost/src/boost/random/detail/signed_unsigned_tools.hpp +++ b/3rdParty/Boost/src/boost/random/detail/signed_unsigned_tools.hpp @@ -73,7 +73,7 @@ struct add<T1, T2, /* signed */ true> if (y >= 0) return T2(x) + y; // y < 0 - if (x >= T1(-(y+1))) // result >= 0 after subtraction + if (x > T1(-(y+1))) // result >= 0 after subtraction // avoid the nasty two's complement edge case for y == min() return T2(x - T1(-(y+1)) - 1); // abs(x) < abs(y), thus T2 able to represent x diff --git a/3rdParty/Boost/src/boost/random/detail/uniform_int_float.hpp b/3rdParty/Boost/src/boost/random/detail/uniform_int_float.hpp index 4607021..ef20915 100644 --- a/3rdParty/Boost/src/boost/random/detail/uniform_int_float.hpp +++ b/3rdParty/Boost/src/boost/random/detail/uniform_int_float.hpp @@ -1,85 +1,76 @@ /* boost random/detail/uniform_int_float.hpp header file * * Copyright Jens Maurer 2000-2001 + * Copyright Steven Watanabe 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) * * See http://www.boost.org for most recent version including documentation. * - * $Id: uniform_int_float.hpp 52492 2009-04-19 14:55:57Z steven_watanabe $ + * $Id: uniform_int_float.hpp 72951 2011-07-07 04:57:37Z steven_watanabe $ * */ #ifndef BOOST_RANDOM_DETAIL_UNIFORM_INT_FLOAT_HPP #define BOOST_RANDOM_DETAIL_UNIFORM_INT_FLOAT_HPP +#include <boost/limits.hpp> #include <boost/config.hpp> +#include <boost/integer.hpp> #include <boost/random/detail/config.hpp> -#include <boost/random/uniform_01.hpp> +#include <boost/random/detail/generator_bits.hpp> +#include <boost/random/detail/disable_warnings.hpp> namespace boost { namespace random { namespace detail { -template<class UniformRandomNumberGenerator, class IntType = unsigned long> +template<class URNG> class uniform_int_float { public: - typedef UniformRandomNumberGenerator base_type; - typedef IntType result_type; + typedef URNG base_type; + typedef typename base_type::result_type base_result; - uniform_int_float(base_type rng, IntType min_arg = 0, IntType max_arg = 0xffffffff) - : _rng(rng), _min(min_arg), _max(max_arg) - { - init(); - } + typedef typename boost::uint_t< + (std::numeric_limits<boost::uintmax_t>::digits < + std::numeric_limits<base_result>::digits)? + std::numeric_limits<boost::uintmax_t>::digits : + std::numeric_limits<base_result>::digits + >::fast result_type; - result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return _min; } - result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return _max; } - base_type& base() { return _rng.base(); } - const base_type& base() const { return _rng.base(); } + uniform_int_float(base_type& rng) + : _rng(rng) {} - result_type operator()() - { - return static_cast<IntType>(_rng() * _range) + _min; - } + static result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () + { return 0; } + static result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () + { + std::size_t digits = std::numeric_limits<result_type>::digits; + if(detail::generator_bits<URNG>::value() < digits) { + digits = detail::generator_bits<URNG>::value(); + } + return (result_type(2) << (digits - 1)) - 1; + } + base_type& base() { return _rng; } + const base_type& base() const { return _rng; } -#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS - template<class CharT, class Traits> - friend std::basic_ostream<CharT,Traits>& - operator<<(std::basic_ostream<CharT,Traits>& os, const uniform_int_float& ud) - { - os << ud._min << " " << ud._max; - return os; - } - - template<class CharT, class Traits> - friend std::basic_istream<CharT,Traits>& - operator>>(std::basic_istream<CharT,Traits>& is, uniform_int_float& ud) - { - is >> std::ws >> ud._min >> std::ws >> ud._max; - ud.init(); - return is; - } -#endif + result_type operator()() + { + base_result range = static_cast<base_result>((max)())+1; + return static_cast<result_type>(_rng() * range); + } private: - void init() - { - _range = static_cast<base_result>(_max-_min)+1; - } - - typedef typename base_type::result_type base_result; - uniform_01<base_type> _rng; - result_type _min, _max; - base_result _range; + base_type& _rng; }; - } // namespace detail } // namespace random } // namespace boost +#include <boost/random/detail/enable_warnings.hpp> + #endif // BOOST_RANDOM_DETAIL_UNIFORM_INT_FLOAT_HPP diff --git a/3rdParty/Boost/src/boost/random/linear_congruential.hpp b/3rdParty/Boost/src/boost/random/linear_congruential.hpp deleted file mode 100644 index 351b9c1..0000000 --- a/3rdParty/Boost/src/boost/random/linear_congruential.hpp +++ /dev/null @@ -1,403 +0,0 @@ -/* boost random/linear_congruential.hpp header file - * - * Copyright Jens Maurer 2000-2001 - * 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) - * - * See http://www.boost.org for most recent version including documentation. - * - * $Id: linear_congruential.hpp 60755 2010-03-22 00:45:06Z steven_watanabe $ - * - * Revision history - * 2001-02-18 moved to individual header files - */ - -#ifndef BOOST_RANDOM_LINEAR_CONGRUENTIAL_HPP -#define BOOST_RANDOM_LINEAR_CONGRUENTIAL_HPP - -#include <iostream> -#include <cassert> -#include <stdexcept> -#include <boost/config.hpp> -#include <boost/limits.hpp> -#include <boost/static_assert.hpp> -#include <boost/random/detail/config.hpp> -#include <boost/random/detail/const_mod.hpp> -#include <boost/detail/workaround.hpp> - -#include <boost/random/detail/disable_warnings.hpp> - -namespace boost { -namespace random { - -/** - * Instantiations of class template linear_congruential model a - * \pseudo_random_number_generator. Linear congruential pseudo-random - * number generators are described in: - * - * "Mathematical methods in large-scale computing units", D. H. Lehmer, - * Proc. 2nd Symposium on Large-Scale Digital Calculating Machines, - * Harvard University Press, 1951, pp. 141-146 - * - * Let x(n) denote the sequence of numbers returned by some pseudo-random - * number generator. Then for the linear congruential generator, - * x(n+1) := (a * x(n) + c) mod m. Parameters for the generator are - * x(0), a, c, m. The template parameter IntType shall denote an integral - * type. It must be large enough to hold values a, c, and m. The template - * parameters a and c must be smaller than m. - * - * Note: The quality of the generator crucially depends on the choice of - * the parameters. User code should use one of the sensibly parameterized - * generators such as minstd_rand instead. - */ -template<class IntType, IntType a, IntType c, IntType m, IntType val> -class linear_congruential -{ -public: - typedef IntType result_type; -#ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION - static const bool has_fixed_range = true; - static const result_type min_value = ( c == 0 ? 1 : 0 ); - static const result_type max_value = m-1; -#else - BOOST_STATIC_CONSTANT(bool, has_fixed_range = false); -#endif - BOOST_STATIC_CONSTANT(IntType, multiplier = a); - BOOST_STATIC_CONSTANT(IntType, increment = c); - BOOST_STATIC_CONSTANT(IntType, modulus = m); - - // MSVC 6 and possibly others crash when encountering complicated integral - // constant expressions. Avoid the check for now. - // BOOST_STATIC_ASSERT(m == 0 || a < m); - // BOOST_STATIC_ASSERT(m == 0 || c < m); - - /** - * Constructs a linear_congruential generator, seeding it with @c x0. - */ - explicit linear_congruential(IntType x0 = 1) - { - seed(x0); - - // MSVC fails BOOST_STATIC_ASSERT with std::numeric_limits at class scope -#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS - BOOST_STATIC_ASSERT(std::numeric_limits<IntType>::is_integer); -#endif - } - - /** - * Constructs a @c linear_congruential generator and seeds it - * with values taken from the itrator range [first, last) - * and adjusts first to point to the element after the last one - * used. If there are not enough elements, throws @c std::invalid_argument. - * - * first and last must be input iterators. - */ - template<class It> - linear_congruential(It& first, It last) - { - seed(first, last); - } - - // compiler-generated copy constructor and assignment operator are fine - - /** - * If c mod m is zero and x0 mod m is zero, changes the current value of - * the generator to 1. Otherwise, changes it to x0 mod m. If c is zero, - * distinct seeds in the range [1,m) will leave the generator in distinct - * states. If c is not zero, the range is [0,m). - */ - void seed(IntType x0 = 1) - { - // wrap _x if it doesn't fit in the destination - if(modulus == 0) { - _x = x0; - } else { - _x = x0 % modulus; - } - // handle negative seeds - if(_x <= 0 && _x != 0) { - _x += modulus; - } - // adjust to the correct range - if(increment == 0 && _x == 0) { - _x = 1; - } - assert(_x >= (min)()); - assert(_x <= (max)()); - } - - /** - * seeds a @c linear_congruential generator with values taken - * from the itrator range [first, last) and adjusts @c first to - * point to the element after the last one used. If there are - * not enough elements, throws @c std::invalid_argument. - * - * @c first and @c last must be input iterators. - */ - template<class It> - void seed(It& first, It last) - { - if(first == last) - throw std::invalid_argument("linear_congruential::seed"); - seed(*first++); - } - - /** - * Returns the smallest value that the @c linear_congruential generator - * can produce. - */ - result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return c == 0 ? 1 : 0; } - /** - * Returns the largest value that the @c linear_congruential generator - * can produce. - */ - result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return modulus-1; } - - /** Returns the next value of the @c linear_congruential generator. */ - IntType operator()() - { - _x = const_mod<IntType, m>::mult_add(a, _x, c); - return _x; - } - - static bool validation(IntType x) { return val == x; } - -#ifdef BOOST_NO_OPERATORS_IN_NAMESPACE - - // Use a member function; Streamable concept not supported. - bool operator==(const linear_congruential& rhs) const - { return _x == rhs._x; } - bool operator!=(const linear_congruential& rhs) const - { return !(*this == rhs); } - -#else - friend bool operator==(const linear_congruential& x, - const linear_congruential& y) - { return x._x == y._x; } - friend bool operator!=(const linear_congruential& x, - const linear_congruential& y) - { return !(x == y); } - -#if !defined(BOOST_RANDOM_NO_STREAM_OPERATORS) && !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) - template<class CharT, class Traits> - friend std::basic_ostream<CharT,Traits>& - operator<<(std::basic_ostream<CharT,Traits>& os, - const linear_congruential& lcg) - { - return os << lcg._x; - } - - template<class CharT, class Traits> - friend std::basic_istream<CharT,Traits>& - operator>>(std::basic_istream<CharT,Traits>& is, - linear_congruential& lcg) - { - return is >> lcg._x; - } - -private: -#endif -#endif - - IntType _x; -}; - -// probably needs the "no native streams" caveat for STLPort -#if !defined(__SGI_STL_PORT) && BOOST_WORKAROUND(__GNUC__, == 2) -template<class IntType, IntType a, IntType c, IntType m, IntType val> -std::ostream& -operator<<(std::ostream& os, - const linear_congruential<IntType,a,c,m,val>& lcg) -{ - return os << lcg._x; -} - -template<class IntType, IntType a, IntType c, IntType m, IntType val> -std::istream& -operator>>(std::istream& is, - linear_congruential<IntType,a,c,m,val>& lcg) -{ - return is >> lcg._x; -} -#elif defined(BOOST_RANDOM_NO_STREAM_OPERATORS) || BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) -template<class CharT, class Traits, class IntType, IntType a, IntType c, IntType m, IntType val> -std::basic_ostream<CharT,Traits>& -operator<<(std::basic_ostream<CharT,Traits>& os, - const linear_congruential<IntType,a,c,m,val>& lcg) -{ - return os << lcg._x; -} - -template<class CharT, class Traits, class IntType, IntType a, IntType c, IntType m, IntType val> -std::basic_istream<CharT,Traits>& -operator>>(std::basic_istream<CharT,Traits>& is, - linear_congruential<IntType,a,c,m,val>& lcg) -{ - return is >> lcg._x; -} -#endif - -#ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION -// A definition is required even for integral static constants -template<class IntType, IntType a, IntType c, IntType m, IntType val> -const bool linear_congruential<IntType, a, c, m, val>::has_fixed_range; -template<class IntType, IntType a, IntType c, IntType m, IntType val> -const typename linear_congruential<IntType, a, c, m, val>::result_type linear_congruential<IntType, a, c, m, val>::min_value; -template<class IntType, IntType a, IntType c, IntType m, IntType val> -const typename linear_congruential<IntType, a, c, m, val>::result_type linear_congruential<IntType, a, c, m, val>::max_value; -template<class IntType, IntType a, IntType c, IntType m, IntType val> -const IntType linear_congruential<IntType,a,c,m,val>::modulus; -#endif - -} // namespace random - -// validation values from the publications -/** - * The specialization \minstd_rand0 was originally suggested in - * - * @blockquote - * A pseudo-random number generator for the System/360, P.A. Lewis, - * A.S. Goodman, J.M. Miller, IBM Systems Journal, Vol. 8, No. 2, - * 1969, pp. 136-146 - * @endblockquote - * - * It is examined more closely together with \minstd_rand in - * - * @blockquote - * "Random Number Generators: Good ones are hard to find", - * Stephen K. Park and Keith W. Miller, Communications of - * the ACM, Vol. 31, No. 10, October 1988, pp. 1192-1201 - * @endblockquote - */ -typedef random::linear_congruential<int32_t, 16807, 0, 2147483647, - 1043618065> minstd_rand0; - -/** The specialization \minstd_rand was suggested in - * - * @blockquote - * "Random Number Generators: Good ones are hard to find", - * Stephen K. Park and Keith W. Miller, Communications of - * the ACM, Vol. 31, No. 10, October 1988, pp. 1192-1201 - * @endblockquote - */ -typedef random::linear_congruential<int32_t, 48271, 0, 2147483647, - 399268537> minstd_rand; - - -#if !defined(BOOST_NO_INT64_T) && !defined(BOOST_NO_INTEGRAL_INT64_T) -/** Class @c rand48 models a \pseudo_random_number_generator. It uses - * the linear congruential algorithm with the parameters a = 0x5DEECE66D, - * c = 0xB, m = 2**48. It delivers identical results to the @c lrand48() - * function available on some systems (assuming lcong48 has not been called). - * - * It is only available on systems where @c uint64_t is provided as an - * integral type, so that for example static in-class constants and/or - * enum definitions with large @c uint64_t numbers work. - */ -class rand48 -{ -public: - typedef int32_t result_type; -#ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION - static const bool has_fixed_range = true; - static const int32_t min_value = 0; - static const int32_t max_value = integer_traits<int32_t>::const_max; -#else - enum { has_fixed_range = false }; -#endif - /** - * Returns the smallest value that the generator can produce - */ - int32_t min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return 0; } - /** - * Returns the largest value that the generator can produce - */ - int32_t max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return std::numeric_limits<int32_t>::max BOOST_PREVENT_MACRO_SUBSTITUTION (); } - -#ifdef BOOST_RANDOM_DOXYGEN - /** - * If T is an integral type smaller than int46_t, constructs - * a \rand48 generator with x(0) := (x0 << 16) | 0x330e. Otherwise - * constructs a \rand48 generator with x(0) = x0. - */ - template<class T> explicit rand48(T x0 = 1); -#else - rand48() : lcf(cnv(static_cast<int32_t>(1))) {} - template<class T> explicit rand48(T x0) : lcf(cnv(x0)) { } -#endif - template<class It> rand48(It& first, It last) : lcf(first, last) { } - - // compiler-generated copy ctor and assignment operator are fine - -#ifdef BOOST_RANDOM_DOXYGEN - /** - * If T is an integral type smaller than int46_t, changes - * the current value x(n) of the generator to (x0 << 16) | 0x330e. - * Otherwise changes the current value x(n) to x0. - */ - template<class T> void seed(T x0 = 1); -#else - void seed() { seed(static_cast<int32_t>(1)); } - template<class T> void seed(T x0) { lcf.seed(cnv(x0)); } -#endif - template<class It> void seed(It& first, It last) { lcf.seed(first,last); } - - /** - * Returns the next value of the generator. - */ - int32_t operator()() { return static_cast<int32_t>(lcf() >> 17); } - // by experiment from lrand48() - static bool validation(int32_t x) { return x == 1993516219; } - -#ifndef BOOST_NO_OPERATORS_IN_NAMESPACE - -#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS - template<class CharT,class Traits> - friend std::basic_ostream<CharT,Traits>& - operator<<(std::basic_ostream<CharT,Traits>& os, const rand48& r) - { os << r.lcf; return os; } - - template<class CharT,class Traits> - friend std::basic_istream<CharT,Traits>& - operator>>(std::basic_istream<CharT,Traits>& is, rand48& r) - { is >> r.lcf; return is; } -#endif - - friend bool operator==(const rand48& x, const rand48& y) - { return x.lcf == y.lcf; } - friend bool operator!=(const rand48& x, const rand48& y) - { return !(x == y); } -#else - // Use a member function; Streamable concept not supported. - bool operator==(const rand48& rhs) const - { return lcf == rhs.lcf; } - bool operator!=(const rand48& rhs) const - { return !(*this == rhs); } -#endif -private: - /// \cond hide_private_members - random::linear_congruential<uint64_t, - uint64_t(0xDEECE66DUL) | (uint64_t(0x5) << 32), // xxxxULL is not portable - 0xB, uint64_t(1)<<48, /* unknown */ 0> lcf; - template<class T> - static uint64_t cnv(T x) - { - if(sizeof(T) < sizeof(uint64_t)) { - return (static_cast<uint64_t>(x) << 16) | 0x330e; - } else { - return(static_cast<uint64_t>(x)); - } - } - static uint64_t cnv(float x) { return(static_cast<uint64_t>(x)); } - static uint64_t cnv(double x) { return(static_cast<uint64_t>(x)); } - static uint64_t cnv(long double x) { return(static_cast<uint64_t>(x)); } - /// \endcond -}; -#endif /* !BOOST_NO_INT64_T && !BOOST_NO_INTEGRAL_INT64_T */ - -} // namespace boost - -#include <boost/random/detail/enable_warnings.hpp> - -#endif // BOOST_RANDOM_LINEAR_CONGRUENTIAL_HPP diff --git a/3rdParty/Boost/src/boost/random/mersenne_twister.hpp b/3rdParty/Boost/src/boost/random/mersenne_twister.hpp index fa80aa6..be60389 100644 --- a/3rdParty/Boost/src/boost/random/mersenne_twister.hpp +++ b/3rdParty/Boost/src/boost/random/mersenne_twister.hpp @@ -1,13 +1,14 @@ /* boost random/mersenne_twister.hpp header file * * Copyright Jens Maurer 2000-2001 + * Copyright Steven Watanabe 2010 * 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) * * See http://www.boost.org for most recent version including documentation. * - * $Id: mersenne_twister.hpp 60755 2010-03-22 00:45:06Z steven_watanabe $ + * $Id: mersenne_twister.hpp 74867 2011-10-09 23:13:31Z steven_watanabe $ * * Revision history * 2001-02-18 moved to individual header files @@ -16,25 +17,23 @@ #ifndef BOOST_RANDOM_MERSENNE_TWISTER_HPP #define BOOST_RANDOM_MERSENNE_TWISTER_HPP -#include <iostream> -#include <algorithm> // std::copy +#include <iosfwd> +#include <istream> #include <stdexcept> #include <boost/config.hpp> -#include <boost/limits.hpp> -#include <boost/static_assert.hpp> -#include <boost/integer_traits.hpp> #include <boost/cstdint.hpp> -#include <boost/random/linear_congruential.hpp> -#include <boost/detail/workaround.hpp> +#include <boost/integer/integer_mask.hpp> #include <boost/random/detail/config.hpp> #include <boost/random/detail/ptr_helper.hpp> #include <boost/random/detail/seed.hpp> +#include <boost/random/detail/seed_impl.hpp> +#include <boost/random/detail/generator_seed_seq.hpp> namespace boost { namespace random { /** - * Instantiations of class template mersenne_twister model a + * Instantiations of class template mersenne_twister_engine model a * \pseudo_random_number_generator. It uses the algorithm described in * * @blockquote @@ -61,277 +60,406 @@ namespace random { * its state array. For example, \mt11213b requires about 1408 bytes and * \mt19937 requires about 2496 bytes. */ -template<class UIntType, int w, int n, int m, int r, UIntType a, int u, - int s, UIntType b, int t, UIntType c, int l, UIntType val> -class mersenne_twister +template<class UIntType, + std::size_t w, std::size_t n, std::size_t m, std::size_t r, + UIntType a, std::size_t u, UIntType d, std::size_t s, + UIntType b, std::size_t t, + UIntType c, std::size_t l, UIntType f> +class mersenne_twister_engine { public: - typedef UIntType result_type; - BOOST_STATIC_CONSTANT(int, word_size = w); - BOOST_STATIC_CONSTANT(int, state_size = n); - BOOST_STATIC_CONSTANT(int, shift_size = m); - BOOST_STATIC_CONSTANT(int, mask_bits = r); - BOOST_STATIC_CONSTANT(UIntType, parameter_a = a); - BOOST_STATIC_CONSTANT(int, output_u = u); - BOOST_STATIC_CONSTANT(int, output_s = s); - BOOST_STATIC_CONSTANT(UIntType, output_b = b); - BOOST_STATIC_CONSTANT(int, output_t = t); - BOOST_STATIC_CONSTANT(UIntType, output_c = c); - BOOST_STATIC_CONSTANT(int, output_l = l); - - BOOST_STATIC_CONSTANT(bool, has_fixed_range = false); + typedef UIntType result_type; + BOOST_STATIC_CONSTANT(std::size_t, word_size = w); + BOOST_STATIC_CONSTANT(std::size_t, state_size = n); + BOOST_STATIC_CONSTANT(std::size_t, shift_size = m); + BOOST_STATIC_CONSTANT(std::size_t, mask_bits = r); + BOOST_STATIC_CONSTANT(UIntType, xor_mask = a); + BOOST_STATIC_CONSTANT(std::size_t, tempering_u = u); + BOOST_STATIC_CONSTANT(UIntType, tempering_d = d); + BOOST_STATIC_CONSTANT(std::size_t, tempering_s = s); + BOOST_STATIC_CONSTANT(UIntType, tempering_b = b); + BOOST_STATIC_CONSTANT(std::size_t, tempering_t = t); + BOOST_STATIC_CONSTANT(UIntType, tempering_c = c); + BOOST_STATIC_CONSTANT(std::size_t, tempering_l = l); + BOOST_STATIC_CONSTANT(UIntType, initialization_multiplier = f); + BOOST_STATIC_CONSTANT(UIntType, default_seed = 5489u); - /** - * Constructs a @c mersenne_twister and calls @c seed(). - */ - mersenne_twister() { seed(); } - - /** - * Constructs a @c mersenne_twister and calls @c seed(value). - */ - BOOST_RANDOM_DETAIL_ARITHMETIC_CONSTRUCTOR(mersenne_twister, UIntType, value) - { seed(value); } - template<class It> mersenne_twister(It& first, It last) { seed(first,last); } - - /** - * Constructs a mersenne_twister and calls @c seed(gen). - * - * @xmlnote - * The copy constructor will always be preferred over - * the templated constructor. - * @endxmlnote - */ - BOOST_RANDOM_DETAIL_GENERATOR_CONSTRUCTOR(mersenne_twister, Generator, gen) - { seed(gen); } - - // compiler-generated copy ctor and assignment operator are fine - - /** Calls @c seed(result_type(5489)). */ - void seed() { seed(UIntType(5489)); } - - /** - * Sets the state x(0) to v mod 2w. Then, iteratively, - * sets x(i) to (i + 1812433253 * (x(i-1) xor (x(i-1) rshift w-2))) mod 2<sup>w</sup> - * for i = 1 .. n-1. x(n) is the first value to be returned by operator(). - */ - BOOST_RANDOM_DETAIL_ARITHMETIC_SEED(mersenne_twister, UIntType, value) - { - // New seeding algorithm from - // http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/MT2002/emt19937ar.html - // In the previous versions, MSBs of the seed affected only MSBs of the - // state x[]. - const UIntType mask = ~0u; - x[0] = value & mask; - for (i = 1; i < n; i++) { - // See Knuth "The Art of Computer Programming" Vol. 2, 3rd ed., page 106 - x[i] = (1812433253UL * (x[i-1] ^ (x[i-1] >> (w-2))) + i) & mask; + // backwards compatibility + BOOST_STATIC_CONSTANT(UIntType, parameter_a = a); + BOOST_STATIC_CONSTANT(std::size_t, output_u = u); + BOOST_STATIC_CONSTANT(std::size_t, output_s = s); + BOOST_STATIC_CONSTANT(UIntType, output_b = b); + BOOST_STATIC_CONSTANT(std::size_t, output_t = t); + BOOST_STATIC_CONSTANT(UIntType, output_c = c); + BOOST_STATIC_CONSTANT(std::size_t, output_l = l); + + // old Boost.Random concept requirements + BOOST_STATIC_CONSTANT(bool, has_fixed_range = false); + + + /** + * Constructs a @c mersenne_twister_engine and calls @c seed(). + */ + mersenne_twister_engine() { seed(); } + + /** + * Constructs a @c mersenne_twister_engine and calls @c seed(value). + */ + BOOST_RANDOM_DETAIL_ARITHMETIC_CONSTRUCTOR(mersenne_twister_engine, + UIntType, value) + { seed(value); } + template<class It> mersenne_twister_engine(It& first, It last) + { seed(first,last); } + + /** + * Constructs a mersenne_twister_engine and calls @c seed(gen). + * + * @xmlnote + * The copy constructor will always be preferred over + * the templated constructor. + * @endxmlnote + */ + BOOST_RANDOM_DETAIL_SEED_SEQ_CONSTRUCTOR(mersenne_twister_engine, + SeedSeq, seq) + { seed(seq); } + + // compiler-generated copy ctor and assignment operator are fine + + /** Calls @c seed(default_seed). */ + void seed() { seed(default_seed); } + + /** + * Sets the state x(0) to v mod 2w. Then, iteratively, + * sets x(i) to + * (i + f * (x(i-1) xor (x(i-1) rshift w-2))) mod 2<sup>w</sup> + * for i = 1 .. n-1. x(n) is the first value to be returned by operator(). + */ + BOOST_RANDOM_DETAIL_ARITHMETIC_SEED(mersenne_twister_engine, UIntType, value) + { + // New seeding algorithm from + // http://www.math.sci.hiroshima-u.ac.jp/~m-mat/MT/MT2002/emt19937ar.html + // In the previous versions, MSBs of the seed affected only MSBs of the + // state x[]. + const UIntType mask = (max)(); + x[0] = value & mask; + for (i = 1; i < n; i++) { + // See Knuth "The Art of Computer Programming" + // Vol. 2, 3rd ed., page 106 + x[i] = (f * (x[i-1] ^ (x[i-1] >> (w-2))) + i) & mask; + } + } + + /** + * Seeds a mersenne_twister_engine using values produced by seq.generate(). + */ + BOOST_RANDOM_DETAIL_SEED_SEQ_SEED(mersenne_twister_engine, SeeqSeq, seq) + { + detail::seed_array_int<w>(seq, x); + i = n; + + // fix up the state if it's all zeroes. + if((x[0] & (~static_cast<UIntType>(0) << r)) == 0) { + for(std::size_t j = 1; j < n; ++j) { + if(x[j] != 0) return; + } + x[0] = static_cast<UIntType>(1) << (w-1); + } } - } - - /** - * Sets the state of this mersenne_twister to the values - * returned by n invocations of gen. - * - * Complexity: Exactly n invocations of gen. - */ - BOOST_RANDOM_DETAIL_GENERATOR_SEED(mersenne_twister, Generator, gen) - { -#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS - BOOST_STATIC_ASSERT(!std::numeric_limits<result_type>::is_signed); -#endif - // I could have used std::generate_n, but it takes "gen" by value - for(int j = 0; j < n; j++) - x[j] = gen(); - i = n; - } - - template<class It> - void seed(It& first, It last) - { - int j; - for(j = 0; j < n && first != last; ++j, ++first) - x[j] = *first; - i = n; - if(first == last && j < n) - throw std::invalid_argument("mersenne_twister::seed"); - } - - result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return 0; } - result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const - { - // avoid "left shift count >= with of type" warning - result_type res = 0; - for(int j = 0; j < w; ++j) - res |= (1u << j); - return res; - } - - result_type operator()(); - static bool validation(result_type v) { return val == v; } -#ifndef BOOST_NO_OPERATORS_IN_NAMESPACE + /** Sets the state of the generator using values from an iterator range. */ + template<class It> + void seed(It& first, It last) + { + detail::fill_array_int<w>(first, last, x); + i = n; + + // fix up the state if it's all zeroes. + if((x[0] & (~static_cast<UIntType>(0) << r)) == 0) { + for(std::size_t j = 1; j < n; ++j) { + if(x[j] != 0) return; + } + x[0] = static_cast<UIntType>(1) << (w-1); + } + } + + /** Returns the smallest value that the generator can produce. */ + static result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () + { return 0; } + /** Returns the largest value that the generator can produce. */ + static result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () + { return boost::low_bits_mask_t<w>::sig_bits; } + + /** Produces the next value of the generator. */ + result_type operator()(); + + /** Fills a range with random values */ + template<class Iter> + void generate(Iter first, Iter last) + { detail::generate_from_int(*this, first, last); } + + /** + * Advances the state of the generator by @c z steps. Equivalent to + * + * @code + * for(unsigned long long i = 0; i < z; ++i) { + * gen(); + * } + * @endcode + */ + void discard(boost::uintmax_t z) + { + for(boost::uintmax_t j = 0; j < z; ++j) { + (*this)(); + } + } #ifndef BOOST_RANDOM_NO_STREAM_OPERATORS - template<class CharT, class Traits> - friend std::basic_ostream<CharT,Traits>& - operator<<(std::basic_ostream<CharT,Traits>& os, const mersenne_twister& mt) - { - for(int j = 0; j < mt.state_size; ++j) - os << mt.compute(j) << " "; - return os; - } - - template<class CharT, class Traits> - friend std::basic_istream<CharT,Traits>& - operator>>(std::basic_istream<CharT,Traits>& is, mersenne_twister& mt) - { - for(int j = 0; j < mt.state_size; ++j) - is >> mt.x[j] >> std::ws; - // MSVC (up to 7.1) and Borland (up to 5.64) don't handle the template - // value parameter "n" available from the class template scope, so use - // the static constant with the same value - mt.i = mt.state_size; - return is; - } + /** Writes a mersenne_twister_engine to a @c std::ostream */ + template<class CharT, class Traits> + friend std::basic_ostream<CharT,Traits>& + operator<<(std::basic_ostream<CharT,Traits>& os, + const mersenne_twister_engine& mt) + { + mt.print(os); + return os; + } + + /** Reads a mersenne_twister_engine from a @c std::istream */ + template<class CharT, class Traits> + friend std::basic_istream<CharT,Traits>& + operator>>(std::basic_istream<CharT,Traits>& is, + mersenne_twister_engine& mt) + { + for(std::size_t j = 0; j < mt.state_size; ++j) + is >> mt.x[j] >> std::ws; + // MSVC (up to 7.1) and Borland (up to 5.64) don't handle the template + // value parameter "n" available from the class template scope, so use + // the static constant with the same value + mt.i = mt.state_size; + return is; + } #endif - friend bool operator==(const mersenne_twister& x, const mersenne_twister& y) - { - for(int j = 0; j < state_size; ++j) - if(x.compute(j) != y.compute(j)) - return false; - return true; - } - - friend bool operator!=(const mersenne_twister& x, const mersenne_twister& y) - { return !(x == y); } -#else - // Use a member function; Streamable concept not supported. - bool operator==(const mersenne_twister& rhs) const - { - for(int j = 0; j < state_size; ++j) - if(compute(j) != rhs.compute(j)) - return false; - return true; - } - - bool operator!=(const mersenne_twister& rhs) const - { return !(*this == rhs); } -#endif + /** + * Returns true if the two generators are in the same state, + * and will thus produce identical sequences. + */ + friend bool operator==(const mersenne_twister_engine& x, + const mersenne_twister_engine& y) + { + if(x.i < y.i) return x.equal_imp(y); + else return y.equal_imp(x); + } + + /** + * Returns true if the two generators are in different states. + */ + friend bool operator!=(const mersenne_twister_engine& x, + const mersenne_twister_engine& y) + { return !(x == y); } private: - /// \cond hide_private_members - // returns x(i-n+index), where index is in 0..n-1 - UIntType compute(unsigned int index) const - { - // equivalent to (i-n+index) % 2n, but doesn't produce negative numbers - return x[ (i + n + index) % (2*n) ]; - } - void twist(int block); - /// \endcond - - // state representation: next output is o(x(i)) - // x[0] ... x[k] x[k+1] ... x[n-1] x[n] ... x[2*n-1] represents - // x(i-k) ... x(i) x(i+1) ... x(i-k+n-1) x(i-k-n) ... x[i(i-k-1)] - // The goal is to always have x(i-n) ... x(i-1) available for - // operator== and save/restore. - - UIntType x[2*n]; - int i; + /// \cond show_private + + void twist(); + + /** + * Does the work of operator==. This is in a member function + * for portability. Some compilers, such as msvc 7.1 and + * Sun CC 5.10 can't access template parameters or static + * members of the class from inline friend functions. + * + * requires i <= other.i + */ + bool equal_imp(const mersenne_twister_engine& other) const + { + UIntType back[n]; + std::size_t offset = other.i - i; + for(std::size_t j = 0; j + offset < n; ++j) + if(x[j] != other.x[j+offset]) + return false; + rewind(&back[n-1], offset); + for(std::size_t j = 0; j < offset; ++j) + if(back[j + n - offset] != other.x[j]) + return false; + return true; + } + + /** + * Does the work of operator<<. This is in a member function + * for portability. + */ + template<class CharT, class Traits> + void print(std::basic_ostream<CharT, Traits>& os) const + { + UIntType data[n]; + for(std::size_t j = 0; j < i; ++j) { + data[j + n - i] = x[j]; + } + if(i != n) { + rewind(&data[n - i - 1], n - i); + } + os << data[0]; + for(std::size_t j = 1; j < n; ++j) { + os << ' ' << data[j]; + } + } + + /** + * Copies z elements of the state preceding x[0] into + * the array whose last element is last. + */ + void rewind(UIntType* last, std::size_t z) const + { + const UIntType upper_mask = (~static_cast<UIntType>(0)) << r; + const UIntType lower_mask = ~upper_mask; + UIntType y0 = x[m-1] ^ x[n-1]; + if(y0 & (static_cast<UIntType>(1) << (w-1))) { + y0 = ((y0 ^ a) << 1) | 1; + } else { + y0 = y0 << 1; + } + for(std::size_t sz = 0; sz < z; ++sz) { + UIntType y1 = + rewind_find(last, sz, m-1) ^ rewind_find(last, sz, n-1); + if(y1 & (static_cast<UIntType>(1) << (w-1))) { + y1 = ((y1 ^ a) << 1) | 1; + } else { + y1 = y1 << 1; + } + *(last - sz) = (y0 & upper_mask) | (y1 & lower_mask); + y0 = y1; + } + } + + /** + * Given a pointer to the last element of the rewind array, + * and the current size of the rewind array, finds an element + * relative to the next available slot in the rewind array. + */ + UIntType + rewind_find(UIntType* last, std::size_t size, std::size_t j) const + { + std::size_t index = (j + n - size + n - 1) % n; + if(index < n - size) { + return x[index]; + } else { + return *(last - (n - 1 - index)); + } + } + + /// \endcond + + // state representation: next output is o(x(i)) + // x[0] ... x[k] x[k+1] ... x[n-1] represents + // x(i-k) ... x(i) x(i+1) ... x(i-k+n-1) + + UIntType x[n]; + std::size_t i; }; +/// \cond show_private + #ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION // A definition is required even for integral static constants -template<class UIntType, int w, int n, int m, int r, UIntType a, int u, - int s, UIntType b, int t, UIntType c, int l, UIntType val> -const bool mersenne_twister<UIntType,w,n,m,r,a,u,s,b,t,c,l,val>::has_fixed_range; -template<class UIntType, int w, int n, int m, int r, UIntType a, int u, - int s, UIntType b, int t, UIntType c, int l, UIntType val> -const int mersenne_twister<UIntType,w,n,m,r,a,u,s,b,t,c,l,val>::state_size; -template<class UIntType, int w, int n, int m, int r, UIntType a, int u, - int s, UIntType b, int t, UIntType c, int l, UIntType val> -const int mersenne_twister<UIntType,w,n,m,r,a,u,s,b,t,c,l,val>::shift_size; -template<class UIntType, int w, int n, int m, int r, UIntType a, int u, - int s, UIntType b, int t, UIntType c, int l, UIntType val> -const int mersenne_twister<UIntType,w,n,m,r,a,u,s,b,t,c,l,val>::mask_bits; -template<class UIntType, int w, int n, int m, int r, UIntType a, int u, - int s, UIntType b, int t, UIntType c, int l, UIntType val> -const UIntType mersenne_twister<UIntType,w,n,m,r,a,u,s,b,t,c,l,val>::parameter_a; -template<class UIntType, int w, int n, int m, int r, UIntType a, int u, - int s, UIntType b, int t, UIntType c, int l, UIntType val> -const int mersenne_twister<UIntType,w,n,m,r,a,u,s,b,t,c,l,val>::output_u; -template<class UIntType, int w, int n, int m, int r, UIntType a, int u, - int s, UIntType b, int t, UIntType c, int l, UIntType val> -const int mersenne_twister<UIntType,w,n,m,r,a,u,s,b,t,c,l,val>::output_s; -template<class UIntType, int w, int n, int m, int r, UIntType a, int u, - int s, UIntType b, int t, UIntType c, int l, UIntType val> -const UIntType mersenne_twister<UIntType,w,n,m,r,a,u,s,b,t,c,l,val>::output_b; -template<class UIntType, int w, int n, int m, int r, UIntType a, int u, - int s, UIntType b, int t, UIntType c, int l, UIntType val> -const int mersenne_twister<UIntType,w,n,m,r,a,u,s,b,t,c,l,val>::output_t; -template<class UIntType, int w, int n, int m, int r, UIntType a, int u, - int s, UIntType b, int t, UIntType c, int l, UIntType val> -const UIntType mersenne_twister<UIntType,w,n,m,r,a,u,s,b,t,c,l,val>::output_c; -template<class UIntType, int w, int n, int m, int r, UIntType a, int u, - int s, UIntType b, int t, UIntType c, int l, UIntType val> -const int mersenne_twister<UIntType,w,n,m,r,a,u,s,b,t,c,l,val>::output_l; +#define BOOST_RANDOM_MT_DEFINE_CONSTANT(type, name) \ +template<class UIntType, std::size_t w, std::size_t n, std::size_t m, \ + std::size_t r, UIntType a, std::size_t u, UIntType d, std::size_t s, \ + UIntType b, std::size_t t, UIntType c, std::size_t l, UIntType f> \ +const type mersenne_twister_engine<UIntType,w,n,m,r,a,u,d,s,b,t,c,l,f>::name +BOOST_RANDOM_MT_DEFINE_CONSTANT(std::size_t, word_size); +BOOST_RANDOM_MT_DEFINE_CONSTANT(std::size_t, state_size); +BOOST_RANDOM_MT_DEFINE_CONSTANT(std::size_t, shift_size); +BOOST_RANDOM_MT_DEFINE_CONSTANT(std::size_t, mask_bits); +BOOST_RANDOM_MT_DEFINE_CONSTANT(UIntType, xor_mask); +BOOST_RANDOM_MT_DEFINE_CONSTANT(std::size_t, tempering_u); +BOOST_RANDOM_MT_DEFINE_CONSTANT(UIntType, tempering_d); +BOOST_RANDOM_MT_DEFINE_CONSTANT(std::size_t, tempering_s); +BOOST_RANDOM_MT_DEFINE_CONSTANT(UIntType, tempering_b); +BOOST_RANDOM_MT_DEFINE_CONSTANT(std::size_t, tempering_t); +BOOST_RANDOM_MT_DEFINE_CONSTANT(UIntType, tempering_c); +BOOST_RANDOM_MT_DEFINE_CONSTANT(std::size_t, tempering_l); +BOOST_RANDOM_MT_DEFINE_CONSTANT(UIntType, initialization_multiplier); +BOOST_RANDOM_MT_DEFINE_CONSTANT(UIntType, default_seed); +BOOST_RANDOM_MT_DEFINE_CONSTANT(UIntType, parameter_a); +BOOST_RANDOM_MT_DEFINE_CONSTANT(std::size_t, output_u ); +BOOST_RANDOM_MT_DEFINE_CONSTANT(std::size_t, output_s); +BOOST_RANDOM_MT_DEFINE_CONSTANT(UIntType, output_b); +BOOST_RANDOM_MT_DEFINE_CONSTANT(std::size_t, output_t); +BOOST_RANDOM_MT_DEFINE_CONSTANT(UIntType, output_c); +BOOST_RANDOM_MT_DEFINE_CONSTANT(std::size_t, output_l); +BOOST_RANDOM_MT_DEFINE_CONSTANT(bool, has_fixed_range); +#undef BOOST_RANDOM_MT_DEFINE_CONSTANT #endif -/// \cond hide_private_members -template<class UIntType, int w, int n, int m, int r, UIntType a, int u, - int s, UIntType b, int t, UIntType c, int l, UIntType val> -void mersenne_twister<UIntType,w,n,m,r,a,u,s,b,t,c,l,val>::twist(int block) +template<class UIntType, + std::size_t w, std::size_t n, std::size_t m, std::size_t r, + UIntType a, std::size_t u, UIntType d, std::size_t s, + UIntType b, std::size_t t, + UIntType c, std::size_t l, UIntType f> +void +mersenne_twister_engine<UIntType,w,n,m,r,a,u,d,s,b,t,c,l,f>::twist() { - const UIntType upper_mask = (~0u) << r; - const UIntType lower_mask = ~upper_mask; + const UIntType upper_mask = (~static_cast<UIntType>(0)) << r; + const UIntType lower_mask = ~upper_mask; + + const std::size_t unroll_factor = 6; + const std::size_t unroll_extra1 = (n-m) % unroll_factor; + const std::size_t unroll_extra2 = (m-1) % unroll_factor; - if(block == 0) { - for(int j = n; j < 2*n; j++) { - UIntType y = (x[j-n] & upper_mask) | (x[j-(n-1)] & lower_mask); - x[j] = x[j-(n-m)] ^ (y >> 1) ^ (y&1 ? a : 0); - } - } else if (block == 1) { // split loop to avoid costly modulo operations { // extra scope for MSVC brokenness w.r.t. for scope - for(int j = 0; j < n-m; j++) { - UIntType y = (x[j+n] & upper_mask) | (x[j+n+1] & lower_mask); - x[j] = x[j+n+m] ^ (y >> 1) ^ (y&1 ? a : 0); - } + for(std::size_t j = 0; j < n-m-unroll_extra1; j++) { + UIntType y = (x[j] & upper_mask) | (x[j+1] & lower_mask); + x[j] = x[j+m] ^ (y >> 1) ^ ((x[j+1]&1) * a); + } } - - for(int j = n-m; j < n-1; j++) { - UIntType y = (x[j+n] & upper_mask) | (x[j+n+1] & lower_mask); - x[j] = x[j-(n-m)] ^ (y >> 1) ^ (y&1 ? a : 0); + { + for(std::size_t j = n-m-unroll_extra1; j < n-m; j++) { + UIntType y = (x[j] & upper_mask) | (x[j+1] & lower_mask); + x[j] = x[j+m] ^ (y >> 1) ^ ((x[j+1]&1) * a); + } + } + { + for(std::size_t j = n-m; j < n-1-unroll_extra2; j++) { + UIntType y = (x[j] & upper_mask) | (x[j+1] & lower_mask); + x[j] = x[j-(n-m)] ^ (y >> 1) ^ ((x[j+1]&1) * a); + } + } + { + for(std::size_t j = n-1-unroll_extra2; j < n-1; j++) { + UIntType y = (x[j] & upper_mask) | (x[j+1] & lower_mask); + x[j] = x[j-(n-m)] ^ (y >> 1) ^ ((x[j+1]&1) * a); + } } // last iteration - UIntType y = (x[2*n-1] & upper_mask) | (x[0] & lower_mask); - x[n-1] = x[m-1] ^ (y >> 1) ^ (y&1 ? a : 0); + UIntType y = (x[n-1] & upper_mask) | (x[0] & lower_mask); + x[n-1] = x[m-1] ^ (y >> 1) ^ ((x[0]&1) * a); i = 0; - } } /// \endcond -template<class UIntType, int w, int n, int m, int r, UIntType a, int u, - int s, UIntType b, int t, UIntType c, int l, UIntType val> -inline typename mersenne_twister<UIntType,w,n,m,r,a,u,s,b,t,c,l,val>::result_type -mersenne_twister<UIntType,w,n,m,r,a,u,s,b,t,c,l,val>::operator()() +template<class UIntType, + std::size_t w, std::size_t n, std::size_t m, std::size_t r, + UIntType a, std::size_t u, UIntType d, std::size_t s, + UIntType b, std::size_t t, + UIntType c, std::size_t l, UIntType f> +inline typename +mersenne_twister_engine<UIntType,w,n,m,r,a,u,d,s,b,t,c,l,f>::result_type +mersenne_twister_engine<UIntType,w,n,m,r,a,u,d,s,b,t,c,l,f>::operator()() { - if(i == n) - twist(0); - else if(i >= 2*n) - twist(1); - // Step 4 - UIntType z = x[i]; - ++i; - z ^= (z >> u); - z ^= ((z << s) & b); - z ^= ((z << t) & c); - z ^= (z >> l); - return z; + if(i == n) + twist(); + // Step 4 + UIntType z = x[i]; + ++i; + z ^= ((z >> u) & d); + z ^= ((z << s) & b); + z ^= ((z << t) & c); + z ^= (z >> l); + return z; } -} // namespace random - /** * The specializations \mt11213b and \mt19937 are from * @@ -343,8 +471,8 @@ mersenne_twister<UIntType,w,n,m,r,a,u,s,b,t,c,l,val>::operator()() * Generation, Vol. 8, No. 1, January 1998, pp. 3-30. * @endblockquote */ -typedef random::mersenne_twister<uint32_t,32,351,175,19,0xccab8ee7,11, - 7,0x31b6ab00,15,0xffe50000,17, 0xa37d3c92> mt11213b; +typedef mersenne_twister_engine<uint32_t,32,351,175,19,0xccab8ee7, + 11,0xffffffff,7,0x31b6ab00,15,0xffe50000,17,1812433253> mt11213b; /** * The specializations \mt11213b and \mt19937 are from @@ -357,11 +485,61 @@ typedef random::mersenne_twister<uint32_t,32,351,175,19,0xccab8ee7,11, * Generation, Vol. 8, No. 1, January 1998, pp. 3-30. * @endblockquote */ -typedef random::mersenne_twister<uint32_t,32,624,397,31,0x9908b0df,11, - 7,0x9d2c5680,15,0xefc60000,18, 3346425566U> mt19937; +typedef mersenne_twister_engine<uint32_t,32,624,397,31,0x9908b0df, + 11,0xffffffff,7,0x9d2c5680,15,0xefc60000,18,1812433253> mt19937; + +#if !defined(BOOST_NO_INT64_T) && !defined(BOOST_NO_INTEGRAL_INT64_T) +typedef mersenne_twister_engine<uint64_t,64,312,156,31, + UINT64_C(0xb5026f5aa96619e9),29,UINT64_C(0x5555555555555555),17, + UINT64_C(0x71d67fffeda60000),37,UINT64_C(0xfff7eee000000000),43, + UINT64_C(6364136223846793005)> mt19937_64; +#endif + +/// \cond show_deprecated + +template<class UIntType, + int w, int n, int m, int r, + UIntType a, int u, std::size_t s, + UIntType b, int t, + UIntType c, int l, UIntType v> +class mersenne_twister : + public mersenne_twister_engine<UIntType, + w, n, m, r, a, u, ~(UIntType)0, s, b, t, c, l, 1812433253> +{ + typedef mersenne_twister_engine<UIntType, + w, n, m, r, a, u, ~(UIntType)0, s, b, t, c, l, 1812433253> base_type; +public: + mersenne_twister() {} + BOOST_RANDOM_DETAIL_GENERATOR_CONSTRUCTOR(mersenne_twister, Gen, gen) + { seed(gen); } + BOOST_RANDOM_DETAIL_ARITHMETIC_CONSTRUCTOR(mersenne_twister, UIntType, val) + { seed(val); } + template<class It> + mersenne_twister(It& first, It last) : base_type(first, last) {} + void seed() { base_type::seed(); } + BOOST_RANDOM_DETAIL_GENERATOR_SEED(mersenne_twister, Gen, gen) + { + detail::generator_seed_seq<Gen> seq(gen); + base_type::seed(seq); + } + BOOST_RANDOM_DETAIL_ARITHMETIC_SEED(mersenne_twister, UIntType, val) + { base_type::seed(val); } + template<class It> + void seed(It& first, It last) { base_type::seed(first, last); } +}; + +/// \endcond + +} // namespace random + +using random::mt11213b; +using random::mt19937; +using random::mt19937_64; } // namespace boost +BOOST_RANDOM_PTR_HELPER_SPEC(boost::mt11213b) BOOST_RANDOM_PTR_HELPER_SPEC(boost::mt19937) +BOOST_RANDOM_PTR_HELPER_SPEC(boost::mt19937_64) #endif // BOOST_RANDOM_MERSENNE_TWISTER_HPP diff --git a/3rdParty/Boost/src/boost/random/uniform_01.hpp b/3rdParty/Boost/src/boost/random/uniform_01.hpp deleted file mode 100644 index 2cdd05f..0000000 --- a/3rdParty/Boost/src/boost/random/uniform_01.hpp +++ /dev/null @@ -1,273 +0,0 @@ -/* boost random/uniform_01.hpp header file - * - * Copyright Jens Maurer 2000-2001 - * 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) - * - * See http://www.boost.org for most recent version including documentation. - * - * $Id: uniform_01.hpp 60755 2010-03-22 00:45:06Z steven_watanabe $ - * - * Revision history - * 2001-02-18 moved to individual header files - */ - -#ifndef BOOST_RANDOM_UNIFORM_01_HPP -#define BOOST_RANDOM_UNIFORM_01_HPP - -#include <iostream> -#include <boost/config.hpp> -#include <boost/limits.hpp> -#include <boost/static_assert.hpp> -#include <boost/random/detail/config.hpp> -#include <boost/random/detail/pass_through_engine.hpp> - -#include <boost/random/detail/disable_warnings.hpp> - -namespace boost { - -#ifdef BOOST_RANDOM_DOXYGEN - -/** - * The distribution function uniform_01 models a \random_distribution. - * On each invocation, it returns a random floating-point value - * uniformly distributed in the range [0..1). - * - * The template parameter RealType shall denote a float-like value type - * with support for binary operators +, -, and /. - * - * Note: The current implementation is buggy, because it may not fill - * all of the mantissa with random bits. I'm unsure how to fill a - * (to-be-invented) @c boost::bigfloat class with random bits efficiently. - * It's probably time for a traits class. - */ -template<class RealType = double> -class uniform_01 -{ -public: - typedef RealType input_type; - typedef RealType result_type; - result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const; - result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const; - void reset(); - - template<class Engine> - result_type operator()(Engine& eng); - -#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS - template<class CharT, class Traits> - friend std::basic_ostream<CharT,Traits>& - operator<<(std::basic_ostream<CharT,Traits>& os, const new_uniform_01&) - { - return os; - } - - template<class CharT, class Traits> - friend std::basic_istream<CharT,Traits>& - operator>>(std::basic_istream<CharT,Traits>& is, new_uniform_01&) - { - return is; - } -#endif -}; - -#else - -namespace detail { - -template<class RealType> -class new_uniform_01 -{ -public: - typedef RealType input_type; - typedef RealType result_type; - // compiler-generated copy ctor and copy assignment are fine - result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return result_type(0); } - result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return result_type(1); } - void reset() { } - - template<class Engine> - result_type operator()(Engine& eng) { - for (;;) { - typedef typename Engine::result_type base_result; - result_type factor = result_type(1) / - (result_type((eng.max)()-(eng.min)()) + - result_type(std::numeric_limits<base_result>::is_integer ? 1 : 0)); - result_type result = result_type(eng() - (eng.min)()) * factor; - if (result < result_type(1)) - return result; - } - } - -#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS - template<class CharT, class Traits> - friend std::basic_ostream<CharT,Traits>& - operator<<(std::basic_ostream<CharT,Traits>& os, const new_uniform_01&) - { - return os; - } - - template<class CharT, class Traits> - friend std::basic_istream<CharT,Traits>& - operator>>(std::basic_istream<CharT,Traits>& is, new_uniform_01&) - { - return is; - } -#endif -}; - -template<class UniformRandomNumberGenerator, class RealType> -class backward_compatible_uniform_01 -{ - typedef boost::random::detail::ptr_helper<UniformRandomNumberGenerator> traits; - typedef boost::random::detail::pass_through_engine<UniformRandomNumberGenerator> internal_engine_type; -public: - typedef UniformRandomNumberGenerator base_type; - typedef RealType result_type; - - BOOST_STATIC_CONSTANT(bool, has_fixed_range = false); - -#if !defined(BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS) && !(defined(BOOST_MSVC) && BOOST_MSVC <= 1300) - BOOST_STATIC_ASSERT(!std::numeric_limits<RealType>::is_integer); -#endif - - explicit backward_compatible_uniform_01(typename traits::rvalue_type rng) - : _rng(rng), - _factor(result_type(1) / - (result_type((_rng.max)()-(_rng.min)()) + - result_type(std::numeric_limits<base_result>::is_integer ? 1 : 0))) - { - } - // compiler-generated copy ctor and copy assignment are fine - - result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return result_type(0); } - result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return result_type(1); } - typename traits::value_type& base() { return _rng.base(); } - const typename traits::value_type& base() const { return _rng.base(); } - void reset() { } - - result_type operator()() { - for (;;) { - result_type result = result_type(_rng() - (_rng.min)()) * _factor; - if (result < result_type(1)) - return result; - } - } - -#if !defined(BOOST_NO_OPERATORS_IN_NAMESPACE) && !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) - template<class CharT, class Traits> - friend std::basic_ostream<CharT,Traits>& - operator<<(std::basic_ostream<CharT,Traits>& os, const backward_compatible_uniform_01& u) - { - os << u._rng; - return os; - } - - template<class CharT, class Traits> - friend std::basic_istream<CharT,Traits>& - operator>>(std::basic_istream<CharT,Traits>& is, backward_compatible_uniform_01& u) - { - is >> u._rng; - return is; - } -#endif - -private: - typedef typename internal_engine_type::result_type base_result; - internal_engine_type _rng; - result_type _factor; -}; - -#ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION -// A definition is required even for integral static constants -template<class UniformRandomNumberGenerator, class RealType> -const bool backward_compatible_uniform_01<UniformRandomNumberGenerator, RealType>::has_fixed_range; -#endif - -template<class UniformRandomNumberGenerator> -struct select_uniform_01 -{ - template<class RealType> - struct apply - { - typedef backward_compatible_uniform_01<UniformRandomNumberGenerator, RealType> type; - }; -}; - -template<> -struct select_uniform_01<float> -{ - template<class RealType> - struct apply - { - typedef new_uniform_01<float> type; - }; -}; - -template<> -struct select_uniform_01<double> -{ - template<class RealType> - struct apply - { - typedef new_uniform_01<double> type; - }; -}; - -template<> -struct select_uniform_01<long double> -{ - template<class RealType> - struct apply - { - typedef new_uniform_01<long double> type; - }; -}; - -} - -// Because it is so commonly used: uniform distribution on the real [0..1) -// range. This allows for specializations to avoid a costly int -> float -// conversion plus float multiplication -template<class UniformRandomNumberGenerator = double, class RealType = double> -class uniform_01 - : public detail::select_uniform_01<UniformRandomNumberGenerator>::BOOST_NESTED_TEMPLATE apply<RealType>::type -{ - typedef typename detail::select_uniform_01<UniformRandomNumberGenerator>::BOOST_NESTED_TEMPLATE apply<RealType>::type impl_type; - typedef boost::random::detail::ptr_helper<UniformRandomNumberGenerator> traits; -public: - - uniform_01() {} - - explicit uniform_01(typename traits::rvalue_type rng) - : impl_type(rng) - { - } - -#if !defined(BOOST_NO_OPERATORS_IN_NAMESPACE) && !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) - template<class CharT, class Traits> - friend std::basic_ostream<CharT,Traits>& - operator<<(std::basic_ostream<CharT,Traits>& os, const uniform_01& u) - { - os << static_cast<const impl_type&>(u); - return os; - } - - template<class CharT, class Traits> - friend std::basic_istream<CharT,Traits>& - operator>>(std::basic_istream<CharT,Traits>& is, uniform_01& u) - { - is >> static_cast<impl_type&>(u); - return is; - } -#endif -}; - -#endif - -} // namespace boost - -#include <boost/random/detail/enable_warnings.hpp> - -#endif // BOOST_RANDOM_UNIFORM_01_HPP diff --git a/3rdParty/Boost/src/boost/random/uniform_int.hpp b/3rdParty/Boost/src/boost/random/uniform_int.hpp index 426a9e1..7ae3b92 100644 --- a/3rdParty/Boost/src/boost/random/uniform_int.hpp +++ b/3rdParty/Boost/src/boost/random/uniform_int.hpp @@ -7,7 +7,7 @@ * * See http://www.boost.org for most recent version including documentation. * - * $Id: uniform_int.hpp 60755 2010-03-22 00:45:06Z steven_watanabe $ + * $Id: uniform_int.hpp 71018 2011-04-05 21:27:52Z steven_watanabe $ * * Revision history * 2001-04-08 added min<max assertion (N. Becker) @@ -17,15 +17,8 @@ #ifndef BOOST_RANDOM_UNIFORM_INT_HPP #define BOOST_RANDOM_UNIFORM_INT_HPP -#include <cassert> -#include <iostream> -#include <boost/config.hpp> -#include <boost/limits.hpp> -#include <boost/static_assert.hpp> -#include <boost/detail/workaround.hpp> -#include <boost/random/detail/config.hpp> -#include <boost/random/detail/signed_unsigned_tools.hpp> -#include <boost/type_traits/make_unsigned.hpp> +#include <boost/assert.hpp> +#include <boost/random/uniform_int_distribution.hpp> namespace boost { @@ -35,264 +28,70 @@ namespace boost { * distributed in the set of integer numbers {min, min+1, min+2, ..., max}. * * The template parameter IntType shall denote an integer-like value type. + * + * This class is deprecated. Please use @c uniform_int_distribution in + * new code. */ template<class IntType = int> -class uniform_int +class uniform_int : public random::uniform_int_distribution<IntType> { + typedef random::uniform_int_distribution<IntType> base_type; public: - typedef IntType input_type; - typedef IntType result_type; - - /// \cond hide_private_members - typedef typename make_unsigned<result_type>::type range_type; - /// \endcond - - /** - * Constructs a uniform_int object. @c min and @c max are - * the parameters of the distribution. - * - * Requires: min <= max - */ - explicit uniform_int(IntType min_arg = 0, IntType max_arg = 9) - : _min(min_arg), _max(max_arg) - { -#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS - // MSVC fails BOOST_STATIC_ASSERT with std::numeric_limits at class scope - BOOST_STATIC_ASSERT(std::numeric_limits<IntType>::is_integer); -#endif - assert(min_arg <= max_arg); - init(); - } - - /** - * Returns: The "min" parameter of the distribution - */ - result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return _min; } - /** - * Returns: The "max" parameter of the distribution - */ - result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return _max; } - void reset() { } - - // can't have member function templates out-of-line due to MSVC bugs - template<class Engine> - result_type operator()(Engine& eng) - { - return generate(eng, _min, _max, _range); - } - - template<class Engine> - result_type operator()(Engine& eng, result_type n) - { - assert(n > 0); - - if (n == 1) - { - return 0; - } - - return generate(eng, 0, n - 1, n - 1); - } - -#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS - template<class CharT, class Traits> - friend std::basic_ostream<CharT,Traits>& - operator<<(std::basic_ostream<CharT,Traits>& os, const uniform_int& ud) - { - os << ud._min << " " << ud._max; - return os; - } - - template<class CharT, class Traits> - friend std::basic_istream<CharT,Traits>& - operator>>(std::basic_istream<CharT,Traits>& is, uniform_int& ud) - { - is >> std::ws >> ud._min >> std::ws >> ud._max; - ud.init(); - return is; - } -#endif - -private: - -#ifdef BOOST_MSVC -#pragma warning(push) -// disable division by zero warning, since we can't -// actually divide by zero. -#pragma warning(disable:4723) -#endif - /// \cond hide_private_members - template<class Engine> - static result_type generate(Engine& eng, result_type min_value, result_type /*max_value*/, range_type range) - { - typedef typename Engine::result_type base_result; - // ranges are always unsigned - typedef typename make_unsigned<base_result>::type base_unsigned; - const base_result bmin = (eng.min)(); - const base_unsigned brange = - random::detail::subtract<base_result>()((eng.max)(), (eng.min)()); - - if(range == 0) { - return min_value; - } else if(brange == range) { - // this will probably never happen in real life - // basically nothing to do; just take care we don't overflow / underflow - base_unsigned v = random::detail::subtract<base_result>()(eng(), bmin); - return random::detail::add<base_unsigned, result_type>()(v, min_value); - } else if(brange < range) { - // use rejection method to handle things like 0..3 --> 0..4 - for(;;) { - // concatenate several invocations of the base RNG - // take extra care to avoid overflows - - // limit == floor((range+1)/(brange+1)) - // Therefore limit*(brange+1) <= range+1 - range_type limit; - if(range == (std::numeric_limits<range_type>::max)()) { - limit = range/(range_type(brange)+1); - if(range % (range_type(brange)+1) == range_type(brange)) - ++limit; - } else { - limit = (range+1)/(range_type(brange)+1); - } - - // We consider "result" as expressed to base (brange+1): - // For every power of (brange+1), we determine a random factor - range_type result = range_type(0); - range_type mult = range_type(1); - - // loop invariants: - // result < mult - // mult <= range - while(mult <= limit) { - // Postcondition: result <= range, thus no overflow - // - // limit*(brange+1)<=range+1 def. of limit (1) - // eng()-bmin<=brange eng() post. (2) - // and mult<=limit. loop condition (3) - // Therefore mult*(eng()-bmin+1)<=range+1 by (1),(2),(3) (4) - // Therefore mult*(eng()-bmin)+mult<=range+1 rearranging (4) (5) - // result<mult loop invariant (6) - // Therefore result+mult*(eng()-bmin)<range+1 by (5), (6) (7) - // - // Postcondition: result < mult*(brange+1) - // - // result<mult loop invariant (1) - // eng()-bmin<=brange eng() post. (2) - // Therefore result+mult*(eng()-bmin) < - // mult+mult*(eng()-bmin) by (1) (3) - // Therefore result+(eng()-bmin)*mult < - // mult+mult*brange by (2), (3) (4) - // Therefore result+(eng()-bmin)*mult < - // mult*(brange+1) by (4) - result += static_cast<range_type>(random::detail::subtract<base_result>()(eng(), bmin) * mult); - - // equivalent to (mult * (brange+1)) == range+1, but avoids overflow. - if(mult * range_type(brange) == range - mult + 1) { - // The destination range is an integer power of - // the generator's range. - return(result); - } - - // Postcondition: mult <= range - // - // limit*(brange+1)<=range+1 def. of limit (1) - // mult<=limit loop condition (2) - // Therefore mult*(brange+1)<=range+1 by (1), (2) (3) - // mult*(brange+1)!=range+1 preceding if (4) - // Therefore mult*(brange+1)<range+1 by (3), (4) (5) - // - // Postcondition: result < mult - // - // See the second postcondition on the change to result. - mult *= range_type(brange)+range_type(1); - } - // loop postcondition: range/mult < brange+1 - // - // mult > limit loop condition (1) - // Suppose range/mult >= brange+1 Assumption (2) - // range >= mult*(brange+1) by (2) (3) - // range+1 > mult*(brange+1) by (3) (4) - // range+1 > (limit+1)*(brange+1) by (1), (4) (5) - // (range+1)/(brange+1) > limit+1 by (5) (6) - // limit < floor((range+1)/(brange+1)) by (6) (7) - // limit==floor((range+1)/(brange+1)) def. of limit (8) - // not (2) reductio (9) - // - // loop postcondition: (range/mult)*mult+(mult-1) >= range - // - // (range/mult)*mult + range%mult == range identity (1) - // range%mult < mult def. of % (2) - // (range/mult)*mult+mult > range by (1), (2) (3) - // (range/mult)*mult+(mult-1) >= range by (3) (4) - // - // Note that the maximum value of result at this point is (mult-1), - // so after this final step, we generate numbers that can be - // at least as large as range. We have to really careful to avoid - // overflow in this final addition and in the rejection. Anything - // that overflows is larger than range and can thus be rejected. - - // range/mult < brange+1 -> no endless loop - range_type result_increment = uniform_int<range_type>(0, range/mult)(eng); - if((std::numeric_limits<range_type>::max)() / mult < result_increment) { - // The multiplcation would overflow. Reject immediately. - continue; - } - result_increment *= mult; - // unsigned integers are guaranteed to wrap on overflow. - result += result_increment; - if(result < result_increment) { - // The addition overflowed. Reject. - continue; - } - if(result > range) { - // Too big. Reject. - continue; - } - return random::detail::add<range_type, result_type>()(result, min_value); - } - } else { // brange > range - base_unsigned bucket_size; - // it's safe to add 1 to range, as long as we cast it first, - // because we know that it is less than brange. However, - // we do need to be careful not to cause overflow by adding 1 - // to brange. - if(brange == (std::numeric_limits<base_unsigned>::max)()) { - bucket_size = brange / (static_cast<base_unsigned>(range)+1); - if(brange % (static_cast<base_unsigned>(range)+1) == static_cast<base_unsigned>(range)) { - ++bucket_size; - } - } else { - bucket_size = (brange+1) / (static_cast<base_unsigned>(range)+1); - } - for(;;) { - base_unsigned result = - random::detail::subtract<base_result>()(eng(), bmin); - result /= bucket_size; - // result and range are non-negative, and result is possibly larger - // than range, so the cast is safe - if(result <= static_cast<base_unsigned>(range)) - return random::detail::add<base_unsigned, result_type>()(result, min_value); - } + class param_type : public base_type::param_type + { + public: + typedef uniform_int distribution_type; + /** + * Constructs the parameters of a uniform_int distribution. + * + * Requires: min <= max + */ + explicit param_type(IntType min_arg = 0, IntType max_arg = 9) + : base_type::param_type(min_arg, max_arg) + {} + }; + + /** + * Constructs a uniform_int object. @c min and @c max are + * the parameters of the distribution. + * + * Requires: min <= max + */ + explicit uniform_int(IntType min_arg = 0, IntType max_arg = 9) + : base_type(min_arg, max_arg) + {} + + /** Constructs a uniform_int distribution from its parameters. */ + explicit uniform_int(const param_type& parm) + : base_type(parm) + {} + + /** Returns the parameters of the distribution */ + param_type param() const { return param_type(this->a(), this->b()); } + /** Sets the parameters of the distribution. */ + void param(const param_type& parm) { this->base_type::param(parm); } + + // Codergear seems to have trouble with a using declaration here + + template<class Engine> + IntType operator()(Engine& eng) const + { + return static_cast<const base_type&>(*this)(eng); } - } - -#ifdef BOOST_MSVC -#pragma warning(pop) -#endif - - void init() - { - _range = random::detail::subtract<result_type>()(_max, _min); - } - /// \endcond + template<class Engine> + IntType operator()(Engine& eng, const param_type& parm) const + { + return static_cast<const base_type&>(*this)(eng, parm); + } - // The result_type may be signed or unsigned, but the _range is always - // unsigned. - result_type _min, _max; - range_type _range; + template<class Engine> + IntType operator()(Engine& eng, IntType n) const + { + BOOST_ASSERT(n > 0); + return static_cast<const base_type&>(*this)(eng, param_type(0, n - 1)); + } }; } // namespace boost diff --git a/3rdParty/Boost/src/boost/random/uniform_int_distribution.hpp b/3rdParty/Boost/src/boost/random/uniform_int_distribution.hpp new file mode 100644 index 0000000..0612028 --- /dev/null +++ b/3rdParty/Boost/src/boost/random/uniform_int_distribution.hpp @@ -0,0 +1,400 @@ +/* boost random/uniform_int_distribution.hpp header file + * + * Copyright Jens Maurer 2000-2001 + * Copyright Steven Watanabe 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) + * + * See http://www.boost.org for most recent version including documentation. + * + * $Id: uniform_int_distribution.hpp 71018 2011-04-05 21:27:52Z steven_watanabe $ + * + * Revision history + * 2001-04-08 added min<max assertion (N. Becker) + * 2001-02-18 moved to individual header files + */ + +#ifndef BOOST_RANDOM_UNIFORM_INT_DISTRIBUTION_HPP +#define BOOST_RANDOM_UNIFORM_INT_DISTRIBUTION_HPP + +#include <iosfwd> +#include <ios> +#include <istream> +#include <boost/config.hpp> +#include <boost/limits.hpp> +#include <boost/assert.hpp> +#include <boost/random/detail/config.hpp> +#include <boost/random/detail/operators.hpp> +#include <boost/random/detail/uniform_int_float.hpp> +#include <boost/random/detail/signed_unsigned_tools.hpp> +#include <boost/type_traits/make_unsigned.hpp> +#include <boost/type_traits/is_integral.hpp> + +namespace boost { +namespace random { +namespace detail { + + +#ifdef BOOST_MSVC +#pragma warning(push) +// disable division by zero warning, since we can't +// actually divide by zero. +#pragma warning(disable:4723) +#endif + +template<class Engine, class T> +T generate_uniform_int( + Engine& eng, T min_value, T max_value, + boost::mpl::true_ /** is_integral<Engine::result_type> */) +{ + typedef T result_type; + typedef typename make_unsigned<T>::type range_type; + typedef typename Engine::result_type base_result; + // ranges are always unsigned + typedef typename make_unsigned<base_result>::type base_unsigned; + const range_type range = random::detail::subtract<result_type>()(max_value, min_value); + const base_result bmin = (eng.min)(); + const base_unsigned brange = + random::detail::subtract<base_result>()((eng.max)(), (eng.min)()); + + if(range == 0) { + return min_value; + } else if(brange == range) { + // this will probably never happen in real life + // basically nothing to do; just take care we don't overflow / underflow + base_unsigned v = random::detail::subtract<base_result>()(eng(), bmin); + return random::detail::add<base_unsigned, result_type>()(v, min_value); + } else if(brange < range) { + // use rejection method to handle things like 0..3 --> 0..4 + for(;;) { + // concatenate several invocations of the base RNG + // take extra care to avoid overflows + + // limit == floor((range+1)/(brange+1)) + // Therefore limit*(brange+1) <= range+1 + range_type limit; + if(range == (std::numeric_limits<range_type>::max)()) { + limit = range/(range_type(brange)+1); + if(range % (range_type(brange)+1) == range_type(brange)) + ++limit; + } else { + limit = (range+1)/(range_type(brange)+1); + } + + // We consider "result" as expressed to base (brange+1): + // For every power of (brange+1), we determine a random factor + range_type result = range_type(0); + range_type mult = range_type(1); + + // loop invariants: + // result < mult + // mult <= range + while(mult <= limit) { + // Postcondition: result <= range, thus no overflow + // + // limit*(brange+1)<=range+1 def. of limit (1) + // eng()-bmin<=brange eng() post. (2) + // and mult<=limit. loop condition (3) + // Therefore mult*(eng()-bmin+1)<=range+1 by (1),(2),(3) (4) + // Therefore mult*(eng()-bmin)+mult<=range+1 rearranging (4) (5) + // result<mult loop invariant (6) + // Therefore result+mult*(eng()-bmin)<range+1 by (5), (6) (7) + // + // Postcondition: result < mult*(brange+1) + // + // result<mult loop invariant (1) + // eng()-bmin<=brange eng() post. (2) + // Therefore result+mult*(eng()-bmin) < + // mult+mult*(eng()-bmin) by (1) (3) + // Therefore result+(eng()-bmin)*mult < + // mult+mult*brange by (2), (3) (4) + // Therefore result+(eng()-bmin)*mult < + // mult*(brange+1) by (4) + result += static_cast<range_type>(random::detail::subtract<base_result>()(eng(), bmin) * mult); + + // equivalent to (mult * (brange+1)) == range+1, but avoids overflow. + if(mult * range_type(brange) == range - mult + 1) { + // The destination range is an integer power of + // the generator's range. + return(result); + } + + // Postcondition: mult <= range + // + // limit*(brange+1)<=range+1 def. of limit (1) + // mult<=limit loop condition (2) + // Therefore mult*(brange+1)<=range+1 by (1), (2) (3) + // mult*(brange+1)!=range+1 preceding if (4) + // Therefore mult*(brange+1)<range+1 by (3), (4) (5) + // + // Postcondition: result < mult + // + // See the second postcondition on the change to result. + mult *= range_type(brange)+range_type(1); + } + // loop postcondition: range/mult < brange+1 + // + // mult > limit loop condition (1) + // Suppose range/mult >= brange+1 Assumption (2) + // range >= mult*(brange+1) by (2) (3) + // range+1 > mult*(brange+1) by (3) (4) + // range+1 > (limit+1)*(brange+1) by (1), (4) (5) + // (range+1)/(brange+1) > limit+1 by (5) (6) + // limit < floor((range+1)/(brange+1)) by (6) (7) + // limit==floor((range+1)/(brange+1)) def. of limit (8) + // not (2) reductio (9) + // + // loop postcondition: (range/mult)*mult+(mult-1) >= range + // + // (range/mult)*mult + range%mult == range identity (1) + // range%mult < mult def. of % (2) + // (range/mult)*mult+mult > range by (1), (2) (3) + // (range/mult)*mult+(mult-1) >= range by (3) (4) + // + // Note that the maximum value of result at this point is (mult-1), + // so after this final step, we generate numbers that can be + // at least as large as range. We have to really careful to avoid + // overflow in this final addition and in the rejection. Anything + // that overflows is larger than range and can thus be rejected. + + // range/mult < brange+1 -> no endless loop + range_type result_increment = + generate_uniform_int( + eng, + static_cast<range_type>(0), + static_cast<range_type>(range/mult), + boost::mpl::true_()); + if((std::numeric_limits<range_type>::max)() / mult < result_increment) { + // The multiplcation would overflow. Reject immediately. + continue; + } + result_increment *= mult; + // unsigned integers are guaranteed to wrap on overflow. + result += result_increment; + if(result < result_increment) { + // The addition overflowed. Reject. + continue; + } + if(result > range) { + // Too big. Reject. + continue; + } + return random::detail::add<range_type, result_type>()(result, min_value); + } + } else { // brange > range + base_unsigned bucket_size; + // it's safe to add 1 to range, as long as we cast it first, + // because we know that it is less than brange. However, + // we do need to be careful not to cause overflow by adding 1 + // to brange. + if(brange == (std::numeric_limits<base_unsigned>::max)()) { + bucket_size = brange / (static_cast<base_unsigned>(range)+1); + if(brange % (static_cast<base_unsigned>(range)+1) == static_cast<base_unsigned>(range)) { + ++bucket_size; + } + } else { + bucket_size = (brange+1) / (static_cast<base_unsigned>(range)+1); + } + for(;;) { + base_unsigned result = + random::detail::subtract<base_result>()(eng(), bmin); + result /= bucket_size; + // result and range are non-negative, and result is possibly larger + // than range, so the cast is safe + if(result <= static_cast<base_unsigned>(range)) + return random::detail::add<base_unsigned, result_type>()(result, min_value); + } + } +} + +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + +template<class Engine, class T> +inline T generate_uniform_int( + Engine& eng, T min_value, T max_value, + boost::mpl::false_ /** is_integral<Engine::result_type> */) +{ + uniform_int_float<Engine> wrapper(eng); + return generate_uniform_int(wrapper, min_value, max_value, boost::mpl::true_()); +} + +template<class Engine, class T> +inline T generate_uniform_int(Engine& eng, T min_value, T max_value) +{ + typedef typename Engine::result_type base_result; + return generate_uniform_int(eng, min_value, max_value, + boost::is_integral<base_result>()); +} + +} + +/** + * The class template uniform_int_distribution models a \random_distribution. + * On each invocation, it returns a random integer value uniformly + * distributed in the set of integers {min, min+1, min+2, ..., max}. + * + * The template parameter IntType shall denote an integer-like value type. + */ +template<class IntType = int> +class uniform_int_distribution +{ +public: + typedef IntType input_type; + typedef IntType result_type; + + class param_type + { + public: + + typedef uniform_int_distribution distribution_type; + + /** + * Constructs the parameters of a uniform_int_distribution. + * + * Requires min <= max + */ + explicit param_type( + IntType min_arg = 0, + IntType max_arg = (std::numeric_limits<IntType>::max)()) + : _min(min_arg), _max(max_arg) + { + BOOST_ASSERT(_min <= _max); + } + + /** Returns the minimum value of the distribution. */ + IntType a() const { return _min; } + /** Returns the maximum value of the distribution. */ + IntType b() const { return _max; } + + /** Writes the parameters to a @c std::ostream. */ + BOOST_RANDOM_DETAIL_OSTREAM_OPERATOR(os, param_type, parm) + { + os << parm._min << " " << parm._max; + return os; + } + + /** Reads the parameters from a @c std::istream. */ + BOOST_RANDOM_DETAIL_ISTREAM_OPERATOR(is, param_type, parm) + { + IntType min_in, max_in; + if(is >> min_in >> std::ws >> max_in) { + if(min_in <= max_in) { + parm._min = min_in; + parm._max = max_in; + } else { + is.setstate(std::ios_base::failbit); + } + } + return is; + } + + /** Returns true if the two sets of parameters are equal. */ + BOOST_RANDOM_DETAIL_EQUALITY_OPERATOR(param_type, lhs, rhs) + { return lhs._min == rhs._min && lhs._max == rhs._max; } + + /** Returns true if the two sets of parameters are different. */ + BOOST_RANDOM_DETAIL_INEQUALITY_OPERATOR(param_type) + + private: + + IntType _min; + IntType _max; + }; + + /** + * Constructs a uniform_int_distribution. @c min and @c max are + * the parameters of the distribution. + * + * Requires: min <= max + */ + explicit uniform_int_distribution( + IntType min_arg = 0, + IntType max_arg = (std::numeric_limits<IntType>::max)()) + : _min(min_arg), _max(max_arg) + { + BOOST_ASSERT(min_arg <= max_arg); + } + /** Constructs a uniform_int_distribution from its parameters. */ + explicit uniform_int_distribution(const param_type& parm) + : _min(parm.a()), _max(parm.b()) {} + + /** Returns the minimum value of the distribution */ + IntType min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return _min; } + /** Returns the maximum value of the distribution */ + IntType max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return _max; } + + /** Returns the minimum value of the distribution */ + IntType a() const { return _min; } + /** Returns the maximum value of the distribution */ + IntType b() const { return _max; } + + /** Returns the parameters of the distribution. */ + param_type param() const { return param_type(_min, _max); } + /** Sets the parameters of the distribution. */ + void param(const param_type& parm) + { + _min = parm.a(); + _max = parm.b(); + } + + /** + * Effects: Subsequent uses of the distribution do not depend + * on values produced by any engine prior to invoking reset. + */ + void reset() { } + + /** Returns an integer uniformly distributed in the range [min, max]. */ + template<class Engine> + result_type operator()(Engine& eng) const + { return detail::generate_uniform_int(eng, _min, _max); } + + /** + * Returns an integer uniformly distributed in the range + * [param.a(), param.b()]. + */ + template<class Engine> + result_type operator()(Engine& eng, const param_type& parm) const + { return detail::generate_uniform_int(eng, parm.a(), parm.b()); } + + /** Writes the distribution to a @c std::ostream. */ + BOOST_RANDOM_DETAIL_OSTREAM_OPERATOR(os, uniform_int_distribution, ud) + { + os << ud.param(); + return os; + } + + /** Reads the distribution from a @c std::istream. */ + BOOST_RANDOM_DETAIL_ISTREAM_OPERATOR(is, uniform_int_distribution, ud) + { + param_type parm; + if(is >> parm) { + ud.param(parm); + } + return is; + } + + /** + * Returns true if the two distributions will produce identical sequences + * of values given equal generators. + */ + BOOST_RANDOM_DETAIL_EQUALITY_OPERATOR(uniform_int_distribution, lhs, rhs) + { return lhs._min == rhs._min && lhs._max == rhs._max; } + + /** + * Returns true if the two distributions may produce different sequences + * of values given equal generators. + */ + BOOST_RANDOM_DETAIL_INEQUALITY_OPERATOR(uniform_int_distribution) + +private: + IntType _min; + IntType _max; +}; + +} // namespace random +} // namespace boost + +#endif // BOOST_RANDOM_UNIFORM_INT_HPP diff --git a/3rdParty/Boost/src/boost/random/uniform_real.hpp b/3rdParty/Boost/src/boost/random/uniform_real.hpp deleted file mode 100644 index 06bfbc3..0000000 --- a/3rdParty/Boost/src/boost/random/uniform_real.hpp +++ /dev/null @@ -1,108 +0,0 @@ -/* boost random/uniform_real.hpp header file - * - * Copyright Jens Maurer 2000-2001 - * 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) - * - * See http://www.boost.org for most recent version including documentation. - * - * $Id: uniform_real.hpp 60755 2010-03-22 00:45:06Z steven_watanabe $ - * - * Revision history - * 2001-04-08 added min<max assertion (N. Becker) - * 2001-02-18 moved to individual header files - */ - -#ifndef BOOST_RANDOM_UNIFORM_REAL_HPP -#define BOOST_RANDOM_UNIFORM_REAL_HPP - -#include <cassert> -#include <iostream> -#include <boost/config.hpp> -#include <boost/limits.hpp> -#include <boost/static_assert.hpp> -#include <boost/random/detail/config.hpp> - -namespace boost { - -/** - * The distribution function uniform_real models a random distribution. - * On each invocation, it returns a random floating-point value uniformly - * distributed in the range [min..max). The value is computed using - * std::numeric_limits<RealType>::digits random binary digits, i.e. - * the mantissa of the floating-point value is completely filled with - * random bits. - * - * Note: The current implementation is buggy, because it may not fill - * all of the mantissa with random bits. - */ -template<class RealType = double> -class uniform_real -{ -public: - typedef RealType input_type; - typedef RealType result_type; - - /** - * Constructs a uniform_real object. @c min and @c max are the - * parameters of the distribution. - * - * Requires: min <= max - */ - explicit uniform_real(RealType min_arg = RealType(0), - RealType max_arg = RealType(1)) - : _min(min_arg), _max(max_arg) - { -#ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS - BOOST_STATIC_ASSERT(!std::numeric_limits<RealType>::is_integer); -#endif - assert(min_arg <= max_arg); - } - - // compiler-generated copy ctor and assignment operator are fine - - /** - * Returns: The "min" parameter of the distribution - */ - result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return _min; } - /** - * Returns: The "max" parameter of the distribution - */ - result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return _max; } - void reset() { } - - template<class Engine> - result_type operator()(Engine& eng) { - result_type numerator = static_cast<result_type>(eng() - eng.min BOOST_PREVENT_MACRO_SUBSTITUTION()); - result_type divisor = static_cast<result_type>(eng.max BOOST_PREVENT_MACRO_SUBSTITUTION() - eng.min BOOST_PREVENT_MACRO_SUBSTITUTION()); - assert(divisor > 0); - assert(numerator >= 0 && numerator <= divisor); - return numerator / divisor * (_max - _min) + _min; - } - -#ifndef BOOST_RANDOM_NO_STREAM_OPERATORS - template<class CharT, class Traits> - friend std::basic_ostream<CharT,Traits>& - operator<<(std::basic_ostream<CharT,Traits>& os, const uniform_real& ud) - { - os << ud._min << " " << ud._max; - return os; - } - - template<class CharT, class Traits> - friend std::basic_istream<CharT,Traits>& - operator>>(std::basic_istream<CharT,Traits>& is, uniform_real& ud) - { - is >> std::ws >> ud._min >> std::ws >> ud._max; - return is; - } -#endif - -private: - RealType _min, _max; -}; - -} // namespace boost - -#endif // BOOST_RANDOM_UNIFORM_REAL_HPP diff --git a/3rdParty/Boost/src/boost/random/variate_generator.hpp b/3rdParty/Boost/src/boost/random/variate_generator.hpp index 930d961..ac69800 100644 --- a/3rdParty/Boost/src/boost/random/variate_generator.hpp +++ b/3rdParty/Boost/src/boost/random/variate_generator.hpp @@ -1,34 +1,22 @@ /* boost random/variate_generator.hpp header file * * Copyright Jens Maurer 2002 + * Copyright Steven Watanabe 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) * * See http://www.boost.org for most recent version including documentation. * - * $Id: variate_generator.hpp 60755 2010-03-22 00:45:06Z steven_watanabe $ + * $Id: variate_generator.hpp 71018 2011-04-05 21:27:52Z steven_watanabe $ * */ #ifndef BOOST_RANDOM_RANDOM_GENERATOR_HPP #define BOOST_RANDOM_RANDOM_GENERATOR_HPP -#include <boost/config.hpp> - -// implementation details -#include <boost/detail/workaround.hpp> -#include <boost/random/uniform_01.hpp> -#include <boost/random/detail/pass_through_engine.hpp> -#include <boost/random/detail/uniform_int_float.hpp> #include <boost/random/detail/ptr_helper.hpp> -// Borland C++ 5.6.0 has problems using its numeric_limits traits as -// template parameters -#if BOOST_WORKAROUND(__BORLANDC__, <= 0x564) -#include <boost/type_traits/is_integral.hpp> -#endif - #include <boost/random/detail/disable_warnings.hpp> namespace boost { @@ -36,54 +24,6 @@ namespace boost { /// \cond hide_private_members namespace random { -namespace detail { - -template<bool have_int, bool want_int> -struct engine_helper; - -// for consistency, always have two levels of decorations -template<> -struct engine_helper<true, true> -{ - template<class Engine, class DistInputType> - struct impl - { - typedef pass_through_engine<Engine> type; - }; -}; - -template<> -struct engine_helper<false, false> -{ - template<class Engine, class DistInputType> - struct impl - { - typedef uniform_01<Engine, DistInputType> type; - }; -}; - -template<> -struct engine_helper<true, false> -{ - template<class Engine, class DistInputType> - struct impl - { - typedef uniform_01<Engine, DistInputType> type; - }; -}; - -template<> -struct engine_helper<false, true> -{ - template<class Engine, class DistInputType> - struct impl - { - typedef uniform_int_float<Engine, unsigned long> type; - }; -}; - -} // namespace detail -} // namespace random ///\endcond @@ -93,9 +33,6 @@ struct engine_helper<false, true> * Boost.Random provides a vast choice of \generators as well * as \distributions. * - * Instantations of class template @c variate_generator model - * a \number_generator. - * * The argument for the template parameter Engine shall be of * the form U, U&, or U*, where U models a * \uniform_random_number_generator. Then, the member @@ -114,107 +51,72 @@ template<class Engine, class Distribution> class variate_generator { private: - typedef random::detail::pass_through_engine<Engine> decorated_engine; - + typedef boost::random::detail::ptr_helper<Engine> helper_type; public: - typedef typename decorated_engine::base_type engine_value_type; - typedef Engine engine_type; - typedef Distribution distribution_type; - typedef typename Distribution::result_type result_type; - - /** - * Constructs a @c variate_generator object with the associated - * \uniform_random_number_generator eng and the associated - * \random_distribution d. - * - * Throws: If and what the copy constructor of Engine or - * Distribution throws. - */ - variate_generator(Engine e, Distribution d) - : _eng(decorated_engine(e)), _dist(d) { } - - /** - * Returns: distribution()(e) - * - * Notes: The sequence of numbers produced by the - * \uniform_random_number_generator e, s<sub>e</sub>, is - * obtained from the sequence of numbers produced by the - * associated \uniform_random_number_generator eng, s<sub>eng</sub>, - * as follows: Consider the values of @c numeric_limits<T>::is_integer - * for @c T both @c Distribution::input_type and - * @c engine_value_type::result_type. If the values for both types are - * true, then se is identical to s<sub>eng</sub>. Otherwise, if the - * values for both types are false, then the numbers in s<sub>eng</sub> - * are divided by engine().max()-engine().min() to obtain the numbers - * in s<sub>e</sub>. Otherwise, if the value for - * @c engine_value_type::result_type is true and the value for - * @c Distribution::input_type is false, then the numbers in s<sub>eng</sub> - * are divided by engine().max()-engine().min()+1 to obtain the numbers in - * s<sub>e</sub>. Otherwise, the mapping from s<sub>eng</sub> to - * s<sub>e</sub> is implementation-defined. In all cases, an - * implicit conversion from @c engine_value_type::result_type to - * @c Distribution::input_type is performed. If such a conversion does - * not exist, the program is ill-formed. - */ - result_type operator()() { return _dist(_eng); } - /** - * Returns: distribution()(e, value). - * For the semantics of e, see the description of operator()(). - */ - template<class T> - result_type operator()(T value) { return _dist(_eng, value); } - - /** - * Returns: A reference to the associated uniform random number generator. - */ - engine_value_type& engine() { return _eng.base().base(); } - /** - * Returns: A reference to the associated uniform random number generator. - */ - const engine_value_type& engine() const { return _eng.base().base(); } - - /** - * Returns: A reference to the associated random distribution. - */ - distribution_type& distribution() { return _dist; } - /** - * Returns: A reference to the associated random distribution. - */ - const distribution_type& distribution() const { return _dist; } - - /** - * Precondition: distribution().min() is well-formed - * - * Returns: distribution().min() - */ - result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return (distribution().min)(); } - /** - * Precondition: distribution().max() is well-formed - * - * Returns: distribution().max() - */ - result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return (distribution().max)(); } + typedef typename helper_type::value_type engine_value_type; + typedef Engine engine_type; + typedef Distribution distribution_type; + typedef typename Distribution::result_type result_type; + + /** + * Constructs a @c variate_generator object with the associated + * \uniform_random_number_generator eng and the associated + * \random_distribution d. + * + * Throws: If and what the copy constructor of Engine or + * Distribution throws. + */ + variate_generator(Engine e, Distribution d) + : _eng(e), _dist(d) { } + + /** Returns: distribution()(engine()) */ + result_type operator()() { return _dist(engine()); } + /** + * Returns: distribution()(engine(), value). + */ + template<class T> + result_type operator()(const T& value) { return _dist(engine(), value); } + + /** + * Returns: A reference to the associated uniform random number generator. + */ + engine_value_type& engine() { return helper_type::ref(_eng); } + /** + * Returns: A reference to the associated uniform random number generator. + */ + const engine_value_type& engine() const { return helper_type::ref(_eng); } + + /** Returns: A reference to the associated \random_distribution. */ + distribution_type& distribution() { return _dist; } + /** + * Returns: A reference to the associated random distribution. + */ + const distribution_type& distribution() const { return _dist; } + + /** + * Precondition: distribution().min() is well-formed + * + * Returns: distribution().min() + */ + result_type min BOOST_PREVENT_MACRO_SUBSTITUTION () const { return (distribution().min)(); } + /** + * Precondition: distribution().max() is well-formed + * + * Returns: distribution().max() + */ + result_type max BOOST_PREVENT_MACRO_SUBSTITUTION () const { return (distribution().max)(); } private: -#if BOOST_WORKAROUND(__BORLANDC__, <= 0x564) - typedef typename random::detail::engine_helper< - ::boost::is_integral<typename decorated_engine::result_type>::value, - ::boost::is_integral<typename Distribution::input_type>::value - >::BOOST_NESTED_TEMPLATE impl<decorated_engine, typename Distribution::input_type>::type internal_engine_type; -#else - enum { - have_int = std::numeric_limits<typename decorated_engine::result_type>::is_integer, - want_int = std::numeric_limits<typename Distribution::input_type>::is_integer - }; - typedef typename random::detail::engine_helper<have_int, want_int>::BOOST_NESTED_TEMPLATE impl<decorated_engine, typename Distribution::input_type>::type internal_engine_type; -#endif - - internal_engine_type _eng; - distribution_type _dist; + Engine _eng; + distribution_type _dist; }; +} // namespace random + +using random::variate_generator; + } // namespace boost -#include <boost/random/detail/disable_warnings.hpp> +#include <boost/random/detail/enable_warnings.hpp> #endif // BOOST_RANDOM_RANDOM_GENERATOR_HPP diff --git a/3rdParty/Boost/src/boost/range/algorithm/equal.hpp b/3rdParty/Boost/src/boost/range/algorithm/equal.hpp old mode 100755 new mode 100644 index a3ebc29..4472bb1 --- a/3rdParty/Boost/src/boost/range/algorithm/equal.hpp +++ b/3rdParty/Boost/src/boost/range/algorithm/equal.hpp @@ -31,7 +31,7 @@ namespace boost IteratorCategoryTag1, IteratorCategoryTag2 ) { - do + while (true) { // If we have reached the end of the left range then this is // the end of the loop. They are equal if and only if we have @@ -46,7 +46,12 @@ namespace boost return false; // continue looping if and only if the values are equal - } while(*first1++ == *first2++); + if (*first1 != *first2) + break; + + ++first1; + ++first2; + } // Reaching this line in the algorithm indicates that a value // inequality has been detected. @@ -66,7 +71,7 @@ namespace boost IteratorCategoryTag1, IteratorCategoryTag2 ) { - do + while (true) { // If we have reached the end of the left range then this is // the end of the loop. They are equal if and only if we have @@ -81,7 +86,12 @@ namespace boost return false; // continue looping if and only if the values are equal - } while(pred(*first1++, *first2++)); + if (!pred(*first1, *first2)) + break; + + ++first1; + ++first2; + } // Reaching this line in the algorithm indicates that a value // inequality has been detected. @@ -182,7 +192,7 @@ namespace boost } } // namespace range - using range::equal; + using ::boost::range::equal; } // namespace boost #endif // include guard diff --git a/3rdParty/Boost/src/boost/range/as_literal.hpp b/3rdParty/Boost/src/boost/range/as_literal.hpp index f67ead7..9ea144d 100644 --- a/3rdParty/Boost/src/boost/range/as_literal.hpp +++ b/3rdParty/Boost/src/boost/range/as_literal.hpp @@ -74,7 +74,7 @@ namespace boost #endif template< class T > - inline long is_char_ptr( T /* r */ ) + inline long is_char_ptr( const T& /* r */ ) { return 0L; } diff --git a/3rdParty/Boost/src/boost/range/detail/detail_str.hpp b/3rdParty/Boost/src/boost/range/detail/detail_str.hpp index d5ad5b3..5ef7a34 100644 --- a/3rdParty/Boost/src/boost/range/detail/detail_str.hpp +++ b/3rdParty/Boost/src/boost/range/detail/detail_str.hpp @@ -134,8 +134,8 @@ namespace boost #include <boost/range/detail/begin.hpp> #include <boost/range/detail/end.hpp> -#include <boost/range/detail/size_type> -#include <boost/range/detail/value_type> +#include <boost/range/detail/size_type.hpp> +#include <boost/range/detail/value_type.hpp> #include <boost/range/detail/common.hpp> namespace boost diff --git a/3rdParty/Boost/src/boost/range/detail/extract_optional_type.hpp b/3rdParty/Boost/src/boost/range/detail/extract_optional_type.hpp old mode 100755 new mode 100644 diff --git a/3rdParty/Boost/src/boost/range/detail/misc_concept.hpp b/3rdParty/Boost/src/boost/range/detail/misc_concept.hpp old mode 100755 new mode 100644 diff --git a/3rdParty/Boost/src/boost/range/detail/size_type.hpp b/3rdParty/Boost/src/boost/range/detail/size_type.hpp index ec49f4d..78a60a4 100644 --- a/3rdParty/Boost/src/boost/range/detail/size_type.hpp +++ b/3rdParty/Boost/src/boost/range/detail/size_type.hpp @@ -17,52 +17,37 @@ // missing partial specialization workaround. ////////////////////////////////////////////////////////////////////////////// -namespace boost +namespace boost { - namespace range_detail - { + namespace range_detail + { template< typename T > - struct range_size_type_; - - template<> - struct range_size_type_<std_container_> + struct range_size_type_ { template< typename C > struct pts { - typedef BOOST_RANGE_DEDUCED_TYPENAME C::size_type type; - }; - }; - - template<> - struct range_size_type_<std_pair_> - { - template< typename P > - struct pts - { typedef std::size_t type; }; }; template<> - struct range_size_type_<array_> + struct range_size_type_<std_container_> { - template< typename A > + template< typename C > struct pts { - typedef std::size_t type; + typedef BOOST_RANGE_DEDUCED_TYPENAME C::size_type type; }; }; + } - - } - template< typename C > class range_size { typedef typename range_detail::range<C>::type c_type; public: - typedef typename range_detail::range_size_type_<c_type>::BOOST_NESTED_TEMPLATE pts<C>::type type; + typedef typename range_detail::range_size_type_<c_type>::BOOST_NESTED_TEMPLATE pts<C>::type type; }; } diff --git a/3rdParty/Boost/src/boost/range/detail/value_type.hpp b/3rdParty/Boost/src/boost/range/detail/value_type.hpp new file mode 100644 index 0000000..2784514 --- /dev/null +++ b/3rdParty/Boost/src/boost/range/detail/value_type.hpp @@ -0,0 +1,72 @@ +// Boost.Range library +// +// Copyright Thorsten Ottosen 2003-2004. 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) +// +// For more information, see http://www.boost.org/libs/range/ +// + +#ifndef BOOST_RANGE_DETAIL_VALUE_TYPE_HPP +#define BOOST_RANGE_DETAIL_VALUE_TYPE_HPP + +#include <boost/range/detail/common.hpp> +#include <boost/range/detail/remove_extent.hpp> +#include <boost/iterator/iterator_traits.hpp> + +////////////////////////////////////////////////////////////////////////////// +// missing partial specialization workaround. +////////////////////////////////////////////////////////////////////////////// + +namespace boost +{ + namespace range_detail + { + template< typename T > + struct range_value_type_; + + template<> + struct range_value_type_<std_container_> + { + template< typename C > + struct pts + { + typedef BOOST_RANGE_DEDUCED_TYPENAME C::value_type type; + }; + }; + + template<> + struct range_value_type_<std_pair_> + { + template< typename P > + struct pts + { + typedef BOOST_RANGE_DEDUCED_TYPENAME boost::iterator_value< BOOST_RANGE_DEDUCED_TYPENAME P::first_type >::type type; + }; + }; + + template<> + struct range_value_type_<array_> + { + template< typename T > + struct pts + { + typedef BOOST_DEDUCED_TYPENAME remove_extent<T>::type type; + }; + }; + + } + + template< typename C > + class range_value + { + typedef BOOST_DEDUCED_TYPENAME range_detail::range<C>::type c_type; + public: + typedef BOOST_DEDUCED_TYPENAME range_detail::range_value_type_<c_type>::BOOST_NESTED_TEMPLATE pts<C>::type type; + }; + +} + +#endif + diff --git a/3rdParty/Boost/src/boost/range/iterator_range_core.hpp b/3rdParty/Boost/src/boost/range/iterator_range_core.hpp old mode 100755 new mode 100644 index 7ef7523..60c7670 --- a/3rdParty/Boost/src/boost/range/iterator_range_core.hpp +++ b/3rdParty/Boost/src/boost/range/iterator_range_core.hpp @@ -53,13 +53,13 @@ namespace boost template< class ForwardRange > static IteratorT adl_begin( ForwardRange& r ) { - return IteratorT( boost::begin( r ) ); + return static_cast<IteratorT>( boost::begin( r ) ); } template< class ForwardRange > static IteratorT adl_end( ForwardRange& r ) { - return IteratorT( boost::end( r ) ); + return static_cast<IteratorT>( boost::end( r ) ); } }; @@ -71,6 +71,24 @@ namespace boost boost::begin(r), boost::end(r) ); } + + template< class Left, class Right > + inline bool greater_than( const Left& l, const Right& r ) + { + return less_than(r,l); + } + + template< class Left, class Right > + inline bool less_or_equal_than( const Left& l, const Right& r ) + { + return !iterator_range_detail::less_than(r,l); + } + + template< class Left, class Right > + inline bool greater_or_equal_than( const Left& l, const Right& r ) + { + return !iterator_range_detail::less_than(l,r); + } // This version is maintained since it is used in other boost libraries // such as Boost.Assign @@ -231,7 +249,7 @@ namespace boost difference_type size() const { - return m_End - m_Begin; + return m_End - m_Begin; } bool empty() const @@ -271,6 +289,21 @@ namespace boost { return iterator_range_detail::less_than( *this, r ); } + + bool operator>( const iterator_range& r ) const + { + return iterator_range_detail::greater_than( *this, r ); + } + + bool operator<=( const iterator_range& r ) const + { + return iterator_range_detail::less_or_equal_than( *this, r ); + } + + bool operator>=( const iterator_range& r ) const + { + return iterator_range_detail::greater_or_equal_than( *this, r ); + } #endif @@ -370,6 +403,27 @@ namespace boost { return iterator_range_detail::less_than( l, r ); } + + template< class IteratorT, class ForwardRange > + inline bool operator<=( const ForwardRange& l, + const iterator_range<IteratorT>& r ) + { + return iterator_range_detail::less_or_equal_than( l, r ); + } + + template< class IteratorT, class ForwardRange > + inline bool operator>( const ForwardRange& l, + const iterator_range<IteratorT>& r ) + { + return iterator_range_detail::greater_than( l, r ); + } + + template< class IteratorT, class ForwardRange > + inline bool operator>=( const ForwardRange& l, + const iterator_range<IteratorT>& r ) + { + return iterator_range_detail::greater_or_equal_than( l, r ); + } #ifdef BOOST_NO_FUNCTION_TEMPLATE_ORDERING #else @@ -416,6 +470,48 @@ namespace boost { return iterator_range_detail::less_than( l, r ); } + + template< class Iterator1T, class Iterator2T > + inline bool operator<=( const iterator_range<Iterator1T>& l, + const iterator_range<Iterator2T>& r ) + { + return iterator_range_detail::less_or_equal_than( l, r ); + } + + template< class IteratorT, class ForwardRange > + inline bool operator<=( const iterator_range<IteratorT>& l, + const ForwardRange& r ) + { + return iterator_range_detail::less_or_equal_than( l, r ); + } + + template< class Iterator1T, class Iterator2T > + inline bool operator>( const iterator_range<Iterator1T>& l, + const iterator_range<Iterator2T>& r ) + { + return iterator_range_detail::greater_than( l, r ); + } + + template< class IteratorT, class ForwardRange > + inline bool operator>( const iterator_range<IteratorT>& l, + const ForwardRange& r ) + { + return iterator_range_detail::greater_than( l, r ); + } + + template< class Iterator1T, class Iterator2T > + inline bool operator>=( const iterator_range<Iterator1T>& l, + const iterator_range<Iterator2T>& r ) + { + return iterator_range_detail::greater_or_equal_than( l, r ); + } + + template< class IteratorT, class ForwardRange > + inline bool operator>=( const iterator_range<IteratorT>& l, + const ForwardRange& r ) + { + return iterator_range_detail::greater_or_equal_than( l, r ); + } #endif // BOOST_NO_FUNCTION_TEMPLATE_ORDERING diff --git a/3rdParty/Boost/src/boost/range/iterator_range_io.hpp b/3rdParty/Boost/src/boost/range/iterator_range_io.hpp old mode 100755 new mode 100644 diff --git a/3rdParty/Boost/src/boost/range/size.hpp b/3rdParty/Boost/src/boost/range/size.hpp index 4b4eebe..6ae74d1 100644 --- a/3rdParty/Boost/src/boost/range/size.hpp +++ b/3rdParty/Boost/src/boost/range/size.hpp @@ -18,7 +18,7 @@ #include <boost/range/config.hpp> #include <boost/range/begin.hpp> #include <boost/range/end.hpp> -#include <boost/range/difference_type.hpp> +#include <boost/range/size_type.hpp> #include <boost/assert.hpp> namespace boost @@ -26,7 +26,7 @@ namespace boost namespace range_detail { template<class SinglePassRange> - inline BOOST_DEDUCED_TYPENAME range_difference<SinglePassRange>::type + inline BOOST_DEDUCED_TYPENAME range_size<const SinglePassRange>::type range_calculate_size(const SinglePassRange& rng) { BOOST_ASSERT( (boost::end(rng) - boost::begin(rng)) >= 0 && @@ -36,7 +36,7 @@ namespace boost } template<class SinglePassRange> - inline BOOST_DEDUCED_TYPENAME range_difference<SinglePassRange>::type + inline BOOST_DEDUCED_TYPENAME range_size<const SinglePassRange>::type size(const SinglePassRange& rng) { #if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564)) && \ diff --git a/3rdParty/Boost/src/boost/range/size_type.hpp b/3rdParty/Boost/src/boost/range/size_type.hpp index 8c184f8..c6fb54b 100644 --- a/3rdParty/Boost/src/boost/range/size_type.hpp +++ b/3rdParty/Boost/src/boost/range/size_type.hpp @@ -16,11 +16,13 @@ #endif #include <boost/range/config.hpp> - +#include <boost/range/difference_type.hpp> #ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION #include <boost/range/detail/size_type.hpp> #else +#include <boost/utility/enable_if.hpp> +#include <boost/type_traits/make_unsigned.hpp> #include <boost/type_traits/remove_const.hpp> #include <cstddef> #include <utility> @@ -33,36 +35,44 @@ namespace boost ////////////////////////////////////////////////////////////////////////// // default ////////////////////////////////////////////////////////////////////////// - - template< typename C > - struct range_size + + template<typename T> + class has_size_type { - typedef BOOST_DEDUCED_TYPENAME C::size_type type; + typedef char no_type; + struct yes_type { char dummy[2]; }; + + template<typename C> + static yes_type test(BOOST_DEDUCED_TYPENAME C::size_type x); + + template<typename C, typename Arg> + static no_type test(Arg x); + + public: + static const bool value = sizeof(test<T>(0)) == sizeof(yes_type); }; - - ////////////////////////////////////////////////////////////////////////// - // pair - ////////////////////////////////////////////////////////////////////////// - - template< typename Iterator > - struct range_size< std::pair<Iterator,Iterator> > + + template<typename C, typename Enabler=void> + struct range_size { - typedef std::size_t type; + typedef BOOST_DEDUCED_TYPENAME make_unsigned< + BOOST_DEDUCED_TYPENAME range_difference<C>::type + >::type type; }; - - ////////////////////////////////////////////////////////////////////////// - // array - ////////////////////////////////////////////////////////////////////////// - - template< typename T, std::size_t sz > - struct range_size< T[sz] > + + template<typename C> + struct range_size< + C, + BOOST_DEDUCED_TYPENAME enable_if<has_size_type<C>, void>::type + > { - typedef std::size_t type; + typedef BOOST_DEDUCED_TYPENAME C::size_type type; }; + } template< class T > - struct range_size : + struct range_size : detail::range_size<T> { }; @@ -70,7 +80,7 @@ namespace boost struct range_size<const T > : detail::range_size<T> { }; - + } // namespace boost #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION diff --git a/3rdParty/Boost/src/boost/ratio/config.hpp b/3rdParty/Boost/src/boost/ratio/config.hpp new file mode 100644 index 0000000..67a60fc --- /dev/null +++ b/3rdParty/Boost/src/boost/ratio/config.hpp @@ -0,0 +1,86 @@ +// config.hpp ---------------------------------------------------------------// + +// Copyright 2012 Vicente J. Botet Escriba + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + + +#ifndef BOOST_RATIO_CONFIG_HPP +#define BOOST_RATIO_CONFIG_HPP + +#include <boost/config.hpp> +#include <boost/cstdint.hpp> + + +#if __GNUC__ < 4 || (__GNUC__ == 4 && __GNUC_MINOR__ < 5) || !defined(__GXX_EXPERIMENTAL_CXX0X__) +# if ! defined BOOST_NO_CXX11_U16STRING +# define BOOST_NO_CXX11_U16STRING +# endif +# if ! defined BOOST_NO_CXX11_U32STRING +# define BOOST_NO_CXX11_U32STRING +# endif +#endif + + +#if !defined BOOST_RATIO_VERSION +#define BOOST_RATIO_VERSION 1 +#else +#if BOOST_RATIO_VERSION!=1 && BOOST_RATIO_VERSION!=2 +#error "BOOST_RATIO_VERSION must be 1 or 2" +#endif +#endif + +#if BOOST_RATIO_VERSION==1 +#if ! defined BOOST_RATIO_DONT_PROVIDE_DEPRECATED_FEATURES_SINCE_V2_0_0 +#define BOOST_RATIO_PROVIDES_DEPRECATED_FEATURES_SINCE_V2_0_0 +#endif +#endif + +#if BOOST_RATIO_VERSION==2 +#if ! defined BOOST_RATIO_PROVIDES_DEPRECATED_FEATURES_SINCE_V2_0_0 +#define BOOST_RATIO_DONT_PROVIDE_DEPRECATED_FEATURES_SINCE_V2_0_0 +#endif +#endif + +#ifdef INTMAX_C +#define BOOST_RATIO_INTMAX_C(a) INTMAX_C(a) +#else +#define BOOST_RATIO_INTMAX_C(a) a##LL +#endif + +#define BOOST_RATIO_INTMAX_T_MAX (0x7FFFFFFFFFFFFFFELL) + + +#ifndef BOOST_NO_CXX11_STATIC_ASSERT +#define BOOST_RATIO_STATIC_ASSERT(CND, MSG, TYPES) static_assert(CND,MSG) +#elif defined(BOOST_RATIO_USES_STATIC_ASSERT) +#include <boost/static_assert.hpp> +#define BOOST_RATIO_STATIC_ASSERT(CND, MSG, TYPES) BOOST_STATIC_ASSERT(CND) +#elif defined(BOOST_RATIO_USES_MPL_ASSERT) +#include <boost/mpl/assert.hpp> +#include <boost/mpl/bool.hpp> +#define BOOST_RATIO_STATIC_ASSERT(CND, MSG, TYPES) \ + BOOST_MPL_ASSERT_MSG(boost::mpl::bool_< (CND) >::type::value, MSG, TYPES) +#else +//~ #elif defined(BOOST_RATIO_USES_ARRAY_ASSERT) +#define BOOST_RATIO_CONCAT(A,B) A##B +#define BOOST_RATIO_NAME(A,B) BOOST_RATIO_CONCAT(A,B) +#define BOOST_RATIO_STATIC_ASSERT(CND, MSG, TYPES) static char BOOST_RATIO_NAME(__boost_ratio_test_,__LINE__)[(CND)?1:-1] +//~ #define BOOST_RATIO_STATIC_ASSERT(CND, MSG, TYPES) +#endif + +#if !defined(BOOST_NO_CXX11_STATIC_ASSERT) || !defined(BOOST_RATIO_USES_MPL_ASSERT) +#define BOOST_RATIO_OVERFLOW_IN_ADD "overflow in ratio add" +#define BOOST_RATIO_OVERFLOW_IN_SUB "overflow in ratio sub" +#define BOOST_RATIO_OVERFLOW_IN_MUL "overflow in ratio mul" +#define BOOST_RATIO_OVERFLOW_IN_DIV "overflow in ratio div" +#define BOOST_RATIO_NUMERATOR_IS_OUT_OF_RANGE "ratio numerator is out of range" +#define BOOST_RATIO_DIVIDE_BY_0 "ratio divide by 0" +#define BOOST_RATIO_DENOMINATOR_IS_OUT_OF_RANGE "ratio denominator is out of range" +#endif + + +//#define BOOST_RATIO_EXTENSIONS + +#endif // header diff --git a/3rdParty/Boost/src/boost/ratio/detail/mpl/abs.hpp b/3rdParty/Boost/src/boost/ratio/detail/mpl/abs.hpp new file mode 100644 index 0000000..4be1274 --- /dev/null +++ b/3rdParty/Boost/src/boost/ratio/detail/mpl/abs.hpp @@ -0,0 +1,89 @@ +//////////////////////////////////////////////////////////////////// +// +// Copyright Vicente J. Botet Escriba 2010 +// +// 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) +// +// See http://www.boost.org/libs/mpl for documentation. +// +//////////////////////////////////////////////////////////////////// +#ifndef BOOST_MPL_ABS_HPP_INCLUDED +#define BOOST_MPL_ABS_HPP_INCLUDED + +#include <boost/mpl/integral_c.hpp> +#include <boost/mpl/aux_/na_spec.hpp> +#include <boost/mpl/aux_/lambda_support.hpp> +#include <boost/mpl/aux_/config/eti.hpp> +#include <boost/mpl/aux_/config/integral.hpp> +#include <boost/mpl/aux_/config/static_constant.hpp> + +#if !defined(BOOST_MPL_CFG_NO_NESTED_VALUE_ARITHMETIC_2) \ + && !defined(BOOST_MPL_PREPROCESSING_MODE) \ + && ( defined(BOOST_MSVC) \ + || BOOST_WORKAROUND(__EDG_VERSION__, <= 238) \ + ) + +# define BOOST_MPL_CFG_NO_NESTED_VALUE_ARITHMETIC_2 + +#endif + +namespace boost { namespace mpl { + +template< typename Tag > struct abs_impl; + +template< typename T > struct abs_tag +{ + typedef typename T::tag type; +}; + +template< + typename BOOST_MPL_AUX_NA_PARAM(N) + > +struct abs + : abs_impl< + typename abs_tag<N>::type + >::template apply<N>::type +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT(1, abs, (N)) +}; + +BOOST_MPL_AUX_NA_SPEC(1, abs) + +template< + typename T + , T n1 + > +struct abs_c + : abs<integral_c<T,n1> > +{ +}; + +#if defined(BOOST_MPL_CFG_NO_NESTED_VALUE_ARITHMETIC_2) +namespace aux { +template< typename T, T n > struct abs_wknd +{ + BOOST_STATIC_CONSTANT(T, value = (n < 0 ? -n : n)); + typedef integral_c<T,value> type; +}; +} +#endif + +template<> +struct abs_impl<integral_c_tag> +{ +#if defined(BOOST_MPL_CFG_NO_NESTED_VALUE_ARITHMETIC_2) + template< typename N > struct apply + : aux::abs_wknd< typename N::value_type, N::value > +#else + template< typename N > struct apply + : integral_c< typename N::value_type, ((N::value < 0) ? (-N::value) : N::value ) > +#endif + { + }; +}; + +}} + +#endif // BOOST_MPL_ABS_HPP_INCLUDED diff --git a/3rdParty/Boost/src/boost/ratio/detail/mpl/gcd.hpp b/3rdParty/Boost/src/boost/ratio/detail/mpl/gcd.hpp new file mode 100644 index 0000000..c8258cf --- /dev/null +++ b/3rdParty/Boost/src/boost/ratio/detail/mpl/gcd.hpp @@ -0,0 +1,124 @@ +//////////////////////////////////////////////////////////////////// +// +// Copyright Vicente J. Botet Escriba 2010 +// +// 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) +// +// See http://www.boost.org/libs/mpl for documentation. +// +//////////////////////////////////////////////////////////////////// +#ifndef BOOST_MPL_GCD_HPP_INCLUDED +#define BOOST_MPL_GCD_HPP_INCLUDED + +#include <boost/mpl/integral_c.hpp> +#include <boost/ratio/detail/mpl/abs.hpp> +#include <boost/mpl/aux_/largest_int.hpp> +#include <boost/mpl/aux_/na_spec.hpp> +#include <boost/mpl/aux_/lambda_support.hpp> +#include <boost/mpl/aux_/config/eti.hpp> +#include <boost/mpl/aux_/config/integral.hpp> +#include <boost/mpl/aux_/config/static_constant.hpp> +#include <boost/mpl/aux_/config/dependent_nttp.hpp> +#include <boost/cstdint.hpp> + +#if !defined(BOOST_MPL_CFG_NO_NESTED_VALUE_ARITHMETIC_2) \ + && !defined(BOOST_MPL_PREPROCESSING_MODE) \ + && ( defined(BOOST_MSVC) \ + || BOOST_WORKAROUND(__EDG_VERSION__, <= 238) \ + ) + +# define BOOST_MPL_CFG_NO_NESTED_VALUE_ARITHMETIC_2 + +#endif + +namespace boost { namespace mpl { + +template< typename Tag1, typename Tag2 > struct gcd_impl; + +template< typename T > struct gcd_tag +{ + typedef typename T::tag type; +}; + +template< + typename BOOST_MPL_AUX_NA_PARAM(N1) + , typename BOOST_MPL_AUX_NA_PARAM(N2) + > +struct gcd + : gcd_impl< + typename gcd_tag<N1>::type + , typename gcd_tag<N2>::type + >::template apply<N1, N2>::type +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT(2, gcd, (N1, N2)) +}; + +BOOST_MPL_AUX_NA_SPEC(2, gcd) + +template< + typename T + , T n1 + , T n2 + > +struct gcd_c + : gcd<integral_c<T,n1>,integral_c<T,n2> > +{ +}; + +namespace aux { + + // Workaround for error: the type of partial specialization template parameter constant "n2" + // depends on another template parameter + // Note: this solution could be wrong for n1 or n2 = [2**63 .. 2**64-1] +#if defined(BOOST_MPL_CFG_NO_DEPENDENT_NONTYPE_PARAMETER_IN_PARTIAL_SPEC) + + template< typename T1, boost::intmax_t n1, bool n1_is_0 + , typename T2, boost::intmax_t n2, bool n2_is_0 > + struct gcd_aux + : gcd_aux<T2, n2, n2==0, T1, (n1 % n2), (n1 % n2)==0> + {}; + + template <typename T1, boost::intmax_t n1, typename T2, boost::intmax_t n2> + struct gcd_aux<T1, n1, false, T2, n2, true> : integral_c<T1, n1> + {}; + + template <typename T1, boost::intmax_t n1, typename T2, boost::intmax_t n2, bool C> + struct gcd_aux<T1, n1, true, T2, n2, C> : integral_c<T2, n2> + {}; + +#else // defined(BOOST_MPL_CFG_NO_DEPENDENT_NONTYPE_PARAMETER_IN_PARTIAL_SPEC) + + template< typename T1, T1 n1, bool n1_is_0, typename T2, T2 n2, bool n2_is_0 > + struct gcd_aux + + : gcd_aux<T2, n2, n2==0, + typename aux::largest_int<T1, T2>::type, + //~ T1, + (n1 % n2), (n1 % n2)==0> + {}; + + template <typename T1, T1 n1, typename T2, T2 n2> + struct gcd_aux<T1, n1, false, T2, n2, true> : integral_c<T1, n1> + {}; + + template <typename T1, T1 n1, typename T2, T2 n2, bool C> + struct gcd_aux<T1, n1, true, T2, n2, C> : integral_c<T2, n2> + {}; +#endif // defined(BOOST_MPL_CFG_NO_DEPENDENT_NONTYPE_PARAMETER_IN_PARTIAL_SPEC) +} + +template<> +struct gcd_impl<integral_c_tag, integral_c_tag> +{ + template< typename N1, typename N2 > struct apply + : abs<aux::gcd_aux< typename N1::value_type, N1::value, N1::value==0, + typename N2::value_type, N2::value, N2::value==0 > > + { + }; +}; + +}} + +#endif // BOOST_MPL_GCD_HPP_INCLUDED diff --git a/3rdParty/Boost/src/boost/ratio/detail/mpl/lcm.hpp b/3rdParty/Boost/src/boost/ratio/detail/mpl/lcm.hpp new file mode 100644 index 0000000..546d0e1 --- /dev/null +++ b/3rdParty/Boost/src/boost/ratio/detail/mpl/lcm.hpp @@ -0,0 +1,126 @@ +//////////////////////////////////////////////////////////////////// +// +// Copyright Vicente J. Botet Escriba 2010 +// +// 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) +// +// See http://www.boost.org/libs/mpl for documentation. +// +//////////////////////////////////////////////////////////////////// +#ifndef BOOST_MPL_LCM_HPP_INCLUDED +#define BOOST_MPL_LCM_HPP_INCLUDED + +#include <boost/mpl/integral_c.hpp> +#include <boost/ratio/detail/mpl/abs.hpp> +#include <boost/mpl/aux_/largest_int.hpp> +#include <boost/mpl/aux_/na_spec.hpp> +#include <boost/mpl/aux_/lambda_support.hpp> +#include <boost/mpl/aux_/config/eti.hpp> +#include <boost/mpl/aux_/config/integral.hpp> +#include <boost/mpl/aux_/config/static_constant.hpp> +#include <boost/mpl/aux_/config/dependent_nttp.hpp> +#include <boost/cstdint.hpp> + +#if !defined(BOOST_MPL_CFG_NO_NESTED_VALUE_ARITHMETIC_2) \ + && !defined(BOOST_MPL_PREPROCESSING_MODE) \ + && ( defined(BOOST_MSVC) \ + || BOOST_WORKAROUND(__EDG_VERSION__, <= 238) \ + ) + +# define BOOST_MPL_CFG_NO_NESTED_VALUE_ARITHMETIC_2 + +#endif + +namespace boost { namespace mpl { + +template< typename Tag1, typename Tag2 > struct lcm_impl; + +template< typename T > struct lcm_tag +{ + typedef typename T::tag type; +}; + +template< + typename BOOST_MPL_AUX_NA_PARAM(N1) + , typename BOOST_MPL_AUX_NA_PARAM(N2) + > +struct lcm + : lcm_impl< + typename lcm_tag<N1>::type + , typename lcm_tag<N2>::type + >::template apply<N1, N2>::type +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT(2, lcm, (N1, N2)) +}; + +BOOST_MPL_AUX_NA_SPEC(2, lcm) + +template< + typename T + , T n1 + , T n2 + > +struct lcm_c + : lcm<integral_c<T,n1>,integral_c<T,n2> > +{ +}; + + +namespace aux { + // Workaround for error: the type of partial specialization template parameter constant "n2" + // depends on another template parameter + // Note: this solution could be wrong for n1 or n2 = [2**63 .. 2**64-1] + #if defined(BOOST_MPL_CFG_NO_DEPENDENT_NONTYPE_PARAMETER_IN_PARTIAL_SPEC) + template< typename T1, boost::intmax_t n1, bool n1_is_0 + , typename T2, boost::intmax_t n2, bool n2_is_0 > + struct lcm_aux + : abs<integral_c< typename aux::largest_int<T1, T2>::type, + ( n1 / gcd<integral_c<T1,n1>, integral_c<T2,n2> >::value * n2 ) + > > + {}; + + template <typename T1, boost::intmax_t n1, typename T2, boost::intmax_t n2> + struct lcm_aux<T1, n1, false, T2, n2, true> : integral_c<T2, 0> + {}; + + template <typename T1, boost::intmax_t n1, typename T2, boost::intmax_t n2, bool C> + struct lcm_aux<T1, n1, true, T2, n2, C> : integral_c<T1, 0> + {}; + + +#else // defined(BOOST_MPL_CFG_NO_DEPENDENT_NONTYPE_PARAMETER_IN_PARTIAL_SPEC) + + + template< typename T1, T1 n1, bool n1_is_0, typename T2, T2 n2, bool n2_is_0 > + struct lcm_aux + + : abs<integral_c< typename aux::largest_int<T1, T2>::type, + ( n1 / gcd<integral_c<T1,n1>, integral_c<T2,n2> >::value * n2 ) + > > + {}; + + template <typename T1, T1 n1, typename T2, T2 n2> + struct lcm_aux<T1, n1, false, T2, n2, true> : integral_c<T2, 0> + {}; + + template <typename T1, T1 n1, typename T2, T2 n2, bool C> + struct lcm_aux<T1, n1, true, T2, n2, C> : integral_c<T1, 0> + {}; +#endif // defined(BOOST_MPL_CFG_NO_DEPENDENT_NONTYPE_PARAMETER_IN_PARTIAL_SPEC) +} + +template<> +struct lcm_impl<integral_c_tag, integral_c_tag> +{ + template< typename N1, typename N2 > struct apply + : abs<aux::lcm_aux< typename N1::value_type, N1::value, N1::value==0, + typename N2::value_type, N2::value, N2::value==0 > > + { + }; +}; + +}} + +#endif // BOOST_MPL_LCM_HPP_INCLUDED diff --git a/3rdParty/Boost/src/boost/ratio/detail/mpl/sign.hpp b/3rdParty/Boost/src/boost/ratio/detail/mpl/sign.hpp new file mode 100644 index 0000000..af201eb --- /dev/null +++ b/3rdParty/Boost/src/boost/ratio/detail/mpl/sign.hpp @@ -0,0 +1,89 @@ +//////////////////////////////////////////////////////////////////// +// +// Copyright Vicente J. Botet Escriba 2010 +// +// 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) +// +// See http://www.boost.org/libs/mpl for documentation. +// +//////////////////////////////////////////////////////////////////// +#ifndef BOOST_MPL_SIGN_HPP_INCLUDED +#define BOOST_MPL_SIGN_HPP_INCLUDED + +#include <boost/mpl/integral_c.hpp> +#include <boost/mpl/aux_/na_spec.hpp> +#include <boost/mpl/aux_/lambda_support.hpp> +#include <boost/mpl/aux_/config/eti.hpp> +#include <boost/mpl/aux_/config/integral.hpp> +#include <boost/mpl/aux_/config/static_constant.hpp> + +#if !defined(BOOST_MPL_CFG_NO_NESTED_VALUE_ARITHMETIC_2) \ + && !defined(BOOST_MPL_PREPROCESSING_MODE) \ + && ( defined(BOOST_MSVC) \ + || BOOST_WORKAROUND(__EDG_VERSION__, <= 238) \ + ) + +# define BOOST_MPL_CFG_NO_NESTED_VALUE_ARITHMETIC_2 + +#endif + +namespace boost { namespace mpl { + +template< typename Tag > struct sign_impl; + +template< typename T > struct sign_tag +{ + typedef typename T::tag type; +}; + +template< + typename BOOST_MPL_AUX_NA_PARAM(N) + > +struct sign + : sign_impl< + typename sign_tag<N>::type + >::template apply<N>::type +{ + BOOST_MPL_AUX_LAMBDA_SUPPORT(1, sign, (N)) +}; + +BOOST_MPL_AUX_NA_SPEC(1, sign) + +template< + typename T + , T n1 + > +struct sign_c + : sign<integral_c<T,n1> > +{ +}; + +#if defined(BOOST_MPL_CFG_NO_NESTED_VALUE_ARITHMETIC_2) +namespace aux { +template< typename T, T n > struct sign_wknd +{ + BOOST_STATIC_CONSTANT(T, value = (n == 0 ? 0 : (n < 0 ? -1 : 1))); + typedef integral_c<T,value> type; +}; +} +#endif + +template<> +struct sign_impl<integral_c_tag> +{ +#if defined(BOOST_MPL_CFG_NO_NESTED_VALUE_ARITHMETIC_2) + template< typename N > struct apply + : aux::sign_wknd< typename N::value_type, N::value > +#else + template< typename N > struct apply + : integral_c< typename N::value_type, (N::value == 0 ? 0 : (N::value < 0 ? -1 : 1)) > +#endif + { + }; +}; + +}} + +#endif // BOOST_MPL_SIGN_HPP_INCLUDED diff --git a/3rdParty/Boost/src/boost/ratio/detail/overflow_helpers.hpp b/3rdParty/Boost/src/boost/ratio/detail/overflow_helpers.hpp new file mode 100644 index 0000000..0e292fa --- /dev/null +++ b/3rdParty/Boost/src/boost/ratio/detail/overflow_helpers.hpp @@ -0,0 +1,367 @@ +// ratio.hpp ---------------------------------------------------------------// + +// Copyright 2008 Howard Hinnant +// Copyright 2008 Beman Dawes +// Copyright 2009 Vicente J. Botet Escriba + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +/* + +This code was derived by Beman Dawes from Howard Hinnant's time2_demo prototype. +Many thanks to Howard for making his code available under the Boost license. +The original code was modified to conform to Boost conventions and to section +20.4 Compile-time rational arithmetic [ratio], of the C++ committee working +paper N2798. +See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2798.pdf. + +time2_demo contained this comment: + + Much thanks to Andrei Alexandrescu, + Walter Brown, + Peter Dimov, + Jeff Garland, + Terry Golubiewski, + Daniel Krugler, + Anthony Williams. +*/ + +// The way overflow is managed for ratio_less is taken from llvm/libcxx/include/ratio + +#ifndef BOOST_RATIO_DETAIL_RATIO_OPERATIONS_HPP +#define BOOST_RATIO_DETAIL_RATIO_OPERATIONS_HPP + +#include <boost/ratio/config.hpp> +#include <boost/ratio/detail/mpl/abs.hpp> +#include <boost/ratio/detail/mpl/sign.hpp> +#include <cstdlib> +#include <climits> +#include <limits> +#include <boost/cstdint.hpp> +#include <boost/type_traits/integral_constant.hpp> +#include <boost/utility/enable_if.hpp> +#include <boost/integer_traits.hpp> + +// +// We simply cannot include this header on gcc without getting copious warnings of the kind: +// +// boost/integer.hpp:77:30: warning: use of C99 long long integer constant +// +// And yet there is no other reasonable implementation, so we declare this a system header +// to suppress these warnings. +// +#if defined(__GNUC__) && (__GNUC__ >= 4) +#pragma GCC system_header +#endif + +namespace boost +{ + +//----------------------------------------------------------------------------// +// helpers // +//----------------------------------------------------------------------------// + +namespace ratio_detail +{ + + template <boost::intmax_t X, boost::intmax_t Y, boost::intmax_t = mpl::sign_c<boost::intmax_t, Y>::value> + class br_add; + + template <boost::intmax_t X, boost::intmax_t Y> + class br_add<X, Y, 1> + { + static const boost::intmax_t min = boost::integer_traits<boost::intmax_t>::const_min; + static const boost::intmax_t max = boost::integer_traits<boost::intmax_t>::const_max; + + BOOST_RATIO_STATIC_ASSERT(X <= max - Y , BOOST_RATIO_OVERFLOW_IN_ADD, ()); + public: + static const boost::intmax_t value = X + Y; + }; + + template <boost::intmax_t X, boost::intmax_t Y> + class br_add<X, Y, 0> + { + public: + static const boost::intmax_t value = X; + }; + + template <boost::intmax_t X, boost::intmax_t Y> + class br_add<X, Y, -1> + { + static const boost::intmax_t min = boost::integer_traits<boost::intmax_t>::const_min; + static const boost::intmax_t max = boost::integer_traits<boost::intmax_t>::const_max; + + BOOST_RATIO_STATIC_ASSERT(min - Y <= X, BOOST_RATIO_OVERFLOW_IN_ADD, ()); + public: + static const boost::intmax_t value = X + Y; + }; + + template <boost::intmax_t X, boost::intmax_t Y, boost::intmax_t = mpl::sign_c<boost::intmax_t, Y>::value> + class br_sub; + + template <boost::intmax_t X, boost::intmax_t Y> + class br_sub<X, Y, 1> + { + static const boost::intmax_t min = boost::integer_traits<boost::intmax_t>::const_min; + static const boost::intmax_t max = boost::integer_traits<boost::intmax_t>::const_max; + + BOOST_RATIO_STATIC_ASSERT(min + Y <= X, BOOST_RATIO_OVERFLOW_IN_SUB, ()); + public: + static const boost::intmax_t value = X - Y; + }; + + template <boost::intmax_t X, boost::intmax_t Y> + class br_sub<X, Y, 0> + { + public: + static const boost::intmax_t value = X; + }; + + template <boost::intmax_t X, boost::intmax_t Y> + class br_sub<X, Y, -1> + { + static const boost::intmax_t min = boost::integer_traits<boost::intmax_t>::const_min; + static const boost::intmax_t max = boost::integer_traits<boost::intmax_t>::const_max; + + BOOST_RATIO_STATIC_ASSERT(X <= max + Y, BOOST_RATIO_OVERFLOW_IN_SUB, ()); + public: + static const boost::intmax_t value = X - Y; + }; + + template <boost::intmax_t X, boost::intmax_t Y> + class br_mul + { + static const boost::intmax_t nan = + (BOOST_RATIO_INTMAX_C(1) << (sizeof(boost::intmax_t) * CHAR_BIT - 1)); + static const boost::intmax_t min = boost::integer_traits<boost::intmax_t>::const_min; + static const boost::intmax_t max = boost::integer_traits<boost::intmax_t>::const_max; + + static const boost::intmax_t a_x = mpl::abs_c<boost::intmax_t, X>::value; + static const boost::intmax_t a_y = mpl::abs_c<boost::intmax_t, Y>::value; + + BOOST_RATIO_STATIC_ASSERT(X != nan, BOOST_RATIO_OVERFLOW_IN_MUL, ()); + BOOST_RATIO_STATIC_ASSERT(Y != nan, BOOST_RATIO_OVERFLOW_IN_MUL, ()); + BOOST_RATIO_STATIC_ASSERT(a_x <= max / a_y, BOOST_RATIO_OVERFLOW_IN_MUL, ()); + public: + static const boost::intmax_t value = X * Y; + }; + + template <boost::intmax_t Y> + class br_mul<0, Y> + { + public: + static const boost::intmax_t value = 0; + }; + + template <boost::intmax_t X> + class br_mul<X, 0> + { + public: + static const boost::intmax_t value = 0; + }; + + template <> + class br_mul<0, 0> + { + public: + static const boost::intmax_t value = 0; + }; + + // Not actually used but left here in case needed in future maintenance + template <boost::intmax_t X, boost::intmax_t Y> + class br_div + { + static const boost::intmax_t nan = (1LL << (sizeof(boost::intmax_t) * CHAR_BIT - 1)); + static const boost::intmax_t min = boost::integer_traits<boost::intmax_t>::const_min; + static const boost::intmax_t max = boost::integer_traits<boost::intmax_t>::const_max; + + BOOST_RATIO_STATIC_ASSERT(X != nan, BOOST_RATIO_OVERFLOW_IN_DIV, ()); + BOOST_RATIO_STATIC_ASSERT(Y != nan, BOOST_RATIO_OVERFLOW_IN_DIV, ()); + BOOST_RATIO_STATIC_ASSERT(Y != 0, BOOST_RATIO_DIVIDE_BY_0, ()); + public: + static const boost::intmax_t value = X / Y; + }; + + // ratio arithmetic + template <class R1, class R2> struct ratio_add; + template <class R1, class R2> struct ratio_subtract; + template <class R1, class R2> struct ratio_multiply; + template <class R1, class R2> struct ratio_divide; + + template <class R1, class R2> + struct ratio_add + { + //The nested typedef type shall be a synonym for ratio<T1, T2>::type where T1 has the value R1::num * + //R2::den + R2::num * R1::den and T2 has the value R1::den * R2::den. + // As the preceding doesn't works because of overflow on boost::intmax_t we need something more elaborated. + private: + static const boost::intmax_t gcd_n1_n2 = mpl::gcd_c<boost::intmax_t, R1::num, R2::num>::value; + static const boost::intmax_t gcd_d1_d2 = mpl::gcd_c<boost::intmax_t, R1::den, R2::den>::value; + public: + // No need to normalize as ratio_multiply is already normalized + typedef typename ratio_multiply + < + ratio<gcd_n1_n2, R1::den / gcd_d1_d2>, + ratio + < + boost::ratio_detail::br_add + < + boost::ratio_detail::br_mul<R1::num / gcd_n1_n2, R2::den / gcd_d1_d2>::value, + boost::ratio_detail::br_mul<R2::num / gcd_n1_n2, R1::den / gcd_d1_d2>::value + >::value, + R2::den + > + >::type type; + }; + template <class R, boost::intmax_t D> + struct ratio_add<R, ratio<0,D> > + { + typedef R type; + }; + + template <class R1, class R2> + struct ratio_subtract + { + //The nested typedef type shall be a synonym for ratio<T1, T2>::type where T1 has the value + // R1::num *R2::den - R2::num * R1::den and T2 has the value R1::den * R2::den. + // As the preceding doesn't works because of overflow on boost::intmax_t we need something more elaborated. + private: + static const boost::intmax_t gcd_n1_n2 = mpl::gcd_c<boost::intmax_t, R1::num, R2::num>::value; + static const boost::intmax_t gcd_d1_d2 = mpl::gcd_c<boost::intmax_t, R1::den, R2::den>::value; + public: + // No need to normalize as ratio_multiply is already normalized + typedef typename ratio_multiply + < + ratio<gcd_n1_n2, R1::den / gcd_d1_d2>, + ratio + < + boost::ratio_detail::br_sub + < + boost::ratio_detail::br_mul<R1::num / gcd_n1_n2, R2::den / gcd_d1_d2>::value, + boost::ratio_detail::br_mul<R2::num / gcd_n1_n2, R1::den / gcd_d1_d2>::value + >::value, + R2::den + > + >::type type; + }; + + template <class R, boost::intmax_t D> + struct ratio_subtract<R, ratio<0,D> > + { + typedef R type; + }; + + template <class R1, class R2> + struct ratio_multiply + { + // The nested typedef type shall be a synonym for ratio<R1::num * R2::den - R2::num * R1::den, R1::den * R2::den>::type. + // As the preceding doesn't works because of overflow on boost::intmax_t we need something more elaborated. + private: + static const boost::intmax_t gcd_n1_d2 = mpl::gcd_c<boost::intmax_t, R1::num, R2::den>::value; + static const boost::intmax_t gcd_d1_n2 = mpl::gcd_c<boost::intmax_t, R1::den, R2::num>::value; + public: + typedef typename ratio + < + boost::ratio_detail::br_mul<R1::num / gcd_n1_d2, R2::num / gcd_d1_n2>::value, + boost::ratio_detail::br_mul<R2::den / gcd_n1_d2, R1::den / gcd_d1_n2>::value + >::type type; + }; + + template <class R1, class R2> + struct ratio_divide + { + // The nested typedef type shall be a synonym for ratio<R1::num * R2::den, R2::num * R1::den>::type. + // As the preceding doesn't works because of overflow on boost::intmax_t we need something more elaborated. + private: + static const boost::intmax_t gcd_n1_n2 = mpl::gcd_c<boost::intmax_t, R1::num, R2::num>::value; + static const boost::intmax_t gcd_d1_d2 = mpl::gcd_c<boost::intmax_t, R1::den, R2::den>::value; + public: + typedef typename ratio + < + boost::ratio_detail::br_mul<R1::num / gcd_n1_n2, R2::den / gcd_d1_d2>::value, + boost::ratio_detail::br_mul<R2::num / gcd_n1_n2, R1::den / gcd_d1_d2>::value + >::type type; + }; + template <class R1, class R2> + struct is_evenly_divisible_by + { + private: + static const boost::intmax_t gcd_n1_n2 = mpl::gcd_c<boost::intmax_t, R1::num, R2::num>::value; + static const boost::intmax_t gcd_d1_d2 = mpl::gcd_c<boost::intmax_t, R1::den, R2::den>::value; + public: + typedef integral_constant<bool, + ((R2::num / gcd_n1_n2 ==1) && (R1::den / gcd_d1_d2)==1) + > type; + }; + + template <class T> + struct is_ratio : public boost::false_type + {}; + template <boost::intmax_t N, boost::intmax_t D> + struct is_ratio<ratio<N, D> > : public boost::true_type + {}; + + template <class R1, class R2, + boost::intmax_t Q1 = R1::num / R1::den, boost::intmax_t M1 = R1::num % R1::den, + boost::intmax_t Q2 = R2::num / R2::den, boost::intmax_t M2 = R2::num % R2::den> + struct ratio_less1 + { + static const bool value = Q1 < Q2; + }; + + template <class R1, class R2, boost::intmax_t Q> + struct ratio_less1<R1, R2, Q, 0, Q, 0> + { + static const bool value = false; + }; + + template <class R1, class R2, boost::intmax_t Q, boost::intmax_t M2> + struct ratio_less1<R1, R2, Q, 0, Q, M2> + { + static const bool value = true; + }; + + template <class R1, class R2, boost::intmax_t Q, boost::intmax_t M1> + struct ratio_less1<R1, R2, Q, M1, Q, 0> + { + static const bool value = false; + }; + + template <class R1, class R2, boost::intmax_t Q, boost::intmax_t M1, boost::intmax_t M2> + struct ratio_less1<R1, R2, Q, M1, Q, M2> + { + static const bool value = ratio_less1<ratio<R2::den, M2>, ratio<R1::den, M1> + >::value; + }; + + template < + class R1, + class R2, + boost::intmax_t S1 = mpl::sign_c<boost::intmax_t, R1::num>::value, + boost::intmax_t S2 = mpl::sign_c<boost::intmax_t, R2::num>::value +> + struct ratio_less + { + static const bool value = S1 < S2; + }; + + template <class R1, class R2> + struct ratio_less<R1, R2, 1LL, 1LL> + { + static const bool value = ratio_less1<R1, R2>::value; + }; + + template <class R1, class R2> + struct ratio_less<R1, R2, -1LL, -1LL> + { + static const bool value = ratio_less1<ratio<-R2::num, R2::den>, + ratio<-R1::num, R1::den> >::value; + }; + + +} // namespace ratio_detail + +} // namespace boost + +#endif // BOOST_RATIO_HPP diff --git a/3rdParty/Boost/src/boost/ratio/mpl/rational_c_tag.hpp b/3rdParty/Boost/src/boost/ratio/mpl/rational_c_tag.hpp new file mode 100644 index 0000000..743766f --- /dev/null +++ b/3rdParty/Boost/src/boost/ratio/mpl/rational_c_tag.hpp @@ -0,0 +1,25 @@ +// abs.hpp +// +// (C) Copyright 2011 Vicente J. Botet Escriba +// 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). +// + +#ifndef BOOST_RATIO_MPL_RATIONAL_C_TAG_HPP +#define BOOST_RATIO_MPL_RATIONAL_C_TAG_HPP + +#ifdef BOOST_RATIO_EXTENSIONS + +#include <boost/mpl/int.hpp> + +namespace boost { +namespace mpl { + +struct rational_c_tag : int_<10> {}; + +} +} + +#endif // BOOST_RATIO_EXTENSIONS +#endif // BOOST_RATIO_MPL_RATIONAL_C_TAG_HPP diff --git a/3rdParty/Boost/src/boost/ratio/ratio.hpp b/3rdParty/Boost/src/boost/ratio/ratio.hpp new file mode 100644 index 0000000..546e8f0 --- /dev/null +++ b/3rdParty/Boost/src/boost/ratio/ratio.hpp @@ -0,0 +1,233 @@ +// ratio.hpp ---------------------------------------------------------------// + +// Copyright 2008 Howard Hinnant +// Copyright 2008 Beman Dawes +// Copyright 2009 Vicente J. Botet Escriba + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +/* + +This code was derived by Beman Dawes from Howard Hinnant's time2_demo prototype. +Many thanks to Howard for making his code available under the Boost license. +The original code was modified to conform to Boost conventions and to section +20.4 Compile-time rational arithmetic [ratio], of the C++ committee working +paper N2798. +See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2798.pdf. + +time2_demo contained this comment: + + Much thanks to Andrei Alexandrescu, + Walter Brown, + Peter Dimov, + Jeff Garland, + Terry Golubiewski, + Daniel Krugler, + Anthony Williams. +*/ + +// The way overflow is managed for ratio_less is taken from llvm/libcxx/include/ratio + +#ifndef BOOST_RATIO_RATIO_HPP +#define BOOST_RATIO_RATIO_HPP + +#include <boost/ratio/config.hpp> +#include <boost/ratio/detail/mpl/abs.hpp> +#include <boost/ratio/detail/mpl/sign.hpp> +#include <boost/ratio/detail/mpl/gcd.hpp> +#include <boost/ratio/detail/mpl/lcm.hpp> +#include <cstdlib> +#include <climits> +#include <limits> +#include <boost/cstdint.hpp> +#include <boost/type_traits/integral_constant.hpp> +#include <boost/utility/enable_if.hpp> +#include <boost/integer_traits.hpp> +#include <boost/ratio/ratio_fwd.hpp> +#include <boost/ratio/detail/overflow_helpers.hpp> +#ifdef BOOST_RATIO_EXTENSIONS +#include <boost/rational.hpp> +#include <boost/ratio/mpl/rational_c_tag.hpp> +#endif + +// +// We simply cannot include this header on gcc without getting copious warnings of the kind: +// +// boost/integer.hpp:77:30: warning: use of C99 long long integer constant +// +// And yet there is no other reasonable implementation, so we declare this a system header +// to suppress these warnings. +// +#if defined(__GNUC__) && (__GNUC__ >= 4) +#pragma GCC system_header +#endif + +namespace boost +{ + + +//----------------------------------------------------------------------------// +// // +// 20.6.1 Class template ratio [ratio.ratio] // +// // +//----------------------------------------------------------------------------// + +template <boost::intmax_t N, boost::intmax_t D> +class ratio +{ + static const boost::intmax_t ABS_N = mpl::abs_c<boost::intmax_t, N>::value; + static const boost::intmax_t ABS_D = mpl::abs_c<boost::intmax_t, D>::value; + BOOST_RATIO_STATIC_ASSERT(ABS_N >= 0, BOOST_RATIO_NUMERATOR_IS_OUT_OF_RANGE, ()); + BOOST_RATIO_STATIC_ASSERT(ABS_D > 0, BOOST_RATIO_DENOMINATOR_IS_OUT_OF_RANGE, ()); + BOOST_RATIO_STATIC_ASSERT(D != 0, BOOST_RATIO_DIVIDE_BY_0 , ()); + static const boost::intmax_t SIGN_N = mpl::sign_c<boost::intmax_t,N>::value + * mpl::sign_c<boost::intmax_t,D>::value; + static const boost::intmax_t GCD = mpl::gcd_c<boost::intmax_t, ABS_N, ABS_D>::value; +public: + BOOST_STATIC_CONSTEXPR boost::intmax_t num = SIGN_N * ABS_N / GCD; + BOOST_STATIC_CONSTEXPR boost::intmax_t den = ABS_D / GCD; + +#ifdef BOOST_RATIO_EXTENSIONS + typedef mpl::rational_c_tag tag; + typedef boost::rational<boost::intmax_t> value_type; + typedef boost::intmax_t num_type; + typedef boost::intmax_t den_type; + ratio() + {} + template <boost::intmax_t _N2, boost::intmax_t _D2> + ratio(const ratio<_N2, _D2>&, + typename enable_if_c + < + (ratio<_N2, _D2>::num == num && + ratio<_N2, _D2>::den == den) + >::type* = 0) + {} + + template <boost::intmax_t _N2, boost::intmax_t _D2> + typename enable_if_c + < + (ratio<_N2, _D2>::num == num && + ratio<_N2, _D2>::den == den), + ratio& + >::type + operator=(const ratio<_N2, _D2>&) {return *this;} + + static value_type value() {return value_type(num,den);} + value_type operator()() const {return value();} +#endif + typedef ratio<num, den> type; +}; + +#if defined(BOOST_NO_CXX11_CONSTEXPR) +template <boost::intmax_t N, boost::intmax_t D> +const boost::intmax_t ratio<N, D>::num; +template <boost::intmax_t N, boost::intmax_t D> +const boost::intmax_t ratio<N, D>::den; +#endif + +//----------------------------------------------------------------------------// +// // +// 20.6.2 Arithmetic on ratio types [ratio.arithmetic] // +// // +//----------------------------------------------------------------------------// + +template <class R1, class R2> +struct ratio_add +: boost::ratio_detail::ratio_add<R1, R2>::type +{ +}; + +template <class R1, class R2> +struct ratio_subtract +: boost::ratio_detail::ratio_subtract<R1, R2>::type +{ +}; + +template <class R1, class R2> +struct ratio_multiply +: boost::ratio_detail::ratio_multiply<R1, R2>::type +{ +}; + +template <class R1, class R2> +struct ratio_divide +: boost::ratio_detail::ratio_divide<R1, R2>::type +{ +}; + +//----------------------------------------------------------------------------// +// // +// 20.6.3 Comparasion of ratio types [ratio.comparison] // +// // +//----------------------------------------------------------------------------// + +// ratio_equal + +template <class R1, class R2> +struct ratio_equal + : public boost::integral_constant<bool, + (R1::num == R2::num && R1::den == R2::den)> +{}; + +template <class R1, class R2> +struct ratio_not_equal + : public boost::integral_constant<bool, !ratio_equal<R1, R2>::value> +{}; + +// ratio_less + +template <class R1, class R2> +struct ratio_less + : boost::integral_constant<bool, boost::ratio_detail::ratio_less<R1, R2>::value> +{}; + +template <class R1, class R2> +struct ratio_less_equal + : boost::integral_constant<bool, !ratio_less<R2, R1>::value> +{}; + +template <class R1, class R2> +struct ratio_greater + : boost::integral_constant<bool, ratio_less<R2, R1>::value> +{}; + +template <class R1, class R2> +struct ratio_greater_equal + : boost::integral_constant<bool, !ratio_less<R1, R2>::value> +{}; + +template <class R1, class R2> +struct ratio_gcd : + ratio<mpl::gcd_c<boost::intmax_t, R1::num, R2::num>::value, + mpl::lcm_c<boost::intmax_t, R1::den, R2::den>::value>::type +{ +}; + +#ifdef BOOST_RATIO_EXTENSIONS +template <class R> +struct ratio_negate + : ratio<-R::num, R::den>::type +{ +}; +template <class R> +struct ratio_abs + : ratio<mpl::abs_c<boost::intmax_t, R::num>::value, R::den>::type +{ +}; +template <class R> +struct ratio_sign + : mpl::sign_c<boost::intmax_t, R::num> +{ +}; +template <class R1, class R2> +struct ratio_lcm : + ratio<mpl::lcm_c<boost::intmax_t, R1::num, R2::num>::value, + mpl::gcd_c<boost::intmax_t, R1::den, R2::den>::value>::type +{ +}; +#endif +} // namespace boost + + +#endif // BOOST_RATIO_RATIO_HPP diff --git a/3rdParty/Boost/src/boost/ratio/ratio_fwd.hpp b/3rdParty/Boost/src/boost/ratio/ratio_fwd.hpp new file mode 100644 index 0000000..0882e0b --- /dev/null +++ b/3rdParty/Boost/src/boost/ratio/ratio_fwd.hpp @@ -0,0 +1,84 @@ +// ratio_fwd.hpp ---------------------------------------------------------------// + +// Copyright 2008 Howard Hinnant +// Copyright 2008 Beman Dawes +// Copyright 2009 Vicente J. Botet Escriba + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +/* + +This code was derived by Beman Dawes from Howard Hinnant's time2_demo prototype. +Many thanks to Howard for making his code available under the Boost license. +The original code was modified to conform to Boost conventions and to section +20.4 Compile-time rational arithmetic [ratio], of the C++ committee working +paper N2798. +See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2008/n2798.pdf. + +time2_demo contained this comment: + + Much thanks to Andrei Alexandrescu, + Walter Brown, + Peter Dimov, + Jeff Garland, + Terry Golubiewski, + Daniel Krugler, + Anthony Williams. +*/ + +// The way overflow is managed for ratio_less is taken from llvm/libcxx/include/ratio + +#ifndef BOOST_RATIO_RATIO_FWD_HPP +#define BOOST_RATIO_RATIO_FWD_HPP + +#include <boost/ratio/config.hpp> + +namespace boost +{ + +//----------------------------------------------------------------------------// +// // +// 20.6 Compile-time rational arithmetic [ratio] // +// // +//----------------------------------------------------------------------------// + +// ratio +template <boost::intmax_t N, boost::intmax_t D = 1> class ratio; + +// ratio arithmetic +template <class R1, class R2> struct ratio_add; +template <class R1, class R2> struct ratio_subtract; +template <class R1, class R2> struct ratio_multiply; +template <class R1, class R2> struct ratio_divide; + +// ratio comparison +template <class R1, class R2> struct ratio_equal; +template <class R1, class R2> struct ratio_not_equal; +template <class R1, class R2> struct ratio_less; +template <class R1, class R2> struct ratio_less_equal; +template <class R1, class R2> struct ratio_greater; +template <class R1, class R2> struct ratio_greater_equal; + +// convenience SI typedefs +typedef ratio<BOOST_RATIO_INTMAX_C(1), BOOST_RATIO_INTMAX_C(1000000000000000000)> atto; +typedef ratio<BOOST_RATIO_INTMAX_C(1), BOOST_RATIO_INTMAX_C(1000000000000000)> femto; +typedef ratio<BOOST_RATIO_INTMAX_C(1), BOOST_RATIO_INTMAX_C(1000000000000)> pico; +typedef ratio<BOOST_RATIO_INTMAX_C(1), BOOST_RATIO_INTMAX_C(1000000000)> nano; +typedef ratio<BOOST_RATIO_INTMAX_C(1), BOOST_RATIO_INTMAX_C(1000000)> micro; +typedef ratio<BOOST_RATIO_INTMAX_C(1), BOOST_RATIO_INTMAX_C(1000)> milli; +typedef ratio<BOOST_RATIO_INTMAX_C(1), BOOST_RATIO_INTMAX_C(100)> centi; +typedef ratio<BOOST_RATIO_INTMAX_C(1), BOOST_RATIO_INTMAX_C(10)> deci; +typedef ratio< BOOST_RATIO_INTMAX_C(10), BOOST_RATIO_INTMAX_C(1)> deca; +typedef ratio< BOOST_RATIO_INTMAX_C(100), BOOST_RATIO_INTMAX_C(1)> hecto; +typedef ratio< BOOST_RATIO_INTMAX_C(1000), BOOST_RATIO_INTMAX_C(1)> kilo; +typedef ratio< BOOST_RATIO_INTMAX_C(1000000), BOOST_RATIO_INTMAX_C(1)> mega; +typedef ratio< BOOST_RATIO_INTMAX_C(1000000000), BOOST_RATIO_INTMAX_C(1)> giga; +typedef ratio< BOOST_RATIO_INTMAX_C(1000000000000), BOOST_RATIO_INTMAX_C(1)> tera; +typedef ratio< BOOST_RATIO_INTMAX_C(1000000000000000), BOOST_RATIO_INTMAX_C(1)> peta; +typedef ratio<BOOST_RATIO_INTMAX_C(1000000000000000000), BOOST_RATIO_INTMAX_C(1)> exa; + +} // namespace boost + + +#endif // BOOST_RATIO_HPP diff --git a/3rdParty/Boost/src/boost/rational.hpp b/3rdParty/Boost/src/boost/rational.hpp new file mode 100644 index 0000000..468db79 --- /dev/null +++ b/3rdParty/Boost/src/boost/rational.hpp @@ -0,0 +1,609 @@ +// Boost rational.hpp header file ------------------------------------------// + +// (C) Copyright Paul Moore 1999. Permission to copy, use, modify, sell and +// distribute this software is granted provided this copyright notice appears +// in all copies. This software is provided "as is" without express or +// implied warranty, and with no claim as to its suitability for any purpose. + +// boostinspect:nolicense (don't complain about the lack of a Boost license) +// (Paul Moore hasn't been in contact for years, so there's no way to change the +// license.) + +// See http://www.boost.org/libs/rational for documentation. + +// Credits: +// Thanks to the boost mailing list in general for useful comments. +// Particular contributions included: +// Andrew D Jewell, for reminding me to take care to avoid overflow +// Ed Brey, for many comments, including picking up on some dreadful typos +// Stephen Silver contributed the test suite and comments on user-defined +// IntType +// Nickolay Mladenov, for the implementation of operator+= + +// Revision History +// 05 Nov 06 Change rational_cast to not depend on division between different +// types (Daryle Walker) +// 04 Nov 06 Off-load GCD and LCM to Boost.Math; add some invariant checks; +// add std::numeric_limits<> requirement to help GCD (Daryle Walker) +// 31 Oct 06 Recoded both operator< to use round-to-negative-infinity +// divisions; the rational-value version now uses continued fraction +// expansion to avoid overflows, for bug #798357 (Daryle Walker) +// 20 Oct 06 Fix operator bool_type for CW 8.3 (Joaqu�n M L�pez Mu�oz) +// 18 Oct 06 Use EXPLICIT_TEMPLATE_TYPE helper macros from Boost.Config +// (Joaqu�n M L�pez Mu�oz) +// 27 Dec 05 Add Boolean conversion operator (Daryle Walker) +// 28 Sep 02 Use _left versions of operators from operators.hpp +// 05 Jul 01 Recode gcd(), avoiding std::swap (Helmut Zeisel) +// 03 Mar 01 Workarounds for Intel C++ 5.0 (David Abrahams) +// 05 Feb 01 Update operator>> to tighten up input syntax +// 05 Feb 01 Final tidy up of gcd code prior to the new release +// 27 Jan 01 Recode abs() without relying on abs(IntType) +// 21 Jan 01 Include Nickolay Mladenov's operator+= algorithm, +// tidy up a number of areas, use newer features of operators.hpp +// (reduces space overhead to zero), add operator!, +// introduce explicit mixed-mode arithmetic operations +// 12 Jan 01 Include fixes to handle a user-defined IntType better +// 19 Nov 00 Throw on divide by zero in operator /= (John (EBo) David) +// 23 Jun 00 Incorporate changes from Mark Rodgers for Borland C++ +// 22 Jun 00 Change _MSC_VER to BOOST_MSVC so other compilers are not +// affected (Beman Dawes) +// 6 Mar 00 Fix operator-= normalization, #include <string> (Jens Maurer) +// 14 Dec 99 Modifications based on comments from the boost list +// 09 Dec 99 Initial Version (Paul Moore) + +#ifndef BOOST_RATIONAL_HPP +#define BOOST_RATIONAL_HPP + +#include <iostream> // for std::istream and std::ostream +#include <ios> // for std::noskipws +#include <stdexcept> // for std::domain_error +#include <string> // for std::string implicit constructor +#include <boost/operators.hpp> // for boost::addable etc +#include <cstdlib> // for std::abs +#include <boost/call_traits.hpp> // for boost::call_traits +#include <boost/config.hpp> // for BOOST_NO_STDC_NAMESPACE, BOOST_MSVC +#include <boost/detail/workaround.hpp> // for BOOST_WORKAROUND +#include <boost/assert.hpp> // for BOOST_ASSERT +#include <boost/math/common_factor_rt.hpp> // for boost::math::gcd, lcm +#include <limits> // for std::numeric_limits +#include <boost/static_assert.hpp> // for BOOST_STATIC_ASSERT + +// Control whether depreciated GCD and LCM functions are included (default: yes) +#ifndef BOOST_CONTROL_RATIONAL_HAS_GCD +#define BOOST_CONTROL_RATIONAL_HAS_GCD 1 +#endif + +namespace boost { + +#if BOOST_CONTROL_RATIONAL_HAS_GCD +template <typename IntType> +IntType gcd(IntType n, IntType m) +{ + // Defer to the version in Boost.Math + return math::gcd( n, m ); +} + +template <typename IntType> +IntType lcm(IntType n, IntType m) +{ + // Defer to the version in Boost.Math + return math::lcm( n, m ); +} +#endif // BOOST_CONTROL_RATIONAL_HAS_GCD + +class bad_rational : public std::domain_error +{ +public: + explicit bad_rational() : std::domain_error("bad rational: zero denominator") {} +}; + +template <typename IntType> +class rational; + +template <typename IntType> +rational<IntType> abs(const rational<IntType>& r); + +template <typename IntType> +class rational : + less_than_comparable < rational<IntType>, + equality_comparable < rational<IntType>, + less_than_comparable2 < rational<IntType>, IntType, + equality_comparable2 < rational<IntType>, IntType, + addable < rational<IntType>, + subtractable < rational<IntType>, + multipliable < rational<IntType>, + dividable < rational<IntType>, + addable2 < rational<IntType>, IntType, + subtractable2 < rational<IntType>, IntType, + subtractable2_left < rational<IntType>, IntType, + multipliable2 < rational<IntType>, IntType, + dividable2 < rational<IntType>, IntType, + dividable2_left < rational<IntType>, IntType, + incrementable < rational<IntType>, + decrementable < rational<IntType> + > > > > > > > > > > > > > > > > +{ + // Class-wide pre-conditions + BOOST_STATIC_ASSERT( ::std::numeric_limits<IntType>::is_specialized ); + + // Helper types + typedef typename boost::call_traits<IntType>::param_type param_type; + + struct helper { IntType parts[2]; }; + typedef IntType (helper::* bool_type)[2]; + +public: + typedef IntType int_type; + rational() : num(0), den(1) {} + rational(param_type n) : num(n), den(1) {} + rational(param_type n, param_type d) : num(n), den(d) { normalize(); } + + // Default copy constructor and assignment are fine + + // Add assignment from IntType + rational& operator=(param_type n) { return assign(n, 1); } + + // Assign in place + rational& assign(param_type n, param_type d); + + // Access to representation + IntType numerator() const { return num; } + IntType denominator() const { return den; } + + // Arithmetic assignment operators + rational& operator+= (const rational& r); + rational& operator-= (const rational& r); + rational& operator*= (const rational& r); + rational& operator/= (const rational& r); + + rational& operator+= (param_type i); + rational& operator-= (param_type i); + rational& operator*= (param_type i); + rational& operator/= (param_type i); + + // Increment and decrement + const rational& operator++(); + const rational& operator--(); + + // Operator not + bool operator!() const { return !num; } + + // Boolean conversion + +#if BOOST_WORKAROUND(__MWERKS__,<=0x3003) + // The "ISO C++ Template Parser" option in CW 8.3 chokes on the + // following, hence we selectively disable that option for the + // offending memfun. +#pragma parse_mfunc_templ off +#endif + + operator bool_type() const { return operator !() ? 0 : &helper::parts; } + +#if BOOST_WORKAROUND(__MWERKS__,<=0x3003) +#pragma parse_mfunc_templ reset +#endif + + // Comparison operators + bool operator< (const rational& r) const; + bool operator== (const rational& r) const; + + bool operator< (param_type i) const; + bool operator> (param_type i) const; + bool operator== (param_type i) const; + +private: + // Implementation - numerator and denominator (normalized). + // Other possibilities - separate whole-part, or sign, fields? + IntType num; + IntType den; + + // Representation note: Fractions are kept in normalized form at all + // times. normalized form is defined as gcd(num,den) == 1 and den > 0. + // In particular, note that the implementation of abs() below relies + // on den always being positive. + bool test_invariant() const; + void normalize(); +}; + +// Assign in place +template <typename IntType> +inline rational<IntType>& rational<IntType>::assign(param_type n, param_type d) +{ + num = n; + den = d; + normalize(); + return *this; +} + +// Unary plus and minus +template <typename IntType> +inline rational<IntType> operator+ (const rational<IntType>& r) +{ + return r; +} + +template <typename IntType> +inline rational<IntType> operator- (const rational<IntType>& r) +{ + return rational<IntType>(-r.numerator(), r.denominator()); +} + +// Arithmetic assignment operators +template <typename IntType> +rational<IntType>& rational<IntType>::operator+= (const rational<IntType>& r) +{ + // This calculation avoids overflow, and minimises the number of expensive + // calculations. Thanks to Nickolay Mladenov for this algorithm. + // + // Proof: + // We have to compute a/b + c/d, where gcd(a,b)=1 and gcd(b,c)=1. + // Let g = gcd(b,d), and b = b1*g, d=d1*g. Then gcd(b1,d1)=1 + // + // The result is (a*d1 + c*b1) / (b1*d1*g). + // Now we have to normalize this ratio. + // Let's assume h | gcd((a*d1 + c*b1), (b1*d1*g)), and h > 1 + // If h | b1 then gcd(h,d1)=1 and hence h|(a*d1+c*b1) => h|a. + // But since gcd(a,b1)=1 we have h=1. + // Similarly h|d1 leads to h=1. + // So we have that h | gcd((a*d1 + c*b1) , (b1*d1*g)) => h|g + // Finally we have gcd((a*d1 + c*b1), (b1*d1*g)) = gcd((a*d1 + c*b1), g) + // Which proves that instead of normalizing the result, it is better to + // divide num and den by gcd((a*d1 + c*b1), g) + + // Protect against self-modification + IntType r_num = r.num; + IntType r_den = r.den; + + IntType g = math::gcd(den, r_den); + den /= g; // = b1 from the calculations above + num = num * (r_den / g) + r_num * den; + g = math::gcd(num, g); + num /= g; + den *= r_den/g; + + return *this; +} + +template <typename IntType> +rational<IntType>& rational<IntType>::operator-= (const rational<IntType>& r) +{ + // Protect against self-modification + IntType r_num = r.num; + IntType r_den = r.den; + + // This calculation avoids overflow, and minimises the number of expensive + // calculations. It corresponds exactly to the += case above + IntType g = math::gcd(den, r_den); + den /= g; + num = num * (r_den / g) - r_num * den; + g = math::gcd(num, g); + num /= g; + den *= r_den/g; + + return *this; +} + +template <typename IntType> +rational<IntType>& rational<IntType>::operator*= (const rational<IntType>& r) +{ + // Protect against self-modification + IntType r_num = r.num; + IntType r_den = r.den; + + // Avoid overflow and preserve normalization + IntType gcd1 = math::gcd(num, r_den); + IntType gcd2 = math::gcd(r_num, den); + num = (num/gcd1) * (r_num/gcd2); + den = (den/gcd2) * (r_den/gcd1); + return *this; +} + +template <typename IntType> +rational<IntType>& rational<IntType>::operator/= (const rational<IntType>& r) +{ + // Protect against self-modification + IntType r_num = r.num; + IntType r_den = r.den; + + // Avoid repeated construction + IntType zero(0); + + // Trap division by zero + if (r_num == zero) + throw bad_rational(); + if (num == zero) + return *this; + + // Avoid overflow and preserve normalization + IntType gcd1 = math::gcd(num, r_num); + IntType gcd2 = math::gcd(r_den, den); + num = (num/gcd1) * (r_den/gcd2); + den = (den/gcd2) * (r_num/gcd1); + + if (den < zero) { + num = -num; + den = -den; + } + return *this; +} + +// Mixed-mode operators +template <typename IntType> +inline rational<IntType>& +rational<IntType>::operator+= (param_type i) +{ + return operator+= (rational<IntType>(i)); +} + +template <typename IntType> +inline rational<IntType>& +rational<IntType>::operator-= (param_type i) +{ + return operator-= (rational<IntType>(i)); +} + +template <typename IntType> +inline rational<IntType>& +rational<IntType>::operator*= (param_type i) +{ + return operator*= (rational<IntType>(i)); +} + +template <typename IntType> +inline rational<IntType>& +rational<IntType>::operator/= (param_type i) +{ + return operator/= (rational<IntType>(i)); +} + +// Increment and decrement +template <typename IntType> +inline const rational<IntType>& rational<IntType>::operator++() +{ + // This can never denormalise the fraction + num += den; + return *this; +} + +template <typename IntType> +inline const rational<IntType>& rational<IntType>::operator--() +{ + // This can never denormalise the fraction + num -= den; + return *this; +} + +// Comparison operators +template <typename IntType> +bool rational<IntType>::operator< (const rational<IntType>& r) const +{ + // Avoid repeated construction + int_type const zero( 0 ); + + // This should really be a class-wide invariant. The reason for these + // checks is that for 2's complement systems, INT_MIN has no corresponding + // positive, so negating it during normalization keeps it INT_MIN, which + // is bad for later calculations that assume a positive denominator. + BOOST_ASSERT( this->den > zero ); + BOOST_ASSERT( r.den > zero ); + + // Determine relative order by expanding each value to its simple continued + // fraction representation using the Euclidian GCD algorithm. + struct { int_type n, d, q, r; } ts = { this->num, this->den, this->num / + this->den, this->num % this->den }, rs = { r.num, r.den, r.num / r.den, + r.num % r.den }; + unsigned reverse = 0u; + + // Normalize negative moduli by repeatedly adding the (positive) denominator + // and decrementing the quotient. Later cycles should have all positive + // values, so this only has to be done for the first cycle. (The rules of + // C++ require a nonnegative quotient & remainder for a nonnegative dividend + // & positive divisor.) + while ( ts.r < zero ) { ts.r += ts.d; --ts.q; } + while ( rs.r < zero ) { rs.r += rs.d; --rs.q; } + + // Loop through and compare each variable's continued-fraction components + while ( true ) + { + // The quotients of the current cycle are the continued-fraction + // components. Comparing two c.f. is comparing their sequences, + // stopping at the first difference. + if ( ts.q != rs.q ) + { + // Since reciprocation changes the relative order of two variables, + // and c.f. use reciprocals, the less/greater-than test reverses + // after each index. (Start w/ non-reversed @ whole-number place.) + return reverse ? ts.q > rs.q : ts.q < rs.q; + } + + // Prepare the next cycle + reverse ^= 1u; + + if ( (ts.r == zero) || (rs.r == zero) ) + { + // At least one variable's c.f. expansion has ended + break; + } + + ts.n = ts.d; ts.d = ts.r; + ts.q = ts.n / ts.d; ts.r = ts.n % ts.d; + rs.n = rs.d; rs.d = rs.r; + rs.q = rs.n / rs.d; rs.r = rs.n % rs.d; + } + + // Compare infinity-valued components for otherwise equal sequences + if ( ts.r == rs.r ) + { + // Both remainders are zero, so the next (and subsequent) c.f. + // components for both sequences are infinity. Therefore, the sequences + // and their corresponding values are equal. + return false; + } + else + { +#ifdef BOOST_MSVC +#pragma warning(push) +#pragma warning(disable:4800) +#endif + // Exactly one of the remainders is zero, so all following c.f. + // components of that variable are infinity, while the other variable + // has a finite next c.f. component. So that other variable has the + // lesser value (modulo the reversal flag!). + return ( ts.r != zero ) != static_cast<bool>( reverse ); +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif + } +} + +template <typename IntType> +bool rational<IntType>::operator< (param_type i) const +{ + // Avoid repeated construction + int_type const zero( 0 ); + + // Break value into mixed-fraction form, w/ always-nonnegative remainder + BOOST_ASSERT( this->den > zero ); + int_type q = this->num / this->den, r = this->num % this->den; + while ( r < zero ) { r += this->den; --q; } + + // Compare with just the quotient, since the remainder always bumps the + // value up. [Since q = floor(n/d), and if n/d < i then q < i, if n/d == i + // then q == i, if n/d == i + r/d then q == i, and if n/d >= i + 1 then + // q >= i + 1 > i; therefore n/d < i iff q < i.] + return q < i; +} + +template <typename IntType> +bool rational<IntType>::operator> (param_type i) const +{ + // Trap equality first + if (num == i && den == IntType(1)) + return false; + + // Otherwise, we can use operator< + return !operator<(i); +} + +template <typename IntType> +inline bool rational<IntType>::operator== (const rational<IntType>& r) const +{ + return ((num == r.num) && (den == r.den)); +} + +template <typename IntType> +inline bool rational<IntType>::operator== (param_type i) const +{ + return ((den == IntType(1)) && (num == i)); +} + +// Invariant check +template <typename IntType> +inline bool rational<IntType>::test_invariant() const +{ + return ( this->den > int_type(0) ) && ( math::gcd(this->num, this->den) == + int_type(1) ); +} + +// Normalisation +template <typename IntType> +void rational<IntType>::normalize() +{ + // Avoid repeated construction + IntType zero(0); + + if (den == zero) + throw bad_rational(); + + // Handle the case of zero separately, to avoid division by zero + if (num == zero) { + den = IntType(1); + return; + } + + IntType g = math::gcd(num, den); + + num /= g; + den /= g; + + // Ensure that the denominator is positive + if (den < zero) { + num = -num; + den = -den; + } + + BOOST_ASSERT( this->test_invariant() ); +} + +namespace detail { + + // A utility class to reset the format flags for an istream at end + // of scope, even in case of exceptions + struct resetter { + resetter(std::istream& is) : is_(is), f_(is.flags()) {} + ~resetter() { is_.flags(f_); } + std::istream& is_; + std::istream::fmtflags f_; // old GNU c++ lib has no ios_base + }; + +} + +// Input and output +template <typename IntType> +std::istream& operator>> (std::istream& is, rational<IntType>& r) +{ + IntType n = IntType(0), d = IntType(1); + char c = 0; + detail::resetter sentry(is); + + is >> n; + c = is.get(); + + if (c != '/') + is.clear(std::istream::badbit); // old GNU c++ lib has no ios_base + +#if !defined(__GNUC__) || (defined(__GNUC__) && (__GNUC__ >= 3)) || defined __SGI_STL_PORT + is >> std::noskipws; +#else + is.unsetf(ios::skipws); // compiles, but seems to have no effect. +#endif + is >> d; + + if (is) + r.assign(n, d); + + return is; +} + +// Add manipulators for output format? +template <typename IntType> +std::ostream& operator<< (std::ostream& os, const rational<IntType>& r) +{ + os << r.numerator() << '/' << r.denominator(); + return os; +} + +// Type conversion +template <typename T, typename IntType> +inline T rational_cast( + const rational<IntType>& src BOOST_APPEND_EXPLICIT_TEMPLATE_TYPE(T)) +{ + return static_cast<T>(src.numerator())/static_cast<T>(src.denominator()); +} + +// Do not use any abs() defined on IntType - it isn't worth it, given the +// difficulties involved (Koenig lookup required, there may not *be* an abs() +// defined, etc etc). +template <typename IntType> +inline rational<IntType> abs(const rational<IntType>& r) +{ + if (r.numerator() >= IntType(0)) + return r; + + return rational<IntType>(-r.numerator(), r.denominator()); +} + +} // namespace boost + +#endif // BOOST_RATIONAL_HPP + diff --git a/3rdParty/Boost/src/boost/regex/config.hpp b/3rdParty/Boost/src/boost/regex/config.hpp index a88a785..e8cec5b 100644 --- a/3rdParty/Boost/src/boost/regex/config.hpp +++ b/3rdParty/Boost/src/boost/regex/config.hpp @@ -163,12 +163,17 @@ * with MSVC and the /Zc:wchar_t option we place some extra unsigned short versions * of the non-inline functions in the library, so that users can still link to the lib, * irrespective of whether their own code is built with /Zc:wchar_t. + * Note that this does NOT WORK with VC10 when the C++ locale is in effect as + * the locale's <unsigned short> facets simply do not compile in that case. */ -#if defined(__cplusplus) && (defined(BOOST_MSVC) || defined(__ICL)) && !defined(BOOST_NO_INTRINSIC_WCHAR_T) && defined(BOOST_WINDOWS) && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION) && !defined(BOOST_RWSTD_VER) +#if defined(__cplusplus) && (defined(BOOST_MSVC) || defined(__ICL)) && !defined(BOOST_NO_INTRINSIC_WCHAR_T) && defined(BOOST_WINDOWS) && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION) && !defined(BOOST_RWSTD_VER) && ((_MSC_VER < 1600) || !defined(BOOST_REGEX_USE_CPP_LOCALE)) # define BOOST_REGEX_HAS_OTHER_WCHAR_T # ifdef BOOST_MSVC # pragma warning(push) -# pragma warning(disable : 4251 4231 4660) +# pragma warning(disable : 4251 4231) +# if BOOST_MSVC < 1600 +# pragma warning(disable : 4660) +# endif # endif # if defined(_DLL) && defined(BOOST_MSVC) && (BOOST_MSVC < 1600) # include <string> @@ -220,7 +225,7 @@ ****************************************************************************/ #if defined(BOOST_MSVC) && (BOOST_MSVC >= 1200) && defined(_MSC_EXTENSIONS) -#if defined(_DEBUG) || defined(__MSVC_RUNTIME_CHECKS) || defined(_MANAGED) +#if defined(_DEBUG) || defined(__MSVC_RUNTIME_CHECKS) || defined(_MANAGED) || defined(BOOST_REGEX_NO_FASTCALL) # define BOOST_REGEX_CALL __cdecl #else # define BOOST_REGEX_CALL __fastcall diff --git a/3rdParty/Boost/src/boost/regex/icu.hpp b/3rdParty/Boost/src/boost/regex/icu.hpp index e9a55c0..772806e 100644 --- a/3rdParty/Boost/src/boost/regex/icu.hpp +++ b/3rdParty/Boost/src/boost/regex/icu.hpp @@ -251,7 +251,7 @@ inline u32regex do_make_u32regex(InputIterator i, const boost::mpl::int_<1>*) { typedef boost::u8_to_u32_iterator<InputIterator, UChar32> conv_type; - return u32regex(conv_type(i), conv_type(j), opt); + return u32regex(conv_type(i, i, j), conv_type(j, i, j), opt); } template <class InputIterator> @@ -261,7 +261,7 @@ inline u32regex do_make_u32regex(InputIterator i, const boost::mpl::int_<2>*) { typedef boost::u16_to_u32_iterator<InputIterator, UChar32> conv_type; - return u32regex(conv_type(i), conv_type(j), opt); + return u32regex(conv_type(i, i, j), conv_type(j, i, j), opt); } template <class InputIterator> @@ -282,7 +282,7 @@ inline u32regex do_make_u32regex(InputIterator i, typedef boost::u8_to_u32_iterator<InputIterator, UChar32> conv_type; typedef std::vector<UChar32> vector_type; vector_type v; - conv_type a(i), b(j); + conv_type a(i, i, j), b(j, i, j); while(a != b) { v.push_back(*a); @@ -302,7 +302,7 @@ inline u32regex do_make_u32regex(InputIterator i, typedef boost::u16_to_u32_iterator<InputIterator, UChar32> conv_type; typedef std::vector<UChar32> vector_type; vector_type v; - conv_type a(i), b(j); + conv_type a(i, i, j), b(j, i, j); while(a != b) { v.push_back(*a); @@ -425,7 +425,7 @@ bool do_regex_match(BidiIterator first, BidiIterator last, typedef match_results<conv_type> match_type; typedef typename match_type::allocator_type alloc_type; match_type what; - bool result = ::boost::regex_match(conv_type(first), conv_type(last), what, e, flags); + bool result = ::boost::regex_match(conv_type(first, first, last), conv_type(last, first, last), what, e, flags); // copy results across to m: if(result) copy_results(m, what); return result; @@ -441,7 +441,7 @@ bool do_regex_match(BidiIterator first, BidiIterator last, typedef match_results<conv_type> match_type; typedef typename match_type::allocator_type alloc_type; match_type what; - bool result = ::boost::regex_match(conv_type(first), conv_type(last), what, e, flags); + bool result = ::boost::regex_match(conv_type(first, first, last), conv_type(last, first, last), what, e, flags); // copy results across to m: if(result) copy_results(m, what); return result; @@ -600,7 +600,7 @@ bool do_regex_search(BidiIterator first, BidiIterator last, typedef match_results<conv_type> match_type; typedef typename match_type::allocator_type alloc_type; match_type what; - bool result = ::boost::regex_search(conv_type(first), conv_type(last), what, e, flags, conv_type(base)); + bool result = ::boost::regex_search(conv_type(first, first, last), conv_type(last, first, last), what, e, flags, conv_type(base)); // copy results across to m: if(result) copy_results(m, what); return result; @@ -617,7 +617,7 @@ bool do_regex_search(BidiIterator first, BidiIterator last, typedef match_results<conv_type> match_type; typedef typename match_type::allocator_type alloc_type; match_type what; - bool result = ::boost::regex_search(conv_type(first), conv_type(last), what, e, flags, conv_type(base)); + bool result = ::boost::regex_search(conv_type(first, first, last), conv_type(last, first, last), what, e, flags, conv_type(base)); // copy results across to m: if(result) copy_results(m, what); return result; @@ -764,13 +764,13 @@ template <class I> inline std::pair< boost::u8_to_u32_iterator<I>, boost::u8_to_u32_iterator<I> > make_utf32_seq(I i, I j, mpl::int_<1> const*) { - return std::pair< boost::u8_to_u32_iterator<I>, boost::u8_to_u32_iterator<I> >(boost::u8_to_u32_iterator<I>(i), boost::u8_to_u32_iterator<I>(j)); + return std::pair< boost::u8_to_u32_iterator<I>, boost::u8_to_u32_iterator<I> >(boost::u8_to_u32_iterator<I>(i, i, j), boost::u8_to_u32_iterator<I>(j, i, j)); } template <class I> inline std::pair< boost::u16_to_u32_iterator<I>, boost::u16_to_u32_iterator<I> > make_utf32_seq(I i, I j, mpl::int_<2> const*) { - return std::pair< boost::u16_to_u32_iterator<I>, boost::u16_to_u32_iterator<I> >(boost::u16_to_u32_iterator<I>(i), boost::u16_to_u32_iterator<I>(j)); + return std::pair< boost::u16_to_u32_iterator<I>, boost::u16_to_u32_iterator<I> >(boost::u16_to_u32_iterator<I>(i, i, j), boost::u16_to_u32_iterator<I>(j, i, j)); } template <class I> inline std::pair< I, I > @@ -782,13 +782,15 @@ template <class charT> inline std::pair< boost::u8_to_u32_iterator<const charT*>, boost::u8_to_u32_iterator<const charT*> > make_utf32_seq(const charT* p, mpl::int_<1> const*) { - return std::pair< boost::u8_to_u32_iterator<const charT*>, boost::u8_to_u32_iterator<const charT*> >(boost::u8_to_u32_iterator<const charT*>(p), boost::u8_to_u32_iterator<const charT*>(p+std::strlen((const char*)p))); + std::size_t len = std::strlen((const char*)p); + return std::pair< boost::u8_to_u32_iterator<const charT*>, boost::u8_to_u32_iterator<const charT*> >(boost::u8_to_u32_iterator<const charT*>(p, p, p+len), boost::u8_to_u32_iterator<const charT*>(p+len, p, p+len)); } template <class charT> inline std::pair< boost::u16_to_u32_iterator<const charT*>, boost::u16_to_u32_iterator<const charT*> > make_utf32_seq(const charT* p, mpl::int_<2> const*) { - return std::pair< boost::u16_to_u32_iterator<const charT*>, boost::u16_to_u32_iterator<const charT*> >(boost::u16_to_u32_iterator<const charT*>(p), boost::u16_to_u32_iterator<const charT*>(p+u_strlen((const UChar*)p))); + std::size_t len = u_strlen((const UChar*)p); + return std::pair< boost::u16_to_u32_iterator<const charT*>, boost::u16_to_u32_iterator<const charT*> >(boost::u16_to_u32_iterator<const charT*>(p, p, p + len), boost::u16_to_u32_iterator<const charT*>(p+len, p, p + len)); } template <class charT> inline std::pair< const charT*, const charT* > diff --git a/3rdParty/Boost/src/boost/regex/pending/object_cache.hpp b/3rdParty/Boost/src/boost/regex/pending/object_cache.hpp index db60e28..d47fbba 100644 --- a/3rdParty/Boost/src/boost/regex/pending/object_cache.hpp +++ b/3rdParty/Boost/src/boost/regex/pending/object_cache.hpp @@ -73,7 +73,7 @@ boost::shared_ptr<Object const> object_cache<Key, Object>::get(const Key& k, siz // for now just throw, but we should never really get here... // ::boost::throw_exception(std::runtime_error("Error in thread safety code: could not acquire a lock")); -#ifdef BOOST_NO_UNREACHABLE_RETURN_DETECTION +#if defined(BOOST_NO_UNREACHABLE_RETURN_DETECTION) || defined(BOOST_NO_EXCEPTIONS) return boost::shared_ptr<Object>(); #endif #else @@ -151,7 +151,7 @@ boost::shared_ptr<Object const> object_cache<Key, Object>::do_get(const Key& k, --s; } else - --pos; + ++pos; } BOOST_ASSERT(s_data.index[k]->first.get() == result.get()); BOOST_ASSERT(&(s_data.index.find(k)->first) == s_data.cont.back().second); diff --git a/3rdParty/Boost/src/boost/regex/pending/unicode_iterator.hpp b/3rdParty/Boost/src/boost/regex/pending/unicode_iterator.hpp index 657ca0a..e6399b5 100644 --- a/3rdParty/Boost/src/boost/regex/pending/unicode_iterator.hpp +++ b/3rdParty/Boost/src/boost/regex/pending/unicode_iterator.hpp @@ -82,16 +82,16 @@ static const ::boost::uint32_t ten_bit_mask = 0x3FFu; inline bool is_high_surrogate(::boost::uint16_t v) { - return (v & 0xFC00u) == 0xd800u; + return (v & 0xFFFFFC00u) == 0xd800u; } inline bool is_low_surrogate(::boost::uint16_t v) { - return (v & 0xFC00u) == 0xdc00u; + return (v & 0xFFFFFC00u) == 0xdc00u; } template <class T> inline bool is_surrogate(T v) { - return (v & 0xF800u) == 0xd800; + return (v & 0xFFFFF800u) == 0xd800; } inline unsigned utf8_byte_count(boost::uint8_t c) @@ -113,6 +113,10 @@ inline unsigned utf8_trailing_byte_count(boost::uint8_t c) return utf8_byte_count(c) - 1; } +#ifdef BOOST_MSVC +#pragma warning(push) +#pragma warning(disable:4100) +#endif inline void invalid_utf32_code_point(::boost::uint32_t val) { #ifndef BOOST_NO_STD_LOCALE @@ -124,6 +128,9 @@ inline void invalid_utf32_code_point(::boost::uint32_t val) #endif boost::throw_exception(e); } +#ifdef BOOST_MSVC +#pragma warning(pop) +#endif } // namespace detail @@ -296,6 +303,34 @@ public: { m_value = pending_read; } + // + // Range checked version: + // + u16_to_u32_iterator(BaseIterator b, BaseIterator start, BaseIterator end) : m_position(b) + { + m_value = pending_read; + // + // The range must not start with a low surrogate, or end in a high surrogate, + // otherwise we run the risk of running outside the underlying input range. + // Likewise b must not be located at a low surrogate. + // + boost::uint16_t val; + if(start != end) + { + if((b != start) && (b != end)) + { + val = *b; + if(detail::is_surrogate(val) && ((val & 0xFC00u) == 0xDC00u)) + invalid_code_point(val); + } + val = *start; + if(detail::is_surrogate(val) && ((val & 0xFC00u) == 0xDC00u)) + invalid_code_point(val); + val = *--end; + if(detail::is_high_surrogate(val)) + invalid_code_point(val); + } + } private: static void invalid_code_point(::boost::uint16_t val) { @@ -497,7 +532,7 @@ public: while((*--m_position & 0xC0u) == 0x80u) ++count; // now check that the sequence was valid: if(count != detail::utf8_trailing_byte_count(*m_position)) - invalid_sequnce(); + invalid_sequence(); m_value = pending_read; } BaseIterator base()const @@ -513,8 +548,37 @@ public: { m_value = pending_read; } + // + // Checked constructor: + // + u8_to_u32_iterator(BaseIterator b, BaseIterator start, BaseIterator end) : m_position(b) + { + m_value = pending_read; + // + // We must not start with a continuation character, or end with a + // truncated UTF-8 sequence otherwise we run the risk of going past + // the start/end of the underlying sequence: + // + if(start != end) + { + unsigned char v = *start; + if((v & 0xC0u) == 0x80u) + invalid_sequence(); + if((b != start) && (b != end) && ((*b & 0xC0u) == 0x80u)) + invalid_sequence(); + BaseIterator pos = end; + do + { + v = *--pos; + } + while((start != pos) && ((v & 0xC0u) == 0x80u)); + std::ptrdiff_t extra = detail::utf8_byte_count(v); + if(std::distance(pos, end) < extra) + invalid_sequence(); + } + } private: - static void invalid_sequnce() + static void invalid_sequence() { std::out_of_range e("Invalid UTF-8 sequence encountered while trying to encode UTF-32 character"); boost::throw_exception(e); @@ -524,7 +588,7 @@ private: m_value = static_cast<U32Type>(static_cast< ::boost::uint8_t>(*m_position)); // we must not have a continuation character: if((m_value & 0xC0u) == 0x80u) - invalid_sequnce(); + invalid_sequence(); // see how many extra byts we have: unsigned extra = detail::utf8_trailing_byte_count(*m_position); // extract the extra bits, 6 from each extra byte: @@ -547,7 +611,7 @@ private: m_value &= masks[extra]; // check the result: if(m_value > static_cast<U32Type>(0x10FFFFu)) - invalid_sequnce(); + invalid_sequence(); } BaseIterator m_position; mutable U32Type m_value; diff --git a/3rdParty/Boost/src/boost/regex/user.hpp b/3rdParty/Boost/src/boost/regex/user.hpp index 9590817..33b1013 100644 --- a/3rdParty/Boost/src/boost/regex/user.hpp +++ b/3rdParty/Boost/src/boost/regex/user.hpp @@ -88,3 +88,6 @@ // define this if you want to enable support for Unicode via ICU. // #define BOOST_HAS_ICU + +// define this if you want regex to use __cdecl calling convensions, even when __fastcall is available: +// #define BOOST_REGEX_NO_FASTCALL diff --git a/3rdParty/Boost/src/boost/regex/v4/basic_regex.hpp b/3rdParty/Boost/src/boost/regex/v4/basic_regex.hpp index 04c7bb3..0b63e3a 100644 --- a/3rdParty/Boost/src/boost/regex/v4/basic_regex.hpp +++ b/3rdParty/Boost/src/boost/regex/v4/basic_regex.hpp @@ -1,7 +1,7 @@ /* * - * Copyright (c) 1998-2004 - * John Maddock + * Copyright (c) 1998-2004 John Maddock + * Copyright 2011 Garmin Ltd. or its subsidiaries * * Distributed under the Boost Software License, Version 1.0. * (See accompanying file LICENSE_1_0.txt or copy at @@ -36,7 +36,10 @@ namespace boost{ #ifdef BOOST_MSVC #pragma warning(push) -#pragma warning(disable : 4251 4231 4660 4800) +#pragma warning(disable : 4251 4231 4800) +#if BOOST_MSVC < 1600 +#pragma warning(disable : 4660) +#endif #endif namespace re_detail{ @@ -234,7 +237,7 @@ public: std::pair<const_iterator, const_iterator> BOOST_REGEX_CALL subexpression(std::size_t n)const { if(n == 0) - throw std::out_of_range("0 is not a valid subexpression index."); + boost::throw_exception(std::out_of_range("0 is not a valid subexpression index.")); const std::pair<std::size_t, std::size_t>& pi = this->m_subs.at(n - 1); std::pair<const_iterator, const_iterator> p(expression() + pi.first, expression() + pi.second); return p; @@ -243,11 +246,11 @@ public: // begin, end: const_iterator BOOST_REGEX_CALL begin()const { - return (!this->m_status ? 0 : this->m_expression); + return (this->m_status ? 0 : this->m_expression); } const_iterator BOOST_REGEX_CALL end()const { - return (!this->m_status ? 0 : this->m_expression + this->m_expression_len); + return (this->m_status ? 0 : this->m_expression + this->m_expression_len); } flag_type BOOST_REGEX_CALL flags()const { @@ -398,7 +401,7 @@ public: typedef typename traits::string_type seq_type; seq_type a(arg_first, arg_last); if(a.size()) - assign(&*a.begin(), &*a.begin() + a.size(), f); + assign(static_cast<const charT*>(&*a.begin()), static_cast<const charT*>(&*a.begin() + a.size()), f); else assign(static_cast<const charT*>(0), static_cast<const charT*>(0), f); } @@ -487,7 +490,7 @@ public: std::pair<const_iterator, const_iterator> BOOST_REGEX_CALL subexpression(std::size_t n)const { if(!m_pimpl.get()) - throw std::logic_error("Can't access subexpressions in an invalid regex."); + boost::throw_exception(std::logic_error("Can't access subexpressions in an invalid regex.")); return m_pimpl->subexpression(n); } const_iterator BOOST_REGEX_CALL begin()const diff --git a/3rdParty/Boost/src/boost/regex/v4/basic_regex_creator.hpp b/3rdParty/Boost/src/boost/regex/v4/basic_regex_creator.hpp index efa9f7d..efb649c 100644 --- a/3rdParty/Boost/src/boost/regex/v4/basic_regex_creator.hpp +++ b/3rdParty/Boost/src/boost/regex/v4/basic_regex_creator.hpp @@ -66,7 +66,7 @@ class basic_char_set public: typedef digraph<charT> digraph_type; typedef typename traits::string_type string_type; - typedef typename traits::char_class_type mask_type; + typedef typename traits::char_class_type m_type; basic_char_set() { @@ -100,12 +100,12 @@ public: } m_empty = false; } - void add_class(mask_type m) + void add_class(m_type m) { m_classes |= m; m_empty = false; } - void add_negated_class(mask_type m) + void add_negated_class(m_type m) { m_negated_classes |= m; m_empty = false; @@ -162,11 +162,11 @@ public: { return m_equivalents.end(); } - mask_type classes()const + m_type classes()const { return m_classes; } - mask_type negated_classes()const + m_type negated_classes()const { return m_negated_classes; } @@ -179,8 +179,8 @@ private: std::vector<digraph_type> m_ranges; // a list of end points of our ranges bool m_negate; // true if the set is to be negated bool m_has_digraphs; // true if we have digraphs present - mask_type m_classes; // character classes to match - mask_type m_negated_classes; // negated character classes to match + m_type m_classes; // character classes to match + m_type m_negated_classes; // negated character classes to match bool m_empty; // whether we've added anything yet std::vector<digraph_type> m_equivalents; // a list of equivalence classes }; @@ -241,6 +241,7 @@ protected: unsigned m_backrefs; // bitmask of permitted backrefs boost::uintmax_t m_bad_repeats; // bitmask of repeats we can't deduce a startmap for; bool m_has_recursions; // set when we have recursive expresisons to fixup + std::vector<bool> m_recursion_checks; // notes which recursions we've followed while analysing this expression typename traits::char_class_type m_word_mask; // mask used to determine if a character is a word character typename traits::char_class_type m_mask_space; // mask used to determine if a character is a word character typename traits::char_class_type m_lower_mask; // mask used to determine if a character is a lowercase character @@ -366,9 +367,9 @@ re_syntax_base* basic_regex_creator<charT, traits>::append_set( { typedef typename traits::string_type string_type; typedef typename basic_char_set<charT, traits>::list_iterator item_iterator; - typedef typename traits::char_class_type mask_type; + typedef typename traits::char_class_type m_type; - re_set_long<mask_type>* result = static_cast<re_set_long<mask_type>*>(append_state(syntax_element_long_set, sizeof(re_set_long<mask_type>))); + re_set_long<m_type>* result = static_cast<re_set_long<m_type>*>(append_state(syntax_element_long_set, sizeof(re_set_long<m_type>))); // // fill in the basics: // @@ -512,28 +513,23 @@ re_syntax_base* basic_regex_creator<charT, traits>::append_set( // // finally reset the address of our last state: // - m_last_state = result = static_cast<re_set_long<mask_type>*>(getaddress(offset)); + m_last_state = result = static_cast<re_set_long<m_type>*>(getaddress(offset)); return result; } -namespace{ - template<class T> inline bool char_less(T t1, T t2) { return t1 < t2; } -template<> -inline bool char_less<char>(char t1, char t2) +inline bool char_less(char t1, char t2) { return static_cast<unsigned char>(t1) < static_cast<unsigned char>(t2); } -template<> -inline bool char_less<signed char>(signed char t1, signed char t2) +inline bool char_less(signed char t1, signed char t2) { return static_cast<unsigned char>(t1) < static_cast<unsigned char>(t2); } -} template <class charT, class traits> re_syntax_base* basic_regex_creator<charT, traits>::append_set( @@ -597,7 +593,7 @@ re_syntax_base* basic_regex_creator<charT, traits>::append_set( } else { - if(char_less<charT>(c2, c1)) + if(char_less(c2, c1)) { // Oops error: return 0; @@ -609,8 +605,8 @@ re_syntax_base* basic_regex_creator<charT, traits>::append_set( // // and now the classes: // - typedef typename traits::char_class_type mask_type; - mask_type m = char_set.classes(); + typedef typename traits::char_class_type m_type; + m_type m = char_set.classes(); if(flags() & regbase::icase) { // adjust m as needed: @@ -712,6 +708,8 @@ void basic_regex_creator<charT, traits>::finalize(const charT* p1, const charT* m_pdata->m_can_be_null = 0; m_bad_repeats = 0; + if(m_has_recursions) + m_recursion_checks.assign(1 + m_pdata->m_mark_count, false); create_startmap(m_pdata->m_first_state, m_pdata->m_startmap, &(m_pdata->m_can_be_null), mask_all); // get the restart type: m_pdata->m_restart_type = get_restart_type(m_pdata->m_first_state); @@ -948,9 +946,14 @@ void basic_regex_creator<charT, traits>::create_startmaps(re_syntax_base* state) state = state->next.p; } } + // now work through our list, building all the maps as we go: while(v.size()) { + // Initialize m_recursion_checks if we need it: + if(m_has_recursions) + m_recursion_checks.assign(1 + m_pdata->m_mark_count, false); + const std::pair<bool, re_syntax_base*>& p = v.back(); m_icase = p.first; state = p.second; @@ -960,6 +963,9 @@ void basic_regex_creator<charT, traits>::create_startmaps(re_syntax_base* state) m_bad_repeats = 0; create_startmap(state->next.p, static_cast<re_alt*>(state)->_map, &static_cast<re_alt*>(state)->can_be_null, mask_take); m_bad_repeats = 0; + + if(m_has_recursions) + m_recursion_checks.assign(1 + m_pdata->m_mark_count, false); create_startmap(static_cast<re_alt*>(state)->alt.p, static_cast<re_alt*>(state)->_map, &static_cast<re_alt*>(state)->can_be_null, mask_skip); // adjust the type of the state to allow for faster matching: state->type = this->get_repeat_type(state); @@ -971,7 +977,7 @@ void basic_regex_creator<charT, traits>::create_startmaps(re_syntax_base* state) template <class charT, class traits> int basic_regex_creator<charT, traits>::calculate_backstep(re_syntax_base* state) { - typedef typename traits::char_class_type mask_type; + typedef typename traits::char_class_type m_type; int result = 0; while(state) { @@ -1024,10 +1030,10 @@ int basic_regex_creator<charT, traits>::calculate_backstep(re_syntax_base* state state = rep->alt.p; continue; } - else if((state->type == syntax_element_long_set_rep)) + else if(state->type == syntax_element_long_set_rep) { BOOST_ASSERT(rep->next.p->type == syntax_element_long_set); - if(static_cast<re_set_long<mask_type>*>(rep->next.p)->singleton == 0) + if(static_cast<re_set_long<m_type>*>(rep->next.p)->singleton == 0) return -1; if(rep->max != rep->min) return -1; @@ -1038,7 +1044,7 @@ int basic_regex_creator<charT, traits>::calculate_backstep(re_syntax_base* state } return -1; case syntax_element_long_set: - if(static_cast<re_set_long<mask_type>*>(state)->singleton == 0) + if(static_cast<re_set_long<m_type>*>(state)->singleton == 0) return -1; result += 1; break; @@ -1102,9 +1108,9 @@ void basic_regex_creator<charT, traits>::create_startmap(re_syntax_base* state, if(l_map) { l_map[0] |= mask_init; - l_map['\n'] |= mask; - l_map['\r'] |= mask; - l_map['\f'] |= mask; + l_map[static_cast<unsigned>('\n')] |= mask; + l_map[static_cast<unsigned>('\r')] |= mask; + l_map[static_cast<unsigned>('\f')] |= mask; l_map[0x85] |= mask; } // now figure out if we can match a NULL string at this point: @@ -1114,7 +1120,11 @@ void basic_regex_creator<charT, traits>::create_startmap(re_syntax_base* state, } case syntax_element_recurse: { - if(recursion_start == state) + if(state->type == syntax_element_startmark) + recursion_sub = static_cast<re_brace*>(state)->index; + else + recursion_sub = 0; + if(m_recursion_checks[recursion_sub]) { // Infinite recursion!! if(0 == this->m_pdata->m_status) // update the error code if not already set @@ -1139,12 +1149,10 @@ void basic_regex_creator<charT, traits>::create_startmap(re_syntax_base* state, recursion_start = state; recursion_restart = state->next.p; state = static_cast<re_jump*>(state)->alt.p; - if(state->type == syntax_element_startmark) - recursion_sub = static_cast<re_brace*>(state)->index; - else - recursion_sub = 0; + m_recursion_checks[recursion_sub] = true; break; } + m_recursion_checks[recursion_sub] = true; // fall through, can't handle nested recursion here... } case syntax_element_backref: @@ -1206,14 +1214,14 @@ void basic_regex_creator<charT, traits>::create_startmap(re_syntax_base* state, case syntax_element_long_set: if(l_map) { - typedef typename traits::char_class_type mask_type; - if(static_cast<re_set_long<mask_type>*>(state)->singleton) + typedef typename traits::char_class_type m_type; + if(static_cast<re_set_long<m_type>*>(state)->singleton) { l_map[0] |= mask_init; for(unsigned int i = 0; i < (1u << CHAR_BIT); ++i) { charT c = static_cast<charT>(i); - if(&c != re_is_set_member(&c, &c + 1, static_cast<re_set_long<mask_type>*>(state), *m_pdata, m_icase)) + if(&c != re_is_set_member(&c, &c + 1, static_cast<re_set_long<m_type>*>(state), *m_pdata, l_icase)) l_map[i] |= mask; } } @@ -1289,8 +1297,8 @@ void basic_regex_creator<charT, traits>::create_startmap(re_syntax_base* state, if(l_map) { l_map[0] |= mask_init; - l_map['\n'] |= mask; - l_map['\r'] |= mask; + l_map[static_cast<unsigned>('\n')] |= mask; + l_map[static_cast<unsigned>('\r')] |= mask; } if(pnull) *pnull |= mask; @@ -1325,7 +1333,7 @@ void basic_regex_creator<charT, traits>::create_startmap(re_syntax_base* state, re_syntax_base* p = m_pdata->m_first_state; while(p) { - if((p->type == syntax_element_recurse)) + if(p->type == syntax_element_recurse) { re_brace* p2 = static_cast<re_brace*>(static_cast<re_jump*>(p)->alt.p); if((p2->type == syntax_element_startmark) && (p2->index == static_cast<re_brace*>(state)->index)) @@ -1456,7 +1464,7 @@ void basic_regex_creator<charT, traits>::set_bad_repeat(re_syntax_base* pt) template <class charT, class traits> syntax_element_type basic_regex_creator<charT, traits>::get_repeat_type(re_syntax_base* state) { - typedef typename traits::char_class_type mask_type; + typedef typename traits::char_class_type m_type; if(state->type == syntax_element_rep) { // check to see if we are repeating a single state: @@ -1471,7 +1479,7 @@ syntax_element_type basic_regex_creator<charT, traits>::get_repeat_type(re_synta case re_detail::syntax_element_set: return re_detail::syntax_element_short_set_rep; case re_detail::syntax_element_long_set: - if(static_cast<re_detail::re_set_long<mask_type>*>(state->next.p)->singleton) + if(static_cast<re_detail::re_set_long<m_type>*>(state->next.p)->singleton) return re_detail::syntax_element_long_set_rep; break; default: diff --git a/3rdParty/Boost/src/boost/regex/v4/basic_regex_parser.hpp b/3rdParty/Boost/src/boost/regex/v4/basic_regex_parser.hpp index 4dacfc6..72dc4ee 100644 --- a/3rdParty/Boost/src/boost/regex/v4/basic_regex_parser.hpp +++ b/3rdParty/Boost/src/boost/regex/v4/basic_regex_parser.hpp @@ -191,6 +191,7 @@ void basic_regex_parser<charT, traits>::fail(regex_constants::error_type error_c this->m_pdata->m_status = error_code; m_position = m_end; // don't bother parsing anything else +#ifndef BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS // // Augment error message with the regular expression text: // @@ -200,9 +201,9 @@ void basic_regex_parser<charT, traits>::fail(regex_constants::error_type error_c if(error_code != regex_constants::error_empty) { if((start_pos != 0) || (end_pos != (m_end - m_base))) - message += " The error occured while parsing the regular expression fragment: '"; + message += " The error occurred while parsing the regular expression fragment: '"; else - message += " The error occured while parsing the regular expression: '"; + message += " The error occurred while parsing the regular expression: '"; if(start_pos != end_pos) { message += std::string(m_base + start_pos, m_base + position); @@ -211,6 +212,7 @@ void basic_regex_parser<charT, traits>::fail(regex_constants::error_type error_c } message += "'."; } +#endif #ifndef BOOST_NO_EXCEPTIONS if(0 == (this->flags() & regex_constants::no_except)) @@ -660,6 +662,11 @@ template <class charT, class traits> bool basic_regex_parser<charT, traits>::parse_extended_escape() { ++m_position; + if(m_position == m_end) + { + fail(regex_constants::error_escape, m_position - m_base, "Incomplete escape sequence found."); + return false; + } bool negate = false; // in case this is a character class escape: \w \d etc switch(this->m_traits.escape_syntax_type(*m_position)) { @@ -669,8 +676,8 @@ bool basic_regex_parser<charT, traits>::parse_extended_escape() case regex_constants::escape_type_class: { escape_type_class_jump: - typedef typename traits::char_class_type mask_type; - mask_type m = this->m_traits.lookup_classname(m_position, m_position+1); + typedef typename traits::char_class_type m_type; + m_type m = this->m_traits.lookup_classname(m_position, m_position+1); if(m != 0) { basic_char_set<charT, traits> char_set; @@ -941,7 +948,8 @@ bool basic_regex_parser<charT, traits>::parse_repeat(std::size_t low, std::size_ ++m_position; } // for perl regexes only check for pocessive ++ repeats. - if((0 == (this->flags() & regbase::main_option_type)) + if((m_position != m_end) + && (0 == (this->flags() & regbase::main_option_type)) && (this->m_traits.syntax_type(*m_position) == regex_constants::syntax_plus)) { pocessive = true; @@ -1025,13 +1033,14 @@ bool basic_regex_parser<charT, traits>::parse_repeat(std::size_t low, std::size_ { // // Check for illegal following quantifier, we have to do this here, because - // the extra states we insert below circumvents are usual error checking :-( + // the extra states we insert below circumvents our usual error checking :-( // switch(this->m_traits.syntax_type(*m_position)) { case regex_constants::syntax_star: case regex_constants::syntax_plus: case regex_constants::syntax_question: + case regex_constants::syntax_open_brace: fail(regex_constants::error_badrepeat, m_position - m_base); return false; } @@ -1381,8 +1390,8 @@ bool basic_regex_parser<charT, traits>::parse_inner_set(basic_char_set<charT, tr ++name_first; negated = true; } - typedef typename traits::char_class_type mask_type; - mask_type m = this->m_traits.lookup_classname(name_first, name_last); + typedef typename traits::char_class_type m_type; + m_type m = this->m_traits.lookup_classname(name_first, name_last); if(m == 0) { if(char_set.empty() && (name_last - name_first == 1)) @@ -2087,6 +2096,14 @@ insert_recursion: return false; } v = this->m_traits.toi(m_position, m_end, 10); + if(m_position == m_end) + { + // Rewind to start of (? sequence: + --m_position; + while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position; + fail(regex_constants::error_perl_extension, m_position - m_base); + return false; + } if(*m_position == charT('R')) { if(++m_position == m_end) @@ -2490,9 +2507,11 @@ option_group_jump: this->m_pdata->m_data.align(); re_jump* jmp = static_cast<re_jump*>(this->getaddress(jump_offset)); jmp->alt.i = this->m_pdata->m_data.size() - this->getoffset(jmp); - if(this->m_last_state == jmp) + if((this->m_last_state == jmp) && (markid != -2)) { - // Oops... we didn't have anything inside the assertion: + // Oops... we didn't have anything inside the assertion. + // Note we don't get here for negated forward lookahead as (?!) + // does have some uses. // Rewind to start of (? sequence: --m_position; while(this->m_traits.syntax_type(*m_position) != regex_constants::syntax_open_mark) --m_position; @@ -2711,6 +2730,8 @@ regex_constants::syntax_option_type basic_regex_parser<charT, traits>::parse_opt } } while(!breakout); + + breakout = false; if(*m_position == static_cast<charT>('-')) { diff --git a/3rdParty/Boost/src/boost/regex/v4/cpp_regex_traits.hpp b/3rdParty/Boost/src/boost/regex/v4/cpp_regex_traits.hpp index cd22bd8..bcae455 100644 --- a/3rdParty/Boost/src/boost/regex/v4/cpp_regex_traits.hpp +++ b/3rdParty/Boost/src/boost/regex/v4/cpp_regex_traits.hpp @@ -1,7 +1,7 @@ /* * - * Copyright (c) 2004 - * John Maddock + * Copyright (c) 2004 John Maddock + * Copyright 2011 Garmin Ltd. or its subsidiaries * * Use, modification and distribution are subject to the * Boost Software License, Version 1.0. (See accompanying file @@ -511,7 +511,9 @@ typename cpp_regex_traits_implementation<charT>::string_type // however at least one std lib will always throw // std::bad_alloc for certain arguments... // +#ifndef BOOST_NO_EXCEPTIONS try{ +#endif // // What we do here depends upon the format of the sort key returned by // sort key returned by this->transform: @@ -546,7 +548,9 @@ typename cpp_regex_traits_implementation<charT>::string_type result.erase(i); break; } +#ifndef BOOST_NO_EXCEPTIONS }catch(...){} +#endif while(result.size() && (charT(0) == *result.rbegin())) result.erase(result.size() - 1); if(result.empty()) @@ -576,7 +580,9 @@ typename cpp_regex_traits_implementation<charT>::string_type // std::bad_alloc for certain arguments... // string_type result; +#ifndef BOOST_NO_EXCEPTIONS try{ +#endif result = this->m_pcollate->transform(p1, p2); // // Borland's STLPort version returns a NULL-terminated @@ -593,10 +599,12 @@ typename cpp_regex_traits_implementation<charT>::string_type result.erase(result.size() - 1); #endif BOOST_ASSERT(std::find(result.begin(), result.end(), charT(0)) == result.end()); +#ifndef BOOST_NO_EXCEPTIONS } catch(...) { } +#endif return result; } diff --git a/3rdParty/Boost/src/boost/regex/v4/instances.hpp b/3rdParty/Boost/src/boost/regex/v4/instances.hpp index c62d136..2839c0b 100644 --- a/3rdParty/Boost/src/boost/regex/v4/instances.hpp +++ b/3rdParty/Boost/src/boost/regex/v4/instances.hpp @@ -84,7 +84,10 @@ template class BOOST_REGEX_DECL ::boost::re_detail::perl_matcher<BOOST_REGEX_CHA # ifdef BOOST_MSVC # pragma warning(push) -# pragma warning(disable : 4251 4231 4660) +# pragma warning(disable : 4251 4231) +# if BOOST_MSVC < 1600 +# pragma warning(disable : 4660) +# endif # endif template class BOOST_REGEX_TEMPLATE_DECL basic_regex< BOOST_REGEX_CHAR_T BOOST_REGEX_TRAITS_T >; diff --git a/3rdParty/Boost/src/boost/regex/v4/match_results.hpp b/3rdParty/Boost/src/boost/regex/v4/match_results.hpp index ca9898f..63e5117 100644 --- a/3rdParty/Boost/src/boost/regex/v4/match_results.hpp +++ b/3rdParty/Boost/src/boost/regex/v4/match_results.hpp @@ -33,7 +33,10 @@ namespace boost{ #ifdef BOOST_MSVC #pragma warning(push) -#pragma warning(disable : 4251 4231 4660) +#pragma warning(disable : 4251 4231) +# if BOOST_MSVC < 1600 +# pragma warning(disable : 4660) +# endif #endif namespace re_detail{ diff --git a/3rdParty/Boost/src/boost/regex/v4/perl_matcher.hpp b/3rdParty/Boost/src/boost/regex/v4/perl_matcher.hpp index 52cc55c..ddaafbd 100644 --- a/3rdParty/Boost/src/boost/regex/v4/perl_matcher.hpp +++ b/3rdParty/Boost/src/boost/regex/v4/perl_matcher.hpp @@ -344,7 +344,10 @@ struct recursion_info #ifdef BOOST_MSVC #pragma warning(push) -#pragma warning(disable : 4251 4231 4660) +#pragma warning(disable : 4251 4231) +# if BOOST_MSVC < 1600 +# pragma warning(disable : 4660) +# endif #endif template <class BidiIterator, class Allocator, class traits> diff --git a/3rdParty/Boost/src/boost/regex/v4/perl_matcher_non_recursive.hpp b/3rdParty/Boost/src/boost/regex/v4/perl_matcher_non_recursive.hpp index 7ab6781..0da43e3 100644 --- a/3rdParty/Boost/src/boost/regex/v4/perl_matcher_non_recursive.hpp +++ b/3rdParty/Boost/src/boost/regex/v4/perl_matcher_non_recursive.hpp @@ -828,9 +828,9 @@ bool perl_matcher<BidiIterator, Allocator, traits>::match_long_set_repeat() #ifdef __BORLANDC__ #pragma option push -w-8008 -w-8066 -w-8004 #endif - typedef typename traits::char_class_type mask_type; + typedef typename traits::char_class_type m_type; const re_repeat* rep = static_cast<const re_repeat*>(pstate); - const re_set_long<mask_type>* set = static_cast<const re_set_long<mask_type>*>(pstate->next.p); + const re_set_long<m_type>* set = static_cast<const re_set_long<m_type>*>(pstate->next.p); std::size_t count = 0; // // start by working out how much we can skip: @@ -1434,7 +1434,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::unwind_short_set_repeat(bool template <class BidiIterator, class Allocator, class traits> bool perl_matcher<BidiIterator, Allocator, traits>::unwind_long_set_repeat(bool r) { - typedef typename traits::char_class_type mask_type; + typedef typename traits::char_class_type m_type; saved_single_repeat<BidiIterator>* pmp = static_cast<saved_single_repeat<BidiIterator>*>(m_backup_state); // if we have a match, just discard this state: @@ -1447,7 +1447,7 @@ bool perl_matcher<BidiIterator, Allocator, traits>::unwind_long_set_repeat(bool const re_repeat* rep = pmp->rep; std::size_t count = pmp->count; pstate = rep->next.p; - const re_set_long<mask_type>* set = static_cast<const re_set_long<mask_type>*>(pstate); + const re_set_long<m_type>* set = static_cast<const re_set_long<m_type>*>(pstate); position = pmp->last_position; BOOST_ASSERT(rep->type == syntax_element_long_set_rep); diff --git a/3rdParty/Boost/src/boost/regex/v4/regex_format.hpp b/3rdParty/Boost/src/boost/regex/v4/regex_format.hpp index 4406839..3b1d19d 100644 --- a/3rdParty/Boost/src/boost/regex/v4/regex_format.hpp +++ b/3rdParty/Boost/src/boost/regex/v4/regex_format.hpp @@ -180,8 +180,14 @@ private: } inline int toi(ForwardIter& i, ForwardIter j, int base) { +#if defined(_MSC_VER) && defined(__INTEL_COMPILER) && ((__INTEL_COMPILER == 9999) || (__INTEL_COMPILER == 1210)) + // Workaround for Intel support issue #656654. + // See also https://svn.boost.org/trac/boost/ticket/6359 + return toi(i, j, base, mpl::false_()); +#else typedef typename boost::is_convertible<ForwardIter, const char_type*&>::type tag_type; return toi(i, j, base, tag_type()); +#endif } const traits& m_traits; // the traits class for localised formatting operations @@ -842,7 +848,15 @@ OutputIterator regex_format_imp(OutputIterator out, BOOST_MPL_HAS_XXX_TRAIT_DEF(const_iterator) -struct any_type { any_type(...); }; +struct any_type +{ + template <class T> + any_type(const T&); + template <class T, class U> + any_type(const T&, const U&); + template <class T, class U, class V> + any_type(const T&, const U&, const V&); +}; typedef char no_type; typedef char (&unary_type)[2]; typedef char (&binary_type)[3]; diff --git a/3rdParty/Boost/src/boost/regex/v4/regex_iterator.hpp b/3rdParty/Boost/src/boost/regex/v4/regex_iterator.hpp index c2f2c49..09e75c6 100644 --- a/3rdParty/Boost/src/boost/regex/v4/regex_iterator.hpp +++ b/3rdParty/Boost/src/boost/regex/v4/regex_iterator.hpp @@ -68,7 +68,7 @@ public: // flags |= match_prev_avail; BidirectionalIterator next_start = what[0].second; match_flag_type f(flags); - if(!what.length()) + if(!what.length() || (f & regex_constants::match_posix)) f |= regex_constants::match_not_initial_null; //if(base != next_start) // f |= regex_constants::match_not_bob; diff --git a/3rdParty/Boost/src/boost/regex/v4/u32regex_token_iterator.hpp b/3rdParty/Boost/src/boost/regex/v4/u32regex_token_iterator.hpp index 4b0ac92..de16771 100644 --- a/3rdParty/Boost/src/boost/regex/v4/u32regex_token_iterator.hpp +++ b/3rdParty/Boost/src/boost/regex/v4/u32regex_token_iterator.hpp @@ -317,14 +317,14 @@ inline u32regex_token_iterator<const wchar_t*> make_u32regex_token_iterator(cons template <std::size_t N> inline u32regex_token_iterator<const UChar*> make_u32regex_token_iterator(const UChar* p, const u32regex& e, const int (&submatch)[N], regex_constants::match_flag_type m = regex_constants::match_default) { - return u32regex_token_iterator<const UChar*>(p, p+u_strlen(p), e, m); + return u32regex_token_iterator<const UChar*>(p, p+u_strlen(p), e, submatch, m); } #endif template <class charT, class Traits, class Alloc, std::size_t N> inline u32regex_token_iterator<typename std::basic_string<charT, Traits, Alloc>::const_iterator> make_u32regex_token_iterator(const std::basic_string<charT, Traits, Alloc>& p, const u32regex& e, const int (&submatch)[N], regex_constants::match_flag_type m = regex_constants::match_default) { typedef typename std::basic_string<charT, Traits, Alloc>::const_iterator iter_type; - return u32regex_token_iterator<iter_type>(p.begin(), p.end(), e, m); + return u32regex_token_iterator<iter_type>(p.begin(), p.end(), e, submatch, m); } template <std::size_t N> inline u32regex_token_iterator<const UChar*> make_u32regex_token_iterator(const U_NAMESPACE_QUALIFIER UnicodeString& s, const u32regex& e, const int (&submatch)[N], regex_constants::match_flag_type m = regex_constants::match_default) @@ -354,7 +354,7 @@ template <class charT, class Traits, class Alloc> inline u32regex_token_iterator<typename std::basic_string<charT, Traits, Alloc>::const_iterator> make_u32regex_token_iterator(const std::basic_string<charT, Traits, Alloc>& p, const u32regex& e, const std::vector<int>& submatch, regex_constants::match_flag_type m = regex_constants::match_default) { typedef typename std::basic_string<charT, Traits, Alloc>::const_iterator iter_type; - return u32regex_token_iterator<iter_type>(p.begin(), p.end(), e, m); + return u32regex_token_iterator<iter_type>(p.begin(), p.end(), e, submatch, m); } inline u32regex_token_iterator<const UChar*> make_u32regex_token_iterator(const U_NAMESPACE_QUALIFIER UnicodeString& s, const u32regex& e, const std::vector<int>& submatch, regex_constants::match_flag_type m = regex_constants::match_default) { diff --git a/3rdParty/Boost/src/boost/signals/connection.hpp b/3rdParty/Boost/src/boost/signals/connection.hpp index 48493aa..1ede6be 100644 --- a/3rdParty/Boost/src/boost/signals/connection.hpp +++ b/3rdParty/Boost/src/boost/signals/connection.hpp @@ -132,7 +132,7 @@ namespace boost { connection release(); - inline void swap(scoped_connection&); + void swap(scoped_connection&); scoped_connection& operator=(const connection&); scoped_connection& operator=(const scoped_connection&); diff --git a/3rdParty/Boost/src/boost/signals/detail/named_slot_map.hpp b/3rdParty/Boost/src/boost/signals/detail/named_slot_map.hpp index 763013f..88625fa 100644 --- a/3rdParty/Boost/src/boost/signals/detail/named_slot_map.hpp +++ b/3rdParty/Boost/src/boost/signals/detail/named_slot_map.hpp @@ -127,7 +127,7 @@ public: || slot_ == other.slot_)); } -#if BOOST_WORKAROUND(_MSC_VER, <= 1600) +#if BOOST_WORKAROUND(_MSC_VER, <= 1700) void decrement(); void advance(difference_type); #endif diff --git a/3rdParty/Boost/src/boost/smart_ptr.hpp b/3rdParty/Boost/src/boost/smart_ptr.hpp index 98e0894..b5e569d 100644 --- a/3rdParty/Boost/src/boost/smart_ptr.hpp +++ b/3rdParty/Boost/src/boost/smart_ptr.hpp @@ -1,3 +1,6 @@ +#ifndef BOOST_SMART_PTR_HPP_INCLUDED +#define BOOST_SMART_PTR_HPP_INCLUDED + // // smart_ptr.hpp // @@ -22,4 +25,7 @@ # include <boost/weak_ptr.hpp> # include <boost/intrusive_ptr.hpp> # include <boost/enable_shared_from_this.hpp> +# include <boost/make_shared.hpp> #endif + +#endif // #ifndef BOOST_SMART_PTR_HPP_INCLUDED diff --git a/3rdParty/Boost/src/boost/smart_ptr/detail/shared_count.hpp b/3rdParty/Boost/src/boost/smart_ptr/detail/shared_count.hpp index 4943e37..f96a220 100644 --- a/3rdParty/Boost/src/boost/smart_ptr/detail/shared_count.hpp +++ b/3rdParty/Boost/src/boost/smart_ptr/detail/shared_count.hpp @@ -52,6 +52,10 @@ int const weak_count_id = 0x298C38A4; struct sp_nothrow_tag {}; +template< class D > struct sp_inplace_tag +{ +}; + class weak_count; class shared_count @@ -142,6 +146,40 @@ public: #endif } +#if !defined( BOOST_NO_FUNCTION_TEMPLATE_ORDERING ) + + template< class P, class D > shared_count( P p, sp_inplace_tag<D> ): pi_( 0 ) +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + , id_(shared_count_id) +#endif + { +#ifndef BOOST_NO_EXCEPTIONS + + try + { + pi_ = new sp_counted_impl_pd< P, D >( p ); + } + catch( ... ) + { + D()( p ); // delete p + throw; + } + +#else + + pi_ = new sp_counted_impl_pd< P, D >( p ); + + if( pi_ == 0 ) + { + D()( p ); // delete p + boost::throw_exception( std::bad_alloc() ); + } + +#endif // #ifndef BOOST_NO_EXCEPTIONS + } + +#endif // !defined( BOOST_NO_FUNCTION_TEMPLATE_ORDERING ) + template<class P, class D, class A> shared_count( P p, D d, A a ): pi_( 0 ) #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) , id_(shared_count_id) @@ -188,6 +226,56 @@ public: #endif } +#if !defined( BOOST_NO_FUNCTION_TEMPLATE_ORDERING ) + + template< class P, class D, class A > shared_count( P p, sp_inplace_tag< D >, A a ): pi_( 0 ) +#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) + , id_(shared_count_id) +#endif + { + typedef sp_counted_impl_pda< P, D, A > impl_type; + typedef typename A::template rebind< impl_type >::other A2; + + A2 a2( a ); + +#ifndef BOOST_NO_EXCEPTIONS + + try + { + pi_ = a2.allocate( 1, static_cast< impl_type* >( 0 ) ); + new( static_cast< void* >( pi_ ) ) impl_type( p, a ); + } + catch(...) + { + D()( p ); + + if( pi_ != 0 ) + { + a2.deallocate( static_cast< impl_type* >( pi_ ), 1 ); + } + + throw; + } + +#else + + pi_ = a2.allocate( 1, static_cast< impl_type* >( 0 ) ); + + if( pi_ != 0 ) + { + new( static_cast< void* >( pi_ ) ) impl_type( p, a ); + } + else + { + D()( p ); + boost::throw_exception( std::bad_alloc() ); + } + +#endif // #ifndef BOOST_NO_EXCEPTIONS + } + +#endif // !defined( BOOST_NO_FUNCTION_TEMPLATE_ORDERING ) + #ifndef BOOST_NO_AUTO_PTR // auto_ptr<Y> is special cased to provide the strong guarantee diff --git a/3rdParty/Boost/src/boost/smart_ptr/detail/sp_counted_base.hpp b/3rdParty/Boost/src/boost/smart_ptr/detail/sp_counted_base.hpp index cab45cc..24adfcc 100644 --- a/3rdParty/Boost/src/boost/smart_ptr/detail/sp_counted_base.hpp +++ b/3rdParty/Boost/src/boost/smart_ptr/detail/sp_counted_base.hpp @@ -41,6 +41,9 @@ #elif defined(__HP_aCC) && defined(__ia64) # include <boost/smart_ptr/detail/sp_counted_base_acc_ia64.hpp> +#elif defined( __IBMCPP__ ) && defined( __powerpc ) +# include <boost/smart_ptr/detail/sp_counted_base_vacpp_ppc.hpp> + #elif defined( __MWERKS__ ) && defined( __POWERPC__ ) # include <boost/smart_ptr/detail/sp_counted_base_cw_ppc.hpp> diff --git a/3rdParty/Boost/src/boost/smart_ptr/detail/sp_counted_base_gcc_mips.hpp b/3rdParty/Boost/src/boost/smart_ptr/detail/sp_counted_base_gcc_mips.hpp index 0c69b0b..3f1f449 100644 --- a/3rdParty/Boost/src/boost/smart_ptr/detail/sp_counted_base_gcc_mips.hpp +++ b/3rdParty/Boost/src/boost/smart_ptr/detail/sp_counted_base_gcc_mips.hpp @@ -37,9 +37,12 @@ inline void atomic_increment( int * pw ) __asm__ __volatile__ ( "0:\n\t" + ".set push\n\t" + ".set mips2\n\t" "ll %0, %1\n\t" "addiu %0, 1\n\t" "sc %0, %1\n\t" + ".set pop\n\t" "beqz %0, 0b": "=&r"( tmp ), "=m"( *pw ): "m"( *pw ) @@ -55,9 +58,12 @@ inline int atomic_decrement( int * pw ) __asm__ __volatile__ ( "0:\n\t" + ".set push\n\t" + ".set mips2\n\t" "ll %1, %2\n\t" "addiu %0, %1, -1\n\t" "sc %0, %2\n\t" + ".set pop\n\t" "beqz %0, 0b\n\t" "addiu %0, %1, -1": "=&r"( rv ), "=&r"( tmp ), "=m"( *pw ): @@ -78,10 +84,13 @@ inline int atomic_conditional_increment( int * pw ) __asm__ __volatile__ ( "0:\n\t" + ".set push\n\t" + ".set mips2\n\t" "ll %0, %2\n\t" "beqz %0, 1f\n\t" "addiu %1, %0, 1\n\t" "sc %1, %2\n\t" + ".set pop\n\t" "beqz %1, 0b\n\t" "addiu %0, %0, 1\n\t" "1:": diff --git a/3rdParty/Boost/src/boost/smart_ptr/detail/sp_counted_base_vacpp_ppc.hpp b/3rdParty/Boost/src/boost/smart_ptr/detail/sp_counted_base_vacpp_ppc.hpp new file mode 100644 index 0000000..842f58f --- /dev/null +++ b/3rdParty/Boost/src/boost/smart_ptr/detail/sp_counted_base_vacpp_ppc.hpp @@ -0,0 +1,150 @@ +#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_VACPP_PPC_HPP_INCLUDED +#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_VACPP_PPC_HPP_INCLUDED + +// +// detail/sp_counted_base_vacpp_ppc.hpp - xlC(vacpp) on POWER +// based on: detail/sp_counted_base_w32.hpp +// +// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd. +// Copyright 2004-2005 Peter Dimov +// Copyright 2006 Michael van der Westhuizen +// Copyright 2012 IBM Corp. +// +// 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) +// +// +// Lock-free algorithm by Alexander Terekhov +// +// Thanks to Ben Hitchings for the #weak + (#shared != 0) +// formulation +// + +#include <boost/detail/sp_typeinfo.hpp> + +extern "builtin" void __lwsync(void); +extern "builtin" void __isync(void); +extern "builtin" int __fetch_and_add(volatile int* addr, int val); +extern "builtin" int __compare_and_swap(volatile int*, int*, int); + +namespace boost +{ + +namespace detail +{ + +inline void atomic_increment( int *pw ) +{ + // ++*pw; + __lwsync(); + __fetch_and_add(pw, 1); + __isync(); +} + +inline int atomic_decrement( int *pw ) +{ + // return --*pw; + __lwsync(); + int originalValue = __fetch_and_add(pw, -1); + __isync(); + + return (originalValue - 1); +} + +inline int atomic_conditional_increment( int *pw ) +{ + // if( *pw != 0 ) ++*pw; + // return *pw; + + __lwsync(); + int v = *const_cast<volatile int*>(pw); + for (;;) + // loop until state is known + { + if (v == 0) return 0; + if (__compare_and_swap(pw, &v, v + 1)) + { + __isync(); return (v + 1); + } + } +} + +class sp_counted_base +{ +private: + + sp_counted_base( sp_counted_base const & ); + sp_counted_base & operator= ( sp_counted_base const & ); + + int use_count_; // #shared + int weak_count_; // #weak + (#shared != 0) + char pad[64] __attribute__((__aligned__(64))); + // pad to prevent false sharing +public: + + sp_counted_base(): use_count_( 1 ), weak_count_( 1 ) + { + } + + virtual ~sp_counted_base() // nothrow + { + } + + // dispose() is called when use_count_ drops to zero, to release + // the resources managed by *this. + + virtual void dispose() = 0; // nothrow + + // destroy() is called when weak_count_ drops to zero. + + virtual void destroy() // nothrow + { + delete this; + } + + virtual void * get_deleter( sp_typeinfo const & ti ) = 0; + + void add_ref_copy() + { + atomic_increment( &use_count_ ); + } + + bool add_ref_lock() // true on success + { + return atomic_conditional_increment( &use_count_ ) != 0; + } + + void release() // nothrow + { + if( atomic_decrement( &use_count_ ) == 0 ) + { + dispose(); + weak_release(); + } + } + + void weak_add_ref() // nothrow + { + atomic_increment( &weak_count_ ); + } + + void weak_release() // nothrow + { + if( atomic_decrement( &weak_count_ ) == 0 ) + { + destroy(); + } + } + + long use_count() const // nothrow + { + return *const_cast<volatile int*>(&use_count_); + } +}; + +} // namespace detail + +} // namespace boost + +#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_VACPP_PPC_HPP_INCLUDED diff --git a/3rdParty/Boost/src/boost/smart_ptr/detail/sp_counted_impl.hpp b/3rdParty/Boost/src/boost/smart_ptr/detail/sp_counted_impl.hpp index 397421a..aab39bd 100644 --- a/3rdParty/Boost/src/boost/smart_ptr/detail/sp_counted_impl.hpp +++ b/3rdParty/Boost/src/boost/smart_ptr/detail/sp_counted_impl.hpp @@ -135,7 +135,11 @@ public: // pre: d(p) must not throw - sp_counted_impl_pd( P p, D d ): ptr(p), del(d) + sp_counted_impl_pd( P p, D & d ): ptr( p ), del( d ) + { + } + + sp_counted_impl_pd( P p ): ptr( p ), del() { } @@ -195,7 +199,11 @@ public: // pre: d( p ) must not throw - sp_counted_impl_pda( P p, D d, A a ): p_( p ), d_( d ), a_( a ) + sp_counted_impl_pda( P p, D & d, A a ): p_( p ), d_( d ), a_( a ) + { + } + + sp_counted_impl_pda( P p, A a ): p_( p ), d_(), a_( a ) { } diff --git a/3rdParty/Boost/src/boost/smart_ptr/detail/sp_has_sync.hpp b/3rdParty/Boost/src/boost/smart_ptr/detail/sp_has_sync.hpp index 7fcd09e..12acea8 100644 --- a/3rdParty/Boost/src/boost/smart_ptr/detail/sp_has_sync.hpp +++ b/3rdParty/Boost/src/boost/smart_ptr/detail/sp_has_sync.hpp @@ -20,7 +20,7 @@ // are available. // -#if defined(__GNUC__) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 401 ) +#if defined( __GNUC__ ) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 401 ) && !defined( BOOST_SP_NO_SYNC ) #define BOOST_SP_HAS_SYNC @@ -36,6 +36,10 @@ #undef BOOST_SP_HAS_SYNC #endif +#if defined( __sh__ ) +#undef BOOST_SP_HAS_SYNC +#endif + #if defined( __sparc__ ) #undef BOOST_SP_HAS_SYNC #endif diff --git a/3rdParty/Boost/src/boost/smart_ptr/detail/spinlock.hpp b/3rdParty/Boost/src/boost/smart_ptr/detail/spinlock.hpp index 1640a38..88d7ad6 100644 --- a/3rdParty/Boost/src/boost/smart_ptr/detail/spinlock.hpp +++ b/3rdParty/Boost/src/boost/smart_ptr/detail/spinlock.hpp @@ -31,7 +31,10 @@ #include <boost/config.hpp> #include <boost/smart_ptr/detail/sp_has_sync.hpp> -#if defined(__GNUC__) && defined( __arm__ ) && !defined( __thumb__ ) +#if defined( BOOST_SP_USE_PTHREADS ) +# include <boost/smart_ptr/detail/spinlock_pt.hpp> + +#elif defined(__GNUC__) && defined( __arm__ ) && !defined( __thumb__ ) # include <boost/smart_ptr/detail/spinlock_gcc_arm.hpp> #elif defined( BOOST_SP_HAS_SYNC ) diff --git a/3rdParty/Boost/src/boost/smart_ptr/detail/spinlock_gcc_arm.hpp b/3rdParty/Boost/src/boost/smart_ptr/detail/spinlock_gcc_arm.hpp index ba6c511..f1bbaf6 100644 --- a/3rdParty/Boost/src/boost/smart_ptr/detail/spinlock_gcc_arm.hpp +++ b/3rdParty/Boost/src/boost/smart_ptr/detail/spinlock_gcc_arm.hpp @@ -2,7 +2,7 @@ #define BOOST_SMART_PTR_DETAIL_SPINLOCK_GCC_ARM_HPP_INCLUDED // -// Copyright (c) 2008 Peter Dimov +// Copyright (c) 2008, 2011 Peter Dimov // // Distributed under the Boost Software License, Version 1.0. // See accompanying file LICENSE_1_0.txt or copy at @@ -11,6 +11,20 @@ #include <boost/smart_ptr/detail/yield_k.hpp> +#if defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || defined(__ARM_ARCH_7R__) || defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__) + +# define BOOST_SP_ARM_BARRIER "dmb" + +#elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || defined(__ARM_ARCH_6K__) || defined(__ARM_ARCH_6Z__) || defined(__ARM_ARCH_6ZK__) || defined(__ARM_ARCH_6T2__) + +# define BOOST_SP_ARM_BARRIER "mcr p15, 0, r0, c7, c10, 5" + +#else + +# define BOOST_SP_ARM_BARRIER "" + +#endif + namespace boost { @@ -29,12 +43,38 @@ public: { int r; +#if defined(__ARM_ARCH_6__) \ + || defined(__ARM_ARCH_6J__) \ + || defined(__ARM_ARCH_6K__) \ + || defined(__ARM_ARCH_6Z__) \ + || defined(__ARM_ARCH_6ZK__) \ + || defined(__ARM_ARCH_6T2__) \ + || defined(__ARM_ARCH_7__) \ + || defined(__ARM_ARCH_7A__) \ + || defined(__ARM_ARCH_7R__) \ + || defined(__ARM_ARCH_7M__) \ + || defined(__ARM_ARCH_7EM__) + __asm__ __volatile__( - "swp %0, %1, [%2]": + "ldrex %0, [%2]; \n" + "cmp %0, %1; \n" + "strexne %0, %1, [%2]; \n" + BOOST_SP_ARM_BARRIER : "=&r"( r ): // outputs "r"( 1 ), "r"( &v_ ): // inputs "memory", "cc" ); +#else + + __asm__ __volatile__( + "swp %0, %1, [%2];\n" + BOOST_SP_ARM_BARRIER : + "=&r"( r ): // outputs + "r"( 1 ), "r"( &v_ ): // inputs + "memory", "cc" ); + +#endif + return r == 0; } @@ -48,7 +88,7 @@ public: void unlock() { - __asm__ __volatile__( "" ::: "memory" ); + __asm__ __volatile__( BOOST_SP_ARM_BARRIER ::: "memory" ); *const_cast< int volatile* >( &v_ ) = 0; } @@ -82,4 +122,6 @@ public: #define BOOST_DETAIL_SPINLOCK_INIT {0} +#undef BOOST_SP_ARM_BARRIER + #endif // #ifndef BOOST_SMART_PTR_DETAIL_SPINLOCK_GCC_ARM_HPP_INCLUDED diff --git a/3rdParty/Boost/src/boost/smart_ptr/detail/spinlock_pool.hpp b/3rdParty/Boost/src/boost/smart_ptr/detail/spinlock_pool.hpp index 0e2e08a..f09d5c6 100644 --- a/3rdParty/Boost/src/boost/smart_ptr/detail/spinlock_pool.hpp +++ b/3rdParty/Boost/src/boost/smart_ptr/detail/spinlock_pool.hpp @@ -41,7 +41,11 @@ public: static spinlock & spinlock_for( void const * pv ) { +#if defined(__VMS) && __INITIAL_POINTER_SIZE == 64 + std::size_t i = reinterpret_cast< unsigned long long >( pv ) % 41; +#else std::size_t i = reinterpret_cast< std::size_t >( pv ) % 41; +#endif return pool_[ i ]; } diff --git a/3rdParty/Boost/src/boost/smart_ptr/intrusive_ptr.hpp b/3rdParty/Boost/src/boost/smart_ptr/intrusive_ptr.hpp index e72eb21..a575223 100644 --- a/3rdParty/Boost/src/boost/smart_ptr/intrusive_ptr.hpp +++ b/3rdParty/Boost/src/boost/smart_ptr/intrusive_ptr.hpp @@ -15,11 +15,6 @@ #include <boost/config.hpp> -#ifdef BOOST_MSVC // moved here to work around VC++ compiler crash -# pragma warning(push) -# pragma warning(disable:4284) // odd return type for operator-> -#endif - #include <boost/assert.hpp> #include <boost/detail/workaround.hpp> #include <boost/smart_ptr/detail/sp_convertible.hpp> @@ -290,10 +285,15 @@ template<class E, class T, class Y> std::basic_ostream<E, T> & operator<< (std:: #endif // !defined(BOOST_NO_IOSTREAM) -} // namespace boost +// hash_value + +template< class T > struct hash; -#ifdef BOOST_MSVC -# pragma warning(pop) -#endif +template< class T > std::size_t hash_value( boost::intrusive_ptr<T> const & p ) +{ + return boost::hash< T* >()( p.get() ); +} + +} // namespace boost #endif // #ifndef BOOST_SMART_PTR_INTRUSIVE_PTR_HPP_INCLUDED diff --git a/3rdParty/Boost/src/boost/smart_ptr/make_shared.hpp b/3rdParty/Boost/src/boost/smart_ptr/make_shared.hpp index c4ed28a..7b605e2 100644 --- a/3rdParty/Boost/src/boost/smart_ptr/make_shared.hpp +++ b/3rdParty/Boost/src/boost/smart_ptr/make_shared.hpp @@ -49,7 +49,18 @@ private: { if( initialized_ ) { +#if defined( __GNUC__ ) + + // fixes incorrect aliasing warning + T * p = reinterpret_cast< T* >( storage_.data_ ); + p->~T(); + +#else + reinterpret_cast< T* >( storage_.data_ )->~T(); + +#endif + initialized_ = false; } } @@ -97,13 +108,19 @@ template< class T > T&& sp_forward( T & t ) } // namespace detail +#if !defined( BOOST_NO_FUNCTION_TEMPLATE_ORDERING ) +# define BOOST_SP_MSD( T ) boost::detail::sp_inplace_tag< boost::detail::sp_ms_deleter< T > >() +#else +# define BOOST_SP_MSD( T ) boost::detail::sp_ms_deleter< T >() +#endif + // Zero-argument versions // // Used even when variadic templates are available because of the new T() vs new T issue template< class T > boost::shared_ptr< T > make_shared() { - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >() ); + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); @@ -120,7 +137,7 @@ template< class T > boost::shared_ptr< T > make_shared() template< class T, class A > boost::shared_ptr< T > allocate_shared( A const & a ) { - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >(), a ); + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); @@ -141,7 +158,7 @@ template< class T, class A > boost::shared_ptr< T > allocate_shared( A const & a template< class T, class Arg1, class... Args > boost::shared_ptr< T > make_shared( Arg1 && arg1, Args && ... args ) { - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >() ); + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); @@ -158,7 +175,7 @@ template< class T, class Arg1, class... Args > boost::shared_ptr< T > make_share template< class T, class A, class Arg1, class... Args > boost::shared_ptr< T > allocate_shared( A const & a, Arg1 && arg1, Args && ... args ) { - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >(), a ); + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); @@ -173,6 +190,460 @@ template< class T, class A, class Arg1, class... Args > boost::shared_ptr< T > a return boost::shared_ptr< T >( pt, pt2 ); } +#elif defined( BOOST_HAS_RVALUE_REFS ) + +// For example MSVC 10.0 + +template< class T, class A1 > +boost::shared_ptr< T > make_shared( A1 && a1 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); + + boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::detail::sp_forward<A1>( a1 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A, class A1 > +boost::shared_ptr< T > allocate_shared( A const & a, A1 && a1 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); + + boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::detail::sp_forward<A1>( a1 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A1, class A2 > +boost::shared_ptr< T > make_shared( A1 && a1, A2 && a2 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); + + boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::detail::sp_forward<A1>( a1 ), + boost::detail::sp_forward<A2>( a2 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A, class A1, class A2 > +boost::shared_ptr< T > allocate_shared( A const & a, A1 && a1, A2 && a2 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); + + boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::detail::sp_forward<A1>( a1 ), + boost::detail::sp_forward<A2>( a2 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A1, class A2, class A3 > +boost::shared_ptr< T > make_shared( A1 && a1, A2 && a2, A3 && a3 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); + + boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::detail::sp_forward<A1>( a1 ), + boost::detail::sp_forward<A2>( a2 ), + boost::detail::sp_forward<A3>( a3 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A, class A1, class A2, class A3 > +boost::shared_ptr< T > allocate_shared( A const & a, A1 && a1, A2 && a2, A3 && a3 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); + + boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::detail::sp_forward<A1>( a1 ), + boost::detail::sp_forward<A2>( a2 ), + boost::detail::sp_forward<A3>( a3 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A1, class A2, class A3, class A4 > +boost::shared_ptr< T > make_shared( A1 && a1, A2 && a2, A3 && a3, A4 && a4 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); + + boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::detail::sp_forward<A1>( a1 ), + boost::detail::sp_forward<A2>( a2 ), + boost::detail::sp_forward<A3>( a3 ), + boost::detail::sp_forward<A4>( a4 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A, class A1, class A2, class A3, class A4 > +boost::shared_ptr< T > allocate_shared( A const & a, A1 && a1, A2 && a2, A3 && a3, A4 && a4 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); + + boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::detail::sp_forward<A1>( a1 ), + boost::detail::sp_forward<A2>( a2 ), + boost::detail::sp_forward<A3>( a3 ), + boost::detail::sp_forward<A4>( a4 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A1, class A2, class A3, class A4, class A5 > +boost::shared_ptr< T > make_shared( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); + + boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::detail::sp_forward<A1>( a1 ), + boost::detail::sp_forward<A2>( a2 ), + boost::detail::sp_forward<A3>( a3 ), + boost::detail::sp_forward<A4>( a4 ), + boost::detail::sp_forward<A5>( a5 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A, class A1, class A2, class A3, class A4, class A5 > +boost::shared_ptr< T > allocate_shared( A const & a, A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); + + boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::detail::sp_forward<A1>( a1 ), + boost::detail::sp_forward<A2>( a2 ), + boost::detail::sp_forward<A3>( a3 ), + boost::detail::sp_forward<A4>( a4 ), + boost::detail::sp_forward<A5>( a5 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A1, class A2, class A3, class A4, class A5, class A6 > +boost::shared_ptr< T > make_shared( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); + + boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::detail::sp_forward<A1>( a1 ), + boost::detail::sp_forward<A2>( a2 ), + boost::detail::sp_forward<A3>( a3 ), + boost::detail::sp_forward<A4>( a4 ), + boost::detail::sp_forward<A5>( a5 ), + boost::detail::sp_forward<A6>( a6 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A, class A1, class A2, class A3, class A4, class A5, class A6 > +boost::shared_ptr< T > allocate_shared( A const & a, A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); + + boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::detail::sp_forward<A1>( a1 ), + boost::detail::sp_forward<A2>( a2 ), + boost::detail::sp_forward<A3>( a3 ), + boost::detail::sp_forward<A4>( a4 ), + boost::detail::sp_forward<A5>( a5 ), + boost::detail::sp_forward<A6>( a6 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7 > +boost::shared_ptr< T > make_shared( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); + + boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::detail::sp_forward<A1>( a1 ), + boost::detail::sp_forward<A2>( a2 ), + boost::detail::sp_forward<A3>( a3 ), + boost::detail::sp_forward<A4>( a4 ), + boost::detail::sp_forward<A5>( a5 ), + boost::detail::sp_forward<A6>( a6 ), + boost::detail::sp_forward<A7>( a7 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A, class A1, class A2, class A3, class A4, class A5, class A6, class A7 > +boost::shared_ptr< T > allocate_shared( A const & a, A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); + + boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::detail::sp_forward<A1>( a1 ), + boost::detail::sp_forward<A2>( a2 ), + boost::detail::sp_forward<A3>( a3 ), + boost::detail::sp_forward<A4>( a4 ), + boost::detail::sp_forward<A5>( a5 ), + boost::detail::sp_forward<A6>( a6 ), + boost::detail::sp_forward<A7>( a7 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8 > +boost::shared_ptr< T > make_shared( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7, A8 && a8 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); + + boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::detail::sp_forward<A1>( a1 ), + boost::detail::sp_forward<A2>( a2 ), + boost::detail::sp_forward<A3>( a3 ), + boost::detail::sp_forward<A4>( a4 ), + boost::detail::sp_forward<A5>( a5 ), + boost::detail::sp_forward<A6>( a6 ), + boost::detail::sp_forward<A7>( a7 ), + boost::detail::sp_forward<A8>( a8 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8 > +boost::shared_ptr< T > allocate_shared( A const & a, A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7, A8 && a8 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); + + boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::detail::sp_forward<A1>( a1 ), + boost::detail::sp_forward<A2>( a2 ), + boost::detail::sp_forward<A3>( a3 ), + boost::detail::sp_forward<A4>( a4 ), + boost::detail::sp_forward<A5>( a5 ), + boost::detail::sp_forward<A6>( a6 ), + boost::detail::sp_forward<A7>( a7 ), + boost::detail::sp_forward<A8>( a8 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9 > +boost::shared_ptr< T > make_shared( A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7, A8 && a8, A9 && a9 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); + + boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::detail::sp_forward<A1>( a1 ), + boost::detail::sp_forward<A2>( a2 ), + boost::detail::sp_forward<A3>( a3 ), + boost::detail::sp_forward<A4>( a4 ), + boost::detail::sp_forward<A5>( a5 ), + boost::detail::sp_forward<A6>( a6 ), + boost::detail::sp_forward<A7>( a7 ), + boost::detail::sp_forward<A8>( a8 ), + boost::detail::sp_forward<A9>( a9 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + +template< class T, class A, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9 > +boost::shared_ptr< T > allocate_shared( A const & a, A1 && a1, A2 && a2, A3 && a3, A4 && a4, A5 && a5, A6 && a6, A7 && a7, A8 && a8, A9 && a9 ) +{ + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); + + boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); + + void * pv = pd->address(); + + ::new( pv ) T( + boost::detail::sp_forward<A1>( a1 ), + boost::detail::sp_forward<A2>( a2 ), + boost::detail::sp_forward<A3>( a3 ), + boost::detail::sp_forward<A4>( a4 ), + boost::detail::sp_forward<A5>( a5 ), + boost::detail::sp_forward<A6>( a6 ), + boost::detail::sp_forward<A7>( a7 ), + boost::detail::sp_forward<A8>( a8 ), + boost::detail::sp_forward<A9>( a9 ) + ); + + pd->set_initialized(); + + T * pt2 = static_cast< T* >( pv ); + + boost::detail::sp_enable_shared_from_this( &pt, pt2, pt2 ); + return boost::shared_ptr< T >( pt, pt2 ); +} + #else // C++03 version @@ -180,7 +651,7 @@ template< class T, class A, class Arg1, class... Args > boost::shared_ptr< T > a template< class T, class A1 > boost::shared_ptr< T > make_shared( A1 const & a1 ) { - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >() ); + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); @@ -198,7 +669,7 @@ boost::shared_ptr< T > make_shared( A1 const & a1 ) template< class T, class A, class A1 > boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1 ) { - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >(), a ); + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); @@ -216,7 +687,7 @@ boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1 ) template< class T, class A1, class A2 > boost::shared_ptr< T > make_shared( A1 const & a1, A2 const & a2 ) { - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >() ); + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); @@ -234,7 +705,7 @@ boost::shared_ptr< T > make_shared( A1 const & a1, A2 const & a2 ) template< class T, class A, class A1, class A2 > boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1, A2 const & a2 ) { - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >(), a ); + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); @@ -252,7 +723,7 @@ boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1, A2 const & a template< class T, class A1, class A2, class A3 > boost::shared_ptr< T > make_shared( A1 const & a1, A2 const & a2, A3 const & a3 ) { - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >() ); + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); @@ -270,7 +741,7 @@ boost::shared_ptr< T > make_shared( A1 const & a1, A2 const & a2, A3 const & a3 template< class T, class A, class A1, class A2, class A3 > boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1, A2 const & a2, A3 const & a3 ) { - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >(), a ); + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); @@ -288,7 +759,7 @@ boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1, A2 const & a template< class T, class A1, class A2, class A3, class A4 > boost::shared_ptr< T > make_shared( A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4 ) { - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >() ); + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); @@ -306,7 +777,7 @@ boost::shared_ptr< T > make_shared( A1 const & a1, A2 const & a2, A3 const & a3, template< class T, class A, class A1, class A2, class A3, class A4 > boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4 ) { - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >(), a ); + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); @@ -324,7 +795,7 @@ boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1, A2 const & a template< class T, class A1, class A2, class A3, class A4, class A5 > boost::shared_ptr< T > make_shared( A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5 ) { - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >() ); + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); @@ -342,7 +813,7 @@ boost::shared_ptr< T > make_shared( A1 const & a1, A2 const & a2, A3 const & a3, template< class T, class A, class A1, class A2, class A3, class A4, class A5 > boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5 ) { - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >(), a ); + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); @@ -360,7 +831,7 @@ boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1, A2 const & a template< class T, class A1, class A2, class A3, class A4, class A5, class A6 > boost::shared_ptr< T > make_shared( A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6 ) { - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >() ); + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); @@ -378,7 +849,7 @@ boost::shared_ptr< T > make_shared( A1 const & a1, A2 const & a2, A3 const & a3, template< class T, class A, class A1, class A2, class A3, class A4, class A5, class A6 > boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6 ) { - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >(), a ); + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); @@ -396,7 +867,7 @@ boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1, A2 const & a template< class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7 > boost::shared_ptr< T > make_shared( A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7 ) { - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >() ); + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); @@ -414,7 +885,7 @@ boost::shared_ptr< T > make_shared( A1 const & a1, A2 const & a2, A3 const & a3, template< class T, class A, class A1, class A2, class A3, class A4, class A5, class A6, class A7 > boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7 ) { - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >(), a ); + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); @@ -432,7 +903,7 @@ boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1, A2 const & a template< class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8 > boost::shared_ptr< T > make_shared( A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7, A8 const & a8 ) { - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >() ); + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); @@ -450,7 +921,7 @@ boost::shared_ptr< T > make_shared( A1 const & a1, A2 const & a2, A3 const & a3, template< class T, class A, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8 > boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7, A8 const & a8 ) { - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >(), a ); + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); @@ -468,7 +939,7 @@ boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1, A2 const & a template< class T, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9 > boost::shared_ptr< T > make_shared( A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7, A8 const & a8, A9 const & a9 ) { - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >() ); + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ) ); boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); @@ -486,7 +957,7 @@ boost::shared_ptr< T > make_shared( A1 const & a1, A2 const & a2, A3 const & a3, template< class T, class A, class A1, class A2, class A3, class A4, class A5, class A6, class A7, class A8, class A9 > boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1, A2 const & a2, A3 const & a3, A4 const & a4, A5 const & a5, A6 const & a6, A7 const & a7, A8 const & a8, A9 const & a9 ) { - boost::shared_ptr< T > pt( static_cast< T* >( 0 ), boost::detail::sp_ms_deleter< T >(), a ); + boost::shared_ptr< T > pt( static_cast< T* >( 0 ), BOOST_SP_MSD( T ), a ); boost::detail::sp_ms_deleter< T > * pd = boost::get_deleter< boost::detail::sp_ms_deleter< T > >( pt ); @@ -503,6 +974,8 @@ boost::shared_ptr< T > allocate_shared( A const & a, A1 const & a1, A2 const & a #endif +#undef BOOST_SP_MSD + } // namespace boost #endif // #ifndef BOOST_SMART_PTR_MAKE_SHARED_HPP_INCLUDED diff --git a/3rdParty/Boost/src/boost/smart_ptr/shared_array.hpp b/3rdParty/Boost/src/boost/smart_ptr/shared_array.hpp index 1f50403..36799e6 100644 --- a/3rdParty/Boost/src/boost/smart_ptr/shared_array.hpp +++ b/3rdParty/Boost/src/boost/smart_ptr/shared_array.hpp @@ -69,7 +69,25 @@ public: { } -// generated copy constructor, assignment, destructor are fine +// generated copy constructor, destructor are fine... + +#if defined( BOOST_HAS_RVALUE_REFS ) + +// ... except in C++0x, move disables the implicit copy + + shared_array( shared_array const & r ): px( r.px ), pn( r.pn ) // never throws + { + } + +#endif + + // assignment + + shared_array & operator=( shared_array const & r ) // never throws + { + this_type( r ).swap( *this ); + return *this; + } void reset(T * p = 0) { @@ -113,6 +131,11 @@ public: pn.swap(other.pn); } + void * _internal_get_deleter( boost::detail::sp_typeinfo const & ti ) const + { + return pn.get_deleter( ti ); + } + private: T * px; // contained pointer @@ -140,6 +163,11 @@ template<class T> void swap(shared_array<T> & a, shared_array<T> & b) // never t a.swap(b); } +template< class D, class T > D * get_deleter( shared_array<T> const & p ) +{ + return static_cast< D * >( p._internal_get_deleter( BOOST_SP_TYPEID(D) ) ); +} + } // namespace boost #endif // #if defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(BOOST_MSVC6_MEMBER_TEMPLATES) diff --git a/3rdParty/Boost/src/boost/smart_ptr/shared_ptr.hpp b/3rdParty/Boost/src/boost/smart_ptr/shared_ptr.hpp index 609cce9..1bfb75c 100644 --- a/3rdParty/Boost/src/boost/smart_ptr/shared_ptr.hpp +++ b/3rdParty/Boost/src/boost/smart_ptr/shared_ptr.hpp @@ -41,6 +41,7 @@ #include <algorithm> // for std::swap #include <functional> // for std::less #include <typeinfo> // for std::bad_cast +#include <cstddef> // for std::size_t #if !defined(BOOST_NO_IOSTREAM) #if !defined(BOOST_NO_IOSFWD) @@ -50,11 +51,6 @@ #endif #endif -#ifdef BOOST_MSVC // moved here to work around VC++ compiler crash -# pragma warning(push) -# pragma warning(disable:4284) // odd return type for operator-> -#endif - namespace boost { @@ -207,7 +203,17 @@ public: boost::detail::sp_enable_shared_from_this( this, p, p ); } -// generated copy constructor, destructor are fine +// generated copy constructor, destructor are fine... + +#if defined( BOOST_HAS_RVALUE_REFS ) + +// ... except in C++0x, move disables the implicit copy + + shared_ptr( shared_ptr const & r ): px( r.px ), pn( r.pn ) // never throws + { + } + +#endif template<class Y> explicit shared_ptr(weak_ptr<Y> const & r): pn(r.pn) // may throw @@ -443,7 +449,12 @@ public: pn.swap(other.pn); } - template<class Y> bool _internal_less(shared_ptr<Y> const & rhs) const + template<class Y> bool owner_before( shared_ptr<Y> const & rhs ) const + { + return pn < rhs.pn; + } + + template<class Y> bool owner_before( weak_ptr<Y> const & rhs ) const { return pn < rhs.pn; } @@ -499,7 +510,7 @@ template<class T> inline bool operator!=(shared_ptr<T> const & a, shared_ptr<T> template<class T, class U> inline bool operator<(shared_ptr<T> const & a, shared_ptr<U> const & b) { - return a._internal_less(b); + return a.owner_before( b ); } template<class T> inline void swap(shared_ptr<T> & a, shared_ptr<T> & b) @@ -688,13 +699,18 @@ template<class T> inline bool atomic_compare_exchange_explicit( shared_ptr<T> * return atomic_compare_exchange( p, v, w ); // std::move( w ) } -#endif +#endif // !defined(BOOST_SP_NO_ATOMIC_ACCESS) -} // namespace boost +// hash_value -#ifdef BOOST_MSVC -# pragma warning(pop) -#endif +template< class T > struct hash; + +template< class T > std::size_t hash_value( boost::shared_ptr<T> const & p ) +{ + return boost::hash< T* >()( p.get() ); +} + +} // namespace boost #endif // #if defined(BOOST_NO_MEMBER_TEMPLATES) && !defined(BOOST_MSVC6_MEMBER_TEMPLATES) diff --git a/3rdParty/Boost/src/boost/smart_ptr/weak_ptr.hpp b/3rdParty/Boost/src/boost/smart_ptr/weak_ptr.hpp index d314b0d..2e35583 100644 --- a/3rdParty/Boost/src/boost/smart_ptr/weak_ptr.hpp +++ b/3rdParty/Boost/src/boost/smart_ptr/weak_ptr.hpp @@ -17,11 +17,6 @@ #include <boost/smart_ptr/detail/shared_count.hpp> #include <boost/smart_ptr/shared_ptr.hpp> -#ifdef BOOST_MSVC // moved here to work around VC++ compiler crash -# pragma warning(push) -# pragma warning(disable:4284) // odd return type for operator-> -#endif - namespace boost { @@ -40,8 +35,24 @@ public: { } -// generated copy constructor, assignment, destructor are fine +// generated copy constructor, assignment, destructor are fine... + +#if defined( BOOST_HAS_RVALUE_REFS ) + +// ... except in C++0x, move disables the implicit copy + + weak_ptr( weak_ptr const & r ): px( r.px ), pn( r.pn ) // never throws + { + } + + weak_ptr & operator=( weak_ptr const & r ) // never throws + { + px = r.px; + pn = r.pn; + return *this; + } +#endif // // The "obvious" converting constructor implementation: @@ -189,7 +200,12 @@ public: pn = pn2; } - template<class Y> bool _internal_less(weak_ptr<Y> const & rhs) const + template<class Y> bool owner_before( weak_ptr<Y> const & rhs ) const + { + return pn < rhs.pn; + } + + template<class Y> bool owner_before( shared_ptr<Y> const & rhs ) const { return pn < rhs.pn; } @@ -213,7 +229,7 @@ private: template<class T, class U> inline bool operator<(weak_ptr<T> const & a, weak_ptr<U> const & b) { - return a._internal_less(b); + return a.owner_before( b ); } template<class T> void swap(weak_ptr<T> & a, weak_ptr<T> & b) @@ -223,8 +239,4 @@ template<class T> void swap(weak_ptr<T> & a, weak_ptr<T> & b) } // namespace boost -#ifdef BOOST_MSVC -# pragma warning(pop) -#endif - #endif // #ifndef BOOST_SMART_PTR_WEAK_PTR_HPP_INCLUDED diff --git a/3rdParty/Boost/src/boost/system/config.hpp b/3rdParty/Boost/src/boost/system/config.hpp index bf78051..b128717 100644 --- a/3rdParty/Boost/src/boost/system/config.hpp +++ b/3rdParty/Boost/src/boost/system/config.hpp @@ -16,6 +16,23 @@ // This header implements separate compilation features as described in // http://www.boost.org/more/separate_compilation.html +// normalize macros ------------------------------------------------------------------// + +#if !defined(BOOST_SYSTEM_DYN_LINK) && !defined(BOOST_SYSTEM_STATIC_LINK) \ + && !defined(BOOST_ALL_DYN_LINK) && !defined(BOOST_ALL_STATIC_LINK) +# define BOOST_SYSTEM_STATIC_LINK +#endif + +#if defined(BOOST_ALL_DYN_LINK) && !defined(BOOST_SYSTEM_DYN_LINK) +# define BOOST_SYSTEM_DYN_LINK +#elif defined(BOOST_ALL_STATIC_LINK) && !defined(BOOST_SYSTEM_STATIC_LINK) +# define BOOST_SYSTEM_STATIC_LINK +#endif + +#if defined(BOOST_SYSTEM_DYN_LINK) && defined(BOOST_SYSTEM_STATIC_LINK) +# error Must not define both BOOST_SYSTEM_DYN_LINK and BOOST_SYSTEM_STATIC_LINK +#endif + // enable dynamic or static linking as requested --------------------------------------// #if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_SYSTEM_DYN_LINK) diff --git a/3rdParty/Boost/src/boost/thread/barrier.hpp b/3rdParty/Boost/src/boost/thread/barrier.hpp index 4ca30cb..4fd8988 100644 --- a/3rdParty/Boost/src/boost/thread/barrier.hpp +++ b/3rdParty/Boost/src/boost/thread/barrier.hpp @@ -2,7 +2,7 @@ // David Moore, William E. Kempf // Copyright (C) 2007-8 Anthony Williams // -// Distributed under the Boost Software License, Version 1.0. (See accompanying +// 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_BARRIER_JDM030602_HPP @@ -28,14 +28,14 @@ namespace boost : m_threshold(count), m_count(count), m_generation(0) { if (count == 0) - boost::throw_exception(std::invalid_argument("count cannot be zero.")); + boost::throw_exception(thread_exception(system::errc::invalid_argument, "barrier constructor: count cannot be zero.")); } - + bool wait() { boost::mutex::scoped_lock lock(m_mutex); unsigned int gen = m_generation; - + if (--m_count == 0) { m_generation++; diff --git a/3rdParty/Boost/src/boost/thread/condition.hpp b/3rdParty/Boost/src/boost/thread/condition.hpp deleted file mode 100644 index 35b879f..0000000 --- a/3rdParty/Boost/src/boost/thread/condition.hpp +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef BOOST_THREAD_CONDITION_HPP -#define BOOST_THREAD_CONDITION_HPP -// (C) Copyright 2007 Anthony Williams -// -// 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/thread/condition_variable.hpp> - -namespace boost -{ - typedef condition_variable_any condition; -} - -#endif diff --git a/3rdParty/Boost/src/boost/thread/cv_status.hpp b/3rdParty/Boost/src/boost/thread/cv_status.hpp new file mode 100644 index 0000000..99b3c0c --- /dev/null +++ b/3rdParty/Boost/src/boost/thread/cv_status.hpp @@ -0,0 +1,26 @@ +// cv_status.hpp +// +// Copyright (C) 2011 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) + +#ifndef BOOST_THREAD_CV_STATUS_HPP +#define BOOST_THREAD_CV_STATUS_HPP + +#include <boost/detail/scoped_enum_emulation.hpp> + +namespace boost +{ + + // enum class cv_status; + BOOST_SCOPED_ENUM_DECLARE_BEGIN(cv_status) + { + no_timeout, + timeout + } + BOOST_SCOPED_ENUM_DECLARE_END(cv_status) +} + +#endif // header diff --git a/3rdParty/Boost/src/boost/thread/detail/config.hpp b/3rdParty/Boost/src/boost/thread/detail/config.hpp index 4015a6c..87bad34 100644 --- a/3rdParty/Boost/src/boost/thread/detail/config.hpp +++ b/3rdParty/Boost/src/boost/thread/detail/config.hpp @@ -1,15 +1,138 @@ // Copyright (C) 2001-2003 // William E. Kempf +// Copyright (C) 2011-2012 Vicente J. Botet Escriba // -// Distributed under the Boost Software License, Version 1.0. (See accompanying +// 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_THREAD_CONFIG_WEK01032003_HPP #define BOOST_THREAD_CONFIG_WEK01032003_HPP +// Force SIG_ATOMIC_MAX to be defined +//#ifndef __STDC_LIMIT_MACROS +//#define __STDC_LIMIT_MACROS +//#endif + #include <boost/config.hpp> #include <boost/detail/workaround.hpp> +#ifdef BOOST_NO_NOEXCEPT +# define BOOST_THREAD_NOEXCEPT_OR_THROW throw() +#else +# define BOOST_THREAD_NOEXCEPT_OR_THROW noexcept +#endif + +// This compiler doesn't support Boost.Chrono +#if defined __IBMCPP__ && (__IBMCPP__ < 1100) && ! defined BOOST_THREAD_DONT_USE_CHRONO +#define BOOST_THREAD_DONT_USE_CHRONO +#endif + +// This compiler doesn't support Boost.Move +#if BOOST_WORKAROUND(__SUNPRO_CC, < 0x5100) && ! defined BOOST_THREAD_DONT_USE_MOVE +#define BOOST_THREAD_DONT_USE_MOVE +#endif + +// This compiler doesn't support Boost.Container Allocators files +#if defined __SUNPRO_CC && ! defined BOOST_THREAD_DONT_PROVIDE_FUTURE_CTOR_ALLOCATORS +#define BOOST_THREAD_DONT_PROVIDE_FUTURE_CTOR_ALLOCATORS +#endif + +#if defined _WIN32_WCE && _WIN32_WCE==0x501 && ! defined BOOST_THREAD_DONT_PROVIDE_FUTURE_CTOR_ALLOCATORS +#define BOOST_THREAD_DONT_PROVIDE_FUTURE_CTOR_ALLOCATORS +#endif + +#if ! defined BOOST_THREAD_DONT_PROVIDE_BASIC_THREAD_ID && ! defined BOOST_THREAD_PROVIDES_BASIC_THREAD_ID +#define BOOST_THREAD_PROVIDES_BASIC_THREAD_ID +#endif + +// Default version is 2 +#if !defined BOOST_THREAD_VERSION +#define BOOST_THREAD_VERSION 2 +#else +#if BOOST_THREAD_VERSION!=2 && BOOST_THREAD_VERSION!=3 +#error "BOOST_THREAD_VERSION must be 2 or 3" +#endif +#endif + +// Uses Boost.Chrono by default if not stated the opposite defining BOOST_THREAD_DONT_USE_CHRONO +#if ! defined BOOST_THREAD_DONT_USE_CHRONO && ! defined BOOST_THREAD_USES_CHRONO +#define BOOST_THREAD_USES_CHRONO +#endif + +// Don't provided by default in version 1. +#if defined BOOST_THREAD_PROVIDES_EXPLICIT_LOCK_CONVERSION +#define BOOST_THREAD_EXPLICIT_LOCK_CONVERSION explicit +#else +#define BOOST_THREAD_EXPLICIT_LOCK_CONVERSION +#endif + + +#if BOOST_THREAD_VERSION==2 +#if ! defined BOOST_THREAD_DONT_PROVIDE_PROMISE_LAZY && ! defined BOOST_THREAD_PROMISE_LAZY +#define BOOST_THREAD_PROMISE_LAZY +#endif +#if ! defined BOOST_THREAD_DONT_PROVIDE_DEPRECATED_FEATURES_SINCE_V3_0_0 +#define BOOST_THREAD_PROVIDES_DEPRECATED_FEATURES_SINCE_V3_0_0 +#endif +#endif + +#if BOOST_THREAD_VERSION==3 +#if ! defined BOOST_THREAD_DONT_PROVIDE_ONCE_CXX11 \ + && ! defined BOOST_THREAD_PROVIDES_ONCE_CXX11 +#define BOOST_THREAD_PROVIDES_ONCE_CXX11 +#endif +#if ! defined BOOST_THREAD_DONT_PROVIDE_THREAD_DESTRUCTOR_CALLS_TERMINATE_IF_JOINABLE \ + && ! defined BOOST_THREAD_PROVIDES_THREAD_DESTRUCTOR_CALLS_TERMINATE_IF_JOINABLE +#define BOOST_THREAD_PROVIDES_THREAD_DESTRUCTOR_CALLS_TERMINATE_IF_JOINABLE +#endif +#if ! defined BOOST_THREAD_DONT_PROVIDE_THREAD_MOVE_ASSIGN_CALLS_TERMINATE_IF_JOINABLE \ + && ! defined BOOST_THREAD_PROVIDES_THREAD_MOVE_ASSIGN_CALLS_TERMINATE_IF_JOINABLE +#define BOOST_THREAD_PROVIDES_THREAD_MOVE_ASSIGN_CALLS_TERMINATE_IF_JOINABLE +#endif +#if ! defined BOOST_THREAD_DONT_PROVIDE_FUTURE \ + && ! defined BOOST_THREAD_PROVIDES_FUTURE +#define BOOST_THREAD_PROVIDES_FUTURE +#endif +#if ! defined BOOST_THREAD_DONT_PROVIDE_FUTURE_CTOR_ALLOCATORS \ + && ! defined BOOST_THREAD_PROVIDES_FUTURE_CTOR_ALLOCATORS +#define BOOST_THREAD_PROVIDES_FUTURE_CTOR_ALLOCATORS +#endif +#if ! defined BOOST_THREAD_DONT_PROVIDE_SHARED_MUTEX_UPWARDS_CONVERSIONS \ + && ! defined BOOST_THREAD_PROVIDES_SHARED_MUTEX_UPWARDS_CONVERSIONS +#define BOOST_THREAD_PROVIDES_SHARED_MUTEX_UPWARDS_CONVERSIONS +#endif +#if ! defined BOOST_THREAD_DONT_PROVIDE_EXPLICIT_LOCK_CONVERSION \ + && ! defined BOOST_THREAD_PROVIDES_EXPLICIT_LOCK_CONVERSION +#define BOOST_THREAD_PROVIDES_EXPLICIT_LOCK_CONVERSION +#endif +#if ! defined BOOST_THREAD_DONT_PROVIDE_GENERIC_SHARED_MUTEX_ON_WIN \ + && ! defined BOOST_THREAD_PROVIDES_GENERIC_SHARED_MUTEX_ON_WIN +#define BOOST_THREAD_PROVIDES_GENERIC_SHARED_MUTEX_ON_WIN +#endif +#if ! defined BOOST_THREAD_PROVIDES_DEPRECATED_FEATURES_SINCE_V3_0_0 \ + && ! defined BOOST_THREAD_DONT_PROVIDE_DEPRECATED_FEATURES_SINCE_V3_0_ +#define BOOST_THREAD_DONT_PROVIDE_DEPRECATED_FEATURES_SINCE_V3_0_0 +#endif +#if ! defined BOOST_THREAD_DONT_USE_MOVE \ + && ! defined BOOST_THREAD_USES_MOVE +#define BOOST_THREAD_USES_MOVE +#endif + +#endif + +// BOOST_THREAD_PROVIDES_GENERIC_SHARED_MUTEX_ON_WIN is defined if BOOST_THREAD_PROVIDES_SHARED_MUTEX_UPWARDS_CONVERSIONS +#if defined BOOST_THREAD_PROVIDES_SHARED_MUTEX_UPWARDS_CONVERSIONS \ +&& ! defined BOOST_THREAD_PROVIDES_GENERIC_SHARED_MUTEX_ON_WIN +#define BOOST_THREAD_PROVIDES_GENERIC_SHARED_MUTEX_ON_WIN +#endif + +// BOOST_THREAD_PROVIDES_DEPRECATED_FEATURES_SINCE_V3_0_0 defined by default up to Boost 1.52 +// BOOST_THREAD_DONT_PROVIDE_DEPRECATED_FEATURES_SINCE_V3_0_0 defined by default up to Boost 1.55 +#if ! defined BOOST_THREAD_DONT_PROVIDE_DEPRECATED_FEATURES_SINCE_V3_0_0 \ +&& ! defined BOOST_THREAD_PROVIDES_DEPRECATED_FEATURES_SINCE_V3_0_0 +#define BOOST_THREAD_PROVIDES_DEPRECATED_FEATURES_SINCE_V3_0_0 +#endif + #if BOOST_WORKAROUND(__BORLANDC__, < 0x600) # pragma warn -8008 // Condition always true/false # pragma warn -8080 // Identifier declared but never used @@ -17,11 +140,11 @@ # pragma warn -8066 // Unreachable code #endif -#include "platform.hpp" +#include <boost/thread/detail/platform.hpp> // provided for backwards compatibility, since this // macro was used for several releases by mistake. -#if defined(BOOST_THREAD_DYN_DLL) +#if defined(BOOST_THREAD_DYN_DLL) && ! defined BOOST_THREAD_DYN_LINK # define BOOST_THREAD_DYN_LINK #endif @@ -53,12 +176,18 @@ #if defined(BOOST_HAS_DECLSPEC) # if defined(BOOST_THREAD_BUILD_DLL) //Build dll -# define BOOST_THREAD_DECL __declspec(dllexport) +# define BOOST_THREAD_DECL BOOST_SYMBOL_EXPORT +//# define BOOST_THREAD_DECL __declspec(dllexport) + # elif defined(BOOST_THREAD_USE_DLL) //Use dll -# define BOOST_THREAD_DECL __declspec(dllimport) +# define BOOST_THREAD_DECL BOOST_SYMBOL_IMPORT +//# define BOOST_THREAD_DECL __declspec(dllimport) # else # define BOOST_THREAD_DECL # endif +#elif (__GNUC__ == 4 && __GNUC_MINOR__ >= 1) || (__GNUC__ > 4) +# define BOOST_THREAD_DECL BOOST_SYMBOL_VISIBLE + #else # define BOOST_THREAD_DECL #endif // BOOST_HAS_DECLSPEC @@ -69,7 +198,7 @@ #if !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_THREAD_NO_LIB) && !defined(BOOST_THREAD_BUILD_DLL) && !defined(BOOST_THREAD_BUILD_LIB) // // Tell the autolink to link dynamically, this will get undef'ed by auto_link.hpp -// once it's done with it: +// once it's done with it: // #if defined(BOOST_THREAD_USE_DLL) # define BOOST_DYN_LINK diff --git a/3rdParty/Boost/src/boost/thread/detail/delete.hpp b/3rdParty/Boost/src/boost/thread/detail/delete.hpp new file mode 100644 index 0000000..30e7c93 --- /dev/null +++ b/3rdParty/Boost/src/boost/thread/detail/delete.hpp @@ -0,0 +1,45 @@ +// Copyright (C) 2012 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) + +#ifndef BOOST_THREAD_DETAIL_DELETE_HPP +#define BOOST_THREAD_DETAIL_DELETE_HPP + +#include <boost/config.hpp> + +/** + * BOOST_THREAD_DELETE_COPY_CTOR deletes the copy constructor when the compiler supports it or + * makes it private. + * + * BOOST_THREAD_DELETE_COPY_ASSIGN deletes the copy assignment when the compiler supports it or + * makes it private. + */ +#ifndef BOOST_NO_CXX11_DELETED_FUNCTIONS +#define BOOST_THREAD_DELETE_COPY_CTOR(CLASS) \ + CLASS(CLASS const&) = delete; \ + +#define BOOST_THREAD_DELETE_COPY_ASSIGN(CLASS) \ + CLASS& operator=(CLASS const&) = delete; + +#else // BOOST_NO_CXX11_DELETED_FUNCTIONS +#define BOOST_THREAD_DELETE_COPY_CTOR(CLASS) \ + private: \ + CLASS(CLASS&); \ + public: + +#define BOOST_THREAD_DELETE_COPY_ASSIGN(CLASS) \ + private: \ + CLASS& operator=(CLASS&); \ + public: +#endif // BOOST_NO_CXX11_DELETED_FUNCTIONS + +/** + * BOOST_THREAD_NO_COPYABLE deletes the copy constructor and assignment when the compiler supports it or + * makes them private. + */ +#define BOOST_THREAD_NO_COPYABLE(CLASS) \ + BOOST_THREAD_DELETE_COPY_CTOR(CLASS) \ + BOOST_THREAD_DELETE_COPY_ASSIGN(CLASS) + +#endif // BOOST_THREAD_DETAIL_DELETE_HPP diff --git a/3rdParty/Boost/src/boost/thread/detail/memory.hpp b/3rdParty/Boost/src/boost/thread/detail/memory.hpp new file mode 100644 index 0000000..3c1692d --- /dev/null +++ b/3rdParty/Boost/src/boost/thread/detail/memory.hpp @@ -0,0 +1,156 @@ +////////////////////////////////////////////////////////////////////////////// +// +// (C) Copyright 2011-2012 Vicente J. Botet Escriba +// 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/thread for documentation. +// +////////////////////////////////////////////////////////////////////////////// + +#ifndef BOOST_THREAD_DETAIL_MEMORY_HPP +#define BOOST_THREAD_DETAIL_MEMORY_HPP + +#include <boost/config.hpp> +#include <boost/container/allocator_traits.hpp> +#include <boost/container/scoped_allocator.hpp> +#include <boost/type_traits/remove_cv.hpp> +#include <boost/type_traits/is_convertible.hpp> +#include <boost/type_traits/is_scalar.hpp> +#include <boost/type_traits/is_pointer.hpp> +#include <boost/type_traits/is_same.hpp> +#include <boost/static_assert.hpp> + +namespace boost +{ + namespace thread_detail + { + template <class _Alloc> + class allocator_destructor + { + typedef container::allocator_traits<_Alloc> alloc_traits; + public: + typedef typename alloc_traits::pointer pointer; + typedef typename alloc_traits::size_type size_type; + private: + _Alloc alloc_; + size_type s_; + public: + allocator_destructor(_Alloc& a, size_type s)BOOST_NOEXCEPT + : alloc_(a), s_(s) + {} + void operator()(pointer p)BOOST_NOEXCEPT + { + alloc_traits::destroy(alloc_, p); + alloc_traits::deallocate(alloc_, p, s_); + } + }; + } //namespace thread_detail + + typedef container::allocator_arg_t allocator_arg_t; + BOOST_CONSTEXPR_OR_CONST allocator_arg_t allocator_arg = {}; + + template <class T, class Alloc> + struct uses_allocator: public container::uses_allocator<T, Alloc> + { + }; + + template <class Ptr> + struct pointer_traits + { + typedef Ptr pointer; +// typedef <details> element_type; +// typedef <details> difference_type; + +// template <class U> using rebind = <details>; +// +// static pointer pointer_to(<details>); + }; + + template <class T> + struct pointer_traits<T*> + { + typedef T* pointer; + typedef T element_type; + typedef ptrdiff_t difference_type; + +// template <class U> using rebind = U*; +// +// static pointer pointer_to(<details>) noexcept; + }; + + + namespace thread_detail { + template <class _Ptr1, class _Ptr2, + bool = is_same<typename remove_cv<typename pointer_traits<_Ptr1>::element_type>::type, + typename remove_cv<typename pointer_traits<_Ptr2>::element_type>::type + >::value + > + struct same_or_less_cv_qualified_imp + : is_convertible<_Ptr1, _Ptr2> {}; + + template <class _Ptr1, class _Ptr2> + struct same_or_less_cv_qualified_imp<_Ptr1, _Ptr2, false> + : false_type {}; + + template <class _Ptr1, class _Ptr2, bool = is_scalar<_Ptr1>::value && + !is_pointer<_Ptr1>::value> + struct same_or_less_cv_qualified + : same_or_less_cv_qualified_imp<_Ptr1, _Ptr2> {}; + + template <class _Ptr1, class _Ptr2> + struct same_or_less_cv_qualified<_Ptr1, _Ptr2, true> + : false_type {}; + + } + template <class T> + struct BOOST_SYMBOL_VISIBLE default_delete + { + #ifndef BOOST_NO_CXX11_DEFAULTED_FUNCTIONS + BOOST_SYMBOL_VISIBLE + BOOST_CONSTEXPR default_delete() = default; + #else + BOOST_SYMBOL_VISIBLE + BOOST_CONSTEXPR default_delete() BOOST_NOEXCEPT {} + #endif + template <class U> + BOOST_SYMBOL_VISIBLE + default_delete(const default_delete<U>&, + typename enable_if<is_convertible<U*, T*> >::type* = 0) BOOST_NOEXCEPT {} + BOOST_SYMBOL_VISIBLE + void operator() (T* ptr) const BOOST_NOEXCEPT + { + BOOST_STATIC_ASSERT_MSG(sizeof(T) > 0, "default_delete can not delete incomplete type"); + delete ptr; + } + }; + + template <class T> + struct BOOST_SYMBOL_VISIBLE default_delete<T[]> + { + public: + #ifndef BOOST_NO_CXX11_DEFAULTED_FUNCTIONS + BOOST_SYMBOL_VISIBLE + BOOST_CONSTEXPR default_delete() = default; + #else + BOOST_SYMBOL_VISIBLE + BOOST_CONSTEXPR default_delete() BOOST_NOEXCEPT {} + #endif + template <class U> + BOOST_SYMBOL_VISIBLE + default_delete(const default_delete<U[]>&, + typename enable_if<thread_detail::same_or_less_cv_qualified<U*, T*> >::type* = 0) BOOST_NOEXCEPT {} + template <class U> + BOOST_SYMBOL_VISIBLE + void operator() (U* ptr, + typename enable_if<thread_detail::same_or_less_cv_qualified<U*, T*> >::type* = 0) const BOOST_NOEXCEPT + { + BOOST_STATIC_ASSERT_MSG(sizeof(T) > 0, "default_delete can not delete incomplete type"); + delete [] ptr; + } + }; + +} // namespace boost + + +#endif // BOOST_THREAD_DETAIL_MEMORY_HPP diff --git a/3rdParty/Boost/src/boost/thread/detail/move.hpp b/3rdParty/Boost/src/boost/thread/detail/move.hpp index eb21107..f2665e6 100644 --- a/3rdParty/Boost/src/boost/thread/detail/move.hpp +++ b/3rdParty/Boost/src/boost/thread/detail/move.hpp @@ -2,21 +2,31 @@ // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // (C) Copyright 2007-8 Anthony Williams +// (C) Copyright 2011-2012 Vicente J. Botet Escriba #ifndef BOOST_THREAD_MOVE_HPP #define BOOST_THREAD_MOVE_HPP +#include <boost/thread/detail/config.hpp> #ifndef BOOST_NO_SFINAE #include <boost/utility/enable_if.hpp> #include <boost/type_traits/is_convertible.hpp> +#include <boost/type_traits/remove_reference.hpp> +#include <boost/type_traits/remove_cv.hpp> +#include <boost/type_traits/decay.hpp> #endif +#include <boost/thread/detail/delete.hpp> +#include <boost/move/move.hpp> #include <boost/config/abi_prefix.hpp> namespace boost { + namespace detail { + template <typename T> + struct has_move_emulation_enabled_aux_dummy_specialization; template<typename T> struct thread_move_t { @@ -39,22 +49,198 @@ namespace boost }; } + #ifndef BOOST_NO_SFINAE template<typename T> - typename enable_if<boost::is_convertible<T&,detail::thread_move_t<T> >, detail::thread_move_t<T> >::type move(T& t) + typename enable_if<boost::is_convertible<T&,boost::detail::thread_move_t<T> >, boost::detail::thread_move_t<T> >::type move(T& t) { - return detail::thread_move_t<T>(t); + return boost::detail::thread_move_t<T>(t); } #endif - + template<typename T> - detail::thread_move_t<T> move(detail::thread_move_t<T> t) + boost::detail::thread_move_t<T> move(boost::detail::thread_move_t<T> t) { return t; } - } +#if ! defined BOOST_NO_CXX11_RVALUE_REFERENCES + +#define BOOST_THREAD_RV_REF(TYPE) BOOST_RV_REF(TYPE) +#define BOOST_THREAD_RV_REF_BEG BOOST_RV_REF_BEG +#define BOOST_THREAD_RV_REF_END BOOST_RV_REF_END +#define BOOST_THREAD_RV(V) V +#define BOOST_THREAD_MAKE_RV_REF(RVALUE) RVALUE +#define BOOST_THREAD_FWD_REF(TYPE) BOOST_FWD_REF(TYPE) +#define BOOST_THREAD_DCL_MOVABLE(TYPE) +#define BOOST_THREAD_DCL_MOVABLE_BEG(T) \ + namespace detail { \ + template <typename T> \ + struct has_move_emulation_enabled_aux_dummy_specialization< + +#define BOOST_THREAD_DCL_MOVABLE_END > \ + : integral_constant<bool, true> \ + {}; \ + } + +#elif ! defined BOOST_NO_CXX11_RVALUE_REFERENCES && defined BOOST_MSVC + +#define BOOST_THREAD_RV_REF(TYPE) BOOST_RV_REF(TYPE) +#define BOOST_THREAD_RV_REF_BEG BOOST_RV_REF_BEG +#define BOOST_THREAD_RV_REF_END BOOST_RV_REF_END +#define BOOST_THREAD_RV(V) V +#define BOOST_THREAD_MAKE_RV_REF(RVALUE) RVALUE +#define BOOST_THREAD_FWD_REF(TYPE) BOOST_FWD_REF(TYPE) +#define BOOST_THREAD_DCL_MOVABLE(TYPE) +#define BOOST_THREAD_DCL_MOVABLE_BEG(T) \ + namespace detail { \ + template <typename T> \ + struct has_move_emulation_enabled_aux_dummy_specialization< + +#define BOOST_THREAD_DCL_MOVABLE_END > \ + : integral_constant<bool, true> \ + {}; \ + } + +#else + +#if defined BOOST_THREAD_USES_MOVE +#define BOOST_THREAD_RV_REF(TYPE) BOOST_RV_REF(TYPE) +#define BOOST_THREAD_RV_REF_BEG BOOST_RV_REF_BEG +#define BOOST_THREAD_RV_REF_END BOOST_RV_REF_END +#define BOOST_THREAD_RV(V) V +#define BOOST_THREAD_FWD_REF(TYPE) BOOST_FWD_REF(TYPE) +#define BOOST_THREAD_DCL_MOVABLE(TYPE) +#define BOOST_THREAD_DCL_MOVABLE_BEG(T) \ + namespace detail { \ + template <typename T> \ + struct has_move_emulation_enabled_aux_dummy_specialization< + +#define BOOST_THREAD_DCL_MOVABLE_END > \ + : integral_constant<bool, true> \ + {}; \ + } + +#else + +#define BOOST_THREAD_RV_REF(TYPE) boost::detail::thread_move_t< TYPE > +#define BOOST_THREAD_RV_REF_BEG boost::detail::thread_move_t< +#define BOOST_THREAD_RV_REF_END > +#define BOOST_THREAD_RV(V) (*V) +#define BOOST_THREAD_FWD_REF(TYPE) BOOST_FWD_REF(TYPE) + +#define BOOST_THREAD_DCL_MOVABLE(TYPE) \ +template <> \ +struct has_move_emulation_enabled_aux< TYPE > \ + : BOOST_MOVE_BOOST_NS::integral_constant<bool, true> \ +{}; + +#define BOOST_THREAD_DCL_MOVABLE_BEG(T) \ +template <typename T> \ +struct has_move_emulation_enabled_aux< + +#define BOOST_THREAD_DCL_MOVABLE_END > \ + : BOOST_MOVE_BOOST_NS::integral_constant<bool, true> \ +{}; + +#endif + +namespace boost +{ +namespace detail +{ + template <typename T> + BOOST_THREAD_RV_REF(typename ::boost::remove_cv<typename ::boost::remove_reference<T>::type>::type) + make_rv_ref(T v) BOOST_NOEXCEPT + { + return (BOOST_THREAD_RV_REF(typename ::boost::remove_cv<typename ::boost::remove_reference<T>::type>::type))(v); + } +// template <typename T> +// BOOST_THREAD_RV_REF(typename ::boost::remove_cv<typename ::boost::remove_reference<T>::type>::type) +// make_rv_ref(T &v) BOOST_NOEXCEPT +// { +// return (BOOST_THREAD_RV_REF(typename ::boost::remove_cv<typename ::boost::remove_reference<T>::type>::type))(v); +// } +// template <typename T> +// const BOOST_THREAD_RV_REF(typename ::boost::remove_cv<typename ::boost::remove_reference<T>::type>::type) +// make_rv_ref(T const&v) BOOST_NOEXCEPT +// { +// return (const BOOST_THREAD_RV_REF(typename ::boost::remove_cv<typename ::boost::remove_reference<T>::type>::type))(v); +// } +} +} + +#define BOOST_THREAD_MAKE_RV_REF(RVALUE) RVALUE.move() +//#define BOOST_THREAD_MAKE_RV_REF(RVALUE) boost::detail::make_rv_ref(RVALUE) +#endif + + +#if ! defined BOOST_NO_CXX11_RVALUE_REFERENCES + +#define BOOST_THREAD_MOVABLE(TYPE) + +#else + +#if defined BOOST_THREAD_USES_MOVE + +#define BOOST_THREAD_MOVABLE(TYPE) \ + ::boost::rv<TYPE>& move() BOOST_NOEXCEPT \ + { \ + return *static_cast< ::boost::rv<TYPE>* >(this); \ + } \ + const ::boost::rv<TYPE>& move() const BOOST_NOEXCEPT \ + { \ + return *static_cast<const ::boost::rv<TYPE>* >(this); \ + } \ + operator ::boost::rv<TYPE>&() \ + { \ + return *static_cast< ::boost::rv<TYPE>* >(this); \ + } \ + operator const ::boost::rv<TYPE>&() const \ + { \ + return *static_cast<const ::boost::rv<TYPE>* >(this); \ + }\ + +#else + +#define BOOST_THREAD_MOVABLE(TYPE) \ + operator ::boost::detail::thread_move_t<TYPE>() BOOST_NOEXCEPT \ + { \ + return move(); \ + } \ + ::boost::detail::thread_move_t<TYPE> move() BOOST_NOEXCEPT \ + { \ + ::boost::detail::thread_move_t<TYPE> x(*this); \ + return x; \ + } \ + +#endif +#endif + +#define BOOST_THREAD_MOVABLE_ONLY(TYPE) \ + BOOST_THREAD_NO_COPYABLE(TYPE) \ + BOOST_THREAD_MOVABLE(TYPE) \ + +#define BOOST_THREAD_COPYABLE_AND_MOVABLE(TYPE) \ + BOOST_THREAD_MOVABLE(TYPE) \ + + + +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES +namespace boost +{ namespace thread_detail + { + template <class T> + typename decay<T>::type + decay_copy(T&& t) + { + return boost::forward<T>(t); + } + } +} +#endif + #include <boost/config/abi_suffix.hpp> #endif diff --git a/3rdParty/Boost/src/boost/thread/detail/platform.hpp b/3rdParty/Boost/src/boost/thread/detail/platform.hpp index 58601b0..1f33b1a 100644 --- a/3rdParty/Boost/src/boost/thread/detail/platform.hpp +++ b/3rdParty/Boost/src/boost/thread/detail/platform.hpp @@ -19,6 +19,7 @@ // choose platform #if defined(linux) || defined(__linux) || defined(__linux__) # define BOOST_THREAD_LINUX +//# define BOOST_THREAD_WAIT_BUG boost::posix_time::microseconds(100000) #elif defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__DragonFly__) # define BOOST_THREAD_BSD #elif defined(sun) || defined(__sun) @@ -35,6 +36,7 @@ # define BOOST_THREAD_BEOS #elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__) # define BOOST_THREAD_MACOS +//# define BOOST_THREAD_WAIT_BUG boost::posix_time::microseconds(1000) #elif defined(__IBMCPP__) || defined(_AIX) # define BOOST_THREAD_AIX #elif defined(__amigaos__) @@ -55,7 +57,7 @@ // dispatcher table. If there is no entry for a platform but pthreads is // available on the platform, pthread is choosen as default. If nothing is // available the preprocessor will fail with a diagnostic message. - + #if defined(BOOST_THREAD_POSIX) # define BOOST_THREAD_PLATFORM_PTHREAD #else diff --git a/3rdParty/Boost/src/boost/thread/detail/thread.hpp b/3rdParty/Boost/src/boost/thread/detail/thread.hpp index 005555e..2590f45 100644 --- a/3rdParty/Boost/src/boost/thread/detail/thread.hpp +++ b/3rdParty/Boost/src/boost/thread/detail/thread.hpp @@ -4,7 +4,9 @@ // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // (C) Copyright 2007-10 Anthony Williams - +// (C) Copyright 20011-12 Vicente J. Botet Escriba + +#include <boost/thread/detail/config.hpp> #include <boost/thread/exceptions.hpp> #ifndef BOOST_NO_IOSTREAM #include <ostream> @@ -13,7 +15,6 @@ #include <boost/thread/mutex.hpp> #include <boost/thread/xtime.hpp> #include <boost/thread/detail/thread_heap_alloc.hpp> -#include <boost/utility.hpp> #include <boost/assert.hpp> #include <list> #include <algorithm> @@ -22,8 +23,18 @@ #include <boost/bind.hpp> #include <stdlib.h> #include <memory> +//#include <vector> +//#include <utility> #include <boost/utility/enable_if.hpp> #include <boost/type_traits/remove_reference.hpp> +#include <boost/io/ios_state.hpp> +#include <boost/type_traits/is_same.hpp> +#include <boost/type_traits/decay.hpp> +#include <boost/functional/hash.hpp> +#ifdef BOOST_THREAD_USES_CHRONO +#include <boost/chrono/system_clocks.hpp> +#include <boost/chrono/ceil.hpp> +#endif #include <boost/config/abi_prefix.hpp> @@ -34,6 +45,7 @@ namespace boost { + namespace detail { template<typename F> @@ -41,30 +53,33 @@ namespace boost public detail::thread_data_base { public: -#ifndef BOOST_NO_RVALUE_REFERENCES - thread_data(F&& f_): - f(static_cast<F&&>(f_)) - {} - thread_data(F& f_): - f(f_) - {} + BOOST_THREAD_NO_COPYABLE(thread_data) +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES + thread_data(BOOST_THREAD_RV_REF(F) f_): + f(boost::forward<F>(f_)) + {} +// This overloading must be removed if we want the packaged_task's tests to pass. +// thread_data(F& f_): +// f(f_) +// {} #else - thread_data(F f_): - f(f_) + + thread_data(BOOST_THREAD_RV_REF(F) f_): + f(f_) {} - thread_data(detail::thread_move_t<F> f_): + thread_data(F f_): f(f_) {} -#endif +#endif + //thread_data() {} + void run() { f(); } + private: F f; - - void operator=(thread_data&); - thread_data(thread_data&); }; template<typename F> @@ -73,14 +88,11 @@ namespace boost { private: F& f; - - void operator=(thread_data&); - thread_data(thread_data&); public: + BOOST_THREAD_NO_COPYABLE(thread_data) thread_data(boost::reference_wrapper<F> f_): f(f_) {} - void run() { f(); @@ -93,45 +105,48 @@ namespace boost { private: F& f; - void operator=(thread_data&); - thread_data(thread_data&); public: + BOOST_THREAD_NO_COPYABLE(thread_data) thread_data(const boost::reference_wrapper<F> f_): f(f_) {} - void run() { f(); } }; } - + class BOOST_THREAD_DECL thread { + public: + typedef thread_attributes attributes; + + BOOST_THREAD_MOVABLE_ONLY(thread) private: - thread(thread&); - thread& operator=(thread&); void release_handle(); - + detail::thread_data_ptr thread_info; void start_thread(); - + void start_thread(const attributes& attr); + explicit thread(detail::thread_data_ptr data); detail::thread_data_ptr get_thread_info BOOST_PREVENT_MACRO_SUBSTITUTION () const; -#ifndef BOOST_NO_RVALUE_REFERENCES +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES template<typename F> - static inline detail::thread_data_ptr make_thread_info(F&& f) + static inline detail::thread_data_ptr make_thread_info(BOOST_THREAD_RV_REF(F) f) { - return detail::thread_data_ptr(detail::heap_new<detail::thread_data<typename boost::remove_reference<F>::type> >(static_cast<F&&>(f))); + return detail::thread_data_ptr(detail::heap_new<detail::thread_data<typename boost::remove_reference<F>::type> >( + boost::forward<F>(f))); } static inline detail::thread_data_ptr make_thread_info(void (*f)()) { - return detail::thread_data_ptr(detail::heap_new<detail::thread_data<void(*)()> >(static_cast<void(*&&)()>(f))); + return detail::thread_data_ptr(detail::heap_new<detail::thread_data<void(*)()> >( + boost::forward<void(*)()>(f))); } #else template<typename F> @@ -140,7 +155,7 @@ namespace boost return detail::thread_data_ptr(detail::heap_new<detail::thread_data<F> >(f)); } template<typename F> - static inline detail::thread_data_ptr make_thread_info(boost::detail::thread_move_t<F> f) + static inline detail::thread_data_ptr make_thread_info(BOOST_THREAD_RV_REF(F) f) { return detail::thread_data_ptr(detail::heap_new<detail::thread_data<F> >(f)); } @@ -148,46 +163,42 @@ namespace boost #endif struct dummy; public: +#if 0 // This should not be needed anymore. Use instead BOOST_THREAD_MAKE_RV_REF. #if BOOST_WORKAROUND(__SUNPRO_CC, < 0x5100) - thread(const volatile thread&); -#endif - thread(); - ~thread(); - -#ifndef BOOST_NO_RVALUE_REFERENCES -#ifdef BOOST_MSVC - template <class F> - explicit thread(F f,typename disable_if<boost::is_convertible<F&,detail::thread_move_t<F> >, dummy* >::type=0): - thread_info(make_thread_info(static_cast<F&&>(f))) - { - start_thread(); - } -#else - template <class F> - thread(F&& f): - thread_info(make_thread_info(static_cast<F&&>(f))) - { - start_thread(); - } + thread(const volatile thread&); #endif - - thread(thread&& other) +#endif + thread() BOOST_NOEXCEPT; + ~thread() + { + #if defined BOOST_THREAD_PROVIDES_THREAD_DESTRUCTOR_CALLS_TERMINATE_IF_JOINABLE + if (joinable()) { + std::terminate(); + } + #else + detach(); + #endif + } +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES + template < + class F + > + explicit thread(BOOST_THREAD_RV_REF(F) f + , typename disable_if<is_same<typename decay<F>::type, thread>, dummy* >::type=0 + ): + thread_info(make_thread_info(thread_detail::decay_copy(boost::forward<F>(f)))) { - thread_info.swap(other.thread_info); + start_thread(); } - - thread& operator=(thread&& other) + template < + class F + > + thread(attributes& attrs, BOOST_THREAD_RV_REF(F) f): + thread_info(make_thread_info(thread_detail::decay_copy(boost::forward<F>(f)))) { - thread_info=other.thread_info; - other.thread_info.reset(); - return *this; + start_thread(attrs); } - thread&& move() - { - return static_cast<thread&&>(*this); - } - #else #ifdef BOOST_NO_SFINAE template <class F> @@ -196,57 +207,73 @@ namespace boost { start_thread(); } + template <class F> + thread(attributes& attrs, F f): + thread_info(make_thread_info(f)) + { + start_thread(attrs); + } #else template <class F> - explicit thread(F f,typename disable_if<boost::is_convertible<F&,detail::thread_move_t<F> >, dummy* >::type=0): + explicit thread(F f + // todo Disable also if Or is_same<typename decay<F>::type, thread> + , typename disable_if<boost::is_convertible<F&,BOOST_THREAD_RV_REF(F) >, dummy* >::type=0): thread_info(make_thread_info(f)) { start_thread(); } + template <class F> + thread(attributes& attrs, F f + , typename disable_if<boost::is_convertible<F&,BOOST_THREAD_RV_REF(F) >, dummy* >::type=0): + thread_info(make_thread_info(f)) + { + start_thread(attrs); + } #endif - template <class F> - explicit thread(detail::thread_move_t<F> f): + explicit thread(BOOST_THREAD_RV_REF(F) f + , typename disable_if<is_same<typename decay<F>::type, thread>, dummy* >::type=0 + ): thread_info(make_thread_info(f)) { start_thread(); } - thread(detail::thread_move_t<thread> x) + template <class F> + thread(attributes& attrs, BOOST_THREAD_RV_REF(F) f): + thread_info(make_thread_info(f)) { - thread_info=x->thread_info; - x->thread_info.reset(); + start_thread(attrs); } - -#if BOOST_WORKAROUND(__SUNPRO_CC, < 0x5100) - thread& operator=(thread x) - { - swap(x); - return *this; - } -#else - thread& operator=(detail::thread_move_t<thread> x) +#endif + thread(BOOST_THREAD_RV_REF(thread) x) { - thread new_thread(x); - swap(new_thread); - return *this; + thread_info=BOOST_THREAD_RV(x).thread_info; + BOOST_THREAD_RV(x).thread_info.reset(); } -#endif - operator detail::thread_move_t<thread>() +#if 0 // This should not be needed anymore. Use instead BOOST_THREAD_MAKE_RV_REF. +#if BOOST_WORKAROUND(__SUNPRO_CC, < 0x5100) + thread& operator=(thread x) { - return move(); + swap(x); + return *this; } - - detail::thread_move_t<thread> move() +#endif +#endif + + thread& operator=(BOOST_THREAD_RV_REF(thread) other) BOOST_NOEXCEPT { - detail::thread_move_t<thread> x(*this); - return x; - } +#if defined BOOST_THREAD_PROVIDES_THREAD_MOVE_ASSIGN_CALLS_TERMINATE_IF_JOINABLE + if (joinable()) std::terminate(); #endif + thread_info=BOOST_THREAD_RV(other).thread_info; + BOOST_THREAD_RV(other).thread_info.reset(); + return *this; + } template <class F,class A1> - thread(F f,A1 a1): + thread(F f,A1 a1,typename disable_if<boost::is_convertible<F&,thread_attributes >, dummy* >::type=0): thread_info(make_thread_info(boost::bind(boost::type<void>(),f,a1))) { start_thread(); @@ -307,40 +334,102 @@ namespace boost start_thread(); } - void swap(thread& x) + void swap(thread& x) BOOST_NOEXCEPT { thread_info.swap(x.thread_info); } - class id; - id get_id() const; + class BOOST_SYMBOL_VISIBLE id; + id get_id() const BOOST_NOEXCEPT; - bool joinable() const; + bool joinable() const BOOST_NOEXCEPT; void join(); - bool timed_join(const system_time& wait_until); +#ifdef BOOST_THREAD_USES_CHRONO + template <class Rep, class Period> + bool try_join_for(const chrono::duration<Rep, Period>& rel_time) + { + return try_join_until(chrono::steady_clock::now() + rel_time); + } + template <class Clock, class Duration> + bool try_join_until(const chrono::time_point<Clock, Duration>& t) + { + using namespace chrono; + system_clock::time_point s_now = system_clock::now(); + typename Clock::time_point c_now = Clock::now(); + return try_join_until(s_now + ceil<nanoseconds>(t - c_now)); + } + template <class Duration> + bool try_join_until(const chrono::time_point<chrono::system_clock, Duration>& t) + { + using namespace chrono; + typedef time_point<system_clock, nanoseconds> nano_sys_tmpt; + return try_join_until(nano_sys_tmpt(ceil<nanoseconds>(t.time_since_epoch()))); + } +#endif +#if defined(BOOST_THREAD_PLATFORM_WIN32) + bool timed_join(const system_time& abs_time); + private: + bool do_try_join_until(uintmax_t milli); + public: +#ifdef BOOST_THREAD_USES_CHRONO + bool try_join_until(const chrono::time_point<chrono::system_clock, chrono::nanoseconds>& tp) + { + chrono::milliseconds rel_time= chrono::ceil<chrono::milliseconds>(tp-chrono::system_clock::now()); + return do_try_join_until(rel_time.count()); + } +#endif + + +#else + bool timed_join(const system_time& abs_time) + { + struct timespec const ts=detail::get_timespec(abs_time); + return do_try_join_until(ts); + } +#ifdef BOOST_THREAD_USES_CHRONO + bool try_join_until(const chrono::time_point<chrono::system_clock, chrono::nanoseconds>& tp) + { + using namespace chrono; + nanoseconds d = tp.time_since_epoch(); + timespec ts; + seconds s = duration_cast<seconds>(d); + ts.tv_sec = static_cast<long>(s.count()); + ts.tv_nsec = static_cast<long>((d - s).count()); + return do_try_join_until(ts); + } +#endif + private: + bool do_try_join_until(struct timespec const &timeout); + public: + +#endif template<typename TimeDuration> inline bool timed_join(TimeDuration const& rel_time) { return timed_join(get_system_time()+rel_time); } + void detach(); - static unsigned hardware_concurrency(); + static unsigned hardware_concurrency() BOOST_NOEXCEPT; +#define BOOST_THREAD_DEFINES_THREAD_NATIVE_HANDLE typedef detail::thread_data_base::native_handle_type native_handle_type; native_handle_type native_handle(); +#if defined BOOST_THREAD_PROVIDES_DEPRECATED_FEATURES_SINCE_V3_0_0 + // Use thread::id when comparisions are needed // backwards compatibility bool operator==(const thread& other) const; bool operator!=(const thread& other) const; - - static inline void yield() +#endif + static inline void yield() BOOST_NOEXCEPT { this_thread::yield(); } - + static inline void sleep(const system_time& xt) { this_thread::sleep(xt); @@ -348,85 +437,110 @@ namespace boost // extensions void interrupt(); - bool interruption_requested() const; + bool interruption_requested() const BOOST_NOEXCEPT; }; - inline void swap(thread& lhs,thread& rhs) + inline void swap(thread& lhs,thread& rhs) BOOST_NOEXCEPT { return lhs.swap(rhs); } - -#ifndef BOOST_NO_RVALUE_REFERENCES - inline thread&& move(thread& t) - { - return static_cast<thread&&>(t); - } - inline thread&& move(thread&& t) + +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES + inline thread&& move(thread& t) BOOST_NOEXCEPT { return static_cast<thread&&>(t); } -#else - inline detail::thread_move_t<thread> move(detail::thread_move_t<thread> t) - { - return t; - } #endif + BOOST_THREAD_DCL_MOVABLE(thread) + namespace this_thread { - thread::id BOOST_THREAD_DECL get_id(); + thread::id BOOST_THREAD_DECL get_id() BOOST_NOEXCEPT; void BOOST_THREAD_DECL interruption_point(); - bool BOOST_THREAD_DECL interruption_enabled(); - bool BOOST_THREAD_DECL interruption_requested(); + bool BOOST_THREAD_DECL interruption_enabled() BOOST_NOEXCEPT; + bool BOOST_THREAD_DECL interruption_requested() BOOST_NOEXCEPT; - inline void sleep(xtime const& abs_time) + inline BOOST_SYMBOL_VISIBLE void sleep(xtime const& abs_time) { sleep(system_time(abs_time)); } } - class thread::id + class BOOST_SYMBOL_VISIBLE thread::id { private: - detail::thread_data_ptr thread_data; - - id(detail::thread_data_ptr thread_data_): + friend inline + std::size_t + hash_value(const thread::id &v) + { +#if defined BOOST_THREAD_PROVIDES_BASIC_THREAD_ID + return hash_value(v.thread_data); +#else + return hash_value(v.thread_data.get()); +#endif + } + +#if defined BOOST_THREAD_PROVIDES_BASIC_THREAD_ID +#if defined(BOOST_THREAD_PLATFORM_WIN32) + typedef unsigned int data; +#else + typedef thread::native_handle_type data; +#endif +#else + typedef detail::thread_data_ptr data; +#endif + data thread_data; + + id(data thread_data_): thread_data(thread_data_) {} friend class thread; - friend id BOOST_THREAD_DECL this_thread::get_id(); + friend id BOOST_THREAD_DECL this_thread::get_id() BOOST_NOEXCEPT; public: - id(): - thread_data() + id() BOOST_NOEXCEPT: +#if defined BOOST_THREAD_PROVIDES_BASIC_THREAD_ID +#if defined(BOOST_THREAD_PLATFORM_WIN32) + thread_data(0) +#else + thread_data(0) +#endif +#else + thread_data() +#endif + {} + + id(const id& other) BOOST_NOEXCEPT : + thread_data(other.thread_data) {} - - bool operator==(const id& y) const + + bool operator==(const id& y) const BOOST_NOEXCEPT { return thread_data==y.thread_data; } - - bool operator!=(const id& y) const + + bool operator!=(const id& y) const BOOST_NOEXCEPT { return thread_data!=y.thread_data; } - - bool operator<(const id& y) const + + bool operator<(const id& y) const BOOST_NOEXCEPT { return thread_data<y.thread_data; } - - bool operator>(const id& y) const + + bool operator>(const id& y) const BOOST_NOEXCEPT { return y.thread_data<thread_data; } - - bool operator<=(const id& y) const + + bool operator<=(const id& y) const BOOST_NOEXCEPT { return !(y.thread_data<thread_data); } - - bool operator>=(const id& y) const + + bool operator>=(const id& y) const BOOST_NOEXCEPT { return !(thread_data<y.thread_data); } @@ -434,12 +548,14 @@ namespace boost #ifndef BOOST_NO_IOSTREAM #ifndef BOOST_NO_MEMBER_TEMPLATE_FRIENDS template<class charT, class traits> - friend std::basic_ostream<charT, traits>& + friend BOOST_SYMBOL_VISIBLE + std::basic_ostream<charT, traits>& operator<<(std::basic_ostream<charT, traits>& os, const id& x) { if(x.thread_data) { - return os<<x.thread_data; + io::ios_flags_saver ifs( os ); + return os<< std::hex << x.thread_data; } else { @@ -448,12 +564,14 @@ namespace boost } #else template<class charT, class traits> - std::basic_ostream<charT, traits>& + BOOST_SYMBOL_VISIBLE + std::basic_ostream<charT, traits>& print(std::basic_ostream<charT, traits>& os) const { if(thread_data) { - return os<<thread_data; + io::ios_flags_saver ifs( os ); + return os<< std::hex << thread_data; } else { @@ -467,23 +585,26 @@ namespace boost #if !defined(BOOST_NO_IOSTREAM) && defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) template<class charT, class traits> - std::basic_ostream<charT, traits>& + BOOST_SYMBOL_VISIBLE + std::basic_ostream<charT, traits>& operator<<(std::basic_ostream<charT, traits>& os, const thread::id& x) { return x.print(os); } #endif +#if defined BOOST_THREAD_PROVIDES_DEPRECATED_FEATURES_SINCE_V3_0_0 inline bool thread::operator==(const thread& other) const { return get_id()==other.get_id(); } - + inline bool thread::operator!=(const thread& other) const { return get_id()!=other.get_id(); } - +#endif + namespace detail { struct thread_exit_function_base @@ -492,26 +613,26 @@ namespace boost {} virtual void operator()()=0; }; - + template<typename F> struct thread_exit_function: thread_exit_function_base { F f; - + thread_exit_function(F f_): f(f_) {} - + void operator()() { f(); } }; - + void BOOST_THREAD_DECL add_thread_exit_function(thread_exit_function_base*); } - + namespace this_thread { template<typename F> diff --git a/3rdParty/Boost/src/boost/thread/detail/thread_interruption.hpp b/3rdParty/Boost/src/boost/thread/detail/thread_interruption.hpp index 60c0e65..f1a165c 100644 --- a/3rdParty/Boost/src/boost/thread/detail/thread_interruption.hpp +++ b/3rdParty/Boost/src/boost/thread/detail/thread_interruption.hpp @@ -4,6 +4,10 @@ // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // (C) Copyright 2007-9 Anthony Williams +// (C) Copyright 2012 Vicente J. Botet Escriba + +#include <boost/thread/detail/config.hpp> +#include <boost/thread/detail/delete.hpp> namespace boost { @@ -11,23 +15,20 @@ namespace boost { class BOOST_THREAD_DECL disable_interruption { - disable_interruption(const disable_interruption&); - disable_interruption& operator=(const disable_interruption&); - - bool interruption_was_enabled; - friend class restore_interruption; + bool interruption_was_enabled; + friend class restore_interruption; public: - disable_interruption(); - ~disable_interruption(); + BOOST_THREAD_NO_COPYABLE(disable_interruption) + disable_interruption() BOOST_NOEXCEPT; + ~disable_interruption() BOOST_NOEXCEPT; }; class BOOST_THREAD_DECL restore_interruption { - restore_interruption(const restore_interruption&); - restore_interruption& operator=(const restore_interruption&); public: - explicit restore_interruption(disable_interruption& d); - ~restore_interruption(); + BOOST_THREAD_NO_COPYABLE(restore_interruption) + explicit restore_interruption(disable_interruption& d) BOOST_NOEXCEPT; + ~restore_interruption() BOOST_NOEXCEPT; }; } } diff --git a/3rdParty/Boost/src/boost/thread/exceptions.hpp b/3rdParty/Boost/src/boost/thread/exceptions.hpp index 2a05b50..08c28d3 100644 --- a/3rdParty/Boost/src/boost/thread/exceptions.hpp +++ b/3rdParty/Boost/src/boost/thread/exceptions.hpp @@ -1,8 +1,9 @@ // Copyright (C) 2001-2003 // William E. Kempf // Copyright (C) 2007-9 Anthony Williams +// (C) Copyright 2011-2012 Vicente J. Botet Escriba // -// Distributed under the Boost Software License, Version 1.0. (See accompanying +// 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_THREAD_EXCEPTIONS_PDM070801_H @@ -18,161 +19,201 @@ #include <string> #include <stdexcept> +#include <boost/system/system_error.hpp> +#include <boost/system/error_code.hpp> + #include <boost/config/abi_prefix.hpp> namespace boost { - class thread_interrupted + class BOOST_SYMBOL_VISIBLE thread_interrupted {}; - class thread_exception: - public std::exception + class BOOST_SYMBOL_VISIBLE thread_exception: + public system::system_error + //public std::exception { - protected: - thread_exception(): - m_sys_err(0) + typedef system::system_error base_type; + public: + thread_exception() + : base_type(0,system::system_category()) {} - - thread_exception(int sys_err_code): - m_sys_err(sys_err_code) + + thread_exception(int sys_error_code) + : base_type(sys_error_code, system::system_category()) {} - - public: + thread_exception( int ev, const char * what_arg ) + : base_type(system::error_code(ev, system::system_category()), what_arg) + { + } + thread_exception( int ev, const std::string & what_arg ) + : base_type(system::error_code(ev, system::system_category()), what_arg) + { + } + ~thread_exception() throw() {} - + int native_error() const { - return m_sys_err; + return code().value(); } - - private: - int m_sys_err; }; - class condition_error: - public std::exception + class BOOST_SYMBOL_VISIBLE condition_error: + public system::system_error + //public std::exception { + typedef system::system_error base_type; public: - const char* what() const throw() - { - return "Condition error"; - } + condition_error() + : base_type(system::error_code(0, system::system_category()), "Condition error") + {} + condition_error( int ev ) + : base_type(system::error_code(ev, system::system_category()), "Condition error") + { + } + condition_error( int ev, const char * what_arg ) + : base_type(system::error_code(ev, system::system_category()), what_arg) + { + } + condition_error( int ev, const std::string & what_arg ) + : base_type(system::error_code(ev, system::system_category()), what_arg) + { + } }; - - class lock_error: + + class BOOST_SYMBOL_VISIBLE lock_error: public thread_exception { + typedef thread_exception base_type; public: lock_error() + : base_type(0, "boost::lock_error") {} - - lock_error(int sys_err_code): - thread_exception(sys_err_code) - {} - - ~lock_error() throw() - {} - - virtual const char* what() const throw() + lock_error( int ev ) + : base_type(ev, "boost::lock_error") + { + } + lock_error( int ev, const char * what_arg ) + : base_type(ev, what_arg) { - return "boost::lock_error"; } + lock_error( int ev, const std::string & what_arg ) + : base_type(ev, what_arg) + { + } + + ~lock_error() throw() + {} + }; - class thread_resource_error: + class BOOST_SYMBOL_VISIBLE thread_resource_error: public thread_exception { + typedef thread_exception base_type; public: - thread_resource_error() - {} - - thread_resource_error(int sys_err_code): - thread_exception(sys_err_code) - {} - + thread_resource_error() + : base_type(system::errc::resource_unavailable_try_again, "boost::thread_resource_error") + {} + + thread_resource_error( int ev ) + : base_type(ev, "boost::thread_resource_error") + { + } + thread_resource_error( int ev, const char * what_arg ) + : base_type(ev, what_arg) + { + } + thread_resource_error( int ev, const std::string & what_arg ) + : base_type(ev, what_arg) + { + } + + ~thread_resource_error() throw() {} - - virtual const char* what() const throw() - { - return "boost::thread_resource_error"; - } - }; - class unsupported_thread_option: + class BOOST_SYMBOL_VISIBLE unsupported_thread_option: public thread_exception { + typedef thread_exception base_type; public: - unsupported_thread_option() - {} - - unsupported_thread_option(int sys_err_code): - thread_exception(sys_err_code) - {} - - ~unsupported_thread_option() throw() - {} - + unsupported_thread_option() + : base_type(system::errc::invalid_argument, "boost::unsupported_thread_option") + {} + + unsupported_thread_option( int ev ) + : base_type(ev, "boost::unsupported_thread_option") + { + } + unsupported_thread_option( int ev, const char * what_arg ) + : base_type(ev, what_arg) + { + } + unsupported_thread_option( int ev, const std::string & what_arg ) + : base_type(ev, what_arg) + { + } - virtual const char* what() const throw() - { - return "boost::unsupported_thread_option"; - } - }; - class invalid_thread_argument: + class BOOST_SYMBOL_VISIBLE invalid_thread_argument: public thread_exception { + typedef thread_exception base_type; public: invalid_thread_argument() + : base_type(system::errc::invalid_argument, "boost::invalid_thread_argument") {} - - invalid_thread_argument(int sys_err_code): - thread_exception(sys_err_code) - {} - - ~invalid_thread_argument() throw() - {} - - virtual const char* what() const throw() + invalid_thread_argument( int ev ) + : base_type(ev, "boost::invalid_thread_argument") + { + } + invalid_thread_argument( int ev, const char * what_arg ) + : base_type(ev, what_arg) { - return "boost::invalid_thread_argument"; } - + invalid_thread_argument( int ev, const std::string & what_arg ) + : base_type(ev, what_arg) + { + } + }; - class thread_permission_error: + class BOOST_SYMBOL_VISIBLE thread_permission_error: public thread_exception { + typedef thread_exception base_type; public: - thread_permission_error() - {} - - thread_permission_error(int sys_err_code): - thread_exception(sys_err_code) - {} - - ~thread_permission_error() throw() - {} - + thread_permission_error() + : base_type(system::errc::permission_denied, "boost::thread_permission_error") + {} + + thread_permission_error( int ev ) + : base_type(ev, "boost::thread_permission_error") + { + } + thread_permission_error( int ev, const char * what_arg ) + : base_type(ev, what_arg) + { + } + thread_permission_error( int ev, const std::string & what_arg ) + : base_type(ev, what_arg) + { + } - virtual const char* what() const throw() - { - return "boost::thread_permission_error"; - } - }; } // namespace boost diff --git a/3rdParty/Boost/src/boost/thread/future.hpp b/3rdParty/Boost/src/boost/thread/future.hpp index a4b4343..6bf5cf6 100644 --- a/3rdParty/Boost/src/boost/thread/future.hpp +++ b/3rdParty/Boost/src/boost/thread/future.hpp @@ -1,4 +1,5 @@ -// (C) Copyright 2008-10 Anthony Williams +// (C) Copyright 2008-10 Anthony Williams +// (C) Copyright 2011-2012 Vicente J. Botet Escriba // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at @@ -6,6 +7,15 @@ #ifndef BOOST_THREAD_FUTURE_HPP #define BOOST_THREAD_FUTURE_HPP + +#include <boost/thread/detail/config.hpp> + +// boost::thread::future requires exception handling +// due to boost::exception::exception_ptr dependency + +#ifndef BOOST_NO_EXCEPTIONS + +#include <boost/detail/scoped_enum_emulation.hpp> #include <stdexcept> #include <boost/thread/detail/move.hpp> #include <boost/thread/thread_time.hpp> @@ -16,6 +26,8 @@ #include <boost/scoped_ptr.hpp> #include <boost/type_traits/is_fundamental.hpp> #include <boost/type_traits/is_convertible.hpp> +#include <boost/type_traits/remove_reference.hpp> +#include <boost/type_traits/remove_cv.hpp> #include <boost/mpl/if.hpp> #include <boost/config.hpp> #include <boost/throw_exception.hpp> @@ -28,59 +40,168 @@ #include <list> #include <boost/next_prior.hpp> #include <vector> +#include <boost/system/error_code.hpp> +#ifdef BOOST_THREAD_USES_CHRONO +#include <boost/chrono/system_clocks.hpp> +#endif + +#if defined BOOST_THREAD_PROVIDES_FUTURE_CTOR_ALLOCATORS +#include <boost/thread/detail/memory.hpp> +#endif + +#include <boost/utility/result_of.hpp> +#include <boost/thread/thread.hpp> + +#if defined BOOST_THREAD_PROVIDES_FUTURE +#define BOOST_THREAD_FUTURE future +#else +#define BOOST_THREAD_FUTURE unique_future +#endif + namespace boost { - class future_uninitialized: - public std::logic_error + + //enum class future_errc + BOOST_SCOPED_ENUM_DECLARE_BEGIN(future_errc) + { + broken_promise, + future_already_retrieved, + promise_already_satisfied, + no_state + } + BOOST_SCOPED_ENUM_DECLARE_END(future_errc) + + namespace system + { + template <> + struct BOOST_SYMBOL_VISIBLE is_error_code_enum<future_errc> : public true_type {}; + + #ifdef BOOST_NO_CXX11_SCOPED_ENUMS + template <> + struct BOOST_SYMBOL_VISIBLE is_error_code_enum<future_errc::enum_type> : public true_type { }; + #endif + } + + //enum class launch + BOOST_SCOPED_ENUM_DECLARE_BEGIN(launch) + { + async = 1, + deferred = 2, + any = async | deferred + } + BOOST_SCOPED_ENUM_DECLARE_END(launch) + + //enum class future_status + BOOST_SCOPED_ENUM_DECLARE_BEGIN(future_status) + { + ready, + timeout, + deferred + } + BOOST_SCOPED_ENUM_DECLARE_END(future_status) + + BOOST_THREAD_DECL + const system::error_category& future_category() BOOST_NOEXCEPT; + + namespace system + { + inline + error_code + make_error_code(future_errc e) //BOOST_NOEXCEPT + { + return error_code(underlying_cast<int>(e), boost::future_category()); + } + + inline + error_condition + make_error_condition(future_errc e) //BOOST_NOEXCEPT + { + return error_condition(underlying_cast<int>(e), future_category()); + } + } + + class BOOST_SYMBOL_VISIBLE future_error + : public std::logic_error + { + system::error_code ec_; + public: + future_error(system::error_code ec) + : logic_error(ec.message()), + ec_(ec) + { + } + + const system::error_code& code() const BOOST_NOEXCEPT + { + return ec_; + } + const char* what() const BOOST_THREAD_NOEXCEPT_OR_THROW + { + return code().message().c_str(); + } + + }; + + class BOOST_SYMBOL_VISIBLE future_uninitialized: + public future_error { public: - future_uninitialized(): - std::logic_error("Future Uninitialized") + future_uninitialized() : + future_error(system::make_error_code(future_errc::no_state)) {} }; - class broken_promise: - public std::logic_error + class BOOST_SYMBOL_VISIBLE broken_promise: + public future_error { public: broken_promise(): - std::logic_error("Broken promise") + future_error(system::make_error_code(future_errc::broken_promise)) {} }; - class future_already_retrieved: - public std::logic_error + class BOOST_SYMBOL_VISIBLE future_already_retrieved: + public future_error { public: future_already_retrieved(): - std::logic_error("Future already retrieved") + future_error(system::make_error_code(future_errc::future_already_retrieved)) {} }; - class promise_already_satisfied: - public std::logic_error + class BOOST_SYMBOL_VISIBLE promise_already_satisfied: + public future_error { public: promise_already_satisfied(): - std::logic_error("Promise already satisfied") + future_error(system::make_error_code(future_errc::promise_already_satisfied)) {} }; - class task_already_started: - public std::logic_error + class BOOST_SYMBOL_VISIBLE task_already_started: + public future_error { public: task_already_started(): - std::logic_error("Task already started") + future_error(system::make_error_code(future_errc::promise_already_satisfied)) {} }; - class task_moved: - public std::logic_error - { - public: - task_moved(): - std::logic_error("Task moved") - {} - }; + class BOOST_SYMBOL_VISIBLE task_moved: + public future_error + { + public: + task_moved(): + future_error(system::make_error_code(future_errc::no_state)) + {} + }; + + class promise_moved: + public future_error + { + public: + promise_moved(): + future_error(system::make_error_code(future_errc::no_state)) + {} + }; namespace future_state { @@ -93,6 +214,7 @@ namespace boost { boost::exception_ptr exception; bool done; + bool thread_was_interrupted; boost::mutex mutex; boost::condition_variable waiters; typedef std::list<boost::condition_variable_any*> waiter_list; @@ -100,7 +222,8 @@ namespace boost boost::function<void()> callback; future_object_base(): - done(false) + done(false), + thread_was_interrupted(false) {} virtual ~future_object_base() {} @@ -111,7 +234,7 @@ namespace boost do_callback(lock); return external_waiters.insert(external_waiters.end(),&cv); } - + void remove_external_waiter(waiter_list::iterator it) { boost::lock_guard<boost::mutex> lock(mutex); @@ -132,7 +255,7 @@ namespace boost struct relocker { boost::unique_lock<boost::mutex>& lock; - + relocker(boost::unique_lock<boost::mutex>& lock_): lock(lock_) { @@ -155,7 +278,7 @@ namespace boost local_callback(); } } - + void wait(bool rethrow=true) { @@ -165,6 +288,10 @@ namespace boost { waiters.wait(lock); } + if(rethrow && thread_was_interrupted) + { + throw boost::thread_interrupted(); + } if(rethrow && exception) { boost::rethrow_exception(exception); @@ -185,7 +312,26 @@ namespace boost } return true; } - + +#ifdef BOOST_THREAD_USES_CHRONO + + template <class Clock, class Duration> + future_status + wait_until(const chrono::time_point<Clock, Duration>& abs_time) + { + boost::unique_lock<boost::mutex> lock(mutex); + do_callback(lock); + while(!done) + { + cv_status const st=waiters.wait_until(lock,abs_time); + if(st==cv_status::timeout && !done) + { + return future_status::timeout; + } + } + return future_status::ready; + } +#endif void mark_exceptional_finish_internal(boost::exception_ptr const& e) { exception=e; @@ -196,16 +342,21 @@ namespace boost boost::lock_guard<boost::mutex> lock(mutex); mark_exceptional_finish_internal(boost::current_exception()); } - + void mark_interrupted_finish() + { + boost::lock_guard<boost::mutex> lock(mutex); + thread_was_interrupted=true; + mark_finished_internal(); + } bool has_value() { boost::lock_guard<boost::mutex> lock(mutex); - return done && !exception; + return done && !(exception || thread_was_interrupted); } bool has_exception() { boost::lock_guard<boost::mutex> lock(mutex); - return done && exception; + return done && (exception || thread_was_interrupted); } template<typename F,typename U> @@ -213,7 +364,7 @@ namespace boost { callback=boost::bind(f,boost::ref(*u)); } - + private: future_object_base(future_object_base const&); future_object_base& operator=(future_object_base const&); @@ -223,25 +374,31 @@ namespace boost struct future_traits { typedef boost::scoped_ptr<T> storage_type; -#ifndef BOOST_NO_RVALUE_REFERENCES +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES typedef T const& source_reference_type; struct dummy; - typedef typename boost::mpl::if_<boost::is_fundamental<T>,dummy&,T&&>::type rvalue_source_type; - typedef typename boost::mpl::if_<boost::is_fundamental<T>,T,T&&>::type move_dest_type; + typedef typename boost::mpl::if_<boost::is_fundamental<T>,dummy&,BOOST_THREAD_RV_REF(T)>::type rvalue_source_type; + typedef typename boost::mpl::if_<boost::is_fundamental<T>,T,BOOST_THREAD_RV_REF(T)>::type move_dest_type; +#elif defined BOOST_THREAD_USES_MOVE + typedef T& source_reference_type; + typedef typename boost::mpl::if_<boost::has_move_emulation_enabled<T>,BOOST_THREAD_RV_REF(T),T const&>::type rvalue_source_type; + typedef typename boost::mpl::if_<boost::has_move_emulation_enabled<T>,BOOST_THREAD_RV_REF(T),T>::type move_dest_type; #else typedef T& source_reference_type; - typedef typename boost::mpl::if_<boost::is_convertible<T&,boost::detail::thread_move_t<T> >,boost::detail::thread_move_t<T>,T const&>::type rvalue_source_type; - typedef typename boost::mpl::if_<boost::is_convertible<T&,boost::detail::thread_move_t<T> >,boost::detail::thread_move_t<T>,T>::type move_dest_type; + typedef typename boost::mpl::if_<boost::is_convertible<T&,BOOST_THREAD_RV_REF(T) >,BOOST_THREAD_RV_REF(T),T const&>::type rvalue_source_type; + typedef typename boost::mpl::if_<boost::is_convertible<T&,BOOST_THREAD_RV_REF(T) >,BOOST_THREAD_RV_REF(T),T>::type move_dest_type; #endif + typedef const T& shared_future_get_result_type; + static void init(storage_type& storage,source_reference_type t) { storage.reset(new T(t)); } - + static void init(storage_type& storage,rvalue_source_type t) { - storage.reset(new T(static_cast<rvalue_source_type>(t))); + storage.reset(new T(static_cast<rvalue_source_type>(t))); } static void cleanup(storage_type& storage) @@ -249,7 +406,7 @@ namespace boost storage.reset(); } }; - + template<typename T> struct future_traits<T&> { @@ -258,6 +415,7 @@ namespace boost struct rvalue_source_type {}; typedef T& move_dest_type; + typedef T& shared_future_get_result_type; static void init(storage_type& storage,T& t) { @@ -275,6 +433,7 @@ namespace boost { typedef bool storage_type; typedef void move_dest_type; + typedef void shared_future_get_result_type; static void init(storage_type& storage) { @@ -296,7 +455,8 @@ namespace boost typedef typename future_traits<T>::source_reference_type source_reference_type; typedef typename future_traits<T>::rvalue_source_type rvalue_source_type; typedef typename future_traits<T>::move_dest_type move_dest_type; - + typedef typename future_traits<T>::shared_future_get_result_type shared_future_get_result_type; + storage_type result; future_object(): @@ -308,6 +468,7 @@ namespace boost future_traits<T>::init(result,result_); mark_finished_internal(); } + void mark_finished_with_result_internal(rvalue_source_type result_) { future_traits<T>::init(result,static_cast<rvalue_source_type>(result_)); @@ -319,10 +480,11 @@ namespace boost boost::lock_guard<boost::mutex> lock(mutex); mark_finished_with_result_internal(result_); } + void mark_finished_with_result(rvalue_source_type result_) { boost::lock_guard<boost::mutex> lock(mutex); - mark_finished_with_result_internal(result_); + mark_finished_with_result_internal(static_cast<rvalue_source_type>(result_)); } move_dest_type get() @@ -331,6 +493,12 @@ namespace boost return static_cast<move_dest_type>(*result); } + shared_future_get_result_type get_sh() + { + wait(); + return static_cast<shared_future_get_result_type>(*result); + } + future_state::state get_state() { boost::lock_guard<boost::mutex> guard(mutex); @@ -353,6 +521,8 @@ namespace boost struct future_object<void>: detail::future_object_base { + typedef void shared_future_get_result_type; + future_object() {} @@ -371,7 +541,10 @@ namespace boost { wait(); } - + void get_sh() + { + wait(); + } future_state::state get_state() { boost::lock_guard<boost::mutex> guard(mutex); @@ -384,74 +557,93 @@ namespace boost return future_state::ready; } } - private: future_object(future_object const&); future_object& operator=(future_object const&); }; +// template<typename T, typename Allocator> +// struct future_object_alloc: public future_object<T> +// { +// typedef future_object<T> base; +// Allocator alloc_; +// +// public: +// explicit future_object_alloc(const Allocator& a) +// : alloc_(a) {} +// +// }; class future_waiter { struct registered_waiter; - typedef std::vector<registered_waiter>::size_type count_type; - + typedef std::vector<int>::size_type count_type; + struct registered_waiter { - boost::shared_ptr<detail::future_object_base> future; + boost::shared_ptr<detail::future_object_base> future_; detail::future_object_base::waiter_list::iterator wait_iterator; count_type index; - registered_waiter(boost::shared_ptr<detail::future_object_base> const& future_, + registered_waiter(boost::shared_ptr<detail::future_object_base> const& a_future, detail::future_object_base::waiter_list::iterator wait_iterator_, count_type index_): - future(future_),wait_iterator(wait_iterator_),index(index_) + future_(a_future),wait_iterator(wait_iterator_),index(index_) {} }; - + struct all_futures_lock { - count_type count; +#ifdef _MANAGED + typedef std::ptrdiff_t count_type_portable; +#else + typedef count_type count_type_portable; +#endif + count_type_portable count; boost::scoped_array<boost::unique_lock<boost::mutex> > locks; - + all_futures_lock(std::vector<registered_waiter>& futures): count(futures.size()),locks(new boost::unique_lock<boost::mutex>[count]) { - for(count_type i=0;i<count;++i) + for(count_type_portable i=0;i<count;++i) { - locks[i]=boost::unique_lock<boost::mutex>(futures[i].future->mutex); +#if defined __DECCXX || defined __SUNPRO_CC || defined __hpux + locks[i]=boost::unique_lock<boost::mutex>(futures[i].future_->mutex).move(); +#else + locks[i]=boost::unique_lock<boost::mutex>(futures[i].future_->mutex); +#endif } } - + void lock() { boost::lock(locks.get(),locks.get()+count); } - + void unlock() { - for(count_type i=0;i<count;++i) + for(count_type_portable i=0;i<count;++i) { locks[i].unlock(); } } }; - + boost::condition_variable_any cv; std::vector<registered_waiter> futures; count_type future_count; - + public: future_waiter(): future_count(0) {} - + template<typename F> void add(F& f) { - if(f.future) + if(f.future_) { - futures.push_back(registered_waiter(f.future,f.future->register_external_waiter(cv),future_count)); + futures.push_back(registered_waiter(f.future_,f.future_->register_external_waiter(cv),future_count)); } ++future_count; } @@ -463,7 +655,7 @@ namespace boost { for(count_type i=0;i<futures.size();++i) { - if(futures[i].future->done) + if(futures[i].future_->done) { return futures[i].index; } @@ -471,21 +663,21 @@ namespace boost cv.wait(lk); } } - + ~future_waiter() { for(count_type i=0;i<futures.size();++i) { - futures[i].future->remove_external_waiter(futures[i].wait_iterator); + futures[i].future_->remove_external_waiter(futures[i].wait_iterator); } } - + }; - + } template <typename R> - class unique_future; + class BOOST_THREAD_FUTURE; template <typename R> class shared_future; @@ -495,13 +687,13 @@ namespace boost { BOOST_STATIC_CONSTANT(bool, value=false); }; - + template<typename T> - struct is_future_type<unique_future<T> > + struct is_future_type<BOOST_THREAD_FUTURE<T> > { BOOST_STATIC_CONSTANT(bool, value=true); }; - + template<typename T> struct is_future_type<shared_future<T> > { @@ -531,7 +723,7 @@ namespace boost f2.wait(); f3.wait(); } - + template<typename F1,typename F2,typename F3,typename F4> void wait_for_all(F1& f1,F2& f2,F3& f3,F4& f4) { @@ -556,7 +748,7 @@ namespace boost { if(begin==end) return end; - + detail::future_waiter waiter; for(Iterator current=begin;current!=end;++current) { @@ -583,7 +775,7 @@ namespace boost waiter.add(f3); return waiter.wait(); } - + template<typename F1,typename F2,typename F3,typename F4> unsigned wait_for_any(F1& f1,F2& f2,F3& f3,F4& f4) { @@ -606,7 +798,7 @@ namespace boost waiter.add(f5); return waiter.wait(); } - + template <typename R> class promise; @@ -614,14 +806,13 @@ namespace boost class packaged_task; template <typename R> - class unique_future + class BOOST_THREAD_FUTURE { - unique_future(unique_future & rhs);// = delete; - unique_future& operator=(unique_future& rhs);// = delete; + private: typedef boost::shared_ptr<detail::future_object<R> > future_ptr; - - future_ptr future; + + future_ptr future_; friend class shared_future<R>; friend class promise<R>; @@ -630,139 +821,151 @@ namespace boost typedef typename detail::future_traits<R>::move_dest_type move_dest_type; - unique_future(future_ptr future_): - future(future_) + BOOST_THREAD_FUTURE(future_ptr a_future): + future_(a_future) {} public: + BOOST_THREAD_MOVABLE_ONLY(BOOST_THREAD_FUTURE) typedef future_state::state state; - unique_future() + BOOST_THREAD_FUTURE() {} - - ~unique_future() + + ~BOOST_THREAD_FUTURE() {} -#ifndef BOOST_NO_RVALUE_REFERENCES - unique_future(unique_future && other) - { - future.swap(other.future); - } - unique_future& operator=(unique_future && other) - { - future=other.future; - other.future.reset(); - return *this; - } -#else - unique_future(boost::detail::thread_move_t<unique_future> other): - future(other->future) + BOOST_THREAD_FUTURE(BOOST_THREAD_RV_REF(BOOST_THREAD_FUTURE) other) BOOST_NOEXCEPT: + future_(BOOST_THREAD_RV(other).future_) { - other->future.reset(); + BOOST_THREAD_RV(other).future_.reset(); } - unique_future& operator=(boost::detail::thread_move_t<unique_future> other) + BOOST_THREAD_FUTURE& operator=(BOOST_THREAD_RV_REF(BOOST_THREAD_FUTURE) other) BOOST_NOEXCEPT { - future=other->future; - other->future.reset(); + future_=BOOST_THREAD_RV(other).future_; + BOOST_THREAD_RV(other).future_.reset(); return *this; } - operator boost::detail::thread_move_t<unique_future>() + shared_future<R> share() { - return boost::detail::thread_move_t<unique_future>(*this); + return shared_future<R>(::boost::move(*this)); } -#endif - void swap(unique_future& other) + void swap(BOOST_THREAD_FUTURE& other) { - future.swap(other.future); + future_.swap(other.future_); } // retrieving the value move_dest_type get() { - if(!future) + if(!future_) { boost::throw_exception(future_uninitialized()); } - return future->get(); + return future_->get(); } - + // functions to check state, and wait for ready - state get_state() const + state get_state() const BOOST_NOEXCEPT { - if(!future) + if(!future_) { return future_state::uninitialized; } - return future->get_state(); + return future_->get_state(); } - - bool is_ready() const + bool is_ready() const BOOST_NOEXCEPT { return get_state()==future_state::ready; } - - bool has_exception() const + + bool has_exception() const BOOST_NOEXCEPT { - return future && future->has_exception(); + return future_ && future_->has_exception(); } - - bool has_value() const + + bool has_value() const BOOST_NOEXCEPT { - return future && future->has_value(); + return future_ && future_->has_value(); } - + + bool valid() const BOOST_NOEXCEPT + { + return future_ != 0; + } + + void wait() const { - if(!future) + if(!future_) { boost::throw_exception(future_uninitialized()); } - future->wait(false); + future_->wait(false); } - + template<typename Duration> bool timed_wait(Duration const& rel_time) const { return timed_wait_until(boost::get_system_time()+rel_time); } - + bool timed_wait_until(boost::system_time const& abs_time) const { - if(!future) + if(!future_) { boost::throw_exception(future_uninitialized()); } - return future->timed_wait_until(abs_time); + return future_->timed_wait_until(abs_time); } - +#ifdef BOOST_THREAD_USES_CHRONO + template <class Rep, class Period> + future_status + wait_for(const chrono::duration<Rep, Period>& rel_time) const + { + return wait_until(chrono::steady_clock::now() + rel_time); + + } + template <class Clock, class Duration> + future_status + wait_until(const chrono::time_point<Clock, Duration>& abs_time) const + { + if(!future_) + { + boost::throw_exception(future_uninitialized()); + } + return future_->wait_until(abs_time); + } +#endif }; + BOOST_THREAD_DCL_MOVABLE_BEG(T) BOOST_THREAD_FUTURE<T> BOOST_THREAD_DCL_MOVABLE_END + template <typename R> class shared_future { typedef boost::shared_ptr<detail::future_object<R> > future_ptr; - - future_ptr future; -// shared_future(const unique_future<R>& other); -// shared_future& operator=(const unique_future<R>& other); + future_ptr future_; friend class detail::future_waiter; friend class promise<R>; friend class packaged_task<R>; - - shared_future(future_ptr future_): - future(future_) + + shared_future(future_ptr a_future): + future_(a_future) {} public: + BOOST_THREAD_MOVABLE(shared_future) + shared_future(shared_future const& other): - future(other.future) + future_(other.future_) {} typedef future_state::state state; @@ -775,396 +978,405 @@ namespace boost shared_future& operator=(shared_future const& other) { - future=other.future; + future_=other.future_; return *this; } -#ifndef BOOST_NO_RVALUE_REFERENCES - shared_future(shared_future && other) + shared_future(BOOST_THREAD_RV_REF(shared_future) other) BOOST_NOEXCEPT : + future_(BOOST_THREAD_RV(other).future_) { - future.swap(other.future); + BOOST_THREAD_RV(other).future_.reset(); } - shared_future(unique_future<R> && other) + shared_future(BOOST_THREAD_RV_REF_BEG BOOST_THREAD_FUTURE<R> BOOST_THREAD_RV_REF_END other) BOOST_NOEXCEPT : + future_(BOOST_THREAD_RV(other).future_) { - future.swap(other.future); + BOOST_THREAD_RV(other).future_.reset(); } - shared_future& operator=(shared_future && other) + shared_future& operator=(BOOST_THREAD_RV_REF(shared_future) other) BOOST_NOEXCEPT { - future.swap(other.future); - other.future.reset(); + future_.swap(BOOST_THREAD_RV(other).future_); + BOOST_THREAD_RV(other).future_.reset(); return *this; } - shared_future& operator=(unique_future<R> && other) + shared_future& operator=(BOOST_THREAD_RV_REF_BEG BOOST_THREAD_FUTURE<R> BOOST_THREAD_RV_REF_END other) BOOST_NOEXCEPT { - future.swap(other.future); - other.future.reset(); + future_.swap(BOOST_THREAD_RV(other).future_); + BOOST_THREAD_RV(other).future_.reset(); return *this; } -#else - shared_future(boost::detail::thread_move_t<shared_future> other): - future(other->future) - { - other->future.reset(); - } -// shared_future(const unique_future<R> &) = delete; - shared_future(boost::detail::thread_move_t<unique_future<R> > other): - future(other->future) - { - other->future.reset(); - } - shared_future& operator=(boost::detail::thread_move_t<shared_future> other) - { - future.swap(other->future); - other->future.reset(); - return *this; - } - shared_future& operator=(boost::detail::thread_move_t<unique_future<R> > other) - { - future.swap(other->future); - other->future.reset(); - return *this; - } - - operator boost::detail::thread_move_t<shared_future>() - { - return boost::detail::thread_move_t<shared_future>(*this); - } - -#endif - void swap(shared_future& other) + void swap(shared_future& other) BOOST_NOEXCEPT { - future.swap(other.future); + future_.swap(other.future_); } // retrieving the value - R get() + typename detail::future_object<R>::shared_future_get_result_type get() { - if(!future) + if(!future_) { boost::throw_exception(future_uninitialized()); } - return future->get(); + return future_->get_sh(); } - + // functions to check state, and wait for ready - state get_state() const + state get_state() const BOOST_NOEXCEPT { - if(!future) + if(!future_) { return future_state::uninitialized; } - return future->get_state(); + return future_->get_state(); } - - bool is_ready() const + bool valid() const BOOST_NOEXCEPT + { + return future_ != 0; + } + + bool is_ready() const BOOST_NOEXCEPT { return get_state()==future_state::ready; } - - bool has_exception() const + + bool has_exception() const BOOST_NOEXCEPT { - return future && future->has_exception(); + return future_ && future_->has_exception(); } - - bool has_value() const + + bool has_value() const BOOST_NOEXCEPT { - return future && future->has_value(); + return future_ && future_->has_value(); } void wait() const { - if(!future) + if(!future_) { boost::throw_exception(future_uninitialized()); } - future->wait(false); + future_->wait(false); } - + template<typename Duration> bool timed_wait(Duration const& rel_time) const { return timed_wait_until(boost::get_system_time()+rel_time); } - + bool timed_wait_until(boost::system_time const& abs_time) const { - if(!future) + if(!future_) { boost::throw_exception(future_uninitialized()); } - return future->timed_wait_until(abs_time); + return future_->timed_wait_until(abs_time); } - +#ifdef BOOST_THREAD_USES_CHRONO + + template <class Rep, class Period> + future_status + wait_for(const chrono::duration<Rep, Period>& rel_time) const + { + return wait_until(chrono::steady_clock::now() + rel_time); + + } + template <class Clock, class Duration> + future_status + wait_until(const chrono::time_point<Clock, Duration>& abs_time) const + { + if(!future_) + { + boost::throw_exception(future_uninitialized()); + } + return future_->wait_until(abs_time); + } +#endif }; + BOOST_THREAD_DCL_MOVABLE_BEG(T) shared_future<T> BOOST_THREAD_DCL_MOVABLE_END + template <typename R> class promise { typedef boost::shared_ptr<detail::future_object<R> > future_ptr; - - future_ptr future; + + future_ptr future_; bool future_obtained; - - promise(promise & rhs);// = delete; - promise & operator=(promise & rhs);// = delete; void lazy_init() { - if(!atomic_load(&future)) +#if defined BOOST_THREAD_PROMISE_LAZY + if(!atomic_load(&future_)) { future_ptr blank; - atomic_compare_exchange(&future,&blank,future_ptr(new detail::future_object<R>)); + atomic_compare_exchange(&future_,&blank,future_ptr(new detail::future_object<R>)); } +#endif } - + public: -// template <class Allocator> explicit promise(Allocator a); + BOOST_THREAD_MOVABLE_ONLY(promise) +#if defined BOOST_THREAD_PROVIDES_FUTURE_CTOR_ALLOCATORS + template <class Allocator> + promise(boost::allocator_arg_t, Allocator a) + { + typedef typename Allocator::template rebind<detail::future_object<R> >::other A2; + A2 a2(a); + typedef thread_detail::allocator_destructor<A2> D; + future_ = future_ptr(::new(a2.allocate(1)) detail::future_object<R>(), D(a2, 1) ); + future_obtained = false; + } +#endif promise(): - future(),future_obtained(false) +#if defined BOOST_THREAD_PROMISE_LAZY + future_(), +#else + future_(new detail::future_object<R>()), +#endif + future_obtained(false) {} - + ~promise() { - if(future) + if(future_) { - boost::lock_guard<boost::mutex> lock(future->mutex); + boost::lock_guard<boost::mutex> lock(future_->mutex); - if(!future->done) + if(!future_->done) { - future->mark_exceptional_finish_internal(boost::copy_exception(broken_promise())); + future_->mark_exceptional_finish_internal(boost::copy_exception(broken_promise())); } } } // Assignment -#ifndef BOOST_NO_RVALUE_REFERENCES - promise(promise && rhs): - future_obtained(rhs.future_obtained) + promise(BOOST_THREAD_RV_REF(promise) rhs) BOOST_NOEXCEPT : + future_(BOOST_THREAD_RV(rhs).future_),future_obtained(BOOST_THREAD_RV(rhs).future_obtained) { - future.swap(rhs.future); - rhs.future_obtained=false; + BOOST_THREAD_RV(rhs).future_.reset(); + BOOST_THREAD_RV(rhs).future_obtained=false; } - promise & operator=(promise&& rhs) + promise & operator=(BOOST_THREAD_RV_REF(promise) rhs) BOOST_NOEXCEPT { - future.swap(rhs.future); - future_obtained=rhs.future_obtained; - rhs.future.reset(); - rhs.future_obtained=false; - return *this; - } -#else - promise(boost::detail::thread_move_t<promise> rhs): - future(rhs->future),future_obtained(rhs->future_obtained) - { - rhs->future.reset(); - rhs->future_obtained=false; - } - promise & operator=(boost::detail::thread_move_t<promise> rhs) - { - future=rhs->future; - future_obtained=rhs->future_obtained; - rhs->future.reset(); - rhs->future_obtained=false; + future_=BOOST_THREAD_RV(rhs).future_; + future_obtained=BOOST_THREAD_RV(rhs).future_obtained; + BOOST_THREAD_RV(rhs).future_.reset(); + BOOST_THREAD_RV(rhs).future_obtained=false; return *this; } - operator boost::detail::thread_move_t<promise>() - { - return boost::detail::thread_move_t<promise>(*this); - } -#endif - void swap(promise& other) { - future.swap(other.future); + future_.swap(other.future_); std::swap(future_obtained,other.future_obtained); } // Result retrieval - unique_future<R> get_future() + BOOST_THREAD_FUTURE<R> get_future() { lazy_init(); - if(future_obtained) + if (future_.get()==0) + { + boost::throw_exception(promise_moved()); + } + if (future_obtained) { boost::throw_exception(future_already_retrieved()); } future_obtained=true; - return unique_future<R>(future); + return BOOST_THREAD_FUTURE<R>(future_); } void set_value(typename detail::future_traits<R>::source_reference_type r) { lazy_init(); - boost::lock_guard<boost::mutex> lock(future->mutex); - if(future->done) + boost::lock_guard<boost::mutex> lock(future_->mutex); + if(future_->done) { boost::throw_exception(promise_already_satisfied()); } - future->mark_finished_with_result_internal(r); + future_->mark_finished_with_result_internal(r); } // void set_value(R && r); void set_value(typename detail::future_traits<R>::rvalue_source_type r) { lazy_init(); - boost::lock_guard<boost::mutex> lock(future->mutex); - if(future->done) + boost::lock_guard<boost::mutex> lock(future_->mutex); + if(future_->done) { boost::throw_exception(promise_already_satisfied()); } - future->mark_finished_with_result_internal(static_cast<typename detail::future_traits<R>::rvalue_source_type>(r)); + future_->mark_finished_with_result_internal(static_cast<typename detail::future_traits<R>::rvalue_source_type>(r)); } void set_exception(boost::exception_ptr p) { lazy_init(); - boost::lock_guard<boost::mutex> lock(future->mutex); - if(future->done) + boost::lock_guard<boost::mutex> lock(future_->mutex); + if(future_->done) { boost::throw_exception(promise_already_satisfied()); } - future->mark_exceptional_finish_internal(p); + future_->mark_exceptional_finish_internal(p); } + // setting the result with deferred notification + //void set_value_at_thread_exit(const R& r); // NOT YET IMPLEMENTED + //void set_value_at_thread_exit(see below); // NOT YET IMPLEMENTED + //void set_exception_at_thread_exit(exception_ptr p); // NOT YET IMPLEMENTED + template<typename F> void set_wait_callback(F f) { lazy_init(); - future->set_wait_callback(f,this); + future_->set_wait_callback(f,this); } - + }; template <> class promise<void> { typedef boost::shared_ptr<detail::future_object<void> > future_ptr; - - future_ptr future; + + future_ptr future_; bool future_obtained; - - promise(promise & rhs);// = delete; - promise & operator=(promise & rhs);// = delete; void lazy_init() { - if(!atomic_load(&future)) +#if defined BOOST_THREAD_PROMISE_LAZY + if(!atomic_load(&future_)) { future_ptr blank; - atomic_compare_exchange(&future,&blank,future_ptr(new detail::future_object<void>)); + atomic_compare_exchange(&future_,&blank,future_ptr(new detail::future_object<void>)); } +#endif } public: -// template <class Allocator> explicit promise(Allocator a); + BOOST_THREAD_MOVABLE_ONLY(promise) + +#if defined BOOST_THREAD_PROVIDES_FUTURE_CTOR_ALLOCATORS + template <class Allocator> + promise(boost::allocator_arg_t, Allocator a) + { + typedef typename Allocator::template rebind<detail::future_object<void> >::other A2; + A2 a2(a); + typedef thread_detail::allocator_destructor<A2> D; + future_ = future_ptr(::new(a2.allocate(1)) detail::future_object<void>(), D(a2, 1) ); + future_obtained = false; + } +#endif promise(): - future(),future_obtained(false) +#if defined BOOST_THREAD_PROMISE_LAZY + future_(), +#else + future_(new detail::future_object<void>), +#endif + future_obtained(false) {} - + ~promise() { - if(future) + if(future_) { - boost::lock_guard<boost::mutex> lock(future->mutex); + boost::lock_guard<boost::mutex> lock(future_->mutex); - if(!future->done) + if(!future_->done) { - future->mark_exceptional_finish_internal(boost::copy_exception(broken_promise())); + future_->mark_exceptional_finish_internal(boost::copy_exception(broken_promise())); } } } // Assignment -#ifndef BOOST_NO_RVALUE_REFERENCES - promise(promise && rhs): - future_obtained(rhs.future_obtained) - { - future.swap(rhs.future); - rhs.future_obtained=false; - } - promise & operator=(promise&& rhs) + promise(BOOST_THREAD_RV_REF(promise) rhs) BOOST_NOEXCEPT : + future_(BOOST_THREAD_RV(rhs).future_),future_obtained(BOOST_THREAD_RV(rhs).future_obtained) { - future.swap(rhs.future); - future_obtained=rhs.future_obtained; - rhs.future.reset(); - rhs.future_obtained=false; - return *this; - } -#else - promise(boost::detail::thread_move_t<promise> rhs): - future(rhs->future),future_obtained(rhs->future_obtained) - { - rhs->future.reset(); - rhs->future_obtained=false; + // we need to release the future as shared_ptr doesn't implements move semantics + BOOST_THREAD_RV(rhs).future_.reset(); + BOOST_THREAD_RV(rhs).future_obtained=false; } - promise & operator=(boost::detail::thread_move_t<promise> rhs) + + promise & operator=(BOOST_THREAD_RV_REF(promise) rhs) BOOST_NOEXCEPT { - future=rhs->future; - future_obtained=rhs->future_obtained; - rhs->future.reset(); - rhs->future_obtained=false; + future_=BOOST_THREAD_RV(rhs).future_; + future_obtained=BOOST_THREAD_RV(rhs).future_obtained; + BOOST_THREAD_RV(rhs).future_.reset(); + BOOST_THREAD_RV(rhs).future_obtained=false; return *this; } - operator boost::detail::thread_move_t<promise>() - { - return boost::detail::thread_move_t<promise>(*this); - } -#endif - void swap(promise& other) { - future.swap(other.future); + future_.swap(other.future_); std::swap(future_obtained,other.future_obtained); } // Result retrieval - unique_future<void> get_future() + BOOST_THREAD_FUTURE<void> get_future() { lazy_init(); - + + if (future_.get()==0) + { + boost::throw_exception(promise_moved()); + } if(future_obtained) { boost::throw_exception(future_already_retrieved()); } future_obtained=true; - return unique_future<void>(future); + return BOOST_THREAD_FUTURE<void>(future_); } void set_value() { lazy_init(); - boost::lock_guard<boost::mutex> lock(future->mutex); - if(future->done) + boost::lock_guard<boost::mutex> lock(future_->mutex); + if(future_->done) { boost::throw_exception(promise_already_satisfied()); } - future->mark_finished_with_result_internal(); + future_->mark_finished_with_result_internal(); } void set_exception(boost::exception_ptr p) { lazy_init(); - boost::lock_guard<boost::mutex> lock(future->mutex); - if(future->done) + boost::lock_guard<boost::mutex> lock(future_->mutex); + if(future_->done) { boost::throw_exception(promise_already_satisfied()); } - future->mark_exceptional_finish_internal(p); + future_->mark_exceptional_finish_internal(p); } template<typename F> void set_wait_callback(F f) { lazy_init(); - future->set_wait_callback(f,this); + future_->set_wait_callback(f,this); } - + }; +#if defined BOOST_THREAD_PROVIDES_FUTURE_CTOR_ALLOCATORS + namespace container + { + template <class R, class Alloc> + struct uses_allocator<promise<R> , Alloc> : true_type + { + }; + } +#endif + + BOOST_THREAD_DCL_MOVABLE_BEG(T) promise<T> BOOST_THREAD_DCL_MOVABLE_END + namespace detail { template<typename R> @@ -1177,6 +1389,10 @@ namespace boost started(false) {} + void reset() + { + started=false; + } void run() { { @@ -1199,30 +1415,44 @@ namespace boost this->mark_exceptional_finish_internal(boost::copy_exception(boost::broken_promise())); } } - - + + virtual void do_run()=0; }; - - + + + + template<typename R,typename F> struct task_object: task_base<R> { + private: + task_object(task_object&); + public: F f; task_object(F const& f_): f(f_) {} - task_object(boost::detail::thread_move_t<F> f_): - f(f_) +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES + task_object(BOOST_THREAD_RV_REF(F) f_): + f(boost::forward<F>(f_)) + {} +#else + task_object(BOOST_THREAD_RV_REF(F) f_): + f(boost::move(f_)) {} - +#endif void do_run() { try { this->mark_finished_with_result(f()); } + catch(thread_interrupted& ) + { + this->mark_interrupted_finish(); + } catch(...) { this->mark_exceptional_finish(); @@ -1230,18 +1460,55 @@ namespace boost } }; + template<typename R> + struct task_object<R,R (*)()>: + task_base<R> + { + private: + task_object(task_object&); + public: + R (*f)(); + task_object(R (*f_)()): + f(f_) + {} + void do_run() + { + try + { + this->mark_finished_with_result(f()); + } + catch(thread_interrupted& ) + { + this->mark_interrupted_finish(); + } + catch(...) + { + this->mark_exceptional_finish(); + } + } + }; + template<typename F> struct task_object<void,F>: task_base<void> { + private: + task_object(task_object&); + public: F f; task_object(F const& f_): f(f_) {} - task_object(boost::detail::thread_move_t<F> f_): - f(f_) +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES + task_object(BOOST_THREAD_RV_REF(F) f_): + f(boost::forward<F>(f_)) {} - +#else + task_object(BOOST_THREAD_RV_REF(F) f_): + f(boost::move(f_)) + {} +#endif + void do_run() { try @@ -1249,6 +1516,39 @@ namespace boost f(); this->mark_finished_with_result(); } + catch(thread_interrupted& ) + { + this->mark_interrupted_finish(); + } + catch(...) + { + this->mark_exceptional_finish(); + } + } + }; + + template<> + struct task_object<void,void (*)()>: + task_base<void> + { + private: + task_object(task_object&); + public: + void (*f)(); + task_object(void (*f_)()): + f(f_) + {} + void do_run() + { + try + { + f(); + this->mark_finished_with_result(); + } + catch(thread_interrupted& ) + { + this->mark_interrupted_finish(); + } catch(...) { this->mark_exceptional_finish(); @@ -1257,41 +1557,92 @@ namespace boost }; } - template<typename R> class packaged_task { + typedef boost::shared_ptr<detail::task_base<R> > task_ptr; boost::shared_ptr<detail::task_base<R> > task; bool future_obtained; - packaged_task(packaged_task&);// = delete; - packaged_task& operator=(packaged_task&);// = delete; - public: + typedef R result_type; + BOOST_THREAD_MOVABLE_ONLY(packaged_task) + packaged_task(): future_obtained(false) {} - + // construction and destruction - template <class F> - explicit packaged_task(F const& f): - task(new detail::task_object<R,F>(f)),future_obtained(false) - {} + explicit packaged_task(R(*f)()): task(new detail::task_object<R,R(*)()>(f)),future_obtained(false) {} - +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES + template <class F> + explicit packaged_task(BOOST_THREAD_RV_REF(F) f): + task(new detail::task_object<R, + typename remove_cv<typename remove_reference<F>::type>::type + >(boost::forward<F>(f))),future_obtained(false) + {} +#else template <class F> - explicit packaged_task(boost::detail::thread_move_t<F> f): + explicit packaged_task(F const& f): task(new detail::task_object<R,F>(f)),future_obtained(false) {} + template <class F> + explicit packaged_task(BOOST_THREAD_RV_REF(F) f): + task(new detail::task_object<R,F>(boost::move(f))),future_obtained(false) + {} +#endif -// template <class F, class Allocator> -// explicit packaged_task(F const& f, Allocator a); -// template <class F, class Allocator> -// explicit packaged_task(F&& f, Allocator a); +#if defined BOOST_THREAD_PROVIDES_FUTURE_CTOR_ALLOCATORS + template <class Allocator> + packaged_task(boost::allocator_arg_t, Allocator a, R(*f)()) + { + typedef R(*FR)(); + typedef typename Allocator::template rebind<detail::task_object<R,FR> >::other A2; + A2 a2(a); + typedef thread_detail::allocator_destructor<A2> D; + task = task_ptr(::new(a2.allocate(1)) detail::task_object<R,FR>(f), D(a2, 1) ); + future_obtained = false; + } +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES + template <class F, class Allocator> + packaged_task(boost::allocator_arg_t, Allocator a, BOOST_THREAD_RV_REF(F) f) + { + typedef typename remove_cv<typename remove_reference<F>::type>::type FR; + typedef typename Allocator::template rebind<detail::task_object<R,FR> >::other A2; + A2 a2(a); + typedef thread_detail::allocator_destructor<A2> D; + + task = task_ptr(::new(a2.allocate(1)) detail::task_object<R,FR>(boost::forward<F>(f)), D(a2, 1) ); + future_obtained = false; + } +#else + template <class F, class Allocator> + packaged_task(boost::allocator_arg_t, Allocator a, const F& f) + { + typedef typename Allocator::template rebind<detail::task_object<R,F> >::other A2; + A2 a2(a); + typedef thread_detail::allocator_destructor<A2> D; + + task = task_ptr(::new(a2.allocate(1)) detail::task_object<R,F>(f), D(a2, 1) ); + future_obtained = false; + } + template <class F, class Allocator> + packaged_task(boost::allocator_arg_t, Allocator a, BOOST_THREAD_RV_REF(F) f) + { + typedef typename Allocator::template rebind<detail::task_object<R,F> >::other A2; + A2 a2(a); + typedef thread_detail::allocator_destructor<A2> D; + + task = task_ptr(::new(a2.allocate(1)) detail::task_object<R,F>(boost::move(f)), D(a2, 1) ); + future_obtained = false; + } +#endif //BOOST_NO_CXX11_RVALUE_REFERENCES +#endif // BOOST_THREAD_PROVIDES_FUTURE_CTOR_ALLOCATORS ~packaged_task() { @@ -1302,46 +1653,39 @@ namespace boost } // assignment -#ifndef BOOST_NO_RVALUE_REFERENCES - packaged_task(packaged_task&& other): - future_obtained(other.future_obtained) + packaged_task(BOOST_THREAD_RV_REF(packaged_task) other) BOOST_NOEXCEPT : + future_obtained(BOOST_THREAD_RV(other).future_obtained) { - task.swap(other.task); - other.future_obtained=false; + task.swap(BOOST_THREAD_RV(other).task); + BOOST_THREAD_RV(other).future_obtained=false; } - packaged_task& operator=(packaged_task&& other) + packaged_task& operator=(BOOST_THREAD_RV_REF(packaged_task) other) BOOST_NOEXCEPT { - packaged_task temp(static_cast<packaged_task&&>(other)); + packaged_task temp(static_cast<BOOST_THREAD_RV_REF(packaged_task)>(other)); swap(temp); return *this; } -#else - packaged_task(boost::detail::thread_move_t<packaged_task> other): - future_obtained(other->future_obtained) - { - task.swap(other->task); - other->future_obtained=false; - } - packaged_task& operator=(boost::detail::thread_move_t<packaged_task> other) - { - packaged_task temp(other); - swap(temp); - return *this; - } - operator boost::detail::thread_move_t<packaged_task>() + + void reset() { - return boost::detail::thread_move_t<packaged_task>(*this); + if (!valid()) + throw future_error(system::make_error_code(future_errc::no_state)); + task->reset(); + future_obtained=false; } -#endif - void swap(packaged_task& other) + void swap(packaged_task& other) BOOST_NOEXCEPT { task.swap(other.task); std::swap(future_obtained,other.future_obtained); } + bool valid() const BOOST_NOEXCEPT + { + return task.get()!=0; + } // result retrieval - unique_future<R> get_future() + BOOST_THREAD_FUTURE<R> get_future() { if(!task) { @@ -1350,14 +1694,16 @@ namespace boost else if(!future_obtained) { future_obtained=true; - return unique_future<R>(task); + return BOOST_THREAD_FUTURE<R>(task); } else { boost::throw_exception(future_already_retrieved()); } + return BOOST_THREAD_FUTURE<R>(); + } - + // execution void operator()() @@ -1374,10 +1720,149 @@ namespace boost { task->set_wait_callback(f,this); } - + }; -} +#if defined BOOST_THREAD_PROVIDES_FUTURE_CTOR_ALLOCATORS + namespace container + { + template <class R, class Alloc> + struct uses_allocator<packaged_task<R>, Alloc> + : public true_type {}; + } +#endif + + BOOST_THREAD_DCL_MOVABLE_BEG(T) packaged_task<T> BOOST_THREAD_DCL_MOVABLE_END + + + template <class R> + BOOST_THREAD_FUTURE<R> + async(launch policy, R(*f)()) + { + if (int(policy) & int(launch::async)) + { + packaged_task<R> pt( f ); + + BOOST_THREAD_FUTURE<R> ret = pt.get_future(); + boost::thread( boost::move(pt) ).detach(); + return ::boost::move(ret); + } + else if (int(policy) & int(launch::deferred)) + { + packaged_task<R> pt( f ); + BOOST_THREAD_FUTURE<R> ret = pt.get_future(); + return ::boost::move(ret); + } else { + BOOST_THREAD_FUTURE<R> ret; + return ::boost::move(ret); + } + } + + template <class R> + BOOST_THREAD_FUTURE<R> + async(R(*f)()) + { + return async(launch::any, f); + } +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES + template <class F> + BOOST_THREAD_FUTURE<typename boost::result_of<typename decay<F>::type()>::type> + async(launch policy, BOOST_THREAD_FWD_REF(F) f) + { + typedef typename boost::result_of<typename decay<F>::type()>::type R; + if (int(policy) & int(launch::async)) + { + packaged_task<R> pt( boost::forward<F>(f) ); + + BOOST_THREAD_FUTURE<R> ret = pt.get_future(); + boost::thread( boost::move(pt) ).detach(); + return ::boost::move(ret); + } + else if (int(policy) & int(launch::deferred)) + { + packaged_task<R> pt( boost::forward<F>(f) ); + + BOOST_THREAD_FUTURE<R> ret = pt.get_future(); + return ::boost::move(ret); + } else { + BOOST_THREAD_FUTURE<R> ret; + return ::boost::move(ret); + } + } + template <class F> + BOOST_THREAD_FUTURE<typename boost::result_of<F()>::type> + async(BOOST_THREAD_RV_REF(F) f) + { + return async(launch::any, boost::forward<F>(f)); + } +#else + +// template <class F> +// BOOST_THREAD_FUTURE<typename boost::result_of<typename decay<F>::type()>::type> +// async(launch policy, F const& f) +// { +// typedef typename boost::result_of<typename decay<F>::type()>::type R; +// if (int(policy) & int(launch::async)) +// { +// packaged_task<R> pt( f ); +// +// BOOST_THREAD_FUTURE<R> ret = pt.get_future(); +// boost::thread( boost::move(pt) ).detach(); +// return ::boost::move(ret); +// } +// else if (int(policy) & int(launch::deferred)) +// { +// packaged_task<R> pt( f ); +// +// BOOST_THREAD_FUTURE<R> ret = pt.get_future(); +// return ::boost::move(ret); +// } else { +// BOOST_THREAD_FUTURE<R> ret; +// return ::boost::move(ret); +// } +// } +// template <class F> +// BOOST_THREAD_FUTURE<typename boost::result_of<F()>::type> +// async(F const& f) +// { +// return async(launch::any, f); +// } + + template <class F> + BOOST_THREAD_FUTURE<typename boost::result_of<typename decay<F>::type()>::type> + async(launch policy, BOOST_THREAD_FWD_REF(F) f) + { + typedef typename boost::result_of<typename decay<F>::type()>::type R; + if (int(policy) & int(launch::async)) + { + packaged_task<R> pt( boost::forward<F>(f) ); + + BOOST_THREAD_FUTURE<R> ret = pt.get_future(); + boost::thread( boost::move(pt) ).detach(); + return ::boost::move(ret); + } + else if (int(policy) & int(launch::deferred)) + { + packaged_task<R> pt( boost::forward<F>(f) ); + + BOOST_THREAD_FUTURE<R> ret = pt.get_future(); + return ::boost::move(ret); + } else { + BOOST_THREAD_FUTURE<R> ret; + return ::boost::move(ret); + } + } + template <class F> + BOOST_THREAD_FUTURE<typename boost::result_of<F()>::type> + async(BOOST_THREAD_FWD_REF(F) f) + { + return async(launch::any, boost::forward<F>(f)); + } #endif + +} + +#endif // BOOST_NO_EXCEPTION +#endif // header diff --git a/3rdParty/Boost/src/boost/thread/locks.hpp b/3rdParty/Boost/src/boost/thread/locks.hpp index d23e619..c11c2bd 100644 --- a/3rdParty/Boost/src/boost/thread/locks.hpp +++ b/3rdParty/Boost/src/boost/thread/locks.hpp @@ -2,6 +2,8 @@ // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // (C) Copyright 2007 Anthony Williams +// (C) Copyright 2011-2012 Vicente J. Botet Escriba + #ifndef BOOST_THREAD_LOCKS_HPP #define BOOST_THREAD_LOCKS_HPP #include <boost/thread/detail/config.hpp> @@ -12,6 +14,10 @@ #include <boost/thread/thread_time.hpp> #include <boost/detail/workaround.hpp> #include <boost/type_traits/is_class.hpp> +#ifdef BOOST_THREAD_USES_CHRONO +#include <boost/chrono/time_point.hpp> +#include <boost/chrono/duration.hpp> +#endif #include <boost/config/abi_prefix.hpp> @@ -71,7 +77,7 @@ namespace boost { BOOST_STATIC_CONSTANT(bool, value=false); }; - + template<typename T> struct has_member_lock<T,true> { @@ -80,22 +86,22 @@ namespace boost { true_type dummy[2]; }; - + template<typename U,typename V> static true_type has_member(V (U::*)()); template<typename U> static false_type has_member(U); - + BOOST_STATIC_CONSTANT( bool,value=sizeof(has_member_lock<T>::has_member(&T::lock))==sizeof(true_type)); }; - + template<typename T,bool=has_member_called_unlock<T>::value > struct has_member_unlock { BOOST_STATIC_CONSTANT(bool, value=false); }; - + template<typename T> struct has_member_unlock<T,true> { @@ -104,22 +110,22 @@ namespace boost { true_type dummy[2]; }; - + template<typename U,typename V> static true_type has_member(V (U::*)()); template<typename U> static false_type has_member(U); - + BOOST_STATIC_CONSTANT( bool,value=sizeof(has_member_unlock<T>::has_member(&T::unlock))==sizeof(true_type)); }; - + template<typename T,bool=has_member_called_try_lock<T>::value > struct has_member_try_lock { BOOST_STATIC_CONSTANT(bool, value=false); }; - + template<typename T> struct has_member_try_lock<T,true> { @@ -128,18 +134,18 @@ namespace boost { true_type dummy[2]; }; - + template<typename U> static true_type has_member(bool (U::*)()); template<typename U> static false_type has_member(U); - + BOOST_STATIC_CONSTANT( bool,value=sizeof(has_member_try_lock<T>::has_member(&T::try_lock))==sizeof(true_type)); }; } - + template<typename T> struct is_mutex_type @@ -147,7 +153,7 @@ namespace boost BOOST_STATIC_CONSTANT(bool, value = detail::has_member_lock<T>::value && detail::has_member_unlock<T>::value && detail::has_member_try_lock<T>::value); - + }; #else template<typename T> @@ -155,7 +161,7 @@ namespace boost { BOOST_STATIC_CONSTANT(bool, value = false); }; -#endif +#endif struct defer_lock_t {}; @@ -163,10 +169,10 @@ namespace boost {}; struct adopt_lock_t {}; - - const defer_lock_t defer_lock={}; - const try_to_lock_t try_to_lock={}; - const adopt_lock_t adopt_lock={}; + + BOOST_CONSTEXPR_OR_CONST defer_lock_t defer_lock={}; + BOOST_CONSTEXPR_OR_CONST try_to_lock_t try_to_lock={}; + BOOST_CONSTEXPR_OR_CONST adopt_lock_t adopt_lock={}; template<typename Mutex> class shared_lock; @@ -182,7 +188,7 @@ namespace boost template<typename Mutex> class try_lock_wrapper; } - + #ifdef BOOST_THREAD_NO_AUTO_DETECT_MUTEX_TYPES template<typename T> struct is_mutex_type<unique_lock<T> > @@ -201,7 +207,7 @@ namespace boost { BOOST_STATIC_CONSTANT(bool, value = true); }; - + template<typename T> struct is_mutex_type<detail::try_lock_wrapper<T> > { @@ -213,7 +219,7 @@ namespace boost class recursive_mutex; class recursive_timed_mutex; class shared_mutex; - + template<> struct is_mutex_type<mutex> { @@ -248,9 +254,10 @@ namespace boost private: Mutex& m; - explicit lock_guard(lock_guard&); - lock_guard& operator=(lock_guard&); public: + typedef Mutex mutex_type; + BOOST_THREAD_NO_COPYABLE(lock_guard) + explicit lock_guard(Mutex& m_): m(m_) { @@ -265,25 +272,29 @@ namespace boost } }; - template<typename Mutex> class unique_lock { private: Mutex* m; bool is_locked; - unique_lock(unique_lock&); + + private: explicit unique_lock(upgrade_lock<Mutex>&); - unique_lock& operator=(unique_lock&); unique_lock& operator=(upgrade_lock<Mutex>& other); public: -#if BOOST_WORKAROUND(__SUNPRO_CC, < 0x5100) - unique_lock(const volatile unique_lock&); + typedef Mutex mutex_type; + BOOST_THREAD_MOVABLE_ONLY(unique_lock) + +#if 0 // This should not be needed anymore. Use instead BOOST_THREAD_MAKE_RV_REF. +#if BOOST_WORKAROUND(__SUNPRO_CC, < 0x5100) + unique_lock(const volatile unique_lock&); #endif - unique_lock(): +#endif + unique_lock() BOOST_NOEXCEPT : m(0),is_locked(false) {} - + explicit unique_lock(Mutex& m_): m(&m_),is_locked(false) { @@ -292,7 +303,7 @@ namespace boost unique_lock(Mutex& m_,adopt_lock_t): m(&m_),is_locked(true) {} - unique_lock(Mutex& m_,defer_lock_t): + unique_lock(Mutex& m_,defer_lock_t) BOOST_NOEXCEPT: m(&m_),is_locked(false) {} unique_lock(Mutex& m_,try_to_lock_t): @@ -311,91 +322,172 @@ namespace boost { timed_lock(target_time); } -#ifndef BOOST_NO_RVALUE_REFERENCES - unique_lock(unique_lock&& other): - m(other.m),is_locked(other.is_locked) + +#ifdef BOOST_THREAD_USES_CHRONO + template <class Clock, class Duration> + unique_lock(Mutex& mtx, const chrono::time_point<Clock, Duration>& t) + : m(&mtx), is_locked(mtx.try_lock_until(t)) { - other.is_locked=false; - other.m=0; } - explicit unique_lock(upgrade_lock<Mutex>&& other); - - unique_lock<Mutex>&& move() + template <class Rep, class Period> + unique_lock(Mutex& mtx, const chrono::duration<Rep, Period>& d) + : m(&mtx), is_locked(mtx.try_lock_for(d)) { - return static_cast<unique_lock<Mutex>&&>(*this); } +#endif + unique_lock(BOOST_THREAD_RV_REF(unique_lock) other) BOOST_NOEXCEPT: + m(BOOST_THREAD_RV(other).m),is_locked(BOOST_THREAD_RV(other).is_locked) + { + BOOST_THREAD_RV(other).is_locked=false; + BOOST_THREAD_RV(other).m=0; + } + BOOST_THREAD_EXPLICIT_LOCK_CONVERSION unique_lock(BOOST_THREAD_RV_REF_BEG upgrade_lock<Mutex> BOOST_THREAD_RV_REF_END other); - unique_lock& operator=(unique_lock&& other) +#ifndef BOOST_THREAD_PROVIDES_EXPLICIT_LOCK_CONVERSION + unique_lock& operator=(BOOST_THREAD_RV_REF_BEG upgrade_lock<Mutex> BOOST_THREAD_RV_REF_END other) BOOST_NOEXCEPT { - unique_lock temp(other.move()); + unique_lock temp(::boost::move(other)); swap(temp); return *this; } +#endif - unique_lock& operator=(upgrade_lock<Mutex>&& other) + unique_lock& operator=(BOOST_THREAD_RV_REF(unique_lock) other) BOOST_NOEXCEPT { - unique_lock temp(other.move()); + unique_lock temp(::boost::move(other)); swap(temp); return *this; } - void swap(unique_lock&& other) - { - std::swap(m,other.m); - std::swap(is_locked,other.is_locked); - } -#else - unique_lock(detail::thread_move_t<unique_lock<Mutex> > other): - m(other->m),is_locked(other->is_locked) +#if 0 // This should not be needed anymore. Use instead BOOST_THREAD_MAKE_RV_REF. +#if BOOST_WORKAROUND(__SUNPRO_CC, < 0x5100) + unique_lock& operator=(unique_lock<Mutex> other) { - other->is_locked=false; - other->m=0; + swap(other); + return *this; } - unique_lock(detail::thread_move_t<upgrade_lock<Mutex> > other); +#endif // BOOST_WORKAROUND +#endif - operator detail::thread_move_t<unique_lock<Mutex> >() + // Conversion from upgrade locking + unique_lock(BOOST_THREAD_RV_REF_BEG upgrade_lock<mutex_type> BOOST_THREAD_RV_REF_END ul, try_to_lock_t) + : m(0),is_locked(false) { - return move(); + if (BOOST_THREAD_RV(ul).owns_lock()) { + if (BOOST_THREAD_RV(ul).mutex()->try_unlock_upgrade_and_lock()) + { + m = BOOST_THREAD_RV(ul).release(); + is_locked = true; + } + } + else + { + m = BOOST_THREAD_RV(ul).release(); + } } - detail::thread_move_t<unique_lock<Mutex> > move() +#ifdef BOOST_THREAD_USES_CHRONO + template <class Clock, class Duration> + unique_lock(BOOST_THREAD_RV_REF_BEG upgrade_lock<mutex_type> BOOST_THREAD_RV_REF_END ul, + const chrono::time_point<Clock, Duration>& abs_time) + : m(0),is_locked(false) { - return detail::thread_move_t<unique_lock<Mutex> >(*this); + if (BOOST_THREAD_RV(ul).owns_lock()) { + if (BOOST_THREAD_RV(ul).mutex()->try_unlock_upgrade_and_lock_until(abs_time)) + { + m = BOOST_THREAD_RV(ul).release(); + is_locked = true; + } + } + else + { + m = BOOST_THREAD_RV(ul).release(); + } } -#if BOOST_WORKAROUND(__SUNPRO_CC, < 0x5100) - unique_lock& operator=(unique_lock<Mutex> other) - { - swap(other); - return *this; - } -#else - unique_lock& operator=(detail::thread_move_t<unique_lock<Mutex> > other) + template <class Rep, class Period> + unique_lock(BOOST_THREAD_RV_REF_BEG upgrade_lock<mutex_type> BOOST_THREAD_RV_REF_END ul, + const chrono::duration<Rep, Period>& rel_time) + : m(0),is_locked(false) { - unique_lock temp(other); - swap(temp); - return *this; + if (BOOST_THREAD_RV(ul).owns_lock()) { + if (BOOST_THREAD_RV(ul).mutex()->try_unlock_upgrade_and_lock_for(rel_time)) + { + m = BOOST_THREAD_RV(ul).release(); + is_locked = true; + } + } + else + { + m = BOOST_THREAD_RV(ul).release(); + } } #endif - unique_lock& operator=(detail::thread_move_t<upgrade_lock<Mutex> > other) +#ifdef BOOST_THREAD_PROVIDES_SHARED_MUTEX_UPWARDS_CONVERSIONS + // Conversion from shared locking + unique_lock(BOOST_THREAD_RV_REF_BEG shared_lock<mutex_type> BOOST_THREAD_RV_REF_END sl, try_to_lock_t) + : m(0),is_locked(false) { - unique_lock temp(other); - swap(temp); - return *this; + if (BOOST_THREAD_RV(sl).owns_lock()) { + if (BOOST_THREAD_RV(sl).mutex()->try_unlock_shared_and_lock()) + { + m = BOOST_THREAD_RV(sl).release(); + is_locked = true; + } + } + else + { + m = BOOST_THREAD_RV(sl).release(); + } + } + +#ifdef BOOST_THREAD_USES_CHRONO + template <class Clock, class Duration> + unique_lock(BOOST_THREAD_RV_REF_BEG shared_lock<mutex_type> BOOST_THREAD_RV_REF_END sl, + const chrono::time_point<Clock, Duration>& abs_time) + : m(0),is_locked(false) + { + if (BOOST_THREAD_RV(sl).owns_lock()) { + if (BOOST_THREAD_RV(sl).mutex()->try_unlock_shared_and_lock_until(abs_time)) + { + m = BOOST_THREAD_RV(sl).release(); + is_locked = true; + } + } + else + { + m = BOOST_THREAD_RV(sl).release(); + } } - void swap(detail::thread_move_t<unique_lock<Mutex> > other) + + template <class Rep, class Period> + unique_lock(BOOST_THREAD_RV_REF_BEG shared_lock<mutex_type> BOOST_THREAD_RV_REF_END sl, + const chrono::duration<Rep, Period>& rel_time) + : m(0),is_locked(false) { - std::swap(m,other->m); - std::swap(is_locked,other->is_locked); + if (BOOST_THREAD_RV(sl).owns_lock()) { + if (BOOST_THREAD_RV(sl).mutex()->try_unlock_shared_and_lock_for(rel_time)) + { + m = BOOST_THREAD_RV(sl).release(); + is_locked = true; + } + } + else + { + m = BOOST_THREAD_RV(sl).release(); + } } -#endif - void swap(unique_lock& other) +#endif // BOOST_THREAD_USES_CHRONO +#endif // BOOST_THREAD_PROVIDES_SHARED_MUTEX_UPWARDS_CONVERSIONS + + + void swap(unique_lock& other) BOOST_NOEXCEPT { std::swap(m,other.m); std::swap(is_locked,other.is_locked); } - + ~unique_lock() { if(owns_lock()) @@ -405,18 +497,26 @@ namespace boost } void lock() { + if(m==0) + { + boost::throw_exception(boost::lock_error(system::errc::operation_not_permitted, "boost unique_lock has no mutex")); + } if(owns_lock()) { - boost::throw_exception(boost::lock_error()); + boost::throw_exception(boost::lock_error(system::errc::resource_deadlock_would_occur, "boost unique_lock owns already the mutex")); } m->lock(); is_locked=true; } bool try_lock() { + if(m==0) + { + boost::throw_exception(boost::lock_error(system::errc::operation_not_permitted, "boost unique_lock has no mutex")); + } if(owns_lock()) { - boost::throw_exception(boost::lock_error()); + boost::throw_exception(boost::lock_error(system::errc::resource_deadlock_would_occur, "boost unique_lock owns already the mutex")); } is_locked=m->try_lock(); return is_locked; @@ -424,50 +524,118 @@ namespace boost template<typename TimeDuration> bool timed_lock(TimeDuration const& relative_time) { + if(m==0) + { + boost::throw_exception(boost::lock_error(system::errc::operation_not_permitted, "boost unique_lock has no mutex")); + } + if(owns_lock()) + { + boost::throw_exception(boost::lock_error(system::errc::resource_deadlock_would_occur, "boost unique_lock owns already the mutex")); + } is_locked=m->timed_lock(relative_time); return is_locked; } - + bool timed_lock(::boost::system_time const& absolute_time) { + if(m==0) + { + boost::throw_exception(boost::lock_error(system::errc::operation_not_permitted, "boost unique_lock has no mutex")); + } + if(owns_lock()) + { + boost::throw_exception(boost::lock_error(system::errc::resource_deadlock_would_occur, "boost unique_lock owns already the mutex")); + } is_locked=m->timed_lock(absolute_time); return is_locked; } bool timed_lock(::boost::xtime const& absolute_time) { + if(m==0) + { + boost::throw_exception(boost::lock_error(system::errc::operation_not_permitted, "boost unique_lock has no mutex")); + } + if(owns_lock()) + { + boost::throw_exception(boost::lock_error(system::errc::resource_deadlock_would_occur, "boost unique_lock owns already the mutex")); + } is_locked=m->timed_lock(absolute_time); return is_locked; } + +#ifdef BOOST_THREAD_USES_CHRONO + + template <class Rep, class Period> + bool try_lock_for(const chrono::duration<Rep, Period>& rel_time) + { + if(m==0) + { + boost::throw_exception(boost::lock_error(system::errc::operation_not_permitted, "boost unique_lock has no mutex")); + } + if(owns_lock()) + { + boost::throw_exception(boost::lock_error(system::errc::resource_deadlock_would_occur, "boost unique_lock owns already the mutex")); + } + is_locked=m->try_lock_for(rel_time); + return is_locked; + } + template <class Clock, class Duration> + bool try_lock_until(const chrono::time_point<Clock, Duration>& abs_time) + { + if(m==0) + { + boost::throw_exception(boost::lock_error(system::errc::operation_not_permitted, "boost unique_lock has no mutex")); + } + if(owns_lock()) + { + boost::throw_exception(boost::lock_error(system::errc::resource_deadlock_would_occur, "boost unique_lock owns already the mutex")); + } + is_locked=m->try_lock_until(abs_time); + return is_locked; + } +#endif + void unlock() { + if(m==0) + { + boost::throw_exception(boost::lock_error(system::errc::operation_not_permitted, "boost unique_lock has no mutex")); + } if(!owns_lock()) { - boost::throw_exception(boost::lock_error()); + boost::throw_exception(boost::lock_error(system::errc::operation_not_permitted, "boost unique_lock doesn't own the mutex")); } m->unlock(); is_locked=false; } - + +#if defined(BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS) typedef void (unique_lock::*bool_type)(); - operator bool_type() const + operator bool_type() const BOOST_NOEXCEPT { return is_locked?&unique_lock::lock:0; } - bool operator!() const + bool operator!() const BOOST_NOEXCEPT { return !owns_lock(); } - bool owns_lock() const +#else + explicit operator bool() const BOOST_NOEXCEPT + { + return owns_lock(); + } +#endif + bool owns_lock() const BOOST_NOEXCEPT { return is_locked; } - Mutex* mutex() const + Mutex* mutex() const BOOST_NOEXCEPT { return m; } - Mutex* release() + Mutex* release() BOOST_NOEXCEPT { Mutex* const res=m; m=0; @@ -479,44 +647,13 @@ namespace boost friend class upgrade_lock<Mutex>; }; -#ifndef BOOST_NO_RVALUE_REFERENCES - template<typename Mutex> - void swap(unique_lock<Mutex>&& lhs,unique_lock<Mutex>&& rhs) - { - lhs.swap(rhs); - } - - template<typename Mutex> - inline upgrade_lock<Mutex>&& move(upgrade_lock<Mutex>&& ul) - { - return static_cast<upgrade_lock<Mutex>&&>(ul); - } - - template<typename Mutex> - inline upgrade_lock<Mutex>&& move(upgrade_lock<Mutex>& ul) - { - return static_cast<upgrade_lock<Mutex>&&>(ul); - } -#endif template<typename Mutex> - void swap(unique_lock<Mutex>& lhs,unique_lock<Mutex>& rhs) + void swap(unique_lock<Mutex>& lhs,unique_lock<Mutex>& rhs) BOOST_NOEXCEPT { lhs.swap(rhs); } -#ifndef BOOST_NO_RVALUE_REFERENCES - template<typename Mutex> - inline unique_lock<Mutex>&& move(unique_lock<Mutex>&& ul) - { - return static_cast<unique_lock<Mutex>&&>(ul); - } - - template<typename Mutex> - inline unique_lock<Mutex>&& move(unique_lock<Mutex>& ul) - { - return static_cast<unique_lock<Mutex>&&>(ul); - } -#endif + BOOST_THREAD_DCL_MOVABLE_BEG(Mutex) unique_lock<Mutex> BOOST_THREAD_DCL_MOVABLE_END template<typename Mutex> class shared_lock @@ -524,14 +661,15 @@ namespace boost protected: Mutex* m; bool is_locked; - private: - explicit shared_lock(shared_lock&); - shared_lock& operator=(shared_lock&); + public: - shared_lock(): + typedef Mutex mutex_type; + BOOST_THREAD_MOVABLE_ONLY(shared_lock) + + shared_lock() BOOST_NOEXCEPT: m(0),is_locked(false) {} - + explicit shared_lock(Mutex& m_): m(&m_),is_locked(false) { @@ -540,7 +678,7 @@ namespace boost shared_lock(Mutex& m_,adopt_lock_t): m(&m_),is_locked(true) {} - shared_lock(Mutex& m_,defer_lock_t): + shared_lock(Mutex& m_,defer_lock_t) BOOST_NOEXCEPT: m(&m_),is_locked(false) {} shared_lock(Mutex& m_,try_to_lock_t): @@ -554,91 +692,90 @@ namespace boost timed_lock(target_time); } - shared_lock(detail::thread_move_t<shared_lock<Mutex> > other): - m(other->m),is_locked(other->is_locked) +#ifdef BOOST_THREAD_USES_CHRONO + template <class Clock, class Duration> + shared_lock(Mutex& mtx, const chrono::time_point<Clock, Duration>& t) + : m(&mtx), is_locked(mtx.try_lock_shared_until(t)) + { + } + template <class Rep, class Period> + shared_lock(Mutex& mtx, const chrono::duration<Rep, Period>& d) + : m(&mtx), is_locked(mtx.try_lock_shared_for(d)) + { + } +#endif + + shared_lock(BOOST_THREAD_RV_REF_BEG shared_lock<Mutex> BOOST_THREAD_RV_REF_END other) BOOST_NOEXCEPT: + m(BOOST_THREAD_RV(other).m),is_locked(BOOST_THREAD_RV(other).is_locked) { - other->is_locked=false; - other->m=0; + BOOST_THREAD_RV(other).is_locked=false; + BOOST_THREAD_RV(other).m=0; } - shared_lock(detail::thread_move_t<unique_lock<Mutex> > other): - m(other->m),is_locked(other->is_locked) + BOOST_THREAD_EXPLICIT_LOCK_CONVERSION shared_lock(BOOST_THREAD_RV_REF_BEG unique_lock<Mutex> BOOST_THREAD_RV_REF_END other): + m(BOOST_THREAD_RV(other).m),is_locked(BOOST_THREAD_RV(other).is_locked) { if(is_locked) { m->unlock_and_lock_shared(); } - other->is_locked=false; - other->m=0; + BOOST_THREAD_RV(other).is_locked=false; + BOOST_THREAD_RV(other).m=0; } - shared_lock(detail::thread_move_t<upgrade_lock<Mutex> > other): - m(other->m),is_locked(other->is_locked) + BOOST_THREAD_EXPLICIT_LOCK_CONVERSION shared_lock(BOOST_THREAD_RV_REF_BEG upgrade_lock<Mutex> BOOST_THREAD_RV_REF_END other): + m(BOOST_THREAD_RV(other).m),is_locked(BOOST_THREAD_RV(other).is_locked) { if(is_locked) { m->unlock_upgrade_and_lock_shared(); } - other->is_locked=false; - other->m=0; + BOOST_THREAD_RV(other).is_locked=false; + BOOST_THREAD_RV(other).m=0; } - operator detail::thread_move_t<shared_lock<Mutex> >() - { - return move(); - } - detail::thread_move_t<shared_lock<Mutex> > move() + shared_lock& operator=(BOOST_THREAD_RV_REF_BEG shared_lock<Mutex> BOOST_THREAD_RV_REF_END other) BOOST_NOEXCEPT { - return detail::thread_move_t<shared_lock<Mutex> >(*this); - } - - - shared_lock& operator=(detail::thread_move_t<shared_lock<Mutex> > other) - { - shared_lock temp(other); + shared_lock temp(::boost::move(other)); swap(temp); return *this; } - - shared_lock& operator=(detail::thread_move_t<unique_lock<Mutex> > other) +#ifndef BOOST_THREAD_PROVIDES_EXPLICIT_LOCK_CONVERSION + shared_lock& operator=(BOOST_THREAD_RV_REF_BEG unique_lock<Mutex> BOOST_THREAD_RV_REF_END other) { - shared_lock temp(other); + shared_lock temp(::boost::move(other)); swap(temp); return *this; } - shared_lock& operator=(detail::thread_move_t<upgrade_lock<Mutex> > other) + shared_lock& operator=(BOOST_THREAD_RV_REF_BEG upgrade_lock<Mutex> BOOST_THREAD_RV_REF_END other) { - shared_lock temp(other); + shared_lock temp(::boost::move(other)); swap(temp); return *this; } +#endif -#ifndef BOOST_NO_RVALUE_REFERENCES - void swap(shared_lock&& other) + void swap(shared_lock& other) BOOST_NOEXCEPT { std::swap(m,other.m); std::swap(is_locked,other.is_locked); } -#else - void swap(boost::detail::thread_move_t<shared_lock<Mutex> > other) - { - std::swap(m,other->m); - std::swap(is_locked,other->is_locked); - } -#endif - void swap(shared_lock& other) + + Mutex* mutex() const BOOST_NOEXCEPT { - std::swap(m,other.m); - std::swap(is_locked,other.is_locked); + return m; } - Mutex* mutex() const + Mutex* release() BOOST_NOEXCEPT { - return m; + Mutex* const res=m; + m=0; + is_locked=false; + return res; } - + ~shared_lock() { if(owns_lock()) @@ -648,27 +785,39 @@ namespace boost } void lock() { + if(m==0) + { + boost::throw_exception(boost::lock_error(system::errc::operation_not_permitted, "boost shared_lock has no mutex")); + } if(owns_lock()) { - boost::throw_exception(boost::lock_error()); + boost::throw_exception(boost::lock_error(system::errc::resource_deadlock_would_occur, "boost shared_lock owns already the mutex")); } m->lock_shared(); is_locked=true; } bool try_lock() { + if(m==0) + { + boost::throw_exception(boost::lock_error(system::errc::operation_not_permitted, "boost shared_lock has no mutex")); + } if(owns_lock()) { - boost::throw_exception(boost::lock_error()); + boost::throw_exception(boost::lock_error(system::errc::resource_deadlock_would_occur, "boost shared_lock owns already the mutex")); } is_locked=m->try_lock_shared(); return is_locked; } bool timed_lock(boost::system_time const& target_time) { + if(m==0) + { + boost::throw_exception(boost::lock_error(system::errc::operation_not_permitted, "boost shared_lock has no mutex")); + } if(owns_lock()) { - boost::throw_exception(boost::lock_error()); + boost::throw_exception(boost::lock_error(system::errc::resource_deadlock_would_occur, "boost shared_lock owns already the mutex")); } is_locked=m->timed_lock_shared(target_time); return is_locked; @@ -676,52 +825,91 @@ namespace boost template<typename Duration> bool timed_lock(Duration const& target_time) { + if(m==0) + { + boost::throw_exception(boost::lock_error(system::errc::operation_not_permitted, "boost shared_lock has no mutex")); + } if(owns_lock()) { - boost::throw_exception(boost::lock_error()); + boost::throw_exception(boost::lock_error(system::errc::resource_deadlock_would_occur, "boost shared_lock owns already the mutex")); } is_locked=m->timed_lock_shared(target_time); return is_locked; } +#ifdef BOOST_THREAD_USES_CHRONO + template <class Rep, class Period> + bool try_lock_for(const chrono::duration<Rep, Period>& rel_time) + { + if(m==0) + { + boost::throw_exception(boost::lock_error(system::errc::operation_not_permitted, "boost shared_lock has no mutex")); + } + if(owns_lock()) + { + boost::throw_exception(boost::lock_error(system::errc::resource_deadlock_would_occur, "boost shared_lock owns already the mutex")); + } + is_locked=m->try_lock_shared_for(rel_time); + return is_locked; + } + template <class Clock, class Duration> + bool try_lock_until(const chrono::time_point<Clock, Duration>& abs_time) + { + if(m==0) + { + boost::throw_exception(boost::lock_error(system::errc::operation_not_permitted, "boost shared_lock has no mutex")); + } + if(owns_lock()) + { + boost::throw_exception(boost::lock_error(system::errc::resource_deadlock_would_occur, "boost shared_lock owns already the mutex")); + } + is_locked=m->try_lock_shared_until(abs_time); + return is_locked; + } +#endif void unlock() { + if(m==0) + { + boost::throw_exception(boost::lock_error(system::errc::operation_not_permitted, "boost shared_lock has no mutex")); + } if(!owns_lock()) { - boost::throw_exception(boost::lock_error()); + boost::throw_exception(boost::lock_error(system::errc::operation_not_permitted, "boost shared_lock doesn't own the mutex")); } m->unlock_shared(); is_locked=false; } - + +#if defined(BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS) typedef void (shared_lock<Mutex>::*bool_type)(); - operator bool_type() const + operator bool_type() const BOOST_NOEXCEPT { return is_locked?&shared_lock::lock:0; } - bool operator!() const + bool operator!() const BOOST_NOEXCEPT { return !owns_lock(); } - bool owns_lock() const +#else + explicit operator bool() const BOOST_NOEXCEPT + { + return owns_lock(); + } +#endif + bool owns_lock() const BOOST_NOEXCEPT { return is_locked; } }; -#ifndef BOOST_NO_RVALUE_REFERENCES - template<typename Mutex> - void swap(shared_lock<Mutex>&& lhs,shared_lock<Mutex>&& rhs) - { - lhs.swap(rhs); - } -#else + BOOST_THREAD_DCL_MOVABLE_BEG(Mutex) shared_lock<Mutex> BOOST_THREAD_DCL_MOVABLE_END + template<typename Mutex> - void swap(shared_lock<Mutex>& lhs,shared_lock<Mutex>& rhs) + void swap(shared_lock<Mutex>& lhs,shared_lock<Mutex>& rhs) BOOST_NOEXCEPT { lhs.swap(rhs); } -#endif template<typename Mutex> class upgrade_lock @@ -729,14 +917,15 @@ namespace boost protected: Mutex* m; bool is_locked; - private: - explicit upgrade_lock(upgrade_lock&); - upgrade_lock& operator=(upgrade_lock&); + public: - upgrade_lock(): + typedef Mutex mutex_type; + BOOST_THREAD_MOVABLE_ONLY(upgrade_lock) + + upgrade_lock() BOOST_NOEXCEPT: m(0),is_locked(false) {} - + explicit upgrade_lock(Mutex& m_): m(&m_),is_locked(false) { @@ -745,7 +934,7 @@ namespace boost upgrade_lock(Mutex& m_,adopt_lock_t): m(&m_),is_locked(true) {} - upgrade_lock(Mutex& m_,defer_lock_t): + upgrade_lock(Mutex& m_,defer_lock_t) BOOST_NOEXCEPT: m(&m_),is_locked(false) {} upgrade_lock(Mutex& m_,try_to_lock_t): @@ -753,89 +942,128 @@ namespace boost { try_lock(); } -#ifdef BOOST_HAS_RVALUE_REFS - upgrade_lock(upgrade_lock<Mutex>&& other): - m(other.m),is_locked(other.is_locked) + +#ifdef BOOST_THREAD_USES_CHRONO + template <class Clock, class Duration> + upgrade_lock(Mutex& mtx, const chrono::time_point<Clock, Duration>& t) + : m(&mtx), is_locked(mtx.try_lock_upgrade_until(t)) + { + } + template <class Rep, class Period> + upgrade_lock(Mutex& mtx, const chrono::duration<Rep, Period>& d) + : m(&mtx), is_locked(mtx.try_lock_upgrade_for(d)) + { + } +#endif + + upgrade_lock(BOOST_THREAD_RV_REF_BEG upgrade_lock<Mutex> BOOST_THREAD_RV_REF_END other) BOOST_NOEXCEPT: + m(BOOST_THREAD_RV(other).m),is_locked(BOOST_THREAD_RV(other).is_locked) { - other.is_locked=false; - other.m=0; + BOOST_THREAD_RV(other).is_locked=false; + BOOST_THREAD_RV(other).m=0; } - upgrade_lock(unique_lock<Mutex>&& other): - m(other.m),is_locked(other.is_locked) + BOOST_THREAD_EXPLICIT_LOCK_CONVERSION upgrade_lock(BOOST_THREAD_RV_REF_BEG unique_lock<Mutex> BOOST_THREAD_RV_REF_END other): + m(BOOST_THREAD_RV(other).m),is_locked(BOOST_THREAD_RV(other).is_locked) { if(is_locked) { m->unlock_and_lock_upgrade(); } - other.is_locked=false; - other.m=0; + BOOST_THREAD_RV(other).is_locked=false; + BOOST_THREAD_RV(other).m=0; } - upgrade_lock& operator=(upgrade_lock<Mutex>&& other) + upgrade_lock& operator=(BOOST_THREAD_RV_REF_BEG upgrade_lock<Mutex> BOOST_THREAD_RV_REF_END other) BOOST_NOEXCEPT { - upgrade_lock temp(static_cast<upgrade_lock<Mutex>&&>(other)); + upgrade_lock temp(::boost::move(other)); swap(temp); return *this; } - upgrade_lock& operator=(unique_lock<Mutex>&& other) +#ifndef BOOST_THREAD_PROVIDES_EXPLICIT_LOCK_CONVERSION + upgrade_lock& operator=(BOOST_THREAD_RV_REF_BEG unique_lock<Mutex> BOOST_THREAD_RV_REF_END other) { - upgrade_lock temp(static_cast<unique_lock<Mutex>&&>(other)); + upgrade_lock temp(::boost::move(other)); swap(temp); return *this; } -#else - upgrade_lock(detail::thread_move_t<upgrade_lock<Mutex> > other): - m(other->m),is_locked(other->is_locked) - { - other->is_locked=false; - other->m=0; - } +#endif - upgrade_lock(detail::thread_move_t<unique_lock<Mutex> > other): - m(other->m),is_locked(other->is_locked) +#ifdef BOOST_THREAD_PROVIDES_SHARED_MUTEX_UPWARDS_CONVERSIONS + // Conversion from shared locking + upgrade_lock(BOOST_THREAD_RV_REF_BEG shared_lock<mutex_type> BOOST_THREAD_RV_REF_END sl, try_to_lock_t) + : m(0),is_locked(false) { - if(is_locked) + if (BOOST_THREAD_RV(sl).owns_lock()) { + if (BOOST_THREAD_RV(sl).mutex()->try_unlock_shared_and_lock_upgrade()) { - m->unlock_and_lock_upgrade(); + m = BOOST_THREAD_RV(sl).release(); + is_locked = true; } - other->is_locked=false; - other->m=0; + } + else + { + m = BOOST_THREAD_RV(sl).release(); + } } - operator detail::thread_move_t<upgrade_lock<Mutex> >() +#ifdef BOOST_THREAD_USES_CHRONO + template <class Clock, class Duration> + upgrade_lock(BOOST_THREAD_RV_REF_BEG shared_lock<mutex_type> BOOST_THREAD_RV_REF_END sl, + const chrono::time_point<Clock, Duration>& abs_time) + : m(0),is_locked(false) { - return move(); + if (BOOST_THREAD_RV(sl).owns_lock()) { + if (BOOST_THREAD_RV(sl).mutex()->try_unlock_shared_and_lock_upgrade_until(abs_time)) + { + m = BOOST_THREAD_RV(sl).release(); + is_locked = true; + } + } + else + { + m = BOOST_THREAD_RV(sl).release(); + } } - detail::thread_move_t<upgrade_lock<Mutex> > move() + template <class Rep, class Period> + upgrade_lock(BOOST_THREAD_RV_REF_BEG shared_lock<mutex_type> BOOST_THREAD_RV_REF_END sl, + const chrono::duration<Rep, Period>& rel_time) + : m(0),is_locked(false) { - return detail::thread_move_t<upgrade_lock<Mutex> >(*this); + if (BOOST_THREAD_RV(sl).owns_lock()) { + if (BOOST_THREAD_RV(sl).mutex()->try_unlock_shared_and_lock_upgrade_for(rel_time)) + { + m = BOOST_THREAD_RV(sl).release(); + is_locked = true; + } + } + else + { + m = BOOST_THREAD_RV(sl).release(); + } } +#endif // BOOST_THREAD_USES_CHRONO +#endif // BOOST_THREAD_PROVIDES_SHARED_MUTEX_UPWARDS_CONVERSIONS - - upgrade_lock& operator=(detail::thread_move_t<upgrade_lock<Mutex> > other) + void swap(upgrade_lock& other) BOOST_NOEXCEPT { - upgrade_lock temp(other); - swap(temp); - return *this; + std::swap(m,other.m); + std::swap(is_locked,other.is_locked); } - - upgrade_lock& operator=(detail::thread_move_t<unique_lock<Mutex> > other) + Mutex* mutex() const BOOST_NOEXCEPT { - upgrade_lock temp(other); - swap(temp); - return *this; + return m; } -#endif - void swap(upgrade_lock& other) + Mutex* release() BOOST_NOEXCEPT { - std::swap(m,other.m); - std::swap(is_locked,other.is_locked); + Mutex* const res=m; + m=0; + is_locked=false; + return res; } - ~upgrade_lock() { if(owns_lock()) @@ -845,42 +1073,90 @@ namespace boost } void lock() { + if(m==0) + { + boost::throw_exception(boost::lock_error(system::errc::operation_not_permitted, "boost shared_lock has no mutex")); + } if(owns_lock()) { - boost::throw_exception(boost::lock_error()); + boost::throw_exception(boost::lock_error(system::errc::resource_deadlock_would_occur, "boost upgrade_lock owns already the mutex")); } m->lock_upgrade(); is_locked=true; } bool try_lock() { + if(m==0) + { + boost::throw_exception(boost::lock_error(system::errc::operation_not_permitted, "boost shared_lock has no mutex")); + } if(owns_lock()) { - boost::throw_exception(boost::lock_error()); + boost::throw_exception(boost::lock_error(system::errc::resource_deadlock_would_occur, "boost upgrade_lock owns already the mutex")); } is_locked=m->try_lock_upgrade(); return is_locked; } void unlock() { + if(m==0) + { + boost::throw_exception(boost::lock_error(system::errc::operation_not_permitted, "boost shared_lock has no mutex")); + } if(!owns_lock()) { - boost::throw_exception(boost::lock_error()); + boost::throw_exception(boost::lock_error(system::errc::operation_not_permitted, "boost upgrade_lock doesn't own the mutex")); } m->unlock_upgrade(); is_locked=false; } - +#ifdef BOOST_THREAD_USES_CHRONO + template <class Rep, class Period> + bool try_lock_for(const chrono::duration<Rep, Period>& rel_time) + { + if(m==0) + { + boost::throw_exception(boost::lock_error(system::errc::operation_not_permitted, "boost shared_lock has no mutex")); + } + if(owns_lock()) + { + boost::throw_exception(boost::lock_error(system::errc::resource_deadlock_would_occur, "boost shared_lock owns already the mutex")); + } + is_locked=m->try_lock_upgrade_for(rel_time); + return is_locked; + } + template <class Clock, class Duration> + bool try_lock_until(const chrono::time_point<Clock, Duration>& abs_time) + { + if(m==0) + { + boost::throw_exception(boost::lock_error(system::errc::operation_not_permitted, "boost shared_lock has no mutex")); + } + if(owns_lock()) + { + boost::throw_exception(boost::lock_error(system::errc::resource_deadlock_would_occur, "boost shared_lock owns already the mutex")); + } + is_locked=m->try_lock_upgrade_until(abs_time); + return is_locked; + } +#endif +#if defined(BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS) typedef void (upgrade_lock::*bool_type)(); - operator bool_type() const + operator bool_type() const BOOST_NOEXCEPT { return is_locked?&upgrade_lock::lock:0; } - bool operator!() const + bool operator!() const BOOST_NOEXCEPT { return !owns_lock(); } - bool owns_lock() const +#else + explicit operator bool() const BOOST_NOEXCEPT + { + return owns_lock(); + } +#endif + bool owns_lock() const BOOST_NOEXCEPT { return is_locked; } @@ -888,30 +1164,25 @@ namespace boost friend class unique_lock<Mutex>; }; - -#ifndef BOOST_NO_RVALUE_REFERENCES template<typename Mutex> - unique_lock<Mutex>::unique_lock(upgrade_lock<Mutex>&& other): - m(other.m),is_locked(other.is_locked) + void swap(upgrade_lock<Mutex>& lhs,upgrade_lock<Mutex>& rhs) BOOST_NOEXCEPT { - other.is_locked=false; - if(is_locked) - { - m->unlock_upgrade_and_lock(); - } + lhs.swap(rhs); } -#else + + BOOST_THREAD_DCL_MOVABLE_BEG(Mutex) upgrade_lock<Mutex> BOOST_THREAD_DCL_MOVABLE_END + template<typename Mutex> - unique_lock<Mutex>::unique_lock(detail::thread_move_t<upgrade_lock<Mutex> > other): - m(other->m),is_locked(other->is_locked) + unique_lock<Mutex>::unique_lock(BOOST_THREAD_RV_REF_BEG upgrade_lock<Mutex> BOOST_THREAD_RV_REF_END other): + m(BOOST_THREAD_RV(other).m),is_locked(BOOST_THREAD_RV(other).is_locked) { - other->is_locked=false; if(is_locked) { m->unlock_upgrade_and_lock(); } + BOOST_THREAD_RV(other).release(); } -#endif + template <class Mutex> class upgrade_to_unique_lock { @@ -919,67 +1190,65 @@ namespace boost upgrade_lock<Mutex>* source; unique_lock<Mutex> exclusive; - explicit upgrade_to_unique_lock(upgrade_to_unique_lock&); - upgrade_to_unique_lock& operator=(upgrade_to_unique_lock&); public: + typedef Mutex mutex_type; + BOOST_THREAD_MOVABLE_ONLY(upgrade_to_unique_lock) + explicit upgrade_to_unique_lock(upgrade_lock<Mutex>& m_): - source(&m_),exclusive(move(*source)) + source(&m_),exclusive(::boost::move(*source)) {} ~upgrade_to_unique_lock() { if(source) { - *source=move(exclusive); + *source=BOOST_THREAD_MAKE_RV_REF(upgrade_lock<Mutex>(::boost::move(exclusive))); } } -#ifdef BOOST_HAS_RVALUE_REFS - upgrade_to_unique_lock(upgrade_to_unique_lock<Mutex>&& other): - source(other.source),exclusive(move(other.exclusive)) - { - other.source=0; - } - - upgrade_to_unique_lock& operator=(upgrade_to_unique_lock<Mutex>&& other) - { - upgrade_to_unique_lock temp(other); - swap(temp); - return *this; - } -#else - upgrade_to_unique_lock(detail::thread_move_t<upgrade_to_unique_lock<Mutex> > other): - source(other->source),exclusive(move(other->exclusive)) + upgrade_to_unique_lock(BOOST_THREAD_RV_REF_BEG upgrade_to_unique_lock<Mutex> BOOST_THREAD_RV_REF_END other) BOOST_NOEXCEPT: + source(BOOST_THREAD_RV(other).source),exclusive(::boost::move(BOOST_THREAD_RV(other).exclusive)) { - other->source=0; + BOOST_THREAD_RV(other).source=0; } - - upgrade_to_unique_lock& operator=(detail::thread_move_t<upgrade_to_unique_lock<Mutex> > other) + + upgrade_to_unique_lock& operator=(BOOST_THREAD_RV_REF_BEG upgrade_to_unique_lock<Mutex> BOOST_THREAD_RV_REF_END other) BOOST_NOEXCEPT { upgrade_to_unique_lock temp(other); swap(temp); return *this; } -#endif - void swap(upgrade_to_unique_lock& other) + + void swap(upgrade_to_unique_lock& other) BOOST_NOEXCEPT { std::swap(source,other.source); exclusive.swap(other.exclusive); } + +#if defined(BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS) typedef void (upgrade_to_unique_lock::*bool_type)(upgrade_to_unique_lock&); - operator bool_type() const + operator bool_type() const BOOST_NOEXCEPT { return exclusive.owns_lock()?&upgrade_to_unique_lock::swap:0; } - bool operator!() const + bool operator!() const BOOST_NOEXCEPT { return !owns_lock(); } - bool owns_lock() const +#else + explicit operator bool() const BOOST_NOEXCEPT + { + return owns_lock(); + } +#endif + + bool owns_lock() const BOOST_NOEXCEPT { return exclusive.owns_lock(); } }; + BOOST_THREAD_DCL_MOVABLE_BEG(Mutex) upgrade_to_unique_lock<Mutex> BOOST_THREAD_DCL_MOVABLE_END + namespace detail { template<typename Mutex> @@ -988,9 +1257,11 @@ namespace boost { typedef unique_lock<Mutex> base; public: + BOOST_THREAD_MOVABLE_ONLY(try_lock_wrapper) + try_lock_wrapper() {} - + explicit try_lock_wrapper(Mutex& m): base(m,try_to_lock) {} @@ -1004,54 +1275,27 @@ namespace boost try_lock_wrapper(Mutex& m_,try_to_lock_t): base(m_,try_to_lock) {} -#ifndef BOOST_NO_RVALUE_REFERENCES - try_lock_wrapper(try_lock_wrapper&& other): - base(other.move()) +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES + try_lock_wrapper(BOOST_THREAD_RV_REF(try_lock_wrapper) other): + base(::boost::move(other)) {} - try_lock_wrapper&& move() - { - return static_cast<try_lock_wrapper&&>(*this); - } - - try_lock_wrapper& operator=(try_lock_wrapper<Mutex>&& other) - { - try_lock_wrapper temp(other.move()); - swap(temp); - return *this; - } +#elif defined BOOST_THREAD_USES_MOVE + try_lock_wrapper(BOOST_THREAD_RV_REF(try_lock_wrapper) other): + base(::boost::move(static_cast<base&>(other))) + {} - void swap(try_lock_wrapper&& other) - { - base::swap(other); - } #else - try_lock_wrapper(detail::thread_move_t<try_lock_wrapper<Mutex> > other): - base(detail::thread_move_t<base>(*other)) + try_lock_wrapper(BOOST_THREAD_RV_REF(try_lock_wrapper) other): + base(BOOST_THREAD_RV_REF(base)(*other)) {} - - operator detail::thread_move_t<try_lock_wrapper<Mutex> >() - { - return move(); - } - - detail::thread_move_t<try_lock_wrapper<Mutex> > move() - { - return detail::thread_move_t<try_lock_wrapper<Mutex> >(*this); - } - - try_lock_wrapper& operator=(detail::thread_move_t<try_lock_wrapper<Mutex> > other) +#endif + try_lock_wrapper& operator=(BOOST_THREAD_RV_REF_BEG try_lock_wrapper<Mutex> BOOST_THREAD_RV_REF_END other) { try_lock_wrapper temp(other); swap(temp); return *this; } - - void swap(detail::thread_move_t<try_lock_wrapper<Mutex> > other) - { - base::swap(*other); - } -#endif void swap(try_lock_wrapper& other) { base::swap(other); @@ -1080,32 +1324,31 @@ namespace boost { return base::release(); } - bool operator!() const - { - return !this->owns_lock(); - } +#if defined(BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS) typedef typename base::bool_type bool_type; operator bool_type() const { return base::operator bool_type(); } + bool operator!() const + { + return !this->owns_lock(); + } +#else + explicit operator bool() const + { + return owns_lock(); + } +#endif }; -#ifndef BOOST_NO_RVALUE_REFERENCES - template<typename Mutex> - void swap(try_lock_wrapper<Mutex>&& lhs,try_lock_wrapper<Mutex>&& rhs) - { - lhs.swap(rhs); - } -#else template<typename Mutex> void swap(try_lock_wrapper<Mutex>& lhs,try_lock_wrapper<Mutex>& rhs) { lhs.swap(rhs); } -#endif - + template<typename MutexType1,typename MutexType2> unsigned try_lock_internal(MutexType1& m1,MutexType2& m2) { @@ -1234,7 +1477,7 @@ namespace boost template<bool x> struct is_mutex_type_wrapper {}; - + template<typename MutexType1,typename MutexType2> void lock_impl(MutexType1& m1,MutexType2& m2,is_mutex_type_wrapper<true>) { @@ -1262,7 +1505,7 @@ namespace boost template<typename Iterator> void lock_impl(Iterator begin,Iterator end,is_mutex_type_wrapper<false>); } - + template<typename MutexType1,typename MutexType2> void lock(MutexType1& m1,MutexType2& m2) @@ -1407,7 +1650,7 @@ namespace boost { typedef int type; }; - + template<typename Iterator> struct try_lock_impl_return<Iterator,false> { @@ -1423,7 +1666,7 @@ namespace boost template<typename Iterator> Iterator try_lock_impl(Iterator begin,Iterator end,is_mutex_type_wrapper<false>); } - + template<typename MutexType1,typename MutexType2> typename detail::try_lock_impl_return<MutexType1>::type try_lock(MutexType1& m1,MutexType2& m2) { @@ -1465,7 +1708,7 @@ namespace boost { return ((int)detail::try_lock_internal(m1,m2,m3,m4,m5))-1; } - + namespace detail { @@ -1474,13 +1717,13 @@ namespace boost { Iterator begin; Iterator end; - + range_lock_guard(Iterator begin_,Iterator end_): begin(begin_),end(end_) { - lock(begin,end); + boost::lock(begin,end); } - + void release() { begin=end; @@ -1505,21 +1748,21 @@ namespace boost } typedef typename std::iterator_traits<Iterator>::value_type lock_type; unique_lock<lock_type> guard(*begin,try_to_lock); - + if(!guard.owns_lock()) { return begin; } - Iterator const failed=try_lock(++begin,end); + Iterator const failed=boost::try_lock(++begin,end); if(failed==end) { guard.release(); } - + return failed; } } - + namespace detail { @@ -1527,7 +1770,7 @@ namespace boost void lock_impl(Iterator begin,Iterator end,is_mutex_type_wrapper<false>) { typedef typename std::iterator_traits<Iterator>::value_type lock_type; - + if(begin==end) { return; @@ -1536,14 +1779,14 @@ namespace boost Iterator second=begin; ++second; Iterator next=second; - + for(;;) { unique_lock<lock_type> begin_lock(*begin,defer_lock); if(start_with_begin) { begin_lock.lock(); - Iterator const failed_lock=try_lock(next,end); + Iterator const failed_lock=boost::try_lock(next,end); if(failed_lock==end) { begin_lock.release(); @@ -1557,7 +1800,7 @@ namespace boost detail::range_lock_guard<Iterator> guard(next,end); if(begin_lock.try_lock()) { - Iterator const failed_lock=try_lock(second,next); + Iterator const failed_lock=boost::try_lock(second,next); if(failed_lock==next) { begin_lock.release(); @@ -1575,11 +1818,10 @@ namespace boost } } } - + } - -} +} #include <boost/config/abi_suffix.hpp> #endif diff --git a/3rdParty/Boost/src/boost/thread/once.hpp b/3rdParty/Boost/src/boost/thread/once.hpp index 975304e..acd216e 100644 --- a/3rdParty/Boost/src/boost/thread/once.hpp +++ b/3rdParty/Boost/src/boost/thread/once.hpp @@ -3,7 +3,7 @@ // once.hpp // -// (C) Copyright 2006-7 Anthony Williams +// (C) Copyright 2006-7 Anthony Williams // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at @@ -22,6 +22,8 @@ namespace boost { + // template<class Callable, class ...Args> void + // call_once(once_flag& flag, Callable&& func, Args&&... args); inline void call_once(void (*func)(),once_flag& flag) { call_once(flag,func); diff --git a/3rdParty/Boost/src/boost/thread/pthread/condition_variable.hpp b/3rdParty/Boost/src/boost/thread/pthread/condition_variable.hpp index 9c5bee2..aa71007 100644 --- a/3rdParty/Boost/src/boost/thread/pthread/condition_variable.hpp +++ b/3rdParty/Boost/src/boost/thread/pthread/condition_variable.hpp @@ -4,11 +4,17 @@ // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // (C) Copyright 2007-10 Anthony Williams +// (C) Copyright 2011 Vicente J. Botet Escriba -#include "timespec.hpp" -#include "pthread_mutex_scoped_lock.hpp" -#include "thread_data.hpp" -#include "condition_variable_fwd.hpp" +#include <boost/thread/pthread/timespec.hpp> +#include <boost/thread/pthread/pthread_mutex_scoped_lock.hpp> +#include <boost/thread/pthread/thread_data.hpp> +#include <boost/thread/pthread/condition_variable_fwd.hpp> +#ifdef BOOST_THREAD_USES_CHRONO +#include <boost/chrono/system_clocks.hpp> +#include <boost/chrono/ceil.hpp> +#endif +#include <boost/thread/detail/delete.hpp> #include <boost/config/abi_prefix.hpp> @@ -18,14 +24,14 @@ namespace boost { void BOOST_THREAD_DECL interruption_point(); } - + namespace thread_cv_detail { template<typename MutexType> struct lock_on_exit { MutexType* m; - + lock_on_exit(): m(0) {} @@ -44,66 +50,82 @@ namespace boost } }; } - + inline void condition_variable::wait(unique_lock<mutex>& m) { - thread_cv_detail::lock_on_exit<unique_lock<mutex> > guard; - detail::interruption_checker check_for_interruption(&internal_mutex,&cond); - guard.activate(m); - int const res=pthread_cond_wait(&cond,&internal_mutex); - BOOST_ASSERT(!res); + int res=0; + { + thread_cv_detail::lock_on_exit<unique_lock<mutex> > guard; + detail::interruption_checker check_for_interruption(&internal_mutex,&cond); + guard.activate(m); + do { + res = pthread_cond_wait(&cond,&internal_mutex); + } while (res == EINTR); + } this_thread::interruption_point(); + if(res) + { + boost::throw_exception(condition_error(res, "boost:: condition_variable constructor failed in pthread_cond_wait")); + } } - inline bool condition_variable::timed_wait(unique_lock<mutex>& m,boost::system_time const& wait_until) + inline bool condition_variable::do_timed_wait( + unique_lock<mutex>& m, + struct timespec const &timeout) { + if (!m.owns_lock()) + boost::throw_exception(condition_error(EPERM, "condition_variable do_timed_wait: mutex not locked")); + thread_cv_detail::lock_on_exit<unique_lock<mutex> > guard; - detail::interruption_checker check_for_interruption(&internal_mutex,&cond); - guard.activate(m); - struct timespec const timeout=detail::get_timespec(wait_until); - int const cond_res=pthread_cond_timedwait(&cond,&internal_mutex,&timeout); + int cond_res; + { + detail::interruption_checker check_for_interruption(&internal_mutex,&cond); + guard.activate(m); + cond_res=pthread_cond_timedwait(&cond,&internal_mutex,&timeout); + } this_thread::interruption_point(); if(cond_res==ETIMEDOUT) { return false; } - BOOST_ASSERT(!cond_res); + if(cond_res) + { + boost::throw_exception(condition_error(cond_res, "condition_variable failed in pthread_cond_timedwait")); + } return true; } - inline void condition_variable::notify_one() + inline void condition_variable::notify_one() BOOST_NOEXCEPT { boost::pthread::pthread_mutex_scoped_lock internal_lock(&internal_mutex); BOOST_VERIFY(!pthread_cond_signal(&cond)); } - - inline void condition_variable::notify_all() + + inline void condition_variable::notify_all() BOOST_NOEXCEPT { boost::pthread::pthread_mutex_scoped_lock internal_lock(&internal_mutex); BOOST_VERIFY(!pthread_cond_broadcast(&cond)); } - + class condition_variable_any { pthread_mutex_t internal_mutex; pthread_cond_t cond; - condition_variable_any(condition_variable_any&); - condition_variable_any& operator=(condition_variable_any&); - public: + BOOST_THREAD_NO_COPYABLE(condition_variable_any) condition_variable_any() { int const res=pthread_mutex_init(&internal_mutex,NULL); if(res) { - boost::throw_exception(thread_resource_error()); + boost::throw_exception(thread_resource_error(res, "condition_variable_any failed in pthread_mutex_init")); } int const res2=pthread_cond_init(&cond,NULL); if(res2) { BOOST_VERIFY(!pthread_mutex_destroy(&internal_mutex)); - boost::throw_exception(thread_resource_error()); + boost::throw_exception(thread_resource_error(res, "condition_variable_any failed in pthread_cond_init")); } } ~condition_variable_any() @@ -111,7 +133,7 @@ namespace boost BOOST_VERIFY(!pthread_mutex_destroy(&internal_mutex)); BOOST_VERIFY(!pthread_cond_destroy(&cond)); } - + template<typename lock_type> void wait(lock_type& m) { @@ -121,11 +143,11 @@ namespace boost detail::interruption_checker check_for_interruption(&internal_mutex,&cond); guard.activate(m); res=pthread_cond_wait(&cond,&internal_mutex); - this_thread::interruption_point(); } + this_thread::interruption_point(); if(res) { - boost::throw_exception(condition_error()); + boost::throw_exception(condition_error(res, "condition_variable_any failed in pthread_cond_wait")); } } @@ -134,28 +156,12 @@ namespace boost { while(!pred()) wait(m); } - + template<typename lock_type> bool timed_wait(lock_type& m,boost::system_time const& wait_until) { struct timespec const timeout=detail::get_timespec(wait_until); - int res=0; - { - thread_cv_detail::lock_on_exit<lock_type> guard; - detail::interruption_checker check_for_interruption(&internal_mutex,&cond); - guard.activate(m); - res=pthread_cond_timedwait(&cond,&internal_mutex,&timeout); - this_thread::interruption_point(); - } - if(res==ETIMEDOUT) - { - return false; - } - if(res) - { - boost::throw_exception(condition_error()); - } - return true; + return do_timed_wait(m, timeout); } template<typename lock_type> bool timed_wait(lock_type& m,xtime const& wait_until) @@ -192,17 +198,134 @@ namespace boost return timed_wait(m,get_system_time()+wait_duration,pred); } - void notify_one() +#ifdef BOOST_THREAD_USES_CHRONO + template <class lock_type,class Duration> + cv_status + wait_until( + lock_type& lock, + const chrono::time_point<chrono::system_clock, Duration>& t) + { + using namespace chrono; + typedef time_point<system_clock, nanoseconds> nano_sys_tmpt; + wait_until(lock, + nano_sys_tmpt(ceil<nanoseconds>(t.time_since_epoch()))); + return system_clock::now() < t ? cv_status::no_timeout : + cv_status::timeout; + } + + template <class lock_type, class Clock, class Duration> + cv_status + wait_until( + lock_type& lock, + const chrono::time_point<Clock, Duration>& t) + { + using namespace chrono; + system_clock::time_point s_now = system_clock::now(); + typename Clock::time_point c_now = Clock::now(); + wait_until(lock, s_now + ceil<nanoseconds>(t - c_now)); + return Clock::now() < t ? cv_status::no_timeout : cv_status::timeout; + } + + template <class lock_type, class Clock, class Duration, class Predicate> + bool + wait_until( + lock_type& lock, + const chrono::time_point<Clock, Duration>& t, + Predicate pred) + { + while (!pred()) + { + if (wait_until(lock, t) == cv_status::timeout) + return pred(); + } + return true; + } + + + template <class lock_type, class Rep, class Period> + cv_status + wait_for( + lock_type& lock, + const chrono::duration<Rep, Period>& d) + { + using namespace chrono; + system_clock::time_point s_now = system_clock::now(); + steady_clock::time_point c_now = steady_clock::now(); + wait_until(lock, s_now + ceil<nanoseconds>(d)); + return steady_clock::now() - c_now < d ? cv_status::no_timeout : + cv_status::timeout; + + } + + + template <class lock_type, class Rep, class Period, class Predicate> + bool + wait_for( + lock_type& lock, + const chrono::duration<Rep, Period>& d, + Predicate pred) + { + while (!pred()) + { + if (wait_for(lock, d) == cv_status::timeout) + return pred(); + } + return true; + } + + template <class lock_type> + inline void wait_until( + lock_type& lk, + chrono::time_point<chrono::system_clock, chrono::nanoseconds> tp) + { + using namespace chrono; + nanoseconds d = tp.time_since_epoch(); + timespec ts; + seconds s = duration_cast<seconds>(d); + ts.tv_sec = static_cast<long>(s.count()); + ts.tv_nsec = static_cast<long>((d - s).count()); + do_timed_wait(lk, ts); + } +#endif + + void notify_one() BOOST_NOEXCEPT { boost::pthread::pthread_mutex_scoped_lock internal_lock(&internal_mutex); BOOST_VERIFY(!pthread_cond_signal(&cond)); } - - void notify_all() + + void notify_all() BOOST_NOEXCEPT { boost::pthread::pthread_mutex_scoped_lock internal_lock(&internal_mutex); BOOST_VERIFY(!pthread_cond_broadcast(&cond)); } + private: // used by boost::thread::try_join_until + + template <class lock_type> + inline bool do_timed_wait( + lock_type& m, + struct timespec const &timeout) + { + int res=0; + { + thread_cv_detail::lock_on_exit<lock_type> guard; + detail::interruption_checker check_for_interruption(&internal_mutex,&cond); + guard.activate(m); + res=pthread_cond_timedwait(&cond,&internal_mutex,&timeout); + } + this_thread::interruption_point(); + if(res==ETIMEDOUT) + { + return false; + } + if(res) + { + boost::throw_exception(condition_error(res, "condition_variable_any failed in pthread_cond_timedwait")); + } + return true; + } + + }; } diff --git a/3rdParty/Boost/src/boost/thread/pthread/condition_variable_fwd.hpp b/3rdParty/Boost/src/boost/thread/pthread/condition_variable_fwd.hpp index 365f511..dbb3892 100644 --- a/3rdParty/Boost/src/boost/thread/pthread/condition_variable_fwd.hpp +++ b/3rdParty/Boost/src/boost/thread/pthread/condition_variable_fwd.hpp @@ -4,47 +4,57 @@ // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // (C) Copyright 2007-8 Anthony Williams +// (C) Copyright 2011 Vicente J. Botet Escriba #include <boost/assert.hpp> #include <boost/throw_exception.hpp> #include <pthread.h> +#include <boost/thread/cv_status.hpp> #include <boost/thread/mutex.hpp> #include <boost/thread/locks.hpp> #include <boost/thread/thread_time.hpp> #include <boost/thread/xtime.hpp> - +#ifdef BOOST_THREAD_USES_CHRONO +#include <boost/chrono/system_clocks.hpp> +#include <boost/chrono/ceil.hpp> +#endif +#include <boost/thread/detail/delete.hpp> +#include <boost/date_time/posix_time/posix_time_duration.hpp> #include <boost/config/abi_prefix.hpp> namespace boost { + class condition_variable { private: pthread_mutex_t internal_mutex; pthread_cond_t cond; - - condition_variable(condition_variable&); - condition_variable& operator=(condition_variable&); public: + BOOST_THREAD_NO_COPYABLE(condition_variable) condition_variable() { int const res=pthread_mutex_init(&internal_mutex,NULL); if(res) { - boost::throw_exception(thread_resource_error()); + boost::throw_exception(thread_resource_error(res, "boost:: condition_variable constructor failed in pthread_mutex_init")); } int const res2=pthread_cond_init(&cond,NULL); if(res2) { BOOST_VERIFY(!pthread_mutex_destroy(&internal_mutex)); - boost::throw_exception(thread_resource_error()); + boost::throw_exception(thread_resource_error(res2, "boost:: condition_variable constructor failed in pthread_cond_init")); } } ~condition_variable() { BOOST_VERIFY(!pthread_mutex_destroy(&internal_mutex)); - BOOST_VERIFY(!pthread_cond_destroy(&cond)); + int ret; + do { + ret = pthread_cond_destroy(&cond); + } while (ret == EINTR); + BOOST_VERIFY(!ret); } void wait(unique_lock<mutex>& m); @@ -55,21 +65,38 @@ namespace boost while(!pred()) wait(m); } - inline bool timed_wait(unique_lock<mutex>& m, - boost::system_time const& wait_until); - bool timed_wait(unique_lock<mutex>& m,xtime const& wait_until) + + inline bool timed_wait( + unique_lock<mutex>& m, + boost::system_time const& wait_until) + { +#if defined BOOST_THREAD_WAIT_BUG + struct timespec const timeout=detail::get_timespec(wait_until + BOOST_THREAD_WAIT_BUG); + return do_timed_wait(m, timeout); +#else + struct timespec const timeout=detail::get_timespec(wait_until); + return do_timed_wait(m, timeout); +#endif + } + bool timed_wait( + unique_lock<mutex>& m, + xtime const& wait_until) { return timed_wait(m,system_time(wait_until)); } template<typename duration_type> - bool timed_wait(unique_lock<mutex>& m,duration_type const& wait_duration) + bool timed_wait( + unique_lock<mutex>& m, + duration_type const& wait_duration) { return timed_wait(m,get_system_time()+wait_duration); } template<typename predicate_type> - bool timed_wait(unique_lock<mutex>& m,boost::system_time const& wait_until,predicate_type pred) + bool timed_wait( + unique_lock<mutex>& m, + boost::system_time const& wait_until,predicate_type pred) { while (!pred()) { @@ -80,28 +107,133 @@ namespace boost } template<typename predicate_type> - bool timed_wait(unique_lock<mutex>& m,xtime const& wait_until,predicate_type pred) + bool timed_wait( + unique_lock<mutex>& m, + xtime const& wait_until,predicate_type pred) { return timed_wait(m,system_time(wait_until),pred); } template<typename duration_type,typename predicate_type> - bool timed_wait(unique_lock<mutex>& m,duration_type const& wait_duration,predicate_type pred) + bool timed_wait( + unique_lock<mutex>& m, + duration_type const& wait_duration,predicate_type pred) { return timed_wait(m,get_system_time()+wait_duration,pred); } +#ifdef BOOST_THREAD_USES_CHRONO + + template <class Duration> + cv_status + wait_until( + unique_lock<mutex>& lock, + const chrono::time_point<chrono::system_clock, Duration>& t) + { + using namespace chrono; + typedef time_point<system_clock, nanoseconds> nano_sys_tmpt; + wait_until(lock, + nano_sys_tmpt(ceil<nanoseconds>(t.time_since_epoch()))); + return system_clock::now() < t ? cv_status::no_timeout : + cv_status::timeout; + } + + template <class Clock, class Duration> + cv_status + wait_until( + unique_lock<mutex>& lock, + const chrono::time_point<Clock, Duration>& t) + { + using namespace chrono; + system_clock::time_point s_now = system_clock::now(); + typename Clock::time_point c_now = Clock::now(); + wait_until(lock, s_now + ceil<nanoseconds>(t - c_now)); + return Clock::now() < t ? cv_status::no_timeout : cv_status::timeout; + } + + template <class Clock, class Duration, class Predicate> + bool + wait_until( + unique_lock<mutex>& lock, + const chrono::time_point<Clock, Duration>& t, + Predicate pred) + { + while (!pred()) + { + if (wait_until(lock, t) == cv_status::timeout) + return pred(); + } + return true; + } + + + template <class Rep, class Period> + cv_status + wait_for( + unique_lock<mutex>& lock, + const chrono::duration<Rep, Period>& d) + { + using namespace chrono; + system_clock::time_point s_now = system_clock::now(); + steady_clock::time_point c_now = steady_clock::now(); + wait_until(lock, s_now + ceil<nanoseconds>(d)); + return steady_clock::now() - c_now < d ? cv_status::no_timeout : + cv_status::timeout; + + } + + + template <class Rep, class Period, class Predicate> + bool + wait_for( + unique_lock<mutex>& lock, + const chrono::duration<Rep, Period>& d, + Predicate pred) + { + while (!pred()) + { + if (wait_for(lock, d) == cv_status::timeout) + return pred(); + } + return true; + } +#endif + +#define BOOST_THREAD_DEFINES_CONDITION_VARIABLE_NATIVE_HANDLE typedef pthread_cond_t* native_handle_type; native_handle_type native_handle() { return &cond; } - void notify_one(); - void notify_all(); + void notify_one() BOOST_NOEXCEPT; + void notify_all() BOOST_NOEXCEPT; + +#ifdef BOOST_THREAD_USES_CHRONO + inline void wait_until( + unique_lock<mutex>& lk, + chrono::time_point<chrono::system_clock, chrono::nanoseconds> tp) + { + using namespace chrono; + nanoseconds d = tp.time_since_epoch(); + timespec ts; + seconds s = duration_cast<seconds>(d); + ts.tv_sec = static_cast<long>(s.count()); + ts.tv_nsec = static_cast<long>((d - s).count()); + do_timed_wait(lk, ts); + } +#endif + //private: // used by boost::thread::try_join_until + + inline bool do_timed_wait( + unique_lock<mutex>& lock, + struct timespec const &timeout); }; + + BOOST_THREAD_DECL void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk); } + #include <boost/config/abi_suffix.hpp> #endif diff --git a/3rdParty/Boost/src/boost/thread/pthread/mutex.hpp b/3rdParty/Boost/src/boost/thread/pthread/mutex.hpp index 2a326d7..2c5af92 100644 --- a/3rdParty/Boost/src/boost/thread/pthread/mutex.hpp +++ b/3rdParty/Boost/src/boost/thread/pthread/mutex.hpp @@ -1,12 +1,12 @@ #ifndef BOOST_THREAD_PTHREAD_MUTEX_HPP #define BOOST_THREAD_PTHREAD_MUTEX_HPP // (C) Copyright 2007-8 Anthony Williams +// (C) Copyright 2011-2012 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) #include <pthread.h> -#include <boost/utility.hpp> #include <boost/throw_exception.hpp> #include <boost/thread/exceptions.hpp> #include <boost/thread/locks.hpp> @@ -14,11 +14,16 @@ #include <boost/thread/xtime.hpp> #include <boost/assert.hpp> #include <errno.h> -#include "timespec.hpp" -#include "pthread_mutex_scoped_lock.hpp" +#include <boost/thread/pthread/timespec.hpp> +#include <boost/thread/pthread/pthread_mutex_scoped_lock.hpp> +#ifdef BOOST_THREAD_USES_CHRONO +#include <boost/chrono/system_clocks.hpp> +#include <boost/chrono/ceil.hpp> +#endif +#include <boost/thread/detail/delete.hpp> #ifdef _POSIX_TIMEOUTS -#if _POSIX_TIMEOUTS >= 0 +#if _POSIX_TIMEOUTS >= 0 && _POSIX_C_SOURCE>=200112L #define BOOST_PTHREAD_HAS_TIMEDLOCK #endif #endif @@ -30,48 +35,70 @@ namespace boost class mutex { private: - mutex(mutex const&); - mutex& operator=(mutex const&); pthread_mutex_t m; public: + BOOST_THREAD_NO_COPYABLE(mutex) + mutex() { int const res=pthread_mutex_init(&m,NULL); if(res) { - boost::throw_exception(thread_resource_error()); + boost::throw_exception(thread_resource_error(res, "boost:: mutex constructor failed in pthread_mutex_init")); } } ~mutex() { - BOOST_VERIFY(!pthread_mutex_destroy(&m)); + int ret; + do + { + ret = pthread_mutex_destroy(&m); + } while (ret == EINTR); } - + void lock() { - int const res=pthread_mutex_lock(&m); - if(res) + int res; + do + { + res = pthread_mutex_lock(&m); + } while (res == EINTR); + if (res) { - boost::throw_exception(lock_error(res)); + boost::throw_exception(lock_error(res,"boost: mutex lock failed in pthread_mutex_lock")); } } void unlock() { - BOOST_VERIFY(!pthread_mutex_unlock(&m)); + int ret; + do + { + ret = pthread_mutex_unlock(&m); + } while (ret == EINTR); + BOOST_VERIFY(!ret); } - + bool try_lock() { - int const res=pthread_mutex_trylock(&m); + int res; + do + { + res = pthread_mutex_trylock(&m); + } while (res == EINTR); if(res && (res!=EBUSY)) { - boost::throw_exception(lock_error(res)); + // The following throw_exception has been replaced by an assertion and just return false, + // as this is an internal error and the user can do nothing with the exception. + //boost::throw_exception(lock_error(res,"boost: mutex try_lock failed in pthread_mutex_trylock")); + BOOST_ASSERT_MSG(false ,"boost: mutex try_lock failed in pthread_mutex_trylock"); + return false; } - + return !res; } +#define BOOST_THREAD_DEFINES_MUTEX_NATIVE_HANDLE typedef pthread_mutex_t* native_handle_type; native_handle_type native_handle() { @@ -87,28 +114,26 @@ namespace boost class timed_mutex { private: - timed_mutex(timed_mutex const&); - timed_mutex& operator=(timed_mutex const&); - private: pthread_mutex_t m; #ifndef BOOST_PTHREAD_HAS_TIMEDLOCK pthread_cond_t cond; bool is_locked; #endif public: + BOOST_THREAD_NO_COPYABLE(timed_mutex) timed_mutex() { int const res=pthread_mutex_init(&m,NULL); if(res) { - boost::throw_exception(thread_resource_error()); + boost::throw_exception(thread_resource_error(res, "boost:: timed_mutex constructor failed in pthread_mutex_init")); } #ifndef BOOST_PTHREAD_HAS_TIMEDLOCK int const res2=pthread_cond_init(&cond,NULL); if(res2) { BOOST_VERIFY(!pthread_mutex_destroy(&m)); - boost::throw_exception(thread_resource_error()); + boost::throw_exception(thread_resource_error(res2, "boost:: timed_mutex constructor failed in pthread_cond_init")); } is_locked=false; #endif @@ -141,26 +166,23 @@ namespace boost { BOOST_VERIFY(!pthread_mutex_unlock(&m)); } - + bool try_lock() { int const res=pthread_mutex_trylock(&m); BOOST_ASSERT(!res || res==EBUSY); return !res; } - bool timed_lock(system_time const & abs_time) - { - struct timespec const timeout=detail::get_timespec(abs_time); - int const res=pthread_mutex_timedlock(&m,&timeout); - BOOST_ASSERT(!res || res==ETIMEDOUT); - return !res; - } - typedef pthread_mutex_t* native_handle_type; - native_handle_type native_handle() + + private: + bool do_try_lock_until(struct timespec const &timeout) { - return &m; + int const res=pthread_mutex_timedlock(&m,&timeout); + BOOST_ASSERT(!res || res==ETIMEDOUT); + return !res; } + public: #else void lock() @@ -179,7 +201,7 @@ namespace boost is_locked=false; BOOST_VERIFY(!pthread_cond_signal(&cond)); } - + bool try_lock() { boost::pthread::pthread_mutex_scoped_lock const local_lock(&m); @@ -191,9 +213,9 @@ namespace boost return true; } - bool timed_lock(system_time const & abs_time) + private: + bool do_try_lock_until(struct timespec const &timeout) { - struct timespec const timeout=detail::get_timespec(abs_time); boost::pthread::pthread_mutex_scoped_lock const local_lock(&m); while(is_locked) { @@ -207,8 +229,55 @@ namespace boost is_locked=true; return true; } + public: #endif + bool timed_lock(system_time const & abs_time) + { + struct timespec const ts=detail::get_timespec(abs_time); + return do_try_lock_until(ts); + } + +#ifdef BOOST_THREAD_USES_CHRONO + template <class Rep, class Period> + bool try_lock_for(const chrono::duration<Rep, Period>& rel_time) + { + return try_lock_until(chrono::steady_clock::now() + rel_time); + } + template <class Clock, class Duration> + bool try_lock_until(const chrono::time_point<Clock, Duration>& t) + { + using namespace chrono; + system_clock::time_point s_now = system_clock::now(); + typename Clock::time_point c_now = Clock::now(); + return try_lock_until(s_now + ceil<nanoseconds>(t - c_now)); + } + template <class Duration> + bool try_lock_until(const chrono::time_point<chrono::system_clock, Duration>& t) + { + using namespace chrono; + typedef time_point<system_clock, nanoseconds> nano_sys_tmpt; + return try_lock_until(nano_sys_tmpt(ceil<nanoseconds>(t.time_since_epoch()))); + } + bool try_lock_until(const chrono::time_point<chrono::system_clock, chrono::nanoseconds>& tp) + { + using namespace chrono; + nanoseconds d = tp.time_since_epoch(); + timespec ts; + seconds s = duration_cast<seconds>(d); + ts.tv_sec = static_cast<long>(s.count()); + ts.tv_nsec = static_cast<long>((d - s).count()); + return do_try_lock_until(ts); + } +#endif + +#define BOOST_THREAD_DEFINES_TIMED_MUTEX_NATIVE_HANDLE + typedef pthread_mutex_t* native_handle_type; + native_handle_type native_handle() + { + return &m; + } + typedef unique_lock<timed_mutex> scoped_timed_lock; typedef detail::try_lock_wrapper<timed_mutex> scoped_try_lock; typedef scoped_timed_lock scoped_lock; diff --git a/3rdParty/Boost/src/boost/thread/pthread/once.hpp b/3rdParty/Boost/src/boost/thread/pthread/once.hpp index 6321aa2..02c2732 100644 --- a/3rdParty/Boost/src/boost/thread/pthread/once.hpp +++ b/3rdParty/Boost/src/boost/thread/pthread/once.hpp @@ -3,53 +3,86 @@ // once.hpp // -// (C) Copyright 2007-8 Anthony Williams +// (C) Copyright 2007-8 Anthony Williams +// (C) Copyright 2011-2012 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) #include <boost/thread/detail/config.hpp> -#include <boost/config.hpp> -#include <pthread.h> -#include <boost/assert.hpp> -#include "pthread_mutex_scoped_lock.hpp" #include <boost/thread/pthread/pthread_mutex_scoped_lock.hpp> -#include <boost/cstdint.hpp> +#include <boost/thread/detail/delete.hpp> +#include <boost/detail/no_exceptions_support.hpp> +#include <boost/assert.hpp> #include <boost/config/abi_prefix.hpp> +#include <boost/cstdint.hpp> +#include <pthread.h> +#include <csignal> + namespace boost { +#define BOOST_ONCE_INITIAL_FLAG_VALUE 0 + + namespace thread_detail + { +//#ifdef SIG_ATOMIC_MAX +// typedef sig_atomic_t uintmax_atomic_t; +// #define BOOST_THREAD_DETAIL_UINTMAX_ATOMIC_MAX_C SIG_ATOMIC_MAX +//#else + typedef unsigned long uintmax_atomic_t; + #define BOOST_THREAD_DETAIL_UINTMAX_ATOMIC_C2(value) value##ul + #define BOOST_THREAD_DETAIL_UINTMAX_ATOMIC_MAX_C BOOST_THREAD_DETAIL_UINTMAX_ATOMIC_C2(~0) +//#endif + } + +#ifdef BOOST_THREAD_PROVIDES_ONCE_CXX11 + + struct once_flag + { + BOOST_THREAD_NO_COPYABLE(once_flag) + BOOST_CONSTEXPR once_flag() BOOST_NOEXCEPT + : epoch(BOOST_ONCE_INITIAL_FLAG_VALUE) + {} + private: + volatile thread_detail::uintmax_atomic_t epoch; + template<typename Function> + friend + void call_once(once_flag& flag,Function f); + }; + +#else // BOOST_THREAD_PROVIDES_ONCE_CXX11 + struct once_flag { - boost::uintmax_t epoch; + volatile thread_detail::uintmax_atomic_t epoch; }; +#define BOOST_ONCE_INIT {BOOST_ONCE_INITIAL_FLAG_VALUE} +#endif // BOOST_THREAD_PROVIDES_ONCE_CXX11 + namespace detail { - BOOST_THREAD_DECL boost::uintmax_t& get_once_per_thread_epoch(); - BOOST_THREAD_DECL extern boost::uintmax_t once_global_epoch; + BOOST_THREAD_DECL thread_detail::uintmax_atomic_t& get_once_per_thread_epoch(); + BOOST_THREAD_DECL extern thread_detail::uintmax_atomic_t once_global_epoch; BOOST_THREAD_DECL extern pthread_mutex_t once_epoch_mutex; BOOST_THREAD_DECL extern pthread_cond_t once_epoch_cv; } - -#define BOOST_ONCE_INITIAL_FLAG_VALUE 0 -#define BOOST_ONCE_INIT {BOOST_ONCE_INITIAL_FLAG_VALUE} - // Based on Mike Burrows fast_pthread_once algorithm as described in // http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2444.html template<typename Function> void call_once(once_flag& flag,Function f) { - static boost::uintmax_t const uninitialized_flag=BOOST_ONCE_INITIAL_FLAG_VALUE; - static boost::uintmax_t const being_initialized=uninitialized_flag+1; - boost::uintmax_t const epoch=flag.epoch; - boost::uintmax_t& this_thread_epoch=detail::get_once_per_thread_epoch(); - + static thread_detail::uintmax_atomic_t const uninitialized_flag=BOOST_ONCE_INITIAL_FLAG_VALUE; + static thread_detail::uintmax_atomic_t const being_initialized=uninitialized_flag+1; + thread_detail::uintmax_atomic_t const epoch=flag.epoch; + thread_detail::uintmax_atomic_t& this_thread_epoch=detail::get_once_per_thread_epoch(); + if(epoch<this_thread_epoch) { pthread::pthread_mutex_scoped_lock lk(&detail::once_epoch_mutex); @@ -59,21 +92,18 @@ namespace boost if(flag.epoch==uninitialized_flag) { flag.epoch=being_initialized; -#ifndef BOOST_NO_EXCEPTIONS - try + BOOST_TRY { -#endif pthread::pthread_mutex_scoped_unlock relocker(&detail::once_epoch_mutex); f(); -#ifndef BOOST_NO_EXCEPTIONS } - catch(...) + BOOST_CATCH (...) { flag.epoch=uninitialized_flag; BOOST_VERIFY(!pthread_cond_broadcast(&detail::once_epoch_cv)); - throw; + BOOST_RETHROW } -#endif + BOOST_CATCH_END flag.epoch=--detail::once_global_epoch; BOOST_VERIFY(!pthread_cond_broadcast(&detail::once_epoch_cv)); } diff --git a/3rdParty/Boost/src/boost/thread/pthread/recursive_mutex.hpp b/3rdParty/Boost/src/boost/thread/pthread/recursive_mutex.hpp index 4158a57..2a6bc7d 100644 --- a/3rdParty/Boost/src/boost/thread/pthread/recursive_mutex.hpp +++ b/3rdParty/Boost/src/boost/thread/pthread/recursive_mutex.hpp @@ -1,12 +1,12 @@ #ifndef BOOST_THREAD_PTHREAD_RECURSIVE_MUTEX_HPP #define BOOST_THREAD_PTHREAD_RECURSIVE_MUTEX_HPP // (C) Copyright 2007-8 Anthony Williams +// (C) Copyright 2011-2012 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) #include <pthread.h> -#include <boost/utility.hpp> #include <boost/throw_exception.hpp> #include <boost/thread/exceptions.hpp> #include <boost/thread/locks.hpp> @@ -17,8 +17,13 @@ #endif #include <boost/date_time/posix_time/conversion.hpp> #include <errno.h> -#include "timespec.hpp" -#include "pthread_mutex_scoped_lock.hpp" +#include <boost/thread/pthread/timespec.hpp> +#include <boost/thread/pthread/pthread_mutex_scoped_lock.hpp> +#ifdef BOOST_THREAD_USES_CHRONO +#include <boost/chrono/system_clocks.hpp> +#include <boost/chrono/ceil.hpp> +#endif +#include <boost/thread/detail/delete.hpp> #ifdef _POSIX_TIMEOUTS #if _POSIX_TIMEOUTS >= 0 @@ -26,7 +31,7 @@ #endif #endif -#if defined(BOOST_PTHREAD_HAS_MUTEXATTR_SETTYPE) && defined(BOOST_PTHREAD_HAS_TIMEDLOCK) +#if defined(BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE) && defined(BOOST_PTHREAD_HAS_TIMEDLOCK) #define BOOST_USE_PTHREAD_RECURSIVE_TIMEDLOCK #endif @@ -37,51 +42,50 @@ namespace boost class recursive_mutex { private: - recursive_mutex(recursive_mutex const&); - recursive_mutex& operator=(recursive_mutex const&); pthread_mutex_t m; -#ifndef BOOST_PTHREAD_HAS_MUTEXATTR_SETTYPE +#ifndef BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE pthread_cond_t cond; bool is_locked; pthread_t owner; unsigned count; #endif public: + BOOST_THREAD_NO_COPYABLE(recursive_mutex) recursive_mutex() { -#ifdef BOOST_PTHREAD_HAS_MUTEXATTR_SETTYPE +#ifdef BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE pthread_mutexattr_t attr; - + int const init_attr_res=pthread_mutexattr_init(&attr); if(init_attr_res) { - boost::throw_exception(thread_resource_error()); + boost::throw_exception(thread_resource_error(init_attr_res, "boost:: recursive_mutex constructor failed in pthread_mutexattr_init")); } int const set_attr_res=pthread_mutexattr_settype(&attr,PTHREAD_MUTEX_RECURSIVE); if(set_attr_res) { BOOST_VERIFY(!pthread_mutexattr_destroy(&attr)); - boost::throw_exception(thread_resource_error()); + boost::throw_exception(thread_resource_error(set_attr_res, "boost:: recursive_mutex constructor failed in pthread_mutexattr_settype")); } - + int const res=pthread_mutex_init(&m,&attr); if(res) { BOOST_VERIFY(!pthread_mutexattr_destroy(&attr)); - boost::throw_exception(thread_resource_error()); + boost::throw_exception(thread_resource_error(res, "boost:: recursive_mutex constructor failed in pthread_mutex_init")); } BOOST_VERIFY(!pthread_mutexattr_destroy(&attr)); #else int const res=pthread_mutex_init(&m,NULL); if(res) { - boost::throw_exception(thread_resource_error()); + boost::throw_exception(thread_resource_error(res, "boost:: recursive_mutex constructor failed in pthread_mutex_init")); } int const res2=pthread_cond_init(&cond,NULL); if(res2) { BOOST_VERIFY(!pthread_mutex_destroy(&m)); - boost::throw_exception(thread_resource_error()); + boost::throw_exception(thread_resource_error(res2, "boost:: recursive_mutex constructor failed in pthread_cond_init")); } is_locked=false; count=0; @@ -90,12 +94,12 @@ namespace boost ~recursive_mutex() { BOOST_VERIFY(!pthread_mutex_destroy(&m)); -#ifndef BOOST_PTHREAD_HAS_MUTEXATTR_SETTYPE +#ifndef BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE BOOST_VERIFY(!pthread_cond_destroy(&cond)); #endif } -#ifdef BOOST_PTHREAD_HAS_MUTEXATTR_SETTYPE +#ifdef BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE void lock() { BOOST_VERIFY(!pthread_mutex_lock(&m)); @@ -105,13 +109,14 @@ namespace boost { BOOST_VERIFY(!pthread_mutex_unlock(&m)); } - - bool try_lock() + + bool try_lock() BOOST_NOEXCEPT { int const res=pthread_mutex_trylock(&m); BOOST_ASSERT(!res || res==EBUSY); return !res; } +#define BOOST_THREAD_DEFINES_RECURSIVE_MUTEX_NATIVE_HANDLE typedef pthread_mutex_t* native_handle_type; native_handle_type native_handle() { @@ -127,7 +132,7 @@ namespace boost ++count; return; } - + while(is_locked) { BOOST_VERIFY(!pthread_cond_wait(&cond,&m)); @@ -146,7 +151,7 @@ namespace boost } BOOST_VERIFY(!pthread_cond_signal(&cond)); } - + bool try_lock() { boost::pthread::pthread_mutex_scoped_lock const local_lock(&m); @@ -171,9 +176,6 @@ namespace boost class recursive_timed_mutex { private: - recursive_timed_mutex(recursive_timed_mutex const&); - recursive_timed_mutex& operator=(recursive_timed_mutex const&); - private: pthread_mutex_t m; #ifndef BOOST_USE_PTHREAD_RECURSIVE_TIMEDLOCK pthread_cond_t cond; @@ -182,40 +184,41 @@ namespace boost unsigned count; #endif public: + BOOST_THREAD_NO_COPYABLE(recursive_timed_mutex) recursive_timed_mutex() { #ifdef BOOST_USE_PTHREAD_RECURSIVE_TIMEDLOCK pthread_mutexattr_t attr; - + int const init_attr_res=pthread_mutexattr_init(&attr); if(init_attr_res) { - boost::throw_exception(thread_resource_error()); + boost::throw_exception(thread_resource_error(init_attr_res, "boost:: recursive_timed_mutex constructor failed in pthread_mutexattr_init")); } int const set_attr_res=pthread_mutexattr_settype(&attr,PTHREAD_MUTEX_RECURSIVE); if(set_attr_res) { - boost::throw_exception(thread_resource_error()); + boost::throw_exception(thread_resource_error(set_attr_res, "boost:: recursive_timed_mutex constructor failed in pthread_mutexattr_settype")); } - + int const res=pthread_mutex_init(&m,&attr); if(res) { BOOST_VERIFY(!pthread_mutexattr_destroy(&attr)); - boost::throw_exception(thread_resource_error()); + boost::throw_exception(thread_resource_error(res, "boost:: recursive_timed_mutex constructor failed in pthread_mutex_init")); } BOOST_VERIFY(!pthread_mutexattr_destroy(&attr)); #else int const res=pthread_mutex_init(&m,NULL); if(res) { - boost::throw_exception(thread_resource_error()); + boost::throw_exception(thread_resource_error(res, "boost:: recursive_timed_mutex constructor failed in pthread_mutex_init")); } int const res2=pthread_cond_init(&cond,NULL); if(res2) { BOOST_VERIFY(!pthread_mutex_destroy(&m)); - boost::throw_exception(thread_resource_error()); + boost::throw_exception(thread_resource_error(res2, "boost:: recursive_timed_mutex constructor failed in pthread_cond_init")); } is_locked=false; count=0; @@ -245,26 +248,22 @@ namespace boost { BOOST_VERIFY(!pthread_mutex_unlock(&m)); } - + bool try_lock() { int const res=pthread_mutex_trylock(&m); BOOST_ASSERT(!res || res==EBUSY); return !res; } - bool timed_lock(system_time const & abs_time) + private: + bool do_try_lock_until(struct timespec const &timeout) { - struct timespec const timeout=detail::get_timespec(abs_time); int const res=pthread_mutex_timedlock(&m,&timeout); BOOST_ASSERT(!res || res==ETIMEDOUT); return !res; } - typedef pthread_mutex_t* native_handle_type; - native_handle_type native_handle() - { - return &m; - } + public: #else void lock() @@ -275,7 +274,7 @@ namespace boost ++count; return; } - + while(is_locked) { BOOST_VERIFY(!pthread_cond_wait(&cond,&m)); @@ -294,8 +293,8 @@ namespace boost } BOOST_VERIFY(!pthread_cond_signal(&cond)); } - - bool try_lock() + + bool try_lock() BOOST_NOEXCEPT { boost::pthread::pthread_mutex_scoped_lock const local_lock(&m); if(is_locked && !pthread_equal(owner,pthread_self())) @@ -308,9 +307,9 @@ namespace boost return true; } - bool timed_lock(system_time const & abs_time) + private: + bool do_try_lock_until(struct timespec const &timeout) { - struct timespec const timeout=detail::get_timespec(abs_time); boost::pthread::pthread_mutex_scoped_lock const local_lock(&m); if(is_locked && pthread_equal(owner,pthread_self())) { @@ -331,8 +330,56 @@ namespace boost owner=pthread_self(); return true; } + public: + #endif + bool timed_lock(system_time const & abs_time) + { + struct timespec const ts=detail::get_timespec(abs_time); + return do_try_lock_until(ts); + } + +#ifdef BOOST_THREAD_USES_CHRONO + template <class Rep, class Period> + bool try_lock_for(const chrono::duration<Rep, Period>& rel_time) + { + return try_lock_until(chrono::steady_clock::now() + rel_time); + } + template <class Clock, class Duration> + bool try_lock_until(const chrono::time_point<Clock, Duration>& t) + { + using namespace chrono; + system_clock::time_point s_now = system_clock::now(); + typename Clock::time_point c_now = Clock::now(); + return try_lock_until(s_now + ceil<nanoseconds>(t - c_now)); + } + template <class Duration> + bool try_lock_until(const chrono::time_point<chrono::system_clock, Duration>& t) + { + using namespace chrono; + typedef time_point<system_clock, nanoseconds> nano_sys_tmpt; + return try_lock_until(nano_sys_tmpt(ceil<nanoseconds>(t.time_since_epoch()))); + } + bool try_lock_until(const chrono::time_point<chrono::system_clock, chrono::nanoseconds>& tp) + { + using namespace chrono; + nanoseconds d = tp.time_since_epoch(); + timespec ts; + seconds s = duration_cast<seconds>(d); + ts.tv_sec = static_cast<long>(s.count()); + ts.tv_nsec = static_cast<long>((d - s).count()); + return do_try_lock_until(ts); + } +#endif + +#define BOOST_THREAD_DEFINES_RECURSIVE_TIMED_MUTEX_NATIVE_HANDLE + typedef pthread_mutex_t* native_handle_type; + native_handle_type native_handle() + { + return &m; + } + typedef unique_lock<recursive_timed_mutex> scoped_timed_lock; typedef detail::try_lock_wrapper<recursive_timed_mutex> scoped_try_lock; typedef scoped_timed_lock scoped_lock; diff --git a/3rdParty/Boost/src/boost/thread/pthread/shared_mutex.hpp b/3rdParty/Boost/src/boost/thread/pthread/shared_mutex.hpp index bc26282..cf45188 100644 --- a/3rdParty/Boost/src/boost/thread/pthread/shared_mutex.hpp +++ b/3rdParty/Boost/src/boost/thread/pthread/shared_mutex.hpp @@ -2,6 +2,7 @@ #define BOOST_THREAD_PTHREAD_SHARED_MUTEX_HPP // (C) Copyright 2006-8 Anthony Williams +// (C) Copyright 2012 Vicente J. Botet Escriba // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at @@ -12,6 +13,11 @@ #include <boost/thread/mutex.hpp> #include <boost/thread/condition_variable.hpp> #include <boost/thread/detail/thread_interruption.hpp> +#ifdef BOOST_THREAD_USES_CHRONO +#include <boost/chrono/system_clocks.hpp> +#include <boost/chrono/ceil.hpp> +#endif +#include <boost/thread/detail/delete.hpp> #include <boost/config/abi_prefix.hpp> @@ -27,7 +33,7 @@ namespace boost bool upgrade; bool exclusive_waiting_blocked; }; - + state_data state; @@ -41,9 +47,10 @@ namespace boost exclusive_cond.notify_one(); shared_cond.notify_all(); } - public: + BOOST_THREAD_NO_COPYABLE(shared_mutex) + shared_mutex() { state_data state_={0,0,0,0}; @@ -58,7 +65,7 @@ namespace boost { boost::this_thread::disable_interruption do_not_disturb; boost::mutex::scoped_lock lk(state_change); - + while(state.exclusive || state.exclusive_waiting_blocked) { shared_cond.wait(lk); @@ -69,7 +76,7 @@ namespace boost bool try_lock_shared() { boost::mutex::scoped_lock lk(state_change); - + if(state.exclusive || state.exclusive_waiting_blocked) { return false; @@ -85,7 +92,7 @@ namespace boost { boost::this_thread::disable_interruption do_not_disturb; boost::mutex::scoped_lock lk(state_change); - + while(state.exclusive || state.exclusive_waiting_blocked) { if(!shared_cond.timed_wait(lk,timeout)) @@ -102,12 +109,34 @@ namespace boost { return timed_lock_shared(get_system_time()+relative_time); } +#ifdef BOOST_THREAD_USES_CHRONO + template <class Rep, class Period> + bool try_lock_shared_for(const chrono::duration<Rep, Period>& rel_time) + { + return try_lock_shared_until(chrono::steady_clock::now() + rel_time); + } + template <class Clock, class Duration> + bool try_lock_shared_until(const chrono::time_point<Clock, Duration>& abs_time) + { + boost::this_thread::disable_interruption do_not_disturb; + boost::mutex::scoped_lock lk(state_change); + while(state.exclusive || state.exclusive_waiting_blocked) + { + if(cv_status::timeout==shared_cond.wait_until(lk,abs_time)) + { + return false; + } + } + ++state.shared_count; + return true; + } +#endif void unlock_shared() { boost::mutex::scoped_lock lk(state_change); bool const last_reader=!--state.shared_count; - + if(last_reader) { if(state.upgrade) @@ -128,7 +157,7 @@ namespace boost { boost::this_thread::disable_interruption do_not_disturb; boost::mutex::scoped_lock lk(state_change); - + while(state.shared_count || state.exclusive) { state.exclusive_waiting_blocked=true; @@ -150,7 +179,7 @@ namespace boost if(state.shared_count || state.exclusive) { state.exclusive_waiting_blocked=false; - exclusive_cond.notify_one(); + release_waiters(); return false; } break; @@ -166,10 +195,41 @@ namespace boost return timed_lock(get_system_time()+relative_time); } +#ifdef BOOST_THREAD_USES_CHRONO + template <class Rep, class Period> + bool try_lock_for(const chrono::duration<Rep, Period>& rel_time) + { + return try_lock_until(chrono::steady_clock::now() + rel_time); + } + template <class Clock, class Duration> + bool try_lock_until(const chrono::time_point<Clock, Duration>& abs_time) + { + boost::this_thread::disable_interruption do_not_disturb; + boost::mutex::scoped_lock lk(state_change); + + while(state.shared_count || state.exclusive) + { + state.exclusive_waiting_blocked=true; + if(cv_status::timeout == exclusive_cond.wait_until(lk,abs_time)) + { + if(state.shared_count || state.exclusive) + { + state.exclusive_waiting_blocked=false; + release_waiters(); + return false; + } + break; + } + } + state.exclusive=true; + return true; + } +#endif + bool try_lock() { boost::mutex::scoped_lock lk(state_change); - + if(state.shared_count || state.exclusive) { return false; @@ -179,7 +239,7 @@ namespace boost state.exclusive=true; return true; } - + } void unlock() @@ -228,6 +288,33 @@ namespace boost return timed_lock_upgrade(get_system_time()+relative_time); } +#ifdef BOOST_THREAD_USES_CHRONO + template <class Rep, class Period> + bool try_lock_upgrade_for(const chrono::duration<Rep, Period>& rel_time) + { + return try_lock_upgrade_until(chrono::steady_clock::now() + rel_time); + } + template <class Clock, class Duration> + bool try_lock_upgrade_until(const chrono::time_point<Clock, Duration>& abs_time) + { + boost::this_thread::disable_interruption do_not_disturb; + boost::mutex::scoped_lock lk(state_change); + while(state.exclusive || state.exclusive_waiting_blocked || state.upgrade) + { + if(cv_status::timeout == shared_cond.wait_until(lk,abs_time)) + { + if(state.exclusive || state.exclusive_waiting_blocked || state.upgrade) + { + return false; + } + break; + } + } + ++state.shared_count; + state.upgrade=true; + return true; + } +#endif bool try_lock_upgrade() { boost::mutex::scoped_lock lk(state_change); @@ -248,14 +335,17 @@ namespace boost boost::mutex::scoped_lock lk(state_change); state.upgrade=false; bool const last_reader=!--state.shared_count; - + if(last_reader) { state.exclusive_waiting_blocked=false; release_waiters(); + } else { + shared_cond.notify_all(); } } + // Upgrade <-> Exclusive void unlock_upgrade_and_lock() { boost::this_thread::disable_interruption do_not_disturb; @@ -278,7 +368,58 @@ namespace boost state.exclusive_waiting_blocked=false; release_waiters(); } - + + bool try_unlock_upgrade_and_lock() + { + boost::mutex::scoped_lock lk(state_change); + if( !state.exclusive + && !state.exclusive_waiting_blocked + && state.upgrade + && state.shared_count==1) + { + state.shared_count=0; + state.exclusive=true; + state.upgrade=false; + return true; + } + return false; + } +#ifdef BOOST_THREAD_USES_CHRONO + template <class Rep, class Period> + bool + try_unlock_upgrade_and_lock_for( + const chrono::duration<Rep, Period>& rel_time) + { + return try_unlock_upgrade_and_lock_until( + chrono::steady_clock::now() + rel_time); + } + template <class Clock, class Duration> + bool + try_unlock_upgrade_and_lock_until( + const chrono::time_point<Clock, Duration>& abs_time) + { + boost::this_thread::disable_interruption do_not_disturb; + boost::mutex::scoped_lock lk(state_change); + if (state.shared_count != 1) + { + for (;;) + { + cv_status status = shared_cond.wait_until(lk,abs_time); + if (state.shared_count == 1) + break; + if(status == cv_status::timeout) + return false; + } + } + state.upgrade=false; + state.exclusive=true; + state.exclusive_waiting_blocked=false; + state.shared_count=0; + return true; + } +#endif + + // Shared <-> Exclusive void unlock_and_lock_shared() { boost::mutex::scoped_lock lk(state_change); @@ -287,7 +428,59 @@ namespace boost state.exclusive_waiting_blocked=false; release_waiters(); } - + +#ifdef BOOST_THREAD_PROVIDES_SHARED_MUTEX_UPWARDS_CONVERSIONS + bool try_unlock_shared_and_lock() + { + boost::mutex::scoped_lock lk(state_change); + if( !state.exclusive + && !state.exclusive_waiting_blocked + && !state.upgrade + && state.shared_count==1) + { + state.shared_count=0; + state.exclusive=true; + return true; + } + return false; + } +#ifdef BOOST_THREAD_USES_CHRONO + template <class Rep, class Period> + bool + try_unlock_shared_and_lock_for( + const chrono::duration<Rep, Period>& rel_time) + { + return try_unlock_shared_and_lock_until( + chrono::steady_clock::now() + rel_time); + } + template <class Clock, class Duration> + bool + try_unlock_shared_and_lock_until( + const chrono::time_point<Clock, Duration>& abs_time) + { + boost::this_thread::disable_interruption do_not_disturb; + boost::mutex::scoped_lock lk(state_change); + if (state.shared_count != 1) + { + for (;;) + { + cv_status status = shared_cond.wait_until(lk,abs_time); + if (state.shared_count == 1) + break; + if(status == cv_status::timeout) + return false; + } + } + state.upgrade=false; + state.exclusive=true; + state.exclusive_waiting_blocked=false; + state.shared_count=0; + return true; + } +#endif +#endif + + // Shared <-> Upgrade void unlock_upgrade_and_lock_shared() { boost::mutex::scoped_lock lk(state_change); @@ -295,7 +488,62 @@ namespace boost state.exclusive_waiting_blocked=false; release_waiters(); } + +#ifdef BOOST_THREAD_PROVIDES_SHARED_MUTEX_UPWARDS_CONVERSIONS + bool try_unlock_shared_and_lock_upgrade() + { + boost::mutex::scoped_lock lk(state_change); + if( !state.exclusive + && !state.exclusive_waiting_blocked + && !state.upgrade + ) + { + state.upgrade=true; + return true; + } + return false; + } +#ifdef BOOST_THREAD_USES_CHRONO + template <class Rep, class Period> + bool + try_unlock_shared_and_lock_upgrade_for( + const chrono::duration<Rep, Period>& rel_time) + { + return try_unlock_shared_and_lock_upgrade_until( + chrono::steady_clock::now() + rel_time); + } + template <class Clock, class Duration> + bool + try_unlock_shared_and_lock_upgrade_until( + const chrono::time_point<Clock, Duration>& abs_time) + { + boost::this_thread::disable_interruption do_not_disturb; + boost::mutex::scoped_lock lk(state_change); + if( state.exclusive + || state.exclusive_waiting_blocked + || state.upgrade + ) + { + for (;;) + { + cv_status status = exclusive_cond.wait_until(lk,abs_time); + if( ! state.exclusive + && ! state.exclusive_waiting_blocked + && ! state.upgrade + ) + break; + if(status == cv_status::timeout) + return false; + } + } + state.upgrade=true; + return true; + } +#endif +#endif }; + + typedef shared_mutex upgrade_mutex; } #include <boost/config/abi_suffix.hpp> diff --git a/3rdParty/Boost/src/boost/thread/pthread/thread_data.hpp b/3rdParty/Boost/src/boost/thread/pthread/thread_data.hpp index 1bee28b..db4e09f 100644 --- a/3rdParty/Boost/src/boost/thread/pthread/thread_data.hpp +++ b/3rdParty/Boost/src/boost/thread/pthread/thread_data.hpp @@ -4,24 +4,77 @@ // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // (C) Copyright 2007 Anthony Williams +// (C) Copyright 2011-2012 Vicente J. Botet Escriba #include <boost/thread/detail/config.hpp> #include <boost/thread/exceptions.hpp> +#include <boost/thread/locks.hpp> +#include <boost/thread/mutex.hpp> +#include <boost/thread/pthread/condition_variable_fwd.hpp> + #include <boost/shared_ptr.hpp> #include <boost/enable_shared_from_this.hpp> -#include <boost/thread/mutex.hpp> #include <boost/optional.hpp> -#include <pthread.h> #include <boost/assert.hpp> -#include "condition_variable_fwd.hpp" +#ifdef BOOST_THREAD_USES_CHRONO +#include <boost/chrono/system_clocks.hpp> +#endif + #include <map> +#include <vector> +#include <utility> + +#include <pthread.h> +#include <unistd.h> #include <boost/config/abi_prefix.hpp> namespace boost { + class thread_attributes { + public: + thread_attributes() BOOST_NOEXCEPT { + int res = pthread_attr_init(&val_); + BOOST_VERIFY(!res && "pthread_attr_init failed"); + } + ~thread_attributes() { + int res = pthread_attr_destroy(&val_); + BOOST_VERIFY(!res && "pthread_attr_destroy failed"); + } + // stack + void set_stack_size(std::size_t size) BOOST_NOEXCEPT { + if (size==0) return; + std::size_t page_size = getpagesize(); +#ifdef PTHREAD_STACK_MIN + if (size<PTHREAD_STACK_MIN) size=PTHREAD_STACK_MIN; +#endif + size = ((size+page_size-1)/page_size)*page_size; + int res = pthread_attr_setstacksize(&val_, size); + BOOST_VERIFY(!res && "pthread_attr_setstacksize failed"); + } + + std::size_t get_stack_size() const BOOST_NOEXCEPT { + std::size_t size; + int res = pthread_attr_getstacksize(&val_, &size); + BOOST_VERIFY(!res && "pthread_attr_getstacksize failed"); + return size; + } +#define BOOST_THREAD_DEFINES_THREAD_ATTRIBUTES_NATIVE_HANDLE + + typedef pthread_attr_t native_handle_type; + native_handle_type* native_handle() BOOST_NOEXCEPT { + return &val_; + } + const native_handle_type* native_handle() const BOOST_NOEXCEPT { + return &val_; + } + + private: + pthread_attr_t val_; + }; + class thread; - + namespace detail { struct tss_cleanup_function; @@ -39,7 +92,7 @@ namespace boost struct thread_data_base; typedef boost::shared_ptr<thread_data_base> thread_data_ptr; - + struct BOOST_THREAD_DECL thread_data_base: enable_shared_from_this<thread_data_base> { @@ -58,19 +111,28 @@ namespace boost bool interrupt_requested; pthread_mutex_t* cond_mutex; pthread_cond_t* current_cond; + typedef std::vector<std::pair<condition_variable*, mutex*> + //, hidden_allocator<std::pair<condition_variable*, mutex*> > + > notify_list_t; + notify_list_t notify; thread_data_base(): done(false),join_started(false),joined(false), thread_exit_callbacks(0), interrupt_enabled(true), interrupt_requested(false), - current_cond(0) + current_cond(0), + notify() {} virtual ~thread_data_base(); typedef pthread_t native_handle_type; virtual void run()=0; + void notify_all_at_thread_exit(condition_variable* cv, mutex* m) + { + notify.push_back(std::pair<condition_variable*, mutex*>(cv, m)); + } }; BOOST_THREAD_DECL thread_data_base* get_current_thread_data(); @@ -83,13 +145,15 @@ namespace boost void check_for_interruption() { +#ifndef BOOST_NO_EXCEPTIONS if(thread_info->interrupt_requested) { thread_info->interrupt_requested=false; - throw thread_interrupted(); + throw thread_interrupted(); // BOOST_NO_EXCEPTIONS protected } +#endif } - + void operator=(interruption_checker&); public: explicit interruption_checker(pthread_mutex_t* cond_mutex,pthread_cond_t* cond): @@ -128,15 +192,66 @@ namespace boost namespace this_thread { - void BOOST_THREAD_DECL yield(); - - void BOOST_THREAD_DECL sleep(system_time const& abs_time); - +#ifdef BOOST_THREAD_USES_CHRONO + inline + void BOOST_SYMBOL_VISIBLE sleep_for(const chrono::nanoseconds& ns) + { + using namespace chrono; + boost::detail::thread_data_base* const thread_info=boost::detail::get_current_thread_data(); + + if(thread_info) + { + unique_lock<mutex> lk(thread_info->sleep_mutex); + while(cv_status::no_timeout==thread_info->sleep_condition.wait_for(lk,ns)) {} + } + else + { + if (ns >= nanoseconds::zero()) + { + + # if defined(BOOST_HAS_PTHREAD_DELAY_NP) + timespec ts; + ts.tv_sec = static_cast<long>(duration_cast<seconds>(ns).count()); + ts.tv_nsec = static_cast<long>((ns - seconds(ts.tv_sec)).count()); + BOOST_VERIFY(!pthread_delay_np(&ts)); + # elif defined(BOOST_HAS_NANOSLEEP) + timespec ts; + ts.tv_sec = static_cast<long>(duration_cast<seconds>(ns).count()); + ts.tv_nsec = static_cast<long>((ns - seconds(ts.tv_sec)).count()); + // nanosleep takes a timespec that is an offset, not + // an absolute time. + nanosleep(&ts, 0); + # else + mutex mx; + mutex::scoped_lock lock(mx); + condition_variable cond; + cond.wait_for(lock, ns); + # endif + } + } + } +#endif + void BOOST_THREAD_DECL yield() BOOST_NOEXCEPT; + +#ifdef __DECXXX + /// Workaround of DECCXX issue of incorrect template substitution template<typename TimeDuration> inline void sleep(TimeDuration const& rel_time) { this_thread::sleep(get_system_time()+rel_time); } + + template<> + void BOOST_THREAD_DECL sleep(system_time const& abs_time); +#else + void BOOST_THREAD_DECL sleep(system_time const& abs_time); + + template<typename TimeDuration> + inline BOOST_SYMBOL_VISIBLE void sleep(TimeDuration const& rel_time) + { + this_thread::sleep(get_system_time()+rel_time); + } +#endif } } diff --git a/3rdParty/Boost/src/boost/thread/pthread/thread_heap_alloc.hpp b/3rdParty/Boost/src/boost/thread/pthread/thread_heap_alloc.hpp index 737c298..7828318 100644 --- a/3rdParty/Boost/src/boost/thread/pthread/thread_heap_alloc.hpp +++ b/3rdParty/Boost/src/boost/thread/pthread/thread_heap_alloc.hpp @@ -17,7 +17,7 @@ namespace boost return new T(); } -#ifndef BOOST_NO_RVALUE_REFERENCES +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES template<typename T,typename A1> inline T* heap_new(A1&& a1) { @@ -72,7 +72,7 @@ namespace boost { return heap_new_impl<T,A1&>(a1); } - + template<typename T,typename A1,typename A2> inline T* heap_new(A1 const& a1,A2 const& a2) { @@ -218,8 +218,8 @@ namespace boost { return heap_new_impl<T,A1&,A2&,A3&,A4&>(a1,a2,a3,a4); } - -#endif + +#endif template<typename T> inline void heap_delete(T* data) { diff --git a/3rdParty/Boost/src/boost/thread/shared_mutex.hpp b/3rdParty/Boost/src/boost/thread/shared_mutex.hpp index 51eda0d..e85e269 100644 --- a/3rdParty/Boost/src/boost/thread/shared_mutex.hpp +++ b/3rdParty/Boost/src/boost/thread/shared_mutex.hpp @@ -3,15 +3,20 @@ // shared_mutex.hpp // -// (C) Copyright 2007 Anthony Williams +// (C) Copyright 2007 Anthony Williams +// (C) Copyright 2011-2012 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) -#include <boost/thread/detail/platform.hpp> +#include <boost/thread/detail/config.hpp> #if defined(BOOST_THREAD_PLATFORM_WIN32) +#if defined(BOOST_THREAD_PROVIDES_GENERIC_SHARED_MUTEX_ON_WIN) +#include <boost/thread/pthread/shared_mutex.hpp> +#else #include <boost/thread/win32/shared_mutex.hpp> +#endif #elif defined(BOOST_THREAD_PLATFORM_PTHREAD) #include <boost/thread/pthread/shared_mutex.hpp> #else diff --git a/3rdParty/Boost/src/boost/thread/thread.hpp b/3rdParty/Boost/src/boost/thread/thread.hpp index fdfdadc..ee15c6e 100644 --- a/3rdParty/Boost/src/boost/thread/thread.hpp +++ b/3rdParty/Boost/src/boost/thread/thread.hpp @@ -3,7 +3,7 @@ // thread.hpp // -// (C) Copyright 2007-8 Anthony Williams +// (C) Copyright 2007-8 Anthony Williams // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at @@ -22,6 +22,7 @@ #include <boost/thread/detail/thread.hpp> #include <boost/thread/detail/thread_interruption.hpp> #include <boost/thread/detail/thread_group.hpp> +#include <boost/thread/v2/thread.hpp> #endif diff --git a/3rdParty/Boost/src/boost/thread/v2/thread.hpp b/3rdParty/Boost/src/boost/thread/v2/thread.hpp new file mode 100644 index 0000000..d686c5f --- /dev/null +++ b/3rdParty/Boost/src/boost/thread/v2/thread.hpp @@ -0,0 +1,56 @@ +// 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) +// (C) Copyright 2011 Vicente J. Botet Escriba + +#ifndef BOOST_THREAD_V2_THREAD_HPP +#define BOOST_THREAD_V2_THREAD_HPP + +#include <boost/thread/detail/config.hpp> +#ifdef BOOST_THREAD_USES_CHRONO +#include <boost/chrono/system_clocks.hpp> +#endif +#include <boost/thread/condition_variable.hpp> +#include <boost/thread/locks.hpp> + +namespace boost +{ + namespace this_thread + { + +#ifdef BOOST_THREAD_USES_CHRONO + + template <class Rep, class Period> + void sleep_for(const chrono::duration<Rep, Period>& d) + { + using namespace chrono; + nanoseconds ns = duration_cast<nanoseconds> (d); + if (ns < d) ++ns; + sleep_for(ns); + } + + template <class Clock, class Duration> + void sleep_until(const chrono::time_point<Clock, Duration>& t) + { + using namespace chrono; + mutex mut; + condition_variable cv; + unique_lock<mutex> lk(mut); + while (Clock::now() < t) + cv.wait_until(lk, t); + } + + template <class Duration> + inline BOOST_SYMBOL_VISIBLE + void sleep_until(const chrono::time_point<chrono::steady_clock, Duration>& t) + { + using namespace chrono; + sleep_for(t - steady_clock::now()); + } + +#endif + } +} + + +#endif diff --git a/3rdParty/Boost/src/boost/thread/win32/basic_recursive_mutex.hpp b/3rdParty/Boost/src/boost/thread/win32/basic_recursive_mutex.hpp index 05eb8d7..e259121 100644 --- a/3rdParty/Boost/src/boost/thread/win32/basic_recursive_mutex.hpp +++ b/3rdParty/Boost/src/boost/thread/win32/basic_recursive_mutex.hpp @@ -3,14 +3,19 @@ // basic_recursive_mutex.hpp // -// (C) Copyright 2006-8 Anthony Williams +// (C) Copyright 2006-8 Anthony Williams +// (C) Copyright 2011-2012 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) -#include "thread_primitives.hpp" -#include "basic_timed_mutex.hpp" +#include <boost/thread/win32/thread_primitives.hpp> +#include <boost/thread/win32/basic_timed_mutex.hpp> +#ifdef BOOST_THREAD_USES_CHRONO +#include <boost/chrono/system_clocks.hpp> +#include <boost/chrono/ceil.hpp> +#endif #include <boost/config/abi_prefix.hpp> @@ -37,12 +42,12 @@ namespace boost mutex.destroy(); } - bool try_lock() + bool try_lock() BOOST_NOEXCEPT { long const current_thread_id=win32::GetCurrentThreadId(); return try_recursive_lock(current_thread_id) || try_basic_lock(current_thread_id); } - + void lock() { long const current_thread_id=win32::GetCurrentThreadId(); @@ -64,6 +69,20 @@ namespace boost return timed_lock(get_system_time()+timeout); } +#ifdef BOOST_THREAD_USES_CHRONO + template <class Rep, class Period> + bool try_lock_for(const chrono::duration<Rep, Period>& rel_time) + { + long const current_thread_id=win32::GetCurrentThreadId(); + return try_recursive_lock(current_thread_id) || try_timed_lock_for(current_thread_id,rel_time); + } + template <class Clock, class Duration> + bool try_lock_until(const chrono::time_point<Clock, Duration>& t) + { + long const current_thread_id=win32::GetCurrentThreadId(); + return try_recursive_lock(current_thread_id) || try_timed_lock_until(current_thread_id,t); + } +#endif void unlock() { if(!--recursion_count) @@ -74,7 +93,7 @@ namespace boost } private: - bool try_recursive_lock(long current_thread_id) + bool try_recursive_lock(long current_thread_id) BOOST_NOEXCEPT { if(::boost::detail::interlocked_read_acquire(&locking_thread_id)==current_thread_id) { @@ -83,8 +102,8 @@ namespace boost } return false; } - - bool try_basic_lock(long current_thread_id) + + bool try_basic_lock(long current_thread_id) BOOST_NOEXCEPT { if(mutex.try_lock()) { @@ -94,7 +113,7 @@ namespace boost } return false; } - + bool try_timed_lock(long current_thread_id,::boost::system_time const& target) { if(mutex.timed_lock(target)) @@ -105,7 +124,28 @@ namespace boost } return false; } - + template <typename TP> + bool try_timed_lock_until(long current_thread_id,TP const& target) + { + if(mutex.try_lock_until(target)) + { + BOOST_INTERLOCKED_EXCHANGE(&locking_thread_id,current_thread_id); + recursion_count=1; + return true; + } + return false; + } + template <typename D> + bool try_timed_lock_for(long current_thread_id,D const& target) + { + if(mutex.try_lock_for(target)) + { + BOOST_INTERLOCKED_EXCHANGE(&locking_thread_id,current_thread_id); + recursion_count=1; + return true; + } + return false; + } }; typedef basic_recursive_mutex_impl<basic_timed_mutex> basic_recursive_mutex; diff --git a/3rdParty/Boost/src/boost/thread/win32/basic_timed_mutex.hpp b/3rdParty/Boost/src/boost/thread/win32/basic_timed_mutex.hpp index 7c6797d..6a43077 100644 --- a/3rdParty/Boost/src/boost/thread/win32/basic_timed_mutex.hpp +++ b/3rdParty/Boost/src/boost/thread/win32/basic_timed_mutex.hpp @@ -3,19 +3,23 @@ // basic_timed_mutex_win32.hpp // -// (C) Copyright 2006-8 Anthony Williams +// (C) Copyright 2006-8 Anthony Williams +// (C) Copyright 2011-2012 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) #include <boost/assert.hpp> -#include "thread_primitives.hpp" -#include "interlocked_read.hpp" +#include <boost/thread/win32/thread_primitives.hpp> +#include <boost/thread/win32/interlocked_read.hpp> #include <boost/thread/thread_time.hpp> #include <boost/thread/xtime.hpp> #include <boost/detail/interlocked.hpp> - +#ifdef BOOST_THREAD_USES_CHRONO +#include <boost/chrono/system_clocks.hpp> +#include <boost/chrono/ceil.hpp> +#endif #include <boost/config/abi_prefix.hpp> namespace boost @@ -52,13 +56,13 @@ namespace boost win32::CloseHandle(old_event); } } - - - bool try_lock() + + + bool try_lock() BOOST_NOEXCEPT { return !win32::interlocked_bit_test_and_set(&active_count,lock_flag_bit); } - + void lock() { if(try_lock()) @@ -112,8 +116,8 @@ namespace boost old_count=current; } } - - + + bool timed_lock(::boost::system_time const& wait_until) { if(try_lock()) @@ -143,6 +147,7 @@ namespace boost return true; } + template<typename Duration> bool timed_lock(Duration const& timeout) { @@ -154,6 +159,59 @@ namespace boost return timed_lock(system_time(timeout)); } +#ifdef BOOST_THREAD_USES_CHRONO + template <class Rep, class Period> + bool try_lock_for(const chrono::duration<Rep, Period>& rel_time) + { + return try_lock_until(chrono::steady_clock::now() + rel_time); + } + template <class Clock, class Duration> + bool try_lock_until(const chrono::time_point<Clock, Duration>& t) + { + using namespace chrono; + system_clock::time_point s_now = system_clock::now(); + typename Clock::time_point c_now = Clock::now(); + return try_lock_until(s_now + ceil<system_clock::duration>(t - c_now)); + } + template <class Duration> + bool try_lock_until(const chrono::time_point<chrono::system_clock, Duration>& t) + { + using namespace chrono; + typedef time_point<chrono::system_clock, chrono::system_clock::duration> sys_tmpt; + return try_lock_until(sys_tmpt(chrono::ceil<chrono::system_clock::duration>(t.time_since_epoch()))); + } + bool try_lock_until(const chrono::time_point<chrono::system_clock, chrono::system_clock::duration>& tp) + { + if(try_lock()) + { + return true; + } + long old_count=active_count; + mark_waiting_and_try_lock(old_count); + + if(old_count&lock_flag_value) + { + bool lock_acquired=false; + void* const sem=get_event(); + + do + { + chrono::milliseconds rel_time= chrono::ceil<chrono::milliseconds>(tp-chrono::system_clock::now()); + + if(win32::WaitForSingleObject(sem,static_cast<unsigned long>(rel_time.count()))!=0) + { + BOOST_INTERLOCKED_DECREMENT(&active_count); + return false; + } + clear_waiting_and_try_lock(old_count); + lock_acquired=!(old_count&lock_flag_value); + } + while(!lock_acquired); + } + return true; + } +#endif + void unlock() { long const offset=lock_flag_value; @@ -171,7 +229,7 @@ namespace boost void* get_event() { void* current_event=::boost::detail::interlocked_read_acquire(&event); - + if(!current_event) { void* const new_event=win32::create_anonymous_event(win32::auto_reset_event,win32::event_initially_reset); @@ -196,9 +254,9 @@ namespace boost } return current_event; } - + }; - + } } diff --git a/3rdParty/Boost/src/boost/thread/win32/condition_variable.hpp b/3rdParty/Boost/src/boost/thread/win32/condition_variable.hpp index 6e676b4..4c893ad 100644 --- a/3rdParty/Boost/src/boost/thread/win32/condition_variable.hpp +++ b/3rdParty/Boost/src/boost/thread/win32/condition_variable.hpp @@ -4,18 +4,28 @@ // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // (C) Copyright 2007-8 Anthony Williams +// (C) Copyright 2011-2012 Vicente J. Botet Escriba +#include <boost/thread/win32/thread_primitives.hpp> +#include <boost/thread/win32/thread_data.hpp> +#include <boost/thread/win32/thread_data.hpp> +#include <boost/thread/win32/interlocked_read.hpp> +#include <boost/thread/cv_status.hpp> +#include <boost/thread/xtime.hpp> #include <boost/thread/mutex.hpp> -#include "thread_primitives.hpp" -#include <limits.h> +#include <boost/thread/thread_time.hpp> + #include <boost/assert.hpp> +#include <boost/intrusive_ptr.hpp> + +#ifdef BOOST_THREAD_USES_CHRONO +#include <boost/chrono/system_clocks.hpp> +#include <boost/chrono/ceil.hpp> +#endif + +#include <limits.h> #include <algorithm> -#include <boost/thread/thread.hpp> -#include <boost/thread/thread_time.hpp> -#include "interlocked_read.hpp" -#include <boost/thread/xtime.hpp> #include <vector> -#include <boost/intrusive_ptr.hpp> #include <boost/config/abi_prefix.hpp> @@ -26,7 +36,7 @@ namespace boost class basic_cv_list_entry; void intrusive_ptr_add_ref(basic_cv_list_entry * p); void intrusive_ptr_release(basic_cv_list_entry * p); - + class basic_cv_list_entry { private: @@ -36,10 +46,8 @@ namespace boost bool notified; long references; - basic_cv_list_entry(basic_cv_list_entry&); - void operator=(basic_cv_list_entry&); - public: + BOOST_THREAD_NO_COPYABLE(basic_cv_list_entry) explicit basic_cv_list_entry(detail::win32::handle_manager const& wake_sem_): semaphore(detail::win32::create_anonymous_semaphore(0,LONG_MAX)), wake_sem(wake_sem_.duplicate()), @@ -55,7 +63,7 @@ namespace boost { BOOST_INTERLOCKED_INCREMENT(&waiters); } - + void remove_waiter() { BOOST_INTERLOCKED_DECREMENT(&waiters); @@ -77,9 +85,9 @@ namespace boost return notified; } - bool wait(timeout wait_until) + bool wait(timeout abs_time) { - return this_thread::interruptible_wait(semaphore,wait_until); + return this_thread::interruptible_wait(semaphore,abs_time); } bool woken() @@ -97,7 +105,7 @@ namespace boost { BOOST_INTERLOCKED_INCREMENT(&p->references); } - + inline void intrusive_ptr_release(basic_cv_list_entry * p) { if(!BOOST_INTERLOCKED_DECREMENT(&p->references)) @@ -125,13 +133,14 @@ namespace boost detail::interlocked_write_release(&total_count,total_count-count_to_wake); detail::win32::ReleaseSemaphore(wake_sem,count_to_wake,0); } - + template<typename lock_type> struct relocker { + BOOST_THREAD_NO_COPYABLE(relocker) lock_type& lock; bool unlocked; - + relocker(lock_type& lock_): lock(lock_),unlocked(false) {} @@ -146,13 +155,10 @@ namespace boost { lock.lock(); } - + } - private: - relocker(relocker&); - void operator=(relocker&); }; - + entry_ptr get_wait_entry() { @@ -177,37 +183,37 @@ namespace boost return generations.back(); } } - + struct entry_manager { entry_ptr const entry; - + + BOOST_THREAD_NO_COPYABLE(entry_manager) entry_manager(entry_ptr const& entry_): entry(entry_) {} - + ~entry_manager() { + if(! entry->is_notified()) + { entry->remove_waiter(); + } } list_entry* operator->() { return entry.get(); } - - private: - void operator=(entry_manager&); - entry_manager(entry_manager&); }; - + protected: template<typename lock_type> - bool do_wait(lock_type& lock,timeout wait_until) + bool do_wait(lock_type& lock,timeout abs_time) { relocker<lock_type> locker(lock); - + entry_manager entry(get_wait_entry()); locker.unlock(); @@ -215,27 +221,27 @@ namespace boost bool woken=false; while(!woken) { - if(!entry->wait(wait_until)) + if(!entry->wait(abs_time)) { return false; } - + woken=entry->woken(); } return woken; } template<typename lock_type,typename predicate_type> - bool do_wait(lock_type& m,timeout const& wait_until,predicate_type pred) + bool do_wait(lock_type& m,timeout const& abs_time,predicate_type pred) { while (!pred()) { - if(!do_wait(m, wait_until)) + if(!do_wait(m, abs_time)) return pred(); } return true; } - + basic_condition_variable(const basic_condition_variable& other); basic_condition_variable& operator=(const basic_condition_variable& other); @@ -243,11 +249,11 @@ namespace boost basic_condition_variable(): total_count(0),active_generation_count(0),wake_sem(0) {} - + ~basic_condition_variable() {} - void notify_one() + void notify_one() BOOST_NOEXCEPT { if(detail::interlocked_read_acquire(&total_count)) { @@ -267,8 +273,8 @@ namespace boost generations.erase(std::remove_if(generations.begin(),generations.end(),&basic_cv_list_entry::no_waiters),generations.end()); } } - - void notify_all() + + void notify_all() BOOST_NOEXCEPT { if(detail::interlocked_read_acquire(&total_count)) { @@ -288,23 +294,21 @@ namespace boost wake_sem=detail::win32::handle(0); } } - + }; } class condition_variable: private detail::basic_condition_variable { - private: - condition_variable(condition_variable&); - void operator=(condition_variable&); public: + BOOST_THREAD_NO_COPYABLE(condition_variable) condition_variable() {} - + using detail::basic_condition_variable::notify_one; using detail::basic_condition_variable::notify_all; - + void wait(unique_lock<mutex>& m) { do_wait(m,detail::timeout::sentinel()); @@ -315,16 +319,16 @@ namespace boost { while(!pred()) wait(m); } - - bool timed_wait(unique_lock<mutex>& m,boost::system_time const& wait_until) + + bool timed_wait(unique_lock<mutex>& m,boost::system_time const& abs_time) { - return do_wait(m,wait_until); + return do_wait(m,abs_time); } - bool timed_wait(unique_lock<mutex>& m,boost::xtime const& wait_until) + bool timed_wait(unique_lock<mutex>& m,boost::xtime const& abs_time) { - return do_wait(m,system_time(wait_until)); + return do_wait(m,system_time(abs_time)); } template<typename duration_type> bool timed_wait(unique_lock<mutex>& m,duration_type const& wait_duration) @@ -333,35 +337,85 @@ namespace boost } template<typename predicate_type> - bool timed_wait(unique_lock<mutex>& m,boost::system_time const& wait_until,predicate_type pred) + bool timed_wait(unique_lock<mutex>& m,boost::system_time const& abs_time,predicate_type pred) { - return do_wait(m,wait_until,pred); + return do_wait(m,abs_time,pred); } template<typename predicate_type> - bool timed_wait(unique_lock<mutex>& m,boost::xtime const& wait_until,predicate_type pred) + bool timed_wait(unique_lock<mutex>& m,boost::xtime const& abs_time,predicate_type pred) { - return do_wait(m,system_time(wait_until),pred); + return do_wait(m,system_time(abs_time),pred); } template<typename duration_type,typename predicate_type> bool timed_wait(unique_lock<mutex>& m,duration_type const& wait_duration,predicate_type pred) { return do_wait(m,wait_duration.total_milliseconds(),pred); } + +#ifdef BOOST_THREAD_USES_CHRONO + + template <class Clock, class Duration> + cv_status + wait_until( + unique_lock<mutex>& lock, + const chrono::time_point<Clock, Duration>& t) + { + using namespace chrono; + do_wait(lock, ceil<milliseconds>(t-Clock::now()).count()); + return Clock::now() < t ? cv_status::no_timeout : + cv_status::timeout; + } + + template <class Rep, class Period> + cv_status + wait_for( + unique_lock<mutex>& lock, + const chrono::duration<Rep, Period>& d) + { + using namespace chrono; + steady_clock::time_point c_now = steady_clock::now(); + do_wait(lock, ceil<milliseconds>(d).count()); + return steady_clock::now() - c_now < d ? cv_status::no_timeout : + cv_status::timeout; + } + + template <class Clock, class Duration, class Predicate> + bool + wait_until( + unique_lock<mutex>& lock, + const chrono::time_point<Clock, Duration>& t, + Predicate pred) + { + while (!pred()) + { + if (wait_until(lock, t) == cv_status::timeout) + return pred(); + } + return true; + } + template <class Rep, class Period, class Predicate> + bool + wait_for( + unique_lock<mutex>& lock, + const chrono::duration<Rep, Period>& d, + Predicate pred) + { + return wait_until(lock, chrono::steady_clock::now() + d, pred); + } +#endif }; - + class condition_variable_any: private detail::basic_condition_variable { - private: - condition_variable_any(condition_variable_any&); - void operator=(condition_variable_any&); public: + BOOST_THREAD_NO_COPYABLE(condition_variable_any) condition_variable_any() {} - + using detail::basic_condition_variable::notify_one; using detail::basic_condition_variable::notify_all; - + template<typename lock_type> void wait(lock_type& m) { @@ -373,17 +427,17 @@ namespace boost { while(!pred()) wait(m); } - + template<typename lock_type> - bool timed_wait(lock_type& m,boost::system_time const& wait_until) + bool timed_wait(lock_type& m,boost::system_time const& abs_time) { - return do_wait(m,wait_until); + return do_wait(m,abs_time); } template<typename lock_type> - bool timed_wait(lock_type& m,boost::xtime const& wait_until) + bool timed_wait(lock_type& m,boost::xtime const& abs_time) { - return do_wait(m,system_time(wait_until)); + return do_wait(m,system_time(abs_time)); } template<typename lock_type,typename duration_type> @@ -393,15 +447,15 @@ namespace boost } template<typename lock_type,typename predicate_type> - bool timed_wait(lock_type& m,boost::system_time const& wait_until,predicate_type pred) + bool timed_wait(lock_type& m,boost::system_time const& abs_time,predicate_type pred) { - return do_wait(m,wait_until,pred); + return do_wait(m,abs_time,pred); } template<typename lock_type,typename predicate_type> - bool timed_wait(lock_type& m,boost::xtime const& wait_until,predicate_type pred) + bool timed_wait(lock_type& m,boost::xtime const& abs_time,predicate_type pred) { - return do_wait(m,system_time(wait_until),pred); + return do_wait(m,system_time(abs_time),pred); } template<typename lock_type,typename duration_type,typename predicate_type> @@ -409,8 +463,61 @@ namespace boost { return do_wait(m,wait_duration.total_milliseconds(),pred); } +#ifdef BOOST_THREAD_USES_CHRONO + + template <class lock_type, class Clock, class Duration> + cv_status + wait_until( + lock_type& lock, + const chrono::time_point<Clock, Duration>& t) + { + using namespace chrono; + do_wait(lock, ceil<milliseconds>(t-Clock::now()).count()); + return Clock::now() < t ? cv_status::no_timeout : + cv_status::timeout; + } + + template <class lock_type, class Rep, class Period> + cv_status + wait_for( + lock_type& lock, + const chrono::duration<Rep, Period>& d) + { + using namespace chrono; + steady_clock::time_point c_now = steady_clock::now(); + do_wait(lock, ceil<milliseconds>(d).count()); + return steady_clock::now() - c_now < d ? cv_status::no_timeout : + cv_status::timeout; + } + + template <class lock_type, class Clock, class Duration, class Predicate> + bool + wait_until( + lock_type& lock, + const chrono::time_point<Clock, Duration>& t, + Predicate pred) + { + while (!pred()) + { + if (wait_until(lock, t) == cv_status::timeout) + return pred(); + } + return true; + } + + template <class lock_type, class Rep, class Period, class Predicate> + bool + wait_for( + lock_type& lock, + const chrono::duration<Rep, Period>& d, + Predicate pred) + { + return wait_until(lock, chrono::steady_clock::now() + d, pred); + } +#endif }; + BOOST_THREAD_DECL void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk); } #include <boost/config/abi_suffix.hpp> diff --git a/3rdParty/Boost/src/boost/thread/win32/interlocked_read.hpp b/3rdParty/Boost/src/boost/thread/win32/interlocked_read.hpp index 133fb6f..4a96998 100644 --- a/3rdParty/Boost/src/boost/thread/win32/interlocked_read.hpp +++ b/3rdParty/Boost/src/boost/thread/win32/interlocked_read.hpp @@ -3,13 +3,15 @@ // interlocked_read_win32.hpp // -// (C) Copyright 2005-8 Anthony Williams +// (C) Copyright 2005-8 Anthony Williams +// (C) Copyright 2012 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) #include <boost/detail/interlocked.hpp> +#include <boost/thread/detail/config.hpp> #include <boost/config/abi_prefix.hpp> @@ -22,25 +24,25 @@ namespace boost { namespace detail { - inline long interlocked_read_acquire(long volatile* x) + inline long interlocked_read_acquire(long volatile* x) BOOST_NOEXCEPT { long const res=*x; _ReadWriteBarrier(); return res; } - inline void* interlocked_read_acquire(void* volatile* x) + inline void* interlocked_read_acquire(void* volatile* x) BOOST_NOEXCEPT { void* const res=*x; _ReadWriteBarrier(); return res; } - inline void interlocked_write_release(long volatile* x,long value) + inline void interlocked_write_release(long volatile* x,long value) BOOST_NOEXCEPT { _ReadWriteBarrier(); *x=value; } - inline void interlocked_write_release(void* volatile* x,void* value) + inline void interlocked_write_release(void* volatile* x,void* value) BOOST_NOEXCEPT { _ReadWriteBarrier(); *x=value; @@ -54,19 +56,19 @@ namespace boost { namespace detail { - inline long interlocked_read_acquire(long volatile* x) + inline long interlocked_read_acquire(long volatile* x) BOOST_NOEXCEPT { return BOOST_INTERLOCKED_COMPARE_EXCHANGE(x,0,0); } - inline void* interlocked_read_acquire(void* volatile* x) + inline void* interlocked_read_acquire(void* volatile* x) BOOST_NOEXCEPT { return BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER(x,0,0); } - inline void interlocked_write_release(long volatile* x,long value) + inline void interlocked_write_release(long volatile* x,long value) BOOST_NOEXCEPT { BOOST_INTERLOCKED_EXCHANGE(x,value); } - inline void interlocked_write_release(void* volatile* x,void* value) + inline void interlocked_write_release(void* volatile* x,void* value) BOOST_NOEXCEPT { BOOST_INTERLOCKED_EXCHANGE_POINTER(x,value); } diff --git a/3rdParty/Boost/src/boost/thread/win32/mutex.hpp b/3rdParty/Boost/src/boost/thread/win32/mutex.hpp index d59fbfa..85a00e2 100644 --- a/3rdParty/Boost/src/boost/thread/win32/mutex.hpp +++ b/3rdParty/Boost/src/boost/thread/win32/mutex.hpp @@ -1,12 +1,12 @@ #ifndef BOOST_THREAD_WIN32_MUTEX_HPP #define BOOST_THREAD_WIN32_MUTEX_HPP // (C) Copyright 2005-7 Anthony Williams +// (C) Copyright 2011-2012 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) -#include "basic_timed_mutex.hpp" -#include <boost/utility.hpp> +#include <boost/thread/win32/basic_timed_mutex.hpp> #include <boost/thread/exceptions.hpp> #include <boost/thread/locks.hpp> @@ -22,10 +22,8 @@ namespace boost class mutex: public ::boost::detail::underlying_mutex { - private: - mutex(mutex const&); - mutex& operator=(mutex const&); public: + BOOST_THREAD_NO_COPYABLE(mutex) mutex() { initialize(); @@ -44,10 +42,8 @@ namespace boost class timed_mutex: public ::boost::detail::basic_timed_mutex { - private: - timed_mutex(timed_mutex const&); - timed_mutex& operator=(timed_mutex const&); public: + BOOST_THREAD_NO_COPYABLE(timed_mutex) timed_mutex() { initialize(); diff --git a/3rdParty/Boost/src/boost/thread/win32/once.hpp b/3rdParty/Boost/src/boost/thread/win32/once.hpp index e1b1843..3066b50 100644 --- a/3rdParty/Boost/src/boost/thread/win32/once.hpp +++ b/3rdParty/Boost/src/boost/thread/win32/once.hpp @@ -3,8 +3,9 @@ // once.hpp // -// (C) Copyright 2005-7 Anthony Williams +// (C) Copyright 2005-7 Anthony Williams // (C) Copyright 2005 John Maddock +// (C) Copyright 2011-2012 Vicente J. Botet Escriba // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at @@ -30,6 +31,25 @@ namespace std namespace boost { +#ifdef BOOST_THREAD_PROVIDES_ONCE_CXX11 + + struct once_flag + { + BOOST_THREAD_NO_COPYABLE(once_flag) + BOOST_CONSTEXPR once_flag() BOOST_NOEXCEPT + : status(0), count(0) + {} + private: + long status; + long count; + template<typename Function> + friend + void call_once(once_flag& flag,Function f); + }; + +#define BOOST_ONCE_INIT once_flag() +#else // BOOST_THREAD_PROVIDES_ONCE_CXX11 + struct once_flag { long status; @@ -37,6 +57,7 @@ namespace boost }; #define BOOST_ONCE_INIT {0,0} +#endif // BOOST_THREAD_PROVIDES_ONCE_CXX11 namespace detail { @@ -71,29 +92,29 @@ namespace boost #else static const once_char_type fixed_mutex_name[]="Local\\{C15730E2-145C-4c5e-B005-3BC753F42475}-once-flag"; #endif - BOOST_STATIC_ASSERT(sizeof(fixed_mutex_name) == + BOOST_STATIC_ASSERT(sizeof(fixed_mutex_name) == (sizeof(once_char_type)*(once_mutex_name_fixed_length+1))); - + std::memcpy(mutex_name,fixed_mutex_name,sizeof(fixed_mutex_name)); - detail::int_to_string(reinterpret_cast<std::ptrdiff_t>(flag_address), + detail::int_to_string(reinterpret_cast<std::ptrdiff_t>(flag_address), mutex_name + once_mutex_name_fixed_length); - detail::int_to_string(win32::GetCurrentProcessId(), + detail::int_to_string(win32::GetCurrentProcessId(), mutex_name + once_mutex_name_fixed_length + sizeof(void*)*2); } - + inline void* open_once_event(once_char_type* mutex_name,void* flag_address) { if(!*mutex_name) { name_once_mutex(mutex_name,flag_address); } - -#ifdef BOOST_NO_ANSI_APIS + +#ifdef BOOST_NO_ANSI_APIS return ::boost::detail::win32::OpenEventW( #else return ::boost::detail::win32::OpenEventA( #endif - ::boost::detail::win32::synchronize | + ::boost::detail::win32::synchronize | ::boost::detail::win32::event_modify_state, false, mutex_name); @@ -105,7 +126,7 @@ namespace boost { name_once_mutex(mutex_name,flag_address); } -#ifdef BOOST_NO_ANSI_APIS +#ifdef BOOST_NO_ANSI_APIS return ::boost::detail::win32::CreateEventW( #else return ::boost::detail::win32::CreateEventA( @@ -115,7 +136,7 @@ namespace boost mutex_name); } } - + template<typename Function> void call_once(once_flag& flag,Function f) @@ -136,7 +157,9 @@ namespace boost status=BOOST_INTERLOCKED_COMPARE_EXCHANGE(&flag.status,running_value,0); if(!status) { - try +#ifndef BOOST_NO_EXCEPTIONS + try // BOOST_NO_EXCEPTIONS protected +#endif { if(!event_handle) { @@ -153,7 +176,7 @@ namespace boost counted=true; } BOOST_INTERLOCKED_EXCHANGE(&flag.status,function_complete_flag_value); - if(!event_handle && + if(!event_handle && (::boost::detail::interlocked_read_acquire(&flag.count)>1)) { event_handle=detail::create_once_event(mutex_name,&flag); @@ -164,7 +187,8 @@ namespace boost } break; } - catch(...) +#ifndef BOOST_NO_EXCEPTIONS + catch(...) // BOOST_NO_EXCEPTIONS protected { BOOST_INTERLOCKED_EXCHANGE(&flag.status,0); if(!event_handle) @@ -175,8 +199,9 @@ namespace boost { ::boost::detail::win32::SetEvent(event_handle); } - throw; + throw; // BOOST_NO_EXCEPTIONS protected } +#endif } if(!counted) diff --git a/3rdParty/Boost/src/boost/thread/win32/recursive_mutex.hpp b/3rdParty/Boost/src/boost/thread/win32/recursive_mutex.hpp index e83d3bc..5144e77 100644 --- a/3rdParty/Boost/src/boost/thread/win32/recursive_mutex.hpp +++ b/3rdParty/Boost/src/boost/thread/win32/recursive_mutex.hpp @@ -3,15 +3,14 @@ // recursive_mutex.hpp // -// (C) Copyright 2006-7 Anthony Williams +// (C) Copyright 2006-7 Anthony Williams // // 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/utility.hpp> -#include "basic_recursive_mutex.hpp" +#include <boost/thread/win32/basic_recursive_mutex.hpp> #include <boost/thread/exceptions.hpp> #include <boost/thread/locks.hpp> @@ -22,10 +21,8 @@ namespace boost class recursive_mutex: public ::boost::detail::basic_recursive_mutex { - private: - recursive_mutex(recursive_mutex const&); - recursive_mutex& operator=(recursive_mutex const&); public: + BOOST_THREAD_NO_COPYABLE(recursive_mutex) recursive_mutex() { ::boost::detail::basic_recursive_mutex::initialize(); @@ -44,10 +41,8 @@ namespace boost class recursive_timed_mutex: public ::boost::detail::basic_recursive_timed_mutex { - private: - recursive_timed_mutex(recursive_timed_mutex const&); - recursive_timed_mutex& operator=(recursive_timed_mutex const&); public: + BOOST_THREAD_NO_COPYABLE(recursive_timed_mutex) recursive_timed_mutex() { ::boost::detail::basic_recursive_timed_mutex::initialize(); diff --git a/3rdParty/Boost/src/boost/thread/win32/shared_mutex.hpp b/3rdParty/Boost/src/boost/thread/win32/shared_mutex.hpp index 58fc622..fef2d5b 100644 --- a/3rdParty/Boost/src/boost/thread/win32/shared_mutex.hpp +++ b/3rdParty/Boost/src/boost/thread/win32/shared_mutex.hpp @@ -2,6 +2,7 @@ #define BOOST_THREAD_WIN32_SHARED_MUTEX_HPP // (C) Copyright 2006-8 Anthony Williams +// (C) Copyright 2011-2012 Vicente J. Botet Escriba // // Distributed under the Boost Software License, Version 1.0. (See // accompanying file LICENSE_1_0.txt or copy at @@ -12,8 +13,12 @@ #include <boost/thread/win32/thread_primitives.hpp> #include <boost/static_assert.hpp> #include <limits.h> -#include <boost/utility.hpp> #include <boost/thread/thread_time.hpp> +#ifdef BOOST_THREAD_USES_CHRONO +#include <boost/chrono/system_clocks.hpp> +#include <boost/chrono/ceil.hpp> +#endif +#include <boost/thread/detail/delete.hpp> #include <boost/config/abi_prefix.hpp> @@ -22,9 +27,6 @@ namespace boost class shared_mutex { private: - shared_mutex(shared_mutex const&); - shared_mutex& operator=(shared_mutex const&); - private: struct state_data { unsigned shared_count:11, @@ -39,7 +41,7 @@ namespace boost return *reinterpret_cast<unsigned const*>(&lhs)==*reinterpret_cast<unsigned const*>(&rhs); } }; - + template<typename T> T interlocked_compare_exchange(T* target,T new_value,T comparand) @@ -67,20 +69,32 @@ namespace boost { BOOST_VERIFY(detail::win32::ReleaseSemaphore(semaphores[exclusive_sem],1,0)!=0); } - + if(old_state.shared_waiting || old_state.exclusive_waiting) { BOOST_VERIFY(detail::win32::ReleaseSemaphore(semaphores[unlock_sem],old_state.shared_waiting + (old_state.exclusive_waiting?1:0),0)!=0); } } - + public: + BOOST_THREAD_NO_COPYABLE(shared_mutex) shared_mutex() { semaphores[unlock_sem]=detail::win32::create_anonymous_semaphore(0,LONG_MAX); - semaphores[exclusive_sem]=detail::win32::create_anonymous_semaphore(0,LONG_MAX); - upgrade_sem=detail::win32::create_anonymous_semaphore(0,LONG_MAX); + semaphores[exclusive_sem]=detail::win32::create_anonymous_semaphore_nothrow(0,LONG_MAX); + if (!semaphores[exclusive_sem]) + { + detail::win32::release_semaphore(semaphores[unlock_sem],LONG_MAX); + boost::throw_exception(thread_resource_error()); + } + upgrade_sem=detail::win32::create_anonymous_semaphore_nothrow(0,LONG_MAX); + if (!upgrade_sem) + { + detail::win32::release_semaphore(semaphores[unlock_sem],LONG_MAX); + detail::win32::release_semaphore(semaphores[exclusive_sem],LONG_MAX); + boost::throw_exception(thread_resource_error()); + } state_data state_={0}; state=state_; } @@ -106,7 +120,7 @@ namespace boost return false; } } - + state_data const current_state=interlocked_compare_exchange(&state,new_state,old_state); if(current_state==old_state) { @@ -165,7 +179,7 @@ namespace boost { return true; } - + unsigned long const res=detail::win32::WaitForSingleObject(semaphores[unlock_sem],::boost::detail::get_milliseconds_until(wait_until)); if(res==detail::win32::timeout) { @@ -202,11 +216,120 @@ namespace boost } return false; } - + BOOST_ASSERT(res==0); } } +#ifdef BOOST_THREAD_USES_CHRONO + template <class Rep, class Period> + bool try_lock_shared_for(const chrono::duration<Rep, Period>& rel_time) + { + return try_lock_shared_until(chrono::steady_clock::now() + rel_time); + } + template <class Clock, class Duration> + bool try_lock_shared_until(const chrono::time_point<Clock, Duration>& t) + { + using namespace chrono; + system_clock::time_point s_now = system_clock::now(); + typename Clock::time_point c_now = Clock::now(); + return try_lock_shared_until(s_now + ceil<system_clock::duration>(t - c_now)); + } + template <class Duration> + bool try_lock_shared_until(const chrono::time_point<chrono::system_clock, Duration>& t) + { + using namespace chrono; + typedef time_point<chrono::system_clock, chrono::system_clock::duration> sys_tmpt; + return try_lock_shared_until(sys_tmpt(chrono::ceil<chrono::system_clock::duration>(t.time_since_epoch()))); + } + bool try_lock_shared_until(const chrono::time_point<chrono::system_clock, chrono::system_clock::duration>& tp) + { + for(;;) + { + state_data old_state=state; + for(;;) + { + state_data new_state=old_state; + if(new_state.exclusive || new_state.exclusive_waiting_blocked) + { + ++new_state.shared_waiting; + if(!new_state.shared_waiting) + { + boost::throw_exception(boost::lock_error()); + } + } + else + { + ++new_state.shared_count; + if(!new_state.shared_count) + { + boost::throw_exception(boost::lock_error()); + } + } + + state_data const current_state=interlocked_compare_exchange(&state,new_state,old_state); + if(current_state==old_state) + { + break; + } + old_state=current_state; + } + + if(!(old_state.exclusive| old_state.exclusive_waiting_blocked)) + { + return true; + } + + chrono::system_clock::time_point n = chrono::system_clock::now(); + unsigned long res; + if (tp>n) { + chrono::milliseconds rel_time= chrono::ceil<chrono::milliseconds>(tp-n); + res=detail::win32::WaitForSingleObject(semaphores[unlock_sem], + static_cast<unsigned long>(rel_time.count())); + } else { + res=detail::win32::timeout; + } + if(res==detail::win32::timeout) + { + for(;;) + { + state_data new_state=old_state; + if(new_state.exclusive || new_state.exclusive_waiting_blocked) + { + if(new_state.shared_waiting) + { + --new_state.shared_waiting; + } + } + else + { + ++new_state.shared_count; + if(!new_state.shared_count) + { + return false; + } + } + + state_data const current_state=interlocked_compare_exchange(&state,new_state,old_state); + if(current_state==old_state) + { + break; + } + old_state=current_state; + } + + if(!(old_state.exclusive| old_state.exclusive_waiting_blocked)) + { + return true; + } + return false; + } + + BOOST_ASSERT(res==0); + } + } +#endif + void unlock_shared() { state_data old_state=state; @@ -214,7 +337,7 @@ namespace boost { state_data new_state=old_state; bool const last_reader=!--new_state.shared_count; - + if(last_reader) { if(new_state.upgrade) @@ -232,7 +355,7 @@ namespace boost new_state.shared_waiting=0; } } - + state_data const current_state=interlocked_compare_exchange(&state,new_state,old_state); if(current_state==old_state) { @@ -278,7 +401,7 @@ namespace boost { new_state.exclusive=true; } - + state_data const current_state=interlocked_compare_exchange(&state,new_state,old_state); if(current_state==old_state) { @@ -306,7 +429,7 @@ namespace boost { boost::throw_exception(boost::lock_error()); } - + new_state.exclusive_waiting_blocked=true; } else @@ -326,7 +449,12 @@ namespace boost { return true; } - unsigned long const wait_res=detail::win32::WaitForMultipleObjects(2,semaphores,true,::boost::detail::get_milliseconds_until(wait_until)); + #ifndef UNDER_CE + const bool wait_all = true; + #else + const bool wait_all = false; + #endif + unsigned long const wait_res=detail::win32::WaitForMultipleObjects(2,semaphores,wait_all,::boost::detail::get_milliseconds_until(wait_until)); if(wait_res==detail::win32::timeout) { for(;;) @@ -364,6 +492,116 @@ namespace boost } } +#ifdef BOOST_THREAD_USES_CHRONO + template <class Rep, class Period> + bool try_lock_for(const chrono::duration<Rep, Period>& rel_time) + { + return try_lock_until(chrono::steady_clock::now() + rel_time); + } + template <class Clock, class Duration> + bool try_lock_until(const chrono::time_point<Clock, Duration>& t) + { + using namespace chrono; + system_clock::time_point s_now = system_clock::now(); + typename Clock::time_point c_now = Clock::now(); + return try_lock_until(s_now + ceil<system_clock::duration>(t - c_now)); + } + template <class Duration> + bool try_lock_until(const chrono::time_point<chrono::system_clock, Duration>& t) + { + using namespace chrono; + typedef time_point<chrono::system_clock, chrono::system_clock::duration> sys_tmpt; + return try_lock_until(sys_tmpt(chrono::ceil<chrono::system_clock::duration>(t.time_since_epoch()))); + } + bool try_lock_until(const chrono::time_point<chrono::system_clock, chrono::system_clock::duration>& tp) + { + for(;;) + { + state_data old_state=state; + + for(;;) + { + state_data new_state=old_state; + if(new_state.shared_count || new_state.exclusive) + { + ++new_state.exclusive_waiting; + if(!new_state.exclusive_waiting) + { + boost::throw_exception(boost::lock_error()); + } + + new_state.exclusive_waiting_blocked=true; + } + else + { + new_state.exclusive=true; + } + + state_data const current_state=interlocked_compare_exchange(&state,new_state,old_state); + if(current_state==old_state) + { + break; + } + old_state=current_state; + } + + if(!old_state.shared_count && !old_state.exclusive) + { + return true; + } + #ifndef UNDER_CE + const bool wait_all = true; + #else + const bool wait_all = false; + #endif + + chrono::system_clock::time_point n = chrono::system_clock::now(); + unsigned long wait_res; + if (tp>n) { + chrono::milliseconds rel_time= chrono::ceil<chrono::milliseconds>(tp-chrono::system_clock::now()); + wait_res=detail::win32::WaitForMultipleObjects(2,semaphores,wait_all, + static_cast<unsigned long>(rel_time.count())); + } else { + wait_res=detail::win32::timeout; + } + if(wait_res==detail::win32::timeout) + { + for(;;) + { + state_data new_state=old_state; + if(new_state.shared_count || new_state.exclusive) + { + if(new_state.exclusive_waiting) + { + if(!--new_state.exclusive_waiting) + { + new_state.exclusive_waiting_blocked=false; + } + } + } + else + { + new_state.exclusive=true; + } + + state_data const current_state=interlocked_compare_exchange(&state,new_state,old_state); + if(current_state==old_state) + { + break; + } + old_state=current_state; + } + if(!old_state.shared_count && !old_state.exclusive) + { + return true; + } + return false; + } + BOOST_ASSERT(wait_res<2); + } + } +#endif + void unlock() { state_data old_state=state; @@ -426,7 +664,7 @@ namespace boost { return; } - + BOOST_VERIFY(!detail::win32::WaitForSingleObject(semaphores[unlock_sem],detail::win32::infinite)); } } @@ -450,7 +688,7 @@ namespace boost } new_state.upgrade=true; } - + state_data const current_state=interlocked_compare_exchange(&state,new_state,old_state); if(current_state==old_state) { @@ -469,7 +707,7 @@ namespace boost state_data new_state=old_state; new_state.upgrade=false; bool const last_reader=!--new_state.shared_count; - + if(last_reader) { if(new_state.exclusive_waiting) @@ -479,13 +717,15 @@ namespace boost } new_state.shared_waiting=0; } - + state_data const current_state=interlocked_compare_exchange(&state,new_state,old_state); if(current_state==old_state) { if(last_reader) { release_waiters(old_state); + } else { + release_waiters(old_state); } break; } @@ -500,13 +740,13 @@ namespace boost { state_data new_state=old_state; bool const last_reader=!--new_state.shared_count; - + if(last_reader) { new_state.upgrade=false; new_state.exclusive=true; } - + state_data const current_state=interlocked_compare_exchange(&state,new_state,old_state); if(current_state==old_state) { @@ -545,7 +785,28 @@ namespace boost } release_waiters(old_state); } - +// bool try_unlock_upgrade_and_lock() +// { +// return false; +// } +//#ifdef BOOST_THREAD_USES_CHRONO +// template <class Rep, class Period> +// bool +// try_unlock_upgrade_and_lock_for( +// const chrono::duration<Rep, Period>& rel_time) +// { +// return try_unlock_upgrade_and_lock_until( +// chrono::steady_clock::now() + rel_time); +// } +// template <class Clock, class Duration> +// bool +// try_unlock_upgrade_and_lock_until( +// const chrono::time_point<Clock, Duration>& abs_time) +// { +// return false; +// } +//#endif + void unlock_and_lock_shared() { state_data old_state=state; @@ -570,7 +831,6 @@ namespace boost } release_waiters(old_state); } - void unlock_upgrade_and_lock_shared() { state_data old_state=state; @@ -594,8 +854,10 @@ namespace boost } release_waiters(old_state); } - + }; + typedef shared_mutex upgrade_mutex; + } #include <boost/config/abi_suffix.hpp> diff --git a/3rdParty/Boost/src/boost/thread/win32/thread_data.hpp b/3rdParty/Boost/src/boost/thread/win32/thread_data.hpp index c86b0fa..18fd7cb 100644 --- a/3rdParty/Boost/src/boost/thread/win32/thread_data.hpp +++ b/3rdParty/Boost/src/boost/thread/win32/thread_data.hpp @@ -4,51 +4,116 @@ // accompanying file LICENSE_1_0.txt or copy at // http://www.boost.org/LICENSE_1_0.txt) // (C) Copyright 2008 Anthony Williams +// (C) Copyright 2011-2012 Vicente J. Botet Escriba #include <boost/thread/detail/config.hpp> -#include <boost/intrusive_ptr.hpp> #include <boost/thread/thread_time.hpp> -#include "thread_primitives.hpp" -#include "thread_heap_alloc.hpp" +#include <boost/thread/win32/thread_primitives.hpp> +#include <boost/thread/win32/thread_heap_alloc.hpp> + +#include <boost/intrusive_ptr.hpp> +#ifdef BOOST_THREAD_USES_CHRONO +#include <boost/chrono/system_clocks.hpp> +#endif + +#include <map> +#include <vector> +#include <utility> #include <boost/config/abi_prefix.hpp> namespace boost { + class condition_variable; + class mutex; + + class thread_attributes { + public: + thread_attributes() BOOST_NOEXCEPT { + val_.stack_size = 0; + //val_.lpThreadAttributes=0; + } + ~thread_attributes() { + } + // stack size + void set_stack_size(std::size_t size) BOOST_NOEXCEPT { + val_.stack_size = size; + } + + std::size_t get_stack_size() const BOOST_NOEXCEPT { + return val_.stack_size; + } + + //void set_security(LPSECURITY_ATTRIBUTES lpThreadAttributes) + //{ + // val_.lpThreadAttributes=lpThreadAttributes; + //} + //LPSECURITY_ATTRIBUTES get_security() + //{ + // return val_.lpThreadAttributes; + //} + + struct win_attrs { + std::size_t stack_size; + //LPSECURITY_ATTRIBUTES lpThreadAttributes; + }; + typedef win_attrs native_handle_type; + native_handle_type* native_handle() {return &val_;} + const native_handle_type* native_handle() const {return &val_;} + + private: + win_attrs val_; + }; + namespace detail { + struct tss_cleanup_function; struct thread_exit_callback_node; - struct tss_data_node; + struct tss_data_node + { + boost::shared_ptr<boost::detail::tss_cleanup_function> func; + void* value; + + tss_data_node(boost::shared_ptr<boost::detail::tss_cleanup_function> func_, + void* value_): + func(func_),value(value_) + {} + }; struct thread_data_base; void intrusive_ptr_add_ref(thread_data_base * p); void intrusive_ptr_release(thread_data_base * p); - - struct thread_data_base + + struct BOOST_THREAD_DECL thread_data_base { long count; detail::win32::handle_manager thread_handle; detail::win32::handle_manager interruption_handle; boost::detail::thread_exit_callback_node* thread_exit_callbacks; - boost::detail::tss_data_node* tss_data; + std::map<void const*,boost::detail::tss_data_node> tss_data; bool interruption_enabled; unsigned id; + typedef std::vector<std::pair<condition_variable*, mutex*> + //, hidden_allocator<std::pair<condition_variable*, mutex*> > + > notify_list_t; + notify_list_t notify; + thread_data_base(): count(0),thread_handle(detail::win32::invalid_handle_value), interruption_handle(create_anonymous_event(detail::win32::manual_reset_event,detail::win32::event_initially_reset)), - thread_exit_callbacks(0),tss_data(0), + thread_exit_callbacks(0),tss_data(), interruption_enabled(true), - id(0) - {} - virtual ~thread_data_base() + id(0), + notify() {} + virtual ~thread_data_base(); friend void intrusive_ptr_add_ref(thread_data_base * p) { BOOST_INTERLOCKED_INCREMENT(&p->count); } - + friend void intrusive_ptr_release(thread_data_base * p) { if(!BOOST_INTERLOCKED_DECREMENT(&p->count)) @@ -61,15 +126,21 @@ namespace boost { BOOST_VERIFY(detail::win32::SetEvent(interruption_handle)!=0); } - + typedef detail::win32::handle native_handle_type; virtual void run()=0; + + void notify_all_at_thread_exit(condition_variable* cv, mutex* m) + { + notify.push_back(std::pair<condition_variable*, mutex*>(cv, m)); + } + }; typedef boost::intrusive_ptr<detail::thread_data_base> thread_data_ptr; - struct timeout + struct BOOST_SYMBOL_VISIBLE timeout { unsigned long start; uintmax_t milliseconds; @@ -92,7 +163,7 @@ namespace boost abs_time(abs_time_) {} - struct remaining_time + struct BOOST_SYMBOL_VISIBLE remaining_time { bool more; unsigned long milliseconds; @@ -130,7 +201,7 @@ namespace boost { return milliseconds==~uintmax_t(0); } - + static timeout sentinel() { @@ -139,43 +210,49 @@ namespace boost private: struct sentinel_type {}; - + explicit timeout(sentinel_type): start(0),milliseconds(~uintmax_t(0)),relative(true) {} }; - inline unsigned long pin_to_zero(long value) + inline uintmax_t pin_to_zero(intmax_t value) { - return (value<0)?0u:(unsigned long)value; + return (value<0)?0u:(uintmax_t)value; } } namespace this_thread { - void BOOST_THREAD_DECL yield(); + void BOOST_THREAD_DECL yield() BOOST_NOEXCEPT; bool BOOST_THREAD_DECL interruptible_wait(detail::win32::handle handle_to_wait_for,detail::timeout target_time); - inline void interruptible_wait(unsigned long milliseconds) + inline void interruptible_wait(uintmax_t milliseconds) { interruptible_wait(detail::win32::invalid_handle_value,milliseconds); } - inline void interruptible_wait(system_time const& abs_time) + inline BOOST_SYMBOL_VISIBLE void interruptible_wait(system_time const& abs_time) { interruptible_wait(detail::win32::invalid_handle_value,abs_time); } template<typename TimeDuration> - inline void sleep(TimeDuration const& rel_time) + inline BOOST_SYMBOL_VISIBLE void sleep(TimeDuration const& rel_time) { interruptible_wait(detail::pin_to_zero(rel_time.total_milliseconds())); } - inline void sleep(system_time const& abs_time) + inline BOOST_SYMBOL_VISIBLE void sleep(system_time const& abs_time) { interruptible_wait(abs_time); } +#ifdef BOOST_THREAD_USES_CHRONO + inline void BOOST_SYMBOL_VISIBLE sleep_for(const chrono::nanoseconds& ns) + { + interruptible_wait(chrono::duration_cast<chrono::milliseconds>(ns).count()); + } +#endif } - + } #include <boost/config/abi_suffix.hpp> diff --git a/3rdParty/Boost/src/boost/thread/win32/thread_heap_alloc.hpp b/3rdParty/Boost/src/boost/thread/win32/thread_heap_alloc.hpp index c210a91..9b6d390 100644 --- a/3rdParty/Boost/src/boost/thread/win32/thread_heap_alloc.hpp +++ b/3rdParty/Boost/src/boost/thread/win32/thread_heap_alloc.hpp @@ -5,7 +5,7 @@ #ifndef THREAD_HEAP_ALLOC_HPP #define THREAD_HEAP_ALLOC_HPP #include <new> -#include "thread_primitives.hpp" +#include <boost/thread/win32/thread_primitives.hpp> #include <stdexcept> #include <boost/assert.hpp> #include <boost/throw_exception.hpp> @@ -56,7 +56,7 @@ namespace boost { namespace detail { - inline /*BOOST_THREAD_DECL*/ void* allocate_raw_heap_memory(unsigned size) + inline void* allocate_raw_heap_memory(unsigned size) { void* const heap_memory=detail::win32::HeapAlloc(detail::win32::GetProcessHeap(),0,size); if(!heap_memory) @@ -66,153 +66,189 @@ namespace boost return heap_memory; } - inline /*BOOST_THREAD_DECL*/ void free_raw_heap_memory(void* heap_memory) + inline void free_raw_heap_memory(void* heap_memory) { BOOST_VERIFY(detail::win32::HeapFree(detail::win32::GetProcessHeap(),0,heap_memory)!=0); } - + template<typename T> inline T* heap_new() { void* const heap_memory=allocate_raw_heap_memory(sizeof(T)); - try +#ifndef BOOST_NO_EXCEPTIONS + try // BOOST_NO_EXCEPTIONS protected +#endif { T* const data=new (heap_memory) T(); return data; } - catch(...) +#ifndef BOOST_NO_EXCEPTIONS + catch(...) // BOOST_NO_EXCEPTIONS protected { free_raw_heap_memory(heap_memory); - throw; + throw; // BOOST_NO_EXCEPTIONS protected } +#endif } -#ifndef BOOST_NO_RVALUE_REFERENCES +#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES template<typename T,typename A1> inline T* heap_new(A1&& a1) { void* const heap_memory=allocate_raw_heap_memory(sizeof(T)); - try +#ifndef BOOST_NO_EXCEPTIONS + try // BOOST_NO_EXCEPTIONS protected +#endif { T* const data=new (heap_memory) T(static_cast<A1&&>(a1)); return data; } - catch(...) +#ifndef BOOST_NO_EXCEPTIONS + catch(...) // BOOST_NO_EXCEPTIONS protected { free_raw_heap_memory(heap_memory); - throw; + throw; // BOOST_NO_EXCEPTIONS protected } +#endif } template<typename T,typename A1,typename A2> inline T* heap_new(A1&& a1,A2&& a2) { void* const heap_memory=allocate_raw_heap_memory(sizeof(T)); - try +#ifndef BOOST_NO_EXCEPTIONS + try // BOOST_NO_EXCEPTIONS protected +#endif { T* const data=new (heap_memory) T(static_cast<A1&&>(a1),static_cast<A2&&>(a2)); return data; } - catch(...) +#ifndef BOOST_NO_EXCEPTIONS + catch(...) // BOOST_NO_EXCEPTIONS protected { free_raw_heap_memory(heap_memory); - throw; + throw; // BOOST_NO_EXCEPTIONS protected } +#endif } template<typename T,typename A1,typename A2,typename A3> inline T* heap_new(A1&& a1,A2&& a2,A3&& a3) { void* const heap_memory=allocate_raw_heap_memory(sizeof(T)); - try +#ifndef BOOST_NO_EXCEPTIONS + try // BOOST_NO_EXCEPTIONS protected +#endif { T* const data=new (heap_memory) T(static_cast<A1&&>(a1),static_cast<A2&&>(a2), static_cast<A3&&>(a3)); return data; } - catch(...) +#ifndef BOOST_NO_EXCEPTIONS + catch(...) // BOOST_NO_EXCEPTIONS protected { free_raw_heap_memory(heap_memory); - throw; + throw; // BOOST_NO_EXCEPTIONS protected } +#endif } template<typename T,typename A1,typename A2,typename A3,typename A4> inline T* heap_new(A1&& a1,A2&& a2,A3&& a3,A4&& a4) { void* const heap_memory=allocate_raw_heap_memory(sizeof(T)); - try +#ifndef BOOST_NO_EXCEPTIONS + try // BOOST_NO_EXCEPTIONS protected +#endif { T* const data=new (heap_memory) T(static_cast<A1&&>(a1),static_cast<A2&&>(a2), static_cast<A3&&>(a3),static_cast<A4&&>(a4)); return data; } - catch(...) +#ifndef BOOST_NO_EXCEPTIONS + catch(...) // BOOST_NO_EXCEPTIONS protected { free_raw_heap_memory(heap_memory); - throw; + throw; // BOOST_NO_EXCEPTIONS protected } +#endif } #else template<typename T,typename A1> inline T* heap_new_impl(A1 a1) { void* const heap_memory=allocate_raw_heap_memory(sizeof(T)); - try +#ifndef BOOST_NO_EXCEPTIONS + try // BOOST_NO_EXCEPTIONS protected +#endif { T* const data=new (heap_memory) T(a1); return data; } - catch(...) +#ifndef BOOST_NO_EXCEPTIONS + catch(...) // BOOST_NO_EXCEPTIONS protected { free_raw_heap_memory(heap_memory); - throw; + throw; // BOOST_NO_EXCEPTIONS protected } +#endif } template<typename T,typename A1,typename A2> inline T* heap_new_impl(A1 a1,A2 a2) { void* const heap_memory=allocate_raw_heap_memory(sizeof(T)); - try +#ifndef BOOST_NO_EXCEPTIONS + try // BOOST_NO_EXCEPTIONS protected +#endif { T* const data=new (heap_memory) T(a1,a2); return data; } - catch(...) +#ifndef BOOST_NO_EXCEPTIONS + catch(...) // BOOST_NO_EXCEPTIONS protected { free_raw_heap_memory(heap_memory); - throw; + throw; // BOOST_NO_EXCEPTIONS protected } +#endif } template<typename T,typename A1,typename A2,typename A3> inline T* heap_new_impl(A1 a1,A2 a2,A3 a3) { void* const heap_memory=allocate_raw_heap_memory(sizeof(T)); - try +#ifndef BOOST_NO_EXCEPTIONS + try // BOOST_NO_EXCEPTIONS protected +#endif { T* const data=new (heap_memory) T(a1,a2,a3); return data; } - catch(...) +#ifndef BOOST_NO_EXCEPTIONS + catch(...) // BOOST_NO_EXCEPTIONS protected { free_raw_heap_memory(heap_memory); - throw; + throw; // BOOST_NO_EXCEPTIONS protected } +#endif } template<typename T,typename A1,typename A2,typename A3,typename A4> inline T* heap_new_impl(A1 a1,A2 a2,A3 a3,A4 a4) { void* const heap_memory=allocate_raw_heap_memory(sizeof(T)); - try +#ifndef BOOST_NO_EXCEPTIONS + try // BOOST_NO_EXCEPTIONS protected +#endif { T* const data=new (heap_memory) T(a1,a2,a3,a4); return data; } - catch(...) +#ifndef BOOST_NO_EXCEPTIONS + catch(...) // BOOST_NO_EXCEPTIONS protected { free_raw_heap_memory(heap_memory); - throw; + throw; // BOOST_NO_EXCEPTIONS protected } +#endif } @@ -226,7 +262,7 @@ namespace boost { return heap_new_impl<T,A1&>(a1); } - + template<typename T,typename A1,typename A2> inline T* heap_new(A1 const& a1,A2 const& a2) { @@ -372,8 +408,8 @@ namespace boost { return heap_new_impl<T,A1&,A2&,A3&,A4&>(a1,a2,a3,a4); } - -#endif + +#endif template<typename T> inline void heap_delete(T* data) { diff --git a/3rdParty/Boost/src/boost/thread/win32/thread_primitives.hpp b/3rdParty/Boost/src/boost/thread/win32/thread_primitives.hpp index 9b20e86..c0dba11 100644 --- a/3rdParty/Boost/src/boost/thread/win32/thread_primitives.hpp +++ b/3rdParty/Boost/src/boost/thread/win32/thread_primitives.hpp @@ -3,14 +3,14 @@ // win32_thread_primitives.hpp // -// (C) Copyright 2005-7 Anthony Williams -// (C) Copyright 2007 David Deakins +// (C) Copyright 2005-7 Anthony Williams +// (C) Copyright 2007 David Deakins // // 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> +#include <boost/thread/detail/config.hpp> #include <boost/throw_exception.hpp> #include <boost/assert.hpp> #include <boost/thread/exceptions.hpp> @@ -94,7 +94,7 @@ namespace boost { namespace win32 { - + # ifdef _WIN64 typedef unsigned __int64 ulong_ptr; # else @@ -170,20 +170,20 @@ namespace boost auto_reset_event=false, manual_reset_event=true }; - + enum initial_event_state { event_initially_reset=false, event_initially_set=true }; - + inline handle create_anonymous_event(event_type type,initial_event_state state) { -#if !defined(BOOST_NO_ANSI_APIS) +#if !defined(BOOST_NO_ANSI_APIS) handle const res=win32::CreateEventA(0,type,state,0); #else handle const res=win32::CreateEventW(0,type,state,0); -#endif +#endif if(!res) { boost::throw_exception(thread_resource_error()); @@ -193,17 +193,26 @@ namespace boost inline handle create_anonymous_semaphore(long initial_count,long max_count) { -#if !defined(BOOST_NO_ANSI_APIS) +#if !defined(BOOST_NO_ANSI_APIS) handle const res=CreateSemaphoreA(0,initial_count,max_count,0); #else handle const res=CreateSemaphoreW(0,initial_count,max_count,0); -#endif +#endif if(!res) { boost::throw_exception(thread_resource_error()); } return res; } + inline handle create_anonymous_semaphore_nothrow(long initial_count,long max_count) + { +#if !defined(BOOST_NO_ANSI_APIS) + handle const res=CreateSemaphoreA(0,initial_count,max_count,0); +#else + handle const res=CreateSemaphoreW(0,initial_count,max_count,0); +#endif + return res; + } inline handle duplicate_handle(handle source) { @@ -237,7 +246,7 @@ namespace boost BOOST_VERIFY(CloseHandle(handle_to_manage)); } } - + public: explicit handle_manager(handle handle_to_manage_): handle_to_manage(handle_to_manage_) @@ -245,7 +254,7 @@ namespace boost handle_manager(): handle_to_manage(0) {} - + handle_manager& operator=(handle new_handle) { cleanup(); @@ -279,13 +288,13 @@ namespace boost { return !handle_to_manage; } - + ~handle_manager() { cleanup(); } }; - + } } } @@ -318,7 +327,7 @@ namespace boost { return _interlockedbittestandreset(x,bit)!=0; } - + } } } @@ -332,24 +341,50 @@ namespace boost { inline bool interlocked_bit_test_and_set(long* x,long bit) { +#ifndef BOOST_INTEL_CXX_VERSION __asm { mov eax,bit; mov edx,x; lock bts [edx],eax; setc al; - }; + }; +#else + bool ret; + __asm { + mov eax,bit + mov edx,x + lock bts [edx],eax + setc al + mov ret, al + }; + return ret; + +#endif } inline bool interlocked_bit_test_and_reset(long* x,long bit) { +#ifndef BOOST_INTEL_CXX_VERSION __asm { mov eax,bit; mov edx,x; lock btr [edx],eax; setc al; - }; + }; +#else + bool ret; + __asm { + mov eax,bit + mov edx,x + lock btr [edx],eax + setc al + mov ret, al + }; + return ret; + +#endif } - + } } } diff --git a/3rdParty/Boost/src/boost/thread/xtime.hpp b/3rdParty/Boost/src/boost/thread/xtime.hpp index 7cc6272..1ca996f 100644 --- a/3rdParty/Boost/src/boost/thread/xtime.hpp +++ b/3rdParty/Boost/src/boost/thread/xtime.hpp @@ -2,7 +2,7 @@ // William E. Kempf // Copyright (C) 2007-8 Anthony Williams // -// Distributed under the Boost Software License, Version 1.0. (See accompanying +// 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_XTIME_WEK070601_HPP @@ -20,7 +20,7 @@ namespace boost { enum xtime_clock_types { - TIME_UTC=1 + TIME_UTC_=1 // TIME_TAI, // TIME_MONOTONIC, // TIME_PROCESS, @@ -53,14 +53,14 @@ struct xtime boost::posix_time::microseconds((nsec+500)/1000); #endif } - + }; inline xtime get_xtime(boost::system_time const& abs_time) { xtime res; boost::posix_time::time_duration const time_since_epoch=abs_time-boost::posix_time::from_time_t(0); - + res.sec=static_cast<xtime::xtime_sec_t>(time_since_epoch.total_seconds()); res.nsec=static_cast<xtime::xtime_nsec_t>(time_since_epoch.fractional_seconds()*(1000000000/time_since_epoch.ticks_per_second())); return res; @@ -68,7 +68,7 @@ inline xtime get_xtime(boost::system_time const& abs_time) inline int xtime_get(struct xtime* xtp, int clock_type) { - if (clock_type == TIME_UTC) + if (clock_type == TIME_UTC_) { *xtp=get_xtime(get_system_time()); return clock_type; @@ -81,7 +81,7 @@ inline int xtime_cmp(const xtime& xt1, const xtime& xt2) { if (xt1.sec == xt2.sec) return (int)(xt1.nsec - xt2.nsec); - else + else return (xt1.sec > xt2.sec) ? 1 : -1; } diff --git a/3rdParty/Boost/src/boost/throw_exception.hpp b/3rdParty/Boost/src/boost/throw_exception.hpp index a73acb6..c1bff43 100644 --- a/3rdParty/Boost/src/boost/throw_exception.hpp +++ b/3rdParty/Boost/src/boost/throw_exception.hpp @@ -1,5 +1,11 @@ -#ifndef BOOST_THROW_EXCEPTION_HPP_INCLUDED -#define BOOST_THROW_EXCEPTION_HPP_INCLUDED +#ifndef UUID_AA15E74A856F11E08B8D93F24824019B +#define UUID_AA15E74A856F11E08B8D93F24824019B +#if defined(__GNUC__) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma GCC system_header +#endif +#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma warning(push,1) +#endif // MS compatible compilers support #pragma once @@ -79,7 +85,7 @@ template<class E> BOOST_ATTRIBUTE_NORETURN inline void throw_exception( E const set_info( set_info( set_info( - boost::enable_error_info(x), + enable_error_info(x), throw_function(current_function)), throw_file(file)), throw_line(line))); @@ -88,4 +94,7 @@ template<class E> BOOST_ATTRIBUTE_NORETURN inline void throw_exception( E const #endif } // namespace boost -#endif // #ifndef BOOST_THROW_EXCEPTION_HPP_INCLUDED +#if defined(_MSC_VER) && !defined(BOOST_EXCEPTION_ENABLE_WARNINGS) +#pragma warning(pop) +#endif +#endif diff --git a/3rdParty/Boost/src/boost/token_functions.hpp b/3rdParty/Boost/src/boost/token_functions.hpp index 50f8330..4d1a1df 100644 --- a/3rdParty/Boost/src/boost/token_functions.hpp +++ b/3rdParty/Boost/src/boost/token_functions.hpp @@ -209,6 +209,36 @@ namespace boost{ // Assuming that the conditional will always get optimized out in the function // implementations, argument types are not a problem since both forms of character classifiers // expect an int. + +#if !defined(BOOST_NO_CWCTYPE) + template<typename traits, int N> + struct traits_extension_details : public traits { + typedef typename traits::char_type char_type; + static bool isspace(char_type c) + { + return std::iswspace(c) != 0; + } + static bool ispunct(char_type c) + { + return std::iswpunct(c) != 0; + } + }; + + template<typename traits> + struct traits_extension_details<traits, 1> : public traits { + typedef typename traits::char_type char_type; + static bool isspace(char_type c) + { + return std::isspace(c) != 0; + } + static bool ispunct(char_type c) + { + return std::ispunct(c) != 0; + } + }; +#endif + + // In case there is no cwctype header, we implement the checks manually. // We make use of the fact that the tested categories should fit in ASCII. template<typename traits> @@ -217,10 +247,7 @@ namespace boost{ static bool isspace(char_type c) { #if !defined(BOOST_NO_CWCTYPE) - if (sizeof(char_type) == 1) - return std::isspace(static_cast<int>(c)) != 0; - else - return std::iswspace(static_cast<std::wint_t>(c)) != 0; + return traits_extension_details<traits, sizeof(char_type)>::isspace(c); #else return static_cast< unsigned >(c) <= 255 && std::isspace(c) != 0; #endif @@ -229,10 +256,7 @@ namespace boost{ static bool ispunct(char_type c) { #if !defined(BOOST_NO_CWCTYPE) - if (sizeof(char_type) == 1) - return std::ispunct(static_cast<int>(c)) != 0; - else - return std::iswpunct(static_cast<std::wint_t>(c)) != 0; + return traits_extension_details<traits, sizeof(char_type)>::ispunct(c); #else return static_cast< unsigned >(c) <= 255 && std::ispunct(c) != 0; #endif diff --git a/3rdParty/Boost/src/boost/type_traits.hpp b/3rdParty/Boost/src/boost/type_traits.hpp index c725296..acd5aff 100644 --- a/3rdParty/Boost/src/boost/type_traits.hpp +++ b/3rdParty/Boost/src/boost/type_traits.hpp @@ -1,4 +1,4 @@ -// (C) Copyright John Maddock 2000. +// (C) Copyright 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). @@ -32,6 +32,7 @@ #include "boost/type_traits/has_nothrow_constructor.hpp" #include "boost/type_traits/has_nothrow_copy.hpp" #include "boost/type_traits/has_nothrow_destructor.hpp" +#include <boost/type_traits/has_operator.hpp> #include "boost/type_traits/has_trivial_assign.hpp" #include "boost/type_traits/has_trivial_constructor.hpp" #include "boost/type_traits/has_trivial_copy.hpp" @@ -93,7 +94,3 @@ #include "boost/type_traits/ice.hpp" #endif // BOOST_TYPE_TRAITS_HPP - - - - diff --git a/3rdParty/Boost/src/boost/type_traits/add_rvalue_reference.hpp b/3rdParty/Boost/src/boost/type_traits/add_rvalue_reference.hpp index 00b723c..f0e9925 100644 --- a/3rdParty/Boost/src/boost/type_traits/add_rvalue_reference.hpp +++ b/3rdParty/Boost/src/boost/type_traits/add_rvalue_reference.hpp @@ -28,7 +28,7 @@ // shall name T&&; otherwise, type shall name T. [ Note: This rule reflects // the semantics of reference collapsing. For example, when a type T names // a type T1&, the type add_rvalue_reference<T>::type is not an rvalue -// reference. �end note ] +// reference. -end note ] //----------------------------------------------------------------------------// namespace boost { @@ -39,15 +39,13 @@ namespace type_traits_detail { struct add_rvalue_reference_helper { typedef T type; }; +#if !defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) template <typename T> struct add_rvalue_reference_helper<T, true> { -#if !defined(BOOST_NO_RVALUE_REFERENCES) typedef T&& type; -#else - typedef T type; -#endif }; +#endif template <typename T> struct add_rvalue_reference_imp @@ -65,3 +63,4 @@ BOOST_TT_AUX_TYPE_TRAIT_DEF1(add_rvalue_reference,T,typename boost::type_traits_ #include <boost/type_traits/detail/type_trait_undef.hpp> #endif // BOOST_TYPE_TRAITS_EXT_ADD_RVALUE_REFERENCE__HPP + diff --git a/3rdParty/Boost/src/boost/type_traits/alignment_of.hpp b/3rdParty/Boost/src/boost/type_traits/alignment_of.hpp index 51357ce..e1735dc 100644 --- a/3rdParty/Boost/src/boost/type_traits/alignment_of.hpp +++ b/3rdParty/Boost/src/boost/type_traits/alignment_of.hpp @@ -93,7 +93,7 @@ BOOST_TT_AUX_SIZE_T_TRAIT_DEF1(alignment_of,T,::boost::detail::alignment_of_impl #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION template <typename T> struct alignment_of<T&> - : alignment_of<T*> + : public alignment_of<T*> { }; #endif diff --git a/3rdParty/Boost/src/boost/type_traits/common_type.hpp b/3rdParty/Boost/src/boost/type_traits/common_type.hpp index 74b0363..2739688 100644 --- a/3rdParty/Boost/src/boost/type_traits/common_type.hpp +++ b/3rdParty/Boost/src/boost/type_traits/common_type.hpp @@ -11,20 +11,20 @@ #include <boost/config.hpp> -#ifdef __SUNPRO_CC +#if defined(__SUNPRO_CC) && !defined(BOOST_COMMON_TYPE_DONT_USE_TYPEOF) # define BOOST_COMMON_TYPE_DONT_USE_TYPEOF #endif -#ifdef __IBMCPP__ +#if defined(__IBMCPP__) && !defined(BOOST_COMMON_TYPE_DONT_USE_TYPEOF) # define BOOST_COMMON_TYPE_DONT_USE_TYPEOF #endif //----------------------------------------------------------------------------// -#if defined(BOOST_NO_VARIADIC_TEMPLATES) +#if defined(BOOST_NO_VARIADIC_TEMPLATES) && !defined(BOOST_COMMON_TYPE_ARITY) #define BOOST_COMMON_TYPE_ARITY 3 #endif //----------------------------------------------------------------------------// -#if defined(BOOST_NO_DECLTYPE) && !defined(BOOST_COMMON_TYPE_DONT_USE_TYPEOF) +#if defined(BOOST_NO_DECLTYPE) && !defined(BOOST_COMMON_TYPE_DONT_USE_TYPEOF) && !defined(BOOST_TYPEOF_SILENT) #define BOOST_TYPEOF_SILENT #include <boost/typeof/typeof.hpp> // boost wonders never cease! #endif @@ -141,7 +141,7 @@ namespace type_traits_detail { template <class T, class U> struct common_type<T, U, void> #endif - : type_traits_detail::common_type_2<T,U> + : public type_traits_detail::common_type_2<T,U> { }; diff --git a/3rdParty/Boost/src/boost/type_traits/detail/bool_trait_def.hpp b/3rdParty/Boost/src/boost/type_traits/detail/bool_trait_def.hpp index 19bb18c..e3c7774 100644 --- a/3rdParty/Boost/src/boost/type_traits/detail/bool_trait_def.hpp +++ b/3rdParty/Boost/src/boost/type_traits/detail/bool_trait_def.hpp @@ -8,8 +8,8 @@ // http://www.boost.org/LICENSE_1_0.txt) // $Source$ -// $Date: 2006-07-12 07:10:22 -0400 (Wed, 12 Jul 2006) $ -// $Revision: 34511 $ +// $Date: 2011-10-09 15:28:33 -0700 (Sun, 09 Oct 2011) $ +// $Revision: 74865 $ #include <boost/type_traits/detail/template_arity_spec.hpp> #include <boost/type_traits/integral_constant.hpp> @@ -60,7 +60,7 @@ #endif #ifndef BOOST_TT_AUX_BOOL_C_BASE -# define BOOST_TT_AUX_BOOL_C_BASE(C) : ::boost::integral_constant<bool,C> +# define BOOST_TT_AUX_BOOL_C_BASE(C) : public ::boost::integral_constant<bool,C> #endif @@ -68,6 +68,7 @@ template< typename T > struct trait \ BOOST_TT_AUX_BOOL_C_BASE(C) \ { \ +public:\ BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \ BOOST_MPL_AUX_LAMBDA_SUPPORT(1,trait,(T)) \ }; \ @@ -80,6 +81,7 @@ BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(1,trait) \ template< typename T1, typename T2 > struct trait \ BOOST_TT_AUX_BOOL_C_BASE(C) \ { \ +public:\ BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \ BOOST_MPL_AUX_LAMBDA_SUPPORT(2,trait,(T1,T2)) \ }; \ @@ -87,10 +89,23 @@ template< typename T1, typename T2 > struct trait \ BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(2,trait) \ /**/ +#define BOOST_TT_AUX_BOOL_TRAIT_DEF3(trait,T1,T2,T3,C) \ +template< typename T1, typename T2, typename T3 > struct trait \ + BOOST_TT_AUX_BOOL_C_BASE(C) \ +{ \ +public:\ + BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \ + BOOST_MPL_AUX_LAMBDA_SUPPORT(3,trait,(T1,T2,T3)) \ +}; \ +\ +BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(3,trait) \ +/**/ + #define BOOST_TT_AUX_BOOL_TRAIT_SPEC1(trait,sp,C) \ template<> struct trait< sp > \ BOOST_TT_AUX_BOOL_C_BASE(C) \ { \ +public:\ BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \ BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(1,trait,(sp)) \ }; \ @@ -100,6 +115,7 @@ template<> struct trait< sp > \ template<> struct trait< sp1,sp2 > \ BOOST_TT_AUX_BOOL_C_BASE(C) \ { \ +public:\ BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \ BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(2,trait,(sp1,sp2)) \ }; \ @@ -108,6 +124,7 @@ template<> struct trait< sp1,sp2 > \ #define BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(trait,sp,C) \ template<> struct trait##_impl< sp > \ { \ +public:\ BOOST_STATIC_CONSTANT(bool, value = (C)); \ }; \ /**/ @@ -115,6 +132,7 @@ template<> struct trait##_impl< sp > \ #define BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC2(trait,sp1,sp2,C) \ template<> struct trait##_impl< sp1,sp2 > \ { \ +public:\ BOOST_STATIC_CONSTANT(bool, value = (C)); \ }; \ /**/ @@ -123,6 +141,7 @@ template<> struct trait##_impl< sp1,sp2 > \ template< param > struct trait< sp > \ BOOST_TT_AUX_BOOL_C_BASE(C) \ { \ +public:\ BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \ }; \ /**/ @@ -131,6 +150,7 @@ template< param > struct trait< sp > \ template< param1, param2 > struct trait< sp > \ BOOST_TT_AUX_BOOL_C_BASE(C) \ { \ +public:\ BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \ }; \ /**/ @@ -139,6 +159,7 @@ template< param1, param2 > struct trait< sp > \ template< param > struct trait< sp1,sp2 > \ BOOST_TT_AUX_BOOL_C_BASE(C) \ { \ +public:\ BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \ BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(2,trait,(sp1,sp2)) \ }; \ @@ -148,6 +169,7 @@ template< param > struct trait< sp1,sp2 > \ template< param1, param2 > struct trait< sp1,sp2 > \ BOOST_TT_AUX_BOOL_C_BASE(C) \ { \ +public:\ BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(C) \ }; \ /**/ @@ -155,6 +177,7 @@ template< param1, param2 > struct trait< sp1,sp2 > \ #define BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(param,trait,sp1,sp2,C) \ template< param > struct trait##_impl< sp1,sp2 > \ { \ +public:\ BOOST_STATIC_CONSTANT(bool, value = (C)); \ }; \ /**/ diff --git a/3rdParty/Boost/src/boost/type_traits/detail/bool_trait_undef.hpp b/3rdParty/Boost/src/boost/type_traits/detail/bool_trait_undef.hpp index 2259c64..008febe 100644 --- a/3rdParty/Boost/src/boost/type_traits/detail/bool_trait_undef.hpp +++ b/3rdParty/Boost/src/boost/type_traits/detail/bool_trait_undef.hpp @@ -8,13 +8,14 @@ // http://www.boost.org/LICENSE_1_0.txt) // $Source$ -// $Date: 2004-09-02 11:41:37 -0400 (Thu, 02 Sep 2004) $ -// $Revision: 24874 $ +// $Date: 2011-10-09 15:28:33 -0700 (Sun, 09 Oct 2011) $ +// $Revision: 74865 $ #undef BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL #undef BOOST_TT_AUX_BOOL_C_BASE #undef BOOST_TT_AUX_BOOL_TRAIT_DEF1 #undef BOOST_TT_AUX_BOOL_TRAIT_DEF2 +#undef BOOST_TT_AUX_BOOL_TRAIT_DEF3 #undef BOOST_TT_AUX_BOOL_TRAIT_SPEC1 #undef BOOST_TT_AUX_BOOL_TRAIT_SPEC2 #undef BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1 diff --git a/3rdParty/Boost/src/boost/type_traits/detail/common_type_imp.hpp b/3rdParty/Boost/src/boost/type_traits/detail/common_type_imp.hpp index 9e06282..dd530ca 100644 --- a/3rdParty/Boost/src/boost/type_traits/detail/common_type_imp.hpp +++ b/3rdParty/Boost/src/boost/type_traits/detail/common_type_imp.hpp @@ -72,22 +72,46 @@ struct propagate_cv< const volatile From, To > { typedef To const volatile type; }; /******************************************************************************* - * struct is_signable_integral<T> + * struct is_integral_or_enum<T> * * This metafunction determines if T is an integral type which can be made * signed or unsigned. ******************************************************************************/ template< class T > -struct is_signable_integral - : mpl::or_< is_integral<T>, is_enum<T> > +struct is_integral_or_enum + : public mpl::or_< is_integral<T>, is_enum<T> > { }; template<> -struct is_signable_integral< bool > - : false_type +struct is_integral_or_enum< bool > + : public false_type { }; /******************************************************************************* + * struct make_unsigned_soft<T> + * struct make_signed_soft<T> + * + * These metafunction are identical to make_unsigned and make_signed, + * respetively, except for special-casing bool. + ******************************************************************************/ + +template< class T > +struct make_unsigned_soft + : public make_unsigned<T> +{ }; +template<> +struct make_unsigned_soft< bool > +{ typedef bool type; }; + +template< class T > +struct make_signed_soft + : public make_signed<T> +{ }; +template<> +struct make_signed_soft< bool > +{ typedef bool type; }; + +/******************************************************************************* * struct sizeof_t<N> * typedef ... yes_type * typedef ... no_type @@ -127,7 +151,7 @@ yes_type rvalue_test(...); template< class First, class Last, std::size_t Index > struct conversion_test_overloads_iterate - : conversion_test_overloads_iterate< + : public conversion_test_overloads_iterate< typename mpl::next< First >::type, Last, Index + 1 > { @@ -144,7 +168,7 @@ struct conversion_test_overloads_iterate< Last, Last, Index > template< class Sequence > struct conversion_test_overloads - : conversion_test_overloads_iterate< + : public conversion_test_overloads_iterate< typename mpl::begin< Sequence >::type, typename mpl::end< Sequence >::type, 0 @@ -163,7 +187,7 @@ template< int N = mpl::size< Sequence >::value > struct select - : mpl::at_c< Sequence, Index > + : public mpl::at_c< Sequence, Index > { }; template< class Sequence, int N > struct select< Sequence, N, N > @@ -185,12 +209,21 @@ struct select< Sequence, N, N > * { V*, W*, V'*, W'* } * where V' is V with whatever cv-qualifiers are on W, and W' is W * with whatever cv-qualifiers are on V - * else T' and U' are both "signable integral types" (integral and enum - * types excepting bool), then: + * else if T' and U' are both integral or enum types, then: * define the set of NominalCandidates to be - * { unsigned(T'), unsigned(U'), signed(T'), signed(U') } - * where unsigned(X) is make_unsigned<X>::type and signed(X) is - * make_signed<X>::type + * { + * unsigned_soft(T'), + * unsigned_soft(U'), + * signed_soft(T'), + * signed_soft(U'), + * T', + * U', + * unsigned int, + * int + * } + * where unsigned_soft(X) is make_unsigned_soft<X>::type and + * signed_soft(X) is make_signed_soft<X>::type (these are all + * generally necessary to cover the various integral promotion cases) * else * define the set of NominalCandidates to be * { T', U' } @@ -231,22 +264,20 @@ template< class T, class U, class V = typename remove_cv< typename remove_reference<T>::type >::type, class W = typename remove_cv< typename remove_reference<U>::type >::type, - bool = is_signable_integral<V>::value && is_signable_integral<W>::value + bool = is_integral_or_enum<V>::value && is_integral_or_enum<W>::value > -struct nominal_candidates; - -template< class T, class U, class V, class W > -struct nominal_candidates< T, U, V, W, false > +struct nominal_candidates { typedef mpl::vector2<V,W> type; }; template< class T, class U, class V, class W > struct nominal_candidates< T, U, V, W, true > { - typedef mpl::vector4< - typename make_unsigned<V>::type, - typename make_unsigned<W>::type, - typename make_signed<V>::type, - typename make_signed<W>::type + typedef boost::mpl::vector8< + typename make_unsigned_soft<V>::type, + typename make_unsigned_soft<W>::type, + typename make_signed_soft<V>::type, + typename make_signed_soft<W>::type, + V, W, unsigned int, int > type; }; @@ -262,7 +293,7 @@ struct nominal_candidates< T, U, V*, W*, false > template<class T, class U, bool b> struct common_type_dispatch_on_rvalueness - : deduce_common_type< T, U, typename nominal_candidates<T,U>::type > + : public deduce_common_type< T, U, typename nominal_candidates<T,U>::type > { }; template< class T, class U > @@ -285,7 +316,7 @@ public: template< class T, class U > struct common_type_impl - : common_type_dispatch_on_rvalueness<T,U, sizeof( ::boost::detail_type_traits_common_type::rvalue_test( + : public common_type_dispatch_on_rvalueness<T,U, sizeof( ::boost::detail_type_traits_common_type::rvalue_test( declval< bool >() ? declval<T>() : declval<U>() ) ) == sizeof( yes_type ) > { }; diff --git a/3rdParty/Boost/src/boost/type_traits/detail/cv_traits_impl.hpp b/3rdParty/Boost/src/boost/type_traits/detail/cv_traits_impl.hpp index b3fa595..ed20c9d 100644 --- a/3rdParty/Boost/src/boost/type_traits/detail/cv_traits_impl.hpp +++ b/3rdParty/Boost/src/boost/type_traits/detail/cv_traits_impl.hpp @@ -77,7 +77,7 @@ namespace detail { // Use the implementation above for non function pointers template <typename T, unsigned Select = (unsigned)sizeof(::boost::type_traits::gcc8503::mini_funcptr_tester((T)0)) > -struct cv_traits_imp : ::boost::type_traits::gcc8503::cv_traits_imp<T> { }; +struct cv_traits_imp : public ::boost::type_traits::gcc8503::cv_traits_imp<T> { }; // Functions are never cv-qualified template <typename T> struct cv_traits_imp<T*,1> diff --git a/3rdParty/Boost/src/boost/type_traits/detail/has_binary_operator.hpp b/3rdParty/Boost/src/boost/type_traits/detail/has_binary_operator.hpp new file mode 100644 index 0000000..9257bc2 --- /dev/null +++ b/3rdParty/Boost/src/boost/type_traits/detail/has_binary_operator.hpp @@ -0,0 +1,229 @@ +// (C) Copyright 2009-2011 Frederic Bron, Robert Stewart, Steven Watanabe & Roman Perepelitsa. +// +// 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/type_traits for most recent version including documentation. + +#include <boost/config.hpp> +#include <boost/type_traits/ice.hpp> +#include <boost/type_traits/integral_constant.hpp> +#include <boost/type_traits/is_base_of.hpp> +#include <boost/type_traits/is_const.hpp> +#include <boost/type_traits/is_convertible.hpp> +#include <boost/type_traits/is_fundamental.hpp> +#include <boost/type_traits/is_integral.hpp> +#include <boost/type_traits/is_pointer.hpp> +#include <boost/type_traits/is_same.hpp> +#include <boost/type_traits/is_void.hpp> +#include <boost/type_traits/remove_cv.hpp> +#include <boost/type_traits/remove_pointer.hpp> +#include <boost/type_traits/remove_reference.hpp> + +// should be the last #include +#include <boost/type_traits/detail/bool_trait_def.hpp> + +// cannot include this header without getting warnings of the kind: +// gcc: +// warning: value computed is not used +// warning: comparison between signed and unsigned integer expressions +// msvc: +// warning C4018: '<' : signed/unsigned mismatch +// warning C4244: '+=' : conversion from 'double' to 'char', possible loss of data +// warning C4547: '*' : operator before comma has no effect; expected operator with side-effect +// warning C4800: 'int' : forcing value to bool 'true' or 'false' (performance warning) +// warning C4804: '<' : unsafe use of type 'bool' in operation +// warning C4805: '==' : unsafe mix of type 'bool' and type 'char' in operation +// cannot find another implementation -> declared as system header to suppress these warnings. +#if defined(__GNUC__) && ((__GNUC__==3 && __GNUC_MINOR__>=1) || (__GNUC__>3)) +# pragma GCC system_header +#elif defined(BOOST_MSVC) +# pragma warning ( push ) +# pragma warning ( disable : 4018 4244 4547 4800 4804 4805 4913 ) +#endif + +namespace boost { +namespace detail { + +// This namespace ensures that argument-dependent name lookup does not mess things up. +namespace BOOST_JOIN(BOOST_TT_TRAIT_NAME,_impl) { + +// 1. a function to have an instance of type T without requiring T to be default +// constructible +template <typename T> T &make(); + + +// 2. we provide our operator definition for types that do not have one already + +// a type returned from operator BOOST_TT_TRAIT_OP when no such operator is +// found in the type's own namespace (our own operator is used) so that we have +// a means to know that our operator was used +struct no_operator { }; + +// this class allows implicit conversions and makes the following operator +// definition less-preferred than any other such operators that might be found +// via argument-dependent name lookup +struct any { template <class T> any(T const&); }; + +// when operator BOOST_TT_TRAIT_OP is not available, this one is used +no_operator operator BOOST_TT_TRAIT_OP (const any&, const any&); + + +// 3. checks if the operator returns void or not +// conditions: Lhs!=void and Rhs!=void + +// we first redefine "operator," so that we have no compilation error if +// operator BOOST_TT_TRAIT_OP returns void and we can use the return type of +// (lhs BOOST_TT_TRAIT_OP rhs, returns_void_t()) to deduce if +// operator BOOST_TT_TRAIT_OP returns void or not: +// - operator BOOST_TT_TRAIT_OP returns void -> (lhs BOOST_TT_TRAIT_OP rhs, returns_void_t()) returns returns_void_t +// - operator BOOST_TT_TRAIT_OP returns !=void -> (lhs BOOST_TT_TRAIT_OP rhs, returns_void_t()) returns int +struct returns_void_t { }; +template <typename T> int operator,(const T&, returns_void_t); +template <typename T> int operator,(const volatile T&, returns_void_t); + +// this intermediate trait has member value of type bool: +// - value==true -> operator BOOST_TT_TRAIT_OP returns void +// - value==false -> operator BOOST_TT_TRAIT_OP does not return void +template < typename Lhs, typename Rhs > +struct operator_returns_void { + // overloads of function returns_void make the difference + // yes_type and no_type have different size by construction + static ::boost::type_traits::yes_type returns_void(returns_void_t); + static ::boost::type_traits::no_type returns_void(int); + BOOST_STATIC_CONSTANT(bool, value = (sizeof(::boost::type_traits::yes_type)==sizeof(returns_void((make<Lhs>() BOOST_TT_TRAIT_OP make<Rhs>(),returns_void_t()))))); +}; + + +// 4. checks if the return type is Ret or Ret==dont_care +// conditions: Lhs!=void and Rhs!=void + +struct dont_care { }; + +template < typename Lhs, typename Rhs, typename Ret, bool Returns_void > +struct operator_returns_Ret; + +template < typename Lhs, typename Rhs > +struct operator_returns_Ret < Lhs, Rhs, dont_care, true > { + BOOST_STATIC_CONSTANT(bool, value = true); +}; + +template < typename Lhs, typename Rhs > +struct operator_returns_Ret < Lhs, Rhs, dont_care, false > { + BOOST_STATIC_CONSTANT(bool, value = true); +}; + +template < typename Lhs, typename Rhs > +struct operator_returns_Ret < Lhs, Rhs, void, true > { + BOOST_STATIC_CONSTANT(bool, value = true); +}; + +template < typename Lhs, typename Rhs > +struct operator_returns_Ret < Lhs, Rhs, void, false > { + BOOST_STATIC_CONSTANT(bool, value = false); +}; + +template < typename Lhs, typename Rhs, typename Ret > +struct operator_returns_Ret < Lhs, Rhs, Ret, true > { + BOOST_STATIC_CONSTANT(bool, value = false); +}; + +// otherwise checks if it is convertible to Ret using the sizeof trick +// based on overload resolution +// condition: Ret!=void and Ret!=dont_care and the operator does not return void +template < typename Lhs, typename Rhs, typename Ret > +struct operator_returns_Ret < Lhs, Rhs, Ret, false > { + static ::boost::type_traits::yes_type is_convertible_to_Ret(Ret); // this version is preferred for types convertible to Ret + static ::boost::type_traits::no_type is_convertible_to_Ret(...); // this version is used otherwise + + BOOST_STATIC_CONSTANT(bool, value = (sizeof(is_convertible_to_Ret(make<Lhs>() BOOST_TT_TRAIT_OP make<Rhs>()))==sizeof(::boost::type_traits::yes_type))); +}; + + +// 5. checks for operator existence +// condition: Lhs!=void and Rhs!=void + +// checks if our definition of operator BOOST_TT_TRAIT_OP is used or an other +// existing one; +// this is done with redefinition of "operator," that returns no_operator or has_operator +struct has_operator { }; +no_operator operator,(no_operator, has_operator); + +template < typename Lhs, typename Rhs > +struct operator_exists { + static ::boost::type_traits::yes_type check(has_operator); // this version is preferred when operator exists + static ::boost::type_traits::no_type check(no_operator); // this version is used otherwise + + BOOST_STATIC_CONSTANT(bool, value = (sizeof(check(((make<Lhs>() BOOST_TT_TRAIT_OP make<Rhs>()),make<has_operator>())))==sizeof(::boost::type_traits::yes_type))); +}; + + +// 6. main trait: to avoid any compilation error, this class behaves +// differently when operator BOOST_TT_TRAIT_OP(Lhs, Rhs) is forbidden by the +// standard. +// Forbidden_if is a bool that is: +// - true when the operator BOOST_TT_TRAIT_OP(Lhs, Rhs) is forbidden by the standard +// (would yield compilation error if used) +// - false otherwise +template < typename Lhs, typename Rhs, typename Ret, bool Forbidden_if > +struct trait_impl1; + +template < typename Lhs, typename Rhs, typename Ret > +struct trait_impl1 < Lhs, Rhs, Ret, true > { + BOOST_STATIC_CONSTANT(bool, value = false); +}; + +template < typename Lhs, typename Rhs, typename Ret > +struct trait_impl1 < Lhs, Rhs, Ret, false > { + BOOST_STATIC_CONSTANT(bool, + value = ( + ::boost::type_traits::ice_and< + operator_exists < Lhs, Rhs >::value, + operator_returns_Ret < Lhs, Rhs, Ret, operator_returns_void < Lhs, Rhs >::value >::value + >::value + ) + ); +}; + +// some specializations needs to be declared for the special void case +template < typename Rhs, typename Ret > +struct trait_impl1 < void, Rhs, Ret, false > { + BOOST_STATIC_CONSTANT(bool, value = false); +}; + +template < typename Lhs, typename Ret > +struct trait_impl1 < Lhs, void, Ret, false > { + BOOST_STATIC_CONSTANT(bool, value = false); +}; + +template < typename Ret > +struct trait_impl1 < void, void, Ret, false > { + BOOST_STATIC_CONSTANT(bool, value = false); +}; + +// defines some typedef for convenience +template < typename Lhs, typename Rhs, typename Ret > +struct trait_impl { + typedef typename ::boost::remove_reference<Lhs>::type Lhs_noref; + typedef typename ::boost::remove_reference<Rhs>::type Rhs_noref; + typedef typename ::boost::remove_cv<Lhs_noref>::type Lhs_nocv; + typedef typename ::boost::remove_cv<Rhs_noref>::type Rhs_nocv; + typedef typename ::boost::remove_cv< typename ::boost::remove_reference< typename ::boost::remove_pointer<Lhs_noref>::type >::type >::type Lhs_noptr; + typedef typename ::boost::remove_cv< typename ::boost::remove_reference< typename ::boost::remove_pointer<Rhs_noref>::type >::type >::type Rhs_noptr; + BOOST_STATIC_CONSTANT(bool, value = (trait_impl1 < Lhs_noref, Rhs_noref, Ret, BOOST_TT_FORBIDDEN_IF >::value)); +}; + +} // namespace impl +} // namespace detail + +// this is the accessible definition of the trait to end user +BOOST_TT_AUX_BOOL_TRAIT_DEF3(BOOST_TT_TRAIT_NAME, Lhs, Rhs=Lhs, Ret=::boost::detail::BOOST_JOIN(BOOST_TT_TRAIT_NAME,_impl)::dont_care, (::boost::detail::BOOST_JOIN(BOOST_TT_TRAIT_NAME,_impl)::trait_impl < Lhs, Rhs, Ret >::value)) + +} // namespace boost + +#if defined(BOOST_MSVC) +# pragma warning ( pop ) +#endif + +#include <boost/type_traits/detail/bool_trait_undef.hpp> diff --git a/3rdParty/Boost/src/boost/type_traits/detail/has_postfix_operator.hpp b/3rdParty/Boost/src/boost/type_traits/detail/has_postfix_operator.hpp new file mode 100644 index 0000000..5c52b07 --- /dev/null +++ b/3rdParty/Boost/src/boost/type_traits/detail/has_postfix_operator.hpp @@ -0,0 +1,202 @@ +// (C) Copyright 2009-2011 Frederic Bron, Robert Stewart, Steven Watanabe & Roman Perepelitsa. +// +// 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/type_traits for most recent version including documentation. + +#include <boost/config.hpp> +#include <boost/type_traits/ice.hpp> +#include <boost/type_traits/integral_constant.hpp> +#include <boost/type_traits/is_const.hpp> +#include <boost/type_traits/is_fundamental.hpp> +#include <boost/type_traits/is_pointer.hpp> +#include <boost/type_traits/is_same.hpp> +#include <boost/type_traits/is_void.hpp> +#include <boost/type_traits/remove_cv.hpp> +#include <boost/type_traits/remove_pointer.hpp> +#include <boost/type_traits/remove_reference.hpp> + +// should be the last #include +#include <boost/type_traits/detail/bool_trait_def.hpp> + +// avoid warnings +#if defined(__GNUC__) && ((__GNUC__==3 && __GNUC_MINOR__>=1) || (__GNUC__>3)) +# pragma GCC system_header +#elif defined(BOOST_MSVC) +# pragma warning ( push ) +# pragma warning ( disable : 4244 4913 ) +#endif + +namespace boost { +namespace detail { + +// This namespace ensures that argument-dependent name lookup does not mess things up. +namespace BOOST_JOIN(BOOST_TT_TRAIT_NAME,_impl) { + +// 1. a function to have an instance of type T without requiring T to be default +// constructible +template <typename T> T &make(); + + +// 2. we provide our operator definition for types that do not have one already + +// a type returned from operator BOOST_TT_TRAIT_OP when no such operator is +// found in the type's own namespace (our own operator is used) so that we have +// a means to know that our operator was used +struct no_operator { }; + +// this class allows implicit conversions and makes the following operator +// definition less-preferred than any other such operators that might be found +// via argument-dependent name lookup +struct any { template <class T> any(T const&); }; + +// when operator BOOST_TT_TRAIT_OP is not available, this one is used +no_operator operator BOOST_TT_TRAIT_OP (const any&, int); + + +// 3. checks if the operator returns void or not +// conditions: Lhs!=void + +// we first redefine "operator," so that we have no compilation error if +// operator BOOST_TT_TRAIT_OP returns void and we can use the return type of +// (lhs BOOST_TT_TRAIT_OP, returns_void_t()) to deduce if +// operator BOOST_TT_TRAIT_OP returns void or not: +// - operator BOOST_TT_TRAIT_OP returns void -> (lhs BOOST_TT_TRAIT_OP, returns_void_t()) returns returns_void_t +// - operator BOOST_TT_TRAIT_OP returns !=void -> (lhs BOOST_TT_TRAIT_OP, returns_void_t()) returns int +struct returns_void_t { }; +template <typename T> int operator,(const T&, returns_void_t); +template <typename T> int operator,(const volatile T&, returns_void_t); + +// this intermediate trait has member value of type bool: +// - value==true -> operator BOOST_TT_TRAIT_OP returns void +// - value==false -> operator BOOST_TT_TRAIT_OP does not return void +template < typename Lhs > +struct operator_returns_void { + // overloads of function returns_void make the difference + // yes_type and no_type have different size by construction + static ::boost::type_traits::yes_type returns_void(returns_void_t); + static ::boost::type_traits::no_type returns_void(int); + BOOST_STATIC_CONSTANT(bool, value = (sizeof(::boost::type_traits::yes_type)==sizeof(returns_void((make<Lhs>() BOOST_TT_TRAIT_OP,returns_void_t()))))); +}; + + +// 4. checks if the return type is Ret or Ret==dont_care +// conditions: Lhs!=void + +struct dont_care { }; + +template < typename Lhs, typename Ret, bool Returns_void > +struct operator_returns_Ret; + +template < typename Lhs > +struct operator_returns_Ret < Lhs, dont_care, true > { + BOOST_STATIC_CONSTANT(bool, value = true); +}; + +template < typename Lhs > +struct operator_returns_Ret < Lhs, dont_care, false > { + BOOST_STATIC_CONSTANT(bool, value = true); +}; + +template < typename Lhs > +struct operator_returns_Ret < Lhs, void, true > { + BOOST_STATIC_CONSTANT(bool, value = true); +}; + +template < typename Lhs > +struct operator_returns_Ret < Lhs, void, false > { + BOOST_STATIC_CONSTANT(bool, value = false); +}; + +template < typename Lhs, typename Ret > +struct operator_returns_Ret < Lhs, Ret, true > { + BOOST_STATIC_CONSTANT(bool, value = false); +}; + +// otherwise checks if it is convertible to Ret using the sizeof trick +// based on overload resolution +// condition: Ret!=void and Ret!=dont_care and the operator does not return void +template < typename Lhs, typename Ret > +struct operator_returns_Ret < Lhs, Ret, false > { + static ::boost::type_traits::yes_type is_convertible_to_Ret(Ret); // this version is preferred for types convertible to Ret + static ::boost::type_traits::no_type is_convertible_to_Ret(...); // this version is used otherwise + + BOOST_STATIC_CONSTANT(bool, value = (sizeof(is_convertible_to_Ret(make<Lhs>() BOOST_TT_TRAIT_OP))==sizeof(::boost::type_traits::yes_type))); +}; + + +// 5. checks for operator existence +// condition: Lhs!=void + +// checks if our definition of operator BOOST_TT_TRAIT_OP is used or an other +// existing one; +// this is done with redefinition of "operator," that returns no_operator or has_operator +struct has_operator { }; +no_operator operator,(no_operator, has_operator); + +template < typename Lhs > +struct operator_exists { + static ::boost::type_traits::yes_type check(has_operator); // this version is preferred when operator exists + static ::boost::type_traits::no_type check(no_operator); // this version is used otherwise + + BOOST_STATIC_CONSTANT(bool, value = (sizeof(check(((make<Lhs>() BOOST_TT_TRAIT_OP),make<has_operator>())))==sizeof(::boost::type_traits::yes_type))); +}; + + +// 6. main trait: to avoid any compilation error, this class behaves +// differently when operator BOOST_TT_TRAIT_OP(Lhs) is forbidden by the +// standard. +// Forbidden_if is a bool that is: +// - true when the operator BOOST_TT_TRAIT_OP(Lhs) is forbidden by the standard +// (would yield compilation error if used) +// - false otherwise +template < typename Lhs, typename Ret, bool Forbidden_if > +struct trait_impl1; + +template < typename Lhs, typename Ret > +struct trait_impl1 < Lhs, Ret, true > { + BOOST_STATIC_CONSTANT(bool, value = false); +}; + +template < typename Lhs, typename Ret > +struct trait_impl1 < Lhs, Ret, false > { + BOOST_STATIC_CONSTANT(bool, + value = ( + ::boost::type_traits::ice_and< + operator_exists < Lhs >::value, + operator_returns_Ret < Lhs, Ret, operator_returns_void < Lhs >::value >::value + >::value + ) + ); +}; + +// specialization needs to be declared for the special void case +template < typename Ret > +struct trait_impl1 < void, Ret, false > { + BOOST_STATIC_CONSTANT(bool, value = false); +}; + +// defines some typedef for convenience +template < typename Lhs, typename Ret > +struct trait_impl { + typedef typename ::boost::remove_reference<Lhs>::type Lhs_noref; + typedef typename ::boost::remove_cv<Lhs_noref>::type Lhs_nocv; + typedef typename ::boost::remove_cv< typename ::boost::remove_reference< typename ::boost::remove_pointer<Lhs_noref>::type >::type >::type Lhs_noptr; + BOOST_STATIC_CONSTANT(bool, value = (trait_impl1 < Lhs_noref, Ret, BOOST_TT_FORBIDDEN_IF >::value)); +}; + +} // namespace impl +} // namespace detail + +// this is the accessible definition of the trait to end user +BOOST_TT_AUX_BOOL_TRAIT_DEF2(BOOST_TT_TRAIT_NAME, Lhs, Ret=::boost::detail::BOOST_JOIN(BOOST_TT_TRAIT_NAME,_impl)::dont_care, (::boost::detail::BOOST_JOIN(BOOST_TT_TRAIT_NAME,_impl)::trait_impl< Lhs, Ret >::value)) + +} // namespace boost + +#if defined(BOOST_MSVC) +# pragma warning ( pop ) +#endif + +#include <boost/type_traits/detail/bool_trait_undef.hpp> diff --git a/3rdParty/Boost/src/boost/type_traits/detail/has_prefix_operator.hpp b/3rdParty/Boost/src/boost/type_traits/detail/has_prefix_operator.hpp new file mode 100644 index 0000000..ac30e4d --- /dev/null +++ b/3rdParty/Boost/src/boost/type_traits/detail/has_prefix_operator.hpp @@ -0,0 +1,210 @@ +// (C) Copyright 2009-2011 Frederic Bron, Robert Stewart, Steven Watanabe & Roman Perepelitsa. +// +// 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/type_traits for most recent version including documentation. + +#include <boost/config.hpp> +#include <boost/type_traits/ice.hpp> +#include <boost/type_traits/integral_constant.hpp> +#include <boost/type_traits/is_const.hpp> +#include <boost/type_traits/is_fundamental.hpp> +#include <boost/type_traits/is_integral.hpp> +#include <boost/type_traits/is_pointer.hpp> +#include <boost/type_traits/is_same.hpp> +#include <boost/type_traits/is_void.hpp> +#include <boost/type_traits/remove_cv.hpp> +#include <boost/type_traits/remove_pointer.hpp> +#include <boost/type_traits/remove_reference.hpp> + +// should be the last #include +#include <boost/type_traits/detail/bool_trait_def.hpp> + +// cannot include this header without getting warnings of the kind: +// gcc: +// warning: value computed is not used +// warning: comparison between signed and unsigned integer expressions +// msvc: +// warning C4146: unary minus operator applied to unsigned type, result still unsigned +// warning C4804: '-' : unsafe use of type 'bool' in operation +// cannot find another implementation -> declared as system header to suppress these warnings. +#if defined(__GNUC__) && ((__GNUC__==3 && __GNUC_MINOR__>=1) || (__GNUC__>3)) +# pragma GCC system_header +#elif defined(BOOST_MSVC) +# pragma warning ( push ) +# pragma warning ( disable : 4146 4804 4913 4244 ) +#endif + +namespace boost { +namespace detail { + +// This namespace ensures that argument-dependent name lookup does not mess things up. +namespace BOOST_JOIN(BOOST_TT_TRAIT_NAME,_impl) { + +// 1. a function to have an instance of type T without requiring T to be default +// constructible +template <typename T> T &make(); + + +// 2. we provide our operator definition for types that do not have one already + +// a type returned from operator BOOST_TT_TRAIT_OP when no such operator is +// found in the type's own namespace (our own operator is used) so that we have +// a means to know that our operator was used +struct no_operator { }; + +// this class allows implicit conversions and makes the following operator +// definition less-preferred than any other such operators that might be found +// via argument-dependent name lookup +struct any { template <class T> any(T const&); }; + +// when operator BOOST_TT_TRAIT_OP is not available, this one is used +no_operator operator BOOST_TT_TRAIT_OP (const any&); + + +// 3. checks if the operator returns void or not +// conditions: Rhs!=void + +// we first redefine "operator," so that we have no compilation error if +// operator BOOST_TT_TRAIT_OP returns void and we can use the return type of +// (BOOST_TT_TRAIT_OP rhs, returns_void_t()) to deduce if +// operator BOOST_TT_TRAIT_OP returns void or not: +// - operator BOOST_TT_TRAIT_OP returns void -> (BOOST_TT_TRAIT_OP rhs, returns_void_t()) returns returns_void_t +// - operator BOOST_TT_TRAIT_OP returns !=void -> (BOOST_TT_TRAIT_OP rhs, returns_void_t()) returns int +struct returns_void_t { }; +template <typename T> int operator,(const T&, returns_void_t); +template <typename T> int operator,(const volatile T&, returns_void_t); + +// this intermediate trait has member value of type bool: +// - value==true -> operator BOOST_TT_TRAIT_OP returns void +// - value==false -> operator BOOST_TT_TRAIT_OP does not return void +template < typename Rhs > +struct operator_returns_void { + // overloads of function returns_void make the difference + // yes_type and no_type have different size by construction + static ::boost::type_traits::yes_type returns_void(returns_void_t); + static ::boost::type_traits::no_type returns_void(int); + BOOST_STATIC_CONSTANT(bool, value = (sizeof(::boost::type_traits::yes_type)==sizeof(returns_void((BOOST_TT_TRAIT_OP make<Rhs>(),returns_void_t()))))); +}; + + +// 4. checks if the return type is Ret or Ret==dont_care +// conditions: Rhs!=void + +struct dont_care { }; + +template < typename Rhs, typename Ret, bool Returns_void > +struct operator_returns_Ret; + +template < typename Rhs > +struct operator_returns_Ret < Rhs, dont_care, true > { + BOOST_STATIC_CONSTANT(bool, value = true); +}; + +template < typename Rhs > +struct operator_returns_Ret < Rhs, dont_care, false > { + BOOST_STATIC_CONSTANT(bool, value = true); +}; + +template < typename Rhs > +struct operator_returns_Ret < Rhs, void, true > { + BOOST_STATIC_CONSTANT(bool, value = true); +}; + +template < typename Rhs > +struct operator_returns_Ret < Rhs, void, false > { + BOOST_STATIC_CONSTANT(bool, value = false); +}; + +template < typename Rhs, typename Ret > +struct operator_returns_Ret < Rhs, Ret, true > { + BOOST_STATIC_CONSTANT(bool, value = false); +}; + +// otherwise checks if it is convertible to Ret using the sizeof trick +// based on overload resolution +// condition: Ret!=void and Ret!=dont_care and the operator does not return void +template < typename Rhs, typename Ret > +struct operator_returns_Ret < Rhs, Ret, false > { + static ::boost::type_traits::yes_type is_convertible_to_Ret(Ret); // this version is preferred for types convertible to Ret + static ::boost::type_traits::no_type is_convertible_to_Ret(...); // this version is used otherwise + + BOOST_STATIC_CONSTANT(bool, value = (sizeof(is_convertible_to_Ret(BOOST_TT_TRAIT_OP make<Rhs>()))==sizeof(::boost::type_traits::yes_type))); +}; + + +// 5. checks for operator existence +// condition: Rhs!=void + +// checks if our definition of operator BOOST_TT_TRAIT_OP is used or an other +// existing one; +// this is done with redefinition of "operator," that returns no_operator or has_operator +struct has_operator { }; +no_operator operator,(no_operator, has_operator); + +template < typename Rhs > +struct operator_exists { + static ::boost::type_traits::yes_type check(has_operator); // this version is preferred when operator exists + static ::boost::type_traits::no_type check(no_operator); // this version is used otherwise + + BOOST_STATIC_CONSTANT(bool, value = (sizeof(check(((BOOST_TT_TRAIT_OP make<Rhs>()),make<has_operator>())))==sizeof(::boost::type_traits::yes_type))); +}; + + +// 6. main trait: to avoid any compilation error, this class behaves +// differently when operator BOOST_TT_TRAIT_OP(Rhs) is forbidden by the +// standard. +// Forbidden_if is a bool that is: +// - true when the operator BOOST_TT_TRAIT_OP(Rhs) is forbidden by the standard +// (would yield compilation error if used) +// - false otherwise +template < typename Rhs, typename Ret, bool Forbidden_if > +struct trait_impl1; + +template < typename Rhs, typename Ret > +struct trait_impl1 < Rhs, Ret, true > { + BOOST_STATIC_CONSTANT(bool, value = false); +}; + +template < typename Rhs, typename Ret > +struct trait_impl1 < Rhs, Ret, false > { + BOOST_STATIC_CONSTANT(bool, + value = ( + ::boost::type_traits::ice_and< + operator_exists < Rhs >::value, + operator_returns_Ret < Rhs, Ret, operator_returns_void < Rhs >::value >::value + >::value + ) + ); +}; + +// specialization needs to be declared for the special void case +template < typename Ret > +struct trait_impl1 < void, Ret, false > { + BOOST_STATIC_CONSTANT(bool, value = false); +}; + +// defines some typedef for convenience +template < typename Rhs, typename Ret > +struct trait_impl { + typedef typename ::boost::remove_reference<Rhs>::type Rhs_noref; + typedef typename ::boost::remove_cv<Rhs_noref>::type Rhs_nocv; + typedef typename ::boost::remove_cv< typename ::boost::remove_reference< typename ::boost::remove_pointer<Rhs_noref>::type >::type >::type Rhs_noptr; + BOOST_STATIC_CONSTANT(bool, value = (trait_impl1 < Rhs_noref, Ret, BOOST_TT_FORBIDDEN_IF >::value)); +}; + +} // namespace impl +} // namespace detail + +// this is the accessible definition of the trait to end user +BOOST_TT_AUX_BOOL_TRAIT_DEF2(BOOST_TT_TRAIT_NAME, Rhs, Ret=::boost::detail::BOOST_JOIN(BOOST_TT_TRAIT_NAME,_impl)::dont_care, (::boost::detail::BOOST_JOIN(BOOST_TT_TRAIT_NAME,_impl)::trait_impl < Rhs, Ret >::value)) + +} // namespace boost + +#if defined(BOOST_MSVC) +# pragma warning ( pop ) +#endif + +#include <boost/type_traits/detail/bool_trait_undef.hpp> diff --git a/3rdParty/Boost/src/boost/type_traits/detail/size_t_trait_def.hpp b/3rdParty/Boost/src/boost/type_traits/detail/size_t_trait_def.hpp index 472c6ac..3be4f70 100644 --- a/3rdParty/Boost/src/boost/type_traits/detail/size_t_trait_def.hpp +++ b/3rdParty/Boost/src/boost/type_traits/detail/size_t_trait_def.hpp @@ -8,8 +8,8 @@ // http://www.boost.org/LICENSE_1_0.txt) // $Source$ -// $Date: 2005-08-25 12:27:28 -0400 (Thu, 25 Aug 2005) $ -// $Revision: 30670 $ +// $Date: 2011-04-25 05:26:48 -0700 (Mon, 25 Apr 2011) $ +// $Revision: 71481 $ #include <boost/type_traits/detail/template_arity_spec.hpp> #include <boost/type_traits/integral_constant.hpp> @@ -19,10 +19,10 @@ #include <cstddef> #if !defined(BOOST_MSVC) || BOOST_MSVC >= 1300 -# define BOOST_TT_AUX_SIZE_T_BASE(C) ::boost::integral_constant<std::size_t,C> +# define BOOST_TT_AUX_SIZE_T_BASE(C) public ::boost::integral_constant<std::size_t,C> # define BOOST_TT_AUX_SIZE_T_TRAIT_VALUE_DECL(C) /**/ #else -# define BOOST_TT_AUX_SIZE_T_BASE(C) ::boost::mpl::size_t<C> +# define BOOST_TT_AUX_SIZE_T_BASE(C) public ::boost::mpl::size_t<C> # define BOOST_TT_AUX_SIZE_T_TRAIT_VALUE_DECL(C) \ typedef ::boost::mpl::size_t<C> base_; \ using base_::value; \ @@ -34,6 +34,7 @@ template< typename T > struct trait \ : BOOST_TT_AUX_SIZE_T_BASE(C) \ { \ +public:\ BOOST_TT_AUX_SIZE_T_TRAIT_VALUE_DECL(C) \ BOOST_MPL_AUX_LAMBDA_SUPPORT(1,trait,(T)) \ }; \ @@ -45,6 +46,7 @@ BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(1,trait) \ template<> struct trait<spec> \ : BOOST_TT_AUX_SIZE_T_BASE(C) \ { \ +public:\ BOOST_TT_AUX_SIZE_T_TRAIT_VALUE_DECL(C) \ BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(1,trait,(spec)) \ }; \ diff --git a/3rdParty/Boost/src/boost/type_traits/detail/size_t_trait_undef.hpp b/3rdParty/Boost/src/boost/type_traits/detail/size_t_trait_undef.hpp index 06a176d..967fd91 100644 --- a/3rdParty/Boost/src/boost/type_traits/detail/size_t_trait_undef.hpp +++ b/3rdParty/Boost/src/boost/type_traits/detail/size_t_trait_undef.hpp @@ -8,7 +8,7 @@ // http://www.boost.org/LICENSE_1_0.txt) // $Source$ -// $Date: 2004-09-02 11:41:37 -0400 (Thu, 02 Sep 2004) $ +// $Date: 2004-09-02 08:41:37 -0700 (Thu, 02 Sep 2004) $ // $Revision: 24874 $ #undef BOOST_TT_AUX_SIZE_T_TRAIT_DEF1 diff --git a/3rdParty/Boost/src/boost/type_traits/detail/type_trait_def.hpp b/3rdParty/Boost/src/boost/type_traits/detail/type_trait_def.hpp index 644c7ac..224f848 100644 --- a/3rdParty/Boost/src/boost/type_traits/detail/type_trait_def.hpp +++ b/3rdParty/Boost/src/boost/type_traits/detail/type_trait_def.hpp @@ -8,8 +8,8 @@ // http://www.boost.org/LICENSE_1_0.txt) // $Source$ -// $Date: 2004-09-02 11:41:37 -0400 (Thu, 02 Sep 2004) $ -// $Revision: 24874 $ +// $Date: 2011-04-25 05:26:48 -0700 (Mon, 25 Apr 2011) $ +// $Revision: 71481 $ #include <boost/type_traits/detail/template_arity_spec.hpp> #include <boost/mpl/aux_/lambda_support.hpp> @@ -17,6 +17,7 @@ #define BOOST_TT_AUX_TYPE_TRAIT_DEF1(trait,T,result) \ template< typename T > struct trait \ { \ +public:\ typedef result type; \ BOOST_MPL_AUX_LAMBDA_SUPPORT(1,trait,(T)) \ }; \ @@ -27,6 +28,7 @@ BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(1,trait) \ #define BOOST_TT_AUX_TYPE_TRAIT_SPEC1(trait,spec,result) \ template<> struct trait<spec> \ { \ +public:\ typedef result type; \ BOOST_MPL_AUX_LAMBDA_SUPPORT_SPEC(1,trait,(spec)) \ }; \ @@ -35,6 +37,7 @@ template<> struct trait<spec> \ #define BOOST_TT_AUX_TYPE_TRAIT_IMPL_SPEC1(trait,spec,result) \ template<> struct trait##_impl<spec> \ { \ +public:\ typedef result type; \ }; \ /**/ @@ -42,6 +45,7 @@ template<> struct trait##_impl<spec> \ #define BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(param,trait,spec,result) \ template< param > struct trait<spec> \ { \ +public:\ typedef result type; \ }; \ /**/ @@ -49,6 +53,7 @@ template< param > struct trait<spec> \ #define BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_2(param1,param2,trait,spec,result) \ template< param1, param2 > struct trait<spec> \ { \ +public:\ typedef result; \ }; \ /**/ @@ -56,6 +61,7 @@ template< param1, param2 > struct trait<spec> \ #define BOOST_TT_AUX_TYPE_TRAIT_IMPL_PARTIAL_SPEC1_1(param,trait,spec,result) \ template< param > struct trait##_impl<spec> \ { \ +public:\ typedef result type; \ }; \ /**/ diff --git a/3rdParty/Boost/src/boost/type_traits/detail/type_trait_undef.hpp b/3rdParty/Boost/src/boost/type_traits/detail/type_trait_undef.hpp index 9403b9b..c4f14ff 100644 --- a/3rdParty/Boost/src/boost/type_traits/detail/type_trait_undef.hpp +++ b/3rdParty/Boost/src/boost/type_traits/detail/type_trait_undef.hpp @@ -8,7 +8,7 @@ // http://www.boost.org/LICENSE_1_0.txt) // $Source$ -// $Date: 2004-09-02 11:41:37 -0400 (Thu, 02 Sep 2004) $ +// $Date: 2004-09-02 08:41:37 -0700 (Thu, 02 Sep 2004) $ // $Revision: 24874 $ #undef BOOST_TT_AUX_TYPE_TRAIT_DEF1 diff --git a/3rdParty/Boost/src/boost/type_traits/has_bit_and.hpp b/3rdParty/Boost/src/boost/type_traits/has_bit_and.hpp new file mode 100644 index 0000000..ee3307f --- /dev/null +++ b/3rdParty/Boost/src/boost/type_traits/has_bit_and.hpp @@ -0,0 +1,49 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// 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/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_BIT_AND_HPP_INCLUDED +#define BOOST_TT_HAS_BIT_AND_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_bit_and +#define BOOST_TT_TRAIT_OP & +#define BOOST_TT_FORBIDDEN_IF\ + ::boost::type_traits::ice_or<\ + /* Lhs==fundamental and Rhs==fundamental and (Lhs!=integral or Rhs!=integral) */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::type_traits::ice_or<\ + ::boost::type_traits::ice_not< ::boost::is_integral< Lhs_noref >::value >::value,\ + ::boost::type_traits::ice_not< ::boost::is_integral< Rhs_noref >::value >::value\ + >::value\ + >::value,\ + /* Lhs==fundamental and Rhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value,\ + /* Rhs==fundamental and Lhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::is_pointer< Lhs_noref >::value\ + >::value,\ + /* Lhs==pointer and Rhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value\ + >::value + + +#include <boost/type_traits/detail/has_binary_operator.hpp> + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/3rdParty/Boost/src/boost/type_traits/has_bit_and_assign.hpp b/3rdParty/Boost/src/boost/type_traits/has_bit_and_assign.hpp new file mode 100644 index 0000000..5b3112a --- /dev/null +++ b/3rdParty/Boost/src/boost/type_traits/has_bit_and_assign.hpp @@ -0,0 +1,55 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// 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/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_BIT_AND_ASSIGN_HPP_INCLUDED +#define BOOST_TT_HAS_BIT_AND_ASSIGN_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_bit_and_assign +#define BOOST_TT_TRAIT_OP &= +#define BOOST_TT_FORBIDDEN_IF\ + ::boost::type_traits::ice_or<\ + /* Lhs==fundamental and Rhs==fundamental and (Lhs!=integral or Rhs!=integral) */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::type_traits::ice_or<\ + ::boost::type_traits::ice_not< ::boost::is_integral< Lhs_noref >::value >::value,\ + ::boost::type_traits::ice_not< ::boost::is_integral< Rhs_noref >::value >::value\ + >::value\ + >::value,\ + /* Lhs==fundamental and Rhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value,\ + /* Rhs==fundamental and Lhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::is_pointer< Lhs_noref >::value\ + >::value,\ + /* Lhs==pointer and Rhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value,\ + /* Lhs==fundamental and Rhs==fundamental and Lhs==const */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::is_const< Lhs_noref >::value\ + >::value\ + >::value + + +#include <boost/type_traits/detail/has_binary_operator.hpp> + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/3rdParty/Boost/src/boost/type_traits/has_bit_or.hpp b/3rdParty/Boost/src/boost/type_traits/has_bit_or.hpp new file mode 100644 index 0000000..922b4ce --- /dev/null +++ b/3rdParty/Boost/src/boost/type_traits/has_bit_or.hpp @@ -0,0 +1,49 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// 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/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_BIT_OR_HPP_INCLUDED +#define BOOST_TT_HAS_BIT_OR_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_bit_or +#define BOOST_TT_TRAIT_OP | +#define BOOST_TT_FORBIDDEN_IF\ + ::boost::type_traits::ice_or<\ + /* Lhs==fundamental and Rhs==fundamental and (Lhs!=integral or Rhs!=integral) */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::type_traits::ice_or<\ + ::boost::type_traits::ice_not< ::boost::is_integral< Lhs_noref >::value >::value,\ + ::boost::type_traits::ice_not< ::boost::is_integral< Rhs_noref >::value >::value\ + >::value\ + >::value,\ + /* Lhs==fundamental and Rhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value,\ + /* Rhs==fundamental and Lhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::is_pointer< Lhs_noref >::value\ + >::value,\ + /* Lhs==pointer and Rhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value\ + >::value + + +#include <boost/type_traits/detail/has_binary_operator.hpp> + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/3rdParty/Boost/src/boost/type_traits/has_bit_or_assign.hpp b/3rdParty/Boost/src/boost/type_traits/has_bit_or_assign.hpp new file mode 100644 index 0000000..5481b92 --- /dev/null +++ b/3rdParty/Boost/src/boost/type_traits/has_bit_or_assign.hpp @@ -0,0 +1,55 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// 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/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_BIT_OR_ASSIGN_HPP_INCLUDED +#define BOOST_TT_HAS_BIT_OR_ASSIGN_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_bit_or_assign +#define BOOST_TT_TRAIT_OP |= +#define BOOST_TT_FORBIDDEN_IF\ + ::boost::type_traits::ice_or<\ + /* Lhs==fundamental and Rhs==fundamental and (Lhs!=integral or Rhs!=integral) */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::type_traits::ice_or<\ + ::boost::type_traits::ice_not< ::boost::is_integral< Lhs_noref >::value >::value,\ + ::boost::type_traits::ice_not< ::boost::is_integral< Rhs_noref >::value >::value\ + >::value\ + >::value,\ + /* Lhs==fundamental and Rhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value,\ + /* Rhs==fundamental and Lhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::is_pointer< Lhs_noref >::value\ + >::value,\ + /* Lhs==pointer and Rhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value,\ + /* Lhs==fundamental and Rhs==fundamental and Lhs==const */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::is_const< Lhs_noref >::value\ + >::value\ + >::value + + +#include <boost/type_traits/detail/has_binary_operator.hpp> + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/3rdParty/Boost/src/boost/type_traits/has_bit_xor.hpp b/3rdParty/Boost/src/boost/type_traits/has_bit_xor.hpp new file mode 100644 index 0000000..883dcf6 --- /dev/null +++ b/3rdParty/Boost/src/boost/type_traits/has_bit_xor.hpp @@ -0,0 +1,49 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// 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/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_BIT_XOR_HPP_INCLUDED +#define BOOST_TT_HAS_BIT_XOR_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_bit_xor +#define BOOST_TT_TRAIT_OP ^ +#define BOOST_TT_FORBIDDEN_IF\ + ::boost::type_traits::ice_or<\ + /* Lhs==fundamental and Rhs==fundamental and (Lhs!=integral or Rhs!=integral) */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::type_traits::ice_or<\ + ::boost::type_traits::ice_not< ::boost::is_integral< Lhs_noref >::value >::value,\ + ::boost::type_traits::ice_not< ::boost::is_integral< Rhs_noref >::value >::value\ + >::value\ + >::value,\ + /* Lhs==fundamental and Rhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value,\ + /* Rhs==fundamental and Lhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::is_pointer< Lhs_noref >::value\ + >::value,\ + /* Lhs==pointer and Rhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value\ + >::value + + +#include <boost/type_traits/detail/has_binary_operator.hpp> + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/3rdParty/Boost/src/boost/type_traits/has_bit_xor_assign.hpp b/3rdParty/Boost/src/boost/type_traits/has_bit_xor_assign.hpp new file mode 100644 index 0000000..e2767cc --- /dev/null +++ b/3rdParty/Boost/src/boost/type_traits/has_bit_xor_assign.hpp @@ -0,0 +1,55 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// 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/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_BIT_XOR_ASSIGN_HPP_INCLUDED +#define BOOST_TT_HAS_BIT_XOR_ASSIGN_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_bit_xor_assign +#define BOOST_TT_TRAIT_OP ^= +#define BOOST_TT_FORBIDDEN_IF\ + ::boost::type_traits::ice_or<\ + /* Lhs==fundamental and Rhs==fundamental and (Lhs!=integral or Rhs!=integral) */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::type_traits::ice_or<\ + ::boost::type_traits::ice_not< ::boost::is_integral< Lhs_noref >::value >::value,\ + ::boost::type_traits::ice_not< ::boost::is_integral< Rhs_noref >::value >::value\ + >::value\ + >::value,\ + /* Lhs==fundamental and Rhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value,\ + /* Rhs==fundamental and Lhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::is_pointer< Lhs_noref >::value\ + >::value,\ + /* Lhs==pointer and Rhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value,\ + /* Lhs==fundamental and Rhs==fundamental and Lhs==const */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::is_const< Lhs_noref >::value\ + >::value\ + >::value + + +#include <boost/type_traits/detail/has_binary_operator.hpp> + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/3rdParty/Boost/src/boost/type_traits/has_complement.hpp b/3rdParty/Boost/src/boost/type_traits/has_complement.hpp new file mode 100644 index 0000000..dafd9f5 --- /dev/null +++ b/3rdParty/Boost/src/boost/type_traits/has_complement.hpp @@ -0,0 +1,32 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// 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/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_COMPLEMENT_HPP_INCLUDED +#define BOOST_TT_HAS_COMPLEMENT_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_complement +#define BOOST_TT_TRAIT_OP ~ +#define BOOST_TT_FORBIDDEN_IF\ + ::boost::type_traits::ice_or<\ + /* pointer */\ + ::boost::is_pointer< Rhs_noref >::value,\ + /* fundamental non integral */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Rhs_noref >::value,\ + ::boost::type_traits::ice_not< ::boost::is_integral< Rhs_noref >::value >::value\ + >::value\ + >::value + + +#include <boost/type_traits/detail/has_prefix_operator.hpp> + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/3rdParty/Boost/src/boost/type_traits/has_dereference.hpp b/3rdParty/Boost/src/boost/type_traits/has_dereference.hpp new file mode 100644 index 0000000..fe48e11 --- /dev/null +++ b/3rdParty/Boost/src/boost/type_traits/has_dereference.hpp @@ -0,0 +1,31 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// 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/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_DEREFERENCE_HPP_INCLUDED +#define BOOST_TT_HAS_DEREFERENCE_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_dereference +#define BOOST_TT_TRAIT_OP * +#define BOOST_TT_FORBIDDEN_IF\ + /* void* or fundamental */\ + ::boost::type_traits::ice_or<\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Rhs_noref >::value,\ + ::boost::is_void< Rhs_noptr >::value\ + >::value,\ + ::boost::is_fundamental< Rhs_nocv >::value\ + >::value + + +#include <boost/type_traits/detail/has_prefix_operator.hpp> + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/3rdParty/Boost/src/boost/type_traits/has_divides.hpp b/3rdParty/Boost/src/boost/type_traits/has_divides.hpp new file mode 100644 index 0000000..277c2da --- /dev/null +++ b/3rdParty/Boost/src/boost/type_traits/has_divides.hpp @@ -0,0 +1,40 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// 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/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_DIVIDES_HPP_INCLUDED +#define BOOST_TT_HAS_DIVIDES_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_divides +#define BOOST_TT_TRAIT_OP / +#define BOOST_TT_FORBIDDEN_IF\ + /* pointer with pointer or fundamental */\ + ::boost::type_traits::ice_or<\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::type_traits::ice_or<\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value\ + >::value,\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Rhs_noref >::value,\ + ::boost::type_traits::ice_or<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_pointer< Lhs_noref >::value\ + >::value\ + >::value\ + >::value + + +#include <boost/type_traits/detail/has_binary_operator.hpp> + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/3rdParty/Boost/src/boost/type_traits/has_divides_assign.hpp b/3rdParty/Boost/src/boost/type_traits/has_divides_assign.hpp new file mode 100644 index 0000000..b21a05a --- /dev/null +++ b/3rdParty/Boost/src/boost/type_traits/has_divides_assign.hpp @@ -0,0 +1,47 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// 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/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_DIVIDES_ASSIGN_HPP_INCLUDED +#define BOOST_TT_HAS_DIVIDES_ASSIGN_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_divides_assign +#define BOOST_TT_TRAIT_OP /= +#define BOOST_TT_FORBIDDEN_IF\ + ::boost::type_traits::ice_or<\ + /* Lhs==fundamental and Lhs==const and Rhs==fundamental */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_const< Lhs_noref >::value,\ + ::boost::is_fundamental< Rhs_nocv >::value\ + >::value,\ + /* Lhs==pointer and (Rhs==fundamental or Rhs==pointer) */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::type_traits::ice_or<\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value\ + >::value,\ + /* Rhs==pointer and (Lhs==fundamental or Lhs==pointer) */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Rhs_noref >::value,\ + ::boost::type_traits::ice_or<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_pointer< Lhs_noref >::value\ + >::value\ + >::value\ + >::value + + +#include <boost/type_traits/detail/has_binary_operator.hpp> + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/3rdParty/Boost/src/boost/type_traits/has_equal_to.hpp b/3rdParty/Boost/src/boost/type_traits/has_equal_to.hpp new file mode 100644 index 0000000..c2245c2 --- /dev/null +++ b/3rdParty/Boost/src/boost/type_traits/has_equal_to.hpp @@ -0,0 +1,49 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// 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/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_EQUAL_TO_HPP_INCLUDED +#define BOOST_TT_HAS_EQUAL_TO_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_equal_to +#define BOOST_TT_TRAIT_OP == +#define BOOST_TT_FORBIDDEN_IF\ + ::boost::type_traits::ice_or<\ + /* Lhs==pointer and Rhs==fundamental */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::is_fundamental< Rhs_nocv >::value\ + >::value,\ + /* Rhs==pointer and Lhs==fundamental */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Rhs_noref >::value,\ + ::boost::is_fundamental< Lhs_nocv >::value\ + >::value,\ + /* Lhs==pointer and Rhs==pointer and Lhs!=base(Rhs) and Rhs!=base(Lhs) and Lhs!=void* and Rhs!=void* */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::is_pointer< Rhs_noref >::value,\ + ::boost::type_traits::ice_not<\ + ::boost::type_traits::ice_or<\ + ::boost::is_base_of< Lhs_noptr, Rhs_noptr >::value,\ + ::boost::is_base_of< Rhs_noptr, Lhs_noptr >::value,\ + ::boost::is_same< Lhs_noptr, Rhs_noptr >::value,\ + ::boost::is_void< Lhs_noptr >::value,\ + ::boost::is_void< Rhs_noptr >::value\ + >::value\ + >::value\ + >::value\ + >::value + + +#include <boost/type_traits/detail/has_binary_operator.hpp> + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/3rdParty/Boost/src/boost/type_traits/has_greater.hpp b/3rdParty/Boost/src/boost/type_traits/has_greater.hpp new file mode 100644 index 0000000..ce32658 --- /dev/null +++ b/3rdParty/Boost/src/boost/type_traits/has_greater.hpp @@ -0,0 +1,49 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// 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/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_GREATER_HPP_INCLUDED +#define BOOST_TT_HAS_GREATER_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_greater +#define BOOST_TT_TRAIT_OP > +#define BOOST_TT_FORBIDDEN_IF\ + ::boost::type_traits::ice_or<\ + /* Lhs==pointer and Rhs==fundamental */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::is_fundamental< Rhs_nocv >::value\ + >::value,\ + /* Rhs==pointer and Lhs==fundamental */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Rhs_noref >::value,\ + ::boost::is_fundamental< Lhs_nocv >::value\ + >::value,\ + /* Lhs==pointer and Rhs==pointer and Lhs!=base(Rhs) and Rhs!=base(Lhs) and Lhs!=void* and Rhs!=void* */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::is_pointer< Rhs_noref >::value,\ + ::boost::type_traits::ice_not<\ + ::boost::type_traits::ice_or<\ + ::boost::is_base_of< Lhs_noptr, Rhs_noptr >::value,\ + ::boost::is_base_of< Rhs_noptr, Lhs_noptr >::value,\ + ::boost::is_same< Lhs_noptr, Rhs_noptr >::value,\ + ::boost::is_void< Lhs_noptr >::value,\ + ::boost::is_void< Rhs_noptr >::value\ + >::value\ + >::value\ + >::value\ + >::value + + +#include <boost/type_traits/detail/has_binary_operator.hpp> + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/3rdParty/Boost/src/boost/type_traits/has_greater_equal.hpp b/3rdParty/Boost/src/boost/type_traits/has_greater_equal.hpp new file mode 100644 index 0000000..681685a --- /dev/null +++ b/3rdParty/Boost/src/boost/type_traits/has_greater_equal.hpp @@ -0,0 +1,49 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// 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/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_GREATER_EQUAL_HPP_INCLUDED +#define BOOST_TT_HAS_GREATER_EQUAL_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_greater_equal +#define BOOST_TT_TRAIT_OP >= +#define BOOST_TT_FORBIDDEN_IF\ + ::boost::type_traits::ice_or<\ + /* Lhs==pointer and Rhs==fundamental */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::is_fundamental< Rhs_nocv >::value\ + >::value,\ + /* Rhs==pointer and Lhs==fundamental */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Rhs_noref >::value,\ + ::boost::is_fundamental< Lhs_nocv >::value\ + >::value,\ + /* Lhs==pointer and Rhs==pointer and Lhs!=base(Rhs) and Rhs!=base(Lhs) and Lhs!=void* and Rhs!=void* */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::is_pointer< Rhs_noref >::value,\ + ::boost::type_traits::ice_not<\ + ::boost::type_traits::ice_or<\ + ::boost::is_base_of< Lhs_noptr, Rhs_noptr >::value,\ + ::boost::is_base_of< Rhs_noptr, Lhs_noptr >::value,\ + ::boost::is_same< Lhs_noptr, Rhs_noptr >::value,\ + ::boost::is_void< Lhs_noptr >::value,\ + ::boost::is_void< Rhs_noptr >::value\ + >::value\ + >::value\ + >::value\ + >::value + + +#include <boost/type_traits/detail/has_binary_operator.hpp> + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/3rdParty/Boost/src/boost/type_traits/has_left_shift.hpp b/3rdParty/Boost/src/boost/type_traits/has_left_shift.hpp new file mode 100644 index 0000000..88205d9 --- /dev/null +++ b/3rdParty/Boost/src/boost/type_traits/has_left_shift.hpp @@ -0,0 +1,49 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// 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/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_LEFT_SHIFT_HPP_INCLUDED +#define BOOST_TT_HAS_LEFT_SHIFT_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_left_shift +#define BOOST_TT_TRAIT_OP << +#define BOOST_TT_FORBIDDEN_IF\ + ::boost::type_traits::ice_or<\ + /* Lhs==fundamental and Rhs==fundamental and (Lhs!=integral or Rhs!=integral) */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::type_traits::ice_or<\ + ::boost::type_traits::ice_not< ::boost::is_integral< Lhs_noref >::value >::value,\ + ::boost::type_traits::ice_not< ::boost::is_integral< Rhs_noref >::value >::value\ + >::value\ + >::value,\ + /* Lhs==fundamental and Rhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value,\ + /* Rhs==fundamental and Lhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::is_pointer< Lhs_noref >::value\ + >::value,\ + /* Lhs==pointer and Rhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value\ + >::value + + +#include <boost/type_traits/detail/has_binary_operator.hpp> + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/3rdParty/Boost/src/boost/type_traits/has_left_shift_assign.hpp b/3rdParty/Boost/src/boost/type_traits/has_left_shift_assign.hpp new file mode 100644 index 0000000..0b3b9b1 --- /dev/null +++ b/3rdParty/Boost/src/boost/type_traits/has_left_shift_assign.hpp @@ -0,0 +1,55 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// 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/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_LEFT_SHIFT_ASSIGN_HPP_INCLUDED +#define BOOST_TT_HAS_LEFT_SHIFT_ASSIGN_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_left_shift_assign +#define BOOST_TT_TRAIT_OP <<= +#define BOOST_TT_FORBIDDEN_IF\ + ::boost::type_traits::ice_or<\ + /* Lhs==fundamental and Rhs==fundamental and (Lhs!=integral or Rhs!=integral) */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::type_traits::ice_or<\ + ::boost::type_traits::ice_not< ::boost::is_integral< Lhs_noref >::value >::value,\ + ::boost::type_traits::ice_not< ::boost::is_integral< Rhs_noref >::value >::value\ + >::value\ + >::value,\ + /* Lhs==fundamental and Rhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value,\ + /* Rhs==fundamental and Lhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::is_pointer< Lhs_noref >::value\ + >::value,\ + /* Lhs==pointer and Rhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value,\ + /* Lhs==fundamental and Rhs==fundamental and Lhs==const */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::is_const< Lhs_noref >::value\ + >::value\ + >::value + + +#include <boost/type_traits/detail/has_binary_operator.hpp> + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/3rdParty/Boost/src/boost/type_traits/has_less.hpp b/3rdParty/Boost/src/boost/type_traits/has_less.hpp new file mode 100644 index 0000000..e1a045e --- /dev/null +++ b/3rdParty/Boost/src/boost/type_traits/has_less.hpp @@ -0,0 +1,49 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// 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/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_LESS_HPP_INCLUDED +#define BOOST_TT_HAS_LESS_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_less +#define BOOST_TT_TRAIT_OP < +#define BOOST_TT_FORBIDDEN_IF\ + ::boost::type_traits::ice_or<\ + /* Lhs==pointer and Rhs==fundamental */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::is_fundamental< Rhs_nocv >::value\ + >::value,\ + /* Rhs==pointer and Lhs==fundamental */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Rhs_noref >::value,\ + ::boost::is_fundamental< Lhs_nocv >::value\ + >::value,\ + /* Lhs==pointer and Rhs==pointer and Lhs!=base(Rhs) and Rhs!=base(Lhs) and Lhs!=void* and Rhs!=void* */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::is_pointer< Rhs_noref >::value,\ + ::boost::type_traits::ice_not<\ + ::boost::type_traits::ice_or<\ + ::boost::is_base_of< Lhs_noptr, Rhs_noptr >::value,\ + ::boost::is_base_of< Rhs_noptr, Lhs_noptr >::value,\ + ::boost::is_same< Lhs_noptr, Rhs_noptr >::value,\ + ::boost::is_void< Lhs_noptr >::value,\ + ::boost::is_void< Rhs_noptr >::value\ + >::value\ + >::value\ + >::value\ + >::value + + +#include <boost/type_traits/detail/has_binary_operator.hpp> + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/3rdParty/Boost/src/boost/type_traits/has_less_equal.hpp b/3rdParty/Boost/src/boost/type_traits/has_less_equal.hpp new file mode 100644 index 0000000..c633b8b --- /dev/null +++ b/3rdParty/Boost/src/boost/type_traits/has_less_equal.hpp @@ -0,0 +1,49 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// 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/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_LESS_EQUAL_HPP_INCLUDED +#define BOOST_TT_HAS_LESS_EQUAL_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_less_equal +#define BOOST_TT_TRAIT_OP <= +#define BOOST_TT_FORBIDDEN_IF\ + ::boost::type_traits::ice_or<\ + /* Lhs==pointer and Rhs==fundamental */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::is_fundamental< Rhs_nocv >::value\ + >::value,\ + /* Rhs==pointer and Lhs==fundamental */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Rhs_noref >::value,\ + ::boost::is_fundamental< Lhs_nocv >::value\ + >::value,\ + /* Lhs==pointer and Rhs==pointer and Lhs!=base(Rhs) and Rhs!=base(Lhs) and Lhs!=void* and Rhs!=void* */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::is_pointer< Rhs_noref >::value,\ + ::boost::type_traits::ice_not<\ + ::boost::type_traits::ice_or<\ + ::boost::is_base_of< Lhs_noptr, Rhs_noptr >::value,\ + ::boost::is_base_of< Rhs_noptr, Lhs_noptr >::value,\ + ::boost::is_same< Lhs_noptr, Rhs_noptr >::value,\ + ::boost::is_void< Lhs_noptr >::value,\ + ::boost::is_void< Rhs_noptr >::value\ + >::value\ + >::value\ + >::value\ + >::value + + +#include <boost/type_traits/detail/has_binary_operator.hpp> + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/3rdParty/Boost/src/boost/type_traits/has_logical_and.hpp b/3rdParty/Boost/src/boost/type_traits/has_logical_and.hpp new file mode 100644 index 0000000..5bfa1c3 --- /dev/null +++ b/3rdParty/Boost/src/boost/type_traits/has_logical_and.hpp @@ -0,0 +1,40 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// 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/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_LOGICAL_AND_HPP_INCLUDED +#define BOOST_TT_HAS_LOGICAL_AND_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_logical_and +#define BOOST_TT_TRAIT_OP && +#define BOOST_TT_FORBIDDEN_IF\ + /* pointer with fundamental non convertible to bool */\ + ::boost::type_traits::ice_or<\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::type_traits::ice_not< ::boost::is_convertible< Rhs_nocv, bool >::value >::value\ + >::value\ + >::value,\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Rhs_noref >::value,\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::type_traits::ice_not< ::boost::is_convertible< Lhs_nocv, bool >::value >::value\ + >::value\ + >::value\ + >::value + + +#include <boost/type_traits/detail/has_binary_operator.hpp> + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/3rdParty/Boost/src/boost/type_traits/has_logical_not.hpp b/3rdParty/Boost/src/boost/type_traits/has_logical_not.hpp new file mode 100644 index 0000000..fd99d3c --- /dev/null +++ b/3rdParty/Boost/src/boost/type_traits/has_logical_not.hpp @@ -0,0 +1,23 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// 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/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_LOGICAL_NOT_HPP_INCLUDED +#define BOOST_TT_HAS_LOGICAL_NOT_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_logical_not +#define BOOST_TT_TRAIT_OP ! +#define BOOST_TT_FORBIDDEN_IF\ + false + +#include <boost/type_traits/detail/has_prefix_operator.hpp> + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/3rdParty/Boost/src/boost/type_traits/has_logical_or.hpp b/3rdParty/Boost/src/boost/type_traits/has_logical_or.hpp new file mode 100644 index 0000000..a4ae6c5 --- /dev/null +++ b/3rdParty/Boost/src/boost/type_traits/has_logical_or.hpp @@ -0,0 +1,40 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// 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/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_LOGICAL_OR_HPP_INCLUDED +#define BOOST_TT_HAS_LOGICAL_OR_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_logical_or +#define BOOST_TT_TRAIT_OP || +#define BOOST_TT_FORBIDDEN_IF\ + /* pointer with fundamental non convertible to bool */\ + ::boost::type_traits::ice_or<\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::type_traits::ice_not< ::boost::is_convertible< Rhs_nocv, bool >::value >::value\ + >::value\ + >::value,\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Rhs_noref >::value,\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::type_traits::ice_not< ::boost::is_convertible< Lhs_nocv, bool >::value >::value\ + >::value\ + >::value\ + >::value + + +#include <boost/type_traits/detail/has_binary_operator.hpp> + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/3rdParty/Boost/src/boost/type_traits/has_minus.hpp b/3rdParty/Boost/src/boost/type_traits/has_minus.hpp new file mode 100644 index 0000000..cc1d06b --- /dev/null +++ b/3rdParty/Boost/src/boost/type_traits/has_minus.hpp @@ -0,0 +1,60 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// 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/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_MINUS_HPP_INCLUDED +#define BOOST_TT_HAS_MINUS_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_minus +#define BOOST_TT_TRAIT_OP - +#define BOOST_TT_FORBIDDEN_IF\ + ::boost::type_traits::ice_or<\ + /* Lhs==pointer and Rhs==fundamental and Rhs!=integral */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::type_traits::ice_not< ::boost::is_integral< Rhs_noref >::value >::value\ + >::value,\ + /* Lhs==void* and (Rhs==fundamental or Rhs==pointer) */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::is_void< Lhs_noptr >::value,\ + ::boost::type_traits::ice_or<\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value\ + >::value,\ + /* Rhs==void* and (Lhs==fundamental or Lhs==pointer) */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Rhs_noref >::value,\ + ::boost::is_void< Rhs_noptr >::value,\ + ::boost::type_traits::ice_or<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_pointer< Lhs_noref >::value\ + >::value\ + >::value,\ + /* Lhs=fundamental and Rhs=pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value,\ + /* two different pointers */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::is_pointer< Rhs_noref >::value,\ + ::boost::type_traits::ice_not< ::boost::is_same< Lhs_nocv, Rhs_nocv >::value >::value\ + >::value\ + >::value + + +#include <boost/type_traits/detail/has_binary_operator.hpp> + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/3rdParty/Boost/src/boost/type_traits/has_minus_assign.hpp b/3rdParty/Boost/src/boost/type_traits/has_minus_assign.hpp new file mode 100644 index 0000000..84ba359 --- /dev/null +++ b/3rdParty/Boost/src/boost/type_traits/has_minus_assign.hpp @@ -0,0 +1,65 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// 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/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_MINUS_ASSIGN_HPP_INCLUDED +#define BOOST_TT_HAS_MINUS_ASSIGN_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_minus_assign +#define BOOST_TT_TRAIT_OP -= +#define BOOST_TT_FORBIDDEN_IF\ + ::boost::type_traits::ice_or<\ + /* Lhs==pointer and Rhs==fundamental and Rhs!=integral */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::type_traits::ice_not< ::boost::is_integral< Rhs_noref >::value >::value\ + >::value,\ + /* Lhs==void* and Rhs==fundamental */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::is_void< Lhs_noptr >::value,\ + ::boost::is_fundamental< Rhs_nocv >::value\ + >::value,\ + /* Rhs==void* and Lhs==fundamental */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Rhs_noref >::value,\ + ::boost::is_void< Rhs_noptr >::value,\ + ::boost::is_fundamental< Lhs_nocv >::value\ + >::value,\ + /* Lhs=fundamental and Rhs=pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value,\ + /* Lhs==pointer and Rhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value,\ + /* (Lhs==fundamental or Lhs==pointer) and (Rhs==fundamental or Rhs==pointer) and (Lhs==const) */\ + ::boost::type_traits::ice_and<\ + ::boost::type_traits::ice_or<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_pointer< Lhs_noref >::value\ + >::value,\ + ::boost::type_traits::ice_or<\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value,\ + ::boost::is_const< Lhs_noref >::value\ + >::value\ + >::value + + +#include <boost/type_traits/detail/has_binary_operator.hpp> + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/3rdParty/Boost/src/boost/type_traits/has_modulus.hpp b/3rdParty/Boost/src/boost/type_traits/has_modulus.hpp new file mode 100644 index 0000000..6948728 --- /dev/null +++ b/3rdParty/Boost/src/boost/type_traits/has_modulus.hpp @@ -0,0 +1,49 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// 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/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_MODULUS_HPP_INCLUDED +#define BOOST_TT_HAS_MODULUS_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_modulus +#define BOOST_TT_TRAIT_OP % +#define BOOST_TT_FORBIDDEN_IF\ + ::boost::type_traits::ice_or<\ + /* Lhs==fundamental and Rhs==fundamental and (Lhs!=integral or Rhs!=integral) */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::type_traits::ice_or<\ + ::boost::type_traits::ice_not< ::boost::is_integral< Lhs_noref >::value >::value,\ + ::boost::type_traits::ice_not< ::boost::is_integral< Rhs_noref >::value >::value\ + >::value\ + >::value,\ + /* Lhs==fundamental and Rhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value,\ + /* Rhs==fundamental and Lhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::is_pointer< Lhs_noref >::value\ + >::value,\ + /* Lhs==pointer and Rhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value\ + >::value + + +#include <boost/type_traits/detail/has_binary_operator.hpp> + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/3rdParty/Boost/src/boost/type_traits/has_modulus_assign.hpp b/3rdParty/Boost/src/boost/type_traits/has_modulus_assign.hpp new file mode 100644 index 0000000..f0531f0 --- /dev/null +++ b/3rdParty/Boost/src/boost/type_traits/has_modulus_assign.hpp @@ -0,0 +1,55 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// 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/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_MODULUS_ASSIGN_HPP_INCLUDED +#define BOOST_TT_HAS_MODULUS_ASSIGN_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_modulus_assign +#define BOOST_TT_TRAIT_OP %= +#define BOOST_TT_FORBIDDEN_IF\ + ::boost::type_traits::ice_or<\ + /* Lhs==fundamental and Rhs==fundamental and (Lhs!=integral or Rhs!=integral) */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::type_traits::ice_or<\ + ::boost::type_traits::ice_not< ::boost::is_integral< Lhs_noref >::value >::value,\ + ::boost::type_traits::ice_not< ::boost::is_integral< Rhs_noref >::value >::value\ + >::value\ + >::value,\ + /* Lhs==fundamental and Rhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value,\ + /* Rhs==fundamental and Lhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::is_pointer< Lhs_noref >::value\ + >::value,\ + /* Lhs==pointer and Rhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value,\ + /* Lhs==fundamental and Rhs==fundamental and Lhs==const */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::is_const< Lhs_noref >::value\ + >::value\ + >::value + + +#include <boost/type_traits/detail/has_binary_operator.hpp> + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/3rdParty/Boost/src/boost/type_traits/has_multiplies.hpp b/3rdParty/Boost/src/boost/type_traits/has_multiplies.hpp new file mode 100644 index 0000000..4b578c5 --- /dev/null +++ b/3rdParty/Boost/src/boost/type_traits/has_multiplies.hpp @@ -0,0 +1,40 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// 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/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_MULTIPLIES_HPP_INCLUDED +#define BOOST_TT_HAS_MULTIPLIES_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_multiplies +#define BOOST_TT_TRAIT_OP * +#define BOOST_TT_FORBIDDEN_IF\ + /* pointer with pointer or fundamental */\ + ::boost::type_traits::ice_or<\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::type_traits::ice_or<\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value\ + >::value,\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Rhs_noref >::value,\ + ::boost::type_traits::ice_or<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_pointer< Lhs_noref >::value\ + >::value\ + >::value\ + >::value + + +#include <boost/type_traits/detail/has_binary_operator.hpp> + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/3rdParty/Boost/src/boost/type_traits/has_multiplies_assign.hpp b/3rdParty/Boost/src/boost/type_traits/has_multiplies_assign.hpp new file mode 100644 index 0000000..1678b7b --- /dev/null +++ b/3rdParty/Boost/src/boost/type_traits/has_multiplies_assign.hpp @@ -0,0 +1,47 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// 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/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_MULTIPLIES_ASSIGN_HPP_INCLUDED +#define BOOST_TT_HAS_MULTIPLIES_ASSIGN_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_multiplies_assign +#define BOOST_TT_TRAIT_OP *= +#define BOOST_TT_FORBIDDEN_IF\ + ::boost::type_traits::ice_or<\ + /* Lhs==fundamental and Lhs==const and Rhs==fundamental */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_const< Lhs_noref >::value,\ + ::boost::is_fundamental< Rhs_nocv >::value\ + >::value,\ + /* Lhs==pointer and (Rhs==fundamental or Rhs==pointer) */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::type_traits::ice_or<\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value\ + >::value,\ + /* Rhs==pointer and (Lhs==fundamental or Lhs==pointer) */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Rhs_noref >::value,\ + ::boost::type_traits::ice_or<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_pointer< Lhs_noref >::value\ + >::value\ + >::value\ + >::value + + +#include <boost/type_traits/detail/has_binary_operator.hpp> + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/3rdParty/Boost/src/boost/type_traits/has_negate.hpp b/3rdParty/Boost/src/boost/type_traits/has_negate.hpp new file mode 100644 index 0000000..452e54a --- /dev/null +++ b/3rdParty/Boost/src/boost/type_traits/has_negate.hpp @@ -0,0 +1,25 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// 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/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_NEGATE_HPP_INCLUDED +#define BOOST_TT_HAS_NEGATE_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_negate +#define BOOST_TT_TRAIT_OP - +#define BOOST_TT_FORBIDDEN_IF\ + /* pointer */\ + ::boost::is_pointer< Rhs_noref >::value + + +#include <boost/type_traits/detail/has_prefix_operator.hpp> + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/3rdParty/Boost/src/boost/type_traits/has_not_equal_to.hpp b/3rdParty/Boost/src/boost/type_traits/has_not_equal_to.hpp new file mode 100644 index 0000000..e7e3700 --- /dev/null +++ b/3rdParty/Boost/src/boost/type_traits/has_not_equal_to.hpp @@ -0,0 +1,49 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// 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/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_NOT_EQUAL_TO_HPP_INCLUDED +#define BOOST_TT_HAS_NOT_EQUAL_TO_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_not_equal_to +#define BOOST_TT_TRAIT_OP != +#define BOOST_TT_FORBIDDEN_IF\ + ::boost::type_traits::ice_or<\ + /* Lhs==pointer and Rhs==fundamental */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::is_fundamental< Rhs_nocv >::value\ + >::value,\ + /* Rhs==pointer and Lhs==fundamental */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Rhs_noref >::value,\ + ::boost::is_fundamental< Lhs_nocv >::value\ + >::value,\ + /* Lhs==pointer and Rhs==pointer and Lhs!=base(Rhs) and Rhs!=base(Lhs) and Lhs!=void* and Rhs!=void* */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::is_pointer< Rhs_noref >::value,\ + ::boost::type_traits::ice_not<\ + ::boost::type_traits::ice_or<\ + ::boost::is_base_of< Lhs_noptr, Rhs_noptr >::value,\ + ::boost::is_base_of< Rhs_noptr, Lhs_noptr >::value,\ + ::boost::is_same< Lhs_noptr, Rhs_noptr >::value,\ + ::boost::is_void< Lhs_noptr >::value,\ + ::boost::is_void< Rhs_noptr >::value\ + >::value\ + >::value\ + >::value\ + >::value + + +#include <boost/type_traits/detail/has_binary_operator.hpp> + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/3rdParty/Boost/src/boost/type_traits/has_nothrow_assign.hpp b/3rdParty/Boost/src/boost/type_traits/has_nothrow_assign.hpp index 3cef735..83e5968 100644 --- a/3rdParty/Boost/src/boost/type_traits/has_nothrow_assign.hpp +++ b/3rdParty/Boost/src/boost/type_traits/has_nothrow_assign.hpp @@ -20,16 +20,22 @@ namespace detail{ template <class T> struct has_nothrow_assign_imp{ - BOOST_STATIC_CONSTANT(bool, value = - (::boost::type_traits::ice_or< - ::boost::has_trivial_assign<T>::value, - BOOST_HAS_NOTHROW_ASSIGN(T) - >::value)); +#ifndef BOOST_HAS_NOTHROW_ASSIGN + BOOST_STATIC_CONSTANT(bool, value = ::boost::has_trivial_assign<T>::value); +#else + BOOST_STATIC_CONSTANT(bool, value = BOOST_HAS_NOTHROW_ASSIGN(T)); +#endif }; } BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_nothrow_assign,T,::boost::detail::has_nothrow_assign_imp<T>::value) +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_assign,void,false) +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_assign,void const,false) +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_assign,void const volatile,false) +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_assign,void volatile,false) +#endif } // namespace boost diff --git a/3rdParty/Boost/src/boost/type_traits/has_nothrow_constructor.hpp b/3rdParty/Boost/src/boost/type_traits/has_nothrow_constructor.hpp index e807fd4..3bc4f80 100644 --- a/3rdParty/Boost/src/boost/type_traits/has_nothrow_constructor.hpp +++ b/3rdParty/Boost/src/boost/type_traits/has_nothrow_constructor.hpp @@ -20,11 +20,11 @@ namespace detail{ template <class T> struct has_nothrow_constructor_imp{ - BOOST_STATIC_CONSTANT(bool, value = - (::boost::type_traits::ice_or< - ::boost::has_trivial_constructor<T>::value, - BOOST_HAS_NOTHROW_CONSTRUCTOR(T) - >::value)); +#ifdef BOOST_HAS_NOTHROW_CONSTRUCTOR + BOOST_STATIC_CONSTANT(bool, value = BOOST_HAS_NOTHROW_CONSTRUCTOR(T)); +#else + BOOST_STATIC_CONSTANT(bool, value = ::boost::has_trivial_constructor<T>::value); +#endif }; } @@ -32,6 +32,20 @@ struct has_nothrow_constructor_imp{ BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_nothrow_constructor,T,::boost::detail::has_nothrow_constructor_imp<T>::value) BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_nothrow_default_constructor,T,::boost::detail::has_nothrow_constructor_imp<T>::value) +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_constructor,void,false) +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_constructor,void const,false) +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_constructor,void const volatile,false) +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_constructor,void volatile,false) +#endif + +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_default_constructor,void,false) +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_default_constructor,void const,false) +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_default_constructor,void const volatile,false) +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_default_constructor,void volatile,false) +#endif + } // namespace boost #include <boost/type_traits/detail/bool_trait_undef.hpp> diff --git a/3rdParty/Boost/src/boost/type_traits/has_nothrow_copy.hpp b/3rdParty/Boost/src/boost/type_traits/has_nothrow_copy.hpp index c06b4a3..9c3c903 100644 --- a/3rdParty/Boost/src/boost/type_traits/has_nothrow_copy.hpp +++ b/3rdParty/Boost/src/boost/type_traits/has_nothrow_copy.hpp @@ -20,11 +20,11 @@ namespace detail{ template <class T> struct has_nothrow_copy_imp{ - BOOST_STATIC_CONSTANT(bool, value = - (::boost::type_traits::ice_or< - ::boost::has_trivial_copy<T>::value, - BOOST_HAS_NOTHROW_COPY(T) - >::value)); +#ifdef BOOST_HAS_NOTHROW_COPY + BOOST_STATIC_CONSTANT(bool, value = BOOST_HAS_NOTHROW_COPY(T)); +#else + BOOST_STATIC_CONSTANT(bool, value = ::boost::has_trivial_copy<T>::value); +#endif }; } @@ -32,6 +32,20 @@ struct has_nothrow_copy_imp{ BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_nothrow_copy,T,::boost::detail::has_nothrow_copy_imp<T>::value) BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_nothrow_copy_constructor,T,::boost::detail::has_nothrow_copy_imp<T>::value) +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_copy,void,false) +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_copy,void const,false) +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_copy,void const volatile,false) +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_copy,void volatile,false) +#endif + +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_copy_constructor,void,false) +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_copy_constructor,void const,false) +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_copy_constructor,void const volatile,false) +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_nothrow_copy_constructor,void volatile,false) +#endif + } // namespace boost #include <boost/type_traits/detail/bool_trait_undef.hpp> diff --git a/3rdParty/Boost/src/boost/type_traits/has_operator.hpp b/3rdParty/Boost/src/boost/type_traits/has_operator.hpp new file mode 100644 index 0000000..c97a90f --- /dev/null +++ b/3rdParty/Boost/src/boost/type_traits/has_operator.hpp @@ -0,0 +1,51 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// 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/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_OPERATOR_HPP_INCLUDED +#define BOOST_TT_HAS_OPERATOR_HPP_INCLUDED + +#include <boost/type_traits/has_bit_and.hpp> +#include <boost/type_traits/has_bit_and_assign.hpp> +#include <boost/type_traits/has_bit_or.hpp> +#include <boost/type_traits/has_bit_or_assign.hpp> +#include <boost/type_traits/has_bit_xor.hpp> +#include <boost/type_traits/has_bit_xor_assign.hpp> +#include <boost/type_traits/has_complement.hpp> +#include <boost/type_traits/has_dereference.hpp> +#include <boost/type_traits/has_divides.hpp> +#include <boost/type_traits/has_divides_assign.hpp> +#include <boost/type_traits/has_equal_to.hpp> +#include <boost/type_traits/has_greater.hpp> +#include <boost/type_traits/has_greater_equal.hpp> +#include <boost/type_traits/has_left_shift.hpp> +#include <boost/type_traits/has_left_shift_assign.hpp> +#include <boost/type_traits/has_less.hpp> +#include <boost/type_traits/has_less_equal.hpp> +#include <boost/type_traits/has_logical_and.hpp> +#include <boost/type_traits/has_logical_not.hpp> +#include <boost/type_traits/has_logical_or.hpp> +#include <boost/type_traits/has_minus.hpp> +#include <boost/type_traits/has_minus_assign.hpp> +#include <boost/type_traits/has_modulus.hpp> +#include <boost/type_traits/has_modulus_assign.hpp> +#include <boost/type_traits/has_multiplies.hpp> +#include <boost/type_traits/has_multiplies_assign.hpp> +#include <boost/type_traits/has_negate.hpp> +#include <boost/type_traits/has_not_equal_to.hpp> +#include <boost/type_traits/has_plus.hpp> +#include <boost/type_traits/has_plus_assign.hpp> +#include <boost/type_traits/has_post_decrement.hpp> +#include <boost/type_traits/has_post_increment.hpp> +#include <boost/type_traits/has_pre_decrement.hpp> +#include <boost/type_traits/has_pre_increment.hpp> +#include <boost/type_traits/has_right_shift.hpp> +#include <boost/type_traits/has_right_shift_assign.hpp> +#include <boost/type_traits/has_unary_minus.hpp> +#include <boost/type_traits/has_unary_plus.hpp> + +#endif diff --git a/3rdParty/Boost/src/boost/type_traits/has_plus.hpp b/3rdParty/Boost/src/boost/type_traits/has_plus.hpp new file mode 100644 index 0000000..70c1200 --- /dev/null +++ b/3rdParty/Boost/src/boost/type_traits/has_plus.hpp @@ -0,0 +1,54 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// 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/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_PLUS_HPP_INCLUDED +#define BOOST_TT_HAS_PLUS_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_plus +#define BOOST_TT_TRAIT_OP + +#define BOOST_TT_FORBIDDEN_IF\ + ::boost::type_traits::ice_or<\ + /* Lhs==pointer and Rhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value,\ + /* Lhs==void* and Rhs==fundamental */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::is_void< Lhs_noptr >::value,\ + ::boost::is_fundamental< Rhs_nocv >::value\ + >::value,\ + /* Rhs==void* and Lhs==fundamental */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Rhs_noref >::value,\ + ::boost::is_void< Rhs_noptr >::value,\ + ::boost::is_fundamental< Lhs_nocv >::value\ + >::value,\ + /* Lhs==pointer and Rhs==fundamental and Rhs!=integral */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::type_traits::ice_not< ::boost::is_integral< Rhs_noref >::value >::value\ + >::value,\ + /* Rhs==pointer and Lhs==fundamental and Lhs!=integral */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Rhs_noref >::value,\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::type_traits::ice_not< ::boost::is_integral< Lhs_noref >::value >::value\ + >::value\ + >::value + + +#include <boost/type_traits/detail/has_binary_operator.hpp> + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/3rdParty/Boost/src/boost/type_traits/has_plus_assign.hpp b/3rdParty/Boost/src/boost/type_traits/has_plus_assign.hpp new file mode 100644 index 0000000..6d65204 --- /dev/null +++ b/3rdParty/Boost/src/boost/type_traits/has_plus_assign.hpp @@ -0,0 +1,66 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// 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/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_PLUS_ASSIGN_HPP_INCLUDED +#define BOOST_TT_HAS_PLUS_ASSIGN_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_plus_assign +#define BOOST_TT_TRAIT_OP += +#define BOOST_TT_FORBIDDEN_IF\ + ::boost::type_traits::ice_or<\ + /* Lhs==pointer and Rhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value,\ + /* Lhs==void* and Rhs==fundamental */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::is_void< Lhs_noptr >::value,\ + ::boost::is_fundamental< Rhs_nocv >::value\ + >::value,\ + /* Rhs==void* and Lhs==fundamental */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Rhs_noref >::value,\ + ::boost::is_void< Rhs_noptr >::value,\ + ::boost::is_fundamental< Lhs_nocv >::value\ + >::value,\ + /* Lhs==pointer and Rhs==fundamental and Rhs!=integral */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::type_traits::ice_not< ::boost::is_integral< Rhs_noref >::value >::value\ + >::value,\ + /* Rhs==pointer and Lhs==fundamental and Lhs!=bool */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Rhs_noref >::value,\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::type_traits::ice_not< ::boost::is_same< Lhs_nocv, bool >::value >::value\ + >::value,\ + /* (Lhs==fundamental or Lhs==pointer) and (Rhs==fundamental or Rhs==pointer) and (Lhs==const) */\ + ::boost::type_traits::ice_and<\ + ::boost::type_traits::ice_or<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_pointer< Lhs_noref >::value\ + >::value,\ + ::boost::type_traits::ice_or<\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value,\ + ::boost::is_const< Lhs_noref >::value\ + >::value\ + >::value + + +#include <boost/type_traits/detail/has_binary_operator.hpp> + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/3rdParty/Boost/src/boost/type_traits/has_post_decrement.hpp b/3rdParty/Boost/src/boost/type_traits/has_post_decrement.hpp new file mode 100644 index 0000000..e277eaf --- /dev/null +++ b/3rdParty/Boost/src/boost/type_traits/has_post_decrement.hpp @@ -0,0 +1,40 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// 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/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_POST_DECREMENT_HPP_INCLUDED +#define BOOST_TT_HAS_POST_DECREMENT_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_post_decrement +#define BOOST_TT_TRAIT_OP -- +#define BOOST_TT_FORBIDDEN_IF\ + ::boost::type_traits::ice_or<\ + /* bool */\ + ::boost::is_same< bool, Lhs_nocv >::value,\ + /* void* */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::is_void< Lhs_noptr >::value\ + >::value,\ + /* (fundamental or pointer) and const */\ + ::boost::type_traits::ice_and<\ + ::boost::type_traits::ice_or<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_pointer< Lhs_noref >::value\ + >::value,\ + ::boost::is_const< Lhs_noref >::value\ + >::value\ + >::value + + +#include <boost/type_traits/detail/has_postfix_operator.hpp> + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/3rdParty/Boost/src/boost/type_traits/has_post_increment.hpp b/3rdParty/Boost/src/boost/type_traits/has_post_increment.hpp new file mode 100644 index 0000000..085b2d5 --- /dev/null +++ b/3rdParty/Boost/src/boost/type_traits/has_post_increment.hpp @@ -0,0 +1,40 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// 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/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_POST_INCREMENT_HPP_INCLUDED +#define BOOST_TT_HAS_POST_INCREMENT_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_post_increment +#define BOOST_TT_TRAIT_OP ++ +#define BOOST_TT_FORBIDDEN_IF\ + ::boost::type_traits::ice_or<\ + /* bool */\ + ::boost::is_same< bool, Lhs_nocv >::value,\ + /* void* */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::is_void< Lhs_noptr >::value\ + >::value,\ + /* (fundamental or pointer) and const */\ + ::boost::type_traits::ice_and<\ + ::boost::type_traits::ice_or<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_pointer< Lhs_noref >::value\ + >::value,\ + ::boost::is_const< Lhs_noref >::value\ + >::value\ + >::value + + +#include <boost/type_traits/detail/has_postfix_operator.hpp> + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/3rdParty/Boost/src/boost/type_traits/has_pre_decrement.hpp b/3rdParty/Boost/src/boost/type_traits/has_pre_decrement.hpp new file mode 100644 index 0000000..8f08291 --- /dev/null +++ b/3rdParty/Boost/src/boost/type_traits/has_pre_decrement.hpp @@ -0,0 +1,40 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// 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/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_PRE_DECREMENT_HPP_INCLUDED +#define BOOST_TT_HAS_PRE_DECREMENT_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_pre_decrement +#define BOOST_TT_TRAIT_OP -- +#define BOOST_TT_FORBIDDEN_IF\ + ::boost::type_traits::ice_or<\ + /* bool */\ + ::boost::is_same< bool, Rhs_nocv >::value,\ + /* void* */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Rhs_noref >::value,\ + ::boost::is_void< Rhs_noptr >::value\ + >::value,\ + /* (fundamental or pointer) and const */\ + ::boost::type_traits::ice_and<\ + ::boost::type_traits::ice_or<\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value,\ + ::boost::is_const< Rhs_noref >::value\ + >::value\ + >::value + + +#include <boost/type_traits/detail/has_prefix_operator.hpp> + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/3rdParty/Boost/src/boost/type_traits/has_pre_increment.hpp b/3rdParty/Boost/src/boost/type_traits/has_pre_increment.hpp new file mode 100644 index 0000000..fcb946d --- /dev/null +++ b/3rdParty/Boost/src/boost/type_traits/has_pre_increment.hpp @@ -0,0 +1,40 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// 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/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_PRE_INCREMENT_HPP_INCLUDED +#define BOOST_TT_HAS_PRE_INCREMENT_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_pre_increment +#define BOOST_TT_TRAIT_OP ++ +#define BOOST_TT_FORBIDDEN_IF\ + ::boost::type_traits::ice_or<\ + /* bool */\ + ::boost::is_same< bool, Rhs_nocv >::value,\ + /* void* */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Rhs_noref >::value,\ + ::boost::is_void< Rhs_noptr >::value\ + >::value,\ + /* (fundamental or pointer) and const */\ + ::boost::type_traits::ice_and<\ + ::boost::type_traits::ice_or<\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value,\ + ::boost::is_const< Rhs_noref >::value\ + >::value\ + >::value + + +#include <boost/type_traits/detail/has_prefix_operator.hpp> + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/3rdParty/Boost/src/boost/type_traits/has_right_shift.hpp b/3rdParty/Boost/src/boost/type_traits/has_right_shift.hpp new file mode 100644 index 0000000..5735870 --- /dev/null +++ b/3rdParty/Boost/src/boost/type_traits/has_right_shift.hpp @@ -0,0 +1,49 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// 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/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_RIGHT_SHIFT_HPP_INCLUDED +#define BOOST_TT_HAS_RIGHT_SHIFT_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_right_shift +#define BOOST_TT_TRAIT_OP >> +#define BOOST_TT_FORBIDDEN_IF\ + ::boost::type_traits::ice_or<\ + /* Lhs==fundamental and Rhs==fundamental and (Lhs!=integral or Rhs!=integral) */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::type_traits::ice_or<\ + ::boost::type_traits::ice_not< ::boost::is_integral< Lhs_noref >::value >::value,\ + ::boost::type_traits::ice_not< ::boost::is_integral< Rhs_noref >::value >::value\ + >::value\ + >::value,\ + /* Lhs==fundamental and Rhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value,\ + /* Rhs==fundamental and Lhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::is_pointer< Lhs_noref >::value\ + >::value,\ + /* Lhs==pointer and Rhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value\ + >::value + + +#include <boost/type_traits/detail/has_binary_operator.hpp> + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/3rdParty/Boost/src/boost/type_traits/has_right_shift_assign.hpp b/3rdParty/Boost/src/boost/type_traits/has_right_shift_assign.hpp new file mode 100644 index 0000000..0536e71 --- /dev/null +++ b/3rdParty/Boost/src/boost/type_traits/has_right_shift_assign.hpp @@ -0,0 +1,55 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// 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/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_RIGHT_SHIFT_ASSIGN_HPP_INCLUDED +#define BOOST_TT_HAS_RIGHT_SHIFT_ASSIGN_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_right_shift_assign +#define BOOST_TT_TRAIT_OP >>= +#define BOOST_TT_FORBIDDEN_IF\ + ::boost::type_traits::ice_or<\ + /* Lhs==fundamental and Rhs==fundamental and (Lhs!=integral or Rhs!=integral) */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::type_traits::ice_or<\ + ::boost::type_traits::ice_not< ::boost::is_integral< Lhs_noref >::value >::value,\ + ::boost::type_traits::ice_not< ::boost::is_integral< Rhs_noref >::value >::value\ + >::value\ + >::value,\ + /* Lhs==fundamental and Rhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value,\ + /* Rhs==fundamental and Lhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::is_pointer< Lhs_noref >::value\ + >::value,\ + /* Lhs==pointer and Rhs==pointer */\ + ::boost::type_traits::ice_and<\ + ::boost::is_pointer< Lhs_noref >::value,\ + ::boost::is_pointer< Rhs_noref >::value\ + >::value,\ + /* Lhs==fundamental and Rhs==fundamental and Lhs==const */\ + ::boost::type_traits::ice_and<\ + ::boost::is_fundamental< Lhs_nocv >::value,\ + ::boost::is_fundamental< Rhs_nocv >::value,\ + ::boost::is_const< Lhs_noref >::value\ + >::value\ + >::value + + +#include <boost/type_traits/detail/has_binary_operator.hpp> + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/3rdParty/Boost/src/boost/type_traits/has_trivial_assign.hpp b/3rdParty/Boost/src/boost/type_traits/has_trivial_assign.hpp index 4179e8d..404b62c 100644 --- a/3rdParty/Boost/src/boost/type_traits/has_trivial_assign.hpp +++ b/3rdParty/Boost/src/boost/type_traits/has_trivial_assign.hpp @@ -28,20 +28,27 @@ namespace detail { template <typename T> struct has_trivial_assign_impl { +#ifdef BOOST_HAS_TRIVIAL_ASSIGN + BOOST_STATIC_CONSTANT(bool, value = BOOST_HAS_TRIVIAL_ASSIGN(T)); +#else BOOST_STATIC_CONSTANT(bool, value = (::boost::type_traits::ice_and< - ::boost::type_traits::ice_or< - ::boost::is_pod<T>::value, - BOOST_HAS_TRIVIAL_ASSIGN(T) - >::value, - ::boost::type_traits::ice_not< ::boost::is_const<T>::value >::value, + ::boost::is_pod<T>::value, + ::boost::type_traits::ice_not< ::boost::is_const<T>::value >::value, ::boost::type_traits::ice_not< ::boost::is_volatile<T>::value >::value >::value)); +#endif }; } // namespace detail BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_trivial_assign,T,::boost::detail::has_trivial_assign_impl<T>::value) +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_assign,void,false) +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_assign,void const,false) +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_assign,void const volatile,false) +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_assign,void volatile,false) +#endif } // namespace boost diff --git a/3rdParty/Boost/src/boost/type_traits/has_trivial_constructor.hpp b/3rdParty/Boost/src/boost/type_traits/has_trivial_constructor.hpp index f9ade5d..30dbdd8 100644 --- a/3rdParty/Boost/src/boost/type_traits/has_trivial_constructor.hpp +++ b/3rdParty/Boost/src/boost/type_traits/has_trivial_constructor.hpp @@ -24,11 +24,19 @@ namespace detail { template <typename T> struct has_trivial_ctor_impl { +#ifdef BOOST_HAS_TRIVIAL_CONSTRUCTOR BOOST_STATIC_CONSTANT(bool, value = (::boost::type_traits::ice_or< ::boost::is_pod<T>::value, BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) >::value)); +#else + BOOST_STATIC_CONSTANT(bool, value = + (::boost::type_traits::ice_or< + ::boost::is_pod<T>::value, + false + >::value)); +#endif }; } // namespace detail diff --git a/3rdParty/Boost/src/boost/type_traits/has_trivial_copy.hpp b/3rdParty/Boost/src/boost/type_traits/has_trivial_copy.hpp index 8c75361..ba4d884 100644 --- a/3rdParty/Boost/src/boost/type_traits/has_trivial_copy.hpp +++ b/3rdParty/Boost/src/boost/type_traits/has_trivial_copy.hpp @@ -27,14 +27,15 @@ namespace detail { template <typename T> struct has_trivial_copy_impl { +#ifdef BOOST_HAS_TRIVIAL_COPY + BOOST_STATIC_CONSTANT(bool, value = BOOST_HAS_TRIVIAL_COPY(T)); +#else BOOST_STATIC_CONSTANT(bool, value = (::boost::type_traits::ice_and< - ::boost::type_traits::ice_or< - ::boost::is_pod<T>::value, - BOOST_HAS_TRIVIAL_COPY(T) - >::value, - ::boost::type_traits::ice_not< ::boost::is_volatile<T>::value >::value + ::boost::is_pod<T>::value, + ::boost::type_traits::ice_not< ::boost::is_volatile<T>::value >::value >::value)); +#endif }; } // namespace detail @@ -42,6 +43,20 @@ struct has_trivial_copy_impl BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_trivial_copy,T,::boost::detail::has_trivial_copy_impl<T>::value) BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_trivial_copy_constructor,T,::boost::detail::has_trivial_copy_impl<T>::value) +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_copy,void,false) +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_copy,void const,false) +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_copy,void const volatile,false) +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_copy,void volatile,false) +#endif + +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_copy_constructor,void,false) +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_copy_constructor,void const,false) +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_copy_constructor,void const volatile,false) +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_copy_constructor,void volatile,false) +#endif + } // namespace boost #include <boost/type_traits/detail/bool_trait_undef.hpp> diff --git a/3rdParty/Boost/src/boost/type_traits/has_trivial_destructor.hpp b/3rdParty/Boost/src/boost/type_traits/has_trivial_destructor.hpp index f2a8ce6..79d7522 100644 --- a/3rdParty/Boost/src/boost/type_traits/has_trivial_destructor.hpp +++ b/3rdParty/Boost/src/boost/type_traits/has_trivial_destructor.hpp @@ -24,17 +24,24 @@ namespace detail { template <typename T> struct has_trivial_dtor_impl { - BOOST_STATIC_CONSTANT(bool, value = - (::boost::type_traits::ice_or< - ::boost::is_pod<T>::value, - BOOST_HAS_TRIVIAL_DESTRUCTOR(T) - >::value)); +#ifdef BOOST_HAS_TRIVIAL_DESTRUCTOR + BOOST_STATIC_CONSTANT(bool, value = BOOST_HAS_TRIVIAL_DESTRUCTOR(T)); +#else + BOOST_STATIC_CONSTANT(bool, value = ::boost::is_pod<T>::value); +#endif }; } // namespace detail BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_trivial_destructor,T,::boost::detail::has_trivial_dtor_impl<T>::value) +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_destructor,void,false) +#ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_destructor,void const,false) +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_destructor,void const volatile,false) +BOOST_TT_AUX_BOOL_TRAIT_SPEC1(has_trivial_destructor,void volatile,false) +#endif + } // namespace boost #include <boost/type_traits/detail/bool_trait_undef.hpp> diff --git a/3rdParty/Boost/src/boost/type_traits/has_unary_minus.hpp b/3rdParty/Boost/src/boost/type_traits/has_unary_minus.hpp new file mode 100644 index 0000000..6b3157f --- /dev/null +++ b/3rdParty/Boost/src/boost/type_traits/has_unary_minus.hpp @@ -0,0 +1,25 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// 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/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_UNARY_MINUS_HPP_INCLUDED +#define BOOST_TT_HAS_UNARY_MINUS_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_unary_minus +#define BOOST_TT_TRAIT_OP - +#define BOOST_TT_FORBIDDEN_IF\ + /* pointer */\ + ::boost::is_pointer< Rhs_noref >::value + + +#include <boost/type_traits/detail/has_prefix_operator.hpp> + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/3rdParty/Boost/src/boost/type_traits/has_unary_plus.hpp b/3rdParty/Boost/src/boost/type_traits/has_unary_plus.hpp new file mode 100644 index 0000000..a61770f --- /dev/null +++ b/3rdParty/Boost/src/boost/type_traits/has_unary_plus.hpp @@ -0,0 +1,23 @@ +// (C) Copyright 2009-2011 Frederic Bron. +// +// 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/type_traits for most recent version including documentation. + +#ifndef BOOST_TT_HAS_UNARY_PLUS_HPP_INCLUDED +#define BOOST_TT_HAS_UNARY_PLUS_HPP_INCLUDED + +#define BOOST_TT_TRAIT_NAME has_unary_plus +#define BOOST_TT_TRAIT_OP + +#define BOOST_TT_FORBIDDEN_IF\ + false + +#include <boost/type_traits/detail/has_prefix_operator.hpp> + +#undef BOOST_TT_TRAIT_NAME +#undef BOOST_TT_TRAIT_OP +#undef BOOST_TT_FORBIDDEN_IF + +#endif diff --git a/3rdParty/Boost/src/boost/type_traits/has_virtual_destructor.hpp b/3rdParty/Boost/src/boost/type_traits/has_virtual_destructor.hpp index 8f99ff4..b741197 100644 --- a/3rdParty/Boost/src/boost/type_traits/has_virtual_destructor.hpp +++ b/3rdParty/Boost/src/boost/type_traits/has_virtual_destructor.hpp @@ -16,7 +16,11 @@ namespace boost { +#ifdef BOOST_HAS_VIRTUAL_DESTRUCTOR BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_virtual_destructor,T,BOOST_HAS_VIRTUAL_DESTRUCTOR(T)) +#else +BOOST_TT_AUX_BOOL_TRAIT_DEF1(has_virtual_destructor,T,false) +#endif } // namespace boost diff --git a/3rdParty/Boost/src/boost/type_traits/integral_promotion.hpp b/3rdParty/Boost/src/boost/type_traits/integral_promotion.hpp index a85e243..2109b9c 100644 --- a/3rdParty/Boost/src/boost/type_traits/integral_promotion.hpp +++ b/3rdParty/Boost/src/boost/type_traits/integral_promotion.hpp @@ -24,14 +24,14 @@ namespace boost { namespace type_traits { namespace detail { // 4.5/2 -template <class T> struct need_promotion : boost::is_enum<T> {}; +template <class T> struct need_promotion : public boost::is_enum<T> {}; // 4.5/1 -template<> struct need_promotion<char > : true_type {}; -template<> struct need_promotion<signed char > : true_type {}; -template<> struct need_promotion<unsigned char > : true_type {}; -template<> struct need_promotion<signed short int > : true_type {}; -template<> struct need_promotion<unsigned short int> : true_type {}; +template<> struct need_promotion<char > : public true_type {}; +template<> struct need_promotion<signed char > : public true_type {}; +template<> struct need_promotion<unsigned char > : public true_type {}; +template<> struct need_promotion<signed short int > : public true_type {}; +template<> struct need_promotion<unsigned short int> : public true_type {}; // Specializations for non-standard types. @@ -39,7 +39,7 @@ template<> struct need_promotion<unsigned short int> : true_type {}; #define BOOST_TT_AUX_PROMOTE_NONSTANDARD_TYPE(T) \ template<> struct need_promotion<T> \ - : integral_constant<bool, (sizeof(T) < sizeof(int))> {}; + : public integral_constant<bool, (sizeof(T) < sizeof(int))> {}; // Same set of integral types as in boost/type_traits/is_integral.hpp. // Please, keep in sync. @@ -72,13 +72,13 @@ BOOST_TT_AUX_PROMOTE_NONSTANDARD_TYPE( __int64) #ifndef BOOST_NO_INTRINSIC_WCHAR_T // 4.5/2 -template<> struct need_promotion<wchar_t> : true_type {}; +template<> struct need_promotion<wchar_t> : public true_type {}; #endif // 4.5/3 (integral bit-field) is not supported. // 4.5/4 -template<> struct need_promotion<bool> : true_type {}; +template<> struct need_promotion<bool> : public true_type {}; // Get promoted type by index and cv qualifiers. @@ -171,7 +171,7 @@ struct integral_promotion_impl template<class T> struct integral_promotion - : boost::mpl::eval_if< + : public boost::mpl::eval_if< need_promotion<BOOST_DEDUCED_TYPENAME remove_cv<T>::type> , integral_promotion_impl<T> , boost::mpl::identity<T> diff --git a/3rdParty/Boost/src/boost/type_traits/intrinsics.hpp b/3rdParty/Boost/src/boost/type_traits/intrinsics.hpp index 9666456..8408ec3 100644 --- a/3rdParty/Boost/src/boost/type_traits/intrinsics.hpp +++ b/3rdParty/Boost/src/boost/type_traits/intrinsics.hpp @@ -1,4 +1,3 @@ - // (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 @@ -22,7 +21,7 @@ // (these should largely ignore cv-qualifiers) // BOOST_IS_UNION(T) should evaluate to true if T is a union type // BOOST_IS_POD(T) should evaluate to true if T is a POD type -// BOOST_IS_EMPTY(T) should evaluate to true if T is an empty struct or union +// BOOST_IS_EMPTY(T) should evaluate to true if T is an empty class type (and not a union) // BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) should evaluate to true if "T x;" has no effect // BOOST_HAS_TRIVIAL_COPY(T) should evaluate to true if T(t) <==> memcpy // BOOST_HAS_TRIVIAL_ASSIGN(T) should evaluate to true if t = u <==> memcpy @@ -33,12 +32,10 @@ // BOOST_HAS_VIRTUAL_DESTRUCTOR(T) should evaluate to true T has a virtual destructor // // The following can also be defined: when detected our implementation is greatly simplified. -// Note that unlike the macros above these do not have default definitions, so we can use -// #ifdef MACRONAME to detect when these are available. // // BOOST_IS_ABSTRACT(T) true if T is an abstract type // BOOST_IS_BASE_OF(T,U) true if T is a base class of U -// BOOST_IS_CLASS(T) true if T is a class type +// BOOST_IS_CLASS(T) true if T is a class type (and not a union) // BOOST_IS_CONVERTIBLE(T,U) true if T is convertible to U // BOOST_IS_ENUM(T) true is T is an enum // BOOST_IS_POLYMORPHIC(T) true if T is a polymorphic type @@ -89,19 +86,18 @@ # define BOOST_IS_POD(T) (__is_pod(T) && __has_trivial_constructor(T)) # define BOOST_IS_EMPTY(T) __is_empty(T) # define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) __has_trivial_constructor(T) -# define BOOST_HAS_TRIVIAL_COPY(T) __has_trivial_copy(T) -# define BOOST_HAS_TRIVIAL_ASSIGN(T) __has_trivial_assign(T) -# define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) __has_trivial_destructor(T) -# define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) __has_nothrow_constructor(T) -# define BOOST_HAS_NOTHROW_COPY(T) __has_nothrow_copy(T) -# define BOOST_HAS_NOTHROW_ASSIGN(T) __has_nothrow_assign(T) +# define BOOST_HAS_TRIVIAL_COPY(T) (__has_trivial_copy(T)|| ( ::boost::is_pod<T>::value && !::boost::is_volatile<T>::value)) +# define BOOST_HAS_TRIVIAL_ASSIGN(T) (__has_trivial_assign(T) || ( ::boost::is_pod<T>::value && ! ::boost::is_const<T>::value && !::boost::is_volatile<T>::value)) +# define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) (__has_trivial_destructor(T) || ::boost::is_pod<T>::value) +# define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) (__has_nothrow_constructor(T) || ::boost::has_trivial_constructor<T>::value) +# define BOOST_HAS_NOTHROW_COPY(T) (__has_nothrow_copy(T) || ::boost::has_trivial_copy<T>::value) +# define BOOST_HAS_NOTHROW_ASSIGN(T) (__has_nothrow_assign(T) || ::boost::has_trivial_assign<T>::value) # define BOOST_HAS_VIRTUAL_DESTRUCTOR(T) __has_virtual_destructor(T) # define BOOST_IS_ABSTRACT(T) __is_abstract(T) # define BOOST_IS_BASE_OF(T,U) (__is_base_of(T,U) && !is_same<T,U>::value) # define BOOST_IS_CLASS(T) __is_class(T) -// This one doesn't quite always do the right thing: -// # define BOOST_IS_CONVERTIBLE(T,U) __is_convertible_to(T,U) +# define BOOST_IS_CONVERTIBLE(T,U) ((__is_convertible_to(T,U) || is_same<T,U>::value) && !__is_abstract(U)) # define BOOST_IS_ENUM(T) __is_enum(T) // This one doesn't quite always do the right thing: // # define BOOST_IS_POLYMORPHIC(T) __is_polymorphic(T) @@ -127,21 +123,90 @@ # define BOOST_HAS_TYPE_TRAITS_INTRINSICS #endif -#if defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3) && !defined(__GCCXML__))) +#if defined(BOOST_CLANG) && defined(__has_feature) +# include <cstddef> +# include <boost/type_traits/is_same.hpp> +# include <boost/type_traits/is_reference.hpp> +# include <boost/type_traits/is_volatile.hpp> + +# if __has_feature(is_union) +# define BOOST_IS_UNION(T) __is_union(T) +# endif +# if (!defined(__GLIBCXX__) || (__GLIBCXX__ >= 20080306 && __GLIBCXX__ != 20080519)) && __has_feature(is_pod) +# define BOOST_IS_POD(T) __is_pod(T) +# endif +# if (!defined(__GLIBCXX__) || (__GLIBCXX__ >= 20080306 && __GLIBCXX__ != 20080519)) && __has_feature(is_empty) +# define BOOST_IS_EMPTY(T) __is_empty(T) +# endif +# if __has_feature(has_trivial_constructor) +# define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) __has_trivial_constructor(T) +# endif +# if __has_feature(has_trivial_copy) +# define BOOST_HAS_TRIVIAL_COPY(T) (__has_trivial_copy(T) && !is_reference<T>::value && !is_volatile<T>::value) +# endif +# if __has_feature(has_trivial_assign) +# define BOOST_HAS_TRIVIAL_ASSIGN(T) (__has_trivial_assign(T) && !is_volatile<T>::value) +# endif +# if __has_feature(has_trivial_destructor) +# define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) __has_trivial_destructor(T) +# endif +# if __has_feature(has_nothrow_constructor) +# define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) __has_nothrow_constructor(T) +# endif +# if __has_feature(has_nothrow_copy) +# define BOOST_HAS_NOTHROW_COPY(T) (__has_nothrow_copy(T) && !is_volatile<T>::value && !is_reference<T>::value) +# endif +# if __has_feature(has_nothrow_assign) +# define BOOST_HAS_NOTHROW_ASSIGN(T) (__has_nothrow_assign(T) && !is_volatile<T>::value) +# endif +# if __has_feature(has_virtual_destructor) +# define BOOST_HAS_VIRTUAL_DESTRUCTOR(T) __has_virtual_destructor(T) +# endif +# if __has_feature(is_abstract) +# define BOOST_IS_ABSTRACT(T) __is_abstract(T) +# endif +# if __has_feature(is_base_of) +# define BOOST_IS_BASE_OF(T,U) (__is_base_of(T,U) && !is_same<T,U>::value) +# endif +# if __has_feature(is_class) +# define BOOST_IS_CLASS(T) __is_class(T) +# endif +# if __has_feature(is_convertible_to) +# include <boost/type_traits/is_abstract.hpp> +# define BOOST_IS_CONVERTIBLE(T,U) (__is_convertible_to(T,U) && !::boost::is_abstract<U>::value) +# endif +# if __has_feature(is_enum) +# define BOOST_IS_ENUM(T) __is_enum(T) +# endif +# if __has_feature(is_polymorphic) +# define BOOST_IS_POLYMORPHIC(T) __is_polymorphic(T) +# endif +# define BOOST_ALIGNMENT_OF(T) __alignof(T) + +# define BOOST_HAS_TYPE_TRAITS_INTRINSICS +#endif + +#if defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 3) && !defined(__GCCXML__))) && !defined(BOOST_CLANG) # include <boost/type_traits/is_same.hpp> # include <boost/type_traits/is_reference.hpp> # include <boost/type_traits/is_volatile.hpp> +#ifdef BOOST_INTEL +# define BOOST_INTEL_TT_OPTS || is_pod<T>::value +#else +# define BOOST_INTEL_TT_OPTS +#endif + # define BOOST_IS_UNION(T) __is_union(T) # define BOOST_IS_POD(T) __is_pod(T) # define BOOST_IS_EMPTY(T) __is_empty(T) -# define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) __has_trivial_constructor(T) -# define BOOST_HAS_TRIVIAL_COPY(T) (__has_trivial_copy(T) && !is_reference<T>::value) -# define BOOST_HAS_TRIVIAL_ASSIGN(T) __has_trivial_assign(T) -# define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) __has_trivial_destructor(T) -# define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) __has_nothrow_constructor(T) -# define BOOST_HAS_NOTHROW_COPY(T) (__has_nothrow_copy(T) && !is_volatile<T>::value && !is_reference<T>::value) -# define BOOST_HAS_NOTHROW_ASSIGN(T) (__has_nothrow_assign(T) && !is_volatile<T>::value) +# define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) ((__has_trivial_constructor(T) BOOST_INTEL_TT_OPTS) && ! ::boost::is_volatile<T>::value) +# define BOOST_HAS_TRIVIAL_COPY(T) ((__has_trivial_copy(T) BOOST_INTEL_TT_OPTS) && !is_reference<T>::value && ! ::boost::is_volatile<T>::value) +# define BOOST_HAS_TRIVIAL_ASSIGN(T) ((__has_trivial_assign(T) BOOST_INTEL_TT_OPTS) && ! ::boost::is_volatile<T>::value && ! ::boost::is_const<T>::value) +# define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) (__has_trivial_destructor(T) BOOST_INTEL_TT_OPTS) +# define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) (__has_nothrow_constructor(T) BOOST_INTEL_TT_OPTS) +# define BOOST_HAS_NOTHROW_COPY(T) ((__has_nothrow_copy(T) BOOST_INTEL_TT_OPTS) && !is_volatile<T>::value && !is_reference<T>::value) +# define BOOST_HAS_NOTHROW_ASSIGN(T) ((__has_nothrow_assign(T) BOOST_INTEL_TT_OPTS) && !is_volatile<T>::value && !is_const<T>::value) # define BOOST_HAS_VIRTUAL_DESTRUCTOR(T) __has_virtual_destructor(T) # define BOOST_IS_ABSTRACT(T) __is_abstract(T) @@ -168,8 +233,8 @@ # define BOOST_IS_POD(T) __is_pod(T) # define BOOST_IS_EMPTY(T) __is_empty(T) # define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) __has_trivial_constructor(T) -# define BOOST_HAS_TRIVIAL_COPY(T) (__has_trivial_copy(T) && !is_reference<T>::value) -# define BOOST_HAS_TRIVIAL_ASSIGN(T) __has_trivial_assign(T) +# define BOOST_HAS_TRIVIAL_COPY(T) (__has_trivial_copy(T) && !is_reference<T>::value && !is_volatile<T>::value) +# define BOOST_HAS_TRIVIAL_ASSIGN(T) (__has_trivial_assign(T) && !is_volatile<T>::value) # define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) __has_trivial_destructor(T) # define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) __has_nothrow_constructor(T) # define BOOST_HAS_NOTHROW_COPY(T) (__has_nothrow_copy(T) && !is_volatile<T>::value && !is_reference<T>::value) @@ -195,13 +260,13 @@ # define BOOST_IS_UNION(T) __is_union(T) # define BOOST_IS_POD(T) __is_pod(T) # define BOOST_IS_EMPTY(T) __is_empty(T) -# define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) (__has_trivial_default_constructor(T) || is_void<T>::value) -# define BOOST_HAS_TRIVIAL_COPY(T) (__has_trivial_copy_constructor(T) && !is_volatile<T>::value && !is_reference<T>::value || is_void<T>::value) -# define BOOST_HAS_TRIVIAL_ASSIGN(T) (__has_trivial_assign(T) && !is_volatile<T>::value || is_void<T>::value) -# define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) (__has_trivial_destructor(T) || is_void<T>::value) -# define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) (__has_nothrow_default_constructor(T) || is_void<T>::value) -# define BOOST_HAS_NOTHROW_COPY(T) (__has_nothrow_copy_constructor(T) && !is_volatile<T>::value && !is_reference<T>::value || is_void<T>::value) -# define BOOST_HAS_NOTHROW_ASSIGN(T) (__has_nothrow_assign(T) && !is_volatile<T>::value || is_void<T>::value) +# define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) (__has_trivial_default_constructor(T)) +# define BOOST_HAS_TRIVIAL_COPY(T) (__has_trivial_copy_constructor(T) && !is_volatile<T>::value && !is_reference<T>::value) +# define BOOST_HAS_TRIVIAL_ASSIGN(T) (__has_trivial_assign(T) && !is_volatile<T>::value) +# define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) (__has_trivial_destructor(T)) +# define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) (__has_nothrow_default_constructor(T)) +# define BOOST_HAS_NOTHROW_COPY(T) (__has_nothrow_copy_constructor(T) && !is_volatile<T>::value && !is_reference<T>::value) +# define BOOST_HAS_NOTHROW_ASSIGN(T) (__has_nothrow_assign(T) && !is_volatile<T>::value) # define BOOST_HAS_VIRTUAL_DESTRUCTOR(T) __has_virtual_destructor(T) # define BOOST_IS_ABSTRACT(T) __is_abstract(T) @@ -215,53 +280,10 @@ # define BOOST_HAS_TYPE_TRAITS_INTRINSICS #endif -#ifndef BOOST_IS_UNION -# define BOOST_IS_UNION(T) false -#endif - -#ifndef BOOST_IS_POD -# define BOOST_IS_POD(T) false -#endif - -#ifndef BOOST_IS_EMPTY -# define BOOST_IS_EMPTY(T) false -#endif - -#ifndef BOOST_HAS_TRIVIAL_CONSTRUCTOR -# define BOOST_HAS_TRIVIAL_CONSTRUCTOR(T) false -#endif - -#ifndef BOOST_HAS_TRIVIAL_COPY -# define BOOST_HAS_TRIVIAL_COPY(T) false -#endif - -#ifndef BOOST_HAS_TRIVIAL_ASSIGN -# define BOOST_HAS_TRIVIAL_ASSIGN(T) false -#endif - -#ifndef BOOST_HAS_TRIVIAL_DESTRUCTOR -# define BOOST_HAS_TRIVIAL_DESTRUCTOR(T) false -#endif - -#ifndef BOOST_HAS_NOTHROW_CONSTRUCTOR -# define BOOST_HAS_NOTHROW_CONSTRUCTOR(T) false -#endif - -#ifndef BOOST_HAS_NOTHROW_COPY -# define BOOST_HAS_NOTHROW_COPY(T) false -#endif - -#ifndef BOOST_HAS_NOTHROW_ASSIGN -# define BOOST_HAS_NOTHROW_ASSIGN(T) false -#endif - -#ifndef BOOST_HAS_VIRTUAL_DESTRUCTOR -# define BOOST_HAS_VIRTUAL_DESTRUCTOR(T) false -#endif - #endif // BOOST_TT_INTRINSICS_HPP_INCLUDED + diff --git a/3rdParty/Boost/src/boost/type_traits/is_const.hpp b/3rdParty/Boost/src/boost/type_traits/is_const.hpp index 99b0f36..f24b71a 100644 --- a/3rdParty/Boost/src/boost/type_traits/is_const.hpp +++ b/3rdParty/Boost/src/boost/type_traits/is_const.hpp @@ -106,7 +106,7 @@ no_type is_const_tester(volatile void *); template <bool is_ref, bool array> struct is_const_helper - : ::boost::type_traits::false_result + : public ::boost::type_traits::false_result { }; @@ -136,7 +136,7 @@ struct is_const_helper<false,true> template <typename T> struct is_const_impl - : is_const_helper< + : public is_const_helper< is_reference<T>::value , is_array<T>::value >::template result_<T> diff --git a/3rdParty/Boost/src/boost/type_traits/is_convertible.hpp b/3rdParty/Boost/src/boost/type_traits/is_convertible.hpp index c05c297..0d42c46 100644 --- a/3rdParty/Boost/src/boost/type_traits/is_convertible.hpp +++ b/3rdParty/Boost/src/boost/type_traits/is_convertible.hpp @@ -24,6 +24,7 @@ #ifndef BOOST_NO_IS_ABSTRACT #include <boost/type_traits/is_abstract.hpp> #endif +#include <boost/type_traits/add_rvalue_reference.hpp> #if defined(__MWERKS__) #include <boost/type_traits/is_function.hpp> @@ -68,7 +69,7 @@ struct does_conversion_exist { static no_type BOOST_TT_DECL _m_check(...); static yes_type BOOST_TT_DECL _m_check(To); - static From _m_from; + static typename add_rvalue_reference<From>::type _m_from; enum { value = sizeof( _m_check(_m_from) ) == sizeof(yes_type) }; }; }; @@ -84,7 +85,7 @@ struct does_conversion_exist<void> template <typename From, typename To> struct is_convertible_basic_impl - : does_conversion_exist<From>::template result_<To> + : public does_conversion_exist<From>::template result_<To> { }; @@ -106,7 +107,7 @@ struct is_convertible_impl static ::boost::type_traits::yes_type BOOST_TT_DECL _m_check(T); }; - static From _m_from; + static typename add_rvalue_reference<From>::type _m_from; static bool const value = sizeof( checker<To>::_m_check(_m_from) ) == sizeof(::boost::type_traits::yes_type); #pragma option pop @@ -131,7 +132,7 @@ template <typename T> struct checker template <typename From, typename To> struct is_convertible_basic_impl { - static From _m_from; + static typename add_rvalue_reference<From>::type _m_from; static bool const value = sizeof( boost::detail::checker<To>::_m_check(_m_from, 0) ) == sizeof(::boost::type_traits::yes_type); }; @@ -161,7 +162,7 @@ struct is_convertible_basic_impl { static ::boost::type_traits::no_type BOOST_TT_DECL _m_check(any_conversion ...); static ::boost::type_traits::yes_type BOOST_TT_DECL _m_check(To, int); - static From _m_from; + static typename add_rvalue_reference<From>::type _m_from; BOOST_STATIC_CONSTANT(bool, value = sizeof( _m_check(_m_from, 0) ) == sizeof(::boost::type_traits::yes_type) @@ -185,7 +186,7 @@ struct is_convertible_basic_impl template <class T> static ::boost::type_traits::no_type BOOST_TT_DECL _m_check(any_conversion, float, T); static ::boost::type_traits::yes_type BOOST_TT_DECL _m_check(To, int, int); - static From _m_from; + static typename add_rvalue_reference<From>::type _m_from; // Static constants sometime cause the conversion of _m_from to To to be // called. This doesn't happen with an enum. @@ -215,7 +216,7 @@ struct is_convertible_basic_impl_aux<From,To,false /*FromIsFunctionRef*/> { static ::boost::type_traits::no_type BOOST_TT_DECL _m_check(any_conversion ...); static ::boost::type_traits::yes_type BOOST_TT_DECL _m_check(To, int); - static From _m_from; + static typename add_rvalue_reference<From>::type _m_from; BOOST_STATIC_CONSTANT(bool, value = sizeof( _m_check(_m_from, 0) ) == sizeof(::boost::type_traits::yes_type) @@ -227,7 +228,7 @@ struct is_convertible_basic_impl_aux<From,To,true /*FromIsFunctionRef*/> { static ::boost::type_traits::no_type BOOST_TT_DECL _m_check(...); static ::boost::type_traits::yes_type BOOST_TT_DECL _m_check(To); - static From _m_from; + static typename add_rvalue_reference<From>::type _m_from; BOOST_STATIC_CONSTANT(bool, value = sizeof( _m_check(_m_from) ) == sizeof(::boost::type_traits::yes_type) ); @@ -252,7 +253,7 @@ struct is_convertible_basic_impl { static ::boost::type_traits::no_type BOOST_TT_DECL _m_check(...); static ::boost::type_traits::yes_type BOOST_TT_DECL _m_check(To); - static From _m_from; + static typename add_rvalue_reference<From>::type _m_from; #ifdef BOOST_MSVC #pragma warning(push) #pragma warning(disable:4244) @@ -402,14 +403,14 @@ struct is_convertible_impl_dispatch #ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(typename To,is_convertible,void,To,false) -BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(typename From,is_convertible,From,void,true) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(typename From,is_convertible,From,void,false) #ifndef BOOST_NO_CV_VOID_SPECIALIZATIONS BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(typename To,is_convertible,void const,To,false) BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(typename To,is_convertible,void volatile,To,false) BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(typename To,is_convertible,void const volatile,To,false) -BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(typename From,is_convertible,From,void const,true) -BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(typename From,is_convertible,From,void volatile,true) -BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(typename From,is_convertible,From,void const volatile,true) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(typename From,is_convertible,From,void const,false) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(typename From,is_convertible,From,void volatile,false) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_PARTIAL_SPEC2_1(typename From,is_convertible,From,void const volatile,false) #endif #endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION diff --git a/3rdParty/Boost/src/boost/type_traits/is_empty.hpp b/3rdParty/Boost/src/boost/type_traits/is_empty.hpp index 45c4e9e..8a2c5b8 100644 --- a/3rdParty/Boost/src/boost/type_traits/is_empty.hpp +++ b/3rdParty/Boost/src/boost/type_traits/is_empty.hpp @@ -31,6 +31,12 @@ // should be always the last #include directive #include <boost/type_traits/detail/bool_trait_def.hpp> +#ifndef BOOST_INTERNAL_IS_EMPTY +#define BOOST_INTERNAL_IS_EMPTY(T) false +#else +#define BOOST_INTERNAL_IS_EMPTY(T) BOOST_IS_EMPTY(T) +#endif + namespace boost { namespace detail { @@ -83,7 +89,7 @@ struct is_empty_impl bool, value = ( ::boost::type_traits::ice_or< ::boost::detail::empty_helper<cvt,::boost::is_class<T>::value>::value - , BOOST_IS_EMPTY(cvt) + , BOOST_INTERNAL_IS_EMPTY(cvt) >::value )); }; @@ -118,7 +124,7 @@ struct is_empty_impl , ::boost::is_class<T>::value , ::boost::is_convertible< r_type,int>::value >::value - , BOOST_IS_EMPTY(cvt) + , BOOST_INTERNAL_IS_EMPTY(cvt) >::value)); }; @@ -187,14 +193,14 @@ struct is_empty_impl typedef typename result::type eh_type; BOOST_STATIC_CONSTANT(bool, value = - (::boost::type_traits::ice_or<eh_type::value, BOOST_IS_EMPTY(T)>::value)); + (::boost::type_traits::ice_or<eh_type::value, BOOST_INTERNAL_IS_EMPTY(T)>::value)); }; #else template <typename T> struct is_empty_impl { - BOOST_STATIC_CONSTANT(bool, value = BOOST_IS_EMPTY(T)); + BOOST_STATIC_CONSTANT(bool, value = BOOST_INTERNAL_IS_EMPTY(T)); }; #endif // BOOST_MSVC6_MEMBER_TEMPLATES @@ -217,5 +223,7 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_empty,T,::boost::detail::is_empty_impl<T>::value #include <boost/type_traits/detail/bool_trait_undef.hpp> +#undef BOOST_INTERNAL_IS_EMPTY + #endif // BOOST_TT_IS_EMPTY_HPP_INCLUDED diff --git a/3rdParty/Boost/src/boost/type_traits/is_enum.hpp b/3rdParty/Boost/src/boost/type_traits/is_enum.hpp index 86fa66d..e35548c 100644 --- a/3rdParty/Boost/src/boost/type_traits/is_enum.hpp +++ b/3rdParty/Boost/src/boost/type_traits/is_enum.hpp @@ -95,7 +95,7 @@ template <> struct is_enum_helper<false> { template <typename T> struct type - : ::boost::is_convertible<typename boost::add_reference<T>::type,::boost::detail::int_convertible> + : public ::boost::is_convertible<typename boost::add_reference<T>::type,::boost::detail::int_convertible> { }; }; diff --git a/3rdParty/Boost/src/boost/type_traits/is_function.hpp b/3rdParty/Boost/src/boost/type_traits/is_function.hpp index 55c05c1..2cb1bb9 100644 --- a/3rdParty/Boost/src/boost/type_traits/is_function.hpp +++ b/3rdParty/Boost/src/boost/type_traits/is_function.hpp @@ -40,7 +40,7 @@ namespace detail { #if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_TT_TEST_MS_FUNC_SIGS) template<bool is_ref = true> struct is_function_chooser - : ::boost::type_traits::false_result + : public ::boost::type_traits::false_result { }; @@ -48,14 +48,14 @@ template <> struct is_function_chooser<false> { template< typename T > struct result_ - : ::boost::type_traits::is_function_ptr_helper<T*> + : public ::boost::type_traits::is_function_ptr_helper<T*> { }; }; template <typename T> struct is_function_impl - : is_function_chooser< ::boost::is_reference<T>::value > + : public is_function_chooser< ::boost::is_reference<T>::value > ::BOOST_NESTED_TEMPLATE result_<T> { }; diff --git a/3rdParty/Boost/src/boost/type_traits/is_fundamental.hpp b/3rdParty/Boost/src/boost/type_traits/is_fundamental.hpp index 6aff7dd..138e296 100644 --- a/3rdParty/Boost/src/boost/type_traits/is_fundamental.hpp +++ b/3rdParty/Boost/src/boost/type_traits/is_fundamental.hpp @@ -22,7 +22,7 @@ namespace detail { template <typename T> struct is_fundamental_impl - : ::boost::type_traits::ice_or< + : public ::boost::type_traits::ice_or< ::boost::is_arithmetic<T>::value , ::boost::is_void<T>::value > diff --git a/3rdParty/Boost/src/boost/type_traits/is_member_function_pointer.hpp b/3rdParty/Boost/src/boost/type_traits/is_member_function_pointer.hpp index 81f1eac..38babf4 100644 --- a/3rdParty/Boost/src/boost/type_traits/is_member_function_pointer.hpp +++ b/3rdParty/Boost/src/boost/type_traits/is_member_function_pointer.hpp @@ -55,7 +55,7 @@ namespace detail { template <bool> struct is_mem_fun_pointer_select - : ::boost::type_traits::false_result + : public ::boost::type_traits::false_result { }; @@ -83,7 +83,7 @@ struct is_mem_fun_pointer_select<false> template <typename T> struct is_member_function_pointer_impl - : is_mem_fun_pointer_select< + : public is_mem_fun_pointer_select< ::boost::type_traits::ice_or< ::boost::is_reference<T>::value , ::boost::is_array<T>::value diff --git a/3rdParty/Boost/src/boost/type_traits/is_member_pointer.hpp b/3rdParty/Boost/src/boost/type_traits/is_member_pointer.hpp index ba02b89..a4a6d25 100644 --- a/3rdParty/Boost/src/boost/type_traits/is_member_pointer.hpp +++ b/3rdParty/Boost/src/boost/type_traits/is_member_pointer.hpp @@ -66,7 +66,7 @@ template <typename R, typename T> template <bool> struct is_member_pointer_select - : ::boost::type_traits::false_result + : public ::boost::type_traits::false_result { }; @@ -87,7 +87,7 @@ struct is_member_pointer_select<false> template <typename T> struct is_member_pointer_impl - : is_member_pointer_select< + : public is_member_pointer_select< ::boost::type_traits::ice_or< ::boost::is_reference<T>::value , ::boost::is_array<T>::value diff --git a/3rdParty/Boost/src/boost/type_traits/is_pod.hpp b/3rdParty/Boost/src/boost/type_traits/is_pod.hpp index af2c3c4..4691e66 100644 --- a/3rdParty/Boost/src/boost/type_traits/is_pod.hpp +++ b/3rdParty/Boost/src/boost/type_traits/is_pod.hpp @@ -20,6 +20,12 @@ // should be the last #include #include <boost/type_traits/detail/bool_trait_def.hpp> +#ifndef BOOST_IS_POD +#define BOOST_INTERNAL_IS_POD(T) false +#else +#define BOOST_INTERNAL_IS_POD(T) BOOST_IS_POD(T) +#endif + namespace boost { // forward declaration, needed by 'is_pod_array_helper' template below @@ -36,14 +42,14 @@ template <typename T> struct is_pod_impl (::boost::type_traits::ice_or< ::boost::is_scalar<T>::value, ::boost::is_void<T>::value, - BOOST_IS_POD(T) + BOOST_INTERNAL_IS_POD(T) >::value)); }; #if !defined(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS) template <typename T, std::size_t sz> struct is_pod_impl<T[sz]> - : is_pod_impl<T> + : public is_pod_impl<T> { }; #endif @@ -60,7 +66,7 @@ struct is_pod_helper (::boost::type_traits::ice_or< ::boost::is_scalar<T>::value, ::boost::is_void<T>::value, - BOOST_IS_POD(T) + BOOST_INTERNAL_IS_POD(T) >::value)); }; }; @@ -132,4 +138,6 @@ BOOST_TT_AUX_BOOL_TRAIT_DEF1(is_pod,T,::boost::detail::is_pod_impl<T>::value) #include <boost/type_traits/detail/bool_trait_undef.hpp> +#undef BOOST_INTERNAL_IS_POD + #endif // BOOST_TT_IS_POD_HPP_INCLUDED diff --git a/3rdParty/Boost/src/boost/type_traits/is_pointer.hpp b/3rdParty/Boost/src/boost/type_traits/is_pointer.hpp index f6ecf33..4e29bb3 100644 --- a/3rdParty/Boost/src/boost/type_traits/is_pointer.hpp +++ b/3rdParty/Boost/src/boost/type_traits/is_pointer.hpp @@ -113,7 +113,7 @@ no_type BOOST_TT_DECL is_pointer_tester(...); template <bool> struct is_pointer_select - : ::boost::type_traits::false_result + : public ::boost::type_traits::false_result { }; @@ -133,7 +133,7 @@ struct is_pointer_select<false> template <typename T> struct is_pointer_impl - : is_pointer_select< + : public is_pointer_select< ::boost::type_traits::ice_or< ::boost::is_reference<T>::value , ::boost::is_array<T>::value diff --git a/3rdParty/Boost/src/boost/type_traits/is_union.hpp b/3rdParty/Boost/src/boost/type_traits/is_union.hpp index 25bddcc..610f162 100644 --- a/3rdParty/Boost/src/boost/type_traits/is_union.hpp +++ b/3rdParty/Boost/src/boost/type_traits/is_union.hpp @@ -25,7 +25,11 @@ namespace detail { template <typename T> struct is_union_impl { typedef typename remove_cv<T>::type cvt; +#ifdef BOOST_IS_UNION BOOST_STATIC_CONSTANT(bool, value = BOOST_IS_UNION(cvt)); +#else + BOOST_STATIC_CONSTANT(bool, value = false); +#endif }; #else // @@ -35,7 +39,11 @@ template <typename T> struct is_union_impl // template <typename T> struct is_union_impl { +#ifdef BOOST_IS_UNION BOOST_STATIC_CONSTANT(bool, value = BOOST_IS_UNION(T)); +#else + BOOST_STATIC_CONSTANT(bool, value = false); +#endif }; #endif } // namespace detail diff --git a/3rdParty/Boost/src/boost/type_traits/is_unsigned.hpp b/3rdParty/Boost/src/boost/type_traits/is_unsigned.hpp index d8e5a89..0602838 100644 --- a/3rdParty/Boost/src/boost/type_traits/is_unsigned.hpp +++ b/3rdParty/Boost/src/boost/type_traits/is_unsigned.hpp @@ -109,7 +109,7 @@ template <> struct is_unsigned_imp<const char> : public true_type{}; template <> struct is_unsigned_imp<volatile char> : public true_type{}; template <> struct is_unsigned_imp<const volatile char> : public true_type{}; #endif -#if defined(WCHAR_MIN) && (WCHAR_MIN == 0) +#if defined(WCHAR_MIN) && (WCHAR_MIN == 0) && !defined(BOOST_NO_INTRINSIC_WCHAR_T) template <> struct is_unsigned_imp<wchar_t> : public true_type{}; template <> struct is_unsigned_imp<const wchar_t> : public true_type{}; template <> struct is_unsigned_imp<volatile wchar_t> : public true_type{}; diff --git a/3rdParty/Boost/src/boost/type_traits/is_virtual_base_of.hpp b/3rdParty/Boost/src/boost/type_traits/is_virtual_base_of.hpp index 8dcd988..f57cb61 100644 --- a/3rdParty/Boost/src/boost/type_traits/is_virtual_base_of.hpp +++ b/3rdParty/Boost/src/boost/type_traits/is_virtual_base_of.hpp @@ -23,7 +23,7 @@ namespace detail { #ifdef BOOST_MSVC #pragma warning( push ) #pragma warning( disable : 4584 4250) -#elif defined __GNUC__ +#elif defined(__GNUC__) && (__GNUC__ >= 4) #pragma GCC system_header #endif @@ -52,14 +52,14 @@ struct is_virtual_base_of_impl<Base, Derived, mpl::true_> ~boost_type_traits_internal_struct_Y()throw(); }; #else - struct boost_type_traits_internal_struct_X : Derived, virtual Base + struct boost_type_traits_internal_struct_X : public Derived, virtual Base { boost_type_traits_internal_struct_X(); boost_type_traits_internal_struct_X(const boost_type_traits_internal_struct_X&); boost_type_traits_internal_struct_X& operator=(const boost_type_traits_internal_struct_X&); ~boost_type_traits_internal_struct_X()throw(); }; - struct boost_type_traits_internal_struct_Y : Derived + struct boost_type_traits_internal_struct_Y : public Derived { boost_type_traits_internal_struct_Y(); boost_type_traits_internal_struct_Y(const boost_type_traits_internal_struct_Y&); diff --git a/3rdParty/Boost/src/boost/type_traits/is_volatile.hpp b/3rdParty/Boost/src/boost/type_traits/is_volatile.hpp index 43c3a8b..863747d 100644 --- a/3rdParty/Boost/src/boost/type_traits/is_volatile.hpp +++ b/3rdParty/Boost/src/boost/type_traits/is_volatile.hpp @@ -94,7 +94,7 @@ no_type is_volatile_tester(void const*); template <bool is_ref, bool array> struct is_volatile_helper - : ::boost::type_traits::false_result + : public ::boost::type_traits::false_result { }; @@ -124,7 +124,7 @@ struct is_volatile_helper<false,true> template <typename T> struct is_volatile_impl - : is_volatile_helper< + : public is_volatile_helper< is_reference<T>::value , is_array<T>::value >::template result_<T> diff --git a/3rdParty/Boost/src/boost/type_traits/msvc/typeof.hpp b/3rdParty/Boost/src/boost/type_traits/msvc/typeof.hpp index ebb0e80..b95785d 100644 --- a/3rdParty/Boost/src/boost/type_traits/msvc/typeof.hpp +++ b/3rdParty/Boost/src/boost/type_traits/msvc/typeof.hpp @@ -20,7 +20,7 @@ namespace boost { namespace detail { }; template<typename T, typename ID> - struct msvc_register_type : msvc_extract_type<ID> + struct msvc_register_type : public msvc_extract_type<ID> { template<> struct id2type_impl<true> //VC7.0 specific bugfeature @@ -36,7 +36,7 @@ namespace boost { namespace detail { }; template<typename T, typename ID> - struct msvc_register_type : msvc_extract_type<ID> + struct msvc_register_type : public msvc_extract_type<ID> { typedef msvc_extract_type<ID> base_type; struct base_type::id2type // This uses nice VC6.5 and VC7.1 bugfeature diff --git a/3rdParty/Boost/src/boost/type_traits/promote.hpp b/3rdParty/Boost/src/boost/type_traits/promote.hpp index 14efad4..60f6278 100644 --- a/3rdParty/Boost/src/boost/type_traits/promote.hpp +++ b/3rdParty/Boost/src/boost/type_traits/promote.hpp @@ -19,7 +19,7 @@ namespace detail { template<class T> struct promote_impl - : integral_promotion< + : public integral_promotion< BOOST_DEDUCED_TYPENAME floating_point_promotion<T>::type > { diff --git a/3rdParty/Boost/src/boost/type_traits/remove_cv.hpp b/3rdParty/Boost/src/boost/type_traits/remove_cv.hpp index 4061fd2..ee6d8f9 100644 --- a/3rdParty/Boost/src/boost/type_traits/remove_cv.hpp +++ b/3rdParty/Boost/src/boost/type_traits/remove_cv.hpp @@ -27,6 +27,8 @@ namespace boost { +#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION + namespace detail{ template <class T> @@ -49,7 +51,6 @@ struct rvalue_ref_filter_rem_cv<T&&> } -#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION // convert a type T to a non-cv-qualified type - remove_cv<T> BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_cv,T,typename boost::detail::rvalue_ref_filter_rem_cv<T>::type) diff --git a/3rdParty/Boost/src/boost/type_traits/remove_pointer.hpp b/3rdParty/Boost/src/boost/type_traits/remove_pointer.hpp index 5359992..01253db 100644 --- a/3rdParty/Boost/src/boost/type_traits/remove_pointer.hpp +++ b/3rdParty/Boost/src/boost/type_traits/remove_pointer.hpp @@ -9,12 +9,17 @@ #ifndef BOOST_TT_REMOVE_POINTER_HPP_INCLUDED #define BOOST_TT_REMOVE_POINTER_HPP_INCLUDED -#include <boost/type_traits/broken_compiler_spec.hpp> #include <boost/config.hpp> #include <boost/detail/workaround.hpp> +#ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +#include <boost/type_traits/broken_compiler_spec.hpp> +#endif #if BOOST_WORKAROUND(BOOST_MSVC,<=1300) #include <boost/type_traits/msvc/remove_pointer.hpp> +#elif defined(BOOST_MSVC) +#include <boost/type_traits/remove_cv.hpp> +#include <boost/type_traits/is_pointer.hpp> #endif // should be the last #include @@ -22,7 +27,51 @@ namespace boost { -#ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION +#ifdef BOOST_MSVC + +namespace detail{ + + // + // We need all this crazy indirection because a type such as: + // + // T (*const)(U) + // + // Does not bind to a <T*> or <T*const> partial specialization with VC10 and earlier + // + template <class T> + struct remove_pointer_imp + { + typedef T type; + }; + + template <class T> + struct remove_pointer_imp<T*> + { + typedef T type; + }; + + template <class T, bool b> + struct remove_pointer_imp3 + { + typedef typename remove_pointer_imp<typename boost::remove_cv<T>::type>::type type; + }; + + template <class T> + struct remove_pointer_imp3<T, false> + { + typedef T type; + }; + + template <class T> + struct remove_pointer_imp2 + { + typedef typename remove_pointer_imp3<T, ::boost::is_pointer<T>::value>::type type; + }; +} + +BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_pointer,T,typename boost::detail::remove_pointer_imp2<T>::type) + +#elif !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) BOOST_TT_AUX_TYPE_TRAIT_DEF1(remove_pointer,T,T) BOOST_TT_AUX_TYPE_TRAIT_PARTIAL_SPEC1_1(typename T,remove_pointer,T*,T) diff --git a/3rdParty/Boost/src/boost/type_traits/transform_traits.hpp b/3rdParty/Boost/src/boost/type_traits/transform_traits.hpp new file mode 100644 index 0000000..7a82f1c --- /dev/null +++ b/3rdParty/Boost/src/boost/type_traits/transform_traits.hpp @@ -0,0 +1,21 @@ +// (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/type_traits for most recent version including documentation. +// +// defines traits classes for transforming one type to another: +// remove_reference, add_reference, remove_bounds, remove_pointer. +// + +#ifndef BOOST_TT_TRANSFORM_TRAITS_HPP_INCLUDED +#define BOOST_TT_TRANSFORM_TRAITS_HPP_INCLUDED + +#include <boost/type_traits/add_pointer.hpp> +#include <boost/type_traits/add_reference.hpp> +#include <boost/type_traits/remove_bounds.hpp> +#include <boost/type_traits/remove_pointer.hpp> +#include <boost/type_traits/remove_reference.hpp> + +#endif // BOOST_TT_TRANSFORM_TRAITS_HPP_INCLUDED diff --git a/3rdParty/Boost/src/boost/type_traits/type_with_alignment.hpp b/3rdParty/Boost/src/boost/type_traits/type_with_alignment.hpp index ac31055..a86137f 100644 --- a/3rdParty/Boost/src/boost/type_traits/type_with_alignment.hpp +++ b/3rdParty/Boost/src/boost/type_traits/type_with_alignment.hpp @@ -86,7 +86,7 @@ struct lower_alignment_helper_impl<false> { template <std::size_t target, class TestType> struct apply - : mpl::if_c<(alignment_of<TestType>::value == target), TestType, char> + : public mpl::if_c<(alignment_of<TestType>::value == target), TestType, char> { enum { value = (alignment_of<TestType>::value == target) }; }; @@ -94,7 +94,7 @@ struct lower_alignment_helper_impl<false> template <bool found, std::size_t target, class TestType> struct lower_alignment_helper - : lower_alignment_helper_impl<found>::template apply<target,TestType> + : public lower_alignment_helper_impl<found>::template apply<target,TestType> { }; #else @@ -225,6 +225,8 @@ struct __attribute__((__aligned__(4))) a4 {}; struct __attribute__((__aligned__(8))) a8 {}; struct __attribute__((__aligned__(16))) a16 {}; struct __attribute__((__aligned__(32))) a32 {}; +struct __attribute__((__aligned__(64))) a64 {}; +struct __attribute__((__aligned__(128))) a128 {}; } template<> class type_with_alignment<1> { public: typedef char type; }; @@ -233,6 +235,8 @@ template<> class type_with_alignment<4> { public: typedef align::a4 type; }; template<> class type_with_alignment<8> { public: typedef align::a8 type; }; template<> class type_with_alignment<16> { public: typedef align::a16 type; }; template<> class type_with_alignment<32> { public: typedef align::a32 type; }; +template<> class type_with_alignment<64> { public: typedef align::a64 type; }; +template<> class type_with_alignment<128> { public: typedef align::a128 type; }; namespace detail { BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::align::a2,true) @@ -240,6 +244,8 @@ BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::align::a4,true) BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::align::a8,true) BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::align::a16,true) BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::align::a32,true) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::align::a64,true) +BOOST_TT_AUX_BOOL_TRAIT_IMPL_SPEC1(is_pod,::boost::align::a128,true) } #endif #if (defined(BOOST_MSVC) || (defined(BOOST_INTEL) && defined(_MSC_VER))) && _MSC_VER >= 1300 diff --git a/3rdParty/Boost/src/boost/typeof/typeof.hpp b/3rdParty/Boost/src/boost/typeof/typeof.hpp index 3e91649..4d56964 100644 --- a/3rdParty/Boost/src/boost/typeof/typeof.hpp +++ b/3rdParty/Boost/src/boost/typeof/typeof.hpp @@ -155,7 +155,22 @@ # else # error native typeof is not supported # endif - +#elif defined(__SUNPRO_CC) +# if (__SUNPRO_CC < 0x590 ) +# ifdef BOOST_TYPEOF_NATIVE +# error native typeof is not supported +# endif +# ifndef BOOST_TYPEOF_EMULATION +# define BOOST_TYPEOF_EMULATION +# endif +# else +# ifndef BOOST_TYPEOF_EMULATION +# ifndef BOOST_TYPEOF_NATIVE +# define BOOST_TYPEOF_NATIVE +# endif +# define BOOST_TYPEOF_KEYWORD __typeof__ +# endif +# endif #else //unknown compiler # ifndef BOOST_TYPEOF_NATIVE # ifndef BOOST_TYPEOF_EMULATION diff --git a/3rdParty/Boost/src/boost/unordered/detail/allocate.hpp b/3rdParty/Boost/src/boost/unordered/detail/allocate.hpp new file mode 100644 index 0000000..b6f1c79 --- /dev/null +++ b/3rdParty/Boost/src/boost/unordered/detail/allocate.hpp @@ -0,0 +1,1241 @@ + +// Copyright 2005-2011 Daniel James. +// Copyright 2009 Pablo Halpern. +// 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) + +// See http://www.boost.org/libs/unordered for documentation + +#ifndef BOOST_UNORDERED_ALLOCATE_HPP +#define BOOST_UNORDERED_ALLOCATE_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include <boost/unordered/detail/fwd.hpp> +#include <boost/move/move.hpp> +#include <boost/preprocessor/cat.hpp> +#include <boost/preprocessor/inc.hpp> +#include <boost/preprocessor/dec.hpp> +#include <boost/preprocessor/repetition/enum.hpp> +#include <boost/preprocessor/repetition/enum_params.hpp> +#include <boost/preprocessor/repetition/enum_binary_params.hpp> +#include <boost/preprocessor/repetition/repeat_from_to.hpp> +#include <boost/type_traits/is_class.hpp> +#include <boost/type_traits/add_lvalue_reference.hpp> +#include <boost/tuple/tuple.hpp> +#include <boost/utility/enable_if.hpp> +#include <boost/utility/addressof.hpp> +#include <boost/detail/select_type.hpp> +#include <boost/assert.hpp> +#include <utility> + +#if !defined(BOOST_NO_CXX11_HDR_TUPLE) +#include <tuple> +#endif + +#if defined(BOOST_MSVC) +#pragma warning(push) +#pragma warning(disable:4512) // assignment operator could not be generated. +#pragma warning(disable:4345) // behavior change: an object of POD type + // constructed with an initializer of the form () + // will be default-initialized. +#endif + +#define BOOST_UNORDERED_EMPLACE_LIMIT 10 + +namespace boost { namespace unordered { namespace detail { + + //////////////////////////////////////////////////////////////////////////// + // Bits and pieces for implementing traits + + template <typename T> typename boost::add_lvalue_reference<T>::type make(); + struct choice9 { typedef char (&type)[9]; }; + struct choice8 : choice9 { typedef char (&type)[8]; }; + struct choice7 : choice8 { typedef char (&type)[7]; }; + struct choice6 : choice7 { typedef char (&type)[6]; }; + struct choice5 : choice6 { typedef char (&type)[5]; }; + struct choice4 : choice5 { typedef char (&type)[4]; }; + struct choice3 : choice4 { typedef char (&type)[3]; }; + struct choice2 : choice3 { typedef char (&type)[2]; }; + struct choice1 : choice2 { typedef char (&type)[1]; }; + choice1 choose(); + + typedef choice1::type yes_type; + typedef choice2::type no_type; + + struct private_type + { + private_type const &operator,(int) const; + }; + + template <typename T> + no_type is_private_type(T const&); + yes_type is_private_type(private_type const&); + + struct convert_from_anything { + template <typename T> + convert_from_anything(T const&); + }; + + //////////////////////////////////////////////////////////////////////////// + // emplace_args + // + // Either forwarding variadic arguments, or storing the arguments in + // emplace_args##n + +#if !defined(BOOST_NO_VARIADIC_TEMPLATES) + +#define BOOST_UNORDERED_EMPLACE_TEMPLATE typename... Args +#define BOOST_UNORDERED_EMPLACE_ARGS BOOST_FWD_REF(Args)... args +#define BOOST_UNORDERED_EMPLACE_FORWARD boost::forward<Args>(args)... + +#define BOOST_UNORDERED_EMPLACE_ARGS1(a0) a0 +#define BOOST_UNORDERED_EMPLACE_ARGS2(a0, a1) a0, a1 +#define BOOST_UNORDERED_EMPLACE_ARGS3(a0, a1, a2) a0, a1, a2 + +#else + +#define BOOST_UNORDERED_EMPLACE_TEMPLATE typename Args +#define BOOST_UNORDERED_EMPLACE_ARGS Args const& args +#define BOOST_UNORDERED_EMPLACE_FORWARD args + +#define BOOST_UNORDERED_FWD_PARAM(z, n, a) \ + BOOST_FWD_REF(BOOST_PP_CAT(A, n)) BOOST_PP_CAT(a, n) + +#define BOOST_UNORDERED_CALL_FORWARD(z, i, a) \ + boost::forward<BOOST_PP_CAT(A,i)>(BOOST_PP_CAT(a,i)) + +#define BOOST_UNORDERED_EARGS(z, n, _) \ + template <BOOST_PP_ENUM_PARAMS_Z(z, n, typename A)> \ + struct BOOST_PP_CAT(emplace_args, n) \ + { \ + BOOST_PP_REPEAT_##z(n, BOOST_UNORDERED_EARGS_MEMBER, _) \ + BOOST_PP_CAT(emplace_args, n) ( \ + BOOST_PP_ENUM_BINARY_PARAMS_Z(z, n, Arg, b) \ + ) : BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_EARGS_INIT, _) \ + {} \ + \ + }; \ + \ + template <BOOST_PP_ENUM_PARAMS_Z(z, n, typename A)> \ + inline BOOST_PP_CAT(emplace_args, n) < \ + BOOST_PP_ENUM_PARAMS_Z(z, n, A) \ + > create_emplace_args( \ + BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, b) \ + ) \ + { \ + BOOST_PP_CAT(emplace_args, n) < \ + BOOST_PP_ENUM_PARAMS_Z(z, n, A) \ + > e(BOOST_PP_ENUM_PARAMS_Z(z, n, b)); \ + return e; \ + } + +#define BOOST_UNORDERED_EMPLACE_ARGS1 create_emplace_args +#define BOOST_UNORDERED_EMPLACE_ARGS2 create_emplace_args +#define BOOST_UNORDERED_EMPLACE_ARGS3 create_emplace_args + +#if defined(BOOST_NO_RVALUE_REFERENCES) + +#define BOOST_UNORDERED_EARGS_MEMBER(z, n, _) \ + typedef BOOST_FWD_REF(BOOST_PP_CAT(A, n)) BOOST_PP_CAT(Arg, n); \ + BOOST_PP_CAT(Arg, n) BOOST_PP_CAT(a, n); + +#define BOOST_UNORDERED_EARGS_INIT(z, n, _) \ + BOOST_PP_CAT(a, n)( \ + boost::forward<BOOST_PP_CAT(A,n)>(BOOST_PP_CAT(b, n))) + +#else + +#define BOOST_UNORDERED_EARGS_MEMBER(z, n, _) \ + typedef typename boost::add_lvalue_reference<BOOST_PP_CAT(A, n)>::type \ + BOOST_PP_CAT(Arg, n); \ + BOOST_PP_CAT(Arg, n) BOOST_PP_CAT(a, n); + +#define BOOST_UNORDERED_EARGS_INIT(z, n, _) \ + BOOST_PP_CAT(a, n)(BOOST_PP_CAT(b, n)) + +#endif + +BOOST_PP_REPEAT_FROM_TO(1, BOOST_UNORDERED_EMPLACE_LIMIT, BOOST_UNORDERED_EARGS, + _) + +#undef BOOST_UNORDERED_DEFINE_EMPLACE_ARGS +#undef BOOST_UNORDERED_EARGS_MEMBER +#undef BOOST_UNORDERED_EARGS_INIT + +#endif + +}}} + +//////////////////////////////////////////////////////////////////////////////// +// +// Pick which version of allocator_traits to use +// +// 0 = Own partial implementation +// 1 = std::allocator_traits +// 2 = boost::container::allocator_traits + +#if !defined(BOOST_UNORDERED_USE_ALLOCATOR_TRAITS) +# if defined(__GXX_EXPERIMENTAL_CXX0X__) && \ + (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 7)) +# define BOOST_UNORDERED_USE_ALLOCATOR_TRAITS 0 +# elif defined(BOOST_MSVC) +# if BOOST_MSVC < 1400 + // Use container's allocator_traits for older versions of Visual + // C++ as I don't test with them. +# define BOOST_UNORDERED_USE_ALLOCATOR_TRAITS 2 +# endif +# endif +#endif + +#if !defined(BOOST_UNORDERED_USE_ALLOCATOR_TRAITS) +# define BOOST_UNORDERED_USE_ALLOCATOR_TRAITS 0 +#endif + +//////////////////////////////////////////////////////////////////////////////// +// +// Some utilities for implementing allocator_traits, but useful elsewhere so +// they're always defined. + +#if !defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS) +# include <type_traits> +#endif + +namespace boost { namespace unordered { namespace detail { + + //////////////////////////////////////////////////////////////////////////// + // Integral_constrant, true_type, false_type + // + // Uses the standard versions if available. + +#if !defined(BOOST_NO_CXX11_HDR_TYPE_TRAITS) + + using std::integral_constant; + using std::true_type; + using std::false_type; + +#else + + template <typename T, T Value> + struct integral_constant { enum { value = Value }; }; + + typedef boost::unordered::detail::integral_constant<bool, true> true_type; + typedef boost::unordered::detail::integral_constant<bool, false> false_type; + +#endif + + //////////////////////////////////////////////////////////////////////////// + // Explicitly call a destructor + +#if defined(BOOST_MSVC) +#pragma warning(push) +#pragma warning(disable:4100) // unreferenced formal parameter +#endif + + template <class T> + inline void destroy(T* x) { + x->~T(); + } + +#if defined(BOOST_MSVC) +#pragma warning(pop) +#endif + + //////////////////////////////////////////////////////////////////////////// + // Expression test mechanism + // + // When SFINAE expressions are available, define + // BOOST_UNORDERED_HAS_FUNCTION which can check if a function call is + // supported by a class, otherwise define BOOST_UNORDERED_HAS_MEMBER which + // can detect if a class has the specified member, but not that it has the + // correct type, this is good enough for a passable impression of + // allocator_traits. + +#if !defined(BOOST_NO_SFINAE_EXPR) + + template <typename T, unsigned int> struct expr_test; + template <typename T> struct expr_test<T, sizeof(char)> : T {}; + template <typename U> static char for_expr_test(U const&); + +# define BOOST_UNORDERED_CHECK_EXPRESSION(count, result, expression) \ + template <typename U> \ + static typename boost::unordered::detail::expr_test< \ + BOOST_PP_CAT(choice, result), \ + sizeof(boost::unordered::detail::for_expr_test(( \ + (expression), \ + 0)))>::type test( \ + BOOST_PP_CAT(choice, count)) + +# define BOOST_UNORDERED_DEFAULT_EXPRESSION(count, result) \ + template <typename U> \ + static BOOST_PP_CAT(choice, result)::type test( \ + BOOST_PP_CAT(choice, count)) + +# define BOOST_UNORDERED_HAS_FUNCTION(name, thing, args, _) \ + struct BOOST_PP_CAT(has_, name) \ + { \ + BOOST_UNORDERED_CHECK_EXPRESSION(1, 1, \ + boost::unordered::detail::make< thing >().name args); \ + BOOST_UNORDERED_DEFAULT_EXPRESSION(2, 2); \ + \ + enum { value = sizeof(test<T>(choose())) == sizeof(choice1::type) };\ + } + +#else + + template <typename T> struct identity { typedef T type; }; + +# define BOOST_UNORDERED_CHECK_MEMBER(count, result, name, member) \ + \ + typedef typename boost::unordered::detail::identity<member>::type \ + BOOST_PP_CAT(check, count); \ + \ + template <BOOST_PP_CAT(check, count) e> \ + struct BOOST_PP_CAT(test, count) { \ + typedef BOOST_PP_CAT(choice, result) type; \ + }; \ + \ + template <class U> static typename \ + BOOST_PP_CAT(test, count)<&U::name>::type \ + test(BOOST_PP_CAT(choice, count)) + +# define BOOST_UNORDERED_DEFAULT_MEMBER(count, result) \ + template <class U> static BOOST_PP_CAT(choice, result)::type \ + test(BOOST_PP_CAT(choice, count)) + +# define BOOST_UNORDERED_HAS_MEMBER(name) \ + struct BOOST_PP_CAT(has_, name) \ + { \ + struct impl { \ + struct base_mixin { int name; }; \ + struct base : public T, public base_mixin {}; \ + \ + BOOST_UNORDERED_CHECK_MEMBER(1, 1, name, int base_mixin::*); \ + BOOST_UNORDERED_DEFAULT_MEMBER(2, 2); \ + \ + enum { value = sizeof(choice2::type) == \ + sizeof(test<base>(choose())) \ + }; \ + }; \ + \ + enum { value = impl::value }; \ + } + +#endif + +}}} + +//////////////////////////////////////////////////////////////////////////////// +// +// Allocator traits +// +// First our implementation, then later light wrappers around the alternatives + +#if BOOST_UNORDERED_USE_ALLOCATOR_TRAITS == 0 + +# include <boost/limits.hpp> +# include <boost/utility/enable_if.hpp> +# include <boost/pointer_to_other.hpp> +# if defined(BOOST_NO_SFINAE_EXPR) +# include <boost/type_traits/is_same.hpp> +# endif + +# if !defined(BOOST_NO_VARIADIC_TEMPLATES) && \ + !defined(BOOST_NO_SFINAE_EXPR) +# define BOOST_UNORDERED_DETAIL_FULL_CONSTRUCT 1 +# else +# define BOOST_UNORDERED_DETAIL_FULL_CONSTRUCT 0 +# endif + +namespace boost { namespace unordered { namespace detail { + + // TODO: Does this match std::allocator_traits<Alloc>::rebind_alloc<T>? + template <typename Alloc, typename T> + struct rebind_wrap + { + typedef typename Alloc::BOOST_NESTED_TEMPLATE rebind<T>::other type; + }; + +# if defined(BOOST_MSVC) && BOOST_MSVC <= 1400 + +# define BOOST_UNORDERED_DEFAULT_TYPE_TMPLT(tname) \ + template <typename Tp, typename Default> \ + struct default_type_ ## tname { \ + \ + template <typename X> \ + static choice1::type test(choice1, typename X::tname* = 0); \ + \ + template <typename X> \ + static choice2::type test(choice2, void* = 0); \ + \ + struct DefaultWrap { typedef Default tname; }; \ + \ + enum { value = (1 == sizeof(test<Tp>(choose()))) }; \ + \ + typedef typename boost::detail::if_true<value>:: \ + BOOST_NESTED_TEMPLATE then<Tp, DefaultWrap> \ + ::type::tname type; \ + } + +# else + + template <typename T, typename T2> + struct sfinae : T2 {}; + +# define BOOST_UNORDERED_DEFAULT_TYPE_TMPLT(tname) \ + template <typename Tp, typename Default> \ + struct default_type_ ## tname { \ + \ + template <typename X> \ + static typename boost::unordered::detail::sfinae< \ + typename X::tname, choice1>::type \ + test(choice1); \ + \ + template <typename X> \ + static choice2::type test(choice2); \ + \ + struct DefaultWrap { typedef Default tname; }; \ + \ + enum { value = (1 == sizeof(test<Tp>(choose()))) }; \ + \ + typedef typename boost::detail::if_true<value>:: \ + BOOST_NESTED_TEMPLATE then<Tp, DefaultWrap> \ + ::type::tname type; \ + } + +# endif + +# define BOOST_UNORDERED_DEFAULT_TYPE(T,tname, arg) \ + typename default_type_ ## tname<T, arg>::type + + BOOST_UNORDERED_DEFAULT_TYPE_TMPLT(pointer); + BOOST_UNORDERED_DEFAULT_TYPE_TMPLT(const_pointer); + BOOST_UNORDERED_DEFAULT_TYPE_TMPLT(void_pointer); + BOOST_UNORDERED_DEFAULT_TYPE_TMPLT(const_void_pointer); + BOOST_UNORDERED_DEFAULT_TYPE_TMPLT(difference_type); + BOOST_UNORDERED_DEFAULT_TYPE_TMPLT(size_type); + BOOST_UNORDERED_DEFAULT_TYPE_TMPLT(propagate_on_container_copy_assignment); + BOOST_UNORDERED_DEFAULT_TYPE_TMPLT(propagate_on_container_move_assignment); + BOOST_UNORDERED_DEFAULT_TYPE_TMPLT(propagate_on_container_swap); + +# if !defined(BOOST_NO_SFINAE_EXPR) + + template <typename T> + BOOST_UNORDERED_HAS_FUNCTION( + select_on_container_copy_construction, U const, (), 0 + ); + + template <typename T> + BOOST_UNORDERED_HAS_FUNCTION( + max_size, U const, (), 0 + ); + +# if !defined(BOOST_NO_VARIADIC_TEMPLATES) + + template <typename T, typename ValueType, typename... Args> + BOOST_UNORDERED_HAS_FUNCTION( + construct, U, ( + boost::unordered::detail::make<ValueType*>(), + boost::unordered::detail::make<Args const>()...), 2 + ); + +# else + + template <typename T, typename ValueType> + BOOST_UNORDERED_HAS_FUNCTION( + construct, U, ( + boost::unordered::detail::make<ValueType*>(), + boost::unordered::detail::make<ValueType const>()), 2 + ); + +# endif + + template <typename T, typename ValueType> + BOOST_UNORDERED_HAS_FUNCTION( + destroy, U, (boost::unordered::detail::make<ValueType*>()), 1 + ); + +# else + + template <typename T> + BOOST_UNORDERED_HAS_MEMBER(select_on_container_copy_construction); + + template <typename T> + BOOST_UNORDERED_HAS_MEMBER(max_size); + + template <typename T, typename ValueType> + BOOST_UNORDERED_HAS_MEMBER(construct); + + template <typename T, typename ValueType> + BOOST_UNORDERED_HAS_MEMBER(destroy); + +# endif + + template <typename Alloc> + inline Alloc call_select_on_container_copy_construction(const Alloc& rhs, + typename boost::enable_if_c< + boost::unordered::detail:: + has_select_on_container_copy_construction<Alloc>::value, void* + >::type = 0) + { + return rhs.select_on_container_copy_construction(); + } + + template <typename Alloc> + inline Alloc call_select_on_container_copy_construction(const Alloc& rhs, + typename boost::disable_if_c< + boost::unordered::detail:: + has_select_on_container_copy_construction<Alloc>::value, void* + >::type = 0) + { + return rhs; + } + + template <typename SizeType, typename Alloc> + inline SizeType call_max_size(const Alloc& a, + typename boost::enable_if_c< + boost::unordered::detail::has_max_size<Alloc>::value, void* + >::type = 0) + { + return a.max_size(); + } + + template <typename SizeType, typename Alloc> + inline SizeType call_max_size(const Alloc&, typename boost::disable_if_c< + boost::unordered::detail::has_max_size<Alloc>::value, void* + >::type = 0) + { + return (std::numeric_limits<SizeType>::max)(); + } + + template <typename Alloc> + struct allocator_traits + { + typedef Alloc allocator_type; + typedef typename Alloc::value_type value_type; + + typedef BOOST_UNORDERED_DEFAULT_TYPE(Alloc, pointer, value_type*) + pointer; + + template <typename T> + struct pointer_to_other : boost::pointer_to_other<pointer, T> {}; + + typedef BOOST_UNORDERED_DEFAULT_TYPE(Alloc, const_pointer, + typename pointer_to_other<const value_type>::type) + const_pointer; + + //typedef BOOST_UNORDERED_DEFAULT_TYPE(Alloc, void_pointer, + // typename pointer_to_other<void>::type) + // void_pointer; + // + //typedef BOOST_UNORDERED_DEFAULT_TYPE(Alloc, const_void_pointer, + // typename pointer_to_other<const void>::type) + // const_void_pointer; + + typedef BOOST_UNORDERED_DEFAULT_TYPE(Alloc, difference_type, + std::ptrdiff_t) difference_type; + + typedef BOOST_UNORDERED_DEFAULT_TYPE(Alloc, size_type, std::size_t) + size_type; + + // TODO: rebind_alloc and rebind_traits + + static pointer allocate(Alloc& a, size_type n) + { return a.allocate(n); } + + // I never use this, so I'll just comment it out for now. + // + //static pointer allocate(Alloc& a, size_type n, + // const_void_pointer hint) + // { return DEFAULT_FUNC(allocate, pointer)(a, n, hint); } + + static void deallocate(Alloc& a, pointer p, size_type n) + { a.deallocate(p, n); } + + public: + +# if BOOST_UNORDERED_DETAIL_FULL_CONSTRUCT + + template <typename T, typename... Args> + static typename boost::enable_if_c< + boost::unordered::detail::has_construct<Alloc, T, Args...> + ::value>::type + construct(Alloc& a, T* p, BOOST_FWD_REF(Args)... x) + { + a.construct(p, boost::forward<Args>(x)...); + } + + template <typename T, typename... Args> + static typename boost::disable_if_c< + boost::unordered::detail::has_construct<Alloc, T, Args...> + ::value>::type + construct(Alloc&, T* p, BOOST_FWD_REF(Args)... x) + { + new ((void*) p) T(boost::forward<Args>(x)...); + } + + template <typename T> + static typename boost::enable_if_c< + boost::unordered::detail::has_destroy<Alloc, T>::value>::type + destroy(Alloc& a, T* p) + { + a.destroy(p); + } + + template <typename T> + static typename boost::disable_if_c< + boost::unordered::detail::has_destroy<Alloc, T>::value>::type + destroy(Alloc&, T* p) + { + boost::unordered::detail::destroy(p); + } + +# elif !defined(BOOST_NO_SFINAE_EXPR) + + template <typename T> + static typename boost::enable_if_c< + boost::unordered::detail::has_construct<Alloc, T>::value>::type + construct(Alloc& a, T* p, T const& x) + { + a.construct(p, x); + } + + template <typename T> + static typename boost::disable_if_c< + boost::unordered::detail::has_construct<Alloc, T>::value>::type + construct(Alloc&, T* p, T const& x) + { + new ((void*) p) T(x); + } + + template <typename T> + static typename boost::enable_if_c< + boost::unordered::detail::has_destroy<Alloc, T>::value>::type + destroy(Alloc& a, T* p) + { + a.destroy(p); + } + + template <typename T> + static typename boost::disable_if_c< + boost::unordered::detail::has_destroy<Alloc, T>::value>::type + destroy(Alloc&, T* p) + { + boost::unordered::detail::destroy(p); + } + +# else + + // If we don't have SFINAE expressions, only call construct for the + // copy constructor for the allocator's value_type - as that's + // the only construct method that old fashioned allocators support. + + template <typename T> + static void construct(Alloc& a, T* p, T const& x, + typename boost::enable_if_c< + boost::unordered::detail::has_construct<Alloc, T>::value && + boost::is_same<T, value_type>::value, + void*>::type = 0) + { + a.construct(p, x); + } + + template <typename T> + static void construct(Alloc&, T* p, T const& x, + typename boost::disable_if_c< + boost::unordered::detail::has_construct<Alloc, T>::value && + boost::is_same<T, value_type>::value, + void*>::type = 0) + { + new ((void*) p) T(x); + } + + template <typename T> + static void destroy(Alloc& a, T* p, + typename boost::enable_if_c< + boost::unordered::detail::has_destroy<Alloc, T>::value && + boost::is_same<T, value_type>::value, + void*>::type = 0) + { + a.destroy(p); + } + + template <typename T> + static void destroy(Alloc&, T* p, + typename boost::disable_if_c< + boost::unordered::detail::has_destroy<Alloc, T>::value && + boost::is_same<T, value_type>::value, + void*>::type = 0) + { + boost::unordered::detail::destroy(p); + } + +# endif + + static size_type max_size(const Alloc& a) + { + return boost::unordered::detail::call_max_size<size_type>(a); + } + + // Allocator propagation on construction + + static Alloc select_on_container_copy_construction(Alloc const& rhs) + { + return boost::unordered::detail:: + call_select_on_container_copy_construction(rhs); + } + + // Allocator propagation on assignment and swap. + // Return true if lhs is modified. + typedef BOOST_UNORDERED_DEFAULT_TYPE( + Alloc, propagate_on_container_copy_assignment, false_type) + propagate_on_container_copy_assignment; + typedef BOOST_UNORDERED_DEFAULT_TYPE( + Alloc,propagate_on_container_move_assignment, false_type) + propagate_on_container_move_assignment; + typedef BOOST_UNORDERED_DEFAULT_TYPE( + Alloc,propagate_on_container_swap,false_type) + propagate_on_container_swap; + }; +}}} + +# undef BOOST_UNORDERED_DEFAULT_TYPE_TMPLT +# undef BOOST_UNORDERED_DEFAULT_TYPE + +//////////////////////////////////////////////////////////////////////////////// +// +// std::allocator_traits + +#elif BOOST_UNORDERED_USE_ALLOCATOR_TRAITS == 1 + +# include <memory> + +# define BOOST_UNORDERED_DETAIL_FULL_CONSTRUCT 1 + +namespace boost { namespace unordered { namespace detail { + + template <typename Alloc> + struct allocator_traits : std::allocator_traits<Alloc> {}; + + template <typename Alloc, typename T> + struct rebind_wrap + { + typedef typename std::allocator_traits<Alloc>:: + template rebind_alloc<T> type; + }; +}}} + +//////////////////////////////////////////////////////////////////////////////// +// +// boost::container::allocator_traits + +#elif BOOST_UNORDERED_USE_ALLOCATOR_TRAITS == 2 + +# include <boost/container/allocator_traits.hpp> + +# define BOOST_UNORDERED_DETAIL_FULL_CONSTRUCT 0 + +namespace boost { namespace unordered { namespace detail { + + template <typename Alloc> + struct allocator_traits : + boost::container::allocator_traits<Alloc> {}; + + template <typename Alloc, typename T> + struct rebind_wrap : + boost::container::allocator_traits<Alloc>:: + template portable_rebind_alloc<T> + {}; + +}}} + +#else + +#error "Invalid BOOST_UNORDERED_USE_ALLOCATOR_TRAITS value." + +#endif + + +namespace boost { namespace unordered { namespace detail { + + //////////////////////////////////////////////////////////////////////////// + // call_construct + +#if !defined(BOOST_NO_VARIADIC_TEMPLATES) + +# if BOOST_UNORDERED_DETAIL_FULL_CONSTRUCT + + template <typename Alloc, typename T, typename... Args> + inline void call_construct(Alloc& alloc, T* address, + BOOST_FWD_REF(Args)... args) + { + boost::unordered::detail::allocator_traits<Alloc>::construct(alloc, + address, boost::forward<Args>(args)...); + } + + template <typename Alloc, typename T> + inline void destroy_value_impl(Alloc& alloc, T* x) { + boost::unordered::detail::allocator_traits<Alloc>::destroy(alloc, x); + } + + +# else + + template <typename Alloc, typename T, typename... Args> + inline void call_construct(Alloc&, T* address, + BOOST_FWD_REF(Args)... args) + { + new((void*) address) T(boost::forward<Args>(args)...); + } + + template <typename Alloc, typename T> + inline void destroy_value_impl(Alloc&, T* x) { + boost::unordered::detail::destroy(x); + } + + +# endif + +#else + + template <typename Alloc, typename T> + inline void destroy_value_impl(Alloc&, T* x) { + boost::unordered::detail::destroy(x); + } + +#endif + + //////////////////////////////////////////////////////////////////////////// + // Construct from tuple + // + // Used for piecewise construction. + +#if !defined(BOOST_NO_VARIADIC_TEMPLATES) + +# define BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(n, namespace_) \ + template<typename Alloc, typename T> \ + void construct_from_tuple(Alloc& alloc, T* ptr, namespace_ tuple<>) \ + { \ + boost::unordered::detail::call_construct(alloc, ptr); \ + } \ + \ + BOOST_PP_REPEAT_FROM_TO(1, n, \ + BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE_IMPL, namespace_) + +# define BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE_IMPL(z, n, namespace_) \ + template<typename Alloc, typename T, \ + BOOST_PP_ENUM_PARAMS_Z(z, n, typename A)> \ + void construct_from_tuple(Alloc& alloc, T* ptr, \ + namespace_ tuple<BOOST_PP_ENUM_PARAMS_Z(z, n, A)> const& x) \ + { \ + boost::unordered::detail::call_construct(alloc, ptr, \ + BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_GET_TUPLE_ARG, namespace_) \ + ); \ + } + +# define BOOST_UNORDERED_GET_TUPLE_ARG(z, n, namespace_) \ + namespace_ get<n>(x) + +#elif !defined(__SUNPRO_CC) + +# define BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(n, namespace_) \ + template<typename Alloc, typename T> \ + void construct_from_tuple(Alloc&, T* ptr, namespace_ tuple<>) \ + { \ + new ((void*) ptr) T(); \ + } \ + \ + BOOST_PP_REPEAT_FROM_TO(1, n, \ + BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE_IMPL, namespace_) + +# define BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE_IMPL(z, n, namespace_) \ + template<typename Alloc, typename T, \ + BOOST_PP_ENUM_PARAMS_Z(z, n, typename A)> \ + void construct_from_tuple(Alloc&, T* ptr, \ + namespace_ tuple<BOOST_PP_ENUM_PARAMS_Z(z, n, A)> const& x) \ + { \ + new ((void*) ptr) T( \ + BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_GET_TUPLE_ARG, namespace_) \ + ); \ + } + +# define BOOST_UNORDERED_GET_TUPLE_ARG(z, n, namespace_) \ + namespace_ get<n>(x) + +#else + + template <int N> struct length {}; + +# define BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(n, namespace_) \ + template<typename Alloc, typename T> \ + void construct_from_tuple_impl( \ + boost::unordered::detail::length<0>, Alloc&, T* ptr, \ + namespace_ tuple<>) \ + { \ + new ((void*) ptr) T(); \ + } \ + \ + BOOST_PP_REPEAT_FROM_TO(1, n, \ + BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE_IMPL, namespace_) + +# define BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE_IMPL(z, n, namespace_) \ + template<typename Alloc, typename T, \ + BOOST_PP_ENUM_PARAMS_Z(z, n, typename A)> \ + void construct_from_tuple_impl( \ + boost::unordered::detail::length<n>, Alloc&, T* ptr, \ + namespace_ tuple<BOOST_PP_ENUM_PARAMS_Z(z, n, A)> const& x) \ + { \ + new ((void*) ptr) T( \ + BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_GET_TUPLE_ARG, namespace_) \ + ); \ + } + +# define BOOST_UNORDERED_GET_TUPLE_ARG(z, n, namespace_) \ + namespace_ get<n>(x) + +#endif + +BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(10, boost::) + +#if !defined(__SUNPRO_CC) && !defined(BOOST_NO_CXX11_HDR_TUPLE) + BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE(10, std::) +#endif + +#undef BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE +#undef BOOST_UNORDERED_CONSTRUCT_FROM_TUPLE_IMPL +#undef BOOST_UNORDERED_GET_TUPLE_ARG + +#if defined(__SUNPRO_CC) + + template <typename Alloc, typename T, typename Tuple> + void construct_from_tuple(Alloc& alloc, T* ptr, Tuple const& x) + { + construct_from_tuple_impl( + boost::unordered::detail::length< + boost::tuples::length<Tuple>::value>(), + alloc, ptr, x); + } + +#endif + + //////////////////////////////////////////////////////////////////////////// + // SFINAE traits for construction. + + // Decide which construction method to use for a three argument + // call. Note that this is difficult to do using overloads because + // the arguments are packed into 'emplace_args3'. + // + // The decision is made on the first argument. + + +#if defined(BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT) + template <typename A, typename B, typename A0> + struct emulation1 { + static choice1::type test(choice1, std::pair<A, B> const&); + static choice2::type test(choice2, A const&); + static choice3::type test(choice3, convert_from_anything const&); + + enum { value = + sizeof(test(choose(), boost::unordered::detail::make<A0>())) == + sizeof(choice2::type) }; + }; +#endif + + template <typename A, typename B, typename A0> + struct check3_base { + static choice1::type test(choice1, + boost::unordered::piecewise_construct_t); + +#if defined(BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT) + static choice2::type test(choice2, A const&); +#endif + + static choice3::type test(choice3, ...); + + enum { value = + sizeof(test(choose(), boost::unordered::detail::make<A0>())) }; + }; + + template <typename A, typename B, typename A0> + struct piecewise3 { + enum { value = check3_base<A,B,A0>::value == sizeof(choice1::type) }; + }; + +#if defined(BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT) + template <typename A, typename B, typename A0> + struct emulation3 { + enum { value = check3_base<A,B,A0>::value == sizeof(choice2::type) }; + }; + +#endif + +// TODO: Full construct? +#if !defined(BOOST_NO_VARIADIC_TEMPLATES) + + //////////////////////////////////////////////////////////////////////////// + // Construct from variadic parameters + + template <typename Alloc, typename T, typename... Args> + inline void construct_value_impl(Alloc& alloc, T* address, + BOOST_FWD_REF(Args)... args) + { + boost::unordered::detail::call_construct(alloc, + address, boost::forward<Args>(args)...); + } + + template <typename Alloc, typename A, typename B, + typename A0, typename A1, typename A2> + inline typename enable_if<piecewise3<A, B, A0>, void>::type + construct_value_impl(Alloc& alloc, std::pair<A, B>* address, + BOOST_FWD_REF(A0), BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2) + { + boost::unordered::detail::construct_from_tuple(alloc, + boost::addressof(address->first), boost::forward<A1>(a1)); + boost::unordered::detail::construct_from_tuple(alloc, + boost::addressof(address->second), boost::forward<A2>(a2)); + } + +#if defined(BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT) + + template <typename Alloc, typename A, typename B, typename A0> + inline typename enable_if<emulation1<A, B, A0>, void>::type + construct_value_impl(Alloc& alloc, std::pair<A, B>* address, + BOOST_FWD_REF(A0) a0) + { + boost::unordered::detail::call_construct(alloc, + boost::addressof(address->first),boost::forward<A0>(a0)); + boost::unordered::detail::call_construct(alloc, + boost::addressof(address->second)); + } + + template <typename Alloc, typename A, typename B, + typename A0, typename A1, typename A2> + inline typename enable_if<emulation3<A, B, A0>, void>::type + construct_value_impl(Alloc& alloc, std::pair<A, B>* address, + BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2) + { + boost::unordered::detail::call_construct(alloc, + boost::addressof(address->first),boost::forward<A0>(a0)); + boost::unordered::detail::call_construct(alloc, + boost::addressof(address->second), + boost::forward<A1>(a1), + boost::forward<A2>(a2)); + } + + template <typename Alloc, typename A, typename B, + typename A0, typename A1, typename A2, typename A3, + typename... Args> + inline void construct_value_impl(Alloc& alloc, std::pair<A, B>* address, + BOOST_FWD_REF(A0) a0, BOOST_FWD_REF(A1) a1, BOOST_FWD_REF(A2) a2, + BOOST_FWD_REF(A3) a3, BOOST_FWD_REF(Args)... args) + { + boost::unordered::detail::call_construct(alloc, + boost::addressof(address->first),boost::forward<A0>(a0)); + boost::unordered::detail::call_construct(alloc, + boost::addressof(address->second), + boost::forward<A1>(a1), + boost::forward<A2>(a2), + boost::forward<A3>(a3), + boost::forward<Args>(args)...); + } + +#endif // BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT +#else // BOOST_NO_VARIADIC_TEMPLATES + +//////////////////////////////////////////////////////////////////////////////// +// Construct from emplace_args + +#define BOOST_UNORDERED_CONSTRUCT_IMPL(z, num_params, _) \ + template < \ + typename Alloc, typename T, \ + BOOST_PP_ENUM_PARAMS_Z(z, num_params, typename A) \ + > \ + inline void construct_value_impl(Alloc&, T* address, \ + boost::unordered::detail::BOOST_PP_CAT(emplace_args,num_params) < \ + BOOST_PP_ENUM_PARAMS_Z(z, num_params, A) \ + > const& args) \ + { \ + new((void*) address) T( \ + BOOST_PP_ENUM_##z(num_params, BOOST_UNORDERED_CALL_FORWARD, \ + args.a)); \ + } + + template <typename Alloc, typename T, typename A0> + inline void construct_value_impl(Alloc&, T* address, + emplace_args1<A0> const& args) + { + new((void*) address) T(boost::forward<A0>(args.a0)); + } + + template <typename Alloc, typename T, typename A0, typename A1> + inline void construct_value_impl(Alloc&, T* address, + emplace_args2<A0, A1> const& args) + { + new((void*) address) T( + boost::forward<A0>(args.a0), + boost::forward<A1>(args.a1) + ); + } + + template <typename Alloc, typename T, typename A0, typename A1, typename A2> + inline void construct_value_impl(Alloc&, T* address, + emplace_args3<A0, A1, A2> const& args) + { + new((void*) address) T( + boost::forward<A0>(args.a0), + boost::forward<A1>(args.a1), + boost::forward<A2>(args.a2) + ); + } + + BOOST_PP_REPEAT_FROM_TO(4, BOOST_UNORDERED_EMPLACE_LIMIT, + BOOST_UNORDERED_CONSTRUCT_IMPL, _) + +#undef BOOST_UNORDERED_CONSTRUCT_IMPL + + template <typename Alloc, typename A, typename B, + typename A0, typename A1, typename A2> + inline void construct_value_impl(Alloc& alloc, std::pair<A, B>* address, + boost::unordered::detail::emplace_args3<A0, A1, A2> const& args, + typename enable_if<piecewise3<A, B, A0>, void*>::type = 0) + { + boost::unordered::detail::construct_from_tuple(alloc, + boost::addressof(address->first), args.a1); + boost::unordered::detail::construct_from_tuple(alloc, + boost::addressof(address->second), args.a2); + } + +#if defined(BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT) + + template <typename Alloc, typename A, typename B, typename A0> + inline void construct_value_impl(Alloc&, std::pair<A, B>* address, + boost::unordered::detail::emplace_args1<A0> const& args, + typename enable_if<emulation1<A, B, A0>, void*>::type = 0) + { + new((void*) boost::addressof(address->first)) A( + boost::forward<A0>(args.a0)); + new((void*) boost::addressof(address->second)) B(); + } + + template <typename Alloc, typename A, typename B, + typename A0, typename A1, typename A2> + inline void construct_value_impl(Alloc&, std::pair<A, B>* address, + boost::unordered::detail::emplace_args3<A0, A1, A2> const& args, + typename enable_if<emulation3<A, B, A0>, void*>::type = 0) + { + new((void*) boost::addressof(address->first)) A( + boost::forward<A0>(args.a0)); + new((void*) boost::addressof(address->second)) B( + boost::forward<A1>(args.a1), + boost::forward<A2>(args.a2)); + } + +#define BOOST_UNORDERED_CONSTRUCT_PAIR_IMPL(z, num_params, _) \ + template <typename Alloc, typename A, typename B, \ + BOOST_PP_ENUM_PARAMS_Z(z, num_params, typename A) \ + > \ + inline void construct_value_impl(Alloc&, std::pair<A, B>* address, \ + boost::unordered::detail::BOOST_PP_CAT(emplace_args, num_params) < \ + BOOST_PP_ENUM_PARAMS_Z(z, num_params, A) \ + > const& args) \ + { \ + new((void*) boost::addressof(address->first)) A( \ + boost::forward<A0>(args.a0)); \ + new((void*) boost::addressof(address->second)) B( \ + BOOST_PP_ENUM_##z(BOOST_PP_DEC(num_params), \ + BOOST_UNORDERED_CALL_FORWARD2, args.a)); \ + } + +#define BOOST_UNORDERED_CALL_FORWARD2(z, i, a) \ + BOOST_UNORDERED_CALL_FORWARD(z, BOOST_PP_INC(i), a) + + BOOST_UNORDERED_CONSTRUCT_PAIR_IMPL(1, 2, _) + BOOST_PP_REPEAT_FROM_TO(4, BOOST_UNORDERED_EMPLACE_LIMIT, + BOOST_UNORDERED_CONSTRUCT_PAIR_IMPL, _) + +#undef BOOST_UNORDERED_CONSTRUCT_PAIR_IMPL +#undef BOOST_UNORDERED_CALL_FORWARD2 + +#endif // BOOST_UNORDERED_DEPRECATED_PAIR_CONSTRUCT +#endif // BOOST_NO_VARIADIC_TEMPLATES + +}}} + +//////////////////////////////////////////////////////////////////////////////// +// +// Some helper functions for allocating & constructing + +namespace boost { namespace unordered { namespace detail { + + //////////////////////////////////////////////////////////////////////////// + // + // array_constructor + // + // Allocate and construct an array in an exception safe manner, and + // clean up if an exception is thrown before the container takes charge + // of it. + + template <typename Allocator> + struct array_constructor + { + typedef boost::unordered::detail::allocator_traits<Allocator> traits; + typedef typename traits::pointer pointer; + + Allocator& alloc_; + pointer ptr_; + pointer constructed_; + std::size_t length_; + + array_constructor(Allocator& a) + : alloc_(a), ptr_(), constructed_(), length_(0) + { + constructed_ = pointer(); + ptr_ = pointer(); + } + + ~array_constructor() { + if (ptr_) { + for(pointer p = ptr_; p != constructed_; ++p) + traits::destroy(alloc_, boost::addressof(*p)); + + traits::deallocate(alloc_, ptr_, length_); + } + } + + template <typename V> + void construct(V const& v, std::size_t l) + { + BOOST_ASSERT(!ptr_); + length_ = l; + ptr_ = traits::allocate(alloc_, length_); + pointer end = ptr_ + static_cast<std::ptrdiff_t>(length_); + for(constructed_ = ptr_; constructed_ != end; ++constructed_) + traits::construct(alloc_, boost::addressof(*constructed_), v); + } + + pointer get() const + { + return ptr_; + } + + pointer release() + { + pointer p(ptr_); + ptr_ = pointer(); + return p; + } + + private: + + array_constructor(array_constructor const&); + array_constructor& operator=(array_constructor const&); + }; +}}} + +#if defined(BOOST_MSVC) +#pragma warning(pop) +#endif + +#endif diff --git a/3rdParty/Boost/src/boost/unordered/detail/allocator_helpers.hpp b/3rdParty/Boost/src/boost/unordered/detail/allocator_helpers.hpp deleted file mode 100644 index 2c64223..0000000 --- a/3rdParty/Boost/src/boost/unordered/detail/allocator_helpers.hpp +++ /dev/null @@ -1,111 +0,0 @@ - -// Copyright 2005-2009 Daniel James. -// 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) - -// A couple of templates to make using allocators easier. - -#ifndef BOOST_UNORDERED_DETAIL_ALLOCATOR_UTILITIES_HPP_INCLUDED -#define BOOST_UNORDERED_DETAIL_ALLOCATOR_UTILITIES_HPP_INCLUDED - -#if defined(_MSC_VER) && (_MSC_VER >= 1020) -# pragma once -#endif - -#include <boost/config.hpp> - -#if (defined(BOOST_NO_STD_ALLOCATOR) || defined(BOOST_DINKUMWARE_STDLIB)) \ - && !defined(__BORLANDC__) -# define BOOST_UNORDERED_USE_ALLOCATOR_UTILITIES -#endif - -#if defined(BOOST_UNORDERED_USE_ALLOCATOR_UTILITIES) -# include <boost/detail/allocator_utilities.hpp> -#endif - -namespace boost { namespace unordered_detail { - - // rebind_wrap - // - // Rebind allocators. For some problematic libraries, use rebind_to - // from <boost/detail/allocator_utilities.hpp>. - -#if defined(BOOST_UNORDERED_USE_ALLOCATOR_UTILITIES) - template <class Alloc, class T> - struct rebind_wrap : ::boost::detail::allocator::rebind_to<Alloc, T> {}; -#else - template <class Alloc, class T> - struct rebind_wrap - { - typedef BOOST_DEDUCED_TYPENAME - Alloc::BOOST_NESTED_TEMPLATE rebind<T>::other - type; - }; -#endif - - // allocator_array_constructor - // - // Allocate and construct an array in an exception safe manner, and - // clean up if an exception is thrown before the container takes charge - // of it. - - template <class Allocator> - struct allocator_array_constructor - { - typedef BOOST_DEDUCED_TYPENAME Allocator::pointer pointer; - - Allocator& alloc_; - pointer ptr_; - pointer constructed_; - std::size_t length_; - - allocator_array_constructor(Allocator& a) - : alloc_(a), ptr_(), constructed_(), length_(0) - { - constructed_ = pointer(); - ptr_ = pointer(); - } - - ~allocator_array_constructor() { - if (ptr_) { - for(pointer p = ptr_; p != constructed_; ++p) - alloc_.destroy(p); - - alloc_.deallocate(ptr_, length_); - } - } - - template <class V> - void construct(V const& v, std::size_t l) - { - BOOST_ASSERT(!ptr_); - length_ = l; - ptr_ = alloc_.allocate(length_); - pointer end = ptr_ + static_cast<std::ptrdiff_t>(length_); - for(constructed_ = ptr_; constructed_ != end; ++constructed_) - alloc_.construct(constructed_, v); - } - - pointer get() const - { - return ptr_; - } - - pointer release() - { - pointer p(ptr_); - ptr_ = pointer(); - return p; - } - private: - allocator_array_constructor(allocator_array_constructor const&); - allocator_array_constructor& operator=( - allocator_array_constructor const&); - }; -}} - -#if defined(BOOST_UNORDERED_USE_ALLOCATOR_UTILITIES) -# undef BOOST_UNORDERED_USE_ALLOCATOR_UTILITIES -#endif - -#endif diff --git a/3rdParty/Boost/src/boost/unordered/detail/buckets.hpp b/3rdParty/Boost/src/boost/unordered/detail/buckets.hpp index 913dbcd..def5c7c 100644 --- a/3rdParty/Boost/src/boost/unordered/detail/buckets.hpp +++ b/3rdParty/Boost/src/boost/unordered/detail/buckets.hpp @@ -1,183 +1,799 @@ // Copyright (C) 2003-2004 Jeremy B. Maitin-Shepard. -// Copyright (C) 2005-2009 Daniel James +// Copyright (C) 2005-2011 Daniel James // 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_UNORDERED_DETAIL_MANAGER_HPP_INCLUDED #define BOOST_UNORDERED_DETAIL_MANAGER_HPP_INCLUDED -#include <boost/config.hpp> -#include <boost/assert.hpp> -#include <boost/unordered/detail/node.hpp> +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + #include <boost/unordered/detail/util.hpp> +#include <boost/unordered/detail/allocate.hpp> +#include <boost/type_traits/aligned_storage.hpp> +#include <boost/type_traits/alignment_of.hpp> +#include <boost/swap.hpp> +#include <boost/assert.hpp> +#include <boost/limits.hpp> +#include <boost/iterator.hpp> + +namespace boost { namespace unordered { namespace detail { + + template <typename Types> struct table; + template <typename NodePointer> struct bucket; + struct ptr_bucket; + template <typename Types> struct table_impl; + template <typename Types> struct grouped_table_impl; + +}}} + +namespace boost { namespace unordered { namespace iterator_detail { -namespace boost { namespace unordered_detail { - //////////////////////////////////////////////////////////////////////////// - // Buckets - - template <class A, class G> - inline std::size_t hash_buckets<A, G>::max_bucket_count() const { - // -1 to account for the sentinel. - return prev_prime(this->bucket_alloc().max_size() - 1); - } + // Iterators + // + // all no throw - template <class A, class G> - inline BOOST_DEDUCED_TYPENAME hash_buckets<A, G>::bucket_ptr - hash_buckets<A, G>::get_bucket(std::size_t num) const + template <typename NodePointer, typename Value> struct iterator; + template <typename ConstNodePointer, typename NodePointer, + typename Value> struct c_iterator; + template <typename NodePointer, typename Value, typename Policy> + struct l_iterator; + template <typename ConstNodePointer, typename NodePointer, + typename Value, typename Policy> struct cl_iterator; + + // Local Iterators + // + // all no throw + + template <typename NodePointer, typename Value, typename Policy> + struct l_iterator + : public boost::iterator< + std::forward_iterator_tag, Value, std::ptrdiff_t, + NodePointer, Value&> { - return buckets_ + static_cast<std::ptrdiff_t>(num); - } +#if !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) + template <typename ConstNodePointer, typename NodePointer2, + typename Value2, typename Policy2> + friend struct boost::unordered::iterator_detail::cl_iterator; + private: +#endif + typedef NodePointer node_pointer; + typedef boost::unordered::iterator_detail::iterator<NodePointer, Value> + iterator; + node_pointer ptr_; + std::size_t bucket_; + std::size_t bucket_count_; + + public: + + l_iterator() : ptr_() {} + + l_iterator(iterator x, std::size_t b, std::size_t c) + : ptr_(x.node_), bucket_(b), bucket_count_(c) {} - template <class A, class G> - inline BOOST_DEDUCED_TYPENAME hash_buckets<A, G>::bucket_ptr - hash_buckets<A, G>::bucket_ptr_from_hash(std::size_t hashed) const + Value& operator*() const { + return ptr_->value(); + } + + Value* operator->() const { + return ptr_->value_ptr(); + } + + l_iterator& operator++() { + ptr_ = static_cast<node_pointer>(ptr_->next_); + if (ptr_ && Policy::to_bucket(bucket_count_, ptr_->hash_) + != bucket_) + ptr_ = node_pointer(); + return *this; + } + + l_iterator operator++(int) { + l_iterator tmp(*this); + ++(*this); + return tmp; + } + + bool operator==(l_iterator x) const { + return ptr_ == x.ptr_; + } + + bool operator!=(l_iterator x) const { + return ptr_ != x.ptr_; + } + }; + + template <typename ConstNodePointer, typename NodePointer, typename Value, + typename Policy> + struct cl_iterator + : public boost::iterator< + std::forward_iterator_tag, Value, std::ptrdiff_t, + ConstNodePointer, Value const&> { - return get_bucket(hashed % bucket_count_); - } - - template <class A, class G> - std::size_t hash_buckets<A, G>::bucket_size(std::size_t index) const + friend struct boost::unordered::iterator_detail::l_iterator + <NodePointer, Value, Policy>; + private: + + typedef NodePointer node_pointer; + typedef boost::unordered::iterator_detail::iterator<NodePointer, Value> + iterator; + node_pointer ptr_; + std::size_t bucket_; + std::size_t bucket_count_; + + public: + + cl_iterator() : ptr_() {} + + cl_iterator(iterator x, std::size_t b, std::size_t c) : + ptr_(x.node_), bucket_(b), bucket_count_(c) {} + + cl_iterator(boost::unordered::iterator_detail::l_iterator< + NodePointer, Value, Policy> const& x) : + ptr_(x.ptr_), bucket_(x.bucket_), bucket_count_(x.bucket_count_) + {} + + Value const& + operator*() const { + return ptr_->value(); + } + + Value const* operator->() const { + return ptr_->value_ptr(); + } + + cl_iterator& operator++() { + ptr_ = static_cast<node_pointer>(ptr_->next_); + if (ptr_ && Policy::to_bucket(bucket_count_, ptr_->hash_) + != bucket_) + ptr_ = node_pointer(); + return *this; + } + + cl_iterator operator++(int) { + cl_iterator tmp(*this); + ++(*this); + return tmp; + } + + friend bool operator==(cl_iterator const& x, cl_iterator const& y) { + return x.ptr_ == y.ptr_; + } + + friend bool operator!=(cl_iterator const& x, cl_iterator const& y) { + return x.ptr_ != y.ptr_; + } + }; + + template <typename NodePointer, typename Value> + struct iterator + : public boost::iterator< + std::forward_iterator_tag, Value, std::ptrdiff_t, + NodePointer, Value&> { - if(!buckets_) return 0; - bucket_ptr ptr = get_bucket(index)->next_; - std::size_t count = 0; - while(ptr) { - ++count; - ptr = ptr->next_; - } - return count; - } +#if !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) + template <typename, typename, typename> + friend struct boost::unordered::iterator_detail::c_iterator; + template <typename, typename, typename> + friend struct boost::unordered::iterator_detail::l_iterator; + template <typename, typename, typename, typename> + friend struct boost::unordered::iterator_detail::cl_iterator; + template <typename> + friend struct boost::unordered::detail::table; + template <typename> + friend struct boost::unordered::detail::table_impl; + template <typename> + friend struct boost::unordered::detail::grouped_table_impl; + private: +#endif + typedef NodePointer node_pointer; + node_pointer node_; + + public: - template <class A, class G> - inline BOOST_DEDUCED_TYPENAME hash_buckets<A, G>::node_ptr - hash_buckets<A, G>::bucket_begin(std::size_t num) const + iterator() : node_() {} + + explicit iterator(node_pointer const& x) : node_(x) {} + + Value& operator*() const { + return node_->value(); + } + + Value* operator->() const { + return &node_->value(); + } + + iterator& operator++() { + node_ = static_cast<node_pointer>(node_->next_); + return *this; + } + + iterator operator++(int) { + iterator tmp(node_); + node_ = static_cast<node_pointer>(node_->next_); + return tmp; + } + + bool operator==(iterator const& x) const { + return node_ == x.node_; + } + + bool operator!=(iterator const& x) const { + return node_ != x.node_; + } + }; + + template <typename ConstNodePointer, typename NodePointer, typename Value> + struct c_iterator + : public boost::iterator< + std::forward_iterator_tag, Value, std::ptrdiff_t, + ConstNodePointer, Value const&> { - return buckets_ ? get_bucket(num)->next_ : node_ptr(); - } + friend struct boost::unordered::iterator_detail::iterator< + NodePointer, Value>; - //////////////////////////////////////////////////////////////////////////// - // Delete +#if !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) + template <typename> + friend struct boost::unordered::detail::table; + template <typename> + friend struct boost::unordered::detail::table_impl; + template <typename> + friend struct boost::unordered::detail::grouped_table_impl; + + private: +#endif + + typedef NodePointer node_pointer; + typedef boost::unordered::iterator_detail::iterator<NodePointer, Value> + iterator; + node_pointer node_; + + public: + + c_iterator() : node_() {} + + explicit c_iterator(node_pointer const& x) : node_(x) {} + + c_iterator(boost::unordered::iterator_detail::iterator< + NodePointer, Value> const& x) : node_(x.node_) {} + + Value const& operator*() const { + return node_->value(); + } + + Value const* operator->() const { + return &node_->value(); + } + + c_iterator& operator++() { + node_ = static_cast<node_pointer>(node_->next_); + return *this; + } + + c_iterator operator++(int) { + c_iterator tmp(node_); + node_ = static_cast<node_pointer>(node_->next_); + return tmp; + } + + friend bool operator==(c_iterator const& x, c_iterator const& y) { + return x.node_ == y.node_; + } + + friend bool operator!=(c_iterator const& x, c_iterator const& y) { + return x.node_ != y.node_; + } + }; +}}} + +namespace boost { namespace unordered { namespace detail { + + /////////////////////////////////////////////////////////////////// + // + // Node construction + + template <typename NodeAlloc> + struct node_constructor + { + private: + + typedef NodeAlloc node_allocator; + typedef boost::unordered::detail::allocator_traits<NodeAlloc> + node_allocator_traits; + typedef typename node_allocator_traits::value_type node; + typedef typename node_allocator_traits::pointer node_pointer; + typedef typename node::value_type value_type; + + protected: + + node_allocator& alloc_; + + private: + + node_pointer node_; + bool node_constructed_; + bool value_constructed_; + + public: + + node_constructor(node_allocator& n) : + alloc_(n), + node_(), + node_constructed_(false), + value_constructed_(false) + { + } + + ~node_constructor(); + + void construct(); + + template <BOOST_UNORDERED_EMPLACE_TEMPLATE> + void construct_with_value(BOOST_UNORDERED_EMPLACE_ARGS) + { + construct(); + boost::unordered::detail::construct_value_impl( + alloc_, node_->value_ptr(), BOOST_UNORDERED_EMPLACE_FORWARD); + value_constructed_ = true; + } + + template <typename A0> + void construct_with_value2(BOOST_FWD_REF(A0) a0) + { + construct(); + boost::unordered::detail::construct_value_impl( + alloc_, node_->value_ptr(), + BOOST_UNORDERED_EMPLACE_ARGS1(boost::forward<A0>(a0))); + value_constructed_ = true; + } - template <class A, class G> - inline void hash_buckets<A, G>::delete_node(node_ptr b) + value_type const& value() const { + BOOST_ASSERT(node_ && node_constructed_ && value_constructed_); + return node_->value(); + } + + // no throw + node_pointer release() + { + BOOST_ASSERT(node_ && node_constructed_); + node_pointer p = node_; + node_ = node_pointer(); + return p; + } + + private: + node_constructor(node_constructor const&); + node_constructor& operator=(node_constructor const&); + }; + + template <typename Alloc> + node_constructor<Alloc>::~node_constructor() { - node* raw_ptr = static_cast<node*>(&*b); - boost::unordered_detail::destroy(raw_ptr->value_ptr()); - real_node_ptr n(node_alloc().address(*raw_ptr)); - node_alloc().destroy(n); - node_alloc().deallocate(n, 1); + if (node_) { + if (value_constructed_) { + boost::unordered::detail::destroy_value_impl(alloc_, + node_->value_ptr()); + } + + if (node_constructed_) { + node_allocator_traits::destroy(alloc_, + boost::addressof(*node_)); + } + + node_allocator_traits::deallocate(alloc_, node_, 1); + } } - template <class A, class G> - inline void hash_buckets<A, G>::clear_bucket(bucket_ptr b) + template <typename Alloc> + void node_constructor<Alloc>::construct() { - node_ptr node_it = b->next_; - b->next_ = node_ptr(); + if(!node_) { + node_constructed_ = false; + value_constructed_ = false; + + node_ = node_allocator_traits::allocate(alloc_, 1); + + node_allocator_traits::construct(alloc_, + boost::addressof(*node_), node()); + node_->init(static_cast<typename node::link_pointer>(node_)); + node_constructed_ = true; + } + else { + BOOST_ASSERT(node_constructed_); - while(node_it) { - node_ptr node_to_delete = node_it; - node_it = node_it->next_; - delete_node(node_to_delete); + if (value_constructed_) + { + boost::unordered::detail::destroy_value_impl(alloc_, + node_->value_ptr()); + value_constructed_ = false; + } } } - template <class A, class G> - inline void hash_buckets<A, G>::delete_buckets() - { - bucket_ptr end = this->get_bucket(this->bucket_count_); + /////////////////////////////////////////////////////////////////// + // + // Node Holder + // + // Temporary store for nodes. Deletes any that aren't used. + + template <typename NodeAlloc> + struct node_holder : private node_constructor<NodeAlloc> + { + private: + typedef node_constructor<NodeAlloc> base; + + typedef NodeAlloc node_allocator; + typedef boost::unordered::detail::allocator_traits<NodeAlloc> + node_allocator_traits; + typedef typename node_allocator_traits::value_type node; + typedef typename node_allocator_traits::pointer node_pointer; + typedef typename node::value_type value_type; + typedef typename node::link_pointer link_pointer; + typedef boost::unordered::iterator_detail:: + iterator<node_pointer, value_type> iterator; - for(bucket_ptr begin = this->buckets_; begin != end; ++begin) { - clear_bucket(begin); + node_pointer nodes_; + + public: + + template <typename Table> + explicit node_holder(Table& b) : + base(b.node_alloc()), + nodes_() + { + if (b.size_) { + typename Table::previous_pointer prev = b.get_previous_start(); + nodes_ = static_cast<node_pointer>(prev->next_); + prev->next_ = link_pointer(); + b.size_ = 0; + } } - // Destroy the buckets (including the sentinel bucket). - ++end; - for(bucket_ptr begin = this->buckets_; begin != end; ++begin) { - bucket_alloc().destroy(begin); + ~node_holder(); + + template <typename T> + inline void assign_impl(T const& v) { + nodes_->value() = v; } - bucket_alloc().deallocate(this->buckets_, this->bucket_count_ + 1); + template <typename T1, typename T2> + inline void assign_impl(std::pair<T1 const, T2> const& v) { + const_cast<T1&>(nodes_->value().first) = v.first; + nodes_->value().second = v.second; + } - this->buckets_ = bucket_ptr(); - } + template <typename T> + inline void move_assign_impl(T& v) { + nodes_->value() = boost::move(v); + } - template <class A, class G> - inline std::size_t hash_buckets<A, G>::delete_nodes( - node_ptr begin, node_ptr end) + template <typename T1, typename T2> + inline void move_assign_impl(std::pair<T1 const, T2>& v) { + // TODO: Move key as well? + const_cast<T1&>(nodes_->value().first) = + boost::move(const_cast<T1&>(v.first)); + nodes_->value().second = boost::move(v.second); + } + + node_pointer copy_of(value_type const& v) + { + if (nodes_) { + assign_impl(v); + node_pointer p = nodes_; + nodes_ = static_cast<node_pointer>(p->next_); + p->init(static_cast<typename node::link_pointer>(p)); + p->next_ = link_pointer(); + return p; + } + else { + this->construct_with_value2(v); + return base::release(); + } + } + + node_pointer move_copy_of(value_type& v) + { + if (nodes_) { + move_assign_impl(v); + node_pointer p = nodes_; + nodes_ = static_cast<node_pointer>(p->next_); + p->init(static_cast<typename node::link_pointer>(p)); + p->next_ = link_pointer(); + return p; + } + else { + this->construct_with_value2(boost::move(v)); + return base::release(); + } + } + + iterator begin() const + { + return iterator(nodes_); + } + }; + + template <typename Alloc> + node_holder<Alloc>::~node_holder() { - std::size_t count = 0; - while(begin != end) { - node_ptr n = begin; - begin = begin->next_; - delete_node(n); - ++count; - } - return count; + while (nodes_) { + node_pointer p = nodes_; + nodes_ = static_cast<node_pointer>(p->next_); + + boost::unordered::detail::destroy_value_impl(this->alloc_, + p->value_ptr()); + node_allocator_traits::destroy(this->alloc_, boost::addressof(*p)); + node_allocator_traits::deallocate(this->alloc_, p, 1); + } } - //////////////////////////////////////////////////////////////////////////// - // Constructors and Destructors - - template <class A, class G> - inline hash_buckets<A, G>::hash_buckets( - node_allocator const& a, std::size_t bucket_count) - : buckets_(), - bucket_count_(bucket_count), - allocators_(a,a) + /////////////////////////////////////////////////////////////////// + // + // Bucket + + template <typename NodePointer> + struct bucket { - } + typedef NodePointer previous_pointer; + previous_pointer next_; + + bucket() : next_() {} - template <class A, class G> - inline hash_buckets<A, G>::~hash_buckets() + previous_pointer first_from_start() + { + return next_; + } + + enum { extra_node = true }; + }; + + struct ptr_bucket { - if(this->buckets_) { this->delete_buckets(); } - } - - template <class A, class G> - inline void hash_buckets<A, G>::create_buckets() + typedef ptr_bucket* previous_pointer; + previous_pointer next_; + + ptr_bucket() : next_(0) {} + + previous_pointer first_from_start() + { + return this; + } + + enum { extra_node = false }; + }; + + /////////////////////////////////////////////////////////////////// + // + // Hash Policy + // + // Don't really want table to derive from this, but will for now. + + template <typename SizeT> + struct prime_policy { - // The array constructor will clean up in the event of an - // exception. - allocator_array_constructor<bucket_allocator> - constructor(bucket_alloc()); - - // Creates an extra bucket to act as a sentinel. - constructor.construct(bucket(), this->bucket_count_ + 1); - - // Set up the sentinel (node_ptr cast) - bucket_ptr sentinel = constructor.get() + - static_cast<std::ptrdiff_t>(this->bucket_count_); - sentinel->next_ = sentinel; - - // Only release the buckets once everything is successfully - // done. - this->buckets_ = constructor.release(); - } + template <typename Hash, typename T> + static inline SizeT apply_hash(Hash const& hf, T const& x) { + return hf(x); + } + + static inline SizeT to_bucket(SizeT bucket_count, SizeT hash) { + return hash % bucket_count; + } + + static inline SizeT new_bucket_count(SizeT min) { + return boost::unordered::detail::next_prime(min); + } + + static inline SizeT prev_bucket_count(SizeT max) { + return boost::unordered::detail::prev_prime(max); + } + }; + + template <typename SizeT> + struct mix64_policy + { + template <typename Hash, typename T> + static inline SizeT apply_hash(Hash const& hf, T const& x) { + SizeT key = hf(x); + key = (~key) + (key << 21); // key = (key << 21) - key - 1; + key = key ^ (key >> 24); + key = (key + (key << 3)) + (key << 8); // key * 265 + key = key ^ (key >> 14); + key = (key + (key << 2)) + (key << 4); // key * 21 + key = key ^ (key >> 28); + key = key + (key << 31); + return key; + } + + static inline SizeT to_bucket(SizeT bucket_count, SizeT hash) { + return hash & (bucket_count - 1); + } + + static inline SizeT new_bucket_count(SizeT min) { + if (min <= 4) return 4; + --min; + min |= min >> 1; + min |= min >> 2; + min |= min >> 4; + min |= min >> 8; + min |= min >> 16; + min |= min >> 32; + return min + 1; + } + + static inline SizeT prev_bucket_count(SizeT max) { + max |= max >> 1; + max |= max >> 2; + max |= max >> 4; + max |= max >> 8; + max |= max >> 16; + max |= max >> 32; + return (max >> 1) + 1; + } + }; + + template <int digits, int radix> + struct pick_policy_impl { + typedef prime_policy<std::size_t> type; + }; + + template <> + struct pick_policy_impl<64, 2> { + typedef mix64_policy<std::size_t> type; + }; + + struct pick_policy : + pick_policy_impl< + std::numeric_limits<std::size_t>::digits, + std::numeric_limits<std::size_t>::radix> {}; //////////////////////////////////////////////////////////////////////////// - // Constructors and Destructors + // Functions + + // Assigning and swapping the equality and hash function objects + // needs strong exception safety. To implement that normally we'd + // require one of them to be known to not throw and the other to + // guarantee strong exception safety. Unfortunately they both only + // have basic exception safety. So to acheive strong exception + // safety we have storage space for two copies, and assign the new + // copies to the unused space. Then switch to using that to use + // them. This is implemented in 'set_hash_functions' which + // atomically assigns the new function objects in a strongly + // exception safe manner. + + template <class H, class P> class set_hash_functions; - // no throw - template <class A, class G> - inline void hash_buckets<A, G>::move(hash_buckets& other) + template <class H, class P> + class functions { - BOOST_ASSERT(node_alloc() == other.node_alloc()); - if(this->buckets_) { this->delete_buckets(); } - this->buckets_ = other.buckets_; - this->bucket_count_ = other.bucket_count_; - other.buckets_ = bucket_ptr(); - other.bucket_count_ = 0; - } + friend class boost::unordered::detail::set_hash_functions<H, P>; + functions& operator=(functions const&); + + typedef compressed<H, P> function_pair; + + typedef typename boost::aligned_storage< + sizeof(function_pair), + boost::alignment_of<function_pair>::value>::type aligned_function; + + bool current_; // The currently active functions. + aligned_function funcs_[2]; + + function_pair const& current() const { + return *static_cast<function_pair const*>( + static_cast<void const*>(&funcs_[current_])); + } + + void construct(bool which, H const& hf, P const& eq) + { + new((void*) &funcs_[which]) function_pair(hf, eq); + } + + void construct(bool which, function_pair const& f) + { + new((void*) &funcs_[which]) function_pair(f); + } + + void destroy(bool which) + { + boost::unordered::detail::destroy((function_pair*)(&funcs_[which])); + } + + public: + + functions(H const& hf, P const& eq) + : current_(false) + { + construct(current_, hf, eq); + } - template <class A, class G> - inline void hash_buckets<A, G>::swap(hash_buckets<A, G>& other) + functions(functions const& bf) + : current_(false) + { + construct(current_, bf.current()); + } + + ~functions() { + this->destroy(current_); + } + + H const& hash_function() const { + return current().first(); + } + + P const& key_eq() const { + return current().second(); + } + }; + + template <class H, class P> + class set_hash_functions { - BOOST_ASSERT(node_alloc() == other.node_alloc()); - std::swap(buckets_, other.buckets_); - std::swap(bucket_count_, other.bucket_count_); - } -}} + set_hash_functions(set_hash_functions const&); + set_hash_functions& operator=(set_hash_functions const&); + + functions<H,P>& functions_; + bool tmp_functions_; + + public: + + set_hash_functions(functions<H,P>& f, H const& h, P const& p) + : functions_(f), + tmp_functions_(!f.current_) + { + f.construct(tmp_functions_, h, p); + } + + set_hash_functions(functions<H,P>& f, functions<H,P> const& other) + : functions_(f), + tmp_functions_(!f.current_) + { + f.construct(tmp_functions_, other.current()); + } + + ~set_hash_functions() + { + functions_.destroy(tmp_functions_); + } + + void commit() + { + functions_.current_ = tmp_functions_; + tmp_functions_ = !tmp_functions_; + } + }; + + //////////////////////////////////////////////////////////////////////////// + // rvalue parameters when type can't be a BOOST_RV_REF(T) parameter + // e.g. for int + +#if !defined(BOOST_NO_RVALUE_REFERENCES) +# define BOOST_UNORDERED_RV_REF(T) BOOST_RV_REF(T) +#else + struct please_ignore_this_overload { + typedef please_ignore_this_overload type; + }; + + template <typename T> + struct rv_ref_impl { + typedef BOOST_RV_REF(T) type; + }; + + template <typename T> + struct rv_ref : + boost::detail::if_true< + boost::is_class<T>::value + >::BOOST_NESTED_TEMPLATE then < + boost::unordered::detail::rv_ref_impl<T>, + please_ignore_this_overload + >::type + {}; + +# define BOOST_UNORDERED_RV_REF(T) \ + typename boost::unordered::detail::rv_ref<T>::type +#endif +}}} #endif diff --git a/3rdParty/Boost/src/boost/unordered/detail/equivalent.hpp b/3rdParty/Boost/src/boost/unordered/detail/equivalent.hpp index 1c497c3..3558b1c 100644 --- a/3rdParty/Boost/src/boost/unordered/detail/equivalent.hpp +++ b/3rdParty/Boost/src/boost/unordered/detail/equivalent.hpp @@ -1,304 +1,781 @@ // Copyright (C) 2003-2004 Jeremy B. Maitin-Shepard. -// Copyright (C) 2005-2009 Daniel James +// Copyright (C) 2005-2011 Daniel James // 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_UNORDERED_DETAIL_EQUIVALENT_HPP_INCLUDED #define BOOST_UNORDERED_DETAIL_EQUIVALENT_HPP_INCLUDED +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + #include <boost/unordered/detail/table.hpp> #include <boost/unordered/detail/extract_key.hpp> -namespace boost { namespace unordered_detail { +namespace boost { namespace unordered { namespace detail { + + template <typename A, typename T> struct grouped_node; + template <typename T> struct grouped_ptr_node; + template <typename Types> struct grouped_table_impl; - template <class T> - class hash_equivalent_table : public T::table + template <typename A, typename T> + struct grouped_node : + boost::unordered::detail::value_base<T> { - public: - typedef BOOST_DEDUCED_TYPENAME T::hasher hasher; - typedef BOOST_DEDUCED_TYPENAME T::key_equal key_equal; - typedef BOOST_DEDUCED_TYPENAME T::value_allocator value_allocator; - typedef BOOST_DEDUCED_TYPENAME T::key_type key_type; - typedef BOOST_DEDUCED_TYPENAME T::value_type value_type; - typedef BOOST_DEDUCED_TYPENAME T::table table; - typedef BOOST_DEDUCED_TYPENAME T::node_constructor node_constructor; - - typedef BOOST_DEDUCED_TYPENAME T::node node; - typedef BOOST_DEDUCED_TYPENAME T::node_ptr node_ptr; - typedef BOOST_DEDUCED_TYPENAME T::bucket_ptr bucket_ptr; - typedef BOOST_DEDUCED_TYPENAME T::iterator_base iterator_base; - typedef BOOST_DEDUCED_TYPENAME T::extractor extractor; + typedef typename ::boost::unordered::detail::rebind_wrap< + A, grouped_node<A, T> >::type::pointer link_pointer; - // Constructors + link_pointer next_; + link_pointer group_prev_; + std::size_t hash_; - hash_equivalent_table(std::size_t n, - hasher const& hf, key_equal const& eq, value_allocator const& a) - : table(n, hf, eq, a) {} - hash_equivalent_table(hash_equivalent_table const& x) - : table(x, x.node_alloc()) {} - hash_equivalent_table(hash_equivalent_table const& x, - value_allocator const& a) - : table(x, a) {} - hash_equivalent_table(hash_equivalent_table& x, move_tag m) - : table(x, m) {} - hash_equivalent_table(hash_equivalent_table& x, - value_allocator const& a, move_tag m) - : table(x, a, m) {} - ~hash_equivalent_table() {} + grouped_node() : + next_(), + group_prev_(), + hash_(0) + {} - // Insert methods + void init(link_pointer self) + { + group_prev_ = self; + } - iterator_base emplace_impl(node_constructor& a); - void emplace_impl_no_rehash(node_constructor& a); + private: + grouped_node& operator=(grouped_node const&); + }; - // equals + template <typename T> + struct grouped_ptr_node : + boost::unordered::detail::value_base<T>, + boost::unordered::detail::ptr_bucket + { + typedef boost::unordered::detail::ptr_bucket bucket_base; + typedef ptr_bucket* link_pointer; - bool equals(hash_equivalent_table const&) const; + link_pointer group_prev_; + std::size_t hash_; - inline node_ptr add_node(node_constructor& a, - bucket_ptr bucket, node_ptr pos); + grouped_ptr_node() : + bucket_base(), + group_prev_(0), + hash_(0) + {} -#if defined(BOOST_UNORDERED_STD_FORWARD) + void init(link_pointer self) + { + group_prev_ = self; + } - template <class... Args> - iterator_base emplace(Args&&... args); + private: + grouped_ptr_node& operator=(grouped_ptr_node const&); + }; -#else + // If the allocator uses raw pointers use grouped_ptr_node + // Otherwise use grouped_node. -#define BOOST_UNORDERED_INSERT_IMPL(z, n, _) \ - template <BOOST_UNORDERED_TEMPLATE_ARGS(z, n)> \ - iterator_base emplace(BOOST_UNORDERED_FUNCTION_PARAMS(z, n)); + template <typename A, typename T, typename NodePtr, typename BucketPtr> + struct pick_grouped_node2 + { + typedef boost::unordered::detail::grouped_node<A, T> node; - BOOST_PP_REPEAT_FROM_TO(1, BOOST_UNORDERED_EMPLACE_LIMIT, - BOOST_UNORDERED_INSERT_IMPL, _) + typedef typename boost::unordered::detail::allocator_traits< + typename boost::unordered::detail::rebind_wrap<A, node>::type + >::pointer node_pointer; -#undef BOOST_UNORDERED_INSERT_IMPL -#endif + typedef boost::unordered::detail::bucket<node_pointer> bucket; + typedef node_pointer link_pointer; + }; - template <class I> - void insert_for_range(I i, I j, forward_traversal_tag); - template <class I> - void insert_for_range(I i, I j, boost::incrementable_traversal_tag); - template <class I> - void insert_range(I i, I j); + template <typename A, typename T> + struct pick_grouped_node2<A, T, + boost::unordered::detail::grouped_ptr_node<T>*, + boost::unordered::detail::ptr_bucket*> + { + typedef boost::unordered::detail::grouped_ptr_node<T> node; + typedef boost::unordered::detail::ptr_bucket bucket; + typedef bucket* link_pointer; }; - template <class H, class P, class A> - struct multiset : public types< - BOOST_DEDUCED_TYPENAME A::value_type, - BOOST_DEDUCED_TYPENAME A::value_type, - H, P, A, - set_extractor<BOOST_DEDUCED_TYPENAME A::value_type>, - grouped> + template <typename A, typename T> + struct pick_grouped_node { - typedef hash_equivalent_table<multiset<H, P, A> > impl; - typedef hash_table<multiset<H, P, A> > table; + typedef boost::unordered::detail::allocator_traits< + typename boost::unordered::detail::rebind_wrap<A, + boost::unordered::detail::grouped_ptr_node<T> >::type + > tentative_node_traits; + + typedef boost::unordered::detail::allocator_traits< + typename boost::unordered::detail::rebind_wrap<A, + boost::unordered::detail::ptr_bucket >::type + > tentative_bucket_traits; + + typedef pick_grouped_node2<A, T, + typename tentative_node_traits::pointer, + typename tentative_bucket_traits::pointer> pick; + + typedef typename pick::node node; + typedef typename pick::bucket bucket; + typedef typename pick::link_pointer link_pointer; }; - template <class K, class H, class P, class A> - struct multimap : public types< - K, BOOST_DEDUCED_TYPENAME A::value_type, - H, P, A, - map_extractor<K, BOOST_DEDUCED_TYPENAME A::value_type>, - grouped> + template <typename A, typename T, typename H, typename P> + struct multiset { - typedef hash_equivalent_table<multimap<K, H, P, A> > impl; - typedef hash_table<multimap<K, H, P, A> > table; + typedef boost::unordered::detail::multiset<A, T, H, P> types; + + typedef A allocator; + typedef T value_type; + typedef H hasher; + typedef P key_equal; + typedef T key_type; + + typedef boost::unordered::detail::allocator_traits<allocator> traits; + typedef boost::unordered::detail::pick_grouped_node<allocator, + value_type> pick; + typedef typename pick::node node; + typedef typename pick::bucket bucket; + typedef typename pick::link_pointer link_pointer; + + typedef boost::unordered::detail::grouped_table_impl<types> table; + typedef boost::unordered::detail::set_extractor<value_type> extractor; + + typedef boost::unordered::detail::pick_policy::type policy; }; - //////////////////////////////////////////////////////////////////////////// - // Equality + template <typename A, typename K, typename M, typename H, typename P> + struct multimap + { + typedef boost::unordered::detail::multimap<A, K, M, H, P> types; + + typedef A allocator; + typedef std::pair<K const, M> value_type; + typedef H hasher; + typedef P key_equal; + typedef K key_type; + + typedef boost::unordered::detail::allocator_traits<allocator> traits; + typedef boost::unordered::detail::pick_grouped_node<allocator, + value_type> pick; + typedef typename pick::node node; + typedef typename pick::bucket bucket; + typedef typename pick::link_pointer link_pointer; + + typedef boost::unordered::detail::grouped_table_impl<types> table; + typedef boost::unordered::detail::map_extractor<key_type, value_type> + extractor; + + typedef boost::unordered::detail::pick_policy::type policy; + }; - template <class T> - bool hash_equivalent_table<T> - ::equals(hash_equivalent_table<T> const& other) const + template <typename Types> + struct grouped_table_impl : boost::unordered::detail::table<Types> { - if(this->size_ != other.size_) return false; - if(!this->size_) return true; + typedef boost::unordered::detail::table<Types> table; + typedef typename table::value_type value_type; + typedef typename table::bucket bucket; + typedef typename table::policy policy; + typedef typename table::node_pointer node_pointer; + typedef typename table::node_allocator node_allocator; + typedef typename table::node_allocator_traits node_allocator_traits; + typedef typename table::bucket_pointer bucket_pointer; + typedef typename table::link_pointer link_pointer; + typedef typename table::previous_pointer previous_pointer; + typedef typename table::hasher hasher; + typedef typename table::key_equal key_equal; + typedef typename table::key_type key_type; + typedef typename table::node_constructor node_constructor; + typedef typename table::extractor extractor; + typedef typename table::iterator iterator; + typedef typename table::c_iterator c_iterator; + + // Constructors + + grouped_table_impl(std::size_t n, + hasher const& hf, + key_equal const& eq, + node_allocator const& a) + : table(n, hf, eq, a) + {} + + grouped_table_impl(grouped_table_impl const& x) + : table(x, node_allocator_traits:: + select_on_container_copy_construction(x.node_alloc())) + { + this->init(x); + } + + grouped_table_impl(grouped_table_impl const& x, + node_allocator const& a) + : table(x, a) + { + this->init(x); + } - bucket_ptr end = this->get_bucket(this->bucket_count_); - for(bucket_ptr i = this->cached_begin_bucket_; i != end; ++i) + grouped_table_impl(grouped_table_impl& x, + boost::unordered::detail::move_tag m) + : table(x, m) + {} + + grouped_table_impl(grouped_table_impl& x, + node_allocator const& a, + boost::unordered::detail::move_tag m) + : table(x, a, m) + { + this->move_init(x); + } + + // Accessors + + template <class Key, class Pred> + iterator find_node_impl( + std::size_t key_hash, + Key const& k, + Pred const& eq) const { - node_ptr it1 = i->next_; - while(BOOST_UNORDERED_BORLAND_BOOL(it1)) + std::size_t bucket_index = + policy::to_bucket(this->bucket_count_, key_hash); + iterator n = this->begin(bucket_index); + + for (;;) { - node_ptr it2 = other.find_iterator(this->get_key_from_ptr(it1)); - if(!BOOST_UNORDERED_BORLAND_BOOL(it2)) return false; - - node_ptr end1 = node::next_group(it1); - node_ptr end2 = node::next_group(it2); - - do { - if(!extractor::compare_mapped( - node::get_value(it1), node::get_value(it2))) - return false; - it1 = it1->next_; - it2 = it2->next_; - } while(it1 != end1 && it2 != end2); - if(it1 != end1 || it2 != end2) return false; + if (!n.node_) return n; + + std::size_t node_hash = n.node_->hash_; + if (key_hash == node_hash) + { + if (eq(k, this->get_key(*n))) + return n; + } + else + { + if (policy::to_bucket(this->bucket_count_, node_hash) + != bucket_index) + return iterator(); + } + + n = iterator(static_cast<node_pointer>( + static_cast<node_pointer>(n.node_->group_prev_)->next_)); } } - return true; - } + std::size_t count(key_type const& k) const + { + iterator n = this->find_node(k); + if (!n.node_) return 0; - //////////////////////////////////////////////////////////////////////////// - // A convenience method for adding nodes. + std::size_t x = 0; + node_pointer it = n.node_; + do { + it = static_cast<node_pointer>(it->group_prev_); + ++x; + } while(it != n.node_); - template <class T> - inline BOOST_DEDUCED_TYPENAME hash_equivalent_table<T>::node_ptr - hash_equivalent_table<T> - ::add_node(node_constructor& a, bucket_ptr bucket, node_ptr pos) - { - node_ptr n = a.release(); - if(BOOST_UNORDERED_BORLAND_BOOL(pos)) { - node::add_after_node(n, pos); + return x; } - else { - node::add_to_bucket(n, *bucket); - if(bucket < this->cached_begin_bucket_) - this->cached_begin_bucket_ = bucket; + + std::pair<iterator, iterator> + equal_range(key_type const& k) const + { + iterator n = this->find_node(k); + return std::make_pair( + n, n.node_ ? iterator( + static_cast<node_pointer>( + static_cast<node_pointer>(n.node_->group_prev_)->next_ + )) : n); } - ++this->size_; - return n; - } - //////////////////////////////////////////////////////////////////////////// - // Insert methods + // Equality - template <class T> - inline BOOST_DEDUCED_TYPENAME - hash_equivalent_table<T>::iterator_base - hash_equivalent_table<T>::emplace_impl(node_constructor& a) - { - key_type const& k = this->get_key(a.value()); - std::size_t hash_value = this->hash_function()(k); - - if(!this->size_) { - return this->emplace_empty_impl_with_node(a, 1); + bool equals(grouped_table_impl const& other) const + { + if(this->size_ != other.size_) return false; + + for(iterator n1 = this->begin(); n1.node_;) + { + iterator n2 = other.find_matching_node(n1); + if (!n2.node_) return false; + iterator end1(static_cast<node_pointer>( + static_cast<node_pointer>(n1.node_->group_prev_)->next_)); + iterator end2(static_cast<node_pointer>( + static_cast<node_pointer>(n2.node_->group_prev_)->next_)); + if (!group_equals(n1, end1, n2, end2)) return false; + n1 = end1; + } + + return true; } - else { - bucket_ptr bucket = this->bucket_ptr_from_hash(hash_value); - node_ptr position = this->find_iterator(bucket, k); - // reserve has basic exception safety if the hash function - // throws, strong otherwise. - if(this->reserve_for_insert(this->size_ + 1)) - bucket = this->bucket_ptr_from_hash(hash_value); +#if !defined(BOOST_UNORDERED_DEPRECATED_EQUALITY) + + static bool group_equals(iterator n1, iterator end1, + iterator n2, iterator end2) + { + for(;;) + { + if (*n1 != *n2) break; - return iterator_base(bucket, add_node(a, bucket, position)); + ++n1; + ++n2; + + if (n1 == end1) return n2 == end2; + if (n2 == end2) return false; + } + + for(iterator n1a = n1, n2a = n2;;) + { + ++n1a; + ++n2a; + + if (n1a == end1) + { + if (n2a == end2) break; + else return false; + } + + if (n2a == end2) return false; + } + + iterator start = n1; + for(;n1 != end1; ++n1) + { + value_type const& v = *n1; + if (find(start, n1, v)) continue; + std::size_t matches = count_equal(n2, end2, v); + if (!matches) return false; + iterator next = n1; + ++next; + if (matches != 1 + count_equal(next, end1, v)) return false; + } + + return true; } - } - - template <class T> - inline void hash_equivalent_table<T> - ::emplace_impl_no_rehash(node_constructor& a) - { - key_type const& k = this->get_key(a.value()); - bucket_ptr bucket = this->get_bucket(this->bucket_index(k)); - add_node(a, bucket, this->find_iterator(bucket, k)); - } - -#if defined(BOOST_UNORDERED_STD_FORWARD) - - // Emplace (equivalent key containers) - // (I'm using an overloaded emplace for both 'insert' and 'emplace') - - // if hash function throws, basic exception safety - // strong otherwise - template <class T> - template <class... Args> - BOOST_DEDUCED_TYPENAME hash_equivalent_table<T>::iterator_base - hash_equivalent_table<T> - ::emplace(Args&&... args) - { - // Create the node before rehashing in case it throws an - // exception (need strong safety in such a case). - node_constructor a(*this); - a.construct(std::forward<Args>(args)...); - return emplace_impl(a); - } + static bool find(iterator n, iterator end, value_type const& v) + { + for(;n != end; ++n) + if (*n == v) + return true; + return false; + } + + static std::size_t count_equal(iterator n, iterator end, + value_type const& v) + { + std::size_t count = 0; + for(;n != end; ++n) + if (*n == v) ++count; + return count; + } #else -#define BOOST_UNORDERED_INSERT_IMPL(z, num_params, _) \ - template <class T> \ - template <BOOST_UNORDERED_TEMPLATE_ARGS(z, num_params)> \ - BOOST_DEDUCED_TYPENAME hash_equivalent_table<T>::iterator_base \ - hash_equivalent_table<T> \ - ::emplace(BOOST_UNORDERED_FUNCTION_PARAMS(z, num_params)) \ - { \ - node_constructor a(*this); \ - a.construct(BOOST_UNORDERED_CALL_PARAMS(z, num_params)); \ - return emplace_impl(a); \ - } - - BOOST_PP_REPEAT_FROM_TO(1, BOOST_UNORDERED_EMPLACE_LIMIT, - BOOST_UNORDERED_INSERT_IMPL, _) - -#undef BOOST_UNORDERED_INSERT_IMPL + static bool group_equals(iterator n1, iterator end1, + iterator n2, iterator end2) + { + for(;;) + { + if(!extractor::compare_mapped(*n1, *n2)) + return false; + + ++n1; + ++n2; + + if (n1 == end1) return n2 == end2; + if (n2 == end2) return false; + } + } + #endif - //////////////////////////////////////////////////////////////////////////// - // Insert range methods + // Emplace/Insert - // if hash function throws, or inserting > 1 element, basic exception safety - // strong otherwise - template <class T> - template <class I> - inline void hash_equivalent_table<T> - ::insert_for_range(I i, I j, forward_traversal_tag) - { - if(i == j) return; - std::size_t distance = unordered_detail::distance(i, j); - if(distance == 1) { - emplace(*i); + static inline void add_after_node( + node_pointer n, + node_pointer pos) + { + n->next_ = static_cast<node_pointer>(pos->group_prev_)->next_; + n->group_prev_ = pos->group_prev_; + static_cast<node_pointer>(pos->group_prev_)->next_ = + static_cast<link_pointer>(n); + pos->group_prev_ = static_cast<link_pointer>(n); } - else { - node_constructor a(*this); - // Only require basic exception safety here - if(this->size_) { - this->reserve_for_insert(this->size_ + distance); + inline iterator add_node( + node_constructor& a, + std::size_t key_hash, + iterator pos) + { + node_pointer n = a.release(); + n->hash_ = key_hash; + if (pos.node_) { + this->add_after_node(n, pos.node_); + if (n->next_) { + std::size_t next_bucket = policy::to_bucket( + this->bucket_count_, + static_cast<node_pointer>(n->next_)->hash_); + if (next_bucket != + policy::to_bucket(this->bucket_count_, key_hash)) { + this->get_bucket(next_bucket)->next_ = n; + } + } + } + else { + bucket_pointer b = this->get_bucket( + policy::to_bucket(this->bucket_count_, key_hash)); + + if (!b->next_) + { + previous_pointer start_node = this->get_previous_start(); + + if (start_node->next_) { + this->get_bucket(policy::to_bucket(this->bucket_count_, + static_cast<node_pointer>(start_node->next_)->hash_ + ))->next_ = n; + } + + b->next_ = start_node; + n->next_ = start_node->next_; + start_node->next_ = static_cast<link_pointer>(n); + } + else + { + n->next_ = b->next_->next_; + b->next_->next_ = static_cast<link_pointer>(n); + } + } + ++this->size_; + return iterator(n); + } + + iterator emplace_impl(node_constructor& a) + { + key_type const& k = this->get_key(a.value()); + std::size_t key_hash = this->hash(k); + iterator position = this->find_node(key_hash, k); + + // reserve has basic exception safety if the hash function + // throws, strong otherwise. + this->reserve_for_insert(this->size_ + 1); + return this->add_node(a, key_hash, position); + } + + void emplace_impl_no_rehash(node_constructor& a) + { + key_type const& k = this->get_key(a.value()); + std::size_t key_hash = this->hash(k); + this->add_node(a, key_hash, this->find_node(key_hash, k)); + } + +#if defined(BOOST_NO_RVALUE_REFERENCES) +# if defined(BOOST_NO_VARIADIC_TEMPLATES) + iterator emplace(boost::unordered::detail::emplace_args1< + boost::unordered::detail::please_ignore_this_overload> const&) + { + BOOST_ASSERT(false); + return iterator(); + } +# else + iterator emplace( + boost::unordered::detail::please_ignore_this_overload const&) + { + BOOST_ASSERT(false); + return iterator(); + } +# endif +#endif + + template <BOOST_UNORDERED_EMPLACE_TEMPLATE> + iterator emplace(BOOST_UNORDERED_EMPLACE_ARGS) + { + node_constructor a(this->node_alloc()); + a.construct_with_value(BOOST_UNORDERED_EMPLACE_FORWARD); + + return iterator(emplace_impl(a)); + } + + //////////////////////////////////////////////////////////////////////// + // Insert range methods + + // if hash function throws, or inserting > 1 element, basic exception + // safety. Strong otherwise + template <class I> + typename boost::unordered::detail::enable_if_forward<I, void>::type + insert_range(I i, I j) + { + if(i == j) return; + + std::size_t distance = boost::unordered::detail::distance(i, j); + if(distance == 1) { + node_constructor a(this->node_alloc()); + a.construct_with_value2(*i); + emplace_impl(a); } else { - a.construct(*i++); - this->emplace_empty_impl_with_node(a, distance); + // Only require basic exception safety here + this->reserve_for_insert(this->size_ + distance); + + node_constructor a(this->node_alloc()); + for (; i != j; ++i) { + a.construct_with_value2(*i); + emplace_impl_no_rehash(a); + } } + } + template <class I> + typename boost::unordered::detail::disable_if_forward<I, void>::type + insert_range(I i, I j) + { + node_constructor a(this->node_alloc()); for (; i != j; ++i) { - a.construct(*i); - emplace_impl_no_rehash(a); + a.construct_with_value2(*i); + emplace_impl(a); } } - } - - // if hash function throws, or inserting > 1 element, basic exception safety - // strong otherwise - template <class T> - template <class I> - inline void hash_equivalent_table<T> - ::insert_for_range(I i, I j, boost::incrementable_traversal_tag) - { - node_constructor a(*this); - for (; i != j; ++i) { - a.construct(*i); - emplace_impl(a); + + //////////////////////////////////////////////////////////////////////// + // Erase + // + // no throw + + std::size_t erase_key(key_type const& k) + { + if(!this->size_) return 0; + + std::size_t key_hash = this->hash(k); + std::size_t bucket_index = + policy::to_bucket(this->bucket_count_, key_hash); + bucket_pointer this_bucket = this->get_bucket(bucket_index); + + previous_pointer prev = this_bucket->next_; + if (!prev) return 0; + + for (;;) + { + if (!prev->next_) return 0; + std::size_t node_hash = + static_cast<node_pointer>(prev->next_)->hash_; + if (policy::to_bucket(this->bucket_count_, node_hash) + != bucket_index) + return 0; + if (node_hash == key_hash && + this->key_eq()(k, this->get_key( + static_cast<node_pointer>(prev->next_)->value()))) + break; + prev = static_cast<previous_pointer>( + static_cast<node_pointer>(prev->next_)->group_prev_); + } + + node_pointer pos = static_cast<node_pointer>(prev->next_); + link_pointer end1 = + static_cast<node_pointer>(pos->group_prev_)->next_; + node_pointer end = static_cast<node_pointer>(end1); + prev->next_ = end1; + this->fix_buckets(this_bucket, prev, end); + return this->delete_nodes(c_iterator(pos), c_iterator(end)); } - } - // if hash function throws, or inserting > 1 element, basic exception safety - // strong otherwise - template <class T> - template <class I> - void hash_equivalent_table<T>::insert_range(I i, I j) - { - BOOST_DEDUCED_TYPENAME boost::iterator_traversal<I>::type - iterator_traversal_tag; - insert_for_range(i, j, iterator_traversal_tag); - } -}} + iterator erase(c_iterator r) + { + BOOST_ASSERT(r.node_); + iterator next(r.node_); + ++next; + + bucket_pointer this_bucket = this->get_bucket( + policy::to_bucket(this->bucket_count_, r.node_->hash_)); + previous_pointer prev = unlink_node(*this_bucket, r.node_); + + this->fix_buckets(this_bucket, prev, next.node_); + + this->delete_node(r); + + return next; + } + + iterator erase_range(c_iterator r1, c_iterator r2) + { + if (r1 == r2) return iterator(r2.node_); + + std::size_t bucket_index = + policy::to_bucket(this->bucket_count_, r1.node_->hash_); + previous_pointer prev = unlink_nodes( + *this->get_bucket(bucket_index), r1.node_, r2.node_); + this->fix_buckets_range(bucket_index, prev, r1.node_, r2.node_); + this->delete_nodes(r1, r2); + + return iterator(r2.node_); + } + + static previous_pointer unlink_node(bucket& b, node_pointer n) + { + node_pointer next = static_cast<node_pointer>(n->next_); + previous_pointer prev = + static_cast<previous_pointer>(n->group_prev_); + + if(prev->next_ != n) { + // The node is at the beginning of a group. + + // Find the previous node pointer: + prev = b.next_; + while(prev->next_ != n) { + prev = static_cast<previous_pointer>( + static_cast<node_pointer>(prev->next_)->group_prev_); + } + + // Remove from group + if (next && next->group_prev_ == static_cast<link_pointer>(n)) + { + next->group_prev_ = n->group_prev_; + } + } + else if (next && next->group_prev_ == static_cast<link_pointer>(n)) + { + // The deleted node is not at the end of the group, so + // change the link from the next node. + next->group_prev_ = n->group_prev_; + } + else { + // The deleted node is at the end of the group, so the + // first node in the group is pointing to it. + // Find that to change its pointer. + node_pointer x = static_cast<node_pointer>(n->group_prev_); + while(x->group_prev_ != static_cast<link_pointer>(n)) { + x = static_cast<node_pointer>(x->group_prev_); + } + x->group_prev_ = n->group_prev_; + } + + prev->next_ = static_cast<link_pointer>(next); + return prev; + } + + static previous_pointer unlink_nodes(bucket& b, + node_pointer begin, node_pointer end) + { + previous_pointer prev = static_cast<previous_pointer>( + begin->group_prev_); + + if(prev->next_ != static_cast<link_pointer>(begin)) { + // The node is at the beginning of a group. + + // Find the previous node pointer: + prev = b.next_; + while(prev->next_ != static_cast<link_pointer>(begin)) + prev = static_cast<previous_pointer>( + static_cast<node_pointer>(prev->next_)->group_prev_); + + if (end) split_group(end); + } + else { + node_pointer group1 = split_group(begin); + + if (end) { + node_pointer group2 = split_group(end); + + if(begin == group2) { + link_pointer end1 = group1->group_prev_; + link_pointer end2 = end->group_prev_; + group1->group_prev_ = end2; + end->group_prev_ = end1; + } + } + } + + prev->next_ = static_cast<link_pointer>(end); + + return prev; + } + + // Break a ciruclar list into two, with split as the beginning + // of the second group (if split is at the beginning then don't + // split). + static node_pointer split_group(node_pointer split) + { + // Find first node in group. + node_pointer first = split; + while (static_cast<node_pointer>(first->group_prev_)->next_ == + static_cast<link_pointer>(first)) + first = static_cast<node_pointer>(first->group_prev_); + + if(first == split) return split; + + link_pointer last = first->group_prev_; + first->group_prev_ = split->group_prev_; + split->group_prev_ = last; + + return first; + } + + //////////////////////////////////////////////////////////////////////// + // fill_buckets + + template <class NodeCreator> + static void fill_buckets(iterator n, table& dst, + NodeCreator& creator) + { + previous_pointer prev = dst.get_previous_start(); + + while (n.node_) { + std::size_t key_hash = n.node_->hash_; + iterator group_end( + static_cast<node_pointer>( + static_cast<node_pointer>(n.node_->group_prev_)->next_ + )); + + node_pointer first_node = creator.create(*n); + node_pointer end = first_node; + first_node->hash_ = key_hash; + prev->next_ = static_cast<link_pointer>(first_node); + ++dst.size_; + + for (++n; n != group_end; ++n) + { + end = creator.create(*n); + end->hash_ = key_hash; + add_after_node(end, first_node); + ++dst.size_; + } + + prev = place_in_bucket(dst, prev, end); + } + } + + // strong otherwise exception safety + void rehash_impl(std::size_t num_buckets) + { + BOOST_ASSERT(this->buckets_); + + this->create_buckets(num_buckets); + previous_pointer prev = this->get_previous_start(); + while (prev->next_) + prev = place_in_bucket(*this, prev, + static_cast<node_pointer>( + static_cast<node_pointer>(prev->next_)->group_prev_)); + } + + // Iterate through the nodes placing them in the correct buckets. + // pre: prev->next_ is not null. + static previous_pointer place_in_bucket(table& dst, + previous_pointer prev, node_pointer end) + { + bucket_pointer b = dst.get_bucket(policy::to_bucket( + dst.bucket_count_, end->hash_)); + + if (!b->next_) { + b->next_ = static_cast<node_pointer>(prev); + return static_cast<previous_pointer>(end); + } + else { + link_pointer next = end->next_; + end->next_ = b->next_->next_; + b->next_->next_ = prev->next_; + prev->next_ = next; + return prev; + } + } + }; +}}} #endif diff --git a/3rdParty/Boost/src/boost/unordered/detail/extract_key.hpp b/3rdParty/Boost/src/boost/unordered/detail/extract_key.hpp index bedb175..56a8532 100644 --- a/3rdParty/Boost/src/boost/unordered/detail/extract_key.hpp +++ b/3rdParty/Boost/src/boost/unordered/detail/extract_key.hpp @@ -1,17 +1,16 @@ -// Copyright (C) 2005-2009 Daniel James +// Copyright (C) 2005-2011 Daniel James // 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_UNORDERED_DETAIL_EXTRACT_KEY_HPP_INCLUDED #define BOOST_UNORDERED_DETAIL_EXTRACT_KEY_HPP_INCLUDED -#include <boost/config.hpp> -#include <boost/type_traits/remove_const.hpp> -#include <boost/unordered/detail/fwd.hpp> +#include <boost/unordered/detail/table.hpp> namespace boost { -namespace unordered_detail { +namespace unordered { +namespace detail { // key extractors // @@ -28,6 +27,19 @@ namespace unordered_detail { template <class T> no_key(T const&) {} }; + template <typename Key, typename T> + struct is_key { + template <typename T2> + static choice1::type test(T2 const&); + static choice2::type test(Key const&); + + enum { value = sizeof(test(boost::unordered::detail::make<T>())) == + sizeof(choice2::type) }; + + typedef typename boost::detail::if_true<value>:: + BOOST_NESTED_TEMPLATE then<Key const&, no_key>::type type; + }; + template <class ValueType> struct set_extractor { @@ -44,13 +56,12 @@ namespace unordered_detail { return no_key(); } -#if defined(BOOST_UNORDERED_STD_FORWARD) +#if !defined(BOOST_NO_VARIADIC_TEMPLATES) template <class... Args> static no_key extract(Args const&...) { return no_key(); } - #else template <class Arg> static no_key extract(Arg const&) @@ -58,8 +69,8 @@ namespace unordered_detail { return no_key(); } - template <class Arg> - static no_key extract(Arg const&, Arg const&) + template <class Arg1, class Arg2> + static no_key extract(Arg1 const&, Arg2 const&) { return no_key(); } @@ -75,7 +86,7 @@ namespace unordered_detail { struct map_extractor { typedef ValueType value_type; - typedef BOOST_DEDUCED_TYPENAME boost::remove_const<Key>::type key_type; + typedef typename boost::remove_const<Key>::type key_type; static key_type const& extract(value_type const& v) { @@ -100,7 +111,7 @@ namespace unordered_detail { return v.first; } -#if defined(BOOST_UNORDERED_STD_FORWARD) +#if !defined(BOOST_NO_VARIADIC_TEMPLATES) template <class Arg1, class... Args> static key_type const& extract(key_type const& k, Arg1 const&, Args const&...) @@ -114,6 +125,7 @@ namespace unordered_detail { return no_key(); } #else + template <class Arg1> static key_type const& extract(key_type const& k, Arg1 const&) { @@ -138,11 +150,57 @@ namespace unordered_detail { } #endif +#if !defined(BOOST_NO_VARIADIC_TEMPLATES) + +#define BOOST_UNORDERED_KEY_FROM_TUPLE(namespace_) \ + template <typename T2> \ + static no_key extract(boost::unordered::piecewise_construct_t, \ + namespace_::tuple<> const&, BOOST_FWD_REF(T2)) \ + { \ + return no_key(); \ + } \ + \ + template <typename T, typename T2> \ + static typename is_key<key_type, T>::type \ + extract(boost::unordered::piecewise_construct_t, \ + namespace_::tuple<T> const& k, BOOST_FWD_REF(T2)) \ + { \ + return typename is_key<key_type, T>::type( \ + namespace_::get<0>(k)); \ + } + +#else + +#define BOOST_UNORDERED_KEY_FROM_TUPLE(namespace_) \ + static no_key extract(boost::unordered::piecewise_construct_t, \ + namespace_::tuple<> const&) \ + { \ + return no_key(); \ + } \ + \ + template <typename T> \ + static typename is_key<key_type, T>::type \ + extract(boost::unordered::piecewise_construct_t, \ + namespace_::tuple<T> const& k) \ + { \ + return typename is_key<key_type, T>::type( \ + namespace_::get<0>(k)); \ + } + +#endif + +BOOST_UNORDERED_KEY_FROM_TUPLE(boost) + +#if !defined(BOOST_NO_CXX11_HDR_TUPLE) +BOOST_UNORDERED_KEY_FROM_TUPLE(std) +#endif + + static bool compare_mapped(value_type const& x, value_type const& y) { return x.second == y.second; } }; -}} +}}} #endif diff --git a/3rdParty/Boost/src/boost/unordered/detail/fwd.hpp b/3rdParty/Boost/src/boost/unordered/detail/fwd.hpp index 471d1d2..ee8966b 100644 --- a/3rdParty/Boost/src/boost/unordered/detail/fwd.hpp +++ b/3rdParty/Boost/src/boost/unordered/detail/fwd.hpp @@ -1,932 +1,23 @@ -// Copyright (C) 2003-2004 Jeremy B. Maitin-Shepard. -// Copyright (C) 2005-2009 Daniel James +// Copyright (C) 2008-2011 Daniel James. // 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) -// This contains the basic data structure, apart from the actual values. There's -// no construction or deconstruction here. So this only depends on the pointer -// type. +#ifndef BOOST_UNORDERED_FWD_HPP_INCLUDED +#define BOOST_UNORDERED_FWD_HPP_INCLUDED -#ifndef BOOST_UNORDERED_DETAIL_FWD_HPP_INCLUDED -#define BOOST_UNORDERED_DETAIL_FWD_HPP_INCLUDED - -#include <boost/config.hpp> -#include <boost/iterator.hpp> -#include <boost/compressed_pair.hpp> -#include <boost/type_traits/aligned_storage.hpp> -#include <boost/type_traits/alignment_of.hpp> -#include <boost/unordered/detail/allocator_helpers.hpp> -#include <algorithm> - -// This header defines most of the classes used to implement the unordered -// containers. It doesn't include the insert methods as they require a lot -// of preprocessor metaprogramming - they are in unique.hpp and equivalent.hpp. - -// Template parameters: -// -// H = Hash Function -// P = Predicate -// A = Value Allocator -// G = Bucket group policy, 'grouped' or 'ungrouped' -// E = Key Extractor - -#if !defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_NO_VARIADIC_TEMPLATES) -# if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION) - // STLport doesn't have std::forward. -# else -# define BOOST_UNORDERED_STD_FORWARD -# endif -#endif - -#if !defined(BOOST_UNORDERED_EMPLACE_LIMIT) -#define BOOST_UNORDERED_EMPLACE_LIMIT 10 -#endif - -#if !defined(BOOST_UNORDERED_STD_FORWARD) - -#include <boost/preprocessor/repetition/enum_params.hpp> -#include <boost/preprocessor/repetition/enum_binary_params.hpp> -#include <boost/preprocessor/repetition/repeat_from_to.hpp> - -#define BOOST_UNORDERED_TEMPLATE_ARGS(z, num_params) \ - BOOST_PP_ENUM_PARAMS_Z(z, num_params, class Arg) -#define BOOST_UNORDERED_FUNCTION_PARAMS(z, num_params) \ - BOOST_PP_ENUM_BINARY_PARAMS_Z(z, num_params, Arg, const& arg) -#define BOOST_UNORDERED_CALL_PARAMS(z, num_params) \ - BOOST_PP_ENUM_PARAMS_Z(z, num_params, arg) - -#endif - -namespace boost { namespace unordered_detail { - - static const float minimum_max_load_factor = 1e-3f; - static const std::size_t default_bucket_count = 11; - struct move_tag {}; - - template <class T> class hash_unique_table; - template <class T> class hash_equivalent_table; - template <class Alloc, class Grouped> - class hash_node_constructor; - template <class ValueType> - struct set_extractor; - template <class Key, class ValueType> - struct map_extractor; - struct no_key; - - // Explicitly call a destructor - -#if defined(BOOST_MSVC) -#pragma warning(push) -#pragma warning(disable:4100) // unreferenced formal parameter -#endif - - template <class T> - inline void destroy(T* x) { - x->~T(); - } - -#if defined(BOOST_MSVC) -#pragma warning(pop) +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once #endif - //////////////////////////////////////////////////////////////////////////// - // - // This section implements buckets and nodes. Here's a rough - // inheritance diagram, to show how they pull together. - // - // For unordered_set/unordered_map: - // - // hash_bucket<A> - // | - // ungrouped_node_base<A> value_base<A::value_type> - // | | - // +--------------+-------------+ - // | - // hash_node<A, ungrouped> - // - // For unordered_multiset/unordered_multimap: - // - // hash_bucket<A> - // | - // grouped_node_base<A> value_base<A::value_type> - // | | - // +--------------+-------------+ - // | - // hash_node<A, grouped> - - // hash_bucket - // - // hash_bucket is used for both the buckets and as a base class for - // nodes. By using 'bucket_ptr' for 'node_ptr', 'next_' can point - // to either a bucket or a node. This is used later to implement a - // sentinel at the end of the bucket array. - - template <class A> - class hash_bucket - { - hash_bucket& operator=(hash_bucket const&); - public: - typedef hash_bucket<A> bucket; - typedef BOOST_DEDUCED_TYPENAME - boost::unordered_detail::rebind_wrap<A, bucket>::type - bucket_allocator; - typedef BOOST_DEDUCED_TYPENAME bucket_allocator::pointer bucket_ptr; - typedef bucket_ptr node_ptr; - - node_ptr next_; - - hash_bucket() : next_() {} - }; - - // In containers with equivalent keys (unordered_multimap and - // unordered_multiset) equivalent nodes are grouped together, in - // containers with unique keys (unordered_map and unordered_set) - // individual nodes are treated as groups of one. The following two - // classes implement the data structure. - - // This is used for containers with unique keys. There are no groups - // so it doesn't add any extra members, and just treats individual - // nodes as groups of one. - - template <class A> - struct ungrouped_node_base : hash_bucket<A> { - typedef hash_bucket<A> bucket; - typedef BOOST_DEDUCED_TYPENAME bucket::bucket_ptr bucket_ptr; - typedef BOOST_DEDUCED_TYPENAME bucket::node_ptr node_ptr; - - ungrouped_node_base() : bucket() {} - static inline node_ptr& next_group(node_ptr ptr); - static inline std::size_t group_count(node_ptr ptr); - static inline void add_to_bucket(node_ptr n, bucket& b); - static inline void add_after_node(node_ptr n, node_ptr position); - static void unlink_node(bucket& b, node_ptr n); - static void unlink_nodes(bucket& b, node_ptr begin, node_ptr end); - static void unlink_nodes(bucket& b, node_ptr end); - }; - - // This is used for containers with equivalent keys. It implements a - // circular list running in the opposite direction to the linked - // list through the nodes. - - template <class A> - struct grouped_node_base : hash_bucket<A> - { - typedef hash_bucket<A> bucket; - typedef BOOST_DEDUCED_TYPENAME bucket::bucket_ptr bucket_ptr; - typedef BOOST_DEDUCED_TYPENAME bucket::node_ptr node_ptr; - - node_ptr group_prev_; - - grouped_node_base() : bucket(), group_prev_() {} - static inline node_ptr& next_group(node_ptr ptr); - static inline node_ptr first_in_group(node_ptr n); - static inline std::size_t group_count(node_ptr ptr); - static inline void add_to_bucket(node_ptr n, bucket& b); - static inline void add_after_node(node_ptr n, node_ptr position); - static void unlink_node(bucket& b, node_ptr n); - static void unlink_nodes(bucket& b, node_ptr begin, node_ptr end); - static void unlink_nodes(bucket& b, node_ptr end); - - private: - static inline node_ptr split_group(node_ptr split); - static inline grouped_node_base& get(node_ptr ptr) { - return static_cast<grouped_node_base&>(*ptr); - } - }; - - // These two classes implement an easy way to pass around the node - // group policy classes without the messy template parameters. - // Whenever you see the template parameter 'G' it's one of these. - - struct ungrouped - { - template <class A> - struct base { - typedef ungrouped_node_base<A> type; - }; - }; - - struct grouped - { - template <class A> - struct base { - typedef grouped_node_base<A> type; - }; - }; - - // The space used to store values in a node. - - template <class ValueType> - struct value_base - { - typedef ValueType value_type; - BOOST_DEDUCED_TYPENAME boost::aligned_storage< - sizeof(value_type), - ::boost::alignment_of<value_type>::value>::type data_; - - void* address() { - return this; - } - value_type& value() { - return *(ValueType*) this; - } - value_type* value_ptr() { - return (ValueType*) this; - } - private: - value_base& operator=(value_base const&); - }; - - // Node - - template <class A, class G> - class hash_node : - public G::BOOST_NESTED_TEMPLATE base<A>::type, - public value_base<BOOST_DEDUCED_TYPENAME A::value_type> - { - public: - typedef BOOST_DEDUCED_TYPENAME A::value_type value_type; - typedef BOOST_DEDUCED_TYPENAME hash_bucket<A>::node_ptr node_ptr; - - static value_type& get_value(node_ptr p) { - return static_cast<hash_node&>(*p).value(); - } - static value_type* get_value_ptr(node_ptr p) { - return static_cast<hash_node&>(*p).value_ptr(); - } - private: - hash_node& operator=(hash_node const&); - }; - - //////////////////////////////////////////////////////////////////////////// - // - // Iterator Base - // - // This is the iterator used internally, the external iterators are - // provided by lightweight wrappers (hash_iterator and - // hast_const_iterator) which provide the full iterator interface. - - template <class A, class G> - class hash_iterator_base - { - public: - typedef A value_allocator; - typedef hash_bucket<A> bucket; - typedef hash_node<A, G> node; - typedef BOOST_DEDUCED_TYPENAME A::value_type value_type; - typedef BOOST_DEDUCED_TYPENAME bucket::bucket_ptr bucket_ptr; - typedef BOOST_DEDUCED_TYPENAME bucket::node_ptr node_ptr; - - bucket_ptr bucket_; - node_ptr node_; - - hash_iterator_base() : bucket_(), node_() {} - explicit hash_iterator_base(bucket_ptr b) - : bucket_(b), - node_(b ? b->next_ : node_ptr()) {} - hash_iterator_base(bucket_ptr b, node_ptr n) - : bucket_(b), - node_(n) {} - - bool operator==(hash_iterator_base const& x) const { - return node_ == x.node_; } - bool operator!=(hash_iterator_base const& x) const { - return node_ != x.node_; } - value_type& operator*() const { - return node::get_value(node_); - } - - void increment_bucket(node_ptr n) { - while(!n) { - ++bucket_; - n = bucket_->next_; - } - node_ = bucket_ == n ? node_ptr() : n; - } - - void increment() { - increment_bucket(node_->next_); - } - }; - - //////////////////////////////////////////////////////////////////////////// - // - // Now the main data structure: - // - // hash_buckets<A, G> hash_buffered_functions<H, P> - // | | - // +-------------+--------------+ - // | - // hash_table<T> - // - // T is a class which contains typedefs for all the types we need. - - // hash_buckets - // - // This is responsible for allocating and deallocating buckets and nodes. - // - // Notes: - // 1. For the sake exception safety the consturctors don't allocate - // anything. - // 2. It's the callers responsibility to allocate the buckets before calling - // any of the methods (other than getters and setters). - - template <class A, class G> - class hash_buckets - { - hash_buckets(hash_buckets const&); - hash_buckets& operator=(hash_buckets const&); - public: - // Types - - typedef A value_allocator; - typedef hash_bucket<A> bucket; - typedef hash_iterator_base<A, G> iterator_base; - typedef BOOST_DEDUCED_TYPENAME A::value_type value_type; - typedef BOOST_DEDUCED_TYPENAME iterator_base::node node; - - typedef BOOST_DEDUCED_TYPENAME bucket::bucket_allocator - bucket_allocator; - typedef BOOST_DEDUCED_TYPENAME bucket::bucket_ptr bucket_ptr; - typedef BOOST_DEDUCED_TYPENAME bucket::node_ptr node_ptr; - - typedef BOOST_DEDUCED_TYPENAME rebind_wrap<value_allocator, node>::type - node_allocator; - typedef BOOST_DEDUCED_TYPENAME node_allocator::pointer real_node_ptr; - - // Members - - bucket_ptr buckets_; - std::size_t bucket_count_; - boost::compressed_pair<bucket_allocator, node_allocator> allocators_; - - // Data access - - bucket_allocator const& bucket_alloc() const { - return allocators_.first(); } - node_allocator const& node_alloc() const { - return allocators_.second(); } - bucket_allocator& bucket_alloc() { - return allocators_.first(); } - node_allocator& node_alloc() { - return allocators_.second(); } - std::size_t max_bucket_count() const; - - // Constructors - - hash_buckets(node_allocator const& a, std::size_t n); - void create_buckets(); - ~hash_buckets(); - - // no throw - void swap(hash_buckets& other); - void move(hash_buckets& other); - - // For the remaining functions, buckets_ must not be null. - - bucket_ptr get_bucket(std::size_t n) const; - bucket_ptr bucket_ptr_from_hash(std::size_t hashed) const; - std::size_t bucket_size(std::size_t index) const; - node_ptr bucket_begin(std::size_t n) const; - - // Alloc/Dealloc - - void delete_node(node_ptr); - - // - void delete_buckets(); - void clear_bucket(bucket_ptr); - std::size_t delete_nodes(node_ptr begin, node_ptr end); - std::size_t delete_to_bucket_end(node_ptr begin); - }; - - // Assigning and swapping the equality and hash function objects - // needs strong exception safety. To implement that normally we'd - // require one of them to be known to not throw and the other to - // guarantee strong exception safety. Unfortunately they both only - // have basic exception safety. So to acheive strong exception - // safety we have storage space for two copies, and assign the new - // copies to the unused space. Then switch to using that to use - // them. This is implemented in 'set_hash_functions' which - // atomically assigns the new function objects in a strongly - // exception safe manner. - - template <class H, class P> class set_hash_functions; - - template <class H, class P> - class hash_buffered_functions - { - friend class set_hash_functions<H, P>; - hash_buffered_functions& operator=(hash_buffered_functions const&); - - typedef boost::compressed_pair<H, P> function_pair; - typedef BOOST_DEDUCED_TYPENAME boost::aligned_storage< - sizeof(function_pair), - ::boost::alignment_of<function_pair>::value>::type aligned_function; - - bool current_; // The currently active functions. - aligned_function funcs_[2]; - - function_pair const& current() const { - return *static_cast<function_pair const*>( - static_cast<void const*>(&funcs_[current_])); - } - - void construct(bool which, H const& hf, P const& eq) - { - new((void*) &funcs_[which]) function_pair(hf, eq); - } - - void construct(bool which, function_pair const& f) - { - new((void*) &funcs_[which]) function_pair(f); - } - - void destroy(bool which) - { - boost::unordered_detail::destroy((function_pair*)(&funcs_[which])); - } - - public: - - hash_buffered_functions(H const& hf, P const& eq) - : current_(false) - { - construct(current_, hf, eq); - } - - hash_buffered_functions(hash_buffered_functions const& bf) - : current_(false) - { - construct(current_, bf.current()); - } - - ~hash_buffered_functions() { - destroy(current_); - } - - H const& hash_function() const { - return current().first(); - } - - P const& key_eq() const { - return current().second(); - } - }; - - template <class H, class P> - class set_hash_functions - { - set_hash_functions(set_hash_functions const&); - set_hash_functions& operator=(set_hash_functions const&); - - typedef hash_buffered_functions<H, P> buffered_functions; - buffered_functions& buffered_functions_; - bool tmp_functions_; - - public: - - set_hash_functions(buffered_functions& f, H const& h, P const& p) - : buffered_functions_(f), - tmp_functions_(!f.current_) - { - f.construct(tmp_functions_, h, p); - } - - set_hash_functions(buffered_functions& f, - buffered_functions const& other) - : buffered_functions_(f), - tmp_functions_(!f.current_) - { - f.construct(tmp_functions_, other.current()); - } - - ~set_hash_functions() - { - buffered_functions_.destroy(tmp_functions_); - } - - void commit() - { - buffered_functions_.current_ = tmp_functions_; - tmp_functions_ = !tmp_functions_; - } - }; - - // This implements almost all of the required functionality, apart - // from some things that are specific to containers with unique and - // equivalent keys which is implemented in hash_unique_table and - // hash_equivalent_table. See unique.hpp and equivalent.hpp for - // their declaration and implementation. - - template <class T> - class hash_table : public T::buckets, public T::buffered_functions - { - hash_table(hash_table const&); - public: - typedef BOOST_DEDUCED_TYPENAME T::hasher hasher; - typedef BOOST_DEDUCED_TYPENAME T::key_equal key_equal; - typedef BOOST_DEDUCED_TYPENAME T::value_allocator value_allocator; - typedef BOOST_DEDUCED_TYPENAME T::key_type key_type; - typedef BOOST_DEDUCED_TYPENAME T::value_type value_type; - typedef BOOST_DEDUCED_TYPENAME T::buffered_functions base; - typedef BOOST_DEDUCED_TYPENAME T::buckets buckets; - typedef BOOST_DEDUCED_TYPENAME T::extractor extractor; - typedef BOOST_DEDUCED_TYPENAME T::node_constructor node_constructor; - - typedef BOOST_DEDUCED_TYPENAME T::node node; - typedef BOOST_DEDUCED_TYPENAME T::bucket bucket; - typedef BOOST_DEDUCED_TYPENAME T::node_ptr node_ptr; - typedef BOOST_DEDUCED_TYPENAME T::bucket_ptr bucket_ptr; - typedef BOOST_DEDUCED_TYPENAME T::iterator_base iterator_base; - typedef BOOST_DEDUCED_TYPENAME T::node_allocator node_allocator; - typedef BOOST_DEDUCED_TYPENAME T::iterator_pair iterator_pair; - - // Members - - std::size_t size_; - float mlf_; - // Cached data - invalid if !this->buckets_ - bucket_ptr cached_begin_bucket_; - std::size_t max_load_; - - // Helper methods - - key_type const& get_key(value_type const& v) const { - return extractor::extract(v); - } - key_type const& get_key_from_ptr(node_ptr n) const { - return extractor::extract(node::get_value(n)); - } - bool equal(key_type const& k, value_type const& v) const; - template <class Key, class Pred> - node_ptr find_iterator(bucket_ptr bucket, Key const& k, - Pred const&) const; - node_ptr find_iterator(bucket_ptr bucket, key_type const& k) const; - node_ptr find_iterator(key_type const& k) const; - node_ptr* find_for_erase(bucket_ptr bucket, key_type const& k) const; - - // Load methods - - std::size_t max_size() const; - std::size_t bucket_index(key_type const& k) const; - void max_load_factor(float z); - std::size_t min_buckets_for_size(std::size_t n) const; - std::size_t calculate_max_load(); - - // Constructors - - hash_table(std::size_t n, hasher const& hf, key_equal const& eq, - node_allocator const& a); - hash_table(hash_table const& x, node_allocator const& a); - hash_table(hash_table& x, move_tag m); - hash_table(hash_table& x, node_allocator const& a, move_tag m); - ~hash_table() {} - hash_table& operator=(hash_table const&); - - // Iterators - - iterator_base begin() const { - return this->size_ ? - iterator_base(this->cached_begin_bucket_) : - iterator_base(); - } - iterator_base end() const { - return iterator_base(); - } - - // Swap & Move - - void swap(hash_table& x); - void fast_swap(hash_table& other); - void slow_swap(hash_table& other); - void partial_swap(hash_table& other); - void move(hash_table& x); - - // Reserve and rehash - - void create_for_insert(std::size_t n); - bool reserve_for_insert(std::size_t n); - void rehash(std::size_t n); - void rehash_impl(std::size_t n); - - // Move/copy buckets - - void move_buckets_to(buckets& dst); - void copy_buckets_to(buckets& dst) const; - - // Misc. key methods - - std::size_t count(key_type const& k) const; - iterator_base find(key_type const& k) const; - template <class Key, class Hash, class Pred> - iterator_base find(Key const& k, Hash const& h, Pred const& eq) const; - value_type& at(key_type const& k) const; - iterator_pair equal_range(key_type const& k) const; - - // Erase - // - // no throw - - void clear(); - std::size_t erase_key(key_type const& k); - iterator_base erase_return_iterator(iterator_base r); - void erase(iterator_base r); - std::size_t erase_group(node_ptr* it, bucket_ptr bucket); - iterator_base erase_range(iterator_base r1, iterator_base r2); - - // recompute_begin_bucket - - void init_buckets(); - - // After an erase cached_begin_bucket_ might be left pointing to - // an empty bucket, so this is called to update it - // - // no throw - - void recompute_begin_bucket(bucket_ptr b); - - // This is called when a range has been erased - // - // no throw - - void recompute_begin_bucket(bucket_ptr b1, bucket_ptr b2); - - // no throw - float load_factor() const; - - iterator_base emplace_empty_impl_with_node( - node_constructor&, std::size_t); - }; - - /////////////////////////////////////////////////////////////////// - // - // Iterators - - // iterator_access is used to access the internal iterator without - // making it publicly available. - - class iterator_access - { - public: - template <class Iterator> - static BOOST_DEDUCED_TYPENAME Iterator::base const& - get(Iterator const& it) - { - return it.base_; - } - }; - - template <class A, class G> class hash_iterator; - template <class A, class G> class hash_const_iterator; - template <class A, class G> class hash_local_iterator; - template <class A, class G> class hash_const_local_iterator; - - // Local Iterators - // - // all no throw - - template <class A, class G> - class hash_local_iterator - : public boost::iterator < - std::forward_iterator_tag, - BOOST_DEDUCED_TYPENAME A::value_type, - std::ptrdiff_t, - BOOST_DEDUCED_TYPENAME A::pointer, - BOOST_DEDUCED_TYPENAME A::reference> - { - public: - typedef BOOST_DEDUCED_TYPENAME A::value_type value_type; - - private: - typedef hash_buckets<A, G> buckets; - typedef BOOST_DEDUCED_TYPENAME buckets::node_ptr node_ptr; - typedef BOOST_DEDUCED_TYPENAME buckets::node node; - typedef hash_const_local_iterator<A, G> const_local_iterator; - - friend class hash_const_local_iterator<A, G>; - node_ptr ptr_; - - public: - hash_local_iterator() : ptr_() {} - explicit hash_local_iterator(node_ptr x) : ptr_(x) {} - BOOST_DEDUCED_TYPENAME A::reference operator*() const { - return node::get_value(ptr_); - } - value_type* operator->() const { - return node::get_value_ptr(ptr_); - } - hash_local_iterator& operator++() { - ptr_ = ptr_->next_; return *this; - } - hash_local_iterator operator++(int) { - hash_local_iterator tmp(ptr_); ptr_ = ptr_->next_; return tmp; } - bool operator==(hash_local_iterator x) const { - return ptr_ == x.ptr_; - } - bool operator==(const_local_iterator x) const { - return ptr_ == x.ptr_; - } - bool operator!=(hash_local_iterator x) const { - return ptr_ != x.ptr_; - } - bool operator!=(const_local_iterator x) const { - return ptr_ != x.ptr_; - } - }; - - template <class A, class G> - class hash_const_local_iterator - : public boost::iterator < - std::forward_iterator_tag, - BOOST_DEDUCED_TYPENAME A::value_type, - std::ptrdiff_t, - BOOST_DEDUCED_TYPENAME A::const_pointer, - BOOST_DEDUCED_TYPENAME A::const_reference > - { - public: - typedef BOOST_DEDUCED_TYPENAME A::value_type value_type; - - private: - typedef hash_buckets<A, G> buckets; - typedef BOOST_DEDUCED_TYPENAME buckets::node_ptr ptr; - typedef BOOST_DEDUCED_TYPENAME buckets::node node; - typedef hash_local_iterator<A, G> local_iterator; - friend class hash_local_iterator<A, G>; - ptr ptr_; - - public: - hash_const_local_iterator() : ptr_() {} - explicit hash_const_local_iterator(ptr x) : ptr_(x) {} - hash_const_local_iterator(local_iterator x) : ptr_(x.ptr_) {} - BOOST_DEDUCED_TYPENAME A::const_reference - operator*() const { - return node::get_value(ptr_); - } - value_type const* operator->() const { - return node::get_value_ptr(ptr_); - } - hash_const_local_iterator& operator++() { - ptr_ = ptr_->next_; return *this; - } - hash_const_local_iterator operator++(int) { - hash_const_local_iterator tmp(ptr_); ptr_ = ptr_->next_; return tmp; - } - bool operator==(local_iterator x) const { - return ptr_ == x.ptr_; - } - bool operator==(hash_const_local_iterator x) const { - return ptr_ == x.ptr_; - } - bool operator!=(local_iterator x) const { - return ptr_ != x.ptr_; - } - bool operator!=(hash_const_local_iterator x) const { - return ptr_ != x.ptr_; - } - }; - - // Iterators - // - // all no throw - - - template <class A, class G> - class hash_iterator - : public boost::iterator < - std::forward_iterator_tag, - BOOST_DEDUCED_TYPENAME A::value_type, - std::ptrdiff_t, - BOOST_DEDUCED_TYPENAME A::pointer, - BOOST_DEDUCED_TYPENAME A::reference > - { - public: - typedef BOOST_DEDUCED_TYPENAME A::value_type value_type; - - private: - typedef hash_buckets<A, G> buckets; - typedef BOOST_DEDUCED_TYPENAME buckets::node node; - typedef BOOST_DEDUCED_TYPENAME buckets::iterator_base base; - typedef hash_const_iterator<A, G> const_iterator; - friend class hash_const_iterator<A, G>; - base base_; - - public: - - hash_iterator() : base_() {} - explicit hash_iterator(base const& x) : base_(x) {} - BOOST_DEDUCED_TYPENAME A::reference operator*() const { - return *base_; - } - value_type* operator->() const { - return &*base_; - } - hash_iterator& operator++() { - base_.increment(); return *this; - } - hash_iterator operator++(int) { - hash_iterator tmp(base_); base_.increment(); return tmp; - } - bool operator==(hash_iterator const& x) const { - return base_ == x.base_; - } - bool operator==(const_iterator const& x) const { - return base_ == x.base_; - } - bool operator!=(hash_iterator const& x) const { - return base_ != x.base_; - } - bool operator!=(const_iterator const& x) const { - return base_ != x.base_; - } - }; - - template <class A, class G> - class hash_const_iterator - : public boost::iterator < - std::forward_iterator_tag, - BOOST_DEDUCED_TYPENAME A::value_type, - std::ptrdiff_t, - BOOST_DEDUCED_TYPENAME A::const_pointer, - BOOST_DEDUCED_TYPENAME A::const_reference > - { - public: - typedef BOOST_DEDUCED_TYPENAME A::value_type value_type; - - private: - typedef hash_buckets<A, G> buckets; - typedef BOOST_DEDUCED_TYPENAME buckets::node node; - typedef BOOST_DEDUCED_TYPENAME buckets::iterator_base base; - typedef hash_iterator<A, G> iterator; - friend class hash_iterator<A, G>; - friend class iterator_access; - base base_; - - public: - - hash_const_iterator() : base_() {} - explicit hash_const_iterator(base const& x) : base_(x) {} - hash_const_iterator(iterator const& x) : base_(x.base_) {} - BOOST_DEDUCED_TYPENAME A::const_reference operator*() const { - return *base_; - } - value_type const* operator->() const { - return &*base_; - } - hash_const_iterator& operator++() { - base_.increment(); return *this; - } - hash_const_iterator operator++(int) { - hash_const_iterator tmp(base_); base_.increment(); return tmp; - } - bool operator==(iterator const& x) const { - return base_ == x.base_; - } - bool operator==(hash_const_iterator const& x) const { - return base_ == x.base_; - } - bool operator!=(iterator const& x) const { - return base_ != x.base_; - } - bool operator!=(hash_const_iterator const& x) const { - return base_ != x.base_; - } - }; - - //////////////////////////////////////////////////////////////////////////// - // - // types - // - // This is used to convieniently pass around a container's typedefs - // without having 7 template parameters. - - template <class K, class V, class H, class P, class A, class E, class G> - struct types - { - public: - typedef K key_type; - typedef V value_type; - typedef H hasher; - typedef P key_equal; - typedef A value_allocator; - typedef E extractor; - typedef G group_type; - - typedef hash_node_constructor<value_allocator, group_type> - node_constructor; - typedef hash_buckets<value_allocator, group_type> buckets; - typedef hash_buffered_functions<hasher, key_equal> buffered_functions; - - typedef BOOST_DEDUCED_TYPENAME buckets::node node; - typedef BOOST_DEDUCED_TYPENAME buckets::bucket bucket; - typedef BOOST_DEDUCED_TYPENAME buckets::node_ptr node_ptr; - typedef BOOST_DEDUCED_TYPENAME buckets::bucket_ptr bucket_ptr; - typedef BOOST_DEDUCED_TYPENAME buckets::iterator_base iterator_base; - typedef BOOST_DEDUCED_TYPENAME buckets::node_allocator node_allocator; - typedef std::pair<iterator_base, iterator_base> iterator_pair; - }; -}} +namespace boost +{ +namespace unordered +{ + struct piecewise_construct_t {}; + const piecewise_construct_t piecewise_construct = piecewise_construct_t(); +} +} #endif diff --git a/3rdParty/Boost/src/boost/unordered/detail/move.hpp b/3rdParty/Boost/src/boost/unordered/detail/move.hpp deleted file mode 100644 index 16fd921..0000000 --- a/3rdParty/Boost/src/boost/unordered/detail/move.hpp +++ /dev/null @@ -1,243 +0,0 @@ -/* - Copyright 2005-2007 Adobe Systems Incorporated - - 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). -*/ - -/*************************************************************************************************/ - -#ifndef BOOST_UNORDERED_DETAIL_MOVE_HEADER -#define BOOST_UNORDERED_DETAIL_MOVE_HEADER - -#include <boost/config.hpp> -#include <boost/mpl/bool.hpp> -#include <boost/mpl/and.hpp> -#include <boost/mpl/or.hpp> -#include <boost/mpl/not.hpp> -#include <boost/type_traits/is_convertible.hpp> -#include <boost/type_traits/is_same.hpp> -#include <boost/type_traits/is_class.hpp> -#include <boost/utility/enable_if.hpp> -#include <boost/detail/workaround.hpp> - -/*************************************************************************************************/ - -#if defined(BOOST_NO_SFINAE) -# define BOOST_UNORDERED_NO_HAS_MOVE_ASSIGN -#elif defined(__GNUC__) && \ - (__GNUC__ < 3 || __GNUC__ == 3 && __GNUC_MINOR__ <= 3) -# define BOOST_UNORDERED_NO_HAS_MOVE_ASSIGN -#elif BOOST_WORKAROUND(BOOST_INTEL, < 900) || \ - BOOST_WORKAROUND(__EDG_VERSION__, < 304) || \ - BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x0593)) -# define BOOST_UNORDERED_NO_HAS_MOVE_ASSIGN -#endif - -/*************************************************************************************************/ - -namespace boost { -namespace unordered_detail { - -/*************************************************************************************************/ - -namespace move_detail { - -/*************************************************************************************************/ - -#if !defined(BOOST_UNORDERED_NO_HAS_MOVE_ASSIGN) - -/*************************************************************************************************/ - -template <typename T> -struct class_has_move_assign { - class type { - typedef T& (T::*E)(T t); - typedef char (&no_type)[1]; - typedef char (&yes_type)[2]; - template <E e> struct sfinae { typedef yes_type type; }; - template <class U> - static typename sfinae<&U::operator=>::type test(int); - template <class U> - static no_type test(...); - public: - enum {value = sizeof(test<T>(1)) == sizeof(yes_type)}; - }; - }; - -/*************************************************************************************************/ - -template<typename T> -struct has_move_assign : boost::mpl::and_<boost::is_class<T>, class_has_move_assign<T> > {}; - -/*************************************************************************************************/ - -class test_can_convert_anything { }; - -/*************************************************************************************************/ - -#endif // BOOST_UNORDERED_NO_HAS_MOVE_ASSIGN - -/*************************************************************************************************/ - -/* - REVISIT (sparent@adobe.com): This is a work around for Boost 1.34.1 and VC++ 2008 where - boost::is_convertible<T, T> fails to compile. -*/ - -template <typename T, typename U> -struct is_convertible : boost::mpl::or_< - boost::is_same<T, U>, - boost::is_convertible<T, U> -> { }; - -/*************************************************************************************************/ - -} //namespace move_detail - - -/*************************************************************************************************/ - -/*! -\ingroup move_related -\brief move_from is used for move_ctors. -*/ - -template <typename T> -struct move_from -{ - explicit move_from(T& x) : source(x) { } - T& source; -private: - move_from& operator=(move_from const&); -}; - -/*************************************************************************************************/ - -#if !defined(BOOST_UNORDERED_NO_HAS_MOVE_ASSIGN) - -/*************************************************************************************************/ - -/*! -\ingroup move_related -\brief The is_movable trait can be used to identify movable types. -*/ -template <typename T> -struct is_movable : boost::mpl::and_< - boost::is_convertible<move_from<T>, T>, - move_detail::has_move_assign<T>, - boost::mpl::not_<boost::is_convertible<move_detail::test_can_convert_anything, T> > - > { }; - -/*************************************************************************************************/ - -#else // BOOST_UNORDERED_NO_HAS_MOVE_ASSIGN - -// On compilers which don't have adequate SFINAE support, treat most types as unmovable, -// unless the trait is specialized. - -template <typename T> -struct is_movable : boost::mpl::false_ { }; - -#endif - -/*************************************************************************************************/ - -#if !defined(BOOST_NO_SFINAE) - -/*************************************************************************************************/ - -/*! -\ingroup move_related -\brief copy_sink and move_sink are used to select between overloaded operations according to - whether type T is movable and convertible to type U. -\sa move -*/ - -template <typename T, - typename U = T, - typename R = void*> -struct copy_sink : boost::enable_if< - boost::mpl::and_< - boost::unordered_detail::move_detail::is_convertible<T, U>, - boost::mpl::not_<is_movable<T> > - >, - R - > -{ }; - -/*************************************************************************************************/ - -/*! -\ingroup move_related -\brief move_sink and copy_sink are used to select between overloaded operations according to - whether type T is movable and convertible to type U. - \sa move -*/ - -template <typename T, - typename U = T, - typename R = void*> -struct move_sink : boost::enable_if< - boost::mpl::and_< - boost::unordered_detail::move_detail::is_convertible<T, U>, - is_movable<T> - >, - R - > -{ }; - -/*************************************************************************************************/ - -/*! -\ingroup move_related -\brief This version of move is selected when T is_movable . It in turn calls the move -constructor. This call, with the help of the return value optimization, will cause x to be moved -instead of copied to its destination. See adobe/test/move/main.cpp for examples. - -*/ -template <typename T> -T move(T& x, typename move_sink<T>::type = 0) { return T(move_from<T>(x)); } - -/*************************************************************************************************/ - -/*! -\ingroup move_related -\brief This version of move is selected when T is not movable . The net result will be that -x gets copied. -*/ -template <typename T> -T& move(T& x, typename copy_sink<T>::type = 0) { return x; } - -/*************************************************************************************************/ - -#else // BOOST_NO_SFINAE - -// On compilers without SFINAE, define copy_sink to always use the copy function. - -template <typename T, - typename U = T, - typename R = void*> -struct copy_sink -{ - typedef R type; -}; - -// Always copy the element unless this is overloaded. - -template <typename T> -T& move(T& x) { - return x; -} - -#endif // BOOST_NO_SFINAE - -} // namespace unordered_detail -} // namespace boost - -/*************************************************************************************************/ - -#endif - -/*************************************************************************************************/ diff --git a/3rdParty/Boost/src/boost/unordered/detail/node.hpp b/3rdParty/Boost/src/boost/unordered/detail/node.hpp deleted file mode 100644 index 85a3141..0000000 --- a/3rdParty/Boost/src/boost/unordered/detail/node.hpp +++ /dev/null @@ -1,226 +0,0 @@ - -// Copyright (C) 2003-2004 Jeremy B. Maitin-Shepard. -// Copyright (C) 2005-2009 Daniel James -// 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) - -// This contains the basic data structure, apart from the actual values. There's -// no construction or deconstruction here. So this only depends on the pointer -// type. - -#ifndef BOOST_UNORDERED_DETAIL_NODE_HPP_INCLUDED -#define BOOST_UNORDERED_DETAIL_NODE_HPP_INCLUDED - -#include <boost/config.hpp> -#include <boost/assert.hpp> -#include <boost/detail/workaround.hpp> -#include <boost/unordered/detail/fwd.hpp> - -#if BOOST_WORKAROUND(__BORLANDC__, <= 0X0582) -#define BOOST_UNORDERED_BORLAND_BOOL(x) (bool)(x) -#else -#define BOOST_UNORDERED_BORLAND_BOOL(x) x -#endif - -namespace boost { namespace unordered_detail { - - //////////////////////////////////////////////////////////////////////////// - // ungrouped node implementation - - template <class A> - inline BOOST_DEDUCED_TYPENAME ungrouped_node_base<A>::node_ptr& - ungrouped_node_base<A>::next_group(node_ptr ptr) - { - return ptr->next_; - } - - template <class A> - inline std::size_t ungrouped_node_base<A>::group_count(node_ptr) - { - return 1; - } - - template <class A> - inline void ungrouped_node_base<A>::add_to_bucket(node_ptr n, bucket& b) - { - n->next_ = b.next_; - b.next_ = n; - } - - template <class A> - inline void ungrouped_node_base<A>::add_after_node(node_ptr n, - node_ptr position) - { - n->next_ = position->next_; - position->next_ = position; - } - - template <class A> - inline void ungrouped_node_base<A>::unlink_nodes(bucket& b, - node_ptr begin, node_ptr end) - { - node_ptr* pos = &b.next_; - while(*pos != begin) pos = &(*pos)->next_; - *pos = end; - } - - template <class A> - inline void ungrouped_node_base<A>::unlink_nodes(bucket& b, node_ptr end) - { - b.next_ = end; - } - - template <class A> - inline void ungrouped_node_base<A>::unlink_node(bucket& b, node_ptr n) - { - unlink_nodes(b, n, n->next_); - } - - //////////////////////////////////////////////////////////////////////////// - // grouped node implementation - - // If ptr is the first element in a group, return pointer to next group. - // Otherwise returns a pointer to ptr. - template <class A> - inline BOOST_DEDUCED_TYPENAME grouped_node_base<A>::node_ptr& - grouped_node_base<A>::next_group(node_ptr ptr) - { - return get(ptr).group_prev_->next_; - } - - template <class A> - inline BOOST_DEDUCED_TYPENAME grouped_node_base<A>::node_ptr - grouped_node_base<A>::first_in_group(node_ptr ptr) - { - while(next_group(ptr) == ptr) - ptr = get(ptr).group_prev_; - return ptr; - } - - template <class A> - inline std::size_t grouped_node_base<A>::group_count(node_ptr ptr) - { - node_ptr start = ptr; - std::size_t size = 0; - do { - ++size; - ptr = get(ptr).group_prev_; - } while(ptr != start); - return size; - } - - template <class A> - inline void grouped_node_base<A>::add_to_bucket(node_ptr n, bucket& b) - { - n->next_ = b.next_; - get(n).group_prev_ = n; - b.next_ = n; - } - - template <class A> - inline void grouped_node_base<A>::add_after_node(node_ptr n, node_ptr pos) - { - n->next_ = next_group(pos); - get(n).group_prev_ = get(pos).group_prev_; - next_group(pos) = n; - get(pos).group_prev_ = n; - } - - // Break a ciruclar list into two, with split as the beginning - // of the second group (if split is at the beginning then don't - // split). - template <class A> - inline BOOST_DEDUCED_TYPENAME grouped_node_base<A>::node_ptr - grouped_node_base<A>::split_group(node_ptr split) - { - node_ptr first = first_in_group(split); - if(first == split) return split; - - node_ptr last = get(first).group_prev_; - get(first).group_prev_ = get(split).group_prev_; - get(split).group_prev_ = last; - - return first; - } - - template <class A> - void grouped_node_base<A>::unlink_node(bucket& b, node_ptr n) - { - node_ptr next = n->next_; - node_ptr* pos = &next_group(n); - - if(*pos != n) { - // The node is at the beginning of a group. - - // Find the previous node pointer: - pos = &b.next_; - while(*pos != n) pos = &next_group(*pos); - - // Remove from group - if(BOOST_UNORDERED_BORLAND_BOOL(next) && - get(next).group_prev_ == n) - { - get(next).group_prev_ = get(n).group_prev_; - } - } - else if(BOOST_UNORDERED_BORLAND_BOOL(next) && - get(next).group_prev_ == n) - { - // The deleted node is not at the end of the group, so - // change the link from the next node. - get(next).group_prev_ = get(n).group_prev_; - } - else { - // The deleted node is at the end of the group, so the - // first node in the group is pointing to it. - // Find that to change its pointer. - node_ptr x = get(n).group_prev_; - while(get(x).group_prev_ != n) { - x = get(x).group_prev_; - } - get(x).group_prev_ = get(n).group_prev_; - } - *pos = next; - } - - template <class A> - void grouped_node_base<A>::unlink_nodes(bucket& b, - node_ptr begin, node_ptr end) - { - node_ptr* pos = &next_group(begin); - - if(*pos != begin) { - // The node is at the beginning of a group. - - // Find the previous node pointer: - pos = &b.next_; - while(*pos != begin) pos = &next_group(*pos); - - // Remove from group - if(BOOST_UNORDERED_BORLAND_BOOL(end)) split_group(end); - } - else { - node_ptr group1 = split_group(begin); - if(BOOST_UNORDERED_BORLAND_BOOL(end)) { - node_ptr group2 = split_group(end); - - if(begin == group2) { - node_ptr end1 = get(group1).group_prev_; - node_ptr end2 = get(group2).group_prev_; - get(group1).group_prev_ = end2; - get(group2).group_prev_ = end1; - } - } - } - *pos = end; - } - - template <class A> - void grouped_node_base<A>::unlink_nodes(bucket& b, node_ptr end) - { - split_group(end); - b.next_ = end; - } -}} - -#endif diff --git a/3rdParty/Boost/src/boost/unordered/detail/table.hpp b/3rdParty/Boost/src/boost/unordered/detail/table.hpp index d37c015..af376fe 100644 --- a/3rdParty/Boost/src/boost/unordered/detail/table.hpp +++ b/3rdParty/Boost/src/boost/unordered/detail/table.hpp @@ -1,778 +1,907 @@ // Copyright (C) 2003-2004 Jeremy B. Maitin-Shepard. -// Copyright (C) 2005-2009 Daniel James +// Copyright (C) 2005-2011 Daniel James // 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_UNORDERED_DETAIL_ALL_HPP_INCLUDED #define BOOST_UNORDERED_DETAIL_ALL_HPP_INCLUDED -#include <cstddef> -#include <stdexcept> -#include <algorithm> -#include <boost/config/no_tr1/cmath.hpp> -#include <boost/iterator/iterator_categories.hpp> -#include <boost/throw_exception.hpp> - #include <boost/unordered/detail/buckets.hpp> +#include <boost/unordered/detail/util.hpp> +#include <boost/type_traits/aligned_storage.hpp> +#include <boost/type_traits/alignment_of.hpp> +#include <cmath> + +#if defined(BOOST_MSVC) +#pragma warning(push) +#pragma warning(disable:4127) // conditional expression is constant +#endif -namespace boost { namespace unordered_detail { +namespace boost { namespace unordered { namespace detail { //////////////////////////////////////////////////////////////////////////// - // Helper methods + // convert double to std::size_t - // strong exception safety, no side effects - template <class T> - inline bool hash_table<T>::equal( - key_type const& k, value_type const& v) const + inline std::size_t double_to_size(double f) { - return this->key_eq()(k, get_key(v)); + return f >= static_cast<double>( + (std::numeric_limits<std::size_t>::max)()) ? + (std::numeric_limits<std::size_t>::max)() : + static_cast<std::size_t>(f); } - // strong exception safety, no side effects - template <class T> - template <class Key, class Pred> - inline BOOST_DEDUCED_TYPENAME T::node_ptr - hash_table<T>::find_iterator(bucket_ptr bucket, Key const& k, - Pred const& eq) const + // The space used to store values in a node. + + template <typename ValueType> + struct value_base { - node_ptr it = bucket->next_; - while (BOOST_UNORDERED_BORLAND_BOOL(it) && - !eq(k, get_key(node::get_value(it)))) - { - it = node::next_group(it); + typedef ValueType value_type; + + typename boost::aligned_storage< + sizeof(value_type), + boost::alignment_of<value_type>::value>::type data_; + + void* address() { + return this; } - return it; - } + value_type& value() { + return *(ValueType*) this; + } - // strong exception safety, no side effects - template <class T> - inline BOOST_DEDUCED_TYPENAME T::node_ptr - hash_table<T>::find_iterator( - bucket_ptr bucket, key_type const& k) const - { - node_ptr it = bucket->next_; - while (BOOST_UNORDERED_BORLAND_BOOL(it) && - !equal(k, node::get_value(it))) - { - it = node::next_group(it); + value_type* value_ptr() { + return (ValueType*) this; } - return it; - } + private: - // strong exception safety, no side effects - // pre: this->buckets_ - template <class T> - inline BOOST_DEDUCED_TYPENAME T::node_ptr - hash_table<T>::find_iterator(key_type const& k) const - { - return find_iterator(this->get_bucket(this->bucket_index(k)), k); - } + value_base& operator=(value_base const&); + }; - // strong exception safety, no side effects - template <class T> - inline BOOST_DEDUCED_TYPENAME T::node_ptr* - hash_table<T>::find_for_erase( - bucket_ptr bucket, key_type const& k) const + template <typename NodeAlloc> + struct copy_nodes { - node_ptr* it = &bucket->next_; - while(BOOST_UNORDERED_BORLAND_BOOL(*it) && - !equal(k, node::get_value(*it))) + typedef boost::unordered::detail::allocator_traits<NodeAlloc> + node_allocator_traits; + + node_constructor<NodeAlloc> constructor; + + explicit copy_nodes(NodeAlloc& a) : constructor(a) {} + + typename node_allocator_traits::pointer create( + typename node_allocator_traits::value_type::value_type const& v) { - it = &node::next_group(*it); + constructor.construct_with_value2(v); + return constructor.release(); } + }; - return it; - } + template <typename NodeAlloc> + struct move_nodes + { + typedef boost::unordered::detail::allocator_traits<NodeAlloc> + node_allocator_traits; - //////////////////////////////////////////////////////////////////////////// - // Load methods + node_constructor<NodeAlloc> constructor; - // no throw - template <class T> - std::size_t hash_table<T>::max_size() const - { - using namespace std; + explicit move_nodes(NodeAlloc& a) : constructor(a) {} - // size < mlf_ * count - return double_to_size_t(ceil( - (double) this->mlf_ * this->max_bucket_count())) - 1; - } + typename node_allocator_traits::pointer create( + typename node_allocator_traits::value_type::value_type& v) + { + constructor.construct_with_value2(boost::move(v)); + return constructor.release(); + } + }; - // strong safety - template <class T> - inline std::size_t hash_table<T>::bucket_index( - key_type const& k) const + template <typename Buckets> + struct assign_nodes { - // hash_function can throw: - return this->hash_function()(k) % this->bucket_count_; - } + node_holder<typename Buckets::node_allocator> holder; + explicit assign_nodes(Buckets& b) : holder(b) {} - // no throw - template <class T> - inline std::size_t hash_table<T>::calculate_max_load() + typename Buckets::node_pointer create( + typename Buckets::value_type const& v) + { + return holder.copy_of(v); + } + }; + + template <typename Buckets> + struct move_assign_nodes { - using namespace std; + node_holder<typename Buckets::node_allocator> holder; - // From 6.3.1/13: - // Only resize when size >= mlf_ * count - return double_to_size_t(ceil((double) mlf_ * this->bucket_count_)); - } + explicit move_assign_nodes(Buckets& b) : holder(b) {} - template <class T> - void hash_table<T>::max_load_factor(float z) - { - BOOST_ASSERT(z > 0); - mlf_ = (std::max)(z, minimum_max_load_factor); - this->max_load_ = this->calculate_max_load(); - } + typename Buckets::node_pointer create( + typename Buckets::value_type& v) + { + return holder.move_copy_of(v); + } + }; + + template <typename Types> + struct table : + Types::policy, + boost::unordered::detail::functions< + typename Types::hasher, + typename Types::key_equal> + { + private: + table(table const&); + table& operator=(table const&); + public: + typedef typename Types::node node; + typedef typename Types::bucket bucket; + typedef typename Types::hasher hasher; + typedef typename Types::key_equal key_equal; + typedef typename Types::key_type key_type; + typedef typename Types::extractor extractor; + typedef typename Types::value_type value_type; + typedef typename Types::table table_impl; + typedef typename Types::link_pointer link_pointer; + typedef typename Types::policy policy; + + typedef boost::unordered::detail::functions< + typename Types::hasher, + typename Types::key_equal> functions; + + typedef typename Types::allocator allocator; + typedef typename boost::unordered::detail:: + rebind_wrap<allocator, node>::type node_allocator; + typedef typename boost::unordered::detail:: + rebind_wrap<allocator, bucket>::type bucket_allocator; + typedef boost::unordered::detail::allocator_traits<node_allocator> + node_allocator_traits; + typedef boost::unordered::detail::allocator_traits<bucket_allocator> + bucket_allocator_traits; + typedef typename node_allocator_traits::pointer + node_pointer; + typedef typename node_allocator_traits::const_pointer + const_node_pointer; + typedef typename bucket_allocator_traits::pointer + bucket_pointer; + typedef typename bucket::previous_pointer + previous_pointer; + typedef boost::unordered::detail::node_constructor<node_allocator> + node_constructor; + + typedef boost::unordered::iterator_detail:: + iterator<node_pointer, value_type> iterator; + typedef boost::unordered::iterator_detail:: + c_iterator<const_node_pointer, node_pointer, value_type> c_iterator; + typedef boost::unordered::iterator_detail:: + l_iterator<node_pointer, value_type, policy> l_iterator; + typedef boost::unordered::iterator_detail:: + cl_iterator<const_node_pointer, node_pointer, value_type, policy> + cl_iterator; + + //////////////////////////////////////////////////////////////////////// + // Members + + boost::unordered::detail::compressed<bucket_allocator, node_allocator> + allocators_; + std::size_t bucket_count_; + std::size_t size_; + float mlf_; + std::size_t max_load_; + bucket_pointer buckets_; + + //////////////////////////////////////////////////////////////////////// + // Data access + + bucket_allocator const& bucket_alloc() const + { + return allocators_.first(); + } - // no throw - template <class T> - inline std::size_t hash_table<T>::min_buckets_for_size( - std::size_t size) const - { - BOOST_ASSERT(this->mlf_ != 0); + node_allocator const& node_alloc() const + { + return allocators_.second(); + } - using namespace std; + bucket_allocator& bucket_alloc() + { + return allocators_.first(); + } - // From 6.3.1/13: - // size < mlf_ * count - // => count > size / mlf_ - // - // Or from rehash post-condition: - // count > size / mlf_ - return next_prime(double_to_size_t(floor(size / (double) mlf_)) + 1); - } + node_allocator& node_alloc() + { + return allocators_.second(); + } - //////////////////////////////////////////////////////////////////////////// - // recompute_begin_bucket + std::size_t max_bucket_count() const + { + // -1 to account for the start bucket. + return policy::prev_bucket_count( + bucket_allocator_traits::max_size(bucket_alloc()) - 1); + } - // init_buckets + bucket_pointer get_bucket(std::size_t bucket_index) const + { + BOOST_ASSERT(buckets_); + return buckets_ + static_cast<std::ptrdiff_t>(bucket_index); + } - template <class T> - inline void hash_table<T>::init_buckets() - { - if (this->size_) { - this->cached_begin_bucket_ = this->buckets_; - while (!this->cached_begin_bucket_->next_) - ++this->cached_begin_bucket_; - } else { - this->cached_begin_bucket_ = this->get_bucket(this->bucket_count_); - } - this->max_load_ = calculate_max_load(); - } + previous_pointer get_previous_start() const + { + return get_bucket(bucket_count_)->first_from_start(); + } - // After an erase cached_begin_bucket_ might be left pointing to - // an empty bucket, so this is called to update it - // - // no throw + previous_pointer get_previous_start(std::size_t bucket_index) const + { + return get_bucket(bucket_index)->next_; + } - template <class T> - inline void hash_table<T>::recompute_begin_bucket(bucket_ptr b) - { - BOOST_ASSERT(!(b < this->cached_begin_bucket_)); + iterator begin() const + { + return size_ ? iterator(static_cast<node_pointer>( + get_previous_start()->next_)) : iterator(); + } - if(b == this->cached_begin_bucket_) + iterator begin(std::size_t bucket_index) const { - if (this->size_ != 0) { - while (!this->cached_begin_bucket_->next_) - ++this->cached_begin_bucket_; - } else { - this->cached_begin_bucket_ = - this->get_bucket(this->bucket_count_); - } + if (!size_) return iterator(); + previous_pointer prev = get_previous_start(bucket_index); + return prev ? iterator(static_cast<node_pointer>(prev->next_)) : + iterator(); } - } - // This is called when a range has been erased - // - // no throw + float load_factor() const + { + BOOST_ASSERT(bucket_count_ != 0); + return static_cast<float>(size_) + / static_cast<float>(bucket_count_); + } - template <class T> - inline void hash_table<T>::recompute_begin_bucket( - bucket_ptr b1, bucket_ptr b2) - { - BOOST_ASSERT(!(b1 < this->cached_begin_bucket_) && !(b2 < b1)); - BOOST_ASSERT(BOOST_UNORDERED_BORLAND_BOOL(b2->next_)); + std::size_t bucket_size(std::size_t index) const + { + iterator it = begin(index); + if (!it.node_) return 0; + + std::size_t count = 0; + while(it.node_ && policy::to_bucket( + bucket_count_, it.node_->hash_) == index) + { + ++count; + ++it; + } - if(b1 == this->cached_begin_bucket_ && !b1->next_) - this->cached_begin_bucket_ = b2; - } + return count; + } - // no throw - template <class T> - inline float hash_table<T>::load_factor() const - { - BOOST_ASSERT(this->bucket_count_ != 0); - return static_cast<float>(this->size_) - / static_cast<float>(this->bucket_count_); - } + //////////////////////////////////////////////////////////////////////// + // Load methods - //////////////////////////////////////////////////////////////////////////// - // Constructors - - template <class T> - hash_table<T>::hash_table(std::size_t num_buckets, - hasher const& hf, key_equal const& eq, node_allocator const& a) - : buckets(a, next_prime(num_buckets)), - base(hf, eq), - size_(), - mlf_(1.0f), - cached_begin_bucket_(), - max_load_(0) - { - } + std::size_t max_size() const + { + using namespace std; + + // size < mlf_ * count + return boost::unordered::detail::double_to_size(ceil( + static_cast<double>(mlf_) * + static_cast<double>(max_bucket_count()) + )) - 1; + } + + void recalculate_max_load() + { + using namespace std; + + // From 6.3.1/13: + // Only resize when size >= mlf_ * count + max_load_ = buckets_ ? boost::unordered::detail::double_to_size(ceil( + static_cast<double>(mlf_) * + static_cast<double>(bucket_count_) + )) : 0; - // Copy Construct with allocator - - template <class T> - hash_table<T>::hash_table(hash_table const& x, - node_allocator const& a) - : buckets(a, x.min_buckets_for_size(x.size_)), - base(x), - size_(x.size_), - mlf_(x.mlf_), - cached_begin_bucket_(), - max_load_(0) - { - if(x.size_) { - x.copy_buckets_to(*this); - this->init_buckets(); } - } - // Move Construct + void max_load_factor(float z) + { + BOOST_ASSERT(z > 0); + mlf_ = (std::max)(z, minimum_max_load_factor); + recalculate_max_load(); + } - template <class T> - hash_table<T>::hash_table(hash_table& x, move_tag) - : buckets(x.node_alloc(), x.bucket_count_), - base(x), - size_(0), - mlf_(1.0f), - cached_begin_bucket_(), - max_load_(0) - { - this->partial_swap(x); - } + std::size_t min_buckets_for_size(std::size_t size) const + { + BOOST_ASSERT(mlf_ >= minimum_max_load_factor); + + using namespace std; + + // From 6.3.1/13: + // size < mlf_ * count + // => count > size / mlf_ + // + // Or from rehash post-condition: + // count > size / mlf_ + + return policy::new_bucket_count( + boost::unordered::detail::double_to_size(floor( + static_cast<double>(size) / + static_cast<double>(mlf_))) + 1); + } - template <class T> - hash_table<T>::hash_table(hash_table& x, - node_allocator const& a, move_tag) - : buckets(a, x.bucket_count_), - base(x), - size_(0), - mlf_(x.mlf_), - cached_begin_bucket_(), - max_load_(0) - { - if(a == x.node_alloc()) { - this->partial_swap(x); + //////////////////////////////////////////////////////////////////////// + // Constructors + + table(std::size_t num_buckets, + hasher const& hf, + key_equal const& eq, + node_allocator const& a) : + functions(hf, eq), + allocators_(a,a), + bucket_count_(policy::new_bucket_count(num_buckets)), + size_(0), + mlf_(1.0f), + max_load_(0), + buckets_() + {} + + table(table const& x, node_allocator const& a) : + functions(x), + allocators_(a,a), + bucket_count_(x.min_buckets_for_size(x.size_)), + size_(0), + mlf_(x.mlf_), + max_load_(0), + buckets_() + {} + + table(table& x, boost::unordered::detail::move_tag m) : + functions(x), + allocators_(x.allocators_, m), + bucket_count_(x.bucket_count_), + size_(x.size_), + mlf_(x.mlf_), + max_load_(x.max_load_), + buckets_(x.buckets_) + { + x.buckets_ = bucket_pointer(); + x.size_ = 0; + x.max_load_ = 0; } - else if(x.size_) { - x.copy_buckets_to(*this); - this->size_ = x.size_; - this->init_buckets(); + + table(table& x, node_allocator const& a, + boost::unordered::detail::move_tag) : + functions(x), + allocators_(a, a), + bucket_count_(x.bucket_count_), + size_(0), + mlf_(x.mlf_), + max_load_(x.max_load_), + buckets_() + {} + + //////////////////////////////////////////////////////////////////////// + // Initialisation. + + void init(table const& x) + { + if (x.size_) { + create_buckets(bucket_count_); + copy_nodes<node_allocator> copy(node_alloc()); + table_impl::fill_buckets(x.begin(), *this, copy); + } } - } - template <class T> - hash_table<T>& hash_table<T>::operator=( - hash_table const& x) - { - hash_table tmp(x, this->node_alloc()); - this->fast_swap(tmp); - return *this; - } + void move_init(table& x) + { + if(node_alloc() == x.node_alloc()) { + move_buckets_from(x); + } + else if(x.size_) { + // TODO: Could pick new bucket size? + create_buckets(bucket_count_); - //////////////////////////////////////////////////////////////////////////// - // Swap & Move + move_nodes<node_allocator> move(node_alloc()); + node_holder<node_allocator> nodes(x); + table_impl::fill_buckets(nodes.begin(), *this, move); + } + } + + //////////////////////////////////////////////////////////////////////// + // Create buckets + + void create_buckets(std::size_t new_count) + { + boost::unordered::detail::array_constructor<bucket_allocator> + constructor(bucket_alloc()); - // Swap - // - // Strong exception safety - // - // Can throw if hash or predicate object's copy constructor throws - // or if allocators are unequal. - - template <class T> - inline void hash_table<T>::partial_swap(hash_table& x) - { - this->buckets::swap(x); // No throw - std::swap(this->size_, x.size_); - std::swap(this->mlf_, x.mlf_); - std::swap(this->cached_begin_bucket_, x.cached_begin_bucket_); - std::swap(this->max_load_, x.max_load_); - } + // Creates an extra bucket to act as the start node. + constructor.construct(bucket(), new_count + 1); + + if (buckets_) + { + // Copy the nodes to the new buckets, including the dummy + // node if there is one. + (constructor.get() + + static_cast<std::ptrdiff_t>(new_count))->next_ = + (buckets_ + static_cast<std::ptrdiff_t>( + bucket_count_))->next_; + destroy_buckets(); + } + else if (bucket::extra_node) + { + node_constructor a(node_alloc()); + a.construct(); + + (constructor.get() + + static_cast<std::ptrdiff_t>(new_count))->next_ = + a.release(); + } - template <class T> - inline void hash_table<T>::fast_swap(hash_table& x) - { - // These can throw, but they only affect the function objects - // that aren't in use so it is strongly exception safe, via. - // double buffering. + bucket_count_ = new_count; + buckets_ = constructor.release(); + recalculate_max_load(); + } + + //////////////////////////////////////////////////////////////////////// + // Swap and Move + + void swap_allocators(table& other, false_type) { - set_hash_functions<hasher, key_equal> op1(*this, x); - set_hash_functions<hasher, key_equal> op2(x, *this); - op1.commit(); - op2.commit(); + // According to 23.2.1.8, if propagate_on_container_swap is + // false the behaviour is undefined unless the allocators + // are equal. + BOOST_ASSERT(node_alloc() == other.node_alloc()); } - this->buckets::swap(x); // No throw - std::swap(this->size_, x.size_); - std::swap(this->mlf_, x.mlf_); - std::swap(this->cached_begin_bucket_, x.cached_begin_bucket_); - std::swap(this->max_load_, x.max_load_); - } - template <class T> - inline void hash_table<T>::slow_swap(hash_table& x) - { - if(this == &x) return; + void swap_allocators(table& other, true_type) + { + allocators_.swap(other.allocators_); + } + // Only swaps the allocators if propagate_on_container_swap + void swap(table& x) { - // These can throw, but they only affect the function objects - // that aren't in use so it is strongly exception safe, via. - // double buffering. - set_hash_functions<hasher, key_equal> op1(*this, x); - set_hash_functions<hasher, key_equal> op2(x, *this); - - // Create new buckets in separate hash_buckets objects - // which will clean up if anything throws an exception. - // (all can throw, but with no effect as these are new objects). - - buckets b1(this->node_alloc(), x.min_buckets_for_size(x.size_)); - if(x.size_) x.copy_buckets_to(b1); - - buckets b2(x.node_alloc(), this->min_buckets_for_size(this->size_)); - if(this->size_) copy_buckets_to(b2); - - // Modifying the data, so no throw from now on. - - b1.swap(*this); - b2.swap(x); + boost::unordered::detail::set_hash_functions<hasher, key_equal> + op1(*this, x); + boost::unordered::detail::set_hash_functions<hasher, key_equal> + op2(x, *this); + + // I think swap can throw if Propagate::value, + // since the allocators' swap can throw. Not sure though. + swap_allocators(x, + boost::unordered::detail::integral_constant<bool, + allocator_traits<node_allocator>:: + propagate_on_container_swap::value>()); + + boost::swap(buckets_, x.buckets_); + boost::swap(bucket_count_, x.bucket_count_); + boost::swap(size_, x.size_); + std::swap(mlf_, x.mlf_); + std::swap(max_load_, x.max_load_); op1.commit(); op2.commit(); } - - std::swap(this->size_, x.size_); - if(this->buckets_) this->init_buckets(); - if(x.buckets_) x.init_buckets(); - } - - template <class T> - void hash_table<T>::swap(hash_table& x) - { - if(this->node_alloc() == x.node_alloc()) { - if(this != &x) this->fast_swap(x); + void move_buckets_from(table& other) + { + BOOST_ASSERT(node_alloc() == other.node_alloc()); + BOOST_ASSERT(!buckets_); + buckets_ = other.buckets_; + bucket_count_ = other.bucket_count_; + size_ = other.size_; + other.buckets_ = bucket_pointer(); + other.size_ = 0; + other.max_load_ = 0; } - else { - this->slow_swap(x); + + //////////////////////////////////////////////////////////////////////// + // Delete/destruct + + ~table() + { + delete_buckets(); } - } - - // Move - // - // Strong exception safety (might change unused function objects) - // - // Can throw if hash or predicate object's copy constructor throws - // or if allocators are unequal. - - template <class T> - void hash_table<T>::move(hash_table& x) - { - // This can throw, but it only affects the function objects - // that aren't in use so it is strongly exception safe, via. - // double buffering. - set_hash_functions<hasher, key_equal> new_func_this(*this, x); - - if(this->node_alloc() == x.node_alloc()) { - this->buckets::move(x); // no throw - this->size_ = x.size_; - this->cached_begin_bucket_ = x.cached_begin_bucket_; - this->max_load_ = x.max_load_; - x.size_ = 0; + void delete_node(c_iterator n) + { + boost::unordered::detail::destroy_value_impl(node_alloc(), + n.node_->value_ptr()); + node_allocator_traits::destroy(node_alloc(), + boost::addressof(*n.node_)); + node_allocator_traits::deallocate(node_alloc(), n.node_, 1); + --size_; } - else { - // Create new buckets in separate HASH_TABLE_DATA objects - // which will clean up if anything throws an exception. - // (all can throw, but with no effect as these are new objects). - - buckets b(this->node_alloc(), x.min_buckets_for_size(x.size_)); - if(x.size_) x.copy_buckets_to(b); - - // Start updating the data here, no throw from now on. - this->size_ = x.size_; - b.swap(*this); - this->init_buckets(); - } - - // We've made it, the rest is no throw. - this->mlf_ = x.mlf_; - new_func_this.commit(); - } - - //////////////////////////////////////////////////////////////////////////// - // Reserve & Rehash - // basic exception safety - template <class T> - inline void hash_table<T>::create_for_insert(std::size_t size) - { - this->bucket_count_ = (std::max)(this->bucket_count_, - this->min_buckets_for_size(size)); - this->create_buckets(); - this->init_buckets(); - } + std::size_t delete_nodes(c_iterator begin, c_iterator end) + { + std::size_t count = 0; - // basic exception safety - template <class T> - inline bool hash_table<T>::reserve_for_insert(std::size_t size) - { - if(size >= max_load_) { - std::size_t num_buckets - = this->min_buckets_for_size((std::max)(size, - this->size_ + (this->size_ >> 1))); - if(num_buckets != this->bucket_count_) { - rehash_impl(num_buckets); - return true; + while(begin != end) { + c_iterator n = begin; + ++begin; + delete_node(n); + ++count; } + + return count; } - - return false; - } - // if hash function throws, basic exception safety - // strong otherwise. + void delete_buckets() + { + if(buckets_) { + delete_nodes(begin(), iterator()); + + if (bucket::extra_node) { + node_pointer n = static_cast<node_pointer>( + get_bucket(bucket_count_)->next_); + node_allocator_traits::destroy(node_alloc(), + boost::addressof(*n)); + node_allocator_traits::deallocate(node_alloc(), n, 1); + } - template <class T> - inline void hash_table<T>::rehash(std::size_t min_buckets) - { - using namespace std; + destroy_buckets(); + buckets_ = bucket_pointer(); + max_load_ = 0; + } - if(!this->size_) { - if(this->buckets_) this->delete_buckets(); - this->bucket_count_ = next_prime(min_buckets); + BOOST_ASSERT(!size_); } - else { - // no throw: - min_buckets = next_prime((std::max)(min_buckets, - double_to_size_t(floor(this->size_ / (double) mlf_)) + 1)); - if(min_buckets != this->bucket_count_) rehash_impl(min_buckets); + + void clear() + { + if(!size_) return; + + delete_nodes(begin(), iterator()); + get_previous_start()->next_ = link_pointer(); + clear_buckets(); + + BOOST_ASSERT(!size_); } - } - // if hash function throws, basic exception safety - // strong otherwise - - template <class T> - void hash_table<T> - ::rehash_impl(std::size_t num_buckets) - { - hasher const& hf = this->hash_function(); - std::size_t size = this->size_; - bucket_ptr end = this->get_bucket(this->bucket_count_); - - buckets dst(this->node_alloc(), num_buckets); - dst.create_buckets(); - - buckets src(this->node_alloc(), this->bucket_count_); - src.swap(*this); - this->size_ = 0; - - for(bucket_ptr bucket = this->cached_begin_bucket_; - bucket != end; ++bucket) - { - node_ptr group = bucket->next_; - while(group) { - // Move the first group of equivalent nodes in bucket to dst. - - // This next line throws iff the hash function throws. - bucket_ptr dst_bucket = dst.bucket_ptr_from_hash( - hf(get_key_from_ptr(group))); - - node_ptr& next_group = node::next_group(group); - bucket->next_ = next_group; - next_group = dst_bucket->next_; - dst_bucket->next_ = group; - group = bucket->next_; + void clear_buckets() + { + bucket_pointer end = get_bucket(bucket_count_); + for(bucket_pointer it = buckets_; it != end; ++it) + { + it->next_ = node_pointer(); } } - // Swap the new nodes back into the container and setup the local - // variables. - this->size_ = size; - dst.swap(*this); // no throw - this->init_buckets(); - } + void destroy_buckets() + { + bucket_pointer end = get_bucket(bucket_count_ + 1); + for(bucket_pointer it = buckets_; it != end; ++it) + { + bucket_allocator_traits::destroy(bucket_alloc(), + boost::addressof(*it)); + } - //////////////////////////////////////////////////////////////////////////// - // copy_buckets_to + bucket_allocator_traits::deallocate(bucket_alloc(), + buckets_, bucket_count_ + 1); + } - // copy_buckets_to - // - // basic excpetion safety. If an exception is thrown this will - // leave dst partially filled. + //////////////////////////////////////////////////////////////////////// + // Fix buckets after erase - template <class T> - void hash_table<T> - ::copy_buckets_to(buckets& dst) const - { - BOOST_ASSERT(this->buckets_ && !dst.buckets_); + // This is called after erasing a node or group of nodes to fix up + // the bucket pointers. + void fix_buckets(bucket_pointer this_bucket, + previous_pointer prev, node_pointer next) + { + if (!next) + { + if (this_bucket->next_ == prev) + this_bucket->next_ = node_pointer(); + } + else + { + bucket_pointer next_bucket = get_bucket( + policy::to_bucket(bucket_count_, next->hash_)); + + if (next_bucket != this_bucket) + { + next_bucket->next_ = prev; + if (this_bucket->next_ == prev) + this_bucket->next_ = node_pointer(); + } + } + } - hasher const& hf = this->hash_function(); - bucket_ptr end = this->get_bucket(this->bucket_count_); + // This is called after erasing a range of nodes to fix any bucket + // pointers into that range. + void fix_buckets_range(std::size_t bucket_index, + previous_pointer prev, node_pointer begin, node_pointer end) + { + node_pointer n = begin; + + // If we're not at the start of the current bucket, then + // go to the start of the next bucket. + if (get_bucket(bucket_index)->next_ != prev) + { + for(;;) { + n = static_cast<node_pointer>(n->next_); + if (n == end) { + if (n) { + std::size_t new_bucket_index = + policy::to_bucket(bucket_count_, n->hash_); + if (bucket_index != new_bucket_index) { + get_bucket(new_bucket_index)->next_ = prev; + } + } + return; + } + + std::size_t new_bucket_index = + policy::to_bucket(bucket_count_, n->hash_); + if (bucket_index != new_bucket_index) { + bucket_index = new_bucket_index; + break; + } + } + } - node_constructor a(dst); - dst.create_buckets(); + // Iterate through the remaining nodes, clearing out the bucket + // pointers. + get_bucket(bucket_index)->next_ = previous_pointer(); + for(;;) { + n = static_cast<node_pointer>(n->next_); + if (n == end) break; + + std::size_t new_bucket_index = + policy::to_bucket(bucket_count_, n->hash_); + if (bucket_index != new_bucket_index) { + bucket_index = new_bucket_index; + get_bucket(bucket_index)->next_ = previous_pointer(); + } + }; - // no throw: - for(bucket_ptr i = this->cached_begin_bucket_; i != end; ++i) { - // no throw: - for(node_ptr it = i->next_; it;) { - // hash function can throw. - bucket_ptr dst_bucket = dst.bucket_ptr_from_hash( - hf(get_key_from_ptr(it))); - // throws, strong + // Finally fix the bucket containing the trailing node. + if (n) { + get_bucket( + policy::to_bucket(bucket_count_, n->hash_))->next_ + = prev; + } + } - node_ptr group_end = node::next_group(it); + //////////////////////////////////////////////////////////////////////// + // Assignment - a.construct(node::get_value(it)); - node_ptr n = a.release(); - node::add_to_bucket(n, *dst_bucket); - - for(it = it->next_; it != group_end; it = it->next_) { - a.construct(node::get_value(it)); - node::add_after_node(a.release(), n); - } + void assign(table const& x) + { + if (this != boost::addressof(x)) + { + assign(x, + boost::unordered::detail::integral_constant<bool, + allocator_traits<node_allocator>:: + propagate_on_container_copy_assignment::value>()); } } - } - //////////////////////////////////////////////////////////////////////////// - // Misc. key methods + void assign(table const& x, false_type) + { + // Strong exception safety. + boost::unordered::detail::set_hash_functions<hasher, key_equal> + new_func_this(*this, x); + new_func_this.commit(); + mlf_ = x.mlf_; + recalculate_max_load(); - // strong exception safety + if (!size_ && !x.size_) return; - // count - // - // strong exception safety, no side effects + if (x.size_ >= max_load_) { + create_buckets(min_buckets_for_size(x.size_)); + } + else { + clear_buckets(); + } - template <class T> - std::size_t hash_table<T>::count(key_type const& k) const - { - if(!this->size_) return 0; - node_ptr it = find_iterator(k); // throws, strong - return BOOST_UNORDERED_BORLAND_BOOL(it) ? node::group_count(it) : 0; - } + // assign_nodes takes ownership of the container's elements, + // assigning to them if possible, and deleting any that are + // left over. + assign_nodes<table> assign(*this); + table_impl::fill_buckets(x.begin(), *this, assign); + } - // find - // - // strong exception safety, no side effects - template <class T> - BOOST_DEDUCED_TYPENAME T::iterator_base - hash_table<T>::find(key_type const& k) const - { - if(!this->size_) return this->end(); + void assign(table const& x, true_type) + { + if (node_alloc() == x.node_alloc()) { + allocators_.assign(x.allocators_); + assign(x, false_type()); + } + else { + boost::unordered::detail::set_hash_functions<hasher, key_equal> + new_func_this(*this, x); + + // Delete everything with current allocators before assigning + // the new ones. + delete_buckets(); + allocators_.assign(x.allocators_); + + // Copy over other data, all no throw. + new_func_this.commit(); + mlf_ = x.mlf_; + bucket_count_ = min_buckets_for_size(x.size_); + max_load_ = 0; + + // Finally copy the elements. + if (x.size_) { + create_buckets(bucket_count_); + copy_nodes<node_allocator> copy(node_alloc()); + table_impl::fill_buckets(x.begin(), *this, copy); + } + } + } - bucket_ptr bucket = this->get_bucket(this->bucket_index(k)); - node_ptr it = find_iterator(bucket, k); + void move_assign(table& x) + { + if (this != boost::addressof(x)) + { + move_assign(x, + boost::unordered::detail::integral_constant<bool, + allocator_traits<node_allocator>:: + propagate_on_container_move_assignment::value>()); + } + } - if (BOOST_UNORDERED_BORLAND_BOOL(it)) - return iterator_base(bucket, it); - else - return this->end(); - } + void move_assign(table& x, true_type) + { + delete_buckets(); + allocators_.move_assign(x.allocators_); + move_assign_no_alloc(x); + } - template <class T> - template <class Key, class Hash, class Pred> - BOOST_DEDUCED_TYPENAME T::iterator_base hash_table<T>::find(Key const& k, - Hash const& h, Pred const& eq) const - { - if(!this->size_) return this->end(); + void move_assign(table& x, false_type) + { + if (node_alloc() == x.node_alloc()) { + delete_buckets(); + move_assign_no_alloc(x); + } + else { + boost::unordered::detail::set_hash_functions<hasher, key_equal> + new_func_this(*this, x); + new_func_this.commit(); + mlf_ = x.mlf_; + recalculate_max_load(); - bucket_ptr bucket = this->get_bucket(h(k) % this->bucket_count_); - node_ptr it = find_iterator(bucket, k, eq); + if (!size_ && !x.size_) return; - if (BOOST_UNORDERED_BORLAND_BOOL(it)) - return iterator_base(bucket, it); - else - return this->end(); - } + if (x.size_ >= max_load_) { + create_buckets(min_buckets_for_size(x.size_)); + } + else { + clear_buckets(); + } - template <class T> - BOOST_DEDUCED_TYPENAME T::value_type& - hash_table<T>::at(key_type const& k) const - { - if(!this->size_) - boost::throw_exception(std::out_of_range("Unable to find key in unordered_map.")); + // move_assign_nodes takes ownership of the container's + // elements, assigning to them if possible, and deleting + // any that are left over. + move_assign_nodes<table> assign(*this); + node_holder<node_allocator> nodes(x); + table_impl::fill_buckets(nodes.begin(), *this, assign); + } + } + + void move_assign_no_alloc(table& x) + { + boost::unordered::detail::set_hash_functions<hasher, key_equal> + new_func_this(*this, x); + // No throw from here. + mlf_ = x.mlf_; + max_load_ = x.max_load_; + move_buckets_from(x); + new_func_this.commit(); + } - bucket_ptr bucket = this->get_bucket(this->bucket_index(k)); - node_ptr it = find_iterator(bucket, k); + // Accessors - if (!it) - boost::throw_exception(std::out_of_range("Unable to find key in unordered_map.")); + key_type const& get_key(value_type const& x) const + { + return extractor::extract(x); + } - return node::get_value(it); - } + std::size_t hash(key_type const& k) const + { + return policy::apply_hash(this->hash_function(), k); + } - // equal_range - // - // strong exception safety, no side effects - template <class T> - BOOST_DEDUCED_TYPENAME T::iterator_pair - hash_table<T>::equal_range(key_type const& k) const - { - if(!this->size_) - return iterator_pair(this->end(), this->end()); + // Find Node - bucket_ptr bucket = this->get_bucket(this->bucket_index(k)); - node_ptr it = find_iterator(bucket, k); - if (BOOST_UNORDERED_BORLAND_BOOL(it)) { - iterator_base first(iterator_base(bucket, it)); - iterator_base second(first); - second.increment_bucket(node::next_group(second.node_)); - return iterator_pair(first, second); - } - else { - return iterator_pair(this->end(), this->end()); + template <typename Key, typename Hash, typename Pred> + iterator generic_find_node( + Key const& k, + Hash const& hf, + Pred const& eq) const + { + return static_cast<table_impl const*>(this)-> + find_node_impl(policy::apply_hash(hf, k), k, eq); } - } - - //////////////////////////////////////////////////////////////////////////// - // Erase methods - - template <class T> - void hash_table<T>::clear() - { - if(!this->size_) return; - bucket_ptr end = this->get_bucket(this->bucket_count_); - for(bucket_ptr begin = this->buckets_; begin != end; ++begin) { - this->clear_bucket(begin); + iterator find_node( + std::size_t key_hash, + key_type const& k) const + { + return static_cast<table_impl const*>(this)-> + find_node_impl(key_hash, k, this->key_eq()); } - this->size_ = 0; - this->cached_begin_bucket_ = end; - } + iterator find_node(key_type const& k) const + { + return static_cast<table_impl const*>(this)-> + find_node_impl(hash(k), k, this->key_eq()); + } - template <class T> - inline std::size_t hash_table<T>::erase_group( - node_ptr* it, bucket_ptr bucket) - { - node_ptr pos = *it; - node_ptr end = node::next_group(pos); - *it = end; - std::size_t count = this->delete_nodes(pos, end); - this->size_ -= count; - this->recompute_begin_bucket(bucket); - return count; - } - - template <class T> - std::size_t hash_table<T>::erase_key(key_type const& k) - { - if(!this->size_) return 0; + iterator find_matching_node(iterator n) const + { + // TODO: Does this apply to C++11? + // + // For some stupid reason, I decided to support equality comparison + // when different hash functions are used. So I can't use the hash + // value from the node here. - // No side effects in initial section - bucket_ptr bucket = this->get_bucket(this->bucket_index(k)); - node_ptr* it = this->find_for_erase(bucket, k); + return find_node(get_key(*n)); + } - // No throw. - return *it ? this->erase_group(it, bucket) : 0; - } + // Reserve and rehash - template <class T> - void hash_table<T>::erase(iterator_base r) - { - BOOST_ASSERT(r.node_); - --this->size_; - node::unlink_node(*r.bucket_, r.node_); - this->delete_node(r.node_); - // r has been invalidated but its bucket is still valid - this->recompute_begin_bucket(r.bucket_); - } + void reserve_for_insert(std::size_t); + void rehash(std::size_t); + void reserve(std::size_t); + }; - template <class T> - BOOST_DEDUCED_TYPENAME T::iterator_base - hash_table<T>::erase_return_iterator(iterator_base r) - { - BOOST_ASSERT(r.node_); - iterator_base next = r; - next.increment(); - --this->size_; - node::unlink_node(*r.bucket_, r.node_); - this->delete_node(r.node_); - // r has been invalidated but its bucket is still valid - this->recompute_begin_bucket(r.bucket_, next.bucket_); - return next; - } + //////////////////////////////////////////////////////////////////////////// + // Reserve & Rehash - template <class T> - BOOST_DEDUCED_TYPENAME T::iterator_base - hash_table<T>::erase_range( - iterator_base r1, iterator_base r2) + // basic exception safety + template <typename Types> + inline void table<Types>::reserve_for_insert(std::size_t size) { - if(r1 != r2) - { - BOOST_ASSERT(r1.node_); - if (r1.bucket_ == r2.bucket_) { - node::unlink_nodes(*r1.bucket_, r1.node_, r2.node_); - this->size_ -= this->delete_nodes(r1.node_, r2.node_); + if (!buckets_) { + create_buckets((std::max)(bucket_count_, + min_buckets_for_size(size))); + } + // According to the standard this should be 'size >= max_load_', + // but I think this is better, defect report filed. + else if(size > max_load_) { + std::size_t num_buckets + = min_buckets_for_size((std::max)(size, + size_ + (size_ >> 1))); - // No need to call recompute_begin_bucket because - // the nodes are only deleted from one bucket, which - // still contains r2 after the erase. - BOOST_ASSERT(r1.bucket_->next_); - } - else { - bucket_ptr end_bucket = r2.node_ ? - r2.bucket_ : this->get_bucket(this->bucket_count_); - BOOST_ASSERT(r1.bucket_ < end_bucket); - node::unlink_nodes(*r1.bucket_, r1.node_, node_ptr()); - this->size_ -= this->delete_nodes(r1.node_, node_ptr()); - - bucket_ptr i = r1.bucket_; - for(++i; i != end_bucket; ++i) { - this->size_ -= this->delete_nodes(i->next_, node_ptr()); - i->next_ = node_ptr(); - } + if (num_buckets != bucket_count_) + static_cast<table_impl*>(this)->rehash_impl(num_buckets); + } + } - if(r2.node_) { - node_ptr first = r2.bucket_->next_; - node::unlink_nodes(*r2.bucket_, r2.node_); - this->size_ -= this->delete_nodes(first, r2.node_); - } + // if hash function throws, basic exception safety + // strong otherwise. - // r1 has been invalidated but its bucket is still - // valid. - this->recompute_begin_bucket(r1.bucket_, end_bucket); - } + template <typename Types> + inline void table<Types>::rehash(std::size_t min_buckets) + { + using namespace std; + + if(!size_) { + delete_buckets(); + bucket_count_ = policy::new_bucket_count(min_buckets); } + else { + min_buckets = policy::new_bucket_count((std::max)(min_buckets, + boost::unordered::detail::double_to_size(floor( + static_cast<double>(size_) / + static_cast<double>(mlf_))) + 1)); - return r2; + if(min_buckets != bucket_count_) + static_cast<table_impl*>(this)->rehash_impl(min_buckets); + } } - template <class T> - BOOST_DEDUCED_TYPENAME hash_table<T>::iterator_base - hash_table<T>::emplace_empty_impl_with_node( - node_constructor& a, std::size_t size) + template <typename Types> + inline void table<Types>::reserve(std::size_t num_elements) { - key_type const& k = get_key(a.value()); - std::size_t hash_value = this->hash_function()(k); - if(this->buckets_) this->reserve_for_insert(size); - else this->create_for_insert(size); - bucket_ptr bucket = this->bucket_ptr_from_hash(hash_value); - node_ptr n = a.release(); - node::add_to_bucket(n, *bucket); - ++this->size_; - this->cached_begin_bucket_ = bucket; - return iterator_base(bucket, n); + rehash(static_cast<std::size_t>( + std::ceil(static_cast<double>(num_elements) / mlf_))); } -}} +}}} + +#if defined(BOOST_MSVC) +#pragma warning(pop) +#endif #endif diff --git a/3rdParty/Boost/src/boost/unordered/detail/unique.hpp b/3rdParty/Boost/src/boost/unordered/detail/unique.hpp index 96fdfee..8805652 100644 --- a/3rdParty/Boost/src/boost/unordered/detail/unique.hpp +++ b/3rdParty/Boost/src/boost/unordered/detail/unique.hpp @@ -1,513 +1,651 @@ // Copyright (C) 2003-2004 Jeremy B. Maitin-Shepard. -// Copyright (C) 2005-2010 Daniel James +// Copyright (C) 2005-2011 Daniel James // 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_UNORDERED_DETAIL_UNIQUE_HPP_INCLUDED #define BOOST_UNORDERED_DETAIL_UNIQUE_HPP_INCLUDED +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + #include <boost/unordered/detail/table.hpp> #include <boost/unordered/detail/extract_key.hpp> +#include <boost/throw_exception.hpp> +#include <stdexcept> + +namespace boost { namespace unordered { namespace detail { -namespace boost { namespace unordered_detail { + template <typename A, typename T> struct unique_node; + template <typename T> struct ptr_node; + template <typename Types> struct table_impl; - template <class T> - class hash_unique_table : public T::table + template <typename A, typename T> + struct unique_node : + boost::unordered::detail::value_base<T> { - public: - typedef BOOST_DEDUCED_TYPENAME T::hasher hasher; - typedef BOOST_DEDUCED_TYPENAME T::key_equal key_equal; - typedef BOOST_DEDUCED_TYPENAME T::value_allocator value_allocator; - typedef BOOST_DEDUCED_TYPENAME T::key_type key_type; - typedef BOOST_DEDUCED_TYPENAME T::value_type value_type; - typedef BOOST_DEDUCED_TYPENAME T::table table; - typedef BOOST_DEDUCED_TYPENAME T::node_constructor node_constructor; - - typedef BOOST_DEDUCED_TYPENAME T::node node; - typedef BOOST_DEDUCED_TYPENAME T::node_ptr node_ptr; - typedef BOOST_DEDUCED_TYPENAME T::bucket_ptr bucket_ptr; - typedef BOOST_DEDUCED_TYPENAME T::iterator_base iterator_base; - typedef BOOST_DEDUCED_TYPENAME T::extractor extractor; - - typedef std::pair<iterator_base, bool> emplace_return; + typedef typename ::boost::unordered::detail::rebind_wrap< + A, unique_node<A, T> >::type::pointer link_pointer; - // Constructors + link_pointer next_; + std::size_t hash_; - hash_unique_table(std::size_t n, hasher const& hf, key_equal const& eq, - value_allocator const& a) - : table(n, hf, eq, a) {} - hash_unique_table(hash_unique_table const& x) - : table(x, x.node_alloc()) {} - hash_unique_table(hash_unique_table const& x, value_allocator const& a) - : table(x, a) {} - hash_unique_table(hash_unique_table& x, move_tag m) - : table(x, m) {} - hash_unique_table(hash_unique_table& x, value_allocator const& a, - move_tag m) - : table(x, a, m) {} - ~hash_unique_table() {} - - // Insert methods - - emplace_return emplace_impl_with_node(node_constructor& a); - value_type& operator[](key_type const& k); + unique_node() : + next_(), + hash_(0) + {} - // equals + void init(link_pointer) + { + } - bool equals(hash_unique_table const&) const; + private: + unique_node& operator=(unique_node const&); + }; - node_ptr add_node(node_constructor& a, bucket_ptr bucket); - -#if defined(BOOST_UNORDERED_STD_FORWARD) + template <typename T> + struct ptr_node : + boost::unordered::detail::value_base<T>, + boost::unordered::detail::ptr_bucket + { + typedef boost::unordered::detail::ptr_bucket bucket_base; + typedef ptr_bucket* link_pointer; - template<class... Args> - emplace_return emplace(Args&&... args); - template<class... Args> - emplace_return emplace_impl(key_type const& k, Args&&... args); - template<class... Args> - emplace_return emplace_impl(no_key, Args&&... args); - template<class... Args> - emplace_return emplace_empty_impl(Args&&... args); -#else + std::size_t hash_; -#define BOOST_UNORDERED_INSERT_IMPL(z, n, _) \ - template <BOOST_UNORDERED_TEMPLATE_ARGS(z, n)> \ - emplace_return emplace( \ - BOOST_UNORDERED_FUNCTION_PARAMS(z, n)); \ - template <BOOST_UNORDERED_TEMPLATE_ARGS(z, n)> \ - emplace_return emplace_impl(key_type const& k, \ - BOOST_UNORDERED_FUNCTION_PARAMS(z, n)); \ - template <BOOST_UNORDERED_TEMPLATE_ARGS(z, n)> \ - emplace_return emplace_impl(no_key, \ - BOOST_UNORDERED_FUNCTION_PARAMS(z, n)); \ - template <BOOST_UNORDERED_TEMPLATE_ARGS(z, n)> \ - emplace_return emplace_empty_impl( \ - BOOST_UNORDERED_FUNCTION_PARAMS(z, n)); - - BOOST_PP_REPEAT_FROM_TO(1, BOOST_UNORDERED_EMPLACE_LIMIT, - BOOST_UNORDERED_INSERT_IMPL, _) - -#undef BOOST_UNORDERED_INSERT_IMPL + ptr_node() : + bucket_base(), + hash_(0) + {} -#endif + void init(link_pointer) + { + } - // if hash function throws, or inserting > 1 element, basic exception - // safety strong otherwise - template <class InputIt> - void insert_range(InputIt i, InputIt j); - template <class InputIt> - void insert_range_impl(key_type const&, InputIt i, InputIt j); - template <class InputIt> - void insert_range_impl2(node_constructor&, key_type const&, InputIt i, InputIt j); - template <class InputIt> - void insert_range_impl(no_key, InputIt i, InputIt j); + private: + ptr_node& operator=(ptr_node const&); }; - template <class H, class P, class A> - struct set : public types< - BOOST_DEDUCED_TYPENAME A::value_type, - BOOST_DEDUCED_TYPENAME A::value_type, - H, P, A, - set_extractor<BOOST_DEDUCED_TYPENAME A::value_type>, - ungrouped> - { - typedef hash_unique_table<set<H, P, A> > impl; - typedef hash_table<set<H, P, A> > table; + // If the allocator uses raw pointers use ptr_node + // Otherwise use node. + + template <typename A, typename T, typename NodePtr, typename BucketPtr> + struct pick_node2 + { + typedef boost::unordered::detail::unique_node<A, T> node; + + typedef typename boost::unordered::detail::allocator_traits< + typename boost::unordered::detail::rebind_wrap<A, node>::type + >::pointer node_pointer; + + typedef boost::unordered::detail::bucket<node_pointer> bucket; + typedef node_pointer link_pointer; }; - template <class K, class H, class P, class A> - struct map : public types< - K, BOOST_DEDUCED_TYPENAME A::value_type, - H, P, A, - map_extractor<K, BOOST_DEDUCED_TYPENAME A::value_type>, - ungrouped> + template <typename A, typename T> + struct pick_node2<A, T, + boost::unordered::detail::ptr_node<T>*, + boost::unordered::detail::ptr_bucket*> { - typedef hash_unique_table<map<K, H, P, A> > impl; - typedef hash_table<map<K, H, P, A> > table; + typedef boost::unordered::detail::ptr_node<T> node; + typedef boost::unordered::detail::ptr_bucket bucket; + typedef bucket* link_pointer; }; - //////////////////////////////////////////////////////////////////////////// - // Equality + template <typename A, typename T> + struct pick_node + { + typedef boost::unordered::detail::allocator_traits< + typename boost::unordered::detail::rebind_wrap<A, + boost::unordered::detail::ptr_node<T> >::type + > tentative_node_traits; + + typedef boost::unordered::detail::allocator_traits< + typename boost::unordered::detail::rebind_wrap<A, + boost::unordered::detail::ptr_bucket >::type + > tentative_bucket_traits; + + typedef pick_node2<A, T, + typename tentative_node_traits::pointer, + typename tentative_bucket_traits::pointer> pick; + + typedef typename pick::node node; + typedef typename pick::bucket bucket; + typedef typename pick::link_pointer link_pointer; + }; + + template <typename A, typename T, typename H, typename P> + struct set + { + typedef boost::unordered::detail::set<A, T, H, P> types; + + typedef A allocator; + typedef T value_type; + typedef H hasher; + typedef P key_equal; + typedef T key_type; + + typedef boost::unordered::detail::allocator_traits<allocator> traits; + typedef boost::unordered::detail::pick_node<allocator, value_type> pick; + typedef typename pick::node node; + typedef typename pick::bucket bucket; + typedef typename pick::link_pointer link_pointer; + + typedef boost::unordered::detail::table_impl<types> table; + typedef boost::unordered::detail::set_extractor<value_type> extractor; + + typedef boost::unordered::detail::pick_policy::type policy; + }; + + template <typename A, typename K, typename M, typename H, typename P> + struct map + { + typedef boost::unordered::detail::map<A, K, M, H, P> types; + + typedef A allocator; + typedef std::pair<K const, M> value_type; + typedef H hasher; + typedef P key_equal; + typedef K key_type; + + typedef boost::unordered::detail::allocator_traits<allocator> + traits; + typedef boost::unordered::detail::pick_node<allocator, value_type> pick; + typedef typename pick::node node; + typedef typename pick::bucket bucket; + typedef typename pick::link_pointer link_pointer; + + typedef boost::unordered::detail::table_impl<types> table; + typedef boost::unordered::detail::map_extractor<key_type, value_type> + extractor; + + typedef boost::unordered::detail::pick_policy::type policy; + }; - template <class T> - bool hash_unique_table<T> - ::equals(hash_unique_table<T> const& other) const + template <typename Types> + struct table_impl : boost::unordered::detail::table<Types> { - if(this->size_ != other.size_) return false; - if(!this->size_) return true; + typedef boost::unordered::detail::table<Types> table; + typedef typename table::value_type value_type; + typedef typename table::bucket bucket; + typedef typename table::policy policy; + typedef typename table::node_pointer node_pointer; + typedef typename table::node_allocator node_allocator; + typedef typename table::node_allocator_traits node_allocator_traits; + typedef typename table::bucket_pointer bucket_pointer; + typedef typename table::link_pointer link_pointer; + typedef typename table::previous_pointer previous_pointer; + typedef typename table::hasher hasher; + typedef typename table::key_equal key_equal; + typedef typename table::key_type key_type; + typedef typename table::node_constructor node_constructor; + typedef typename table::extractor extractor; + typedef typename table::iterator iterator; + typedef typename table::c_iterator c_iterator; + + typedef std::pair<iterator, bool> emplace_return; + + // Constructors + + table_impl(std::size_t n, + hasher const& hf, + key_equal const& eq, + node_allocator const& a) + : table(n, hf, eq, a) + {} + + table_impl(table_impl const& x) + : table(x, node_allocator_traits:: + select_on_container_copy_construction(x.node_alloc())) + { + this->init(x); + } + + table_impl(table_impl const& x, + node_allocator const& a) + : table(x, a) + { + this->init(x); + } + + table_impl(table_impl& x, + boost::unordered::detail::move_tag m) + : table(x, m) + {} - bucket_ptr end = this->get_bucket(this->bucket_count_); - for(bucket_ptr i = this->cached_begin_bucket_; i != end; ++i) + table_impl(table_impl& x, + node_allocator const& a, + boost::unordered::detail::move_tag m) + : table(x, a, m) { - node_ptr it1 = i->next_; - while(BOOST_UNORDERED_BORLAND_BOOL(it1)) + this->move_init(x); + } + + // Accessors + + template <class Key, class Pred> + iterator find_node_impl( + std::size_t key_hash, + Key const& k, + Pred const& eq) const + { + std::size_t bucket_index = + policy::to_bucket(this->bucket_count_, key_hash); + iterator n = this->begin(bucket_index); + + for (;;) { - node_ptr it2 = other.find_iterator(this->get_key_from_ptr(it1)); - if(!BOOST_UNORDERED_BORLAND_BOOL(it2)) return false; - if(!extractor::compare_mapped( - node::get_value(it1), node::get_value(it2))) - return false; - it1 = it1->next_; + if (!n.node_) return n; + + std::size_t node_hash = n.node_->hash_; + if (key_hash == node_hash) + { + if (eq(k, this->get_key(*n))) + return n; + } + else + { + if (policy::to_bucket(this->bucket_count_, node_hash) + != bucket_index) + return iterator(); + } + + ++n; } } - return true; - } + std::size_t count(key_type const& k) const + { + return this->find_node(k).node_ ? 1 : 0; + } - //////////////////////////////////////////////////////////////////////////// - // A convenience method for adding nodes. + value_type& at(key_type const& k) const + { + if (this->size_) { + iterator it = this->find_node(k); + if (it.node_) return *it; + } - template <class T> - inline BOOST_DEDUCED_TYPENAME hash_unique_table<T>::node_ptr - hash_unique_table<T>::add_node(node_constructor& a, - bucket_ptr bucket) - { - node_ptr n = a.release(); - node::add_to_bucket(n, *bucket); - ++this->size_; - if(bucket < this->cached_begin_bucket_) - this->cached_begin_bucket_ = bucket; - return n; - } - - //////////////////////////////////////////////////////////////////////////// - // Insert methods - - // if hash function throws, basic exception safety - // strong otherwise - template <class T> - BOOST_DEDUCED_TYPENAME hash_unique_table<T>::value_type& - hash_unique_table<T>::operator[](key_type const& k) - { - typedef BOOST_DEDUCED_TYPENAME value_type::second_type mapped_type; - - std::size_t hash_value = this->hash_function()(k); - bucket_ptr bucket = this->bucket_ptr_from_hash(hash_value); - - if(!this->buckets_) { - node_constructor a(*this); - a.construct_pair(k, (mapped_type*) 0); - return *this->emplace_empty_impl_with_node(a, 1); + boost::throw_exception( + std::out_of_range("Unable to find key in unordered_map.")); } - node_ptr pos = this->find_iterator(bucket, k); + std::pair<iterator, iterator> + equal_range(key_type const& k) const + { + iterator n = this->find_node(k); + iterator n2 = n; + if (n2.node_) ++n2; + return std::make_pair(n, n2); + } + + // equals - if (BOOST_UNORDERED_BORLAND_BOOL(pos)) { - return node::get_value(pos); + bool equals(table_impl const& other) const + { + if(this->size_ != other.size_) return false; + + for(iterator n1 = this->begin(); n1.node_; ++n1) + { + iterator n2 = other.find_matching_node(n1); + +#if !defined(BOOST_UNORDERED_DEPRECATED_EQUALITY) + if (!n2.node_ || *n1 != *n2) + return false; +#else + if (!n2.node_ || !extractor::compare_mapped(*n1, *n2)) + return false; +#endif + } + + return true; + } + + // Emplace/Insert + + inline iterator add_node( + node_constructor& a, + std::size_t key_hash) + { + node_pointer n = a.release(); + n->hash_ = key_hash; + + bucket_pointer b = this->get_bucket( + policy::to_bucket(this->bucket_count_, key_hash)); + + if (!b->next_) + { + previous_pointer start_node = this->get_previous_start(); + + if (start_node->next_) { + this->get_bucket(policy::to_bucket(this->bucket_count_, + static_cast<node_pointer>(start_node->next_)->hash_) + )->next_ = n; + } + + b->next_ = start_node; + n->next_ = start_node->next_; + start_node->next_ = static_cast<link_pointer>(n); + } + else + { + n->next_ = b->next_->next_; + b->next_->next_ = static_cast<link_pointer>(n); + } + + ++this->size_; + return iterator(n); } - else { - // Side effects only in this block. + value_type& operator[](key_type const& k) + { + typedef typename value_type::second_type mapped_type; + + std::size_t key_hash = this->hash(k); + iterator pos = this->find_node(key_hash, k); + + if (pos.node_) return *pos; + // Create the node before rehashing in case it throws an // exception (need strong safety in such a case). - node_constructor a(*this); - a.construct_pair(k, (mapped_type*) 0); + node_constructor a(this->node_alloc()); + a.construct_with_value(BOOST_UNORDERED_EMPLACE_ARGS3( + boost::unordered::piecewise_construct, + boost::make_tuple(k), + boost::make_tuple())); + + this->reserve_for_insert(this->size_ + 1); + return *add_node(a, key_hash); + } - // reserve has basic exception safety if the hash function - // throws, strong otherwise. - if(this->reserve_for_insert(this->size_ + 1)) - bucket = this->bucket_ptr_from_hash(hash_value); +#if defined(BOOST_NO_RVALUE_REFERENCES) +# if defined(BOOST_NO_VARIADIC_TEMPLATES) + emplace_return emplace(boost::unordered::detail::emplace_args1< + boost::unordered::detail::please_ignore_this_overload> const&) + { + BOOST_ASSERT(false); + return emplace_return(this->begin(), false); + } +# else + emplace_return emplace( + boost::unordered::detail::please_ignore_this_overload const&) + { + BOOST_ASSERT(false); + return emplace_return(this->begin(), false); + } +# endif +#endif - // Nothing after this point can throw. + template <BOOST_UNORDERED_EMPLACE_TEMPLATE> + emplace_return emplace(BOOST_UNORDERED_EMPLACE_ARGS) + { +#if !defined(BOOST_NO_VARIADIC_TEMPLATES) + return emplace_impl( + extractor::extract(BOOST_UNORDERED_EMPLACE_FORWARD), + BOOST_UNORDERED_EMPLACE_FORWARD); +#else + return emplace_impl( + extractor::extract(args.a0, args.a1), + BOOST_UNORDERED_EMPLACE_FORWARD); +#endif + } - return node::get_value(add_node(a, bucket)); +#if defined(BOOST_NO_VARIADIC_TEMPLATES) + template <typename A0> + emplace_return emplace( + boost::unordered::detail::emplace_args1<A0> const& args) + { + return emplace_impl(extractor::extract(args.a0), args); } - } +#endif - template <class T> - inline BOOST_DEDUCED_TYPENAME hash_unique_table<T>::emplace_return - hash_unique_table<T>::emplace_impl_with_node(node_constructor& a) - { - // No side effects in this initial code - key_type const& k = this->get_key(a.value()); - std::size_t hash_value = this->hash_function()(k); - bucket_ptr bucket = this->bucket_ptr_from_hash(hash_value); - node_ptr pos = this->find_iterator(bucket, k); - - if (BOOST_UNORDERED_BORLAND_BOOL(pos)) { - // Found an existing key, return it (no throw). - return emplace_return(iterator_base(bucket, pos), false); - } else { + template <BOOST_UNORDERED_EMPLACE_TEMPLATE> + emplace_return emplace_impl(key_type const& k, + BOOST_UNORDERED_EMPLACE_ARGS) + { + std::size_t key_hash = this->hash(k); + iterator pos = this->find_node(key_hash, k); + + if (pos.node_) return emplace_return(pos, false); + + // Create the node before rehashing in case it throws an + // exception (need strong safety in such a case). + node_constructor a(this->node_alloc()); + a.construct_with_value(BOOST_UNORDERED_EMPLACE_FORWARD); + // reserve has basic exception safety if the hash function // throws, strong otherwise. - if(this->reserve_for_insert(this->size_ + 1)) - bucket = this->bucket_ptr_from_hash(hash_value); + this->reserve_for_insert(this->size_ + 1); + return emplace_return(this->add_node(a, key_hash), true); + } - // Nothing after this point can throw. + emplace_return emplace_impl_with_node(node_constructor& a) + { + key_type const& k = this->get_key(a.value()); + std::size_t key_hash = this->hash(k); + iterator pos = this->find_node(key_hash, k); - return emplace_return( - iterator_base(bucket, add_node(a, bucket)), - true); - } - } + if (pos.node_) return emplace_return(pos, false); -#if defined(BOOST_UNORDERED_STD_FORWARD) + // reserve has basic exception safety if the hash function + // throws, strong otherwise. + this->reserve_for_insert(this->size_ + 1); + return emplace_return(this->add_node(a, key_hash), true); + } - template <class T> - template<class... Args> - inline BOOST_DEDUCED_TYPENAME hash_unique_table<T>::emplace_return - hash_unique_table<T>::emplace_impl(key_type const& k, - Args&&... args) - { - // No side effects in this initial code - std::size_t hash_value = this->hash_function()(k); - bucket_ptr bucket = this->bucket_ptr_from_hash(hash_value); - node_ptr pos = this->find_iterator(bucket, k); + template <BOOST_UNORDERED_EMPLACE_TEMPLATE> + emplace_return emplace_impl(no_key, BOOST_UNORDERED_EMPLACE_ARGS) + { + // Don't have a key, so construct the node first in order + // to be able to lookup the position. + node_constructor a(this->node_alloc()); + a.construct_with_value(BOOST_UNORDERED_EMPLACE_FORWARD); + return emplace_impl_with_node(a); + } - if (BOOST_UNORDERED_BORLAND_BOOL(pos)) { - // Found an existing key, return it (no throw). - return emplace_return(iterator_base(bucket, pos), false); + //////////////////////////////////////////////////////////////////////// + // Insert range methods + // + // if hash function throws, or inserting > 1 element, basic exception + // safety strong otherwise - } else { - // Doesn't already exist, add to bucket. - // Side effects only in this block. + template <class InputIt> + void insert_range(InputIt i, InputIt j) + { + if(i != j) + return insert_range_impl(extractor::extract(*i), i, j); + } - // Create the node before rehashing in case it throws an - // exception (need strong safety in such a case). - node_constructor a(*this); - a.construct(std::forward<Args>(args)...); + template <class InputIt> + void insert_range_impl(key_type const& k, InputIt i, InputIt j) + { + node_constructor a(this->node_alloc()); + + insert_range_impl2(a, k, i, j); + + while(++i != j) { + // Note: can't use get_key as '*i' might not be value_type - it + // could be a pair with first_types as key_type without const or + // a different second_type. + // + // TODO: Might be worth storing the value_type instead of the + // key here. Could be more efficient if '*i' is expensive. Could + // be less efficient if copying the full value_type is + // expensive. + insert_range_impl2(a, extractor::extract(*i), i, j); + } + } - // reserve has basic exception safety if the hash function - // throws, strong otherwise. - if(this->reserve_for_insert(this->size_ + 1)) - bucket = this->bucket_ptr_from_hash(hash_value); + template <class InputIt> + void insert_range_impl2(node_constructor& a, key_type const& k, + InputIt i, InputIt j) + { + // No side effects in this initial code + std::size_t key_hash = this->hash(k); + iterator pos = this->find_node(key_hash, k); + + if (!pos.node_) { + a.construct_with_value2(*i); + if(this->size_ + 1 > this->max_load_) + this->reserve_for_insert(this->size_ + + boost::unordered::detail::insert_size(i, j)); + + // Nothing after this point can throw. + this->add_node(a, key_hash); + } + } - // Nothing after this point can throw. + template <class InputIt> + void insert_range_impl(no_key, InputIt i, InputIt j) + { + node_constructor a(this->node_alloc()); - return emplace_return( - iterator_base(bucket, add_node(a, bucket)), - true); + do { + a.construct_with_value2(*i); + emplace_impl_with_node(a); + } while(++i != j); } - } - template <class T> - template<class... Args> - inline BOOST_DEDUCED_TYPENAME hash_unique_table<T>::emplace_return - hash_unique_table<T>::emplace_impl(no_key, Args&&... args) - { - // Construct the node regardless - in order to get the key. - // It will be discarded if it isn't used - node_constructor a(*this); - a.construct(std::forward<Args>(args)...); - return emplace_impl_with_node(a); - } - - template <class T> - template<class... Args> - inline BOOST_DEDUCED_TYPENAME hash_unique_table<T>::emplace_return - hash_unique_table<T>::emplace_empty_impl(Args&&... args) - { - node_constructor a(*this); - a.construct(std::forward<Args>(args)...); - return emplace_return(this->emplace_empty_impl_with_node(a, 1), true); - } + //////////////////////////////////////////////////////////////////////// + // Erase + // + // no throw -#else + std::size_t erase_key(key_type const& k) + { + if(!this->size_) return 0; -#define BOOST_UNORDERED_INSERT_IMPL(z, num_params, _) \ - template <class T> \ - template <BOOST_UNORDERED_TEMPLATE_ARGS(z, num_params)> \ - inline BOOST_DEDUCED_TYPENAME \ - hash_unique_table<T>::emplace_return \ - hash_unique_table<T>::emplace_impl( \ - key_type const& k, \ - BOOST_UNORDERED_FUNCTION_PARAMS(z, num_params)) \ - { \ - std::size_t hash_value = this->hash_function()(k); \ - bucket_ptr bucket \ - = this->bucket_ptr_from_hash(hash_value); \ - node_ptr pos = this->find_iterator(bucket, k); \ - \ - if (BOOST_UNORDERED_BORLAND_BOOL(pos)) { \ - return emplace_return(iterator_base(bucket, pos), false); \ - } else { \ - node_constructor a(*this); \ - a.construct(BOOST_UNORDERED_CALL_PARAMS(z, num_params)); \ - \ - if(this->reserve_for_insert(this->size_ + 1)) \ - bucket = this->bucket_ptr_from_hash(hash_value); \ - \ - return emplace_return(iterator_base(bucket, \ - add_node(a, bucket)), true); \ - } \ - } \ - \ - template <class T> \ - template <BOOST_UNORDERED_TEMPLATE_ARGS(z, num_params)> \ - inline BOOST_DEDUCED_TYPENAME \ - hash_unique_table<T>::emplace_return \ - hash_unique_table<T>:: \ - emplace_impl(no_key, \ - BOOST_UNORDERED_FUNCTION_PARAMS(z, num_params)) \ - { \ - node_constructor a(*this); \ - a.construct(BOOST_UNORDERED_CALL_PARAMS(z, num_params)); \ - return emplace_impl_with_node(a); \ - } \ - \ - template <class T> \ - template <BOOST_UNORDERED_TEMPLATE_ARGS(z, num_params)> \ - inline BOOST_DEDUCED_TYPENAME \ - hash_unique_table<T>::emplace_return \ - hash_unique_table<T>:: \ - emplace_empty_impl( \ - BOOST_UNORDERED_FUNCTION_PARAMS(z, num_params)) \ - { \ - node_constructor a(*this); \ - a.construct(BOOST_UNORDERED_CALL_PARAMS(z, num_params)); \ - return emplace_return(this->emplace_empty_impl_with_node(a, 1), true); \ - } - - BOOST_PP_REPEAT_FROM_TO(1, BOOST_UNORDERED_EMPLACE_LIMIT, - BOOST_UNORDERED_INSERT_IMPL, _) - -#undef BOOST_UNORDERED_INSERT_IMPL + std::size_t key_hash = this->hash(k); + std::size_t bucket_index = + policy::to_bucket(this->bucket_count_, key_hash); + bucket_pointer this_bucket = this->get_bucket(bucket_index); -#endif + previous_pointer prev = this_bucket->next_; + if (!prev) return 0; -#if defined(BOOST_UNORDERED_STD_FORWARD) + for (;;) + { + if (!prev->next_) return 0; + std::size_t node_hash = + static_cast<node_pointer>(prev->next_)->hash_; + if (policy::to_bucket(this->bucket_count_, node_hash) + != bucket_index) + return 0; + if (node_hash == key_hash && + this->key_eq()(k, this->get_key( + static_cast<node_pointer>(prev->next_)->value()))) + break; + prev = static_cast<previous_pointer>(prev->next_); + } - // Emplace (unique keys) - // (I'm using an overloaded emplace for both 'insert' and 'emplace') + node_pointer pos = static_cast<node_pointer>(prev->next_); + node_pointer end = static_cast<node_pointer>(pos->next_); + prev->next_ = pos->next_; + this->fix_buckets(this_bucket, prev, end); + return this->delete_nodes(c_iterator(pos), c_iterator(end)); + } - // if hash function throws, basic exception safety - // strong otherwise + iterator erase(c_iterator r) + { + BOOST_ASSERT(r.node_); + iterator next(r.node_); + ++next; - template <class T> - template<class... Args> - BOOST_DEDUCED_TYPENAME hash_unique_table<T>::emplace_return - hash_unique_table<T>::emplace(Args&&... args) - { - return this->size_ ? - emplace_impl( - extractor::extract(std::forward<Args>(args)...), - std::forward<Args>(args)...) : - emplace_empty_impl(std::forward<Args>(args)...); - } + bucket_pointer this_bucket = this->get_bucket( + policy::to_bucket(this->bucket_count_, r.node_->hash_)); + previous_pointer prev = unlink_node(*this_bucket, r.node_); -#else + this->fix_buckets(this_bucket, prev, next.node_); - template <class T> - template <class Arg0> - BOOST_DEDUCED_TYPENAME hash_unique_table<T>::emplace_return - hash_unique_table<T>::emplace(Arg0 const& arg0) - { - return this->size_ ? - emplace_impl(extractor::extract(arg0), arg0) : - emplace_empty_impl(arg0); - } - -#define BOOST_UNORDERED_INSERT_IMPL(z, num_params, _) \ - template <class T> \ - template <BOOST_UNORDERED_TEMPLATE_ARGS(z, num_params)> \ - BOOST_DEDUCED_TYPENAME hash_unique_table<T>::emplace_return \ - hash_unique_table<T>::emplace( \ - BOOST_UNORDERED_FUNCTION_PARAMS(z, num_params)) \ - { \ - return this->size_ ? \ - emplace_impl(extractor::extract(arg0, arg1), \ - BOOST_UNORDERED_CALL_PARAMS(z, num_params)) : \ - emplace_empty_impl( \ - BOOST_UNORDERED_CALL_PARAMS(z, num_params)); \ - } - - BOOST_PP_REPEAT_FROM_TO(2, BOOST_UNORDERED_EMPLACE_LIMIT, - BOOST_UNORDERED_INSERT_IMPL, _) - -#undef BOOST_UNORDERED_INSERT_IMPL + this->delete_node(r); -#endif - - //////////////////////////////////////////////////////////////////////////// - // Insert range methods + return next; + } - template <class T> - template <class InputIt> - inline void hash_unique_table<T>::insert_range_impl2( - node_constructor& a, key_type const& k, InputIt i, InputIt j) - { - // No side effects in this initial code - std::size_t hash_value = this->hash_function()(k); - bucket_ptr bucket = this->bucket_ptr_from_hash(hash_value); - node_ptr pos = this->find_iterator(bucket, k); + iterator erase_range(c_iterator r1, c_iterator r2) + { + if (r1 == r2) return iterator(r2.node_); - if (!BOOST_UNORDERED_BORLAND_BOOL(pos)) { - // Doesn't already exist, add to bucket. - // Side effects only in this block. + std::size_t bucket_index = + policy::to_bucket(this->bucket_count_, r1.node_->hash_); + previous_pointer prev = unlink_nodes( + *this->get_bucket(bucket_index), r1.node_, r2.node_); + this->fix_buckets_range(bucket_index, prev, r1.node_, r2.node_); + this->delete_nodes(r1, r2); - // Create the node before rehashing in case it throws an - // exception (need strong safety in such a case). - a.construct(*i); + return iterator(r2.node_); + } - // reserve has basic exception safety if the hash function - // throws, strong otherwise. - if(this->size_ + 1 >= this->max_load_) { - this->reserve_for_insert(this->size_ + insert_size(i, j)); - bucket = this->bucket_ptr_from_hash(hash_value); - } + static previous_pointer unlink_node(bucket& b, node_pointer n) + { + return unlink_nodes(b, n, static_cast<node_pointer>(n->next_)); + } - // Nothing after this point can throw. - add_node(a, bucket); + static previous_pointer unlink_nodes(bucket& b, + node_pointer begin, node_pointer end) + { + previous_pointer prev = b.next_; + link_pointer begin_void = static_cast<link_pointer>(begin); + while(prev->next_ != begin_void) + prev = static_cast<previous_pointer>(prev->next_); + prev->next_ = static_cast<link_pointer>(end); + return prev; } - } - template <class T> - template <class InputIt> - inline void hash_unique_table<T>::insert_range_impl( - key_type const&, InputIt i, InputIt j) - { - node_constructor a(*this); + //////////////////////////////////////////////////////////////////////// + // fill_buckets + + template <class NodeCreator> + static void fill_buckets(iterator n, table& dst, + NodeCreator& creator) + { + previous_pointer prev = dst.get_previous_start(); + + while (n.node_) { + node_pointer node = creator.create(*n); + node->hash_ = n.node_->hash_; + prev->next_ = static_cast<link_pointer>(node); + ++dst.size_; + ++n; - if(!this->size_) { - a.construct(*i); - this->emplace_empty_impl_with_node(a, 1); - ++i; - if(i == j) return; + prev = place_in_bucket(dst, prev); + } } - do { - // Note: can't use get_key as '*i' might not be value_type - it - // could be a pair with first_types as key_type without const or a - // different second_type. - // - // TODO: Might be worth storing the value_type instead of the key - // here. Could be more efficient if '*i' is expensive. Could be - // less efficient if copying the full value_type is expensive. - insert_range_impl2(a, extractor::extract(*i), i, j); - } while(++i != j); - } - - template <class T> - template <class InputIt> - inline void hash_unique_table<T>::insert_range_impl( - no_key, InputIt i, InputIt j) - { - node_constructor a(*this); + // strong otherwise exception safety + void rehash_impl(std::size_t num_buckets) + { + BOOST_ASSERT(this->buckets_); - if(!this->size_) { - a.construct(*i); - this->emplace_empty_impl_with_node(a, 1); - ++i; - if(i == j) return; + this->create_buckets(num_buckets); + previous_pointer prev = this->get_previous_start(); + while (prev->next_) + prev = place_in_bucket(*this, prev); } - do { - // No side effects in this initial code - a.construct(*i); - emplace_impl_with_node(a); - } while(++i != j); - } - - // if hash function throws, or inserting > 1 element, basic exception safety - // strong otherwise - template <class T> - template <class InputIt> - void hash_unique_table<T>::insert_range(InputIt i, InputIt j) - { - if(i != j) - return insert_range_impl(extractor::extract(*i), i, j); - } -}} + // Iterate through the nodes placing them in the correct buckets. + // pre: prev->next_ is not null. + static previous_pointer place_in_bucket(table& dst, + previous_pointer prev) + { + node_pointer n = static_cast<node_pointer>(prev->next_); + bucket_pointer b = dst.get_bucket( + table::to_bucket(dst.bucket_count_, n->hash_)); + + if (!b->next_) { + b->next_ = prev; + return static_cast<previous_pointer>(n); + } + else { + prev->next_ = n->next_; + n->next_ = b->next_->next_; + b->next_->next_ = static_cast<link_pointer>(n); + return prev; + } + } + }; +}}} #endif diff --git a/3rdParty/Boost/src/boost/unordered/detail/util.hpp b/3rdParty/Boost/src/boost/unordered/detail/util.hpp index 989883e..a901477 100644 --- a/3rdParty/Boost/src/boost/unordered/detail/util.hpp +++ b/3rdParty/Boost/src/boost/unordered/detail/util.hpp @@ -1,39 +1,62 @@ // Copyright (C) 2003-2004 Jeremy B. Maitin-Shepard. -// Copyright (C) 2005-2009 Daniel James +// Copyright (C) 2005-2011 Daniel James // 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_UNORDERED_DETAIL_UTIL_HPP_INCLUDED #define BOOST_UNORDERED_DETAIL_UTIL_HPP_INCLUDED -#include <cstddef> -#include <utility> -#include <algorithm> -#include <boost/limits.hpp> +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include <boost/type_traits/is_convertible.hpp> +#include <boost/type_traits/is_empty.hpp> #include <boost/iterator/iterator_categories.hpp> +#include <boost/utility/enable_if.hpp> +#include <boost/detail/select_type.hpp> +#include <boost/move/move.hpp> #include <boost/preprocessor/seq/size.hpp> #include <boost/preprocessor/seq/enum.hpp> -#include <boost/unordered/detail/fwd.hpp> +#include <boost/swap.hpp> -namespace boost { namespace unordered_detail { +namespace boost { namespace unordered { namespace detail { - //////////////////////////////////////////////////////////////////////////// - // convert double to std::size_t + static const float minimum_max_load_factor = 1e-3f; + static const std::size_t default_bucket_count = 11; + struct move_tag {}; + struct empty_emplace {}; - inline std::size_t double_to_size_t(double f) - { - return f >= static_cast<double>( - (std::numeric_limits<std::size_t>::max)()) ? - (std::numeric_limits<std::size_t>::max)() : - static_cast<std::size_t>(f); - } + //////////////////////////////////////////////////////////////////////////// + // iterator SFINAE + + template <typename I> + struct is_forward : + boost::is_convertible< + typename boost::iterator_traversal<I>::type, + boost::forward_traversal_tag> + {}; + + template <typename I, typename ReturnType> + struct enable_if_forward : + boost::enable_if_c< + boost::unordered::detail::is_forward<I>::value, + ReturnType> + {}; + + template <typename I, typename ReturnType> + struct disable_if_forward : + boost::disable_if_c< + boost::unordered::detail::is_forward<I>::value, + ReturnType> + {}; //////////////////////////////////////////////////////////////////////////// // primes #define BOOST_UNORDERED_PRIMES \ - (5ul)(11ul)(17ul)(29ul)(37ul)(53ul)(67ul)(79ul) \ + (17ul)(29ul)(37ul)(53ul)(67ul)(79ul) \ (97ul)(131ul)(193ul)(257ul)(389ul)(521ul)(769ul) \ (1031ul)(1543ul)(2053ul)(3079ul)(6151ul)(12289ul)(24593ul) \ (49157ul)(98317ul)(196613ul)(393241ul)(786433ul) \ @@ -93,239 +116,145 @@ namespace boost { namespace unordered_detail { } //////////////////////////////////////////////////////////////////////////// - // pair_cast - because some libraries don't have the full pair constructors. - - template <class Dst1, class Dst2, class Src1, class Src2> - inline std::pair<Dst1, Dst2> pair_cast(std::pair<Src1, Src2> const& x) - { - return std::pair<Dst1, Dst2>(Dst1(x.first), Dst2(x.second)); - } - - //////////////////////////////////////////////////////////////////////////// // insert_size/initial_size #if !defined(BOOST_NO_STD_DISTANCE) + using ::std::distance; + #else + template <class ForwardIterator> inline std::size_t distance(ForwardIterator i, ForwardIterator j) { std::size_t x; std::distance(i, j, x); return x; } + #endif template <class I> - inline std::size_t insert_size(I i, I j, boost::forward_traversal_tag) + inline typename + boost::unordered::detail::enable_if_forward<I, std::size_t>::type + insert_size(I i, I j) { return std::distance(i, j); } template <class I> - inline std::size_t insert_size(I, I, boost::incrementable_traversal_tag) + inline typename + boost::unordered::detail::disable_if_forward<I, std::size_t>::type + insert_size(I, I) { return 1; } template <class I> - inline std::size_t insert_size(I i, I j) - { - BOOST_DEDUCED_TYPENAME boost::iterator_traversal<I>::type - iterator_traversal_tag; - return insert_size(i, j, iterator_traversal_tag); - } - - template <class I> inline std::size_t initial_size(I i, I j, - std::size_t num_buckets = boost::unordered_detail::default_bucket_count) + std::size_t num_buckets = + boost::unordered::detail::default_bucket_count) { - return (std::max)(static_cast<std::size_t>(insert_size(i, j)) + 1, + // TODO: Why +1? + return (std::max)( + boost::unordered::detail::insert_size(i, j) + 1, num_buckets); } //////////////////////////////////////////////////////////////////////////// - // Node Constructors + // compressed -#if defined(BOOST_UNORDERED_STD_FORWARD) - - template <class T, class... Args> - inline void construct_impl(T*, void* address, Args&&... args) + template <typename T, int Index> + struct compressed_base : private T { - new(address) T(std::forward<Args>(args)...); - } + compressed_base(T const& x) : T(x) {} + compressed_base(T& x, move_tag) : T(boost::move(x)) {} -#if defined(BOOST_UNORDERED_CPP0X_PAIR) - template <class First, class Second, class Key, class Arg0, class... Args> - inline void construct_impl(std::pair<First, Second>*, void* address, - Key&& k, Arg0&& arg0, Args&&... args) - ) + T& get() { return *this; } + T const& get() const { return *this; } + }; + + template <typename T, int Index> + struct uncompressed_base { - new(address) std::pair<First, Second>(k, - Second(arg0, std::forward<Args>(args)...); - } -#endif - -#else - -#define BOOST_UNORDERED_CONSTRUCT_IMPL(z, num_params, _) \ - template < \ - class T, \ - BOOST_UNORDERED_TEMPLATE_ARGS(z, num_params) \ - > \ - inline void construct_impl( \ - T*, void* address, \ - BOOST_UNORDERED_FUNCTION_PARAMS(z, num_params) \ - ) \ - { \ - new(address) T( \ - BOOST_UNORDERED_CALL_PARAMS(z, num_params)); \ - } \ - \ - template <class First, class Second, class Key, \ - BOOST_UNORDERED_TEMPLATE_ARGS(z, num_params) \ - > \ - inline void construct_impl( \ - std::pair<First, Second>*, void* address, \ - Key const& k, BOOST_UNORDERED_FUNCTION_PARAMS(z, num_params)) \ - { \ - new(address) std::pair<First, Second>(k, \ - Second(BOOST_UNORDERED_CALL_PARAMS(z, num_params))); \ - } + uncompressed_base(T const& x) : value_(x) {} + uncompressed_base(T& x, move_tag) : value_(boost::move(x)) {} - BOOST_PP_REPEAT_FROM_TO(1, BOOST_UNORDERED_EMPLACE_LIMIT, - BOOST_UNORDERED_CONSTRUCT_IMPL, _) - -#undef BOOST_UNORDERED_CONSTRUCT_IMPL -#endif - - // hash_node_constructor - // - // Used to construct nodes in an exception safe manner. - - template <class Alloc, class Grouped> - class hash_node_constructor + T& get() { return value_; } + T const& get() const { return value_; } + private: + T value_; + }; + + template <typename T, int Index> + struct generate_base + : boost::detail::if_true< + boost::is_empty<T>::value + >:: BOOST_NESTED_TEMPLATE then< + boost::unordered::detail::compressed_base<T, Index>, + boost::unordered::detail::uncompressed_base<T, Index> + > + {}; + + template <typename T1, typename T2> + struct compressed + : private boost::unordered::detail::generate_base<T1, 1>::type, + private boost::unordered::detail::generate_base<T2, 2>::type { - typedef hash_buckets<Alloc, Grouped> buckets; - typedef BOOST_DEDUCED_TYPENAME buckets::node node; - typedef BOOST_DEDUCED_TYPENAME buckets::real_node_ptr real_node_ptr; - typedef BOOST_DEDUCED_TYPENAME buckets::value_type value_type; - - buckets& buckets_; - real_node_ptr node_; - bool node_constructed_; - bool value_constructed_; - - public: - - hash_node_constructor(buckets& m) : - buckets_(m), - node_(), - node_constructed_(false), - value_constructed_(false) - { + typedef typename generate_base<T1, 1>::type base1; + typedef typename generate_base<T2, 2>::type base2; + + typedef T1 first_type; + typedef T2 second_type; + + first_type& first() { + return static_cast<base1*>(this)->get(); } - ~hash_node_constructor(); - void construct_preamble(); + first_type const& first() const { + return static_cast<base1 const*>(this)->get(); + } -#if defined(BOOST_UNORDERED_STD_FORWARD) - template <class... Args> - void construct(Args&&... args) - { - construct_preamble(); - construct_impl((value_type*) 0, node_->address(), - std::forward<Args>(args)...); - value_constructed_ = true; + second_type& second() { + return static_cast<base2*>(this)->get(); } -#else -#define BOOST_UNORDERED_CONSTRUCT(z, num_params, _) \ - template < \ - BOOST_UNORDERED_TEMPLATE_ARGS(z, num_params) \ - > \ - void construct( \ - BOOST_UNORDERED_FUNCTION_PARAMS(z, num_params) \ - ) \ - { \ - construct_preamble(); \ - construct_impl( \ - (value_type*) 0, node_->address(), \ - BOOST_UNORDERED_CALL_PARAMS(z, num_params) \ - ); \ - value_constructed_ = true; \ + second_type const& second() const { + return static_cast<base2 const*>(this)->get(); } - BOOST_PP_REPEAT_FROM_TO(1, BOOST_UNORDERED_EMPLACE_LIMIT, - BOOST_UNORDERED_CONSTRUCT, _) + template <typename First, typename Second> + compressed(First const& x1, Second const& x2) + : base1(x1), base2(x2) {} -#undef BOOST_UNORDERED_CONSTRUCT + compressed(compressed const& x) + : base1(x.first()), base2(x.second()) {} -#endif - template <class K, class M> - void construct_pair(K const& k, M*) + compressed(compressed& x, move_tag m) + : base1(x.first(), m), base2(x.second(), m) {} + + void assign(compressed const& x) { - construct_preamble(); - new(node_->address()) value_type(k, M()); - value_constructed_ = true; + first() = x.first(); + second() = x.second(); } - value_type& value() const + void move_assign(compressed& x) { - BOOST_ASSERT(node_); - return node_->value(); + first() = boost::move(x.first()); + second() = boost::move(x.second()); } - - // no throw - BOOST_DEDUCED_TYPENAME buckets::node_ptr release() + + void swap(compressed& x) { - real_node_ptr p = node_; - node_ = real_node_ptr(); - // node_ptr cast - return buckets_.bucket_alloc().address(*p); + boost::swap(first(), x.first()); + boost::swap(second(), x.second()); } private: - hash_node_constructor(hash_node_constructor const&); - hash_node_constructor& operator=(hash_node_constructor const&); + // Prevent assignment just to make use of assign or + // move_assign explicit. + compressed& operator=(compressed const&); }; - - // hash_node_constructor - - template <class Alloc, class Grouped> - inline hash_node_constructor<Alloc, Grouped>::~hash_node_constructor() - { - if (node_) { - if (value_constructed_) { -#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613)) - struct dummy { hash_node<Alloc, Grouped> x; }; -#endif - boost::unordered_detail::destroy(node_->value_ptr()); - } - - if (node_constructed_) - buckets_.node_alloc().destroy(node_); - - buckets_.node_alloc().deallocate(node_, 1); - } - } - - template <class Alloc, class Grouped> - inline void hash_node_constructor<Alloc, Grouped>::construct_preamble() - { - if(!node_) { - node_constructed_ = false; - value_constructed_ = false; - - node_ = buckets_.node_alloc().allocate(1); - buckets_.node_alloc().construct(node_, node()); - node_constructed_ = true; - } - else { - BOOST_ASSERT(node_constructed_ && value_constructed_); - boost::unordered_detail::destroy(node_->value_ptr()); - value_constructed_ = false; - } - } -}} +}}} #endif diff --git a/3rdParty/Boost/src/boost/unordered/unordered_map.hpp b/3rdParty/Boost/src/boost/unordered/unordered_map.hpp index 86a6fc6..d606739 100644 --- a/3rdParty/Boost/src/boost/unordered/unordered_map.hpp +++ b/3rdParty/Boost/src/boost/unordered/unordered_map.hpp @@ -1,6 +1,6 @@ // Copyright (C) 2003-2004 Jeremy B. Maitin-Shepard. -// Copyright (C) 2005-2009 Daniel James. +// Copyright (C) 2005-2011 Daniel James. // 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) @@ -14,16 +14,13 @@ #endif #include <boost/unordered/unordered_map_fwd.hpp> -#include <boost/functional/hash.hpp> -#include <boost/unordered/detail/allocator_helpers.hpp> #include <boost/unordered/detail/equivalent.hpp> #include <boost/unordered/detail/unique.hpp> +#include <boost/unordered/detail/util.hpp> +#include <boost/functional/hash.hpp> +#include <boost/move/move.hpp> -#if defined(BOOST_NO_RVALUE_REFERENCES) -#include <boost/unordered/detail/move.hpp> -#endif - -#if !defined(BOOST_NO_0X_HDR_INITIALIZER_LIST) +#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) #include <initializer_list> #endif @@ -38,10 +35,17 @@ namespace boost { +namespace unordered +{ template <class K, class T, class H, class P, class A> class unordered_map { +#if defined(BOOST_UNORDERED_USE_MOVE) + BOOST_COPYABLE_AND_MOVABLE(unordered_map) +#endif + public: + typedef K key_type; typedef std::pair<const K, T> value_type; typedef T mapped_type; @@ -49,179 +53,129 @@ namespace boost typedef P key_equal; typedef A allocator_type; -#if !BOOST_WORKAROUND(__BORLANDC__, < 0x0582) private: -#endif - - typedef BOOST_DEDUCED_TYPENAME - boost::unordered_detail::rebind_wrap< - allocator_type, value_type>::type - value_allocator; - typedef boost::unordered_detail::map<K, H, P, - value_allocator> types; - typedef BOOST_DEDUCED_TYPENAME types::impl table; - - typedef BOOST_DEDUCED_TYPENAME types::iterator_base iterator_base; + typedef boost::unordered::detail::map<A, K, T, H, P> types; + typedef typename types::traits allocator_traits; + typedef typename types::table table; public: - typedef BOOST_DEDUCED_TYPENAME - value_allocator::pointer pointer; - typedef BOOST_DEDUCED_TYPENAME - value_allocator::const_pointer const_pointer; - typedef BOOST_DEDUCED_TYPENAME - value_allocator::reference reference; - typedef BOOST_DEDUCED_TYPENAME - value_allocator::const_reference const_reference; + typedef typename allocator_traits::pointer pointer; + typedef typename allocator_traits::const_pointer const_pointer; + + typedef value_type& reference; + typedef value_type const& const_reference; typedef std::size_t size_type; typedef std::ptrdiff_t difference_type; - typedef boost::unordered_detail::hash_const_local_iterator< - value_allocator, boost::unordered_detail::ungrouped> - const_local_iterator; - typedef boost::unordered_detail::hash_local_iterator< - value_allocator, boost::unordered_detail::ungrouped> - local_iterator; - typedef boost::unordered_detail::hash_const_iterator< - value_allocator, boost::unordered_detail::ungrouped> - const_iterator; - typedef boost::unordered_detail::hash_iterator< - value_allocator, boost::unordered_detail::ungrouped> - iterator; + typedef typename table::cl_iterator const_local_iterator; + typedef typename table::l_iterator local_iterator; + typedef typename table::c_iterator const_iterator; + typedef typename table::iterator iterator; -#if !BOOST_WORKAROUND(__BORLANDC__, < 0x0582) private: -#endif table table_; - - BOOST_DEDUCED_TYPENAME types::iterator_base const& - get(const_iterator const& it) - { - return boost::unordered_detail::iterator_access::get(it); - } public: - // construct/destroy/copy + // constructors explicit unordered_map( - size_type n = boost::unordered_detail::default_bucket_count, - const hasher &hf = hasher(), - const key_equal &eql = key_equal(), - const allocator_type &a = allocator_type()) - : table_(n, hf, eql, a) - { - } - - explicit unordered_map(allocator_type const& a) - : table_(boost::unordered_detail::default_bucket_count, - hasher(), key_equal(), a) - { - } + size_type = boost::unordered::detail::default_bucket_count, + const hasher& = hasher(), + const key_equal& = key_equal(), + const allocator_type& = allocator_type()); - unordered_map(unordered_map const& other, allocator_type const& a) - : table_(other.table_, a) - { - } + explicit unordered_map(allocator_type const&); template <class InputIt> - unordered_map(InputIt f, InputIt l) - : table_(boost::unordered_detail::initial_size(f, l), - hasher(), key_equal(), allocator_type()) - { - table_.insert_range(f, l); - } + unordered_map(InputIt, InputIt); template <class InputIt> - unordered_map(InputIt f, InputIt l, - size_type n, - const hasher &hf = hasher(), - const key_equal &eql = key_equal()) - : table_(boost::unordered_detail::initial_size(f, l, n), - hf, eql, allocator_type()) - { - table_.insert_range(f, l); - } + unordered_map( + InputIt, InputIt, + size_type, + const hasher& = hasher(), + const key_equal& = key_equal()); template <class InputIt> - unordered_map(InputIt f, InputIt l, - size_type n, - const hasher &hf, - const key_equal &eql, - const allocator_type &a) - : table_(boost::unordered_detail::initial_size(f, l, n), hf, eql, a) - { - table_.insert_range(f, l); - } + unordered_map( + InputIt, InputIt, + size_type, + const hasher&, + const key_equal&, + const allocator_type&); - ~unordered_map() {} + // copy/move constructors -#if !defined(BOOST_NO_RVALUE_REFERENCES) - unordered_map(unordered_map const& other) - : table_(other.table_) + unordered_map(unordered_map const&); + + unordered_map(unordered_map const&, allocator_type const&); + +#if defined(BOOST_UNORDERED_USE_MOVE) + unordered_map(BOOST_RV_REF(unordered_map) other) + : table_(other.table_, boost::unordered::detail::move_tag()) { } - +#elif !defined(BOOST_NO_RVALUE_REFERENCES) unordered_map(unordered_map&& other) - : table_(other.table_, boost::unordered_detail::move_tag()) + : table_(other.table_, boost::unordered::detail::move_tag()) { } +#endif - unordered_map(unordered_map&& other, allocator_type const& a) - : table_(other.table_, a, boost::unordered_detail::move_tag()) - { - } +#if !defined(BOOST_NO_RVALUE_REFERENCES) + unordered_map(unordered_map&&, allocator_type const&); +#endif - unordered_map& operator=(unordered_map const& x) +#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) + unordered_map( + std::initializer_list<value_type>, + size_type = boost::unordered::detail::default_bucket_count, + const hasher& = hasher(), + const key_equal&l = key_equal(), + const allocator_type& = allocator_type()); +#endif + + // Destructor + + ~unordered_map(); + + // Assign + +#if defined(BOOST_UNORDERED_USE_MOVE) + unordered_map& operator=(BOOST_COPY_ASSIGN_REF(unordered_map) x) { - table_ = x.table_; + table_.assign(x.table_); return *this; } - unordered_map& operator=(unordered_map&& x) + unordered_map& operator=(BOOST_RV_REF(unordered_map) x) { - table_.move(x.table_); + table_.move_assign(x.table_); return *this; } #else - unordered_map(boost::unordered_detail::move_from< - unordered_map<K, T, H, P, A> - > other) - : table_(other.source.table_, boost::unordered_detail::move_tag()) + unordered_map& operator=(unordered_map const& x) { + table_.assign(x.table_); + return *this; } -#if !BOOST_WORKAROUND(__BORLANDC__, < 0x0593) - unordered_map& operator=(unordered_map x) +#if !defined(BOOST_NO_RVALUE_REFERENCES) + unordered_map& operator=(unordered_map&& x) { - table_.move(x.table_); + table_.move_assign(x.table_); return *this; } #endif #endif -#if !defined(BOOST_NO_0X_HDR_INITIALIZER_LIST) - unordered_map(std::initializer_list<value_type> list, - size_type n = boost::unordered_detail::default_bucket_count, - const hasher &hf = hasher(), - const key_equal &eql = key_equal(), - const allocator_type &a = allocator_type()) - : table_(boost::unordered_detail::initial_size( - list.begin(), list.end(), n), - hf, eql, a) - { - table_.insert_range(list.begin(), list.end()); - } - - unordered_map& operator=(std::initializer_list<value_type> list) - { - table_.clear(); - table_.insert_range(list.begin(), list.end()); - return *this; - } +#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) + unordered_map& operator=(std::initializer_list<value_type>); #endif allocator_type get_allocator() const @@ -241,244 +195,257 @@ namespace boost return table_.size_; } - size_type max_size() const - { - return table_.max_size(); - } + size_type max_size() const; // iterators iterator begin() { - return iterator(table_.begin()); + return table_.begin(); } const_iterator begin() const { - return const_iterator(table_.begin()); + return table_.begin(); } iterator end() { - return iterator(table_.end()); + return iterator(); } const_iterator end() const { - return const_iterator(table_.end()); + return const_iterator(); } const_iterator cbegin() const { - return const_iterator(table_.begin()); + return table_.begin(); } const_iterator cend() const { - return const_iterator(table_.end()); + return const_iterator(); } - // modifiers + // emplace -#if defined(BOOST_UNORDERED_STD_FORWARD) +#if !defined(BOOST_NO_VARIADIC_TEMPLATES) template <class... Args> - std::pair<iterator, bool> emplace(Args&&... args) + std::pair<iterator, bool> emplace(BOOST_FWD_REF(Args)... args) { - return boost::unordered_detail::pair_cast<iterator, bool>( - table_.emplace(std::forward<Args>(args)...)); + return table_.emplace(boost::forward<Args>(args)...); } template <class... Args> - iterator emplace_hint(const_iterator, Args&&... args) + iterator emplace_hint(const_iterator, BOOST_FWD_REF(Args)... args) { - return iterator(table_.emplace(std::forward<Args>(args)...).first); + return table_.emplace(boost::forward<Args>(args)...).first; } #else - #if !BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x5100)) - std::pair<iterator, bool> emplace(value_type const& v = value_type()) - { - return boost::unordered_detail::pair_cast<iterator, bool>( - table_.emplace(v)); - } - - iterator emplace_hint(const_iterator, - value_type const& v = value_type()) - { - return iterator(table_.emplace(v).first); - } - #endif - -#define BOOST_UNORDERED_EMPLACE(z, n, _) \ - template < \ - BOOST_UNORDERED_TEMPLATE_ARGS(z, n) \ - > \ - std::pair<iterator, bool> emplace( \ - BOOST_UNORDERED_FUNCTION_PARAMS(z, n) \ - ) \ - { \ - return boost::unordered_detail::pair_cast<iterator, bool>( \ - table_.emplace( \ - BOOST_UNORDERED_CALL_PARAMS(z, n) \ - )); \ - } \ - \ - template < \ - BOOST_UNORDERED_TEMPLATE_ARGS(z, n) \ - > \ - iterator emplace_hint(const_iterator, \ - BOOST_UNORDERED_FUNCTION_PARAMS(z, n) \ - ) \ - { \ - return iterator(table_.emplace( \ - BOOST_UNORDERED_CALL_PARAMS(z, n)).first); \ - } - - BOOST_PP_REPEAT_FROM_TO(1, BOOST_UNORDERED_EMPLACE_LIMIT, - BOOST_UNORDERED_EMPLACE, _) - -#undef BOOST_UNORDERED_EMPLACE - -#endif +#if !BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x5100)) - std::pair<iterator, bool> insert(const value_type& obj) - { - return boost::unordered_detail::pair_cast<iterator, bool>( - table_.emplace(obj)); - } + // 0 argument emplace requires special treatment in case + // the container is instantiated with a value type that + // doesn't have a default constructor. - iterator insert(const_iterator, const value_type& obj) + std::pair<iterator, bool> emplace( + boost::unordered::detail::empty_emplace + = boost::unordered::detail::empty_emplace(), + value_type v = value_type()) { - return iterator(table_.emplace(obj).first); + return this->emplace(boost::move(v)); } - template <class InputIt> - void insert(InputIt first, InputIt last) + iterator emplace_hint(const_iterator hint, + boost::unordered::detail::empty_emplace + = boost::unordered::detail::empty_emplace(), + value_type v = value_type() + ) { - table_.insert_range(first, last); + return this->emplace_hint(hint, boost::move(v)); } -#if !defined(BOOST_NO_0X_HDR_INITIALIZER_LIST) - void insert(std::initializer_list<value_type> list) - { - table_.insert_range(list.begin(), list.end()); - } #endif - iterator erase(const_iterator position) + template <typename A0> + std::pair<iterator, bool> emplace(BOOST_FWD_REF(A0) a0) { - return iterator(table_.erase_return_iterator(get(position))); + return table_.emplace( + boost::unordered::detail::create_emplace_args( + boost::forward<A0>(a0)) + ); } - size_type erase(const key_type& k) + template <typename A0> + iterator emplace_hint(const_iterator, BOOST_FWD_REF(A0) a0) { - return table_.erase_key(k); + return table_.emplace( + boost::unordered::detail::create_emplace_args( + boost::forward<A0>(a0)) + ).first; } - iterator erase(const_iterator first, const_iterator last) + template <typename A0, typename A1> + std::pair<iterator, bool> emplace( + BOOST_FWD_REF(A0) a0, + BOOST_FWD_REF(A1) a1) { - return iterator(table_.erase_range(get(first), get(last))); + return table_.emplace( + boost::unordered::detail::create_emplace_args( + boost::forward<A0>(a0), + boost::forward<A1>(a1)) + ); } - void quick_erase(const_iterator position) + template <typename A0, typename A1> + iterator emplace_hint(const_iterator, + BOOST_FWD_REF(A0) a0, + BOOST_FWD_REF(A1) a1) { - table_.erase(get(position)); + return table_.emplace( + boost::unordered::detail::create_emplace_args( + boost::forward<A0>(a0), + boost::forward<A1>(a1)) + ).first; } - void erase_return_void(const_iterator position) + template <typename A0, typename A1, typename A2> + std::pair<iterator, bool> emplace( + BOOST_FWD_REF(A0) a0, + BOOST_FWD_REF(A1) a1, + BOOST_FWD_REF(A2) a2) { - table_.erase(get(position)); + return table_.emplace( + boost::unordered::detail::create_emplace_args( + boost::forward<A0>(a0), + boost::forward<A1>(a1), + boost::forward<A2>(a2)) + ); } - void clear() - { - table_.clear(); - } + template <typename A0, typename A1, typename A2> + iterator emplace_hint(const_iterator, + BOOST_FWD_REF(A0) a0, + BOOST_FWD_REF(A1) a1, + BOOST_FWD_REF(A2) a2) + { + return table_.emplace( + boost::unordered::detail::create_emplace_args( + boost::forward<A0>(a0), + boost::forward<A1>(a1), + boost::forward<A2>(a2)) + ).first; + } + +#define BOOST_UNORDERED_EMPLACE(z, n, _) \ + template < \ + BOOST_PP_ENUM_PARAMS_Z(z, n, typename A) \ + > \ + std::pair<iterator, bool> emplace( \ + BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a) \ + ) \ + { \ + return table_.emplace( \ + boost::unordered::detail::create_emplace_args( \ + BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_CALL_FORWARD, \ + a) \ + )); \ + } \ + \ + template < \ + BOOST_PP_ENUM_PARAMS_Z(z, n, typename A) \ + > \ + iterator emplace_hint( \ + const_iterator, \ + BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a) \ + ) \ + { \ + return table_.emplace( \ + boost::unordered::detail::create_emplace_args( \ + BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_CALL_FORWARD, \ + a) \ + )).first; \ + } - void swap(unordered_map& other) - { - table_.swap(other.table_); - } + BOOST_PP_REPEAT_FROM_TO(4, BOOST_UNORDERED_EMPLACE_LIMIT, + BOOST_UNORDERED_EMPLACE, _) - // observers +#undef BOOST_UNORDERED_EMPLACE - hasher hash_function() const - { - return table_.hash_function(); - } +#endif - key_equal key_eq() const + std::pair<iterator, bool> insert(value_type const& x) { - return table_.key_eq(); + return this->emplace(x); } - mapped_type& operator[](const key_type &k) + std::pair<iterator, bool> insert(BOOST_RV_REF(value_type) x) { - return table_[k].second; + return this->emplace(boost::move(x)); } - mapped_type& at(const key_type& k) + iterator insert(const_iterator hint, value_type const& x) { - return table_.at(k).second; + return this->emplace_hint(hint, x); } - mapped_type const& at(const key_type& k) const + iterator insert(const_iterator hint, BOOST_RV_REF(value_type) x) { - return table_.at(k).second; + return this->emplace_hint(hint, boost::move(x)); } - // lookup + template <class InputIt> void insert(InputIt, InputIt); - iterator find(const key_type& k) - { - return iterator(table_.find(k)); - } +#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) + void insert(std::initializer_list<value_type>); +#endif - const_iterator find(const key_type& k) const - { - return const_iterator(table_.find(k)); - } + iterator erase(const_iterator); + size_type erase(const key_type&); + iterator erase(const_iterator, const_iterator); + void quick_erase(const_iterator it) { erase(it); } + void erase_return_void(const_iterator it) { erase(it); } + + void clear(); + void swap(unordered_map&); + + // observers + + hasher hash_function() const; + key_equal key_eq() const; + + mapped_type& operator[](const key_type&); + mapped_type& at(const key_type&); + mapped_type const& at(const key_type&) const; + + // lookup + + iterator find(const key_type&); + const_iterator find(const key_type&) const; template <class CompatibleKey, class CompatibleHash, class CompatiblePredicate> iterator find( - CompatibleKey const& k, - CompatibleHash const& hash, - CompatiblePredicate const& eq) - { - return iterator(table_.find(k, hash, eq)); - } + CompatibleKey const&, + CompatibleHash const&, + CompatiblePredicate const&); template <class CompatibleKey, class CompatibleHash, class CompatiblePredicate> const_iterator find( - CompatibleKey const& k, - CompatibleHash const& hash, - CompatiblePredicate const& eq) const - { - return iterator(table_.find(k, hash, eq)); - } + CompatibleKey const&, + CompatibleHash const&, + CompatiblePredicate const&) const; - size_type count(const key_type& k) const - { - return table_.count(k); - } + size_type count(const key_type&) const; std::pair<iterator, iterator> - equal_range(const key_type& k) - { - return boost::unordered_detail::pair_cast< - iterator, iterator>( - table_.equal_range(k)); - } - + equal_range(const key_type&); std::pair<const_iterator, const_iterator> - equal_range(const key_type& k) const - { - return boost::unordered_detail::pair_cast< - const_iterator, const_iterator>( - table_.equal_range(k)); - } + equal_range(const key_type&) const; // bucket interface @@ -492,24 +459,24 @@ namespace boost return table_.max_bucket_count(); } - size_type bucket_size(size_type n) const - { - return table_.bucket_size(n); - } + size_type bucket_size(size_type) const; size_type bucket(const key_type& k) const { - return table_.bucket_index(k); + return table::to_bucket(table_.bucket_count_, + table_.hash(k)); } local_iterator begin(size_type n) { - return local_iterator(table_.bucket_begin(n)); + return local_iterator( + table_.begin(n), n, table_.bucket_count_); } const_local_iterator begin(size_type n) const { - return const_local_iterator(table_.bucket_begin(n)); + return const_local_iterator( + table_.begin(n), n, table_.bucket_count_); } local_iterator end(size_type) @@ -524,7 +491,8 @@ namespace boost const_local_iterator cbegin(size_type n) const { - return const_local_iterator(table_.bucket_begin(n)); + return const_local_iterator( + table_.begin(n), n, table_.bucket_count_); } const_local_iterator cend(size_type) const @@ -534,67 +502,30 @@ namespace boost // hash policy - float load_factor() const - { - return table_.load_factor(); - } - float max_load_factor() const { return table_.mlf_; } - void max_load_factor(float m) - { - table_.max_load_factor(m); - } + float load_factor() const; + void max_load_factor(float); + void rehash(size_type); + void reserve(size_type); - void rehash(size_type n) - { - table_.rehash(n); - } - #if !BOOST_WORKAROUND(__BORLANDC__, < 0x0582) - friend bool operator==<K, T, H, P, A>( - unordered_map const&, unordered_map const&); - friend bool operator!=<K, T, H, P, A>( - unordered_map const&, unordered_map const&); + friend bool operator==<K,T,H,P,A>( + unordered_map const&, unordered_map const&); + friend bool operator!=<K,T,H,P,A>( + unordered_map const&, unordered_map const&); #endif }; // class template unordered_map template <class K, class T, class H, class P, class A> - inline bool operator==(unordered_map<K, T, H, P, A> const& m1, - unordered_map<K, T, H, P, A> const& m2) - { -#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613)) - struct dummy { unordered_map<K,T,H,P,A> x; }; -#endif - return m1.table_.equals(m2.table_); - } - - template <class K, class T, class H, class P, class A> - inline bool operator!=(unordered_map<K, T, H, P, A> const& m1, - unordered_map<K, T, H, P, A> const& m2) - { -#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613)) - struct dummy { unordered_map<K,T,H,P,A> x; }; -#endif - return !m1.table_.equals(m2.table_); - } - - template <class K, class T, class H, class P, class A> - inline void swap(unordered_map<K, T, H, P, A> &m1, - unordered_map<K, T, H, P, A> &m2) - { -#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613)) - struct dummy { unordered_map<K,T,H,P,A> x; }; -#endif - m1.swap(m2); - } - - template <class K, class T, class H, class P, class A> class unordered_multimap { +#if defined(BOOST_UNORDERED_USE_MOVE) + BOOST_COPYABLE_AND_MOVABLE(unordered_multimap) +#endif public: typedef K key_type; @@ -604,180 +535,130 @@ namespace boost typedef P key_equal; typedef A allocator_type; -#if !BOOST_WORKAROUND(__BORLANDC__, < 0x0582) private: -#endif - - typedef BOOST_DEDUCED_TYPENAME - boost::unordered_detail::rebind_wrap< - allocator_type, value_type>::type - value_allocator; - typedef boost::unordered_detail::multimap<K, H, P, - value_allocator> types; - typedef BOOST_DEDUCED_TYPENAME types::impl table; - - typedef BOOST_DEDUCED_TYPENAME types::iterator_base iterator_base; + typedef boost::unordered::detail::multimap<A, K, T, H, P> types; + typedef typename types::traits allocator_traits; + typedef typename types::table table; public: - typedef BOOST_DEDUCED_TYPENAME - value_allocator::pointer pointer; - typedef BOOST_DEDUCED_TYPENAME - value_allocator::const_pointer const_pointer; - typedef BOOST_DEDUCED_TYPENAME - value_allocator::reference reference; - typedef BOOST_DEDUCED_TYPENAME - value_allocator::const_reference const_reference; + typedef typename allocator_traits::pointer pointer; + typedef typename allocator_traits::const_pointer const_pointer; + + typedef value_type& reference; + typedef value_type const& const_reference; typedef std::size_t size_type; typedef std::ptrdiff_t difference_type; - typedef boost::unordered_detail::hash_const_local_iterator< - value_allocator, boost::unordered_detail::grouped> - const_local_iterator; - typedef boost::unordered_detail::hash_local_iterator< - value_allocator, boost::unordered_detail::grouped> - local_iterator; - typedef boost::unordered_detail::hash_const_iterator< - value_allocator, boost::unordered_detail::grouped> - const_iterator; - typedef boost::unordered_detail::hash_iterator< - value_allocator, boost::unordered_detail::grouped> - iterator; + typedef typename table::cl_iterator const_local_iterator; + typedef typename table::l_iterator local_iterator; + typedef typename table::c_iterator const_iterator; + typedef typename table::iterator iterator; -#if !BOOST_WORKAROUND(__BORLANDC__, < 0x0582) private: -#endif table table_; - BOOST_DEDUCED_TYPENAME types::iterator_base const& - get(const_iterator const& it) - { - return boost::unordered_detail::iterator_access::get(it); - } - public: - // construct/destroy/copy + // constructors explicit unordered_multimap( - size_type n = boost::unordered_detail::default_bucket_count, - const hasher &hf = hasher(), - const key_equal &eql = key_equal(), - const allocator_type &a = allocator_type()) - : table_(n, hf, eql, a) - { - } - - explicit unordered_multimap(allocator_type const& a) - : table_(boost::unordered_detail::default_bucket_count, - hasher(), key_equal(), a) - { - } + size_type = boost::unordered::detail::default_bucket_count, + const hasher& = hasher(), + const key_equal& = key_equal(), + const allocator_type& = allocator_type()); - unordered_multimap(unordered_multimap const& other, - allocator_type const& a) - : table_(other.table_, a) - { - } + explicit unordered_multimap(allocator_type const&); template <class InputIt> - unordered_multimap(InputIt f, InputIt l) - : table_(boost::unordered_detail::initial_size(f, l), - hasher(), key_equal(), allocator_type()) - { - table_.insert_range(f, l); - } + unordered_multimap(InputIt, InputIt); template <class InputIt> - unordered_multimap(InputIt f, InputIt l, - size_type n, - const hasher &hf = hasher(), - const key_equal &eql = key_equal()) - : table_(boost::unordered_detail::initial_size(f, l, n), - hf, eql, allocator_type()) - { - table_.insert_range(f, l); - } + unordered_multimap( + InputIt, InputIt, + size_type, + const hasher& = hasher(), + const key_equal& = key_equal()); template <class InputIt> - unordered_multimap(InputIt f, InputIt l, - size_type n, - const hasher &hf, - const key_equal &eql, - const allocator_type &a) - : table_(boost::unordered_detail::initial_size(f, l, n), hf, eql, a) - { - table_.insert_range(f, l); - } + unordered_multimap( + InputIt, InputIt, + size_type, + const hasher&, + const key_equal&, + const allocator_type&); - ~unordered_multimap() {} + // copy/move constructors -#if !defined(BOOST_NO_RVALUE_REFERENCES) - unordered_multimap(unordered_multimap const& other) - : table_(other.table_) + unordered_multimap(unordered_multimap const&); + + unordered_multimap(unordered_multimap const&, allocator_type const&); + +#if defined(BOOST_UNORDERED_USE_MOVE) + unordered_multimap(BOOST_RV_REF(unordered_multimap) other) + : table_(other.table_, boost::unordered::detail::move_tag()) { } - +#elif !defined(BOOST_NO_RVALUE_REFERENCES) unordered_multimap(unordered_multimap&& other) - : table_(other.table_, boost::unordered_detail::move_tag()) + : table_(other.table_, boost::unordered::detail::move_tag()) { } +#endif - unordered_multimap(unordered_multimap&& other, allocator_type const& a) - : table_(other.table_, a, boost::unordered_detail::move_tag()) - { - } +#if !defined(BOOST_NO_RVALUE_REFERENCES) + unordered_multimap(unordered_multimap&&, allocator_type const&); +#endif - unordered_multimap& operator=(unordered_multimap const& x) +#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) + unordered_multimap( + std::initializer_list<value_type>, + size_type = boost::unordered::detail::default_bucket_count, + const hasher& = hasher(), + const key_equal&l = key_equal(), + const allocator_type& = allocator_type()); +#endif + + // Destructor + + ~unordered_multimap(); + + // Assign + +#if defined(BOOST_UNORDERED_USE_MOVE) + unordered_multimap& operator=( + BOOST_COPY_ASSIGN_REF(unordered_multimap) x) { - table_ = x.table_; + table_.assign(x.table_); return *this; } - unordered_multimap& operator=(unordered_multimap&& x) + unordered_multimap& operator=(BOOST_RV_REF(unordered_multimap) x) { - table_.move(x.table_); + table_.move_assign(x.table_); return *this; } #else - unordered_multimap(boost::unordered_detail::move_from< - unordered_multimap<K, T, H, P, A> - > other) - : table_(other.source.table_, boost::unordered_detail::move_tag()) + unordered_multimap& operator=(unordered_multimap const& x) { + table_.assign(x.table_); + return *this; } -#if !BOOST_WORKAROUND(__BORLANDC__, < 0x0593) - unordered_multimap& operator=(unordered_multimap x) +#if !defined(BOOST_NO_RVALUE_REFERENCES) + unordered_multimap& operator=(unordered_multimap&& x) { - table_.move(x.table_); + table_.move_assign(x.table_); return *this; } #endif #endif -#if !defined(BOOST_NO_0X_HDR_INITIALIZER_LIST) - unordered_multimap(std::initializer_list<value_type> list, - size_type n = boost::unordered_detail::default_bucket_count, - const hasher &hf = hasher(), - const key_equal &eql = key_equal(), - const allocator_type &a = allocator_type()) - : table_(boost::unordered_detail::initial_size( - list.begin(), list.end(), n), - hf, eql, a) - { - table_.insert_range(list.begin(), list.end()); - } - - unordered_multimap& operator=(std::initializer_list<value_type> list) - { - table_.clear(); - table_.insert_range(list.begin(), list.end()); - return *this; - } +#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) + unordered_multimap& operator=(std::initializer_list<value_type>); #endif allocator_type get_allocator() const @@ -797,227 +678,253 @@ namespace boost return table_.size_; } - size_type max_size() const - { - return table_.max_size(); - } + size_type max_size() const; // iterators iterator begin() { - return iterator(table_.begin()); + return table_.begin(); } const_iterator begin() const { - return const_iterator(table_.begin()); + return table_.begin(); } iterator end() { - return iterator(table_.end()); + return iterator(); } const_iterator end() const { - return const_iterator(table_.end()); + return const_iterator(); } const_iterator cbegin() const { - return const_iterator(table_.begin()); + return table_.begin(); } const_iterator cend() const { - return const_iterator(table_.end()); + return const_iterator(); } - // modifiers + // emplace -#if defined(BOOST_UNORDERED_STD_FORWARD) +#if !defined(BOOST_NO_VARIADIC_TEMPLATES) template <class... Args> - iterator emplace(Args&&... args) + iterator emplace(BOOST_FWD_REF(Args)... args) { - return iterator(table_.emplace(std::forward<Args>(args)...)); + return table_.emplace(boost::forward<Args>(args)...); } template <class... Args> - iterator emplace_hint(const_iterator, Args&&... args) + iterator emplace_hint(const_iterator, BOOST_FWD_REF(Args)... args) { - return iterator(table_.emplace(std::forward<Args>(args)...)); + return table_.emplace(boost::forward<Args>(args)...); } #else - #if !BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x5100)) - iterator emplace(value_type const& v = value_type()) - { - return iterator(table_.emplace(v)); - } - - iterator emplace_hint(const_iterator, - value_type const& v = value_type()) - { - return iterator(table_.emplace(v)); - } - #endif - -#define BOOST_UNORDERED_EMPLACE(z, n, _) \ - template < \ - BOOST_UNORDERED_TEMPLATE_ARGS(z, n) \ - > \ - iterator emplace( \ - BOOST_UNORDERED_FUNCTION_PARAMS(z, n) \ - ) \ - { \ - return iterator( \ - table_.emplace( \ - BOOST_UNORDERED_CALL_PARAMS(z, n) \ - )); \ - } \ - \ - template < \ - BOOST_UNORDERED_TEMPLATE_ARGS(z, n) \ - > \ - iterator emplace_hint(const_iterator, \ - BOOST_UNORDERED_FUNCTION_PARAMS(z, n) \ - ) \ - { \ - return iterator(table_.emplace( \ - BOOST_UNORDERED_CALL_PARAMS(z, n) \ - )); \ - } - - BOOST_PP_REPEAT_FROM_TO(1, BOOST_UNORDERED_EMPLACE_LIMIT, - BOOST_UNORDERED_EMPLACE, _) - -#undef BOOST_UNORDERED_EMPLACE +#if !BOOST_WORKAROUND(__SUNPRO_CC, BOOST_TESTED_AT(0x5100)) -#endif + // 0 argument emplace requires special treatment in case + // the container is instantiated with a value type that + // doesn't have a default constructor. - iterator insert(const value_type& obj) + iterator emplace( + boost::unordered::detail::empty_emplace + = boost::unordered::detail::empty_emplace(), + value_type v = value_type()) { - return iterator(table_.emplace(obj)); + return this->emplace(boost::move(v)); } - iterator insert(const_iterator, const value_type& obj) + iterator emplace_hint(const_iterator hint, + boost::unordered::detail::empty_emplace + = boost::unordered::detail::empty_emplace(), + value_type v = value_type() + ) { - return iterator(table_.emplace(obj)); + return this->emplace_hint(hint, boost::move(v)); } - template <class InputIt> - void insert(InputIt first, InputIt last) +#endif + + template <typename A0> + iterator emplace(BOOST_FWD_REF(A0) a0) { - table_.insert_range(first, last); + return table_.emplace( + boost::unordered::detail::create_emplace_args( + boost::forward<A0>(a0)) + ); } -#if !defined(BOOST_NO_0X_HDR_INITIALIZER_LIST) - void insert(std::initializer_list<value_type> list) + template <typename A0> + iterator emplace_hint(const_iterator, BOOST_FWD_REF(A0) a0) { - table_.insert_range(list.begin(), list.end()); + return table_.emplace( + boost::unordered::detail::create_emplace_args( + boost::forward<A0>(a0)) + ); } -#endif - iterator erase(const_iterator position) + template <typename A0, typename A1> + iterator emplace( + BOOST_FWD_REF(A0) a0, + BOOST_FWD_REF(A1) a1) { - return iterator(table_.erase_return_iterator(get(position))); + return table_.emplace( + boost::unordered::detail::create_emplace_args( + boost::forward<A0>(a0), + boost::forward<A1>(a1)) + ); } - size_type erase(const key_type& k) + template <typename A0, typename A1> + iterator emplace_hint(const_iterator, + BOOST_FWD_REF(A0) a0, + BOOST_FWD_REF(A1) a1) { - return table_.erase_key(k); + return table_.emplace( + boost::unordered::detail::create_emplace_args( + boost::forward<A0>(a0), + boost::forward<A1>(a1)) + ); } - iterator erase(const_iterator first, const_iterator last) + template <typename A0, typename A1, typename A2> + iterator emplace( + BOOST_FWD_REF(A0) a0, + BOOST_FWD_REF(A1) a1, + BOOST_FWD_REF(A2) a2) { - return iterator(table_.erase_range(get(first), get(last))); + return table_.emplace( + boost::unordered::detail::create_emplace_args( + boost::forward<A0>(a0), + boost::forward<A1>(a1), + boost::forward<A2>(a2)) + ); } - void quick_erase(const_iterator position) + template <typename A0, typename A1, typename A2> + iterator emplace_hint(const_iterator, + BOOST_FWD_REF(A0) a0, + BOOST_FWD_REF(A1) a1, + BOOST_FWD_REF(A2) a2) + { + return table_.emplace( + boost::unordered::detail::create_emplace_args( + boost::forward<A0>(a0), + boost::forward<A1>(a1), + boost::forward<A2>(a2)) + ); + } + +#define BOOST_UNORDERED_EMPLACE(z, n, _) \ + template < \ + BOOST_PP_ENUM_PARAMS_Z(z, n, typename A) \ + > \ + iterator emplace( \ + BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a) \ + ) \ + { \ + return table_.emplace( \ + boost::unordered::detail::create_emplace_args( \ + BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_CALL_FORWARD, \ + a) \ + )); \ + } \ + \ + template < \ + BOOST_PP_ENUM_PARAMS_Z(z, n, typename A) \ + > \ + iterator emplace_hint( \ + const_iterator, \ + BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_FWD_PARAM, a) \ + ) \ + { \ + return table_.emplace( \ + boost::unordered::detail::create_emplace_args( \ + BOOST_PP_ENUM_##z(n, BOOST_UNORDERED_CALL_FORWARD, \ + a) \ + )); \ + } + + BOOST_PP_REPEAT_FROM_TO(4, BOOST_UNORDERED_EMPLACE_LIMIT, + BOOST_UNORDERED_EMPLACE, _) + +#undef BOOST_UNORDERED_EMPLACE + +#endif + + iterator insert(value_type const& x) { - table_.erase(get(position)); + return this->emplace(x); } - void erase_return_void(const_iterator position) + iterator insert(BOOST_RV_REF(value_type) x) { - table_.erase(get(position)); + return this->emplace(boost::move(x)); } - void clear() + iterator insert(const_iterator hint, value_type const& x) { - table_.clear(); + return this->emplace_hint(hint, x); } - void swap(unordered_multimap& other) + iterator insert(const_iterator hint, BOOST_RV_REF(value_type) x) { - table_.swap(other.table_); + return this->emplace_hint(hint, boost::move(x)); } - // observers + template <class InputIt> void insert(InputIt, InputIt); - hasher hash_function() const - { - return table_.hash_function(); - } +#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) + void insert(std::initializer_list<value_type>); +#endif - key_equal key_eq() const - { - return table_.key_eq(); - } + iterator erase(const_iterator); + size_type erase(const key_type&); + iterator erase(const_iterator, const_iterator); + void quick_erase(const_iterator it) { erase(it); } + void erase_return_void(const_iterator it) { erase(it); } - // lookup + void clear(); + void swap(unordered_multimap&); - iterator find(const key_type& k) - { - return iterator(table_.find(k)); - } + // observers - const_iterator find(const key_type& k) const - { - return const_iterator(table_.find(k)); - } + hasher hash_function() const; + key_equal key_eq() const; + + // lookup + + iterator find(const key_type&); + const_iterator find(const key_type&) const; template <class CompatibleKey, class CompatibleHash, class CompatiblePredicate> iterator find( - CompatibleKey const& k, - CompatibleHash const& hash, - CompatiblePredicate const& eq) - { - return iterator(table_.find(k, hash, eq)); - } + CompatibleKey const&, + CompatibleHash const&, + CompatiblePredicate const&); template <class CompatibleKey, class CompatibleHash, class CompatiblePredicate> const_iterator find( - CompatibleKey const& k, - CompatibleHash const& hash, - CompatiblePredicate const& eq) const - { - return iterator(table_.find(k, hash, eq)); - } + CompatibleKey const&, + CompatibleHash const&, + CompatiblePredicate const&) const; - size_type count(const key_type& k) const - { - return table_.count(k); - } + size_type count(const key_type&) const; std::pair<iterator, iterator> - equal_range(const key_type& k) - { - return boost::unordered_detail::pair_cast< - iterator, iterator>( - table_.equal_range(k)); - } - + equal_range(const key_type&); std::pair<const_iterator, const_iterator> - equal_range(const key_type& k) const - { - return boost::unordered_detail::pair_cast< - const_iterator, const_iterator>( - table_.equal_range(k)); - } + equal_range(const key_type&) const; // bucket interface @@ -1031,24 +938,24 @@ namespace boost return table_.max_bucket_count(); } - size_type bucket_size(size_type n) const - { - return table_.bucket_size(n); - } + size_type bucket_size(size_type) const; size_type bucket(const key_type& k) const { - return table_.bucket_index(k); + return table::to_bucket(table_.bucket_count_, + table_.hash(k)); } local_iterator begin(size_type n) { - return local_iterator(table_.bucket_begin(n)); + return local_iterator( + table_.begin(n), n, table_.bucket_count_); } const_local_iterator begin(size_type n) const { - return const_local_iterator(table_.bucket_begin(n)); + return const_local_iterator( + table_.begin(n), n, table_.bucket_count_); } local_iterator end(size_type) @@ -1063,7 +970,8 @@ namespace boost const_local_iterator cbegin(size_type n) const { - return const_local_iterator(table_.bucket_begin(n)); + return const_local_iterator( + table_.begin(n), n, table_.bucket_count_); } const_local_iterator cend(size_type) const @@ -1073,37 +981,640 @@ namespace boost // hash policy - float load_factor() const - { - return table_.load_factor(); - } - float max_load_factor() const { return table_.mlf_; } - void max_load_factor(float m) - { - table_.max_load_factor(m); - } - - void rehash(size_type n) - { - table_.rehash(n); - } + float load_factor() const; + void max_load_factor(float); + void rehash(size_type); + void reserve(size_type); #if !BOOST_WORKAROUND(__BORLANDC__, < 0x0582) - friend bool operator==<K, T, H, P, A>( - unordered_multimap const&, unordered_multimap const&); - friend bool operator!=<K, T, H, P, A>( - unordered_multimap const&, unordered_multimap const&); + friend bool operator==<K,T,H,P,A>( + unordered_multimap const&, unordered_multimap const&); + friend bool operator!=<K,T,H,P,A>( + unordered_multimap const&, unordered_multimap const&); #endif }; // class template unordered_multimap +//////////////////////////////////////////////////////////////////////////////// + + template <class K, class T, class H, class P, class A> + unordered_map<K,T,H,P,A>::unordered_map( + size_type n, const hasher &hf, const key_equal &eql, + const allocator_type &a) + : table_(n, hf, eql, a) + { + } + + template <class K, class T, class H, class P, class A> + unordered_map<K,T,H,P,A>::unordered_map(allocator_type const& a) + : table_(boost::unordered::detail::default_bucket_count, + hasher(), key_equal(), a) + { + } + + template <class K, class T, class H, class P, class A> + unordered_map<K,T,H,P,A>::unordered_map( + unordered_map const& other, allocator_type const& a) + : table_(other.table_, a) + { + } + + template <class K, class T, class H, class P, class A> + template <class InputIt> + unordered_map<K,T,H,P,A>::unordered_map(InputIt f, InputIt l) + : table_(boost::unordered::detail::initial_size(f, l), + hasher(), key_equal(), allocator_type()) + { + table_.insert_range(f, l); + } + + template <class K, class T, class H, class P, class A> + template <class InputIt> + unordered_map<K,T,H,P,A>::unordered_map( + InputIt f, InputIt l, + size_type n, + const hasher &hf, + const key_equal &eql) + : table_(boost::unordered::detail::initial_size(f, l, n), + hf, eql, allocator_type()) + { + table_.insert_range(f, l); + } + + template <class K, class T, class H, class P, class A> + template <class InputIt> + unordered_map<K,T,H,P,A>::unordered_map( + InputIt f, InputIt l, + size_type n, + const hasher &hf, + const key_equal &eql, + const allocator_type &a) + : table_(boost::unordered::detail::initial_size(f, l, n), hf, eql, a) + { + table_.insert_range(f, l); + } + + template <class K, class T, class H, class P, class A> + unordered_map<K,T,H,P,A>::~unordered_map() {} + + template <class K, class T, class H, class P, class A> + unordered_map<K,T,H,P,A>::unordered_map( + unordered_map const& other) + : table_(other.table_) + { + } + +#if !defined(BOOST_NO_RVALUE_REFERENCES) + + template <class K, class T, class H, class P, class A> + unordered_map<K,T,H,P,A>::unordered_map( + unordered_map&& other, allocator_type const& a) + : table_(other.table_, a, boost::unordered::detail::move_tag()) + { + } + +#endif + +#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) + + template <class K, class T, class H, class P, class A> + unordered_map<K,T,H,P,A>::unordered_map( + std::initializer_list<value_type> list, size_type n, + const hasher &hf, const key_equal &eql, const allocator_type &a) + : table_( + boost::unordered::detail::initial_size( + list.begin(), list.end(), n), + hf, eql, a) + { + table_.insert_range(list.begin(), list.end()); + } + + template <class K, class T, class H, class P, class A> + unordered_map<K,T,H,P,A>& unordered_map<K,T,H,P,A>::operator=( + std::initializer_list<value_type> list) + { + table_.clear(); + table_.insert_range(list.begin(), list.end()); + return *this; + } + +#endif + + // size and capacity + + template <class K, class T, class H, class P, class A> + std::size_t unordered_map<K,T,H,P,A>::max_size() const + { + return table_.max_size(); + } + + // modifiers + + template <class K, class T, class H, class P, class A> + template <class InputIt> + void unordered_map<K,T,H,P,A>::insert(InputIt first, InputIt last) + { + table_.insert_range(first, last); + } + +#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) + template <class K, class T, class H, class P, class A> + void unordered_map<K,T,H,P,A>::insert( + std::initializer_list<value_type> list) + { + table_.insert_range(list.begin(), list.end()); + } +#endif + + template <class K, class T, class H, class P, class A> + typename unordered_map<K,T,H,P,A>::iterator + unordered_map<K,T,H,P,A>::erase(const_iterator position) + { + return table_.erase(position); + } + + template <class K, class T, class H, class P, class A> + typename unordered_map<K,T,H,P,A>::size_type + unordered_map<K,T,H,P,A>::erase(const key_type& k) + { + return table_.erase_key(k); + } + + template <class K, class T, class H, class P, class A> + typename unordered_map<K,T,H,P,A>::iterator + unordered_map<K,T,H,P,A>::erase( + const_iterator first, const_iterator last) + { + return table_.erase_range(first, last); + } + + template <class K, class T, class H, class P, class A> + void unordered_map<K,T,H,P,A>::clear() + { + table_.clear(); + } + + template <class K, class T, class H, class P, class A> + void unordered_map<K,T,H,P,A>::swap(unordered_map& other) + { + table_.swap(other.table_); + } + + // observers + + template <class K, class T, class H, class P, class A> + typename unordered_map<K,T,H,P,A>::hasher + unordered_map<K,T,H,P,A>::hash_function() const + { + return table_.hash_function(); + } + + template <class K, class T, class H, class P, class A> + typename unordered_map<K,T,H,P,A>::key_equal + unordered_map<K,T,H,P,A>::key_eq() const + { + return table_.key_eq(); + } + + template <class K, class T, class H, class P, class A> + typename unordered_map<K,T,H,P,A>::mapped_type& + unordered_map<K,T,H,P,A>::operator[](const key_type &k) + { + return table_[k].second; + } + + template <class K, class T, class H, class P, class A> + typename unordered_map<K,T,H,P,A>::mapped_type& + unordered_map<K,T,H,P,A>::at(const key_type& k) + { + return table_.at(k).second; + } + + template <class K, class T, class H, class P, class A> + typename unordered_map<K,T,H,P,A>::mapped_type const& + unordered_map<K,T,H,P,A>::at(const key_type& k) const + { + return table_.at(k).second; + } + + // lookup + + template <class K, class T, class H, class P, class A> + typename unordered_map<K,T,H,P,A>::iterator + unordered_map<K,T,H,P,A>::find(const key_type& k) + { + return table_.find_node(k); + } + + template <class K, class T, class H, class P, class A> + typename unordered_map<K,T,H,P,A>::const_iterator + unordered_map<K,T,H,P,A>::find(const key_type& k) const + { + return table_.find_node(k); + } + + template <class K, class T, class H, class P, class A> + template <class CompatibleKey, class CompatibleHash, + class CompatiblePredicate> + typename unordered_map<K,T,H,P,A>::iterator + unordered_map<K,T,H,P,A>::find( + CompatibleKey const& k, + CompatibleHash const& hash, + CompatiblePredicate const& eq) + { + return table_.generic_find_node(k, hash, eq); + } + + template <class K, class T, class H, class P, class A> + template <class CompatibleKey, class CompatibleHash, + class CompatiblePredicate> + typename unordered_map<K,T,H,P,A>::const_iterator + unordered_map<K,T,H,P,A>::find( + CompatibleKey const& k, + CompatibleHash const& hash, + CompatiblePredicate const& eq) const + { + return table_.generic_find_node(k, hash, eq); + } + + template <class K, class T, class H, class P, class A> + typename unordered_map<K,T,H,P,A>::size_type + unordered_map<K,T,H,P,A>::count(const key_type& k) const + { + return table_.count(k); + } + + template <class K, class T, class H, class P, class A> + std::pair< + typename unordered_map<K,T,H,P,A>::iterator, + typename unordered_map<K,T,H,P,A>::iterator> + unordered_map<K,T,H,P,A>::equal_range(const key_type& k) + { + return table_.equal_range(k); + } + + template <class K, class T, class H, class P, class A> + std::pair< + typename unordered_map<K,T,H,P,A>::const_iterator, + typename unordered_map<K,T,H,P,A>::const_iterator> + unordered_map<K,T,H,P,A>::equal_range(const key_type& k) const + { + return table_.equal_range(k); + } + + template <class K, class T, class H, class P, class A> + typename unordered_map<K,T,H,P,A>::size_type + unordered_map<K,T,H,P,A>::bucket_size(size_type n) const + { + return table_.bucket_size(n); + } + + // hash policy + + template <class K, class T, class H, class P, class A> + float unordered_map<K,T,H,P,A>::load_factor() const + { + return table_.load_factor(); + } + + template <class K, class T, class H, class P, class A> + void unordered_map<K,T,H,P,A>::max_load_factor(float m) + { + table_.max_load_factor(m); + } + + template <class K, class T, class H, class P, class A> + void unordered_map<K,T,H,P,A>::rehash(size_type n) + { + table_.rehash(n); + } + + template <class K, class T, class H, class P, class A> + void unordered_map<K,T,H,P,A>::reserve(size_type n) + { + table_.reserve(n); + } + + template <class K, class T, class H, class P, class A> + inline bool operator==( + unordered_map<K,T,H,P,A> const& m1, + unordered_map<K,T,H,P,A> const& m2) + { +#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613)) + struct dummy { unordered_map<K,T,H,P,A> x; }; +#endif + return m1.table_.equals(m2.table_); + } + + template <class K, class T, class H, class P, class A> + inline bool operator!=( + unordered_map<K,T,H,P,A> const& m1, + unordered_map<K,T,H,P,A> const& m2) + { +#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613)) + struct dummy { unordered_map<K,T,H,P,A> x; }; +#endif + return !m1.table_.equals(m2.table_); + } + + template <class K, class T, class H, class P, class A> + inline void swap( + unordered_map<K,T,H,P,A> &m1, + unordered_map<K,T,H,P,A> &m2) + { +#if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613)) + struct dummy { unordered_map<K,T,H,P,A> x; }; +#endif + m1.swap(m2); + } + +//////////////////////////////////////////////////////////////////////////////// + + template <class K, class T, class H, class P, class A> + unordered_multimap<K,T,H,P,A>::unordered_multimap( + size_type n, const hasher &hf, const key_equal &eql, + const allocator_type &a) + : table_(n, hf, eql, a) + { + } + + template <class K, class T, class H, class P, class A> + unordered_multimap<K,T,H,P,A>::unordered_multimap(allocator_type const& a) + : table_(boost::unordered::detail::default_bucket_count, + hasher(), key_equal(), a) + { + } + + template <class K, class T, class H, class P, class A> + unordered_multimap<K,T,H,P,A>::unordered_multimap( + unordered_multimap const& other, allocator_type const& a) + : table_(other.table_, a) + { + } + + template <class K, class T, class H, class P, class A> + template <class InputIt> + unordered_multimap<K,T,H,P,A>::unordered_multimap(InputIt f, InputIt l) + : table_(boost::unordered::detail::initial_size(f, l), + hasher(), key_equal(), allocator_type()) + { + table_.insert_range(f, l); + } + + template <class K, class T, class H, class P, class A> + template <class InputIt> + unordered_multimap<K,T,H,P,A>::unordered_multimap( + InputIt f, InputIt l, + size_type n, + const hasher &hf, + const key_equal &eql) + : table_(boost::unordered::detail::initial_size(f, l, n), + hf, eql, allocator_type()) + { + table_.insert_range(f, l); + } + + template <class K, class T, class H, class P, class A> + template <class InputIt> + unordered_multimap<K,T,H,P,A>::unordered_multimap( + InputIt f, InputIt l, + size_type n, + const hasher &hf, + const key_equal &eql, + const allocator_type &a) + : table_(boost::unordered::detail::initial_size(f, l, n), hf, eql, a) + { + table_.insert_range(f, l); + } + + template <class K, class T, class H, class P, class A> + unordered_multimap<K,T,H,P,A>::~unordered_multimap() {} + + template <class K, class T, class H, class P, class A> + unordered_multimap<K,T,H,P,A>::unordered_multimap( + unordered_multimap const& other) + : table_(other.table_) + { + } + +#if !defined(BOOST_NO_RVALUE_REFERENCES) + + template <class K, class T, class H, class P, class A> + unordered_multimap<K,T,H,P,A>::unordered_multimap( + unordered_multimap&& other, allocator_type const& a) + : table_(other.table_, a, boost::unordered::detail::move_tag()) + { + } + +#endif + +#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) + + template <class K, class T, class H, class P, class A> + unordered_multimap<K,T,H,P,A>::unordered_multimap( + std::initializer_list<value_type> list, size_type n, + const hasher &hf, const key_equal &eql, const allocator_type &a) + : table_( + boost::unordered::detail::initial_size( + list.begin(), list.end(), n), + hf, eql, a) + { + table_.insert_range(list.begin(), list.end()); + } + + template <class K, class T, class H, class P, class A> + unordered_multimap<K,T,H,P,A>& unordered_multimap<K,T,H,P,A>::operator=( + std::initializer_list<value_type> list) + { + table_.clear(); + table_.insert_range(list.begin(), list.end()); + return *this; + } + +#endif + + // size and capacity + + template <class K, class T, class H, class P, class A> + std::size_t unordered_multimap<K,T,H,P,A>::max_size() const + { + return table_.max_size(); + } + + // modifiers + + template <class K, class T, class H, class P, class A> + template <class InputIt> + void unordered_multimap<K,T,H,P,A>::insert(InputIt first, InputIt last) + { + table_.insert_range(first, last); + } + +#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST) + template <class K, class T, class H, class P, class A> + void unordered_multimap<K,T,H,P,A>::insert( + std::initializer_list<value_type> list) + { + table_.insert_range(list.begin(), list.end()); + } +#endif + + template <class K, class T, class H, class P, class A> + typename unordered_multimap<K,T,H,P,A>::iterator + unordered_multimap<K,T,H,P,A>::erase(const_iterator position) + { + return table_.erase(position); + } + + template <class K, class T, class H, class P, class A> + typename unordered_multimap<K,T,H,P,A>::size_type + unordered_multimap<K,T,H,P,A>::erase(const key_type& k) + { + return table_.erase_key(k); + } + + template <class K, class T, class H, class P, class A> + typename unordered_multimap<K,T,H,P,A>::iterator + unordered_multimap<K,T,H,P,A>::erase( + const_iterator first, const_iterator last) + { + return table_.erase_range(first, last); + } + + template <class K, class T, class H, class P, class A> + void unordered_multimap<K,T,H,P,A>::clear() + { + table_.clear(); + } + + template <class K, class T, class H, class P, class A> + void unordered_multimap<K,T,H,P,A>::swap(unordered_multimap& other) + { + table_.swap(other.table_); + } + + // observers + + template <class K, class T, class H, class P, class A> + typename unordered_multimap<K,T,H,P,A>::hasher + unordered_multimap<K,T,H,P,A>::hash_function() const + { + return table_.hash_function(); + } + + template <class K, class T, class H, class P, class A> + typename unordered_multimap<K,T,H,P,A>::key_equal + unordered_multimap<K,T,H,P,A>::key_eq() const + { + return table_.key_eq(); + } + + // lookup + + template <class K, class T, class H, class P, class A> + typename unordered_multimap<K,T,H,P,A>::iterator + unordered_multimap<K,T,H,P,A>::find(const key_type& k) + { + return table_.find_node(k); + } + + template <class K, class T, class H, class P, class A> + typename unordered_multimap<K,T,H,P,A>::const_iterator + unordered_multimap<K,T,H,P,A>::find(const key_type& k) const + { + return table_.find_node(k); + } + + template <class K, class T, class H, class P, class A> + template <class CompatibleKey, class CompatibleHash, + class CompatiblePredicate> + typename unordered_multimap<K,T,H,P,A>::iterator + unordered_multimap<K,T,H,P,A>::find( + CompatibleKey const& k, + CompatibleHash const& hash, + CompatiblePredicate const& eq) + { + return table_.generic_find_node(k, hash, eq); + } + + template <class K, class T, class H, class P, class A> + template <class CompatibleKey, class CompatibleHash, + class CompatiblePredicate> + typename unordered_multimap<K,T,H,P,A>::const_iterator + unordered_multimap<K,T,H,P,A>::find( + CompatibleKey const& k, + CompatibleHash const& hash, + CompatiblePredicate const& eq) const + { + return table_.generic_find_node(k, hash, eq); + } + + template <class K, class T, class H, class P, class A> + typename unordered_multimap<K,T,H,P,A>::size_type + unordered_multimap<K,T,H,P,A>::count(const key_type& k) const + { + return table_.count(k); + } + + template <class K, class T, class H, class P, class A> + std::pair< + typename unordered_multimap<K,T,H,P,A>::iterator, + typename unordered_multimap<K,T,H,P,A>::iterator> + unordered_multimap<K,T,H,P,A>::equal_range(const key_type& k) + { + return table_.equal_range(k); + } + + template <class K, class T, class H, class P, class A> + std::pair< + typename unordered_multimap<K,T,H,P,A>::const_iterator, + typename unordered_multimap<K,T,H,P,A>::const_iterator> + unordered_multimap<K,T,H,P,A>::equal_range(const key_type& k) const + { + return table_.equal_range(k); + } + + template <class K, class T, class H, class P, class A> + typename unordered_multimap<K,T,H,P,A>::size_type + unordered_multimap<K,T,H,P,A>::bucket_size(size_type n) const + { + return table_.bucket_size(n); + } + + // hash policy + + template <class K, class T, class H, class P, class A> + float unordered_multimap<K,T,H,P,A>::load_factor() const + { + return table_.load_factor(); + } + + template <class K, class T, class H, class P, class A> + void unordered_multimap<K,T,H,P,A>::max_load_factor(float m) + { + table_.max_load_factor(m); + } + + template <class K, class T, class H, class P, class A> + void unordered_multimap<K,T,H,P,A>::rehash(size_type n) + { + table_.rehash(n); + } + + template <class K, class T, class H, class P, class A> + void unordered_multimap<K,T,H,P,A>::reserve(size_type n) + { + table_.reserve(n); + } + template <class K, class T, class H, class P, class A> - inline bool operator==(unordered_multimap<K, T, H, P, A> const& m1, - unordered_multimap<K, T, H, P, A> const& m2) + inline bool operator==( + unordered_multimap<K,T,H,P,A> const& m1, + unordered_multimap<K,T,H,P,A> const& m2) { #if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613)) struct dummy { unordered_multimap<K,T,H,P,A> x; }; @@ -1112,8 +1623,9 @@ namespace boost } template <class K, class T, class H, class P, class A> - inline bool operator!=(unordered_multimap<K, T, H, P, A> const& m1, - unordered_multimap<K, T, H, P, A> const& m2) + inline bool operator!=( + unordered_multimap<K,T,H,P,A> const& m1, + unordered_multimap<K,T,H,P,A> const& m2) { #if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613)) struct dummy { unordered_multimap<K,T,H,P,A> x; }; @@ -1122,8 +1634,9 @@ namespace boost } template <class K, class T, class H, class P, class A> - inline void swap(unordered_multimap<K, T, H, P, A> &m1, - unordered_multimap<K, T, H, P, A> &m2) + inline void swap( + unordered_multimap<K,T,H,P,A> &m1, + unordered_multimap<K,T,H,P,A> &m2) { #if BOOST_WORKAROUND(__CODEGEARC__, BOOST_TESTED_AT(0x0613)) struct dummy { unordered_multimap<K,T,H,P,A> x; }; @@ -1131,6 +1644,7 @@ namespace boost m1.swap(m2); } +} // namespace unordered } // namespace boost #if defined(BOOST_MSVC) diff --git a/3rdParty/Boost/src/boost/unordered/unordered_map_fwd.hpp b/3rdParty/Boost/src/boost/unordered/unordered_map_fwd.hpp index edecc5d..980bb3e 100644 --- a/3rdParty/Boost/src/boost/unordered/unordered_map_fwd.hpp +++ b/3rdParty/Boost/src/boost/unordered/unordered_map_fwd.hpp @@ -1,5 +1,5 @@ -// Copyright (C) 2008-2009 Daniel James. +// Copyright (C) 2008-2011 Daniel James. // 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) @@ -14,40 +14,52 @@ #include <memory> #include <functional> #include <boost/functional/hash_fwd.hpp> +#include <boost/unordered/detail/fwd.hpp> namespace boost { - template <class K, - class T, - class H = hash<K>, - class P = std::equal_to<K>, - class A = std::allocator<std::pair<const K, T> > > - class unordered_map; - template <class K, class T, class H, class P, class A> - inline bool operator==(unordered_map<K, T, H, P, A> const&, - unordered_map<K, T, H, P, A> const&); - template <class K, class T, class H, class P, class A> - inline bool operator!=(unordered_map<K, T, H, P, A> const&, - unordered_map<K, T, H, P, A> const&); - template <class K, class T, class H, class P, class A> - inline void swap(unordered_map<K, T, H, P, A>&, - unordered_map<K, T, H, P, A>&); - - template <class K, - class T, - class H = hash<K>, - class P = std::equal_to<K>, - class A = std::allocator<std::pair<const K, T> > > - class unordered_multimap; - template <class K, class T, class H, class P, class A> - inline bool operator==(unordered_multimap<K, T, H, P, A> const&, - unordered_multimap<K, T, H, P, A> const&); - template <class K, class T, class H, class P, class A> - inline bool operator!=(unordered_multimap<K, T, H, P, A> const&, - unordered_multimap<K, T, H, P, A> const&); - template <class K, class T, class H, class P, class A> - inline void swap(unordered_multimap<K, T, H, P, A>&, - unordered_multimap<K, T, H, P, A>&); + namespace unordered + { + template <class K, + class T, + class H = boost::hash<K>, + class P = std::equal_to<K>, + class A = std::allocator<std::pair<const K, T> > > + class unordered_map; + + template <class K, class T, class H, class P, class A> + inline bool operator==(unordered_map<K, T, H, P, A> const&, + unordered_map<K, T, H, P, A> const&); + template <class K, class T, class H, class P, class A> + inline bool operator!=(unordered_map<K, T, H, P, A> const&, + unordered_map<K, T, H, P, A> const&); + template <class K, class T, class H, class P, class A> + inline void swap(unordered_map<K, T, H, P, A>&, + unordered_map<K, T, H, P, A>&); + + template <class K, + class T, + class H = boost::hash<K>, + class P = std::equal_to<K>, + class A = std::allocator<std::pair<const K, T> > > + class unordered_multimap; + + template <class K, class T, class H, class P, class A> + inline bool operator==(unordered_multimap<K, T, H, P, A> const&, + unordered_multimap<K, T, H, P, A> const&); + template <class K, class T, class H, class P, class A> + inline bool operator!=(unordered_multimap<K, T, H, P, A> const&, + unordered_multimap<K, T, H, P, A> const&); + template <class K, class T, class H, class P, class A> + inline void swap(unordered_multimap<K, T, H, P, A>&, + unordered_multimap<K, T, H, P, A>&); + } + + using boost::unordered::unordered_map; + using boost::unordered::unordered_multimap; + using boost::unordered::swap; + using boost::unordered::operator==; + using boost::unordered::operator!=; } #endif diff --git a/3rdParty/Boost/src/boost/utility.hpp b/3rdParty/Boost/src/boost/utility.hpp index b909f29..82177c8 100644 --- a/3rdParty/Boost/src/boost/utility.hpp +++ b/3rdParty/Boost/src/boost/utility.hpp @@ -13,6 +13,7 @@ #include <boost/utility/base_from_member.hpp> #include <boost/utility/binary.hpp> #include <boost/utility/enable_if.hpp> +#include <boost/utility/identity_type.hpp> #include <boost/checked_delete.hpp> #include <boost/next_prior.hpp> #include <boost/noncopyable.hpp> diff --git a/3rdParty/Boost/src/boost/utility/declval.hpp b/3rdParty/Boost/src/boost/utility/declval.hpp index 41ec3dc..d74610c 100644 --- a/3rdParty/Boost/src/boost/utility/declval.hpp +++ b/3rdParty/Boost/src/boost/utility/declval.hpp @@ -13,6 +13,7 @@ //----------------------------------------------------------------------------// #include <boost/type_traits/add_rvalue_reference.hpp> +//#include <boost/type_traits/add_lvalue_reference.hpp> //----------------------------------------------------------------------------// // // @@ -36,9 +37,13 @@ namespace boost { +//#if !defined(BOOST_NO_RVALUE_REFERENCES) template <typename T> - typename add_rvalue_reference<T>::type declval(); //noexcept; // as unevaluated operand - + typename add_rvalue_reference<T>::type declval() BOOST_NOEXCEPT; // as unevaluated operand +//#else +// template <typename T> +// typename add_lvalue_reference<T>::type declval() BOOST_NOEXCEPT; // as unevaluated operand +//#endif } // namespace boost #endif // BOOST_TYPE_TRAITS_EXT_DECLVAL__HPP diff --git a/3rdParty/Boost/src/boost/utility/detail/result_of_iterate.hpp b/3rdParty/Boost/src/boost/utility/detail/result_of_iterate.hpp new file mode 100644 index 0000000..17fd4d5 --- /dev/null +++ b/3rdParty/Boost/src/boost/utility/detail/result_of_iterate.hpp @@ -0,0 +1,208 @@ +// Boost result_of library + +// Copyright Douglas Gregor 2004. 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) + +// Copyright Daniel Walker, Eric Niebler, Michel Morin 2008-2012. +// 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) + +// For more information, see http://www.boost.org/libs/utility +#if !defined(BOOST_PP_IS_ITERATING) +# error Boost result_of - do not include this file! +#endif + +// CWPro8 requires an argument in a function type specialization +#if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3002)) && BOOST_PP_ITERATION() == 0 +# define BOOST_RESULT_OF_ARGS void +#else +# define BOOST_RESULT_OF_ARGS BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T) +#endif + +#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) +template<typename F BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)> +struct tr1_result_of<F(BOOST_RESULT_OF_ARGS)> + : mpl::if_< + mpl::or_< is_pointer<F>, is_member_function_pointer<F> > + , boost::detail::tr1_result_of_impl< + typename remove_cv<F>::type, + typename remove_cv<F>::type(BOOST_RESULT_OF_ARGS), + (boost::detail::has_result_type<F>::value)> + , boost::detail::tr1_result_of_impl< + F, + F(BOOST_RESULT_OF_ARGS), + (boost::detail::has_result_type<F>::value)> >::type { }; +#endif + +#ifdef BOOST_RESULT_OF_USE_DECLTYPE + +// Uses declval following N3225 20.7.7.6 when F is not a pointer. +template<typename F BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)> +struct result_of<F(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T))> + : mpl::if_< + is_member_function_pointer<F> + , detail::tr1_result_of_impl< + typename remove_cv<F>::type, + typename remove_cv<F>::type(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)), false + > + , detail::cpp0x_result_of_impl< + F(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)) + > + >::type +{}; + +namespace detail { + +#ifdef BOOST_NO_SFINAE_EXPR + +template<typename F> +struct BOOST_PP_CAT(result_of_callable_fun_2_, BOOST_PP_ITERATION()); + +template<typename R BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(), typename T)> +struct BOOST_PP_CAT(result_of_callable_fun_2_, BOOST_PP_ITERATION())<R(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), T))> { + R operator()(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(), T)) const; + typedef result_of_private_type const &(*pfn_t)(...); + operator pfn_t() const volatile; +}; + +template<typename F> +struct BOOST_PP_CAT(result_of_callable_fun_, BOOST_PP_ITERATION()); + +template<typename F> +struct BOOST_PP_CAT(result_of_callable_fun_, BOOST_PP_ITERATION())<F *> + : BOOST_PP_CAT(result_of_callable_fun_2_, BOOST_PP_ITERATION())<F> +{}; + +template<typename F> +struct BOOST_PP_CAT(result_of_callable_fun_, BOOST_PP_ITERATION())<F &> + : BOOST_PP_CAT(result_of_callable_fun_2_, BOOST_PP_ITERATION())<F> +{}; + +template<typename F> +struct BOOST_PP_CAT(result_of_select_call_wrapper_type_, BOOST_PP_ITERATION()) + : mpl::eval_if< + is_class<typename remove_reference<F>::type>, + result_of_wrap_callable_class<F>, + mpl::identity<BOOST_PP_CAT(result_of_callable_fun_, BOOST_PP_ITERATION())<typename remove_cv<F>::type> > + > +{}; + +template<typename F BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(), typename T)> +struct BOOST_PP_CAT(result_of_is_callable_, BOOST_PP_ITERATION()) { + typedef typename BOOST_PP_CAT(result_of_select_call_wrapper_type_, BOOST_PP_ITERATION())<F>::type wrapper_t; + static const bool value = ( + sizeof(result_of_no_type) == sizeof(detail::result_of_is_private_type( + (boost::declval<wrapper_t>()(BOOST_PP_ENUM_BINARY_PARAMS(BOOST_PP_ITERATION(), boost::declval<T, >() BOOST_PP_INTERCEPT)), result_of_weird_type()) + )) + ); + typedef mpl::bool_<value> type; +}; + +template<typename F BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)> +struct cpp0x_result_of_impl<F(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)), true> + : lazy_enable_if< + BOOST_PP_CAT(result_of_is_callable_, BOOST_PP_ITERATION())<F BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(), T)> + , cpp0x_result_of_impl<F(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)), false> + > +{}; + +template<typename F BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)> +struct cpp0x_result_of_impl<F(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)), false> +{ + typedef decltype( + boost::declval<F>()( + BOOST_PP_ENUM_BINARY_PARAMS(BOOST_PP_ITERATION(), boost::declval<T, >() BOOST_PP_INTERCEPT) + ) + ) type; +}; + +#else // BOOST_NO_SFINAE_EXPR + +template<typename F BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)> +struct cpp0x_result_of_impl<F(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)), + typename result_of_always_void<decltype( + boost::declval<F>()( + BOOST_PP_ENUM_BINARY_PARAMS(BOOST_PP_ITERATION(), boost::declval<T, >() BOOST_PP_INTERCEPT) + ) + )>::type> { + typedef decltype( + boost::declval<F>()( + BOOST_PP_ENUM_BINARY_PARAMS(BOOST_PP_ITERATION(), boost::declval<T, >() BOOST_PP_INTERCEPT) + ) + ) type; +}; + +#endif // BOOST_NO_SFINAE_EXPR + +} // namespace detail + +#else // defined(BOOST_RESULT_OF_USE_DECLTYPE) + +#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) +template<typename F BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)> +struct result_of<F(BOOST_RESULT_OF_ARGS)> + : tr1_result_of<F(BOOST_RESULT_OF_ARGS)> { }; +#endif + +#endif // defined(BOOST_RESULT_OF_USE_DECLTYPE) + +#undef BOOST_RESULT_OF_ARGS + +#if BOOST_PP_ITERATION() >= 1 + +namespace detail { + +template<typename R, typename FArgs BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)> +struct tr1_result_of_impl<R (*)(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)), FArgs, false> +{ + typedef R type; +}; + +template<typename R, typename FArgs BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)> +struct tr1_result_of_impl<R (&)(BOOST_PP_ENUM_PARAMS(BOOST_PP_ITERATION(),T)), FArgs, false> +{ + typedef R type; +}; + +#if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x551)) +template<typename R, typename FArgs BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)> +struct tr1_result_of_impl<R (T0::*) + (BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_ITERATION(),T)), + FArgs, false> +{ + typedef R type; +}; + +template<typename R, typename FArgs BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)> +struct tr1_result_of_impl<R (T0::*) + (BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_ITERATION(),T)) + const, + FArgs, false> +{ + typedef R type; +}; + +template<typename R, typename FArgs BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)> +struct tr1_result_of_impl<R (T0::*) + (BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_ITERATION(),T)) + volatile, + FArgs, false> +{ + typedef R type; +}; + +template<typename R, typename FArgs BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_PP_ITERATION(),typename T)> +struct tr1_result_of_impl<R (T0::*) + (BOOST_PP_ENUM_SHIFTED_PARAMS(BOOST_PP_ITERATION(),T)) + const volatile, + FArgs, false> +{ + typedef R type; +}; +#endif + +} +#endif diff --git a/3rdParty/Boost/src/boost/utility/identity_type.hpp b/3rdParty/Boost/src/boost/utility/identity_type.hpp new file mode 100644 index 0000000..4a1f6c4 --- /dev/null +++ b/3rdParty/Boost/src/boost/utility/identity_type.hpp @@ -0,0 +1,46 @@ + +// Copyright (C) 2009-2012 Lorenzo Caminiti +// Distributed under the Boost Software License, Version 1.0 +// (see accompanying file LICENSE_1_0.txt or a copy at +// http://www.boost.org/LICENSE_1_0.txt) +// Home at http://www.boost.org/libs/utility/identity_type + +/** @file +Wrap type expressions with round parenthesis so they can be passed to macros +even if they contain commas. +*/ + +#ifndef BOOST_IDENTITY_TYPE_HPP_ +#define BOOST_IDENTITY_TYPE_HPP_ + +#include <boost/type_traits/function_traits.hpp> + +/** +@brief This macro allows to wrap the specified type expression within extra +round parenthesis so the type can be passed as a single macro parameter even if +it contains commas (not already wrapped within round parenthesis). + +@Params +@Param{parenthesized_type, +The type expression to be passed as macro parameter wrapped by a single set +of round parenthesis <c>(...)</c>. +This type expression can contain an arbitrary number of commas. +} +@EndParams + +This macro works on any C++03 compiler (it does not use variadic macros). + +This macro must be prefixed by <c>typename</c> when used within templates. +Note that the compiler will not be able to automatically determine function +template parameters when they are wrapped with this macro (these parameters +need to be explicitly specified when calling the function template). + +On some compilers (like GCC), using this macro on abstract types requires to +add and remove a reference to the specified type. +*/ +#define BOOST_IDENTITY_TYPE(parenthesized_type) \ + /* must NOT prefix this with `::` to work with parenthesized syntax */ \ + boost::function_traits< void parenthesized_type >::arg1_type + +#endif // #include guard + diff --git a/3rdParty/Boost/src/boost/utility/result_of.hpp b/3rdParty/Boost/src/boost/utility/result_of.hpp new file mode 100644 index 0000000..f0e084a --- /dev/null +++ b/3rdParty/Boost/src/boost/utility/result_of.hpp @@ -0,0 +1,187 @@ +// Boost result_of library + +// Copyright Douglas Gregor 2004. 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) + +// For more information, see http://www.boost.org/libs/utility +#ifndef BOOST_RESULT_OF_HPP +#define BOOST_RESULT_OF_HPP + +#include <boost/config.hpp> +#include <boost/preprocessor/cat.hpp> +#include <boost/preprocessor/iteration/iterate.hpp> +#include <boost/preprocessor/repetition/enum_params.hpp> +#include <boost/preprocessor/repetition/enum_trailing_params.hpp> +#include <boost/preprocessor/repetition/enum_binary_params.hpp> +#include <boost/preprocessor/repetition/enum_shifted_params.hpp> +#include <boost/preprocessor/facilities/intercept.hpp> +#include <boost/detail/workaround.hpp> +#include <boost/mpl/has_xxx.hpp> +#include <boost/mpl/if.hpp> +#include <boost/mpl/eval_if.hpp> +#include <boost/mpl/bool.hpp> +#include <boost/mpl/identity.hpp> +#include <boost/mpl/or.hpp> +#include <boost/type_traits/is_class.hpp> +#include <boost/type_traits/is_pointer.hpp> +#include <boost/type_traits/is_member_function_pointer.hpp> +#include <boost/type_traits/remove_cv.hpp> +#include <boost/type_traits/remove_reference.hpp> +#include <boost/utility/declval.hpp> +#include <boost/utility/enable_if.hpp> + +#ifndef BOOST_RESULT_OF_NUM_ARGS +# define BOOST_RESULT_OF_NUM_ARGS 16 +#endif + +// Use the decltype-based version of result_of by default if the compiler +// supports N3276 <http://www.open-std.org/JTC1/SC22/WG21/docs/papers/2011/n3276.pdf>. +// The user can force the choice by defining either BOOST_RESULT_OF_USE_DECLTYPE or +// BOOST_RESULT_OF_USE_TR1, but not both! +#if defined(BOOST_RESULT_OF_USE_DECLTYPE) && defined(BOOST_RESULT_OF_USE_TR1) +# error Both BOOST_RESULT_OF_USE_DECLTYPE and BOOST_RESULT_OF_USE_TR1 cannot be defined at the same time. +#endif + +#ifndef BOOST_RESULT_OF_USE_TR1 +# ifndef BOOST_RESULT_OF_USE_DECLTYPE +# ifndef BOOST_NO_DECLTYPE_N3276 // this implies !defined(BOOST_NO_DECLTYPE) +# define BOOST_RESULT_OF_USE_DECLTYPE +# else +# define BOOST_RESULT_OF_USE_TR1 +# endif +# endif +#endif + +namespace boost { + +template<typename F> struct result_of; +template<typename F> struct tr1_result_of; // a TR1-style implementation of result_of + +#if !defined(BOOST_NO_SFINAE) && !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) +namespace detail { + +BOOST_MPL_HAS_XXX_TRAIT_DEF(result_type) + +template<typename F, typename FArgs, bool HasResultType> struct tr1_result_of_impl; + +#ifdef BOOST_NO_SFINAE_EXPR + +struct result_of_private_type {}; + +struct result_of_weird_type { + friend result_of_private_type operator,(result_of_private_type, result_of_weird_type); +}; + +typedef char result_of_yes_type; // sizeof(result_of_yes_type) == 1 +typedef char (&result_of_no_type)[2]; // sizeof(result_of_no_type) == 2 + +template<typename T> +result_of_no_type result_of_is_private_type(T const &); +result_of_yes_type result_of_is_private_type(result_of_private_type); + +template<typename C> +struct result_of_callable_class : C { + result_of_callable_class(); + typedef result_of_private_type const &(*pfn_t)(...); + operator pfn_t() const volatile; +}; + +template<typename C> +struct result_of_wrap_callable_class { + typedef result_of_callable_class<C> type; +}; + +template<typename C> +struct result_of_wrap_callable_class<C const> { + typedef result_of_callable_class<C> const type; +}; + +template<typename C> +struct result_of_wrap_callable_class<C volatile> { + typedef result_of_callable_class<C> volatile type; +}; + +template<typename C> +struct result_of_wrap_callable_class<C const volatile> { + typedef result_of_callable_class<C> const volatile type; +}; + +template<typename C> +struct result_of_wrap_callable_class<C &> { + typedef typename result_of_wrap_callable_class<C>::type &type; +}; + +template<typename F, bool TestCallability = true> struct cpp0x_result_of_impl; + +#else // BOOST_NO_SFINAE_EXPR + +template<typename T> +struct result_of_always_void +{ + typedef void type; +}; + +template<typename F, typename Enable = void> struct cpp0x_result_of_impl {}; + +#endif // BOOST_NO_SFINAE_EXPR + +template<typename F> +struct result_of_void_impl +{ + typedef void type; +}; + +template<typename R> +struct result_of_void_impl<R (*)(void)> +{ + typedef R type; +}; + +template<typename R> +struct result_of_void_impl<R (&)(void)> +{ + typedef R type; +}; + +// Determine the return type of a function pointer or pointer to member. +template<typename F, typename FArgs> +struct result_of_pointer + : tr1_result_of_impl<typename remove_cv<F>::type, FArgs, false> { }; + +template<typename F, typename FArgs> +struct tr1_result_of_impl<F, FArgs, true> +{ + typedef typename F::result_type type; +}; + +template<typename FArgs> +struct is_function_with_no_args : mpl::false_ {}; + +template<typename F> +struct is_function_with_no_args<F(void)> : mpl::true_ {}; + +template<typename F, typename FArgs> +struct result_of_nested_result : F::template result<FArgs> +{}; + +template<typename F, typename FArgs> +struct tr1_result_of_impl<F, FArgs, false> + : mpl::if_<is_function_with_no_args<FArgs>, + result_of_void_impl<F>, + result_of_nested_result<F, FArgs> >::type +{}; + +} // end namespace detail + +#define BOOST_PP_ITERATION_PARAMS_1 (3,(0,BOOST_RESULT_OF_NUM_ARGS,<boost/utility/detail/result_of_iterate.hpp>)) +#include BOOST_PP_ITERATE() + +#else +# define BOOST_NO_RESULT_OF 1 +#endif + +} + +#endif // BOOST_RESULT_OF_HPP diff --git a/3rdParty/Boost/src/boost/uuid/name_generator.hpp b/3rdParty/Boost/src/boost/uuid/name_generator.hpp index 42473a6..fe582b4 100644 --- a/3rdParty/Boost/src/boost/uuid/name_generator.hpp +++ b/3rdParty/Boost/src/boost/uuid/name_generator.hpp @@ -71,10 +71,10 @@ private: for (size_t i=0; i<count; i++) { uint32_t c = characters[i]; - sha.process_byte( (c >> 0) && 0xFF ); - sha.process_byte( (c >> 8) && 0xFF ); - sha.process_byte( (c >> 16) && 0xFF ); - sha.process_byte( (c >> 24) && 0xFF ); + sha.process_byte( (c >> 0) & 0xFF ); + sha.process_byte( (c >> 8) & 0xFF ); + sha.process_byte( (c >> 16) & 0xFF ); + sha.process_byte( (c >> 24) & 0xFF ); } } diff --git a/3rdParty/Boost/src/boost/uuid/random_generator.hpp b/3rdParty/Boost/src/boost/uuid/random_generator.hpp index 4d11f6b..0f4a0ab 100644 --- a/3rdParty/Boost/src/boost/uuid/random_generator.hpp +++ b/3rdParty/Boost/src/boost/uuid/random_generator.hpp @@ -90,7 +90,8 @@ public: i = 0; } - *it = ((random_value >> (i*8)) & 0xFF); + // static_cast gets rid of warnings of converting unsigned long to boost::uint8_t + *it = static_cast<uuid::value_type>((random_value >> (i*8)) & 0xFF); } // set variant diff --git a/3rdParty/Boost/src/boost/uuid/seed_rng.hpp b/3rdParty/Boost/src/boost/uuid/seed_rng.hpp index 3090197..97b505f 100644 --- a/3rdParty/Boost/src/boost/uuid/seed_rng.hpp +++ b/3rdParty/Boost/src/boost/uuid/seed_rng.hpp @@ -24,12 +24,11 @@ #include <boost/config.hpp> #include <cstring> // for memcpy #include <limits> -#include <memory.h> #include <ctime> // for time_t, time, clock_t, clock #include <cstdlib> // for rand #include <cstdio> // for FILE, fopen, fread, fclose #include <boost/uuid/sha1.hpp> -//#include <boost/nondet_random.hpp> //forward declare boost::random_device +//#include <boost/nondet_random.hpp> //forward declare boost::random::random_device // can't use boost::generator_iterator since boost::random number seed(Iter&, Iter) // functions need a last iterator @@ -57,9 +56,9 @@ namespace std { #endif // forward declare random number generators -namespace boost { +namespace boost { namespace random { class random_device; -} //namespace boost +}} //namespace boost::random namespace boost { namespace uuids { @@ -80,7 +79,7 @@ public: : rd_index_(5) , random_(std::fopen( "/dev/urandom", "rb" )) {} - + ~seed_rng() { if (random_) { @@ -110,9 +109,10 @@ public: } private: + inline void ignore_size(size_t) {} + static unsigned int * sha1_random_digest_state_() { - // intentionally left uninitialized static unsigned int state[ 5 ]; return state; } @@ -140,7 +140,11 @@ private: } { - unsigned int rn[] = { std::rand(), std::rand(), std::rand() }; + unsigned int rn[] = + { static_cast<unsigned int>(std::rand()) + , static_cast<unsigned int>(std::rand()) + , static_cast<unsigned int>(std::rand()) + }; sha.process_bytes( (unsigned char const*)rn, sizeof( rn ) ); } @@ -150,7 +154,7 @@ private: if(random_) { - std::fread( buffer, 1, 20, random_ ); + ignore_size(std::fread( buffer, 1, 20, random_ )); } // using an uninitialized buffer[] if fopen fails @@ -185,7 +189,7 @@ private: unsigned int rd_[5]; int rd_index_; std::FILE * random_; - + private: // make seed_rng noncopyable seed_rng(seed_rng const&); seed_rng& operator=(seed_rng const&); @@ -208,9 +212,9 @@ class generator_iterator , single_pass_traversal_tag , typename Generator::result_type const& > super_t; - + public: - generator_iterator() : m_g(NULL) {} + generator_iterator() : m_g(NULL), m_value(0) {} generator_iterator(Generator* g) : m_g(g), m_value((*m_g)()) {} void increment() @@ -247,7 +251,7 @@ inline void seed(UniformRandomNumberGenerator& rng) // random_device does not / can not be seeded template <> -inline void seed<boost::random_device>(boost::random_device&) {} +inline void seed<boost::random::random_device>(boost::random::random_device&) {} // random_device does not / can not be seeded template <> diff --git a/3rdParty/Boost/src/boost/uuid/sha1.hpp b/3rdParty/Boost/src/boost/uuid/sha1.hpp index b4a1344..e695e13 100644 --- a/3rdParty/Boost/src/boost/uuid/sha1.hpp +++ b/3rdParty/Boost/src/boost/uuid/sha1.hpp @@ -8,16 +8,18 @@ // Revision History // 29 May 2007 - Initial Revision // 25 Feb 2008 - moved to namespace boost::uuids::detail +// 10 Jan 2012 - can now handle the full size of messages (2^64 - 1 bits) // This is a byte oriented implementation -// Note: this implementation does not handle message longer than -// 2^32 bytes. #ifndef BOOST_UUID_SHA1_H #define BOOST_UUID_SHA1_H #include <boost/static_assert.hpp> +#include <stdexcept> +#include <boost/throw_exception.hpp> #include <cstddef> +#include <string> #ifdef BOOST_NO_STDC_NAMESPACE namespace std { @@ -54,6 +56,7 @@ public: private: void process_block(); + void process_byte_impl(unsigned char byte); private: unsigned int h_[5]; @@ -61,7 +64,8 @@ private: unsigned char block_[64]; std::size_t block_byte_index_; - std::size_t byte_count_; + std::size_t bit_count_low; + std::size_t bit_count_high; }; inline sha1::sha1() @@ -78,13 +82,34 @@ inline void sha1::reset() h_[4] = 0xC3D2E1F0; block_byte_index_ = 0; - byte_count_ = 0; + bit_count_low = 0; + bit_count_high = 0; } inline void sha1::process_byte(unsigned char byte) { + process_byte_impl(byte); + + // size_t max value = 0xFFFFFFFF + //if (bit_count_low + 8 >= 0x100000000) { // would overflow + //if (bit_count_low >= 0x100000000-8) { + if (bit_count_low < 0xFFFFFFF8) { + bit_count_low += 8; + } else { + bit_count_low = 0; + + if (bit_count_high <= 0xFFFFFFFE) { + ++bit_count_high; + } else { + BOOST_THROW_EXCEPTION(std::runtime_error("sha1 too many bytes")); + } + } +} + +inline void sha1::process_byte_impl(unsigned char byte) +{ block_[block_byte_index_++] = byte; - ++byte_count_; + if (block_byte_index_ == 64) { block_byte_index_ = 0; process_block(); @@ -160,10 +185,8 @@ inline void sha1::process_block() inline void sha1::get_digest(digest_type digest) { - std::size_t bit_count = byte_count_*8; - // append the bit '1' to the message - process_byte(0x80); + process_byte_impl(0x80); // append k bits '0', where k is the minimum number >= 0 // such that the resulting message length is congruent to 56 (mod 64) @@ -171,29 +194,29 @@ inline void sha1::get_digest(digest_type digest) if (block_byte_index_ > 56) { // finish this block while (block_byte_index_ != 0) { - process_byte(0); + process_byte_impl(0); } // one more block while (block_byte_index_ < 56) { - process_byte(0); + process_byte_impl(0); } } else { while (block_byte_index_ < 56) { - process_byte(0); + process_byte_impl(0); } } // append length of message (before pre-processing) // as a 64-bit big-endian integer - process_byte(0); - process_byte(0); - process_byte(0); - process_byte(0); - process_byte( static_cast<unsigned char>((bit_count>>24) & 0xFF)); - process_byte( static_cast<unsigned char>((bit_count>>16) & 0xFF)); - process_byte( static_cast<unsigned char>((bit_count>>8 ) & 0xFF)); - process_byte( static_cast<unsigned char>((bit_count) & 0xFF)); + process_byte_impl( static_cast<unsigned char>((bit_count_high>>24) & 0xFF) ); + process_byte_impl( static_cast<unsigned char>((bit_count_high>>16) & 0xFF) ); + process_byte_impl( static_cast<unsigned char>((bit_count_high>>8 ) & 0xFF) ); + process_byte_impl( static_cast<unsigned char>((bit_count_high) & 0xFF) ); + process_byte_impl( static_cast<unsigned char>((bit_count_low>>24) & 0xFF) ); + process_byte_impl( static_cast<unsigned char>((bit_count_low>>16) & 0xFF) ); + process_byte_impl( static_cast<unsigned char>((bit_count_low>>8 ) & 0xFF) ); + process_byte_impl( static_cast<unsigned char>((bit_count_low) & 0xFF) ); // get final digest digest[0] = h_[0]; diff --git a/3rdParty/Boost/src/boost/uuid/string_generator.hpp b/3rdParty/Boost/src/boost/uuid/string_generator.hpp index 7d2733b..538ebe8 100644 --- a/3rdParty/Boost/src/boost/uuid/string_generator.hpp +++ b/3rdParty/Boost/src/boost/uuid/string_generator.hpp @@ -14,6 +14,7 @@ #include <iterator> #include <algorithm> // for find #include <stdexcept> +#include <boost/throw_exception.hpp> #ifdef BOOST_NO_STDC_NAMESPACE namespace std { @@ -41,7 +42,7 @@ struct string_generator { template <typename ch, typename char_traits, typename alloc> uuid operator()(std::basic_string<ch, char_traits, alloc> const& s) const { return operator()(s.begin(), s.end()); - }; + } uuid operator()(char const*const s) const { return operator()(s, s+std::strlen(s)); @@ -174,7 +175,7 @@ private: } void throw_invalid() const { - throw std::runtime_error("invalid uuid string"); + BOOST_THROW_EXCEPTION(std::runtime_error("invalid uuid string")); } }; diff --git a/3rdParty/Boost/src/boost/variant/detail/apply_visitor_delayed.hpp b/3rdParty/Boost/src/boost/variant/detail/apply_visitor_delayed.hpp index 2650508..5f5642b 100644 --- a/3rdParty/Boost/src/boost/variant/detail/apply_visitor_delayed.hpp +++ b/3rdParty/Boost/src/boost/variant/detail/apply_visitor_delayed.hpp @@ -58,7 +58,7 @@ public: // unary visitor interface template <typename Visitable> BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(result_type) - operator()(Visitable& visitable) + operator()(Visitable& visitable) const { return apply_visitor(visitor_, visitable); } @@ -67,7 +67,7 @@ public: // binary visitor interface template <typename Visitable1, typename Visitable2> BOOST_VARIANT_AUX_GENERIC_RESULT_TYPE(result_type) - operator()(Visitable1& visitable1, Visitable2& visitable2) + operator()(Visitable1& visitable1, Visitable2& visitable2) const { return apply_visitor(visitor_, visitable1, visitable2); } diff --git a/3rdParty/Boost/src/boost/variant/detail/hash_variant.hpp b/3rdParty/Boost/src/boost/variant/detail/hash_variant.hpp new file mode 100644 index 0000000..3da669e --- /dev/null +++ b/3rdParty/Boost/src/boost/variant/detail/hash_variant.hpp @@ -0,0 +1,48 @@ +//----------------------------------------------------------------------------- +// boost variant/detail/hash_variant.hpp header file +// See http://www.boost.org for updates, documentation, and revision history. +//----------------------------------------------------------------------------- +// +// Copyright (c) 2011 +// 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_HASH_VARIANT_FUNCTION_HPP +#define BOOST_HASH_VARIANT_FUNCTION_HPP + +#if defined(_MSC_VER) && (_MSC_VER >= 1020) +# pragma once +#endif + +#include <boost/variant/variant_fwd.hpp> +#include <boost/variant/static_visitor.hpp> +#include <boost/variant/apply_visitor.hpp> +#include <boost/functional/hash_fwd.hpp> + +namespace boost { + + namespace detail { namespace variant { + struct variant_hasher: public boost::static_visitor<std::size_t> { + template <class T> + std::size_t operator()(T const& val) const { + using namespace boost; + hash<T> hasher; + return hasher(val); + } + }; + }} + + template < BOOST_VARIANT_ENUM_PARAMS(typename T) > + std::size_t hash_value(variant< BOOST_VARIANT_ENUM_PARAMS(T) > const& val) { + std::size_t seed = boost::apply_visitor(detail::variant::variant_hasher(), val); + hash_combine(seed, val.which()); + return seed; + } +} + +#endif + diff --git a/3rdParty/Boost/src/boost/variant/detail/visitation_impl.hpp b/3rdParty/Boost/src/boost/variant/detail/visitation_impl.hpp index 0d4271a..9cc3015 100644 --- a/3rdParty/Boost/src/boost/variant/detail/visitation_impl.hpp +++ b/3rdParty/Boost/src/boost/variant/detail/visitation_impl.hpp @@ -167,7 +167,7 @@ visitation_impl_invoke( , has_nothrow_copy<T> >::type never_uses_backup; - return visitation_impl_invoke_impl( + return (visitation_impl_invoke_impl)( internal_which, visitor, storage, t , never_uses_backup() ); @@ -246,7 +246,7 @@ visitation_impl( // ...applying the appropriate case: # define BOOST_VARIANT_AUX_APPLY_VISITOR_STEP_CASE(z, N, _) \ case (Which::value + (N)): \ - return visitation_impl_invoke( \ + return (visitation_impl_invoke)( \ internal_which, visitor, storage \ , static_cast<BOOST_PP_CAT(T,N)*>(0) \ , no_backup_flag, 1L \ @@ -261,6 +261,7 @@ visitation_impl( # undef BOOST_VARIANT_AUX_APPLY_VISITOR_STEP_CASE + default: break; } // If not handled in this iteration, continue unrolling: diff --git a/3rdParty/Boost/src/boost/variant/recursive_variant.hpp b/3rdParty/Boost/src/boost/variant/recursive_variant.hpp index c4cd3b0..071d0f9 100644 --- a/3rdParty/Boost/src/boost/variant/recursive_variant.hpp +++ b/3rdParty/Boost/src/boost/variant/recursive_variant.hpp @@ -21,15 +21,15 @@ #include "boost/mpl/aux_/lambda_arity_param.hpp" -#if !defined(BOOST_VARIANT_NO_TYPE_SEQUENCE_SUPPORT) -# include "boost/mpl/eval_if.hpp" -# include "boost/mpl/identity.hpp" -# include "boost/mpl/protect.hpp" -# include "boost/mpl/transform.hpp" -#else -# include "boost/preprocessor/cat.hpp" -# include "boost/preprocessor/repeat.hpp" -#endif +#include "boost/mpl/equal.hpp" +#include "boost/mpl/eval_if.hpp" +#include "boost/mpl/identity.hpp" +#include "boost/mpl/if.hpp" +#include "boost/mpl/protect.hpp" +#include "boost/mpl/transform.hpp" +#include "boost/type_traits/is_same.hpp" +#include "boost/preprocessor/cat.hpp" +#include "boost/preprocessor/repeat.hpp" #include "boost/mpl/bool.hpp" #include "boost/mpl/is_sequence.hpp" @@ -74,34 +74,48 @@ template < BOOST_MPL_AUX_LAMBDA_ARITY_PARAM(typename Arity) > struct substitute< - ::boost::variant< BOOST_VARIANT_ENUM_PARAMS(T) > + ::boost::variant< + ::boost::detail::variant::over_sequence< T0 > + , BOOST_VARIANT_ENUM_SHIFTED_PARAMS(T) + > , RecursiveVariant , ::boost::recursive_variant_ BOOST_MPL_AUX_LAMBDA_ARITY_PARAM(Arity) > { +private: -#if !defined(BOOST_VARIANT_NO_TYPE_SEQUENCE_SUPPORT) - -private: // helpers, for metafunction result (below) - - typedef typename mpl::eval_if< - ::boost::detail::variant::is_over_sequence<T0> - , mpl::identity< T0 > - , make_variant_list< BOOST_VARIANT_ENUM_PARAMS(T) > - >::type initial_types; + typedef T0 initial_types; typedef typename mpl::transform< initial_types , mpl::protect< quoted_enable_recursive<RecursiveVariant,mpl::true_> > >::type types; -public: // metafunction result - - typedef ::boost::variant< types > type; +public: -#else // defined(BOOST_VARIANT_NO_TYPE_SEQUENCE_SUPPORT) + typedef typename mpl::if_< + mpl::equal<initial_types, types, ::boost::is_same<mpl::_1, mpl::_2> > + , ::boost::variant< + ::boost::detail::variant::over_sequence< T0 > + , BOOST_VARIANT_ENUM_SHIFTED_PARAMS(T) + > + , ::boost::variant< over_sequence<types> > + >::type type; +}; +template < + BOOST_VARIANT_ENUM_PARAMS(typename T) + , typename RecursiveVariant + BOOST_MPL_AUX_LAMBDA_ARITY_PARAM(typename Arity) + > +struct substitute< + ::boost::variant< BOOST_VARIANT_ENUM_PARAMS(T) > + , RecursiveVariant + , ::boost::recursive_variant_ + BOOST_MPL_AUX_LAMBDA_ARITY_PARAM(Arity) + > +{ private: // helpers, for metafunction result (below) #define BOOST_VARIANT_AUX_ENABLE_RECURSIVE_TYPEDEFS(z,N,_) \ @@ -123,9 +137,6 @@ private: // helpers, for metafunction result (below) public: // metafunction result typedef ::boost::variant< BOOST_VARIANT_ENUM_PARAMS(wknd_T) > type; - -#endif // BOOST_VARIANT_NO_TYPE_SEQUENCE_SUPPORT workaround - }; #else // defined(BOOST_VARIANT_DETAIL_NO_SUBSTITUTE) diff --git a/3rdParty/Boost/src/boost/variant/variant.hpp b/3rdParty/Boost/src/boost/variant/variant.hpp index 205ad8d..6afd190 100644 --- a/3rdParty/Boost/src/boost/variant/variant.hpp +++ b/3rdParty/Boost/src/boost/variant/variant.hpp @@ -32,6 +32,7 @@ #include "boost/variant/detail/make_variant_list.hpp" #include "boost/variant/detail/over_sequence.hpp" #include "boost/variant/detail/visitation_impl.hpp" +#include "boost/variant/detail/hash_variant.hpp" #include "boost/variant/detail/generic_result_type.hpp" #include "boost/variant/detail/has_nothrow_move.hpp" @@ -40,6 +41,7 @@ #include "boost/detail/reference_content.hpp" #include "boost/aligned_storage.hpp" #include "boost/blank.hpp" +#include "boost/math/common_factor_ct.hpp" #include "boost/static_assert.hpp" #include "boost/preprocessor/cat.hpp" #include "boost/preprocessor/repeat.hpp" @@ -53,12 +55,14 @@ #include "boost/variant/recursive_wrapper_fwd.hpp" #include "boost/variant/static_visitor.hpp" -#include "boost/mpl/eval_if.hpp" +#include "boost/mpl/assert.hpp" #include "boost/mpl/begin_end.hpp" #include "boost/mpl/bool.hpp" -#include "boost/mpl/not.hpp" +#include "boost/mpl/deref.hpp" #include "boost/mpl/empty.hpp" +#include "boost/mpl/eval_if.hpp" #include "boost/mpl/find_if.hpp" +#include "boost/mpl/fold.hpp" #include "boost/mpl/front.hpp" #include "boost/mpl/identity.hpp" #include "boost/mpl/if.hpp" @@ -69,7 +73,7 @@ #include "boost/mpl/logical.hpp" #include "boost/mpl/max_element.hpp" #include "boost/mpl/next.hpp" -#include "boost/mpl/deref.hpp" +#include "boost/mpl/not.hpp" #include "boost/mpl/pair.hpp" #include "boost/mpl/protect.hpp" #include "boost/mpl/push_front.hpp" @@ -77,7 +81,6 @@ #include "boost/mpl/size_t.hpp" #include "boost/mpl/sizeof.hpp" #include "boost/mpl/transform.hpp" -#include "boost/mpl/assert.hpp" /////////////////////////////////////////////////////////////////////////////// // Implementation Macros: @@ -130,6 +133,19 @@ public: // metafunction result }; +struct add_alignment +{ + template <typename State, typename Item> + struct apply + : mpl::size_t< + ::boost::math::static_lcm< + BOOST_MPL_AUX_VALUE_WKND(State)::value + , ::boost::alignment_of<Item>::value + >::value + > + {}; +}; + /////////////////////////////////////////////////////////////////////////////// // (detail) metafunction find_fallback_type // @@ -234,8 +250,10 @@ private: // helpers, for metafunction result (below) #if !BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x0551)) - typedef typename max_value< - types, alignment_of<mpl::_1> + typedef typename mpl::fold< + types + , mpl::size_t<1> + , add_alignment >::type max_alignment; #else // borland @@ -550,7 +568,7 @@ private: // NOTE: This needs to be a friend of variant, as it needs access to // indicate_which, indicate_backup_which, etc. // -template <typename Variant, typename RhsT> +template <typename Variant> class backup_assigner : public static_visitor<> { @@ -558,19 +576,28 @@ private: // representation Variant& lhs_; int rhs_which_; - const RhsT& rhs_content_; + const void* rhs_content_; + void (*copy_rhs_content_)(void*, const void*); public: // structors + template<class RhsT> backup_assigner(Variant& lhs, int rhs_which, const RhsT& rhs_content) : lhs_(lhs) , rhs_which_(rhs_which) - , rhs_content_(rhs_content) + , rhs_content_(&rhs_content) + , copy_rhs_content_(&construct_impl<RhsT>) { } private: // helpers, for visitor interface (below) + template<class RhsT> + static void construct_impl(void* addr, const void* obj) + { + new(addr) RhsT(*static_cast<const RhsT*>(obj)); + } + template <typename LhsT> void backup_assign_impl( LhsT& lhs_content @@ -588,7 +615,7 @@ private: // helpers, for visitor interface (below) try { // ...and attempt to copy rhs content into lhs storage: - new(lhs_.storage_.address()) RhsT(rhs_content_); + copy_rhs_content_(lhs_.storage_.address(), rhs_content_); } catch (...) { @@ -621,7 +648,7 @@ private: // helpers, for visitor interface (below) try { // ...and attempt to copy rhs content into lhs storage: - new(lhs_.storage_.address()) RhsT(rhs_content_); + copy_rhs_content_(lhs_.storage_.address(), rhs_content_); } catch (...) { @@ -1143,14 +1170,14 @@ private: // helpers, for representation (below) which_t which_; storage_t storage_; - void indicate_which(int which) + void indicate_which(int which_arg) { - which_ = static_cast<which_t>( which ); + which_ = static_cast<which_t>( which_arg ); } - void indicate_backup_which(int which) + void indicate_backup_which(int which_arg) { - which_ = static_cast<which_t>( -(which + 1) ); + which_ = static_cast<which_t>( -(which_arg + 1) ); } private: // helpers, for queries (below) @@ -1431,7 +1458,7 @@ public: // structors, cont. private: // helpers, for modifiers (below) # if !defined(BOOST_NO_MEMBER_TEMPLATE_FRIENDS) - template <typename Variant, typename RhsT> + template <typename Variant> friend class detail::variant::backup_assigner; # endif @@ -1544,7 +1571,7 @@ private: // helpers, for modifiers (below) , mpl::false_// has_fallback_type ) { - detail::variant::backup_assigner<wknd_self_t, RhsT> + detail::variant::backup_assigner<wknd_self_t> visitor(lhs_, rhs_which_, rhs_content); lhs_.internal_apply_visitor(visitor); } diff --git a/3rdParty/Boost/src/boost/variant/variant_fwd.hpp b/3rdParty/Boost/src/boost/variant/variant_fwd.hpp index 7482ad4..133f437 100644 --- a/3rdParty/Boost/src/boost/variant/variant_fwd.hpp +++ b/3rdParty/Boost/src/boost/variant/variant_fwd.hpp @@ -229,7 +229,7 @@ template < BOOST_VARIANT_AUX_DECLARE_PARAMS > struct make_recursive_variant; // Tag type indicates where recursive variant substitution should occur. // #if !defined(BOOST_VARIANT_NO_FULL_RECURSIVE_VARIANT_SUPPORT) - struct recursive_variant_; + struct recursive_variant_ {}; #else typedef mpl::arg<1> recursive_variant_; #endif diff --git a/3rdParty/Boost/src/boost/version.hpp b/3rdParty/Boost/src/boost/version.hpp index c80d428..00d6ab8 100644 --- a/3rdParty/Boost/src/boost/version.hpp +++ b/3rdParty/Boost/src/boost/version.hpp @@ -19,7 +19,7 @@ // BOOST_VERSION / 100 % 1000 is the minor version // BOOST_VERSION / 100000 is the major version -#define BOOST_VERSION 104601 +#define BOOST_VERSION 105200 // // BOOST_LIB_VERSION must be defined to be the same as BOOST_VERSION @@ -27,9 +27,6 @@ // number, y is the minor version number, and z is the patch level if not 0. // This is used by <config/auto_link.hpp> to select which library version to link to. -#define BOOST_LIB_VERSION "1_46_1" +#define BOOST_LIB_VERSION "1_52" #endif - - - diff --git a/3rdParty/Boost/src/libs/date_time/src/gregorian/date_generators.cpp b/3rdParty/Boost/src/libs/date_time/src/gregorian/date_generators.cpp index bbef7f6..4669065 100644 --- a/3rdParty/Boost/src/libs/date_time/src/gregorian/date_generators.cpp +++ b/3rdParty/Boost/src/libs/date_time/src/gregorian/date_generators.cpp @@ -3,7 +3,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2012-09-24 11:08:16 -0700 (Mon, 24 Sep 2012) $ */ @@ -22,7 +22,7 @@ namespace date_time { //! Returns nth arg as string. 1 -> "first", 2 -> "second", max is 5. BOOST_DATE_TIME_DECL const char* nth_as_str(int ele) { - if(ele >= 1 || ele <= 5) { + if(ele >= 1 && ele <= 5) { return _nth_as_str[ele]; } else { diff --git a/3rdParty/Boost/src/libs/date_time/src/gregorian/greg_month.cpp b/3rdParty/Boost/src/libs/date_time/src/gregorian/greg_month.cpp index efca973..cce04f0 100644 --- a/3rdParty/Boost/src/libs/date_time/src/gregorian/greg_month.cpp +++ b/3rdParty/Boost/src/libs/date_time/src/gregorian/greg_month.cpp @@ -3,7 +3,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-11-23 06:13:35 -0500 (Sun, 23 Nov 2008) $ + * $Date: 2012-09-30 16:25:22 -0700 (Sun, 30 Sep 2012) $ */ @@ -108,7 +108,7 @@ namespace gregorian { */ BOOST_DATE_TIME_DECL boost::date_time::all_date_names_put<greg_facet_config, char>* - create_facet_def(char type) + create_facet_def(char /*type*/) { typedef boost::date_time::all_date_names_put<greg_facet_config, char> facet_def; @@ -121,7 +121,7 @@ namespace gregorian { } //! generates a locale with the set of gregorian name-strings of type char* - BOOST_DATE_TIME_DECL std::locale generate_locale(std::locale& loc, char type){ + BOOST_DATE_TIME_DECL std::locale generate_locale(std::locale& loc, char /*type*/){ typedef boost::date_time::all_date_names_put<greg_facet_config, char> facet_def; return std::locale(loc, new facet_def(short_month_names, long_month_names, @@ -139,7 +139,7 @@ namespace gregorian { */ BOOST_DATE_TIME_DECL boost::date_time::all_date_names_put<greg_facet_config, wchar_t>* - create_facet_def(wchar_t type) + create_facet_def(wchar_t /*type*/) { typedef boost::date_time::all_date_names_put<greg_facet_config,wchar_t> facet_def; @@ -152,7 +152,7 @@ namespace gregorian { } //! generates a locale with the set of gregorian name-strings of type wchar_t* - BOOST_DATE_TIME_DECL std::locale generate_locale(std::locale& loc, wchar_t type){ + BOOST_DATE_TIME_DECL std::locale generate_locale(std::locale& loc, wchar_t /*type*/){ typedef boost::date_time::all_date_names_put<greg_facet_config, wchar_t> facet_def; return std::locale(loc, new facet_def(w_short_month_names, w_long_month_names, diff --git a/3rdParty/Boost/src/libs/date_time/src/gregorian/greg_names.hpp b/3rdParty/Boost/src/libs/date_time/src/gregorian/greg_names.hpp index 76a1a24..44aa8b8 100644 --- a/3rdParty/Boost/src/libs/date_time/src/gregorian/greg_names.hpp +++ b/3rdParty/Boost/src/libs/date_time/src/gregorian/greg_names.hpp @@ -3,7 +3,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ diff --git a/3rdParty/Boost/src/libs/date_time/src/gregorian/greg_weekday.cpp b/3rdParty/Boost/src/libs/date_time/src/gregorian/greg_weekday.cpp index 4057d29..fe83c15 100644 --- a/3rdParty/Boost/src/libs/date_time/src/gregorian/greg_weekday.cpp +++ b/3rdParty/Boost/src/libs/date_time/src/gregorian/greg_weekday.cpp @@ -3,7 +3,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland, Bart Garst - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ diff --git a/3rdParty/Boost/src/libs/date_time/src/gregorian/gregorian_types.cpp b/3rdParty/Boost/src/libs/date_time/src/gregorian/gregorian_types.cpp index a856e79..341731f 100644 --- a/3rdParty/Boost/src/libs/date_time/src/gregorian/gregorian_types.cpp +++ b/3rdParty/Boost/src/libs/date_time/src/gregorian/gregorian_types.cpp @@ -3,7 +3,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ diff --git a/3rdParty/Boost/src/libs/date_time/src/posix_time/posix_time_types.cpp b/3rdParty/Boost/src/libs/date_time/src/posix_time/posix_time_types.cpp index 06ef563..4916d36 100644 --- a/3rdParty/Boost/src/libs/date_time/src/posix_time/posix_time_types.cpp +++ b/3rdParty/Boost/src/libs/date_time/src/posix_time/posix_time_types.cpp @@ -4,7 +4,7 @@ * Boost Software License, Version 1.0. (See accompanying * file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt) * Author: Jeff Garland - * $Date: 2008-02-27 15:00:24 -0500 (Wed, 27 Feb 2008) $ + * $Date: 2008-02-27 12:00:24 -0800 (Wed, 27 Feb 2008) $ */ diff --git a/3rdParty/Boost/src/libs/detail/utf8_codecvt_facet.cpp b/3rdParty/Boost/src/libs/detail/utf8_codecvt_facet.cpp deleted file mode 100644 index 7ea5eeb..0000000 --- a/3rdParty/Boost/src/libs/detail/utf8_codecvt_facet.cpp +++ /dev/null @@ -1,285 +0,0 @@ -/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 -// utf8_codecvt_facet.cpp - -// Copyright (c) 2001 Ronald Garcia, Indiana University (garcia@osl.iu.edu) -// Andrew Lumsdaine, Indiana University (lums@osl.iu.edu). -// 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) - -// Please see the comments in <boost/detail/utf8_codecvt_facet.hpp> to -// learn how this file should be used. - -#include <boost/detail/utf8_codecvt_facet.hpp> - -#include <cstdlib> // for multi-byte converson routines -#include <cassert> - -#include <boost/limits.hpp> -#include <boost/config.hpp> - -// If we don't have wstring, then Unicode support -// is not available anyway, so we don't need to even -// compiler this file. This also fixes the problem -// with mingw, which can compile this file, but will -// generate link error when building DLL. -#ifndef BOOST_NO_STD_WSTRING - -BOOST_UTF8_BEGIN_NAMESPACE - -/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8 -// implementation for wchar_t - -// Translate incoming UTF-8 into UCS-4 -std::codecvt_base::result utf8_codecvt_facet::do_in( - std::mbstate_t& /*state*/, - const char * from, - const char * from_end, - const char * & from_next, - wchar_t * to, - wchar_t * to_end, - wchar_t * & to_next -) const { - // Basic algorithm: The first octet determines how many - // octets total make up the UCS-4 character. The remaining - // "continuing octets" all begin with "10". To convert, subtract - // the amount that specifies the number of octets from the first - // octet. Subtract 0x80 (1000 0000) from each continuing octet, - // then mash the whole lot together. Note that each continuing - // octet only uses 6 bits as unique values, so only shift by - // multiples of 6 to combine. - while (from != from_end && to != to_end) { - - // Error checking on the first octet - if (invalid_leading_octet(*from)){ - from_next = from; - to_next = to; - return std::codecvt_base::error; - } - - // The first octet is adjusted by a value dependent upon - // the number of "continuing octets" encoding the character - const int cont_octet_count = get_cont_octet_count(*from); - const wchar_t octet1_modifier_table[] = { - 0x00, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc - }; - - // The unsigned char conversion is necessary in case char is - // signed (I learned this the hard way) - wchar_t ucs_result = - (unsigned char)(*from++) - octet1_modifier_table[cont_octet_count]; - - // Invariants : - // 1) At the start of the loop, 'i' continuing characters have been - // processed - // 2) *from points to the next continuing character to be processed. - int i = 0; - while(i != cont_octet_count && from != from_end) { - - // Error checking on continuing characters - if (invalid_continuing_octet(*from)) { - from_next = from; - to_next = to; - return std::codecvt_base::error; - } - - ucs_result *= (1 << 6); - - // each continuing character has an extra (10xxxxxx)b attached to - // it that must be removed. - ucs_result += (unsigned char)(*from++) - 0x80; - ++i; - } - - // If the buffer ends with an incomplete unicode character... - if (from == from_end && i != cont_octet_count) { - // rewind "from" to before the current character translation - from_next = from - (i+1); - to_next = to; - return std::codecvt_base::partial; - } - *to++ = ucs_result; - } - from_next = from; - to_next = to; - - // Were we done converting or did we run out of destination space? - if(from == from_end) return std::codecvt_base::ok; - else return std::codecvt_base::partial; -} - -std::codecvt_base::result utf8_codecvt_facet::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 -) const -{ - // RG - consider merging this table with the other one - const wchar_t octet1_modifier_table[] = { - 0x00, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc - }; - - wchar_t max_wchar = (std::numeric_limits<wchar_t>::max)(); - while (from != from_end && to != to_end) { - - // Check for invalid UCS-4 character - if (*from > max_wchar) { - from_next = from; - to_next = to; - return std::codecvt_base::error; - } - - int cont_octet_count = get_cont_octet_out_count(*from); - - // RG - comment this formula better - int shift_exponent = (cont_octet_count) * 6; - - // Process the first character - *to++ = static_cast<char>(octet1_modifier_table[cont_octet_count] + - (unsigned char)(*from / (1 << shift_exponent))); - - // Process the continuation characters - // Invariants: At the start of the loop: - // 1) 'i' continuing octets have been generated - // 2) '*to' points to the next location to place an octet - // 3) shift_exponent is 6 more than needed for the next octet - int i = 0; - while (i != cont_octet_count && to != to_end) { - shift_exponent -= 6; - *to++ = static_cast<char>(0x80 + ((*from / (1 << shift_exponent)) % (1 << 6))); - ++i; - } - // If we filled up the out buffer before encoding the character - if(to == to_end && i != cont_octet_count) { - from_next = from; - to_next = to - (i+1); - return std::codecvt_base::partial; - } - ++from; - } - from_next = from; - to_next = to; - // Were we done or did we run out of destination space - if(from == from_end) return std::codecvt_base::ok; - else return std::codecvt_base::partial; -} - -// 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 char * from, - const char * from_end, - std::size_t max_limit -#if BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600)) -) const throw() -#else -) const -#endif -{ - // RG - this code is confusing! I need a better way to express it. - // and test cases. - - // Invariants: - // 1) last_octet_count has the size of the last measured character - // 2) char_count holds the number of characters shown to fit - // within the bounds so far (no greater than max_limit) - // 3) from_next points to the octet 'last_octet_count' before the - // last measured character. - int last_octet_count=0; - std::size_t char_count = 0; - const char* from_next = from; - // Use "<" because the buffer may represent incomplete characters - while (from_next+last_octet_count <= from_end && char_count <= max_limit) { - from_next += last_octet_count; - last_octet_count = (get_octet_count(*from_next)); - ++char_count; - } - return static_cast<int>(from_next-from_end); -} - -unsigned int utf8_codecvt_facet::get_octet_count( - unsigned char lead_octet -){ - // if the 0-bit (MSB) is 0, then 1 character - if (lead_octet <= 0x7f) return 1; - - // Otherwise the count number of consecutive 1 bits starting at MSB -// assert(0xc0 <= lead_octet && lead_octet <= 0xfd); - - if (0xc0 <= lead_octet && lead_octet <= 0xdf) return 2; - else if (0xe0 <= lead_octet && lead_octet <= 0xef) return 3; - else if (0xf0 <= lead_octet && lead_octet <= 0xf7) return 4; - else if (0xf8 <= lead_octet && lead_octet <= 0xfb) return 5; - else return 6; -} -BOOST_UTF8_END_NAMESPACE - -namespace { -template<std::size_t s> -int get_cont_octet_out_count_impl(wchar_t word){ - if (word < 0x80) { - return 0; - } - if (word < 0x800) { - return 1; - } - return 2; -} - -template<> -int get_cont_octet_out_count_impl<4>(wchar_t word){ - if (word < 0x80) { - return 0; - } - if (word < 0x800) { - return 1; - } - - // Note that the following code will generate warnings on some platforms - // where wchar_t is defined as UCS2. The warnings are superfluous as the - // specialization is never instantitiated with such compilers, but this - // can cause problems if warnings are being treated as errors, so we guard - // against that. Including <boost/detail/utf8_codecvt_facet.hpp> as we do - // should be enough to get WCHAR_MAX defined. -#if !defined(WCHAR_MAX) -# error WCHAR_MAX not defined! -#endif - // cope with VC++ 7.1 or earlier having invalid WCHAR_MAX -#if defined(_MSC_VER) && _MSC_VER <= 1310 // 7.1 or earlier - return 2; -#elif WCHAR_MAX > 0x10000 - - if (word < 0x10000) { - return 2; - } - if (word < 0x200000) { - return 3; - } - if (word < 0x4000000) { - return 4; - } - return 5; - -#else - return 2; -#endif -} - -} // namespace anonymous - -BOOST_UTF8_BEGIN_NAMESPACE -// How many "continuing octets" will be needed for this word -// == total octets - 1. -int utf8_codecvt_facet::get_cont_octet_out_count( - wchar_t word -) const { - return get_cont_octet_out_count_impl<sizeof(wchar_t)>(word); -} -BOOST_UTF8_END_NAMESPACE - -#endif diff --git a/3rdParty/Boost/src/libs/exception/build/Jamfile.v2 b/3rdParty/Boost/src/libs/exception/build/Jamfile.v2 new file mode 100644 index 0000000..fb47659 --- /dev/null +++ b/3rdParty/Boost/src/libs/exception/build/Jamfile.v2 @@ -0,0 +1,14 @@ +# Boost Exception Library build Jamfile +# +# Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc. +# +# 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) + +project boost/exception + : source-location ../src + : requirements <link>static + ; + +lib boost_exception : clone_current_exception_non_intrusive.cpp ; +boost-install boost_exception ; diff --git a/3rdParty/Boost/src/libs/exception/src/clone_current_exception_non_intrusive.cpp b/3rdParty/Boost/src/libs/exception/src/clone_current_exception_non_intrusive.cpp new file mode 100644 index 0000000..1710cd7 --- /dev/null +++ b/3rdParty/Boost/src/libs/exception/src/clone_current_exception_non_intrusive.cpp @@ -0,0 +1,320 @@ +//Copyright (c) 2006-2009 Emil Dotchevski and Reverge Studios, Inc. + +//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) + +//This MSVC-specific cpp file implements non-intrusive cloning of exception objects. +//Based on an exception_ptr implementation by Anthony Williams. + +#ifdef BOOST_NO_EXCEPTIONS +#error This file requires exception handling to be enabled. +#endif + +#include <boost/exception/detail/clone_current_exception.hpp> + +#if defined(BOOST_ENABLE_NON_INTRUSIVE_EXCEPTION_PTR) && defined(_MSC_VER) && defined(_M_IX86) && !defined(_M_X64) + +//Non-intrusive cloning support implemented below, only for MSVC versions mentioned above. +//Thanks Anthony Williams! + +#include <boost/exception/exception.hpp> +#include <boost/shared_ptr.hpp> +#ifndef BOOST_NO_RTTI +#include <typeinfo> +#endif +#include <windows.h> +#include <malloc.h> + +namespace + { + unsigned const exception_maximum_parameters=15; + unsigned const exception_noncontinuable=1; + +#if _MSC_VER==1310 + int const exception_info_offset=0x74; +#elif (_MSC_VER==1400 || _MSC_VER==1500) + int const exception_info_offset=0x80; +#else + int const exception_info_offset=-1; +#endif + + struct + exception_record + { + unsigned long ExceptionCode; + unsigned long ExceptionFlags; + exception_record * ExceptionRecord; + void * ExceptionAddress; + unsigned long NumberParameters; + ULONG_PTR ExceptionInformation[exception_maximum_parameters]; + }; + + struct + exception_pointers + { + exception_record * ExceptionRecord; + void * ContextRecord; + }; + + unsigned const cpp_exception_code=0xE06D7363; + unsigned const cpp_exception_magic_flag=0x19930520; + unsigned const cpp_exception_parameter_count=3; + + struct + dummy_exception_type + { + }; + + typedef int(dummy_exception_type::*normal_copy_constructor_ptr)(void * src); + typedef int(dummy_exception_type::*copy_constructor_with_virtual_base_ptr)(void * src,void * dst); + typedef void (dummy_exception_type::*destructor_ptr)(); + + union + cpp_copy_constructor + { + normal_copy_constructor_ptr normal_copy_constructor; + copy_constructor_with_virtual_base_ptr copy_constructor_with_virtual_base; + }; + + enum + cpp_type_flags + { + class_is_simple_type=1, + class_has_virtual_base=4 + }; + + struct + cpp_type_info + { + unsigned flags; +#ifndef BOOST_NO_RTTI + void const * type_info; +#else + std::type_info * type_info; +#endif + int this_offset; + int vbase_descr; + int vbase_offset; + unsigned long size; + cpp_copy_constructor copy_constructor; + }; + + struct + cpp_type_info_table + { + unsigned count; + const cpp_type_info * info[1]; + }; + + struct + cpp_exception_type + { + unsigned flags; + destructor_ptr destructor; + void(*custom_handler)(); + cpp_type_info_table const * type_info_table; + }; + + struct + exception_object_deleter + { + cpp_exception_type const & et_; + + exception_object_deleter( cpp_exception_type const & et ): + et_(et) + { + } + + void + operator()( void * obj ) + { + BOOST_ASSERT(obj!=0); + dummy_exception_type * dummy_exception_ptr=reinterpret_cast<dummy_exception_type *>(obj); + (dummy_exception_ptr->*(et_.destructor))(); + free(obj); + } + }; + + cpp_type_info const & + get_cpp_type_info( cpp_exception_type const & et ) + { + cpp_type_info const * ti = et.type_info_table->info[0]; + BOOST_ASSERT(ti!=0); + return *ti; + } + + void + copy_msvc_exception( void * dst, void * src, cpp_type_info const & ti ) + { + if( !(ti.flags & class_is_simple_type) && ti.copy_constructor.normal_copy_constructor ) + { + dummy_exception_type * dummy_exception_ptr = reinterpret_cast<dummy_exception_type *>(dst); + if( ti.flags & class_has_virtual_base ) + (dummy_exception_ptr->*(ti.copy_constructor.copy_constructor_with_virtual_base))(src,dst); + else + (dummy_exception_ptr->*(ti.copy_constructor.normal_copy_constructor))(src); + } + else + memmove(dst,src,ti.size); + } + + boost::shared_ptr<void> + clone_msvc_exception( void * src, cpp_exception_type const & et ) + { + assert(src!=0); + cpp_type_info const & ti=get_cpp_type_info(et); + if( void * dst = malloc(ti.size) ) + { + try + { + copy_msvc_exception(dst,src,ti); + } + catch( + ... ) + { + free(dst); + throw; + } + return boost::shared_ptr<void>(dst,exception_object_deleter(et)); + } + else + throw std::bad_alloc(); + } + + class + cloned_exception: + public boost::exception_detail::clone_base + { + cloned_exception( cloned_exception const & ); + cloned_exception & operator=( cloned_exception const & ); + + cpp_exception_type const & et_; + boost::shared_ptr<void> exc_; + + public: + + cloned_exception( void * exc, cpp_exception_type const & et ): + et_(et), + exc_(clone_msvc_exception(exc,et_)) + { + } + + ~cloned_exception() throw() + { + } + + boost::exception_detail::clone_base const * + clone() const + { + return new cloned_exception(exc_.get(),et_); + } + + void + rethrow() const + { + cpp_type_info const & ti=get_cpp_type_info(et_); + void * dst = _alloca(ti.size); + copy_msvc_exception(dst,exc_.get(),ti); + ULONG_PTR args[cpp_exception_parameter_count]; + args[0]=cpp_exception_magic_flag; + args[1]=reinterpret_cast<ULONG_PTR>(dst); + args[2]=reinterpret_cast<ULONG_PTR>(&et_); + RaiseException(cpp_exception_code,EXCEPTION_NONCONTINUABLE,cpp_exception_parameter_count,args); + } + }; + + bool + is_cpp_exception( EXCEPTION_RECORD const * record ) + { + return record && + (record->ExceptionCode==cpp_exception_code) && + (record->NumberParameters==cpp_exception_parameter_count) && + (record->ExceptionInformation[0]==cpp_exception_magic_flag); + } + + unsigned long + exception_cloning_filter( int & result, boost::exception_detail::clone_base const * & ptr, void * info_ ) + { + BOOST_ASSERT(exception_info_offset>=0); + BOOST_ASSERT(info_!=0); + EXCEPTION_POINTERS * info=reinterpret_cast<EXCEPTION_POINTERS *>(info_); + EXCEPTION_RECORD * record=info->ExceptionRecord; + if( is_cpp_exception(record) ) + { + if( !record->ExceptionInformation[2] ) + record = *reinterpret_cast<EXCEPTION_RECORD * *>(reinterpret_cast<char *>(_errno())+exception_info_offset); + if( is_cpp_exception(record) && record->ExceptionInformation[2] ) + try + { + ptr = new cloned_exception( + reinterpret_cast<void *>(record->ExceptionInformation[1]), + *reinterpret_cast<cpp_exception_type const *>(record->ExceptionInformation[2])); + result = boost::exception_detail::clone_current_exception_result::success; + } + catch( + std::bad_alloc & ) + { + result = boost::exception_detail::clone_current_exception_result::bad_alloc; + } + catch( + ... ) + { + result = boost::exception_detail::clone_current_exception_result::bad_exception; + } + } + return EXCEPTION_EXECUTE_HANDLER; + } + } + +namespace +boost + { + namespace + exception_detail + { + int + clone_current_exception_non_intrusive( clone_base const * & cloned ) + { + BOOST_ASSERT(!cloned); + int result = clone_current_exception_result::not_supported; + if( exception_info_offset>=0 ) + { + clone_base const * ptr=0; + __try + { + throw; + } + __except(exception_cloning_filter(result,ptr,GetExceptionInformation())) + { + } + if( result==clone_current_exception_result::success ) + cloned=ptr; + } + BOOST_ASSERT(result!=clone_current_exception_result::success || cloned); + return result; + } + } + } + +#else + +//On all other compilers, return clone_current_exception_result::not_supported. +//On such platforms, only the intrusive enable_current_exception() cloning will work. + +#include <boost/config.hpp> + +namespace +boost + { + namespace + exception_detail + { + int + clone_current_exception_non_intrusive( clone_base const * & ) + { + return clone_current_exception_result::not_supported; + } + } + } + +#endif diff --git a/3rdParty/Boost/src/libs/filesystem/src/codecvt_error_category.cpp b/3rdParty/Boost/src/libs/filesystem/src/codecvt_error_category.cpp new file mode 100644 index 0000000..245c3f3 --- /dev/null +++ b/3rdParty/Boost/src/libs/filesystem/src/codecvt_error_category.cpp @@ -0,0 +1,84 @@ +// codecvt_error_category implementation file ----------------------------------------// + +// Copyright Beman Dawes 2009 + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt) + +// Library home page at http://www.boost.org/libs/filesystem + +//--------------------------------------------------------------------------------------// + +#include <boost/config/warning_disable.hpp> + +// define BOOST_FILESYSTEM_SOURCE so that <boost/filesystem/config.hpp> knows +// the library is being built (possibly exporting rather than importing code) +#define BOOST_FILESYSTEM_SOURCE + +#ifndef BOOST_SYSTEM_NO_DEPRECATED +# define BOOST_SYSTEM_NO_DEPRECATED +#endif + +#include <boost/filesystem/config.hpp> +#include <boost/filesystem/path_traits.hpp> +#include <boost/system/error_code.hpp> +#include <locale> +#include <vector> +#include <cstdlib> +#include <cassert> + +//--------------------------------------------------------------------------------------// + +namespace +{ + class codecvt_error_cat : public boost::system::error_category + { + public: + codecvt_error_cat(){} + const char* name() const; + std::string message(int ev) const; + }; + + const char* codecvt_error_cat::name() const + { + return "codecvt"; + } + + std::string codecvt_error_cat::message(int ev) const + { + std::string str; + switch (ev) + { + case std::codecvt_base::ok: + str = "ok"; + break; + case std::codecvt_base::partial: + str = "partial"; + break; + case std::codecvt_base::error: + str = "error"; + break; + case std::codecvt_base::noconv: + str = "noconv"; + break; + default: + str = "unknown error"; + } + return str; + } + +} // unnamed namespace + +namespace boost +{ + namespace filesystem + { + + BOOST_FILESYSTEM_DECL const boost::system::error_category& codecvt_error_category() + { + static const codecvt_error_cat codecvt_error_cat_const; + return codecvt_error_cat_const; + } + + } // namespace filesystem +} // namespace boost diff --git a/3rdParty/Boost/src/libs/filesystem/src/filesystem_utf8_codecvt_facet.cpp b/3rdParty/Boost/src/libs/filesystem/src/filesystem_utf8_codecvt_facet.cpp new file mode 100644 index 0000000..8a5af1e --- /dev/null +++ b/3rdParty/Boost/src/libs/filesystem/src/filesystem_utf8_codecvt_facet.cpp @@ -0,0 +1,27 @@ +// Copyright Vladimir Prus 2004. +// 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) + +// For HP-UX, request that WCHAR_MAX and WCHAR_MIN be defined as macros, +// not casts. See ticket 5048 +#define _INCLUDE_STDCSOURCE_199901 + +#ifndef BOOST_SYSTEM_NO_DEPRECATED +# define BOOST_SYSTEM_NO_DEPRECATED +#endif + +#define BOOST_FILESYSTEM_SOURCE +#include <boost/filesystem/config.hpp> + +#define BOOST_UTF8_BEGIN_NAMESPACE \ + namespace boost { namespace filesystem { namespace detail { + +#define BOOST_UTF8_END_NAMESPACE }}} +#define BOOST_UTF8_DECL BOOST_FILESYSTEM_DECL + +#include <boost/detail/utf8_codecvt_facet.ipp> + +#undef BOOST_UTF8_BEGIN_NAMESPACE +#undef BOOST_UTF8_END_NAMESPACE +#undef BOOST_UTF8_DECL diff --git a/3rdParty/Boost/src/libs/filesystem/src/operations.cpp b/3rdParty/Boost/src/libs/filesystem/src/operations.cpp new file mode 100644 index 0000000..16a336f --- /dev/null +++ b/3rdParty/Boost/src/libs/filesystem/src/operations.cpp @@ -0,0 +1,2228 @@ +// operations.cpp --------------------------------------------------------------------// + +// Copyright 2002-2009 Beman Dawes +// Copyright 2001 Dietmar Kuehl + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +// See library home page at http://www.boost.org/libs/filesystem + +//--------------------------------------------------------------------------------------// + +// define 64-bit offset macros BEFORE including boost/config.hpp (see ticket #5355) +#if !(defined(__HP_aCC) && defined(_ILP32) && !defined(_STATVFS_ACPP_PROBLEMS_FIXED)) +#define _FILE_OFFSET_BITS 64 // at worst, these defines may have no effect, +#endif +#if !defined(__PGI) +#define __USE_FILE_OFFSET64 // but that is harmless on Windows and on POSIX + // 64-bit systems or on 32-bit systems which don't have files larger + // than can be represented by a traditional POSIX/UNIX off_t type. + // OTOH, defining them should kick in 64-bit off_t's (and thus + // st_size)on 32-bit systems that provide the Large File + // Support (LFS)interface, such as Linux, Solaris, and IRIX. + // The defines are given before any headers are included to + // ensure that they are available to all included headers. + // That is required at least on Solaris, and possibly on other + // systems as well. +#else +#define _FILE_OFFSET_BITS 64 +#endif + +// define BOOST_FILESYSTEM_SOURCE so that <boost/filesystem/config.hpp> knows +// the library is being built (possibly exporting rather than importing code) +#define BOOST_FILESYSTEM_SOURCE + +#ifndef BOOST_SYSTEM_NO_DEPRECATED +# define BOOST_SYSTEM_NO_DEPRECATED +#endif + +#ifndef _POSIX_PTHREAD_SEMANTICS +# define _POSIX_PTHREAD_SEMANTICS // Sun readdir_r()needs this +#endif + +#include <boost/filesystem/operations.hpp> +#include <boost/scoped_array.hpp> +#include <boost/detail/workaround.hpp> +#include <vector> +#include <cstdlib> // for malloc, free +#include <cstring> +#include <cstdio> // for remove, rename +#if defined(__QNXNTO__) // see ticket #5355 +# include <stdio.h> +#endif +#include <cerrno> + +#ifdef BOOST_FILEYSTEM_INCLUDE_IOSTREAM +# include <iostream> +#endif + +namespace fs = boost::filesystem; +using boost::filesystem::path; +using boost::filesystem::filesystem_error; +using boost::filesystem::perms; +using boost::system::error_code; +using boost::system::error_category; +using boost::system::system_category; +using std::string; +using std::wstring; + +# ifdef BOOST_POSIX_API + + const fs::path dot_path("."); + const fs::path dot_dot_path(".."); +# include <sys/types.h> +# include <sys/stat.h> +# if !defined(__APPLE__) && !defined(__OpenBSD__) +# include <sys/statvfs.h> +# define BOOST_STATVFS statvfs +# define BOOST_STATVFS_F_FRSIZE vfs.f_frsize +# else +# ifdef __OpenBSD__ +# include <sys/param.h> +# endif +# include <sys/mount.h> +# define BOOST_STATVFS statfs +# define BOOST_STATVFS_F_FRSIZE static_cast<boost::uintmax_t>(vfs.f_bsize) +# endif +# include <dirent.h> +# include <unistd.h> +# include <fcntl.h> +# include <utime.h> +# include "limits.h" + +# else // BOOST_WINDOW_API + + const fs::path dot_path(L"."); + const fs::path dot_dot_path(L".."); +# if (defined(__MINGW32__) || defined(__CYGWIN__)) && !defined(WINVER) + // Versions of MinGW or Cygwin that support Filesystem V3 support at least WINVER 0x501. + // See MinGW's windef.h +# define WINVER 0x501 +# endif +# include <io.h> +# include <windows.h> +# include <winnt.h> +# if !defined(_WIN32_WINNT) +# define _WIN32_WINNT 0x0500 +# endif +# if defined(__BORLANDC__) || defined(__MWERKS__) +# if defined(__BORLANDC__) + using std::time_t; +# endif +# include <utime.h> +# else +# include <sys/utime.h> +# endif + +// REPARSE_DATA_BUFFER related definitions are found in ntifs.h, which is part of the +// Windows Device Driver Kit. Since that's inconvenient, the definitions are provided +// here. See http://msdn.microsoft.com/en-us/library/ms791514.aspx + +#if !defined(REPARSE_DATA_BUFFER_HEADER_SIZE) // mingw winnt.h does provide the defs + +#define SYMLINK_FLAG_RELATIVE 1 + +typedef struct _REPARSE_DATA_BUFFER { + ULONG ReparseTag; + USHORT ReparseDataLength; + USHORT Reserved; + union { + struct { + USHORT SubstituteNameOffset; + USHORT SubstituteNameLength; + USHORT PrintNameOffset; + USHORT PrintNameLength; + ULONG Flags; + WCHAR PathBuffer[1]; + /* Example of distinction between substitute and print names: + mklink /d ldrive c:\ + SubstituteName: c:\\??\ + PrintName: c:\ + */ + } SymbolicLinkReparseBuffer; + struct { + USHORT SubstituteNameOffset; + USHORT SubstituteNameLength; + USHORT PrintNameOffset; + USHORT PrintNameLength; + WCHAR PathBuffer[1]; + } MountPointReparseBuffer; + struct { + UCHAR DataBuffer[1]; + } GenericReparseBuffer; + }; +} REPARSE_DATA_BUFFER, *PREPARSE_DATA_BUFFER; + +#define REPARSE_DATA_BUFFER_HEADER_SIZE \ + FIELD_OFFSET(REPARSE_DATA_BUFFER, GenericReparseBuffer) + +#endif + +#ifndef MAXIMUM_REPARSE_DATA_BUFFER_SIZE +#define MAXIMUM_REPARSE_DATA_BUFFER_SIZE ( 16 * 1024 ) +#endif + +# ifndef FSCTL_GET_REPARSE_POINT +# define FSCTL_GET_REPARSE_POINT 0x900a8 +# endif + +# ifndef IO_REPARSE_TAG_SYMLINK +# define IO_REPARSE_TAG_SYMLINK (0xA000000CL) +# endif + +# endif // BOOST_WINDOWS_API + +// BOOST_FILESYSTEM_STATUS_CACHE enables file_status cache in +// dir_itr_increment. The config tests are placed here because some of the +// macros being tested come from dirent.h. +// +// TODO: find out what macros indicate dirent::d_type present in more libraries +# if defined(BOOST_WINDOWS_API)\ + || defined(_DIRENT_HAVE_D_TYPE)// defined by GNU C library if d_type present +# define BOOST_FILESYSTEM_STATUS_CACHE +# endif + +// POSIX/Windows macros ----------------------------------------------------// + +// Portions of the POSIX and Windows API's are very similar, except for name, +// order of arguments, and meaning of zero/non-zero returns. The macros below +// abstract away those differences. They follow Windows naming and order of +// arguments, and return true to indicate no error occurred. [POSIX naming, +// order of arguments, and meaning of return were followed initially, but +// found to be less clear and cause more coding errors.] + +# if defined(BOOST_POSIX_API) + +// POSIX uses a 0 return to indicate success +# define BOOST_ERRNO errno +# define BOOST_SET_CURRENT_DIRECTORY(P)(::chdir(P)== 0) +# define BOOST_CREATE_DIRECTORY(P)(::mkdir(P, S_IRWXU|S_IRWXG|S_IRWXO)== 0) +# define BOOST_CREATE_HARD_LINK(F,T)(::link(T, F)== 0) +# define BOOST_CREATE_SYMBOLIC_LINK(F,T,Flag)(::symlink(T, F)== 0) +# define BOOST_REMOVE_DIRECTORY(P)(::rmdir(P)== 0) +# define BOOST_DELETE_FILE(P)(::unlink(P)== 0) +# define BOOST_COPY_DIRECTORY(F,T)(!(::stat(from.c_str(), &from_stat)!= 0\ + || ::mkdir(to.c_str(),from_stat.st_mode)!= 0)) +# define BOOST_COPY_FILE(F,T,FailIfExistsBool)copy_file_api(F, T, FailIfExistsBool) +# define BOOST_MOVE_FILE(OLD,NEW)(::rename(OLD, NEW)== 0) +# define BOOST_RESIZE_FILE(P,SZ)(::truncate(P, SZ)== 0) + +# define BOOST_ERROR_NOT_SUPPORTED ENOSYS +# define BOOST_ERROR_ALREADY_EXISTS EEXIST + +# else // BOOST_WINDOWS_API + +// Windows uses a non-0 return to indicate success +# define BOOST_ERRNO ::GetLastError() +# define BOOST_SET_CURRENT_DIRECTORY(P)(::SetCurrentDirectoryW(P)!= 0) +# define BOOST_CREATE_DIRECTORY(P)(::CreateDirectoryW(P, 0)!= 0) +# define BOOST_CREATE_HARD_LINK(F,T)(create_hard_link_api(F, T, 0)!= 0) +# define BOOST_CREATE_SYMBOLIC_LINK(F,T,Flag)(create_symbolic_link_api(F, T, Flag)!= 0) +# define BOOST_REMOVE_DIRECTORY(P)(::RemoveDirectoryW(P)!= 0) +# define BOOST_DELETE_FILE(P)(::DeleteFileW(P)!= 0) +# define BOOST_COPY_DIRECTORY(F,T)(::CreateDirectoryExW(F, T, 0)!= 0) +# define BOOST_COPY_FILE(F,T,FailIfExistsBool)(::CopyFileW(F, T, FailIfExistsBool)!= 0) +# define BOOST_MOVE_FILE(OLD,NEW)(::MoveFileExW(OLD, NEW, MOVEFILE_REPLACE_EXISTING|MOVEFILE_COPY_ALLOWED)!= 0) +# define BOOST_RESIZE_FILE(P,SZ)(resize_file_api(P, SZ)!= 0) +# define BOOST_READ_SYMLINK(P,T) + +# define BOOST_ERROR_ALREADY_EXISTS ERROR_ALREADY_EXISTS +# define BOOST_ERROR_NOT_SUPPORTED ERROR_NOT_SUPPORTED + +# endif + +//--------------------------------------------------------------------------------------// +// // +// helpers (all operating systems) // +// // +//--------------------------------------------------------------------------------------// + +namespace +{ + + fs::file_type query_file_type(const path& p, error_code* ec); + + boost::filesystem::directory_iterator end_dir_itr; + + const std::size_t buf_size(128); + const error_code ok; + + bool error(bool was_error, error_code* ec, const string& message) + { + if (!was_error) + { + if (ec != 0) ec->clear(); + } + else + { // error + if (ec == 0) + BOOST_FILESYSTEM_THROW(filesystem_error(message, + error_code(BOOST_ERRNO, system_category()))); + else + ec->assign(BOOST_ERRNO, system_category()); + } + return was_error; + } + + bool error(bool was_error, const path& p, error_code* ec, const string& message) + { + if (!was_error) + { + if (ec != 0) ec->clear(); + } + else + { // error + if (ec == 0) + BOOST_FILESYSTEM_THROW(filesystem_error(message, + p, error_code(BOOST_ERRNO, system_category()))); + else + ec->assign(BOOST_ERRNO, system_category()); + } + return was_error; + } + + bool error(bool was_error, const path& p1, const path& p2, error_code* ec, + const string& message) + { + if (!was_error) + { + if (ec != 0) ec->clear(); + } + else + { // error + if (ec == 0) + BOOST_FILESYSTEM_THROW(filesystem_error(message, + p1, p2, error_code(BOOST_ERRNO, system_category()))); + else + ec->assign(BOOST_ERRNO, system_category()); + } + return was_error; + } + + bool error(bool was_error, const error_code& result, + const path& p, error_code* ec, const string& message) + // Overwrites ec if there has already been an error + { + if (!was_error) + { + if (ec != 0) ec->clear(); + } + else + { // error + if (ec == 0) + BOOST_FILESYSTEM_THROW(filesystem_error(message, p, result)); + else + *ec = result; + } + return was_error; + } + + bool error(bool was_error, const error_code& result, + const path& p1, const path& p2, error_code* ec, const string& message) + // Overwrites ec if there has already been an error + { + if (!was_error) + { + if (ec != 0) ec->clear(); + } + else + { // error + if (ec == 0) + BOOST_FILESYSTEM_THROW(filesystem_error(message, p1, p2, result)); + else + *ec = result; + } + return was_error; + } + + bool is_empty_directory(const path& p) + { + return fs::directory_iterator(p)== end_dir_itr; + } + + bool remove_directory(const path& p) // true if succeeds + { return BOOST_REMOVE_DIRECTORY(p.c_str()); } + + bool remove_file(const path& p) // true if succeeds + { return BOOST_DELETE_FILE(p.c_str()); } + + // called by remove and remove_all_aux + bool remove_file_or_directory(const path& p, fs::file_type type, error_code* ec) + // return true if file removed, false if not removed + { + if (type == fs::file_not_found) + { + if (ec != 0) ec->clear(); + return false; + } + + if (type == fs::directory_file +# ifdef BOOST_WINDOWS_API + || type == fs::_detail_directory_symlink +# endif + ) + { + if (error(!remove_directory(p), p, ec, "boost::filesystem::remove")) + return false; + } + else + { + if (error(!remove_file(p), p, ec, "boost::filesystem::remove")) + return false; + } + return true; + } + + boost::uintmax_t remove_all_aux(const path& p, fs::file_type type, + error_code* ec) + { + boost::uintmax_t count = 1; + + if (type == fs::directory_file) // but not a directory symlink + { + for (fs::directory_iterator itr(p); + itr != end_dir_itr; ++itr) + { + fs::file_type tmp_type = query_file_type(itr->path(), ec); + if (ec != 0 && *ec) + return count; + count += remove_all_aux(itr->path(), tmp_type, ec); + } + } + remove_file_or_directory(p, type, ec); + return count; + } + +#ifdef BOOST_POSIX_API + +//--------------------------------------------------------------------------------------// +// // +// POSIX-specific helpers // +// // +//--------------------------------------------------------------------------------------// + + const char dot = '.'; + + bool not_found_error(int errval) + { + return errno == ENOENT || errno == ENOTDIR; + } + + bool // true if ok + copy_file_api(const std::string& from_p, + const std::string& to_p, bool fail_if_exists) + { + const std::size_t buf_sz = 32768; + boost::scoped_array<char> buf(new char [buf_sz]); + int infile=-1, outfile=-1; // -1 means not open + + // bug fixed: code previously did a stat()on the from_file first, but that + // introduced a gratuitous race condition; the stat()is now done after the open() + + if ((infile = ::open(from_p.c_str(), O_RDONLY))< 0) + { return false; } + + struct stat from_stat; + if (::stat(from_p.c_str(), &from_stat)!= 0) + { + ::close(infile); + return false; + } + + int oflag = O_CREAT | O_WRONLY | O_TRUNC; + if (fail_if_exists) + oflag |= O_EXCL; + if ((outfile = ::open(to_p.c_str(), oflag, from_stat.st_mode))< 0) + { + int open_errno = errno; + BOOST_ASSERT(infile >= 0); + ::close(infile); + errno = open_errno; + return false; + } + + ssize_t sz, sz_read=1, sz_write; + while (sz_read > 0 + && (sz_read = ::read(infile, buf.get(), buf_sz))> 0) + { + // Allow for partial writes - see Advanced Unix Programming (2nd Ed.), + // Marc Rochkind, Addison-Wesley, 2004, page 94 + sz_write = 0; + do + { + if ((sz = ::write(outfile, buf.get() + sz_write, + sz_read - sz_write))< 0) + { + sz_read = sz; // cause read loop termination + break; // and error to be thrown after closes + } + sz_write += sz; + } while (sz_write < sz_read); + } + + if (::close(infile)< 0)sz_read = -1; + if (::close(outfile)< 0)sz_read = -1; + + return sz_read >= 0; + } + + inline fs::file_type query_file_type(const path& p, error_code* ec) + { + return fs::detail::symlink_status(p, ec).type(); + } + +# else + +//--------------------------------------------------------------------------------------// +// // +// Windows-specific helpers // +// // +//--------------------------------------------------------------------------------------// + + const wchar_t dot = L'.'; + + bool not_found_error(int errval) + { + return errval == ERROR_FILE_NOT_FOUND + || errval == ERROR_PATH_NOT_FOUND + || errval == ERROR_INVALID_NAME // "tools/jam/src/:sys:stat.h", "//foo" + || errval == ERROR_INVALID_DRIVE // USB card reader with no card inserted + || errval == ERROR_NOT_READY // CD/DVD drive with no disc inserted + || errval == ERROR_INVALID_PARAMETER // ":sys:stat.h" + || errval == ERROR_BAD_PATHNAME // "//nosuch" on Win64 + || errval == ERROR_BAD_NETPATH; // "//nosuch" on Win32 + } + +// some distributions of mingw as early as GLIBCXX__ 20110325 have _stricmp, but the +// offical 4.6.2 release with __GLIBCXX__ 20111026 doesn't. Play it safe for now, and +// only use _stricmp if _MSC_VER is defined +#if defined(_MSC_VER) // || (defined(__GLIBCXX__) && __GLIBCXX__ >= 20110325) +# define BOOST_FILESYSTEM_STRICMP _stricmp +#else +# define BOOST_FILESYSTEM_STRICMP strcmp +#endif + + perms make_permissions(const path& p, DWORD attr) + { + perms prms = fs::owner_read | fs::group_read | fs::others_read; + if ((attr & FILE_ATTRIBUTE_READONLY) == 0) + prms |= fs::owner_write | fs::group_write | fs::others_write; + if (BOOST_FILESYSTEM_STRICMP(p.extension().string().c_str(), ".exe") == 0 + || BOOST_FILESYSTEM_STRICMP(p.extension().string().c_str(), ".com") == 0 + || BOOST_FILESYSTEM_STRICMP(p.extension().string().c_str(), ".bat") == 0 + || BOOST_FILESYSTEM_STRICMP(p.extension().string().c_str(), ".cmd") == 0) + prms |= fs::owner_exe | fs::group_exe | fs::others_exe; + return prms; + } + + // these constants come from inspecting some Microsoft sample code + std::time_t to_time_t(const FILETIME & ft) + { + __int64 t = (static_cast<__int64>(ft.dwHighDateTime)<< 32) + + ft.dwLowDateTime; +# if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 // > VC++ 7.0 + t -= 116444736000000000LL; +# else + t -= 116444736000000000; +# endif + t /= 10000000; + return static_cast<std::time_t>(t); + } + + void to_FILETIME(std::time_t t, FILETIME & ft) + { + __int64 temp = t; + temp *= 10000000; +# if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 // > VC++ 7.0 + temp += 116444736000000000LL; +# else + temp += 116444736000000000; +# endif + ft.dwLowDateTime = static_cast<DWORD>(temp); + ft.dwHighDateTime = static_cast<DWORD>(temp >> 32); + } + + // Thanks to Jeremy Maitin-Shepard for much help and for permission to + // base the equivalent()implementation on portions of his + // file-equivalence-win32.cpp experimental code. + + struct handle_wrapper + { + HANDLE handle; + handle_wrapper(HANDLE h) + : handle(h){} + ~handle_wrapper() + { + if (handle != INVALID_HANDLE_VALUE) + ::CloseHandle(handle); + } + }; + + HANDLE create_file_handle(const path& p, DWORD dwDesiredAccess, + DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, + DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, + HANDLE hTemplateFile) + { + return ::CreateFileW(p.c_str(), dwDesiredAccess, dwShareMode, + lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, + hTemplateFile); + } + + bool is_reparse_point_a_symlink(const path& p) + { + handle_wrapper h(create_file_handle(p, FILE_READ_EA, + FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL, OPEN_EXISTING, + FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT, NULL)); + if (h.handle == INVALID_HANDLE_VALUE) + return false; + + boost::scoped_array<char> buf(new char [MAXIMUM_REPARSE_DATA_BUFFER_SIZE]); + + // Query the reparse data + DWORD dwRetLen; + BOOL result = ::DeviceIoControl(h.handle, FSCTL_GET_REPARSE_POINT, NULL, 0, buf.get(), + MAXIMUM_REPARSE_DATA_BUFFER_SIZE, &dwRetLen, NULL); + if (!result) return false; + + return reinterpret_cast<const REPARSE_DATA_BUFFER*>(buf.get()) + ->ReparseTag == IO_REPARSE_TAG_SYMLINK; + } + + inline std::size_t get_full_path_name( + const path& src, std::size_t len, wchar_t* buf, wchar_t** p) + { + return static_cast<std::size_t>( + ::GetFullPathNameW(src.c_str(), static_cast<DWORD>(len), buf, p)); + } + + fs::file_status process_status_failure(const path& p, error_code* ec) + { + int errval(::GetLastError()); + if (ec != 0) // always report errval, even though some + ec->assign(errval, system_category()); // errval values are not status_errors + + if (not_found_error(errval)) + { + return fs::file_status(fs::file_not_found, fs::no_perms); + } + else if ((errval == ERROR_SHARING_VIOLATION)) + { + return fs::file_status(fs::type_unknown); + } + if (ec == 0) + BOOST_FILESYSTEM_THROW(filesystem_error("boost::filesystem::status", + p, error_code(errval, system_category()))); + return fs::file_status(fs::status_error); + } + + // differs from symlink_status() in that directory symlinks are reported as + // _detail_directory_symlink, as required on Windows by remove() and its helpers. + fs::file_type query_file_type(const path& p, error_code* ec) + { + DWORD attr(::GetFileAttributesW(p.c_str())); + if (attr == 0xFFFFFFFF) + { + return process_status_failure(p, ec).type(); + } + + if (ec != 0) ec->clear(); + + if (attr & FILE_ATTRIBUTE_REPARSE_POINT) + { + if (is_reparse_point_a_symlink(p)) + return (attr & FILE_ATTRIBUTE_DIRECTORY) + ? fs::_detail_directory_symlink + : fs::symlink_file; + return fs::reparse_file; + } + + return (attr & FILE_ATTRIBUTE_DIRECTORY) + ? fs::directory_file + : fs::regular_file; + } + + BOOL resize_file_api(const wchar_t* p, boost::uintmax_t size) + { + HANDLE handle = CreateFileW(p, GENERIC_WRITE, 0, 0, OPEN_EXISTING, + FILE_ATTRIBUTE_NORMAL, 0); + LARGE_INTEGER sz; + sz.QuadPart = size; + return handle != INVALID_HANDLE_VALUE + && ::SetFilePointerEx(handle, sz, 0, FILE_BEGIN) + && ::SetEndOfFile(handle) + && ::CloseHandle(handle); + } + + // Windows kernel32.dll functions that may or may not be present + // must be accessed through pointers + + typedef BOOL (WINAPI *PtrCreateHardLinkW)( + /*__in*/ LPCWSTR lpFileName, + /*__in*/ LPCWSTR lpExistingFileName, + /*__reserved*/ LPSECURITY_ATTRIBUTES lpSecurityAttributes + ); + + PtrCreateHardLinkW create_hard_link_api = PtrCreateHardLinkW( + ::GetProcAddress( + ::GetModuleHandle(TEXT("kernel32.dll")), "CreateHardLinkW")); + + typedef BOOLEAN (WINAPI *PtrCreateSymbolicLinkW)( + /*__in*/ LPCWSTR lpSymlinkFileName, + /*__in*/ LPCWSTR lpTargetFileName, + /*__in*/ DWORD dwFlags + ); + + PtrCreateSymbolicLinkW create_symbolic_link_api = PtrCreateSymbolicLinkW( + ::GetProcAddress( + ::GetModuleHandle(TEXT("kernel32.dll")), "CreateSymbolicLinkW")); + +#endif + +//#ifdef BOOST_WINDOWS_API +// +// +// inline bool get_free_disk_space(const std::wstring& ph, +// PULARGE_INTEGER avail, PULARGE_INTEGER total, PULARGE_INTEGER free) +// { return ::GetDiskFreeSpaceExW(ph.c_str(), avail, total, free)!= 0; } +// +//#endif + +} // unnamed namespace + +//--------------------------------------------------------------------------------------// +// // +// operations functions declared in operations.hpp // +// in alphabetic order // +// // +//--------------------------------------------------------------------------------------// + +namespace boost +{ +namespace filesystem +{ + + BOOST_FILESYSTEM_DECL + path absolute(const path& p, const path& base) + { +// if ( p.empty() || p.is_absolute() ) +// return p; +// // recursively calling absolute is sub-optimal, but is simple +// path abs_base(base.is_absolute() ? base : absolute(base)); +//# ifdef BOOST_WINDOWS_API +// if (p.has_root_directory()) +// return abs_base.root_name() / p; +// // !p.has_root_directory +// if (p.has_root_name()) +// return p.root_name() +// / abs_base.root_directory() / abs_base.relative_path() / p.relative_path(); +// // !p.has_root_name() +//# endif +// return abs_base / p; + + // recursively calling absolute is sub-optimal, but is sure and simple + path abs_base(base.is_absolute() ? base : absolute(base)); + + // store expensive to compute values that are needed multiple times + path p_root_name (p.root_name()); + path base_root_name (abs_base.root_name()); + path p_root_directory (p.root_directory()); + + if (p.empty()) + return abs_base; + + if (!p_root_name.empty()) // p.has_root_name() + { + if (p_root_directory.empty()) // !p.has_root_directory() + return p_root_name / abs_base.root_directory() + / abs_base.relative_path() / p.relative_path(); + // p is absolute, so fall through to return p at end of block + } + + else if (!p_root_directory.empty()) // p.has_root_directory() + { +# ifdef BOOST_POSIX_API + // POSIX can have root name it it is a network path + if (base_root_name.empty()) // !abs_base.has_root_name() + return p; +# endif + return base_root_name / p; + } + + else + { + return abs_base / p; + } + + return p; // p.is_absolute() is true + } + +namespace detail +{ + BOOST_FILESYSTEM_DECL bool possible_large_file_size_support() + { +# ifdef BOOST_POSIX_API + struct stat lcl_stat; + return sizeof(lcl_stat.st_size)> 4; +# else + return true; +# endif + } + + BOOST_FILESYSTEM_DECL + path canonical(const path& p, const path& base, system::error_code* ec) + { + path source (p.is_absolute() ? p : absolute(p, base)); + path result; + + system::error_code local_ec; + file_status stat (status(source, local_ec)); + + if (stat.type() == fs::file_not_found) + { + if (ec == 0) + BOOST_FILESYSTEM_THROW(filesystem_error( + "boost::filesystem::canonical", source, + error_code(system::errc::no_such_file_or_directory, system::generic_category()))); + ec->assign(system::errc::no_such_file_or_directory, system::generic_category()); + return result; + } + else if (local_ec) + { + if (ec == 0) + BOOST_FILESYSTEM_THROW(filesystem_error( + "boost::filesystem::canonical", source, local_ec)); + *ec = local_ec; + return result; + } + + bool scan (true); + while (scan) + { + scan = false; + result.clear(); + for (path::iterator itr = source.begin(); itr != source.end(); ++itr) + { + if (*itr == dot_path) + continue; + if (*itr == dot_dot_path) + { + result.remove_filename(); + continue; + } + + result /= *itr; + + bool is_sym (is_symlink(detail::symlink_status(result, ec))); + if (ec && *ec) + return path(); + + if (is_sym) + { + path link(detail::read_symlink(result, ec)); + if (ec && *ec) + return path(); + result.remove_filename(); + + if (link.is_absolute()) + { + for (++itr; itr != source.end(); ++itr) + link /= *itr; + source = link; + } + else // link is relative + { + path new_source(result); + new_source /= link; + for (++itr; itr != source.end(); ++itr) + new_source /= *itr; + source = new_source; + } + scan = true; // symlink causes scan to be restarted + break; + } + } + } + if (ec != 0) + ec->clear(); + BOOST_ASSERT_MSG(result.is_absolute(), "canonical() implementation error; please report"); + return result; + } + + BOOST_FILESYSTEM_DECL + void copy(const path& from, const path& to, system::error_code* ec) + { + file_status s(symlink_status(from, *ec)); + if (ec != 0 && *ec) return; + + if(is_symlink(s)) + { + copy_symlink(from, to, *ec); + } + else if(is_directory(s)) + { + copy_directory(from, to, *ec); + } + else if(is_regular_file(s)) + { + copy_file(from, to, copy_option::fail_if_exists, *ec); + } + else + { + if (ec == 0) + BOOST_FILESYSTEM_THROW(filesystem_error("boost::filesystem::copy", + from, to, error_code(BOOST_ERROR_NOT_SUPPORTED, system_category()))); + ec->assign(BOOST_ERROR_NOT_SUPPORTED, system_category()); + } + } + + BOOST_FILESYSTEM_DECL + void copy_directory(const path& from, const path& to, system::error_code* ec) + { +# ifdef BOOST_POSIX_API + struct stat from_stat; +# endif + error(!BOOST_COPY_DIRECTORY(from.c_str(), to.c_str()), + from, to, ec, "boost::filesystem::copy_directory"); + } + + BOOST_FILESYSTEM_DECL + void copy_file(const path& from, const path& to, + BOOST_SCOPED_ENUM(copy_option)option, + error_code* ec) + { + error(!BOOST_COPY_FILE(from.c_str(), to.c_str(), + option == copy_option::fail_if_exists), + from, to, ec, "boost::filesystem::copy_file"); + } + + BOOST_FILESYSTEM_DECL + void copy_symlink(const path& existing_symlink, const path& new_symlink, + system::error_code* ec) + { +# if defined(_WIN32_WINNT) && _WIN32_WINNT < 0x0600 + error(true, error_code(BOOST_ERROR_NOT_SUPPORTED, system_category()), + new_symlink, existing_symlink, ec, + "boost::filesystem::copy_symlink"); + +# else // modern Windows or BOOST_POSIX_API + path p(read_symlink(existing_symlink, ec)); + if (ec != 0 && *ec) return; + create_symlink(p, new_symlink, ec); + +# endif + } + + BOOST_FILESYSTEM_DECL + bool create_directories(const path& p, system::error_code* ec) + { + error_code local_ec; + file_status p_status = status(p, local_ec); + + if (p_status.type() == directory_file) + { + if (ec != 0) + ec->clear(); + return false; + } + + path parent = p.parent_path(); + if (!parent.empty()) + { + // determine if the parent exists + file_status parent_status = status(parent, local_ec); + + // if the parent does not exist, create the parent + if (parent_status.type() == file_not_found) + { + create_directories(parent, local_ec); + if (local_ec) + { + if (ec == 0) + BOOST_FILESYSTEM_THROW(filesystem_error( + "boost::filesystem::create_directories", parent, local_ec)); + else + *ec = local_ec; + return false; + } + } + } + + // create the directory + return create_directory(p, ec); + } + + BOOST_FILESYSTEM_DECL + bool create_directory(const path& p, error_code* ec) + { + if (BOOST_CREATE_DIRECTORY(p.c_str())) + { + if (ec != 0) + ec->clear(); + return true; + } + + // attempt to create directory failed + int errval(BOOST_ERRNO); // save reason for failure + error_code dummy; + if (errval == BOOST_ERROR_ALREADY_EXISTS && is_directory(p, dummy)) + { + if (ec != 0) + ec->clear(); + return false; + } + + // attempt to create directory failed && it doesn't already exist + if (ec == 0) + BOOST_FILESYSTEM_THROW(filesystem_error("boost::filesystem::create_directory", + p, error_code(errval, system_category()))); + else + ec->assign(errval, system_category()); + return false; + } + + BOOST_FILESYSTEM_DECL + void create_directory_symlink(const path& to, const path& from, + system::error_code* ec) + { +# if defined(BOOST_WINDOWS_API) && _WIN32_WINNT < 0x0600 // SDK earlier than Vista and Server 2008 + + error(true, error_code(BOOST_ERROR_NOT_SUPPORTED, system_category()), to, from, ec, + "boost::filesystem::create_directory_symlink"); +# else + +# if defined(BOOST_WINDOWS_API) && _WIN32_WINNT >= 0x0600 + // see if actually supported by Windows runtime dll + if (error(!create_symbolic_link_api, + error_code(BOOST_ERROR_NOT_SUPPORTED, system_category()), + to, from, ec, + "boost::filesystem::create_directory_symlink")) + return; +# endif + + error(!BOOST_CREATE_SYMBOLIC_LINK(from.c_str(), to.c_str(), SYMBOLIC_LINK_FLAG_DIRECTORY), + to, from, ec, "boost::filesystem::create_directory_symlink"); +# endif + } + + BOOST_FILESYSTEM_DECL + void create_hard_link(const path& to, const path& from, error_code* ec) + { + +# if defined(BOOST_WINDOWS_API) && _WIN32_WINNT < 0x0500 // SDK earlier than Win 2K + + error(true, error_code(BOOST_ERROR_NOT_SUPPORTED, system_category()), to, from, ec, + "boost::filesystem::create_hard_link"); +# else + +# if defined(BOOST_WINDOWS_API) && _WIN32_WINNT >= 0x0500 + // see if actually supported by Windows runtime dll + if (error(!create_hard_link_api, + error_code(BOOST_ERROR_NOT_SUPPORTED, system_category()), + to, from, ec, + "boost::filesystem::create_hard_link")) + return; +# endif + + error(!BOOST_CREATE_HARD_LINK(from.c_str(), to.c_str()), to, from, ec, + "boost::filesystem::create_hard_link"); +# endif + } + + BOOST_FILESYSTEM_DECL + void create_symlink(const path& to, const path& from, error_code* ec) + { +# if defined(BOOST_WINDOWS_API) && _WIN32_WINNT < 0x0600 // SDK earlier than Vista and Server 2008 + error(true, error_code(BOOST_ERROR_NOT_SUPPORTED, system_category()), to, from, ec, + "boost::filesystem::create_directory_symlink"); +# else + +# if defined(BOOST_WINDOWS_API) && _WIN32_WINNT >= 0x0600 + // see if actually supported by Windows runtime dll + if (error(!create_symbolic_link_api, + error_code(BOOST_ERROR_NOT_SUPPORTED, system_category()), + to, from, ec, + "boost::filesystem::create_symlink")) + return; +# endif + + error(!BOOST_CREATE_SYMBOLIC_LINK(from.c_str(), to.c_str(), 0), + to, from, ec, "boost::filesystem::create_symlink"); +# endif + } + + BOOST_FILESYSTEM_DECL + path current_path(error_code* ec) + { +# ifdef BOOST_POSIX_API + path cur; + for (long path_max = 128;; path_max *=2)// loop 'til buffer large enough + { + boost::scoped_array<char> + buf(new char[static_cast<std::size_t>(path_max)]); + if (::getcwd(buf.get(), static_cast<std::size_t>(path_max))== 0) + { + if (error(errno != ERANGE + // bug in some versions of the Metrowerks C lib on the Mac: wrong errno set +# if defined(__MSL__) && (defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)) + && errno != 0 +# endif + , ec, "boost::filesystem::current_path")) + { + break; + } + } + else + { + cur = buf.get(); + if (ec != 0) ec->clear(); + break; + } + } + return cur; + +# else + DWORD sz; + if ((sz = ::GetCurrentDirectoryW(0, NULL))== 0)sz = 1; + boost::scoped_array<path::value_type> buf(new path::value_type[sz]); + error(::GetCurrentDirectoryW(sz, buf.get())== 0, ec, + "boost::filesystem::current_path"); + return path(buf.get()); +# endif + } + + + BOOST_FILESYSTEM_DECL + void current_path(const path& p, system::error_code* ec) + { + error(!BOOST_SET_CURRENT_DIRECTORY(p.c_str()), + p, ec, "boost::filesystem::current_path"); + } + + BOOST_FILESYSTEM_DECL + bool equivalent(const path& p1, const path& p2, system::error_code* ec) + { +# ifdef BOOST_POSIX_API + struct stat s2; + int e2(::stat(p2.c_str(), &s2)); + struct stat s1; + int e1(::stat(p1.c_str(), &s1)); + + if (e1 != 0 || e2 != 0) + { + // if one is invalid and the other isn't then they aren't equivalent, + // but if both are invalid then it is an error + error (e1 != 0 && e2 != 0, p1, p2, ec, "boost::filesystem::equivalent"); + return false; + } + + // both stats now known to be valid + return s1.st_dev == s2.st_dev && s1.st_ino == s2.st_ino + // According to the POSIX stat specs, "The st_ino and st_dev fields + // taken together uniquely identify the file within the system." + // Just to be sure, size and mod time are also checked. + && s1.st_size == s2.st_size && s1.st_mtime == s2.st_mtime; + +# else // Windows + + // Note well: Physical location on external media is part of the + // equivalence criteria. If there are no open handles, physical location + // can change due to defragmentation or other relocations. Thus handles + // must be held open until location information for both paths has + // been retrieved. + + // p2 is done first, so any error reported is for p1 + handle_wrapper h2( + create_file_handle( + p2.c_str(), + 0, + FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, + 0, + OPEN_EXISTING, + FILE_FLAG_BACKUP_SEMANTICS, + 0)); + + handle_wrapper h1( + create_file_handle( + p1.c_str(), + 0, + FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, + 0, + OPEN_EXISTING, + FILE_FLAG_BACKUP_SEMANTICS, + 0)); + + if (h1.handle == INVALID_HANDLE_VALUE + || h2.handle == INVALID_HANDLE_VALUE) + { + // if one is invalid and the other isn't, then they aren't equivalent, + // but if both are invalid then it is an error + error(h1.handle == INVALID_HANDLE_VALUE + && h2.handle == INVALID_HANDLE_VALUE, p1, p2, ec, + "boost::filesystem::equivalent"); + return false; + } + + // at this point, both handles are known to be valid + + BY_HANDLE_FILE_INFORMATION info1, info2; + + if (error(!::GetFileInformationByHandle(h1.handle, &info1), + p1, p2, ec, "boost::filesystem::equivalent")) + return false; + + if (error(!::GetFileInformationByHandle(h2.handle, &info2), + p1, p2, ec, "boost::filesystem::equivalent")) + return false; + + // In theory, volume serial numbers are sufficient to distinguish between + // devices, but in practice VSN's are sometimes duplicated, so last write + // time and file size are also checked. + return + info1.dwVolumeSerialNumber == info2.dwVolumeSerialNumber + && info1.nFileIndexHigh == info2.nFileIndexHigh + && info1.nFileIndexLow == info2.nFileIndexLow + && info1.nFileSizeHigh == info2.nFileSizeHigh + && info1.nFileSizeLow == info2.nFileSizeLow + && info1.ftLastWriteTime.dwLowDateTime + == info2.ftLastWriteTime.dwLowDateTime + && info1.ftLastWriteTime.dwHighDateTime + == info2.ftLastWriteTime.dwHighDateTime; + +# endif + } + + BOOST_FILESYSTEM_DECL + boost::uintmax_t file_size(const path& p, error_code* ec) + { +# ifdef BOOST_POSIX_API + + struct stat path_stat; + if (error(::stat(p.c_str(), &path_stat)!= 0, + p, ec, "boost::filesystem::file_size")) + return static_cast<boost::uintmax_t>(-1); + if (error(!S_ISREG(path_stat.st_mode), + error_code(EPERM, system_category()), + p, ec, "boost::filesystem::file_size")) + return static_cast<boost::uintmax_t>(-1); + + return static_cast<boost::uintmax_t>(path_stat.st_size); + +# else // Windows + + // assume uintmax_t is 64-bits on all Windows compilers + + WIN32_FILE_ATTRIBUTE_DATA fad; + + if (error(::GetFileAttributesExW(p.c_str(), ::GetFileExInfoStandard, &fad)== 0, + p, ec, "boost::filesystem::file_size")) + return static_cast<boost::uintmax_t>(-1); + + if (error((fad.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)!= 0, + error_code(ERROR_NOT_SUPPORTED, system_category()), + p, ec, "boost::filesystem::file_size")) + return static_cast<boost::uintmax_t>(-1); + + return (static_cast<boost::uintmax_t>(fad.nFileSizeHigh) + << (sizeof(fad.nFileSizeLow)*8)) + fad.nFileSizeLow; +# endif + } + + BOOST_FILESYSTEM_DECL + boost::uintmax_t hard_link_count(const path& p, system::error_code* ec) + { +# ifdef BOOST_POSIX_API + + struct stat path_stat; + return error(::stat(p.c_str(), &path_stat)!= 0, + p, ec, "boost::filesystem::hard_link_count") + ? 0 + : static_cast<boost::uintmax_t>(path_stat.st_nlink); + +# else // Windows + + // Link count info is only available through GetFileInformationByHandle + BY_HANDLE_FILE_INFORMATION info; + handle_wrapper h( + create_file_handle(p.c_str(), 0, + FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, 0, + OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0)); + return + !error(h.handle == INVALID_HANDLE_VALUE, + p, ec, "boost::filesystem::hard_link_count") + && !error(::GetFileInformationByHandle(h.handle, &info)== 0, + p, ec, "boost::filesystem::hard_link_count") + ? info.nNumberOfLinks + : 0; +# endif + } + + BOOST_FILESYSTEM_DECL + path initial_path(error_code* ec) + { + static path init_path; + if (init_path.empty()) + init_path = current_path(ec); + else if (ec != 0) ec->clear(); + return init_path; + } + + BOOST_FILESYSTEM_DECL + bool is_empty(const path& p, system::error_code* ec) + { +# ifdef BOOST_POSIX_API + + struct stat path_stat; + if (error(::stat(p.c_str(), &path_stat)!= 0, + p, ec, "boost::filesystem::is_empty")) + return false; + return S_ISDIR(path_stat.st_mode) + ? is_empty_directory(p) + : path_stat.st_size == 0; +# else + + WIN32_FILE_ATTRIBUTE_DATA fad; + if (error(::GetFileAttributesExW(p.c_str(), ::GetFileExInfoStandard, &fad)== 0, + p, ec, "boost::filesystem::is_empty")) + return false; + + if (ec != 0) ec->clear(); + return + (fad.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) + ? is_empty_directory(p) + : (!fad.nFileSizeHigh && !fad.nFileSizeLow); +# endif + } + + BOOST_FILESYSTEM_DECL + std::time_t last_write_time(const path& p, system::error_code* ec) + { +# ifdef BOOST_POSIX_API + + struct stat path_stat; + if (error(::stat(p.c_str(), &path_stat)!= 0, + p, ec, "boost::filesystem::last_write_time")) + return std::time_t(-1); + return path_stat.st_mtime; + +# else + + handle_wrapper hw( + create_file_handle(p.c_str(), 0, + FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, 0, + OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0)); + + if (error(hw.handle == INVALID_HANDLE_VALUE, + p, ec, "boost::filesystem::last_write_time")) + return std::time_t(-1); + + FILETIME lwt; + + if (error(::GetFileTime(hw.handle, 0, 0, &lwt)== 0, + p, ec, "boost::filesystem::last_write_time")) + return std::time_t(-1); + + return to_time_t(lwt); +# endif + } + + BOOST_FILESYSTEM_DECL + void last_write_time(const path& p, const std::time_t new_time, + system::error_code* ec) + { +# ifdef BOOST_POSIX_API + + struct stat path_stat; + if (error(::stat(p.c_str(), &path_stat)!= 0, + p, ec, "boost::filesystem::last_write_time")) + return; + ::utimbuf buf; + buf.actime = path_stat.st_atime; // utime()updates access time too:-( + buf.modtime = new_time; + error(::utime(p.c_str(), &buf)!= 0, + p, ec, "boost::filesystem::last_write_time"); + +# else + + handle_wrapper hw( + create_file_handle(p.c_str(), FILE_WRITE_ATTRIBUTES, + FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, 0, + OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0)); + + if (error(hw.handle == INVALID_HANDLE_VALUE, + p, ec, "boost::filesystem::last_write_time")) + return; + + FILETIME lwt; + to_FILETIME(new_time, lwt); + + error(::SetFileTime(hw.handle, 0, 0, &lwt)== 0, + p, ec, "boost::filesystem::last_write_time"); +# endif + } + +# ifdef BOOST_POSIX_API + const perms active_bits(all_all | set_uid_on_exe | set_gid_on_exe | sticky_bit); + inline mode_t mode_cast(perms prms) { return prms & active_bits; } +# endif + + BOOST_FILESYSTEM_DECL + void permissions(const path& p, perms prms, system::error_code* ec) + { + BOOST_ASSERT_MSG(!((prms & add_perms) && (prms & remove_perms)), + "add_perms and remove_perms are mutually exclusive"); + + if ((prms & add_perms) && (prms & remove_perms)) // precondition failed + return; + +# ifdef BOOST_POSIX_API + error_code local_ec; + file_status current_status((prms & symlink_perms) + ? fs::symlink_status(p, local_ec) + : fs::status(p, local_ec)); + if (local_ec) + { + if (ec == 0) + BOOST_FILESYSTEM_THROW(filesystem_error( + "boost::filesystem::permissions", p, local_ec)); + else + *ec = local_ec; + return; + } + + if (prms & add_perms) + prms |= current_status.permissions(); + else if (prms & remove_perms) + prms = current_status.permissions() & ~prms; + + // Mac OS X Lion and some other platforms don't support fchmodat(). + // Solaris (SunPro and gcc) only support fchmodat() on Solaris 11 and higher, + // and a runtime check is too much trouble. + // Linux does not support permissions on symbolic links and has no plans to + // support them in the future. The chmod() code is thus more practical, + // rather than always hitting ENOTSUP when sending in AT_SYMLINK_NO_FOLLOW. + // - See the 3rd paragraph of + // "Symbolic link ownership, permissions, and timestamps" at: + // "http://man7.org/linux/man-pages/man7/symlink.7.html" + // - See the fchmodat() Linux man page: + // "http://man7.org/linux/man-pages/man2/fchmodat.2.html" +# if defined(AT_FDCWD) && defined(AT_SYMLINK_NOFOLLOW) \ + && !(defined(__SUNPRO_CC) || defined(sun)) \ + && !(defined(linux) || defined(__linux) || defined(__linux__)) + if (::fchmodat(AT_FDCWD, p.c_str(), mode_cast(prms), + !(prms & symlink_perms) ? 0 : AT_SYMLINK_NOFOLLOW)) +# else // fallback if fchmodat() not supported + if (::chmod(p.c_str(), mode_cast(prms))) +# endif + { + if (ec == 0) + BOOST_FILESYSTEM_THROW(filesystem_error( + "boost::filesystem::permissions", p, + error_code(errno, system::generic_category()))); + else + ec->assign(errno, system::generic_category()); + } + +# else // Windows + + // if not going to alter FILE_ATTRIBUTE_READONLY, just return + if (!(!((prms & (add_perms | remove_perms))) + || (prms & (owner_write|group_write|others_write)))) + return; + + DWORD attr = ::GetFileAttributesW(p.c_str()); + + if (error(attr == 0, p, ec, "boost::filesystem::permissions")) + return; + + if (prms & add_perms) + attr &= ~FILE_ATTRIBUTE_READONLY; + else if (prms & remove_perms) + attr |= FILE_ATTRIBUTE_READONLY; + else if (prms & (owner_write|group_write|others_write)) + attr &= ~FILE_ATTRIBUTE_READONLY; + else + attr |= FILE_ATTRIBUTE_READONLY; + + error(::SetFileAttributesW(p.c_str(), attr) == 0, + p, ec, "boost::filesystem::permissions"); +# endif + } + + BOOST_FILESYSTEM_DECL + path read_symlink(const path& p, system::error_code* ec) + { + path symlink_path; + +# ifdef BOOST_POSIX_API + + for (std::size_t path_max = 64;; path_max *= 2)// loop 'til buffer large enough + { + boost::scoped_array<char> buf(new char[path_max]); + ssize_t result; + if ((result=::readlink(p.c_str(), buf.get(), path_max))== -1) + { + if (ec == 0) + BOOST_FILESYSTEM_THROW(filesystem_error("boost::filesystem::read_symlink", + p, error_code(errno, system_category()))); + else ec->assign(errno, system_category()); + break; + } + else + { + if(result != static_cast<ssize_t>(path_max)) + { + symlink_path.assign(buf.get(), buf.get() + result); + if (ec != 0) ec->clear(); + break; + } + } + } + +# elif _WIN32_WINNT < 0x0600 // SDK earlier than Vista and Server 2008 + error(true, error_code(BOOST_ERROR_NOT_SUPPORTED, system_category()), p, ec, + "boost::filesystem::read_symlink"); +# else // Vista and Server 2008 SDK, or later + + union info_t + { + char buf[REPARSE_DATA_BUFFER_HEADER_SIZE+MAXIMUM_REPARSE_DATA_BUFFER_SIZE]; + REPARSE_DATA_BUFFER rdb; + } info; + + handle_wrapper h( + create_file_handle(p.c_str(), GENERIC_READ, 0, 0, OPEN_EXISTING, + FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT, 0)); + + if (error(h.handle == INVALID_HANDLE_VALUE, p, ec, "boost::filesystem::read_symlink")) + return symlink_path; + + DWORD sz; + + if (!error(::DeviceIoControl(h.handle, FSCTL_GET_REPARSE_POINT, + 0, 0, info.buf, sizeof(info), &sz, 0) == 0, p, ec, + "boost::filesystem::read_symlink" )) + symlink_path.assign( + static_cast<wchar_t*>(info.rdb.SymbolicLinkReparseBuffer.PathBuffer) + + info.rdb.SymbolicLinkReparseBuffer.PrintNameOffset/sizeof(wchar_t), + static_cast<wchar_t*>(info.rdb.SymbolicLinkReparseBuffer.PathBuffer) + + info.rdb.SymbolicLinkReparseBuffer.PrintNameOffset/sizeof(wchar_t) + + info.rdb.SymbolicLinkReparseBuffer.PrintNameLength/sizeof(wchar_t)); +# endif + return symlink_path; + } + + BOOST_FILESYSTEM_DECL + bool remove(const path& p, error_code* ec) + { + error_code tmp_ec; + file_type type = query_file_type(p, &tmp_ec); + if (error(type == status_error, tmp_ec, p, ec, + "boost::filesystem::remove")) + return false; + + // Since POSIX remove() is specified to work with either files or directories, in a + // perfect world it could just be called. But some important real-world operating + // systems (Windows, Mac OS X, for example) don't implement the POSIX spec. So + // remove_file_or_directory() is always called to kep it simple. + return remove_file_or_directory(p, type, ec); + } + + BOOST_FILESYSTEM_DECL + boost::uintmax_t remove_all(const path& p, error_code* ec) + { + error_code tmp_ec; + file_type type = query_file_type(p, &tmp_ec); + if (error(type == status_error, tmp_ec, p, ec, + "boost::filesystem::remove_all")) + return 0; + + return (type != status_error && type != file_not_found) // exists + ? remove_all_aux(p, type, ec) + : 0; + } + + BOOST_FILESYSTEM_DECL + void rename(const path& old_p, const path& new_p, error_code* ec) + { + error(!BOOST_MOVE_FILE(old_p.c_str(), new_p.c_str()), old_p, new_p, ec, + "boost::filesystem::rename"); + } + + BOOST_FILESYSTEM_DECL + void resize_file(const path& p, uintmax_t size, system::error_code* ec) + { + error(!BOOST_RESIZE_FILE(p.c_str(), size), p, ec, "boost::filesystem::resize_file"); + } + + BOOST_FILESYSTEM_DECL + space_info space(const path& p, error_code* ec) + { +# ifdef BOOST_POSIX_API + struct BOOST_STATVFS vfs; + space_info info; + if (!error(::BOOST_STATVFS(p.c_str(), &vfs)!= 0, + p, ec, "boost::filesystem::space")) + { + info.capacity + = static_cast<boost::uintmax_t>(vfs.f_blocks)* BOOST_STATVFS_F_FRSIZE; + info.free + = static_cast<boost::uintmax_t>(vfs.f_bfree)* BOOST_STATVFS_F_FRSIZE; + info.available + = static_cast<boost::uintmax_t>(vfs.f_bavail)* BOOST_STATVFS_F_FRSIZE; + } + +# else + ULARGE_INTEGER avail, total, free; + space_info info; + + if (!error(::GetDiskFreeSpaceExW(p.c_str(), &avail, &total, &free)== 0, + p, ec, "boost::filesystem::space")) + { + info.capacity + = (static_cast<boost::uintmax_t>(total.HighPart)<< 32) + + total.LowPart; + info.free + = (static_cast<boost::uintmax_t>(free.HighPart)<< 32) + + free.LowPart; + info.available + = (static_cast<boost::uintmax_t>(avail.HighPart)<< 32) + + avail.LowPart; + } + +# endif + + else + { + info.capacity = info.free = info.available = 0; + } + return info; + } + + BOOST_FILESYSTEM_DECL + file_status status(const path& p, error_code* ec) + { +# ifdef BOOST_POSIX_API + + struct stat path_stat; + if (::stat(p.c_str(), &path_stat)!= 0) + { + if (ec != 0) // always report errno, even though some + ec->assign(errno, system_category()); // errno values are not status_errors + + if (not_found_error(errno)) + { + return fs::file_status(fs::file_not_found, fs::no_perms); + } + if (ec == 0) + BOOST_FILESYSTEM_THROW(filesystem_error("boost::filesystem::status", + p, error_code(errno, system_category()))); + return fs::file_status(fs::status_error); + } + if (ec != 0) ec->clear();; + if (S_ISDIR(path_stat.st_mode)) + return fs::file_status(fs::directory_file, + static_cast<perms>(path_stat.st_mode) & fs::perms_mask); + if (S_ISREG(path_stat.st_mode)) + return fs::file_status(fs::regular_file, + static_cast<perms>(path_stat.st_mode) & fs::perms_mask); + if (S_ISBLK(path_stat.st_mode)) + return fs::file_status(fs::block_file, + static_cast<perms>(path_stat.st_mode) & fs::perms_mask); + if (S_ISCHR(path_stat.st_mode)) + return fs::file_status(fs::character_file, + static_cast<perms>(path_stat.st_mode) & fs::perms_mask); + if (S_ISFIFO(path_stat.st_mode)) + return fs::file_status(fs::fifo_file, + static_cast<perms>(path_stat.st_mode) & fs::perms_mask); + if (S_ISSOCK(path_stat.st_mode)) + return fs::file_status(fs::socket_file, + static_cast<perms>(path_stat.st_mode) & fs::perms_mask); + return fs::file_status(fs::type_unknown); + +# else // Windows + + DWORD attr(::GetFileAttributesW(p.c_str())); + if (attr == 0xFFFFFFFF) + { + return process_status_failure(p, ec); + } + + // reparse point handling; + // since GetFileAttributesW does not resolve symlinks, try to open a file + // handle to discover if the file exists + if (attr & FILE_ATTRIBUTE_REPARSE_POINT) + { + handle_wrapper h( + create_file_handle( + p.c_str(), + 0, // dwDesiredAccess; attributes only + FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, + 0, // lpSecurityAttributes + OPEN_EXISTING, + FILE_FLAG_BACKUP_SEMANTICS, + 0)); // hTemplateFile + if (h.handle == INVALID_HANDLE_VALUE) + { + return process_status_failure(p, ec); + } + + if (!is_reparse_point_a_symlink(p)) + return file_status(reparse_file, make_permissions(p, attr)); + } + + if (ec != 0) ec->clear(); + return (attr & FILE_ATTRIBUTE_DIRECTORY) + ? file_status(directory_file, make_permissions(p, attr)) + : file_status(regular_file, make_permissions(p, attr)); + +# endif + } + + BOOST_FILESYSTEM_DECL + file_status symlink_status(const path& p, error_code* ec) + { +# ifdef BOOST_POSIX_API + + struct stat path_stat; + if (::lstat(p.c_str(), &path_stat)!= 0) + { + if (ec != 0) // always report errno, even though some + ec->assign(errno, system_category()); // errno values are not status_errors + + if (errno == ENOENT || errno == ENOTDIR) // these are not errors + { + return fs::file_status(fs::file_not_found, fs::no_perms); + } + if (ec == 0) + BOOST_FILESYSTEM_THROW(filesystem_error("boost::filesystem::status", + p, error_code(errno, system_category()))); + return fs::file_status(fs::status_error); + } + if (ec != 0) ec->clear(); + if (S_ISREG(path_stat.st_mode)) + return fs::file_status(fs::regular_file, + static_cast<perms>(path_stat.st_mode) & fs::perms_mask); + if (S_ISDIR(path_stat.st_mode)) + return fs::file_status(fs::directory_file, + static_cast<perms>(path_stat.st_mode) & fs::perms_mask); + if (S_ISLNK(path_stat.st_mode)) + return fs::file_status(fs::symlink_file, + static_cast<perms>(path_stat.st_mode) & fs::perms_mask); + if (S_ISBLK(path_stat.st_mode)) + return fs::file_status(fs::block_file, + static_cast<perms>(path_stat.st_mode) & fs::perms_mask); + if (S_ISCHR(path_stat.st_mode)) + return fs::file_status(fs::character_file, + static_cast<perms>(path_stat.st_mode) & fs::perms_mask); + if (S_ISFIFO(path_stat.st_mode)) + return fs::file_status(fs::fifo_file, + static_cast<perms>(path_stat.st_mode) & fs::perms_mask); + if (S_ISSOCK(path_stat.st_mode)) + return fs::file_status(fs::socket_file, + static_cast<perms>(path_stat.st_mode) & fs::perms_mask); + return fs::file_status(fs::type_unknown); + +# else // Windows + + DWORD attr(::GetFileAttributesW(p.c_str())); + if (attr == 0xFFFFFFFF) + { + return process_status_failure(p, ec); + } + + if (ec != 0) ec->clear(); + + if (attr & FILE_ATTRIBUTE_REPARSE_POINT) + return is_reparse_point_a_symlink(p) + ? file_status(symlink_file, make_permissions(p, attr)) + : file_status(reparse_file, make_permissions(p, attr)); + + return (attr & FILE_ATTRIBUTE_DIRECTORY) + ? file_status(directory_file, make_permissions(p, attr)) + : file_status(regular_file, make_permissions(p, attr)); + +# endif + } + + // contributed by Jeff Flinn + BOOST_FILESYSTEM_DECL + path temp_directory_path(system::error_code* ec) + { +# ifdef BOOST_POSIX_API + const char* val = 0; + + (val = std::getenv("TMPDIR" )) || + (val = std::getenv("TMP" )) || + (val = std::getenv("TEMP" )) || + (val = std::getenv("TEMPDIR")); + + path p((val!=0) ? val : "/tmp"); + + if (p.empty() || (ec&&!is_directory(p, *ec))||(!ec&&!is_directory(p))) + { + errno = ENOTDIR; + error(true, p, ec, "boost::filesystem::temp_directory_path"); + return p; + } + + return p; + +# else // Windows + + std::vector<path::value_type> buf(GetTempPathW(0, NULL)); + + if (buf.empty() || GetTempPathW(buf.size(), &buf[0])==0) + { + if(!buf.empty()) ::SetLastError(ENOTDIR); + error(true, ec, "boost::filesystem::temp_directory_path"); + return path(); + } + + buf.pop_back(); + + path p(buf.begin(), buf.end()); + + if ((ec&&!is_directory(p, *ec))||(!ec&&!is_directory(p))) + { + ::SetLastError(ENOTDIR); + error(true, p, ec, "boost::filesystem::temp_directory_path"); + return path(); + } + + return p; +# endif + } + + BOOST_FILESYSTEM_DECL + path system_complete(const path& p, system::error_code* ec) + { +# ifdef BOOST_POSIX_API + return (p.empty() || p.is_absolute()) + ? p : current_path()/ p; + +# else + if (p.empty()) + { + if (ec != 0) ec->clear(); + return p; + } + wchar_t buf[buf_size]; + wchar_t* pfn; + std::size_t len = get_full_path_name(p, buf_size, buf, &pfn); + + if (error(len == 0, p, ec, "boost::filesystem::system_complete")) + return path(); + + if (len < buf_size)// len does not include null termination character + return path(&buf[0]); + + boost::scoped_array<wchar_t> big_buf(new wchar_t[len]); + + return error(get_full_path_name(p, len , big_buf.get(), &pfn)== 0, + p, ec, "boost::filesystem::system_complete") + ? path() + : path(big_buf.get()); +# endif + } + +} // namespace detail + +//--------------------------------------------------------------------------------------// +// // +// directory_entry // +// // +//--------------------------------------------------------------------------------------// + + file_status + directory_entry::m_get_status(system::error_code* ec) const + { + if (!status_known(m_status)) + { + // optimization: if the symlink status is known, and it isn't a symlink, + // then status and symlink_status are identical so just copy the + // symlink status to the regular status. + if (status_known(m_symlink_status) + && !is_symlink(m_symlink_status)) + { + m_status = m_symlink_status; + if (ec != 0) ec->clear(); + } + else m_status = detail::status(m_path, ec); + } + else if (ec != 0) ec->clear(); + return m_status; + } + + file_status + directory_entry::m_get_symlink_status(system::error_code* ec) const + { + if (!status_known(m_symlink_status)) + m_symlink_status = detail::symlink_status(m_path, ec); + else if (ec != 0) ec->clear(); + return m_symlink_status; + } + +// dispatch directory_entry supplied here rather than in +// <boost/filesystem/path_traits.hpp>, thus avoiding header circularity. +// test cases are in operations_unit_test.cpp + +namespace path_traits +{ + void dispatch(const directory_entry & de, +# ifdef BOOST_WINDOWS_API + std::wstring& to, +# else + std::string& to, +# endif + const codecvt_type &) + { + to = de.path().native(); + } + +} // namespace path_traits +} // namespace filesystem +} // namespace boost + +//--------------------------------------------------------------------------------------// +// // +// directory_iterator // +// // +//--------------------------------------------------------------------------------------// + +namespace +{ +# ifdef BOOST_POSIX_API + + error_code path_max(std::size_t & result) + // this code is based on Stevens and Rago, Advanced Programming in the + // UNIX envirnment, 2nd Ed., ISBN 0-201-43307-9, page 49 + { +# ifdef PATH_MAX + static std::size_t max = PATH_MAX; +# else + static std::size_t max = 0; +# endif + if (max == 0) + { + errno = 0; + long tmp = ::pathconf("/", _PC_NAME_MAX); + if (tmp < 0) + { + if (errno == 0)// indeterminate + max = 4096; // guess + else return error_code(errno, system_category()); + } + else max = static_cast<std::size_t>(tmp + 1); // relative root + } + result = max; + return ok; + } + +#if defined(__PGI) && defined(__USE_FILE_OFFSET64) +#define dirent dirent64 +#endif + + error_code dir_itr_first(void *& handle, void *& buffer, + const char* dir, string& target, + fs::file_status &, fs::file_status &) + { + if ((handle = ::opendir(dir))== 0) + return error_code(errno, system_category()); + target = string("."); // string was static but caused trouble + // when iteration called from dtor, after + // static had already been destroyed + std::size_t path_size (0); // initialization quiets gcc warning (ticket #3509) + error_code ec = path_max(path_size); + if (ec)return ec; + dirent de; + buffer = std::malloc((sizeof(dirent) - sizeof(de.d_name)) + + path_size + 1); // + 1 for "/0" + return ok; + } + + // warning: the only dirent member updated is d_name + inline int readdir_r_simulator(DIR * dirp, struct dirent * entry, + struct dirent ** result)// *result set to 0 on end of directory + { + errno = 0; + +# if !defined(__CYGWIN__)\ + && defined(_POSIX_THREAD_SAFE_FUNCTIONS)\ + && defined(_SC_THREAD_SAFE_FUNCTIONS)\ + && (_POSIX_THREAD_SAFE_FUNCTIONS+0 >= 0)\ + && (!defined(__hpux) || defined(_REENTRANT)) \ + && (!defined(_AIX) || defined(__THREAD_SAFE)) + if (::sysconf(_SC_THREAD_SAFE_FUNCTIONS)>= 0) + { return ::readdir_r(dirp, entry, result); } +# endif + + struct dirent * p; + *result = 0; + if ((p = ::readdir(dirp))== 0) + return errno; + std::strcpy(entry->d_name, p->d_name); + *result = entry; + return 0; + } + + error_code dir_itr_increment(void *& handle, void *& buffer, + string& target, fs::file_status & sf, fs::file_status & symlink_sf) + { + BOOST_ASSERT(buffer != 0); + dirent * entry(static_cast<dirent *>(buffer)); + dirent * result; + int return_code; + if ((return_code = readdir_r_simulator(static_cast<DIR*>(handle), entry, &result))!= 0) + return error_code(errno, system_category()); + if (result == 0) + return fs::detail::dir_itr_close(handle, buffer); + target = entry->d_name; +# ifdef BOOST_FILESYSTEM_STATUS_CACHE + if (entry->d_type == DT_UNKNOWN) // filesystem does not supply d_type value + { + sf = symlink_sf = fs::file_status(fs::status_error); + } + else // filesystem supplies d_type value + { + if (entry->d_type == DT_DIR) + sf = symlink_sf = fs::file_status(fs::directory_file); + else if (entry->d_type == DT_REG) + sf = symlink_sf = fs::file_status(fs::regular_file); + else if (entry->d_type == DT_LNK) + { + sf = fs::file_status(fs::status_error); + symlink_sf = fs::file_status(fs::symlink_file); + } + else sf = symlink_sf = fs::file_status(fs::status_error); + } +# else + sf = symlink_sf = fs::file_status(fs::status_error); +# endif + return ok; + } + +# else // BOOST_WINDOWS_API + + error_code dir_itr_first(void *& handle, const fs::path& dir, + wstring& target, fs::file_status & sf, fs::file_status & symlink_sf) + // Note: an empty root directory has no "." or ".." entries, so this + // causes a ERROR_FILE_NOT_FOUND error which we do not considered an + // error. It is treated as eof instead. + { + // use a form of search Sebastian Martel reports will work with Win98 + wstring dirpath(dir.wstring()); + dirpath += (dirpath.empty() + || (dirpath[dirpath.size()-1] != L'\\' + && dirpath[dirpath.size()-1] != L'/' + && dirpath[dirpath.size()-1] != L':'))? L"\\*" : L"*"; + + WIN32_FIND_DATAW data; + if ((handle = ::FindFirstFileW(dirpath.c_str(), &data)) + == INVALID_HANDLE_VALUE) + { + handle = 0; // signal eof + return error_code( (::GetLastError() == ERROR_FILE_NOT_FOUND + // Windows Mobile returns ERROR_NO_MORE_FILES; see ticket #3551 + || ::GetLastError() == ERROR_NO_MORE_FILES) + ? 0 : ::GetLastError(), system_category() ); + } + target = data.cFileName; + if (data.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) + // reparse points are complex, so don't try to handle them here; instead just mark + // them as status_error which causes directory_entry caching to call status() + // and symlink_status() which do handle reparse points fully + { + sf.type(fs::status_error); + symlink_sf.type(fs::status_error); + } + else + { + if (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) + { + sf.type(fs::directory_file); + symlink_sf.type(fs::directory_file); + } + else + { + sf.type(fs::regular_file); + symlink_sf.type(fs::regular_file); + } + sf.permissions(make_permissions(data.cFileName, data.dwFileAttributes)); + symlink_sf.permissions(sf.permissions()); + } + return error_code(); + } + + error_code dir_itr_increment(void *& handle, wstring& target, + fs::file_status & sf, fs::file_status & symlink_sf) + { + WIN32_FIND_DATAW data; + if (::FindNextFileW(handle, &data)== 0)// fails + { + int error = ::GetLastError(); + fs::detail::dir_itr_close(handle); + return error_code(error == ERROR_NO_MORE_FILES ? 0 : error, system_category()); + } + target = data.cFileName; + if (data.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) + // reparse points are complex, so don't try to handle them here; instead just mark + // them as status_error which causes directory_entry caching to call status() + // and symlink_status() which do handle reparse points fully + { + sf.type(fs::status_error); + symlink_sf.type(fs::status_error); + } + else + { + if (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) + { + sf.type(fs::directory_file); + symlink_sf.type(fs::directory_file); + } + else + { + sf.type(fs::regular_file); + symlink_sf.type(fs::regular_file); + } + sf.permissions(make_permissions(data.cFileName, data.dwFileAttributes)); + symlink_sf.permissions(sf.permissions()); + } + return error_code(); + } +#endif + + const error_code not_found_error_code ( +# ifdef BOOST_WINDOWS_API + ERROR_PATH_NOT_FOUND +# else + ENOENT +# endif + , system_category()); + +} // unnamed namespace + +namespace boost +{ +namespace filesystem +{ + +namespace detail +{ + // dir_itr_close is called both from the ~dir_itr_imp()destructor + // and dir_itr_increment() + BOOST_FILESYSTEM_DECL + system::error_code dir_itr_close( // never throws + void *& handle +# if defined(BOOST_POSIX_API) + , void *& buffer +# endif + ) + { +# ifdef BOOST_POSIX_API + std::free(buffer); + buffer = 0; + if (handle == 0)return ok; + DIR * h(static_cast<DIR*>(handle)); + handle = 0; + return error_code(::closedir(h)== 0 ? 0 : errno, system_category()); + +# else + if (handle != 0) + { + ::FindClose(handle); + handle = 0; + } + return ok; + +# endif + } + + void directory_iterator_construct(directory_iterator& it, + const path& p, system::error_code* ec) + { + if (error(p.empty(), not_found_error_code, p, ec, + "boost::filesystem::directory_iterator::construct")) + return; + + path::string_type filename; + file_status file_stat, symlink_file_stat; + error_code result = dir_itr_first(it.m_imp->handle, +# if defined(BOOST_POSIX_API) + it.m_imp->buffer, +# endif + p.c_str(), filename, file_stat, symlink_file_stat); + + if (result) + { + it.m_imp.reset(); + error(true, result, p, + ec, "boost::filesystem::directory_iterator::construct"); + return; + } + + if (it.m_imp->handle == 0) + it.m_imp.reset(); // eof, so make end iterator + else // not eof + { + it.m_imp->dir_entry.assign(p / filename, file_stat, symlink_file_stat); + if (filename[0] == dot // dot or dot-dot + && (filename.size()== 1 + || (filename[1] == dot + && filename.size()== 2))) + { it.increment(*ec); } + } + } + + void directory_iterator_increment(directory_iterator& it, + system::error_code* ec) + { + BOOST_ASSERT_MSG(it.m_imp.get(), "attempt to increment end iterator"); + BOOST_ASSERT_MSG(it.m_imp->handle != 0, "internal program error"); + + path::string_type filename; + file_status file_stat, symlink_file_stat; + system::error_code temp_ec; + + for (;;) + { + temp_ec = dir_itr_increment(it.m_imp->handle, +# if defined(BOOST_POSIX_API) + it.m_imp->buffer, +# endif + filename, file_stat, symlink_file_stat); + + if (temp_ec) // happens if filesystem is corrupt, such as on a damaged optical disc + { + path error_path(it.m_imp->dir_entry.path().parent_path()); // fix ticket #5900 + it.m_imp.reset(); + if (ec == 0) + BOOST_FILESYSTEM_THROW( + filesystem_error("boost::filesystem::directory_iterator::operator++", + error_path, + error_code(BOOST_ERRNO, system_category()))); + ec->assign(BOOST_ERRNO, system_category()); + return; + } + else if (ec != 0) ec->clear(); + + if (it.m_imp->handle == 0) // eof, make end + { + it.m_imp.reset(); + return; + } + + if (!(filename[0] == dot // !(dot or dot-dot) + && (filename.size()== 1 + || (filename[1] == dot + && filename.size()== 2)))) + { + it.m_imp->dir_entry.replace_filename( + filename, file_stat, symlink_file_stat); + return; + } + } + } +} // namespace detail +} // namespace filesystem +} // namespace boost diff --git a/3rdParty/Boost/src/libs/filesystem/src/path.cpp b/3rdParty/Boost/src/libs/filesystem/src/path.cpp new file mode 100644 index 0000000..c740dec --- /dev/null +++ b/3rdParty/Boost/src/libs/filesystem/src/path.cpp @@ -0,0 +1,929 @@ +// filesystem path.cpp ------------------------------------------------------------- // + +// Copyright Beman Dawes 2008 + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +// Library home page: http://www.boost.org/libs/filesystem + +// Old standard library configurations, particularly MingGW, don't support wide strings. +// Report this with an explicit error message. +#include <boost/config.hpp> +# if defined( BOOST_NO_STD_WSTRING ) +# error Configuration not supported: Boost.Filesystem V3 and later requires std::wstring support +# endif + +// define BOOST_FILESYSTEM_SOURCE so that <boost/system/config.hpp> knows +// the library is being built (possibly exporting rather than importing code) +#define BOOST_FILESYSTEM_SOURCE + +#ifndef BOOST_SYSTEM_NO_DEPRECATED +# define BOOST_SYSTEM_NO_DEPRECATED +#endif + +#include <boost/filesystem/config.hpp> +#include <boost/filesystem/path.hpp> +#include <boost/scoped_array.hpp> +#include <boost/system/error_code.hpp> +#include <boost/assert.hpp> +#include <algorithm> +#include <cstddef> +#include <cstring> +#include <cassert> + +#ifdef BOOST_WINDOWS_API +# include "windows_file_codecvt.hpp" +# include <windows.h> +#elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__) +# include <boost/filesystem/detail/utf8_codecvt_facet.hpp> +#endif + +#ifdef BOOST_FILESYSTEM_DEBUG +# include <iostream> +# include <iomanip> +#endif + +namespace fs = boost::filesystem; + +using boost::filesystem::path; + +using std::string; +using std::wstring; + +using boost::system::error_code; + +#ifndef BOOST_FILESYSTEM_CODECVT_BUF_SIZE +# define BOOST_FILESYSTEM_CODECVT_BUF_SIZE 256 +#endif + +//--------------------------------------------------------------------------------------// +// // +// class path helpers // +// // +//--------------------------------------------------------------------------------------// + +namespace +{ + //------------------------------------------------------------------------------------// + // miscellaneous class path helpers // + //------------------------------------------------------------------------------------// + + typedef path::value_type value_type; + typedef path::string_type string_type; + typedef string_type::size_type size_type; + + const std::size_t default_codecvt_buf_size = BOOST_FILESYSTEM_CODECVT_BUF_SIZE; + +# ifdef BOOST_WINDOWS_API + + const wchar_t separator = L'/'; + const wchar_t* const separators = L"/\\"; + const wchar_t* separator_string = L"/"; + const wchar_t* preferred_separator_string = L"\\"; + const wchar_t colon = L':'; + const wchar_t dot = L'.'; + const wchar_t questionmark = L'?'; + const fs::path dot_path(L"."); + const fs::path dot_dot_path(L".."); + + inline bool is_letter(wchar_t c) + { + return (c >= L'a' && c <=L'z') || (c >= L'A' && c <=L'Z'); + } + +# else + + const char separator = '/'; + const char* const separators = "/"; + const char* separator_string = "/"; + const char* preferred_separator_string = "/"; + const char colon = ':'; + const char dot = '.'; + const fs::path dot_path("."); + const fs::path dot_dot_path(".."); + +# endif + + inline bool is_separator(fs::path::value_type c) + { + return c == separator +# ifdef BOOST_WINDOWS_API + || c == path::preferred_separator +# endif + ; + } + + bool is_root_separator(const string_type& str, size_type pos); + // pos is position of the separator + + size_type filename_pos(const string_type& str, + size_type end_pos); // end_pos is past-the-end position + // Returns: 0 if str itself is filename (or empty) + + size_type root_directory_start(const string_type& path, size_type size); + // Returns: npos if no root_directory found + + void first_element( + const string_type& src, + size_type& element_pos, + size_type& element_size, +# if !BOOST_WORKAROUND(BOOST_MSVC, <= 1310) // VC++ 7.1 + size_type size = string_type::npos +# else + size_type size = -1 +# endif + ); + +} // unnamed namespace + +//--------------------------------------------------------------------------------------// +// // +// class path implementation // +// // +//--------------------------------------------------------------------------------------// + +namespace boost +{ +namespace filesystem +{ + path& path::operator/=(const path& p) + { + if (p.empty()) + return *this; + if (this == &p) // self-append + { + path rhs(p); + if (!is_separator(rhs.m_pathname[0])) + m_append_separator_if_needed(); + m_pathname += rhs.m_pathname; + } + else + { + if (!is_separator(*p.m_pathname.begin())) + m_append_separator_if_needed(); + m_pathname += p.m_pathname; + } + return *this; + } + + path& path::operator/=(const value_type* ptr) + { + if (!*ptr) + return *this; + if (ptr >= m_pathname.data() + && ptr < m_pathname.data() + m_pathname.size()) // overlapping source + { + path rhs(ptr); + if (!is_separator(rhs.m_pathname[0])) + m_append_separator_if_needed(); + m_pathname += rhs.m_pathname; + } + else + { + if (!is_separator(*ptr)) + m_append_separator_if_needed(); + m_pathname += ptr; + } + return *this; + } + + int path::compare(const path& p) const BOOST_NOEXCEPT + { + return detail::lex_compare(begin(), end(), p.begin(), p.end()); + } + +# ifdef BOOST_WINDOWS_API + + const std::string path::generic_string(const codecvt_type& cvt) const + { + path tmp(*this); + std::replace(tmp.m_pathname.begin(), tmp.m_pathname.end(), L'\\', L'/'); + return tmp.string(cvt); + } + + const std::wstring path::generic_wstring() const + { + path tmp(*this); + std::replace(tmp.m_pathname.begin(), tmp.m_pathname.end(), L'\\', L'/'); + return tmp.wstring(); + } + +# endif // BOOST_WINDOWS_API + + // m_append_separator_if_needed ----------------------------------------------------// + + path::string_type::size_type path::m_append_separator_if_needed() + { + if (!m_pathname.empty() && +# ifdef BOOST_WINDOWS_API + *(m_pathname.end()-1) != colon && +# endif + !is_separator(*(m_pathname.end()-1))) + { + string_type::size_type tmp(m_pathname.size()); + m_pathname += preferred_separator; + return tmp; + } + return 0; + } + + // m_erase_redundant_separator -----------------------------------------------------// + + void path::m_erase_redundant_separator(string_type::size_type sep_pos) + { + if (sep_pos // a separator was added + && sep_pos < m_pathname.size() // and something was appended + && (m_pathname[sep_pos+1] == separator // and it was also separator +# ifdef BOOST_WINDOWS_API + || m_pathname[sep_pos+1] == preferred_separator // or preferred_separator +# endif +)) { m_pathname.erase(sep_pos, 1); } // erase the added separator + } + + // modifiers -----------------------------------------------------------------------// + +# ifdef BOOST_WINDOWS_API + path & path::make_preferred() + { + std::replace(m_pathname.begin(), m_pathname.end(), L'/', L'\\'); + return *this; + } +# endif + + path& path::remove_filename() + { + m_pathname.erase(m_parent_path_end()); + return *this; + } + + path& path::replace_extension(const path& new_extension) + { + // erase existing extension, including the dot, if any + m_pathname.erase(m_pathname.size()-extension().m_pathname.size()); + + if (!new_extension.empty()) + { + // append new_extension, adding the dot if necessary + if (new_extension.m_pathname[0] != dot) + m_pathname.push_back(dot); + m_pathname.append(new_extension.m_pathname); + } + + return *this; + } + + // decomposition -------------------------------------------------------------------// + + path path::root_path() const + { + path temp(root_name()); + if (!root_directory().empty()) temp.m_pathname += root_directory().c_str(); + return temp; + } + + path path::root_name() const + { + iterator itr(begin()); + + return (itr.m_pos != m_pathname.size() + && ( + (itr.m_element.m_pathname.size() > 1 + && is_separator(itr.m_element.m_pathname[0]) + && is_separator(itr.m_element.m_pathname[1]) + ) +# ifdef BOOST_WINDOWS_API + || itr.m_element.m_pathname[itr.m_element.m_pathname.size()-1] == colon +# endif + )) + ? itr.m_element + : path(); + } + + path path::root_directory() const + { + size_type pos(root_directory_start(m_pathname, m_pathname.size())); + + return pos == string_type::npos + ? path() + : path(m_pathname.c_str() + pos, m_pathname.c_str() + pos + 1); + } + + path path::relative_path() const + { + iterator itr(begin()); + + for (; itr.m_pos != m_pathname.size() + && (is_separator(itr.m_element.m_pathname[0]) +# ifdef BOOST_WINDOWS_API + || itr.m_element.m_pathname[itr.m_element.m_pathname.size()-1] == colon +# endif + ); ++itr) {} + + return path(m_pathname.c_str() + itr.m_pos); + } + + string_type::size_type path::m_parent_path_end() const + { + size_type end_pos(filename_pos(m_pathname, m_pathname.size())); + + bool filename_was_separator(m_pathname.size() + && is_separator(m_pathname[end_pos])); + + // skip separators unless root directory + size_type root_dir_pos(root_directory_start(m_pathname, end_pos)); + for (; + end_pos > 0 + && (end_pos-1) != root_dir_pos + && is_separator(m_pathname[end_pos-1]) + ; + --end_pos) {} + + return (end_pos == 1 && root_dir_pos == 0 && filename_was_separator) + ? string_type::npos + : end_pos; + } + + path path::parent_path() const + { + size_type end_pos(m_parent_path_end()); + return end_pos == string_type::npos + ? path() + : path(m_pathname.c_str(), m_pathname.c_str() + end_pos); + } + + path path::filename() const + { + size_type pos(filename_pos(m_pathname, m_pathname.size())); + return (m_pathname.size() + && pos + && is_separator(m_pathname[pos]) + && !is_root_separator(m_pathname, pos)) + ? dot_path + : path(m_pathname.c_str() + pos); + } + + path path::stem() const + { + path name(filename()); + if (name == dot_path || name == dot_dot_path) return name; + size_type pos(name.m_pathname.rfind(dot)); + return pos == string_type::npos + ? name + : path(name.m_pathname.c_str(), name.m_pathname.c_str() + pos); + } + + path path::extension() const + { + path name(filename()); + if (name == dot_path || name == dot_dot_path) return path(); + size_type pos(name.m_pathname.rfind(dot)); + return pos == string_type::npos + ? path() + : path(name.m_pathname.c_str() + pos); + } + + // m_normalize ----------------------------------------------------------------------// + + path& path::m_normalize() + { + if (m_pathname.empty()) return *this; + + path temp; + iterator start(begin()); + iterator last(end()); + iterator stop(last--); + for (iterator itr(start); itr != stop; ++itr) + { + // ignore "." except at start and last + if (itr->native().size() == 1 + && (itr->native())[0] == dot + && itr != start + && itr != last) continue; + + // ignore a name and following ".." + if (!temp.empty() + && itr->native().size() == 2 + && (itr->native())[0] == dot + && (itr->native())[1] == dot) // dot dot + { + string_type lf(temp.filename().native()); + if (lf.size() > 0 + && (lf.size() != 1 + || (lf[0] != dot + && lf[0] != separator)) + && (lf.size() != 2 + || (lf[0] != dot + && lf[1] != dot +# ifdef BOOST_WINDOWS_API + && lf[1] != colon +# endif + ) + ) + ) + { + temp.remove_filename(); + // if not root directory, must also remove "/" if any + if (temp.m_pathname.size() > 0 + && temp.m_pathname[temp.m_pathname.size()-1] + == separator) + { + string_type::size_type rds( + root_directory_start(temp.m_pathname, temp.m_pathname.size())); + if (rds == string_type::npos + || rds != temp.m_pathname.size()-1) + { temp.m_pathname.erase(temp.m_pathname.size()-1); } + } + + iterator next(itr); + if (temp.empty() && ++next != stop + && next == last && *last == dot_path) temp /= dot_path; + continue; + } + } + + temp /= *itr; + }; + + if (temp.empty()) temp /= dot_path; + m_pathname = temp.m_pathname; + return *this; + } + +} // namespace filesystem +} // namespace boost + +//--------------------------------------------------------------------------------------// +// // +// class path helpers implementation // +// // +//--------------------------------------------------------------------------------------// + +namespace +{ + + // is_root_separator ---------------------------------------------------------------// + + bool is_root_separator(const string_type & str, size_type pos) + // pos is position of the separator + { + BOOST_ASSERT_MSG(!str.empty() && is_separator(str[pos]), + "precondition violation"); + + // subsequent logic expects pos to be for leftmost slash of a set + while (pos > 0 && is_separator(str[pos-1])) + --pos; + + // "/" [...] + if (pos == 0) + return true; + +# ifdef BOOST_WINDOWS_API + // "c:/" [...] + if (pos == 2 && is_letter(str[0]) && str[1] == colon) + return true; +# endif + + // "//" name "/" + if (pos < 3 || !is_separator(str[0]) || !is_separator(str[1])) + return false; + + return str.find_first_of(separators, 2) == pos; + } + + // filename_pos --------------------------------------------------------------------// + + size_type filename_pos(const string_type & str, + size_type end_pos) // end_pos is past-the-end position + // return 0 if str itself is filename (or empty) + { + // case: "//" + if (end_pos == 2 + && is_separator(str[0]) + && is_separator(str[1])) return 0; + + // case: ends in "/" + if (end_pos && is_separator(str[end_pos-1])) + return end_pos-1; + + // set pos to start of last element + size_type pos(str.find_last_of(separators, end_pos-1)); + +# ifdef BOOST_WINDOWS_API + if (pos == string_type::npos) + pos = str.find_last_of(colon, end_pos-2); +# endif + + return (pos == string_type::npos // path itself must be a filename (or empty) + || (pos == 1 && is_separator(str[0]))) // or net + ? 0 // so filename is entire string + : pos + 1; // or starts after delimiter + } + + // root_directory_start ------------------------------------------------------------// + + size_type root_directory_start(const string_type & path, size_type size) + // return npos if no root_directory found + { + +# ifdef BOOST_WINDOWS_API + // case "c:/" + if (size > 2 + && path[1] == colon + && is_separator(path[2])) return 2; +# endif + + // case "//" + if (size == 2 + && is_separator(path[0]) + && is_separator(path[1])) return string_type::npos; + +# ifdef BOOST_WINDOWS_API + // case "\\?\" + if (size > 4 + && is_separator(path[0]) + && is_separator(path[1]) + && path[2] == questionmark + && is_separator(path[3])) + { + string_type::size_type pos(path.find_first_of(separators, 4)); + return pos < size ? pos : string_type::npos; + } +# endif + + // case "//net {/}" + if (size > 3 + && is_separator(path[0]) + && is_separator(path[1]) + && !is_separator(path[2])) + { + string_type::size_type pos(path.find_first_of(separators, 2)); + return pos < size ? pos : string_type::npos; + } + + // case "/" + if (size > 0 && is_separator(path[0])) return 0; + + return string_type::npos; + } + + // first_element --------------------------------------------------------------------// + // sets pos and len of first element, excluding extra separators + // if src.empty(), sets pos,len, to 0,0. + + void first_element( + const string_type & src, + size_type & element_pos, + size_type & element_size, + size_type size +) + { + if (size == string_type::npos) size = src.size(); + element_pos = 0; + element_size = 0; + if (src.empty()) return; + + string_type::size_type cur(0); + + // deal with // [network] + if (size >= 2 && is_separator(src[0]) + && is_separator(src[1]) + && (size == 2 + || !is_separator(src[2]))) + { + cur += 2; + element_size += 2; + } + + // leading (not non-network) separator + else if (is_separator(src[0])) + { + ++element_size; + // bypass extra leading separators + while (cur+1 < size + && is_separator(src[cur+1])) + { + ++cur; + ++element_pos; + } + return; + } + + // at this point, we have either a plain name, a network name, + // or (on Windows only) a device name + + // find the end + while (cur < size +# ifdef BOOST_WINDOWS_API + && src[cur] != colon +# endif + && !is_separator(src[cur])) + { + ++cur; + ++element_size; + } + +# ifdef BOOST_WINDOWS_API + if (cur == size) return; + // include device delimiter + if (src[cur] == colon) + { ++element_size; } +# endif + + return; + } + +} // unnamed namespace + + +namespace boost +{ +namespace filesystem +{ + namespace detail + { + BOOST_FILESYSTEM_DECL + int lex_compare(path::iterator first1, path::iterator last1, + path::iterator first2, path::iterator last2) + { + for (; first1 != last1 && first2 != last2;) + { + if (first1->native() < first2->native()) return -1; + if (first2->native() < first1->native()) return 1; + BOOST_ASSERT(first2->native() == first1->native()); + ++first1; + ++first2; + } + if (first1 == last1 && first2 == last2) + return 0; + return first1 == last1 ? -1 : 1; + } + } + +//--------------------------------------------------------------------------------------// +// // +// class path::iterator implementation // +// // +//--------------------------------------------------------------------------------------// + + path::iterator path::begin() const + { + iterator itr; + itr.m_path_ptr = this; + size_type element_size; + first_element(m_pathname, itr.m_pos, element_size); + itr.m_element = m_pathname.substr(itr.m_pos, element_size); + if (itr.m_element.m_pathname == preferred_separator_string) + itr.m_element.m_pathname = separator_string; // needed for Windows, harmless on POSIX + return itr; + } + + path::iterator path::end() const + { + iterator itr; + itr.m_path_ptr = this; + itr.m_pos = m_pathname.size(); + return itr; + } + + void path::m_path_iterator_increment(path::iterator & it) + { + BOOST_ASSERT_MSG(it.m_pos < it.m_path_ptr->m_pathname.size(), + "path::basic_iterator increment past end()"); + + // increment to position past current element; if current element is implicit dot, + // this will cause it.m_pos to represent the end iterator + it.m_pos += it.m_element.m_pathname.size(); + + // if the end is reached, we are done + if (it.m_pos == it.m_path_ptr->m_pathname.size()) + { + it.m_element.clear(); // aids debugging, may release unneeded memory + return; + } + + // both POSIX and Windows treat paths that begin with exactly two separators specially + bool was_net(it.m_element.m_pathname.size() > 2 + && is_separator(it.m_element.m_pathname[0]) + && is_separator(it.m_element.m_pathname[1]) + && !is_separator(it.m_element.m_pathname[2])); + + // process separator (Windows drive spec is only case not a separator) + if (is_separator(it.m_path_ptr->m_pathname[it.m_pos])) + { + // detect root directory + if (was_net +# ifdef BOOST_WINDOWS_API + // case "c:/" + || it.m_element.m_pathname[it.m_element.m_pathname.size()-1] == colon +# endif + ) + { + it.m_element.m_pathname = separator; // generic format; see docs + return; + } + + // skip separators until it.m_pos points to the start of the next element + while (it.m_pos != it.m_path_ptr->m_pathname.size() + && is_separator(it.m_path_ptr->m_pathname[it.m_pos])) + { ++it.m_pos; } + + // detect trailing separator, and treat it as ".", per POSIX spec + if (it.m_pos == it.m_path_ptr->m_pathname.size() + && !is_root_separator(it.m_path_ptr->m_pathname, it.m_pos-1)) + { + --it.m_pos; + it.m_element = dot_path; + return; + } + } + + // get m_element + size_type end_pos(it.m_path_ptr->m_pathname.find_first_of(separators, it.m_pos)); + if (end_pos == string_type::npos) + end_pos = it.m_path_ptr->m_pathname.size(); + it.m_element = it.m_path_ptr->m_pathname.substr(it.m_pos, end_pos - it.m_pos); + } + + void path::m_path_iterator_decrement(path::iterator & it) + { + BOOST_ASSERT_MSG(it.m_pos, "path::iterator decrement past begin()"); + + size_type end_pos(it.m_pos); + + // if at end and there was a trailing non-root '/', return "." + if (it.m_pos == it.m_path_ptr->m_pathname.size() + && it.m_path_ptr->m_pathname.size() > 1 + && is_separator(it.m_path_ptr->m_pathname[it.m_pos-1]) + && !is_root_separator(it.m_path_ptr->m_pathname, it.m_pos-1) + ) + { + --it.m_pos; + it.m_element = dot_path; + return; + } + + size_type root_dir_pos(root_directory_start(it.m_path_ptr->m_pathname, end_pos)); + + // skip separators unless root directory + for ( + ; + end_pos > 0 + && (end_pos-1) != root_dir_pos + && is_separator(it.m_path_ptr->m_pathname[end_pos-1]) + ; + --end_pos) {} + + it.m_pos = filename_pos(it.m_path_ptr->m_pathname, end_pos); + it.m_element = it.m_path_ptr->m_pathname.substr(it.m_pos, end_pos - it.m_pos); + if (it.m_element.m_pathname == preferred_separator_string) // needed for Windows, harmless on POSIX + it.m_element.m_pathname = separator_string; // generic format; see docs + } + +} // namespace filesystem +} // namespace boost + +//--------------------------------------------------------------------------------------// +// // +// detail helpers // +// // +//--------------------------------------------------------------------------------------// + +namespace +{ + + //------------------------------------------------------------------------------------// + // locale helpers // + //------------------------------------------------------------------------------------// + +#if defined(BOOST_WINDOWS_API) && defined(BOOST_FILESYSTEM_STATIC_LINK) + + inline std::locale default_locale() + { + std::locale global_loc = std::locale(); + std::locale loc(global_loc, new windows_file_codecvt); + return loc; + } + + inline std::locale& path_locale() + { + static std::locale loc(default_locale()); + return loc; + } + + inline const path::codecvt_type*& codecvt_facet_ptr() + { + static const std::codecvt<wchar_t, char, std::mbstate_t>* + facet( + &std::use_facet<std::codecvt<wchar_t, char, std::mbstate_t> > + (path_locale())); + return facet; + } + +#elif defined(BOOST_WINDOWS_API) && !defined(BOOST_FILESYSTEM_STATIC_LINK) + + std::locale path_locale(std::locale(), new windows_file_codecvt); + + const std::codecvt<wchar_t, char, std::mbstate_t>* + codecvt_facet_ptr(&std::use_facet<std::codecvt<wchar_t, char, std::mbstate_t> > + (path_locale)); + +#elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__) + + // "All BSD system functions expect their string parameters to be in UTF-8 encoding + // and nothing else." See + // http://developer.apple.com/mac/library/documentation/MacOSX/Conceptual/BPInternational/Articles/FileEncodings.html + // + // "The kernel will reject any filename that is not a valid UTF-8 string, and it will + // even be normalized (to Unicode NFD) before stored on disk, at least when using HFS. + // The right way to deal with it would be to always convert the filename to UTF-8 + // before trying to open/create a file." See + // http://lists.apple.com/archives/unix-porting/2007/Sep/msg00023.html + // + // "How a file name looks at the API level depends on the API. Current Carbon APIs + // handle file names as an array of UTF-16 characters; POSIX ones handle them as an + // array of UTF-8, which is why UTF-8 works well in Terminal. How it's stored on disk + // depends on the disk format; HFS+ uses UTF-16, but that's not important in most + // cases." See + // http://lists.apple.com/archives/applescript-users/2002/Sep/msg00319.html + // + // Many thanks to Peter Dimov for digging out the above references! + + std::locale path_locale(std::locale(), + new boost::filesystem::detail::utf8_codecvt_facet); + + const std::codecvt<wchar_t, char, std::mbstate_t>* + codecvt_facet_ptr(&std::use_facet<std::codecvt<wchar_t, char, std::mbstate_t> > + (path_locale)); + +#else // Other POSIX + + // ISO C calls std::locale("") "the locale-specific native environment", and this + // locale is the default for many POSIX-based operating systems such as Linux. + + // std::locale("") construction can throw (if environmental variables LC_MESSAGES or + // or LANG are wrong, for example), so lazy initialization is used to ensure + // that exceptions occur after main() starts and so can be caught. + + std::locale path_locale; // initialized by path::codecvt() below + const std::codecvt<wchar_t, char, std::mbstate_t>* codecvt_facet_ptr; // ditto + +# endif + +} // unnamed namespace + +//--------------------------------------------------------------------------------------// +// path::imbue implementation // +//--------------------------------------------------------------------------------------// + +namespace boost +{ +namespace filesystem +{ + +#if defined(BOOST_WINDOWS_API) && defined(BOOST_FILESYSTEM_STATIC_LINK) + + const path::codecvt_type& path::codecvt() + { + BOOST_ASSERT_MSG(codecvt_facet_ptr(), "codecvt_facet_ptr() facet hasn't been properly initialized"); + return *codecvt_facet_ptr(); + } + + std::locale path::imbue(const std::locale & loc) + { + std::locale temp(path_locale()); + path_locale() = loc; + codecvt_facet_ptr() = + &std::use_facet<std::codecvt<wchar_t, char, std::mbstate_t> >(path_locale()); + return temp; + } + +#else + + const path::codecvt_type& path::codecvt() + { +# if defined(BOOST_POSIX_API) && \ + !(defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)) + // A local static initialized by calling path::imbue ensures that std::locale(""), + // which may throw, is called only if path_locale and condecvt_facet will actually + // be used. Thus misconfigured environmental variables will only cause an + // exception if a valid std::locale("") is actually needed. + static std::locale posix_lazy_initialization(path::imbue(std::locale(""))); +# endif + return *codecvt_facet_ptr; + } + + std::locale path::imbue(const std::locale& loc) + { + std::locale temp(path_locale); + path_locale = loc; + codecvt_facet_ptr = + &std::use_facet<std::codecvt<wchar_t, char, std::mbstate_t> >(path_locale); + return temp; + } + + +#endif + +} // namespace filesystem +} // namespace boost diff --git a/3rdParty/Boost/src/libs/filesystem/src/path_traits.cpp b/3rdParty/Boost/src/libs/filesystem/src/path_traits.cpp new file mode 100644 index 0000000..06ac798 --- /dev/null +++ b/3rdParty/Boost/src/libs/filesystem/src/path_traits.cpp @@ -0,0 +1,200 @@ +// filesystem path_traits.cpp --------------------------------------------------------// + +// Copyright Beman Dawes 2008, 2009 + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +// Library home page: http://www.boost.org/libs/filesystem + +//--------------------------------------------------------------------------------------// + +// define BOOST_FILESYSTEM_SOURCE so that <boost/system/config.hpp> knows +// the library is being built (possibly exporting rather than importing code) +#define BOOST_FILESYSTEM_SOURCE + +#ifndef BOOST_SYSTEM_NO_DEPRECATED +# define BOOST_SYSTEM_NO_DEPRECATED +#endif + +#include <boost/filesystem/config.hpp> +#include <boost/filesystem/path_traits.hpp> +#include <boost/system/system_error.hpp> +#include <boost/scoped_array.hpp> +#include <locale> // for codecvt_base::result +#include <cstring> // for strlen +#include <cwchar> // for wcslen + +namespace pt = boost::filesystem::path_traits; +namespace fs = boost::filesystem; +namespace bs = boost::system; + +//--------------------------------------------------------------------------------------// +// configuration // +//--------------------------------------------------------------------------------------// + +#ifndef BOOST_FILESYSTEM_CODECVT_BUF_SIZE +# define BOOST_FILESYSTEM_CODECVT_BUF_SIZE 256 +#endif + +namespace { + + const std::size_t default_codecvt_buf_size = BOOST_FILESYSTEM_CODECVT_BUF_SIZE; + + +//--------------------------------------------------------------------------------------// +// // +// The public convert() functions do buffer management, and then forward to the // +// convert_aux() functions for the actual call to the codecvt facet. // +// // +//--------------------------------------------------------------------------------------// + +//--------------------------------------------------------------------------------------// +// convert_aux const char* to wstring // +//--------------------------------------------------------------------------------------// + + void convert_aux( + const char* from, + const char* from_end, + wchar_t* to, wchar_t* to_end, + std::wstring & target, + const pt::codecvt_type & cvt) + { + //std::cout << std::hex + // << " from=" << std::size_t(from) + // << " from_end=" << std::size_t(from_end) + // << " to=" << std::size_t(to) + // << " to_end=" << std::size_t(to_end) + // << std::endl; + + std::mbstate_t state = std::mbstate_t(); // perhaps unneeded, but cuts bug reports + const char* from_next; + wchar_t* to_next; + + std::codecvt_base::result res; + + if ((res=cvt.in(state, from, from_end, from_next, + to, to_end, to_next)) != std::codecvt_base::ok) + { + //std::cout << " result is " << static_cast<int>(res) << std::endl; + BOOST_FILESYSTEM_THROW(bs::system_error(res, fs::codecvt_error_category(), + "boost::filesystem::path codecvt to wstring")); + } + target.append(to, to_next); + } + +//--------------------------------------------------------------------------------------// +// convert_aux const wchar_t* to string // +//--------------------------------------------------------------------------------------// + + void convert_aux( + const wchar_t* from, + const wchar_t* from_end, + char* to, char* to_end, + std::string & target, + const pt::codecvt_type & cvt) + { + //std::cout << std::hex + // << " from=" << std::size_t(from) + // << " from_end=" << std::size_t(from_end) + // << " to=" << std::size_t(to) + // << " to_end=" << std::size_t(to_end) + // << std::endl; + + std::mbstate_t state = std::mbstate_t(); // perhaps unneeded, but cuts bug reports + const wchar_t* from_next; + char* to_next; + + std::codecvt_base::result res; + + if ((res=cvt.out(state, from, from_end, from_next, + to, to_end, to_next)) != std::codecvt_base::ok) + { + //std::cout << " result is " << static_cast<int>(res) << std::endl; + BOOST_FILESYSTEM_THROW(bs::system_error(res, fs::codecvt_error_category(), + "boost::filesystem::path codecvt to string")); + } + target.append(to, to_next); + } + +} // unnamed namespace + +//--------------------------------------------------------------------------------------// +// path_traits // +//--------------------------------------------------------------------------------------// + +namespace boost { namespace filesystem { namespace path_traits { + +//--------------------------------------------------------------------------------------// +// convert const char* to wstring // +//--------------------------------------------------------------------------------------// + + BOOST_FILESYSTEM_DECL + void convert(const char* from, + const char* from_end, // 0 for null terminated MBCS + std::wstring & to, + const codecvt_type & cvt) + { + BOOST_ASSERT(from); + + if (!from_end) // null terminated + { + from_end = from + std::strlen(from); + } + + if (from == from_end) return; + + std::size_t buf_size = (from_end - from) * 3; // perhaps too large, but that's OK + + // dynamically allocate a buffer only if source is unusually large + if (buf_size > default_codecvt_buf_size) + { + boost::scoped_array< wchar_t > buf(new wchar_t [buf_size]); + convert_aux(from, from_end, buf.get(), buf.get()+buf_size, to, cvt); + } + else + { + wchar_t buf[default_codecvt_buf_size]; + convert_aux(from, from_end, buf, buf+default_codecvt_buf_size, to, cvt); + } + } + +//--------------------------------------------------------------------------------------// +// convert const wchar_t* to string // +//--------------------------------------------------------------------------------------// + + BOOST_FILESYSTEM_DECL + void convert(const wchar_t* from, + const wchar_t* from_end, // 0 for null terminated MBCS + std::string & to, + const codecvt_type & cvt) + { + BOOST_ASSERT(from); + + if (!from_end) // null terminated + { + from_end = from + std::wcslen(from); + } + + if (from == from_end) return; + + // The codecvt length functions may not be implemented, and I don't really + // understand them either. Thus this code is just a guess; if it turns + // out the buffer is too small then an error will be reported and the code + // will have to be fixed. + std::size_t buf_size = (from_end - from) * 4; // perhaps too large, but that's OK + buf_size += 4; // encodings like shift-JIS need some prefix space + + // dynamically allocate a buffer only if source is unusually large + if (buf_size > default_codecvt_buf_size) + { + boost::scoped_array< char > buf(new char [buf_size]); + convert_aux(from, from_end, buf.get(), buf.get()+buf_size, to, cvt); + } + else + { + char buf[default_codecvt_buf_size]; + convert_aux(from, from_end, buf, buf+default_codecvt_buf_size, to, cvt); + } + } +}}} // namespace boost::filesystem::path_traits diff --git a/3rdParty/Boost/src/libs/filesystem/src/portability.cpp b/3rdParty/Boost/src/libs/filesystem/src/portability.cpp new file mode 100644 index 0000000..b1a1352 --- /dev/null +++ b/3rdParty/Boost/src/libs/filesystem/src/portability.cpp @@ -0,0 +1,119 @@ +// portability.cpp -------------------------------------------------------------------// + +// Copyright 2002-2005 Beman Dawes +// 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 library home page at http://www.boost.org/libs/filesystem + +//--------------------------------------------------------------------------------------// + +// define BOOST_FILESYSTEM_SOURCE so that <boost/filesystem/config.hpp> knows +// the library is being built (possibly exporting rather than importing code) +#define BOOST_FILESYSTEM_SOURCE + +#ifndef BOOST_SYSTEM_NO_DEPRECATED +# define BOOST_SYSTEM_NO_DEPRECATED +#endif + +#include <boost/filesystem/config.hpp> +#include <boost/filesystem/path.hpp> + +namespace fs = boost::filesystem; + +#include <cstring> // SGI MIPSpro compilers need this + +# ifdef BOOST_NO_STDC_NAMESPACE + namespace std { using ::strerror; } +# endif + +//--------------------------------------------------------------------------------------// + +namespace +{ + const char invalid_chars[] = + "\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F" + "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F" + "<>:\"/\\|"; + // note that the terminating '\0' is part of the string - thus the size below + // is sizeof(invalid_chars) rather than sizeof(invalid_chars)-1. I + const std::string windows_invalid_chars(invalid_chars, sizeof(invalid_chars)); + + const std::string valid_posix( + "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._-"); + +} // unnamed namespace + +namespace boost +{ + namespace filesystem + { + + // name_check functions ----------------------------------------------// + +# ifdef BOOST_WINDOWS + BOOST_FILESYSTEM_DECL bool native(const std::string & name) + { + return windows_name(name); + } +# else + BOOST_FILESYSTEM_DECL bool native(const std::string & name) + { + return name.size() != 0 + && name[0] != ' ' + && name.find('/') == std::string::npos; + } +# endif + + BOOST_FILESYSTEM_DECL bool portable_posix_name(const std::string & name) + { + return name.size() != 0 + && name.find_first_not_of(valid_posix) == std::string::npos; + } + + BOOST_FILESYSTEM_DECL bool windows_name(const std::string & name) + { + return name.size() != 0 + && name[0] != ' ' + && name.find_first_of(windows_invalid_chars) == std::string::npos + && *(name.end()-1) != ' ' + && (*(name.end()-1) != '.' + || name.length() == 1 || name == ".."); + } + + BOOST_FILESYSTEM_DECL bool portable_name(const std::string & name) + { + return + name.size() != 0 + && (name == "." + || name == ".." + || (windows_name(name) + && portable_posix_name(name) + && name[0] != '.' && name[0] != '-')); + } + + BOOST_FILESYSTEM_DECL bool portable_directory_name(const std::string & name) + { + return + name == "." + || name == ".." + || (portable_name(name) + && name.find('.') == std::string::npos); + } + + BOOST_FILESYSTEM_DECL bool portable_file_name(const std::string & name) + { + std::string::size_type pos; + return + portable_name(name) + && name != "." + && name != ".." + && ((pos = name.find('.')) == std::string::npos + || (name.find('.', pos+1) == std::string::npos + && (pos + 5) > name.length())) + ; + } + + } // namespace filesystem +} // namespace boost diff --git a/3rdParty/Boost/src/libs/filesystem/src/unique_path.cpp b/3rdParty/Boost/src/libs/filesystem/src/unique_path.cpp new file mode 100644 index 0000000..c25c315 --- /dev/null +++ b/3rdParty/Boost/src/libs/filesystem/src/unique_path.cpp @@ -0,0 +1,142 @@ +// filesystem unique_path.cpp --------------------------------------------------------// + +// Copyright Beman Dawes 2010 + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +// Library home page: http://www.boost.org/libs/filesystem + +//--------------------------------------------------------------------------------------// + +// define BOOST_FILESYSTEM_SOURCE so that <boost/filesystem/config.hpp> knows +// the library is being built (possibly exporting rather than importing code) +#define BOOST_FILESYSTEM_SOURCE + +#ifndef BOOST_SYSTEM_NO_DEPRECATED +# define BOOST_SYSTEM_NO_DEPRECATED +#endif + +#include <boost/filesystem/operations.hpp> + +# ifdef BOOST_POSIX_API +# include <fcntl.h> +# else // BOOST_WINDOWS_API +# include <windows.h> +# include <wincrypt.h> +# pragma comment(lib, "Advapi32.lib") +# endif + +namespace { + +void fail(int err, boost::system::error_code* ec) +{ + if (ec == 0) + BOOST_FILESYSTEM_THROW( boost::system::system_error(err, + boost::system::system_category(), + "boost::filesystem::unique_path")); + + ec->assign(err, boost::system::system_category()); + return; +} + +void system_crypt_random(void* buf, std::size_t len, boost::system::error_code* ec) +{ +# ifdef BOOST_POSIX_API + + int file = open("/dev/urandom", O_RDONLY); + if (file == -1) + { + file = open("/dev/random", O_RDONLY); + if (file == -1) + { + fail(errno, ec); + return; + } + } + + size_t bytes_read = 0; + while (bytes_read < len) + { + ssize_t n = read(file, buf, len - bytes_read); + if (n == -1) + { + close(file); + fail(errno, ec); + return; + } + bytes_read += n; + buf = static_cast<char*>(buf) + n; + } + + close(file); + +# else // BOOST_WINDOWS_API + + HCRYPTPROV handle; + int errval = 0; + + if (!::CryptAcquireContextW(&handle, 0, 0, PROV_RSA_FULL, 0)) + { + errval = ::GetLastError(); + if (errval == NTE_BAD_KEYSET) + { + if (!::CryptAcquireContextW(&handle, 0, 0, PROV_RSA_FULL, CRYPT_NEWKEYSET)) + { + errval = ::GetLastError(); + } + else errval = 0; + } + } + + if (!errval) + { + BOOL gen_ok = ::CryptGenRandom(handle, len, static_cast<unsigned char*>(buf)); + if (!gen_ok) + errval = ::GetLastError(); + ::CryptReleaseContext(handle, 0); + } + + if (!errval) return; + + fail(errval, ec); +# endif +} + +} // unnamed namespace + +namespace boost { namespace filesystem { namespace detail { + +BOOST_FILESYSTEM_DECL +path unique_path(const path& model, system::error_code* ec) +{ + std::wstring s (model.wstring()); // std::string ng for MBCS encoded POSIX + const wchar_t hex[] = L"0123456789abcdef"; + const int n_ran = 16; + const int max_nibbles = 2 * n_ran; // 4-bits per nibble + char ran[n_ran]; + + int nibbles_used = max_nibbles; + for(std::wstring::size_type i=0; i < s.size(); ++i) + { + if (s[i] == L'%') // digit request + { + if (nibbles_used == max_nibbles) + { + system_crypt_random(ran, sizeof(ran), ec); + if (ec != 0 && *ec) + return ""; + nibbles_used = 0; + } + int c = ran[nibbles_used/2]; + c >>= 4 * (nibbles_used++ & 1); // if odd, shift right 1 nibble + s[i] = hex[c & 0xf]; // convert to hex digit and replace + } + } + + if (ec != 0) ec->clear(); + + return s; +} + +}}} diff --git a/3rdParty/Boost/src/libs/filesystem/src/windows_file_codecvt.cpp b/3rdParty/Boost/src/libs/filesystem/src/windows_file_codecvt.cpp new file mode 100644 index 0000000..998db60 --- /dev/null +++ b/3rdParty/Boost/src/libs/filesystem/src/windows_file_codecvt.cpp @@ -0,0 +1,75 @@ +// filesystem windows_file_codecvt.cpp -----------------------------------------// + +// Copyright Beman Dawes 2009 + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +// Library home page: http://www.boost.org/libs/filesystem + +//--------------------------------------------------------------------------------------// + +// define BOOST_FILESYSTEM_SOURCE so that <boost/system/config.hpp> knows +// the library is being built (possibly exporting rather than importing code) +#define BOOST_FILESYSTEM_SOURCE + +#ifndef BOOST_SYSTEM_NO_DEPRECATED +# define BOOST_SYSTEM_NO_DEPRECATED +#endif + +#include <boost/filesystem/config.hpp> +#include <cwchar> // for mbstate_t + +#ifdef BOOST_WINDOWS_API + +#include "windows_file_codecvt.hpp" + +// Versions of MinGW prior to GCC 4.6 requires this +#ifndef WINVER +# define WINVER 0x0500 +#endif + +#include <windows.h> + + std::codecvt_base::result windows_file_codecvt::do_in( + std::mbstate_t &, + const char* from, const char* from_end, const char*& from_next, + wchar_t* to, wchar_t* to_end, wchar_t*& to_next) const + { + UINT codepage = AreFileApisANSI() ? CP_ACP : CP_OEMCP; + + int count; + if ((count = ::MultiByteToWideChar(codepage, MB_PRECOMPOSED, from, + from_end - from, to, to_end - to)) == 0) + { + return error; // conversion failed + } + + from_next = from_end; + to_next = to + count; + *to_next = L'\0'; + return ok; + } + + std::codecvt_base::result windows_file_codecvt::do_out( + std::mbstate_t &, + const wchar_t* from, const wchar_t* from_end, const wchar_t* & from_next, + char* to, char* to_end, char* & to_next) const + { + UINT codepage = AreFileApisANSI() ? CP_ACP : CP_OEMCP; + + int count; + if ((count = ::WideCharToMultiByte(codepage, WC_NO_BEST_FIT_CHARS, from, + from_end - from, to, to_end - to, 0, 0)) == 0) + { + return error; // conversion failed + } + + from_next = from_end; + to_next = to + count; + *to_next = '\0'; + return ok; + } + + # endif // BOOST_WINDOWS_API + diff --git a/3rdParty/Boost/src/libs/filesystem/src/windows_file_codecvt.hpp b/3rdParty/Boost/src/libs/filesystem/src/windows_file_codecvt.hpp new file mode 100644 index 0000000..52deab1 --- /dev/null +++ b/3rdParty/Boost/src/libs/filesystem/src/windows_file_codecvt.hpp @@ -0,0 +1,56 @@ +// filesystem windows_file_codecvt.hpp -----------------------------------------------// + +// Copyright Beman Dawes 2009 + +// Distributed under the Boost Software License, Version 1.0. +// See http://www.boost.org/LICENSE_1_0.txt + +// Library home page: http://www.boost.org/libs/filesystem + +#ifndef BOOST_FILESYSTEM3_WIN_FILE_CODECVT_HPP +#define BOOST_FILESYSTEM3_WIN_FILE_CODECVT_HPP + +#include <boost/filesystem/config.hpp> +#include <locale> + + //------------------------------------------------------------------------------------// + // // + // class windows_file_codecvt // + // // + // Warning: partial implementation; even do_in and do_out only partially meet the // + // standard library specifications as the "to" buffer must hold the entire result. // + // // + //------------------------------------------------------------------------------------// + + class BOOST_FILESYSTEM_DECL windows_file_codecvt + : public std::codecvt< wchar_t, char, std::mbstate_t > + { + public: + explicit windows_file_codecvt() + : std::codecvt<wchar_t, char, std::mbstate_t>() {} + protected: + + virtual bool do_always_noconv() const throw() { return false; } + + // seems safest to assume variable number of characters since we don't + // actually know what codepage is active + virtual int do_encoding() const throw() { return 0; } + + virtual std::codecvt_base::result do_in(std::mbstate_t& state, + const char* from, const char* from_end, const char*& from_next, + wchar_t* to, wchar_t* to_end, wchar_t*& to_next) 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) const; + + virtual std::codecvt_base::result do_unshift(std::mbstate_t&, + char* /*from*/, char* /*to*/, char* & /*next*/) const { return ok; } + + virtual int do_length(std::mbstate_t&, + const char* /*from*/, const char* /*from_end*/, std::size_t /*max*/) const { return 0; } + + virtual int do_max_length() const throw () { return 0; } + }; + +#endif // BOOST_FILESYSTEM3_WIN_FILE_CODECVT_HPP diff --git a/3rdParty/Boost/src/libs/filesystem/v2/src/v2_operations.cpp b/3rdParty/Boost/src/libs/filesystem/v2/src/v2_operations.cpp deleted file mode 100644 index f29153c..0000000 --- a/3rdParty/Boost/src/libs/filesystem/v2/src/v2_operations.cpp +++ /dev/null @@ -1,1372 +0,0 @@ -// operations.cpp ----------------------------------------------------------// - -// Copyright 2002-2005 Beman Dawes -// Copyright 2001 Dietmar Kuehl -// 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 library home page at http://www.boost.org/libs/filesystem - -//----------------------------------------------------------------------------// - -// define BOOST_FILESYSTEM_SOURCE so that <boost/filesystem/config.hpp> knows -// the library is being built (possibly exporting rather than importing code) -#define BOOST_FILESYSTEM_SOURCE - -#ifndef BOOST_SYSTEM_NO_DEPRECATED -# define BOOST_SYSTEM_NO_DEPRECATED -#endif - -#define _POSIX_PTHREAD_SEMANTICS // Sun readdir_r() needs this - -#if !(defined(__HP_aCC) && defined(_ILP32) && \ - !defined(_STATVFS_ACPP_PROBLEMS_FIXED)) -#define _FILE_OFFSET_BITS 64 // at worst, these defines may have no effect, -#endif -#define __USE_FILE_OFFSET64 // but that is harmless on Windows and on POSIX - // 64-bit systems or on 32-bit systems which don't have files larger - // than can be represented by a traditional POSIX/UNIX off_t type. - // OTOH, defining them should kick in 64-bit off_t's (and thus - // st_size) on 32-bit systems that provide the Large File - // Support (LFS) interface, such as Linux, Solaris, and IRIX. - // The defines are given before any headers are included to - // ensure that they are available to all included headers. - // That is required at least on Solaris, and possibly on other - // systems as well. - -// for some compilers (CodeWarrior, for example), windows.h -// is getting included by some other boost header, so do this early: -#if !defined(_WIN32_WINNT) -#define _WIN32_WINNT 0x0500 // Default to Windows 2K or later -#endif - - -#include <boost/filesystem/v2/operations.hpp> -#include <boost/scoped_array.hpp> -#include <boost/assert.hpp> -#include <boost/detail/workaround.hpp> -#include <cstdlib> // for malloc, free - -namespace fs = boost::filesystem2; -using boost::system::error_code; -using boost::system::system_category; - -# if defined(BOOST_WINDOWS_API) -# include <windows.h> -# include <ctime> // for time_t - -# else // BOOST_POSIX_API -# include <sys/types.h> -# if !defined(__APPLE__) && !defined(__OpenBSD__) -# include <sys/statvfs.h> -# define BOOST_STATVFS statvfs -# define BOOST_STATVFS_F_FRSIZE vfs.f_frsize -# else -#ifdef __OpenBSD__ -# include <sys/param.h> -#endif -# include <sys/mount.h> -# define BOOST_STATVFS statfs -# define BOOST_STATVFS_F_FRSIZE static_cast<boost::uintmax_t>( vfs.f_bsize ) -# endif -# include <dirent.h> -# include <unistd.h> -# include <fcntl.h> -# include <utime.h> -# include "limits.h" -# endif - -// BOOST_FILESYSTEM_STATUS_CACHE enables file_status cache in -// dir_itr_increment. The config tests are placed here because some of the -// macros being tested come from dirent.h. -// -// TODO: find out what macros indicate dirent::d_type present in more libraries -# if defined(BOOST_WINDOWS_API) \ - || (defined(_DIRENT_HAVE_D_TYPE) /* defined by GNU C library if d_type present */ \ - && !(defined(__SUNPRO_CC) && !defined(__sun))) // _DIRENT_HAVE_D_TYPE wrong for Sun compiler on Linux -# define BOOST_FILESYSTEM_STATUS_CACHE -# endif - -#include <sys/stat.h> // even on Windows some functions use stat() -#include <string> -#include <cstring> -#include <cstdio> // for remove, rename -#include <cerrno> -// #include <iostream> // for debugging only; comment out when not in use - -#ifdef BOOST_NO_STDC_NAMESPACE -namespace std { using ::strcmp; using ::remove; using ::rename; } -#endif - -// helpers -----------------------------------------------------------------// - -namespace -{ - const error_code ok; - - bool is_empty_directory( const std::string & dir_path ) - { - static const fs::directory_iterator end_itr; - return fs::directory_iterator(fs::path(dir_path)) == end_itr; - } - -#ifdef BOOST_WINDOWS_API - -// For Windows, the xxxA form of various function names is used to avoid -// inadvertently getting wide forms of the functions. (The undecorated -// forms are actually macros, so can misfire if the user has various -// other macros defined. There was a bug report of this happening.) - - inline DWORD get_file_attributes( const char * ph ) - { return ::GetFileAttributesA( ph ); } - -# ifndef BOOST_FILESYSTEM2_NARROW_ONLY - - inline DWORD get_file_attributes( const wchar_t * ph ) - { return ::GetFileAttributesW( ph ); } - - bool is_empty_directory( const std::wstring & dir_path ) - { - static const fs::wdirectory_iterator wend_itr; - return fs::wdirectory_iterator(fs::wpath(dir_path)) == wend_itr; - } - - inline BOOL get_file_attributes_ex( const wchar_t * ph, - WIN32_FILE_ATTRIBUTE_DATA & fad ) - { return ::GetFileAttributesExW( ph, ::GetFileExInfoStandard, &fad ); } - - HANDLE create_file( const wchar_t * ph, DWORD dwDesiredAccess, - DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, - DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, - HANDLE hTemplateFile ) - { - return ::CreateFileW( ph, dwDesiredAccess, dwShareMode, - lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, - hTemplateFile ); - } - - inline DWORD get_current_directory( DWORD sz, wchar_t * buf ) - { return ::GetCurrentDirectoryW( sz, buf ); } - - inline bool set_current_directory( const wchar_t * buf ) - { return ::SetCurrentDirectoryW( buf ) != 0 ; } - - inline bool get_free_disk_space( const std::wstring & ph, - PULARGE_INTEGER avail, PULARGE_INTEGER total, PULARGE_INTEGER free ) - { return ::GetDiskFreeSpaceExW( ph.c_str(), avail, total, free ) != 0; } - - inline std::size_t get_full_path_name( - const std::wstring & ph, std::size_t len, wchar_t * buf, wchar_t ** p ) - { - return static_cast<std::size_t>( - ::GetFullPathNameW( ph.c_str(), - static_cast<DWORD>(len), buf, p )); - } - - inline bool remove_directory( const std::wstring & ph ) - { return ::RemoveDirectoryW( ph.c_str() ) != 0; } - - inline bool delete_file( const std::wstring & ph ) - { return ::DeleteFileW( ph.c_str() ) != 0; } - - inline bool create_directory( const std::wstring & dir ) - { return ::CreateDirectoryW( dir.c_str(), 0 ) != 0; } - -#if _WIN32_WINNT >= 0x500 - inline bool create_hard_link( const std::wstring & to_ph, - const std::wstring & from_ph ) - { return ::CreateHardLinkW( from_ph.c_str(), to_ph.c_str(), 0 ) != 0; } -#endif - -# endif // ifndef BOOST_FILESYSTEM2_NARROW_ONLY - - template< class String > - fs::file_status status_template( const String & ph, error_code & ec ) - { - DWORD attr( get_file_attributes( ph.c_str() ) ); - if ( attr == 0xFFFFFFFF ) - { - ec = error_code( ::GetLastError(), system_category() ); - if ((ec.value() == ERROR_FILE_NOT_FOUND) - || (ec.value() == ERROR_PATH_NOT_FOUND) - || (ec.value() == ERROR_INVALID_NAME) // "tools/jam/src/:sys:stat.h", "//foo" - || (ec.value() == ERROR_INVALID_DRIVE) // USB card reader with no card inserted - || (ec.value() == ERROR_NOT_READY) // CD/DVD drive with no disc inserted - || (ec.value() == ERROR_INVALID_PARAMETER) // ":sys:stat.h" - || (ec.value() == ERROR_BAD_PATHNAME) // "//nosuch" on Win64 - || (ec.value() == ERROR_BAD_NETPATH)) // "//nosuch" on Win32 - { - ec = ok; // these are not considered errors; - // the status is considered not found - return fs::file_status( fs::file_not_found ); - } - else if ((ec.value() == ERROR_SHARING_VIOLATION)) - { - ec = ok; // these are not considered errors; - // the file exists but the type is not known - return fs::file_status( fs::type_unknown ); - } - return fs::file_status( fs::status_unknown ); - } - ec = ok;; - return (attr & FILE_ATTRIBUTE_DIRECTORY) - ? fs::file_status( fs::directory_file ) - : fs::file_status( fs::regular_file ); - } - - BOOL get_file_attributes_ex( const char * ph, - WIN32_FILE_ATTRIBUTE_DATA & fad ) - { return ::GetFileAttributesExA( ph, ::GetFileExInfoStandard, &fad ); } - - template< class String > - boost::filesystem2::detail::query_pair - is_empty_template( const String & ph ) - { - WIN32_FILE_ATTRIBUTE_DATA fad; - if ( get_file_attributes_ex( ph.c_str(), fad ) == 0 ) - return std::make_pair( error_code( ::GetLastError(), system_category() ), false ); - return std::make_pair( ok, - ( fad.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) - ? is_empty_directory( ph ) - :( !fad.nFileSizeHigh && !fad.nFileSizeLow ) ); - } - - HANDLE create_file( const char * ph, DWORD dwDesiredAccess, - DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, - DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, - HANDLE hTemplateFile ) - { - return ::CreateFileA( ph, dwDesiredAccess, dwShareMode, - lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, - hTemplateFile ); - } - - // Thanks to Jeremy Maitin-Shepard for much help and for permission to - // base the equivalent() implementation on portions of his - // file-equivalence-win32.cpp experimental code. - struct handle_wrapper - { - HANDLE handle; - handle_wrapper( HANDLE h ) - : handle(h) {} - ~handle_wrapper() - { - if ( handle != INVALID_HANDLE_VALUE ) - ::CloseHandle(handle); - } - }; - - template< class String > - boost::filesystem2::detail::query_pair - equivalent_template( const String & ph1, const String & ph2 ) - { - // Note well: Physical location on external media is part of the - // equivalence criteria. If there are no open handles, physical location - // can change due to defragmentation or other relocations. Thus handles - // must be held open until location information for both paths has - // been retrieved. - handle_wrapper p1( - create_file( - ph1.c_str(), - 0, - FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, - 0, - OPEN_EXISTING, - FILE_FLAG_BACKUP_SEMANTICS, - 0 ) ); - int error1(0); // save error code in case we have to throw - if ( p1.handle == INVALID_HANDLE_VALUE ) - error1 = ::GetLastError(); - handle_wrapper p2( - create_file( - ph2.c_str(), - 0, - FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, - 0, - OPEN_EXISTING, - FILE_FLAG_BACKUP_SEMANTICS, - 0 ) ); - if ( p1.handle == INVALID_HANDLE_VALUE - || p2.handle == INVALID_HANDLE_VALUE ) - { - if ( p1.handle != INVALID_HANDLE_VALUE - || p2.handle != INVALID_HANDLE_VALUE ) - { return std::make_pair( ok, false ); } - BOOST_ASSERT( p1.handle == INVALID_HANDLE_VALUE - && p2.handle == INVALID_HANDLE_VALUE ); - { return std::make_pair( error_code( error1, system_category()), false ); } - } - // at this point, both handles are known to be valid - BY_HANDLE_FILE_INFORMATION info1, info2; - if ( !::GetFileInformationByHandle( p1.handle, &info1 ) ) - { return std::make_pair( error_code( ::GetLastError(), system_category() ), false ); } - if ( !::GetFileInformationByHandle( p2.handle, &info2 ) ) - { return std::make_pair( error_code( ::GetLastError(), system_category() ), false ); } - // In theory, volume serial numbers are sufficient to distinguish between - // devices, but in practice VSN's are sometimes duplicated, so last write - // time and file size are also checked. - return std::make_pair( ok, - info1.dwVolumeSerialNumber == info2.dwVolumeSerialNumber - && info1.nFileIndexHigh == info2.nFileIndexHigh - && info1.nFileIndexLow == info2.nFileIndexLow - && info1.nFileSizeHigh == info2.nFileSizeHigh - && info1.nFileSizeLow == info2.nFileSizeLow - && info1.ftLastWriteTime.dwLowDateTime - == info2.ftLastWriteTime.dwLowDateTime - && info1.ftLastWriteTime.dwHighDateTime - == info2.ftLastWriteTime.dwHighDateTime ); - } - - template< class String > - boost::filesystem2::detail::uintmax_pair - file_size_template( const String & ph ) - { - WIN32_FILE_ATTRIBUTE_DATA fad; - // by now, intmax_t is 64-bits on all Windows compilers - if ( get_file_attributes_ex( ph.c_str(), fad ) == 0 ) - return std::make_pair( error_code( ::GetLastError(), system_category() ), 0 ); - if ( (fad.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) !=0 ) - return std::make_pair( error_code( ERROR_FILE_NOT_FOUND, system_category()), 0 ); - return std::make_pair( ok, - (static_cast<boost::uintmax_t>(fad.nFileSizeHigh) - << (sizeof(fad.nFileSizeLow)*8)) - + fad.nFileSizeLow ); - } - - inline bool get_free_disk_space( const std::string & ph, - PULARGE_INTEGER avail, PULARGE_INTEGER total, PULARGE_INTEGER free ) - { return ::GetDiskFreeSpaceExA( ph.c_str(), avail, total, free ) != 0; } - - template< class String > - boost::filesystem2::detail::space_pair - space_template( String & ph ) - { - ULARGE_INTEGER avail, total, free; - boost::filesystem2::detail::space_pair result; - if ( get_free_disk_space( ph, &avail, &total, &free ) ) - { - result.first = ok; - result.second.capacity - = (static_cast<boost::uintmax_t>(total.HighPart) << 32) - + total.LowPart; - result.second.free - = (static_cast<boost::uintmax_t>(free.HighPart) << 32) - + free.LowPart; - result.second.available - = (static_cast<boost::uintmax_t>(avail.HighPart) << 32) - + avail.LowPart; - } - else - { - result.first = error_code( ::GetLastError(), system_category() ); - result.second.capacity = result.second.free - = result.second.available = 0; - } - return result; - } - - inline DWORD get_current_directory( DWORD sz, char * buf ) - { return ::GetCurrentDirectoryA( sz, buf ); } - - template< class String > - error_code - get_current_path_template( String & ph ) - { - DWORD sz; - if ( (sz = get_current_directory( 0, - static_cast<typename String::value_type*>(0) )) == 0 ) - { sz = 1; } - typedef typename String::value_type value_type; - boost::scoped_array<value_type> buf( new value_type[sz] ); - if ( get_current_directory( sz, buf.get() ) == 0 ) - return error_code( ::GetLastError(), system_category() ); - ph = buf.get(); - return ok; - } - - inline bool set_current_directory( const char * buf ) - { return ::SetCurrentDirectoryA( buf ) != 0; } - - template< class String > - error_code - set_current_path_template( const String & ph ) - { - return error_code( set_current_directory( ph.c_str() ) - ? 0 : ::GetLastError(), system_category() ); - } - - inline std::size_t get_full_path_name( - const std::string & ph, std::size_t len, char * buf, char ** p ) - { - return static_cast<std::size_t>( - ::GetFullPathNameA( ph.c_str(), - static_cast<DWORD>(len), buf, p )); - } - - const std::size_t buf_size( 128 ); - - template<class String> - error_code - get_full_path_name_template( const String & ph, String & target ) - { - typename String::value_type buf[buf_size]; - typename String::value_type * pfn; - std::size_t len = get_full_path_name( ph, - buf_size , buf, &pfn ); - if ( len == 0 ) return error_code( ::GetLastError(), system_category() ); - if ( len > buf_size ) - { - typedef typename String::value_type value_type; - boost::scoped_array<value_type> big_buf( new value_type[len] ); - if ( (len=get_full_path_name( ph, len , big_buf.get(), &pfn )) - == 0 ) return error_code( ::GetLastError(), system_category() ); - big_buf[len] = '\0'; - target = big_buf.get(); - return ok; - } - buf[len] = '\0'; - target = buf; - return ok; - } - - template<class String> - error_code - get_file_write_time( const String & ph, FILETIME & last_write_time ) - { - handle_wrapper hw( - create_file( ph.c_str(), 0, - FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, 0, - OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0 ) ); - if ( hw.handle == INVALID_HANDLE_VALUE ) - return error_code( ::GetLastError(), system_category() ); - return error_code( ::GetFileTime( hw.handle, 0, 0, &last_write_time ) != 0 - ? 0 : ::GetLastError(), system_category() ); - } - - template<class String> - error_code - set_file_write_time( const String & ph, const FILETIME & last_write_time ) - { - handle_wrapper hw( - create_file( ph.c_str(), FILE_WRITE_ATTRIBUTES, - FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, 0, - OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0 ) ); - if ( hw.handle == INVALID_HANDLE_VALUE ) - return error_code( ::GetLastError(), system_category() ); - return error_code( ::SetFileTime( hw.handle, 0, 0, &last_write_time ) != 0 - ? 0 : ::GetLastError(), system_category() ); - } - - // these constants come from inspecting some Microsoft sample code - std::time_t to_time_t( const FILETIME & ft ) - { - __int64 t = (static_cast<__int64>( ft.dwHighDateTime ) << 32) - + ft.dwLowDateTime; -# if !defined( BOOST_MSVC ) || BOOST_MSVC > 1300 // > VC++ 7.0 - t -= 116444736000000000LL; -# else - t -= 116444736000000000; -# endif - t /= 10000000; - return static_cast<std::time_t>( t ); - } - - void to_FILETIME( std::time_t t, FILETIME & ft ) - { - __int64 temp = t; - temp *= 10000000; -# if !defined( BOOST_MSVC ) || BOOST_MSVC > 1300 // > VC++ 7.0 - temp += 116444736000000000LL; -# else - temp += 116444736000000000; -# endif - ft.dwLowDateTime = static_cast<DWORD>( temp ); - ft.dwHighDateTime = static_cast<DWORD>( temp >> 32 ); - } - - template<class String> - boost::filesystem2::detail::time_pair - last_write_time_template( const String & ph ) - { - FILETIME lwt; - error_code ec( - get_file_write_time( ph, lwt ) ); - return std::make_pair( ec, to_time_t( lwt ) ); - } - - template<class String> - error_code - last_write_time_template( const String & ph, const std::time_t new_time ) - { - FILETIME lwt; - to_FILETIME( new_time, lwt ); - return set_file_write_time( ph, lwt ); - } - - bool remove_directory( const std::string & ph ) - { return ::RemoveDirectoryA( ph.c_str() ) != 0; } - - bool delete_file( const std::string & ph ) - { return ::DeleteFileA( ph.c_str() ) != 0; } - - template<class String> - error_code - remove_template( const String & ph ) - { - // TODO: test this code in the presence of Vista symlinks, - // including dangling, self-referal, and cyclic symlinks - error_code ec; - fs::file_status sf( fs::detail::status_api( ph, ec ) ); - if ( ec ) - return ec; - if ( sf.type() == fs::file_not_found ) - return ok; - if ( fs::is_directory( sf ) ) - { - if ( !remove_directory( ph ) ) - return error_code(::GetLastError(), system_category()); - } - else - { - if ( !delete_file( ph ) ) return error_code(::GetLastError(), system_category()); - } - return ok; - } - - inline bool create_directory( const std::string & dir ) - { return ::CreateDirectoryA( dir.c_str(), 0 ) != 0; } - - template<class String> - boost::filesystem2::detail::query_pair - create_directory_template( const String & dir_ph ) - { - error_code error, dummy; - if ( create_directory( dir_ph ) ) return std::make_pair( error, true ); - error = error_code( ::GetLastError(), system_category() ); - // an error here may simply mean the postcondition is already met - if ( error.value() == ERROR_ALREADY_EXISTS - && fs::is_directory( fs::detail::status_api( dir_ph, dummy ) ) ) - return std::make_pair( ok, false ); - return std::make_pair( error, false ); - } - -#if _WIN32_WINNT >= 0x500 - inline bool create_hard_link( const std::string & to_ph, - const std::string & from_ph ) - { return ::CreateHardLinkA( from_ph.c_str(), to_ph.c_str(), 0 ) != 0; } -#endif - -#if _WIN32_WINNT >= 0x500 - template<class String> - error_code - create_hard_link_template( const String & to_ph, - const String & from_ph ) - { - return error_code( create_hard_link( to_ph.c_str(), from_ph.c_str() ) - ? 0 : ::GetLastError(), system_category() ); - } -#endif - -#else // BOOST_POSIX_API - - int posix_remove( const char * p ) - { -# if defined(__QNXNTO__) || (defined(__MSL__) && (defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__))) - // Some Metrowerks C library versions fail on directories because of a - // known Metrowerks coding error in ::remove. Workaround is to call - // rmdir() or unlink() as indicated. - // Same bug also reported for QNX, with the same fix. - int err = ::unlink( p ); - if ( err == 0 || errno != EPERM ) - return err; - return ::rmdir( p ); -# else - return std::remove( p ); -# endif - } - -#endif -} // unnamed namespace - -namespace boost -{ - namespace filesystem2 - { - namespace detail - { - BOOST_FILESYSTEM_DECL system::error_code throws; - -// free functions ----------------------------------------------------------// - - BOOST_FILESYSTEM_DECL error_code not_found_error() - { -# ifdef BOOST_WINDOWS_API - return error_code(ERROR_PATH_NOT_FOUND, system_category()); -# else - return error_code(ENOENT, system_category()); -# endif - } - - BOOST_FILESYSTEM_DECL bool possible_large_file_size_support() - { -# ifdef BOOST_POSIX_API - struct stat lcl_stat; - return sizeof( lcl_stat.st_size ) > 4; -# else - return true; -# endif - } - -# ifdef BOOST_WINDOWS_API - - BOOST_FILESYSTEM_DECL fs::file_status - status_api( const std::string & ph, error_code & ec ) - { return status_template( ph, ec ); } - -# ifndef BOOST_FILESYSTEM2_NARROW_ONLY - - BOOST_FILESYSTEM_DECL fs::file_status - status_api( const std::wstring & ph, error_code & ec ) - { return status_template( ph, ec ); } - - BOOST_FILESYSTEM_DECL bool symbolic_link_exists_api( const std::wstring & ) - { return false; } - - BOOST_FILESYSTEM_DECL - fs::detail::query_pair is_empty_api( const std::wstring & ph ) - { return is_empty_template( ph ); } - - BOOST_FILESYSTEM_DECL - fs::detail::query_pair - equivalent_api( const std::wstring & ph1, const std::wstring & ph2 ) - { return equivalent_template( ph1, ph2 ); } - - BOOST_FILESYSTEM_DECL - fs::detail::uintmax_pair file_size_api( const std::wstring & ph ) - { return file_size_template( ph ); } - - BOOST_FILESYSTEM_DECL - fs::detail::space_pair space_api( const std::wstring & ph ) - { return space_template( ph ); } - - BOOST_FILESYSTEM_DECL - error_code - get_current_path_api( std::wstring & ph ) - { return get_current_path_template( ph ); } - - BOOST_FILESYSTEM_DECL - error_code - set_current_path_api( const std::wstring & ph ) - { return set_current_path_template( ph ); } - - BOOST_FILESYSTEM_DECL error_code - get_full_path_name_api( const std::wstring & ph, std::wstring & target ) - { return get_full_path_name_template( ph, target ); } - - BOOST_FILESYSTEM_DECL time_pair - last_write_time_api( const std::wstring & ph ) - { return last_write_time_template( ph ); } - - BOOST_FILESYSTEM_DECL error_code - last_write_time_api( const std::wstring & ph, std::time_t new_value ) - { return last_write_time_template( ph, new_value ); } - - BOOST_FILESYSTEM_DECL fs::detail::query_pair - create_directory_api( const std::wstring & ph ) - { return create_directory_template( ph ); } - -#if _WIN32_WINNT >= 0x500 - BOOST_FILESYSTEM_DECL error_code - create_hard_link_api( const std::wstring & to_ph, - const std::wstring & from_ph ) - { return create_hard_link_template( to_ph, from_ph ); } -#endif - - BOOST_FILESYSTEM_DECL error_code - create_symlink_api( const std::wstring & /*to_ph*/, - const std::wstring & /*from_ph*/ ) - { return error_code( ERROR_NOT_SUPPORTED, system_category() ); } - - BOOST_FILESYSTEM_DECL error_code - remove_api( const std::wstring & ph ) { return remove_template( ph ); } - - BOOST_FILESYSTEM_DECL error_code - rename_api( const std::wstring & from, const std::wstring & to ) - { - return error_code( ::MoveFileW( from.c_str(), to.c_str() ) - ? 0 : ::GetLastError(), system_category() ); - } - - BOOST_FILESYSTEM_DECL error_code - copy_file_api( const std::wstring & from, const std::wstring & to, bool fail_if_exists ) - { - return error_code( ::CopyFileW( from.c_str(), to.c_str(), fail_if_exists ) - ? 0 : ::GetLastError(), system_category() ); - } - - BOOST_FILESYSTEM_DECL bool create_file_api( const std::wstring & ph, - std::ios_base::openmode mode ) // true if succeeds - { - DWORD access( - ((mode & std::ios_base::in) == 0 ? 0 : GENERIC_READ) - | ((mode & std::ios_base::out) == 0 ? 0 : GENERIC_WRITE) ); - - DWORD disposition(0); // see 27.8.1.3 Table 92 - if ( (mode&~std::ios_base::binary) - == (std::ios_base::out|std::ios_base::app) ) - disposition = OPEN_ALWAYS; - else if ( (mode&~(std::ios_base::binary|std::ios_base::out)) - == std::ios_base::in ) disposition = OPEN_EXISTING; - else if ( ((mode&~(std::ios_base::binary|std::ios_base::trunc)) - == std::ios_base::out ) - || ((mode&~std::ios_base::binary) - == (std::ios_base::in|std::ios_base::out|std::ios_base::trunc)) ) - disposition = CREATE_ALWAYS; - else BOOST_ASSERT( 0 && "invalid mode argument" ); - - HANDLE handle ( ::CreateFileW( ph.c_str(), access, - FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, 0, - disposition, (mode &std::ios_base::out) != 0 - ? FILE_ATTRIBUTE_ARCHIVE : FILE_ATTRIBUTE_NORMAL, 0 ) ); - if ( handle == INVALID_HANDLE_VALUE ) return false; - ::CloseHandle( handle ); - return true; - } - - BOOST_FILESYSTEM_DECL std::string narrow_path_api( - const std::wstring & ph ) // return is empty if fails - { - std::string narrow_short_form; - std::wstring short_form; - for ( DWORD buf_sz( static_cast<DWORD>( ph.size()+1 ));; ) - { - boost::scoped_array<wchar_t> buf( new wchar_t[buf_sz] ); - DWORD sz( ::GetShortPathNameW( ph.c_str(), buf.get(), buf_sz ) ); - if ( sz == 0 ) return narrow_short_form; - if ( sz <= buf_sz ) - { - short_form += buf.get(); - break; - } - buf_sz = sz + 1; - } - // contributed by Takeshi Mouri: - int narrow_sz( ::WideCharToMultiByte( CP_ACP, 0, - short_form.c_str(), static_cast<int>(short_form.size()), 0, 0, 0, 0 ) ); - boost::scoped_array<char> narrow_buf( new char[narrow_sz] ); - ::WideCharToMultiByte( CP_ACP, 0, - short_form.c_str(), static_cast<int>(short_form.size()), - narrow_buf.get(), narrow_sz, 0, 0 ); - narrow_short_form.assign(narrow_buf.get(), narrow_sz); - - return narrow_short_form; - } - - BOOST_FILESYSTEM_DECL error_code - dir_itr_first( void *& handle, const std::wstring & dir, - std::wstring & target, file_status & sf, file_status & symlink_sf ) - { - // use a form of search Sebastian Martel reports will work with Win98 - std::wstring dirpath( dir ); - dirpath += (dirpath.empty() - || dirpath[dirpath.size()-1] != L'\\') ? L"\\*" : L"*"; - - WIN32_FIND_DATAW data; - if ( (handle = ::FindFirstFileW( dirpath.c_str(), &data )) - == INVALID_HANDLE_VALUE ) - { - handle = 0; - return error_code( ::GetLastError() == ERROR_FILE_NOT_FOUND - ? 0 : ::GetLastError(), system_category() ); - } - target = data.cFileName; - if ( data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) - { sf.type( directory_file ); symlink_sf.type( directory_file ); } - else { sf.type( regular_file ); symlink_sf.type( regular_file ); } - return ok; - } - - BOOST_FILESYSTEM_DECL error_code - dir_itr_increment( void *& handle, std::wstring & target, - file_status & sf, file_status & symlink_sf ) - { - WIN32_FIND_DATAW data; - if ( ::FindNextFileW( handle, &data ) == 0 ) // fails - { - int error = ::GetLastError(); - dir_itr_close( handle ); - return error_code( error == ERROR_NO_MORE_FILES ? 0 : error, system_category() ); - } - target = data.cFileName; - if ( data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) - { sf.type( directory_file ); symlink_sf.type( directory_file ); } - else { sf.type( regular_file ); symlink_sf.type( regular_file ); } - return ok; - } - -# endif // ifndef BOOST_FILESYSTEM2_NARROW_ONLY - - // suggested by Walter Landry - BOOST_FILESYSTEM_DECL bool symbolic_link_exists_api( const std::string & ) - { return false; } - - BOOST_FILESYSTEM_DECL - fs::detail::query_pair is_empty_api( const std::string & ph ) - { return is_empty_template( ph ); } - - BOOST_FILESYSTEM_DECL - fs::detail::query_pair - equivalent_api( const std::string & ph1, const std::string & ph2 ) - { return equivalent_template( ph1, ph2 ); } - - BOOST_FILESYSTEM_DECL - fs::detail::uintmax_pair file_size_api( const std::string & ph ) - { return file_size_template( ph ); } - - BOOST_FILESYSTEM_DECL - fs::detail::space_pair space_api( const std::string & ph ) - { return space_template( ph ); } - - BOOST_FILESYSTEM_DECL - error_code - get_current_path_api( std::string & ph ) - { return get_current_path_template( ph ); } - - BOOST_FILESYSTEM_DECL - error_code - set_current_path_api( const std::string & ph ) - { return set_current_path_template( ph ); } - - BOOST_FILESYSTEM_DECL error_code - get_full_path_name_api( const std::string & ph, std::string & target ) - { return get_full_path_name_template( ph, target ); } - - BOOST_FILESYSTEM_DECL time_pair - last_write_time_api( const std::string & ph ) - { return last_write_time_template( ph ); } - - BOOST_FILESYSTEM_DECL error_code - last_write_time_api( const std::string & ph, std::time_t new_value ) - { return last_write_time_template( ph, new_value ); } - - BOOST_FILESYSTEM_DECL fs::detail::query_pair - create_directory_api( const std::string & ph ) - { return create_directory_template( ph ); } - -#if _WIN32_WINNT >= 0x500 - BOOST_FILESYSTEM_DECL error_code - create_hard_link_api( const std::string & to_ph, - const std::string & from_ph ) - { - return create_hard_link_template( to_ph, from_ph ); - } -#endif - - BOOST_FILESYSTEM_DECL error_code - create_symlink_api( const std::string & /*to_ph*/, - const std::string & /*from_ph*/ ) - { return error_code( ERROR_NOT_SUPPORTED, system_category() ); } - - BOOST_FILESYSTEM_DECL error_code - remove_api( const std::string & ph ) { return remove_template( ph ); } - - BOOST_FILESYSTEM_DECL error_code - rename_api( const std::string & from, const std::string & to ) - { - return error_code( ::MoveFileA( from.c_str(), to.c_str() ) - ? 0 : ::GetLastError(), system_category() ); - } - - BOOST_FILESYSTEM_DECL error_code - copy_file_api( const std::string & from, const std::string & to, bool fail_if_exists ) - { - return error_code( ::CopyFileA( from.c_str(), to.c_str(), fail_if_exists ) - ? 0 : ::GetLastError(), system_category() ); - } - - BOOST_FILESYSTEM_DECL error_code - dir_itr_first( void *& handle, const std::string & dir, - std::string & target, file_status & sf, file_status & symlink_sf ) - // Note: an empty root directory has no "." or ".." entries, so this - // causes a ERROR_FILE_NOT_FOUND error which we do not considered an - // error. It is treated as eof instead. - { - // use a form of search Sebastian Martel reports will work with Win98 - std::string dirpath( dir ); - dirpath += (dirpath.empty() - || (dirpath[dirpath.size()-1] != '\\' - && dirpath[dirpath.size()-1] != ':')) ? "\\*" : "*"; - - WIN32_FIND_DATAA data; - if ( (handle = ::FindFirstFileA( dirpath.c_str(), &data )) - == INVALID_HANDLE_VALUE ) - { - handle = 0; - return error_code( (::GetLastError() == ERROR_FILE_NOT_FOUND - // Windows Mobile returns ERROR_NO_MORE_FILES; see ticket #3551 - || ::GetLastError() == ERROR_NO_MORE_FILES) - ? 0 : ::GetLastError(), system_category() ); - } - target = data.cFileName; - if ( data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) - { sf.type( directory_file ); symlink_sf.type( directory_file ); } - else { sf.type( regular_file ); symlink_sf.type( regular_file ); } - return ok; - } - - BOOST_FILESYSTEM_DECL error_code - dir_itr_close( void *& handle ) - { - if ( handle != 0 ) - { - bool ok = ::FindClose( handle ) != 0; - handle = 0; - return error_code( ok ? 0 : ::GetLastError(), system_category() ); - } - return ok; - } - - BOOST_FILESYSTEM_DECL error_code - dir_itr_increment( void *& handle, std::string & target, - file_status & sf, file_status & symlink_sf ) - { - WIN32_FIND_DATAA data; - if ( ::FindNextFileA( handle, &data ) == 0 ) // fails - { - int error = ::GetLastError(); - dir_itr_close( handle ); - return error_code( error == ERROR_NO_MORE_FILES ? 0 : error, system_category() ); - } - target = data.cFileName; - if ( data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY ) - { sf.type( directory_file ); symlink_sf.type( directory_file ); } - else { sf.type( regular_file ); symlink_sf.type( regular_file ); } - return ok; - } - -# else // BOOST_POSIX_API - - BOOST_FILESYSTEM_DECL fs::file_status - status_api( const std::string & ph, error_code & ec ) - { - struct stat path_stat; - if ( ::stat( ph.c_str(), &path_stat ) != 0 ) - { - if ( errno == ENOENT || errno == ENOTDIR ) - { - ec = ok; - return fs::file_status( fs::file_not_found ); - } - ec = error_code( errno, system_category() ); - return fs::file_status( fs::status_unknown ); - } - ec = ok; - if ( S_ISDIR( path_stat.st_mode ) ) - return fs::file_status( fs::directory_file ); - if ( S_ISREG( path_stat.st_mode ) ) - return fs::file_status( fs::regular_file ); - if ( S_ISBLK( path_stat.st_mode ) ) - return fs::file_status( fs::block_file ); - if ( S_ISCHR( path_stat.st_mode ) ) - return fs::file_status( fs::character_file ); - if ( S_ISFIFO( path_stat.st_mode ) ) - return fs::file_status( fs::fifo_file ); - if ( S_ISSOCK( path_stat.st_mode ) ) - return fs::file_status( fs::socket_file ); - return fs::file_status( fs::type_unknown ); - } - - BOOST_FILESYSTEM_DECL fs::file_status - symlink_status_api( const std::string & ph, error_code & ec ) - { - struct stat path_stat; - if ( ::lstat( ph.c_str(), &path_stat ) != 0 ) - { - if ( errno == ENOENT || errno == ENOTDIR ) - { - ec = ok; - return fs::file_status( fs::file_not_found ); - } - ec = error_code( errno, system_category() ); - return fs::file_status( fs::status_unknown ); - } - ec = ok; - if ( S_ISREG( path_stat.st_mode ) ) - return fs::file_status( fs::regular_file ); - if ( S_ISDIR( path_stat.st_mode ) ) - return fs::file_status( fs::directory_file ); - if ( S_ISLNK( path_stat.st_mode ) ) - return fs::file_status( fs::symlink_file ); - if ( S_ISBLK( path_stat.st_mode ) ) - return fs::file_status( fs::block_file ); - if ( S_ISCHR( path_stat.st_mode ) ) - return fs::file_status( fs::character_file ); - if ( S_ISFIFO( path_stat.st_mode ) ) - return fs::file_status( fs::fifo_file ); - if ( S_ISSOCK( path_stat.st_mode ) ) - return fs::file_status( fs::socket_file ); - return fs::file_status( fs::type_unknown ); - } - - // suggested by Walter Landry - BOOST_FILESYSTEM_DECL bool - symbolic_link_exists_api( const std::string & ph ) - { - struct stat path_stat; - return ::lstat( ph.c_str(), &path_stat ) == 0 - && S_ISLNK( path_stat.st_mode ); - } - - BOOST_FILESYSTEM_DECL query_pair - is_empty_api( const std::string & ph ) - { - struct stat path_stat; - if ( (::stat( ph.c_str(), &path_stat )) != 0 ) - return std::make_pair( error_code( errno, system_category() ), false ); - return std::make_pair( ok, S_ISDIR( path_stat.st_mode ) - ? is_empty_directory( ph ) - : path_stat.st_size == 0 ); - } - - BOOST_FILESYSTEM_DECL query_pair - equivalent_api( const std::string & ph1, const std::string & ph2 ) - { - struct stat s2; - int e2( ::stat( ph2.c_str(), &s2 ) ); - struct stat s1; - int e1( ::stat( ph1.c_str(), &s1 ) ); - if ( e1 != 0 || e2 != 0 ) - return std::make_pair( error_code( e1 != 0 && e2 != 0 ? errno : 0, system_category() ), false ); - // at this point, both stats are known to be valid - return std::make_pair( ok, - s1.st_dev == s2.st_dev - && s1.st_ino == s2.st_ino - // According to the POSIX stat specs, "The st_ino and st_dev fields - // taken together uniquely identify the file within the system." - // Just to be sure, size and mod time are also checked. - && s1.st_size == s2.st_size - && s1.st_mtime == s2.st_mtime ); - } - - BOOST_FILESYSTEM_DECL uintmax_pair - file_size_api( const std::string & ph ) - { - struct stat path_stat; - if ( ::stat( ph.c_str(), &path_stat ) != 0 ) - return std::make_pair( error_code( errno, system_category() ), 0 ); - if ( !S_ISREG( path_stat.st_mode ) ) - return std::make_pair( error_code( EPERM, system_category() ), 0 ); - return std::make_pair( ok, - static_cast<boost::uintmax_t>(path_stat.st_size) ); - } - - BOOST_FILESYSTEM_DECL space_pair - space_api( const std::string & ph ) - { - struct BOOST_STATVFS vfs; - space_pair result; - if ( ::BOOST_STATVFS( ph.c_str(), &vfs ) != 0 ) - { - result.first = error_code( errno, system_category() ); - result.second.capacity = result.second.free - = result.second.available = 0; - } - else - { - result.first = ok; - result.second.capacity - = static_cast<boost::uintmax_t>(vfs.f_blocks) * BOOST_STATVFS_F_FRSIZE; - result.second.free - = static_cast<boost::uintmax_t>(vfs.f_bfree) * BOOST_STATVFS_F_FRSIZE; - result.second.available - = static_cast<boost::uintmax_t>(vfs.f_bavail) * BOOST_STATVFS_F_FRSIZE; - } - return result; - } - - BOOST_FILESYSTEM_DECL time_pair - last_write_time_api( const std::string & ph ) - { - struct stat path_stat; - if ( ::stat( ph.c_str(), &path_stat ) != 0 ) - return std::make_pair( error_code( errno, system_category() ), 0 ); - return std::make_pair( ok, path_stat.st_mtime ); - } - - BOOST_FILESYSTEM_DECL error_code - last_write_time_api( const std::string & ph, std::time_t new_value ) - { - struct stat path_stat; - if ( ::stat( ph.c_str(), &path_stat ) != 0 ) - return error_code( errno, system_category() ); - ::utimbuf buf; - buf.actime = path_stat.st_atime; // utime() updates access time too:-( - buf.modtime = new_value; - return error_code( ::utime( ph.c_str(), &buf ) != 0 ? errno : 0, system_category() ); - } - - BOOST_FILESYSTEM_DECL error_code - get_current_path_api( std::string & ph ) - { - for ( long path_max = 32;; path_max *=2 ) // loop 'til buffer large enough - { - boost::scoped_array<char> - buf( new char[static_cast<std::size_t>(path_max)] ); - if ( ::getcwd( buf.get(), static_cast<std::size_t>(path_max) ) == 0 ) - { - if ( errno != ERANGE - // bug in some versions of the Metrowerks C lib on the Mac: wrong errno set -# if defined(__MSL__) && (defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)) - && errno != 0 -# endif - ) return error_code( errno, system_category() ); - } - else - { - ph = buf.get(); - break; - } - } - return ok; - } - - BOOST_FILESYSTEM_DECL error_code - set_current_path_api( const std::string & ph ) - { - return error_code( ::chdir( ph.c_str() ) - ? errno : 0, system_category() ); - } - - BOOST_FILESYSTEM_DECL fs::detail::query_pair - create_directory_api( const std::string & ph ) - { - if ( ::mkdir( ph.c_str(), S_IRWXU|S_IRWXG|S_IRWXO ) == 0 ) - { return std::make_pair( ok, true ); } - int ec=errno; - error_code dummy; - if ( ec != EEXIST - || !fs::is_directory( status_api( ph, dummy ) ) ) - { return std::make_pair( error_code( ec, system_category() ), false ); } - return std::make_pair( ok, false ); - } - - BOOST_FILESYSTEM_DECL error_code - create_hard_link_api( const std::string & to_ph, - const std::string & from_ph ) - { - return error_code( ::link( to_ph.c_str(), from_ph.c_str() ) == 0 - ? 0 : errno, system_category() ); - } - - BOOST_FILESYSTEM_DECL error_code - create_symlink_api( const std::string & to_ph, - const std::string & from_ph ) - { - return error_code( ::symlink( to_ph.c_str(), from_ph.c_str() ) == 0 - ? 0 : errno, system_category() ); - } - - BOOST_FILESYSTEM_DECL error_code - remove_api( const std::string & ph ) - { - if ( posix_remove( ph.c_str() ) == 0 ) - return ok; - int error = errno; - // POSIX says "If the directory is not an empty directory, rmdir() - // shall fail and set errno to EEXIST or ENOTEMPTY." - // Linux uses ENOTEMPTY, Solaris uses EEXIST. - if ( error == EEXIST ) error = ENOTEMPTY; - - error_code ec; - - // ignore errors if post-condition satisfied - return status_api(ph, ec).type() == file_not_found - ? ok : error_code( error, system_category() ) ; - } - - BOOST_FILESYSTEM_DECL error_code - rename_api( const std::string & from, const std::string & to ) - { - // POSIX is too permissive so must check - error_code dummy; - if ( fs::exists( status_api( to, dummy ) ) ) - return error_code( EEXIST, system_category() ); - return error_code( std::rename( from.c_str(), to.c_str() ) != 0 - ? errno : 0, system_category() ); - } - - BOOST_FILESYSTEM_DECL error_code - copy_file_api( const std::string & from_file_ph, - const std::string & to_file_ph, bool fail_if_exists ) - { - const std::size_t buf_sz = 32768; - boost::scoped_array<char> buf( new char [buf_sz] ); - int infile=-1, outfile=-1; // -1 means not open - - // bug fixed: code previously did a stat() on the from_file first, but that - // introduced a gratuitous race condition; the stat() is now done after the open() - - if ( (infile = ::open( from_file_ph.c_str(), O_RDONLY )) < 0 ) - { return error_code( errno, system_category() ); } - - struct stat from_stat; - if ( ::stat( from_file_ph.c_str(), &from_stat ) != 0 ) - { return error_code( errno, system_category() ); } - - int oflag = O_CREAT | O_WRONLY | O_TRUNC; - if ( fail_if_exists ) - oflag |= O_EXCL; - if ( (outfile = ::open( to_file_ph.c_str(), oflag, from_stat.st_mode )) < 0 ) - { - int open_errno = errno; - BOOST_ASSERT( infile >= 0 ); - ::close( infile ); - return error_code( open_errno, system_category() ); - } - - ssize_t sz, sz_read=1, sz_write; - while ( sz_read > 0 - && (sz_read = ::read( infile, buf.get(), buf_sz )) > 0 ) - { - // Allow for partial writes - see Advanced Unix Programming (2nd Ed.), - // Marc Rochkind, Addison-Wesley, 2004, page 94 - sz_write = 0; - do - { - if ( (sz = ::write( outfile, buf.get() + sz_write, - sz_read - sz_write )) < 0 ) - { - sz_read = sz; // cause read loop termination - break; // and error to be thrown after closes - } - sz_write += sz; - } while ( sz_write < sz_read ); - } - - if ( ::close( infile) < 0 ) sz_read = -1; - if ( ::close( outfile) < 0 ) sz_read = -1; - - return error_code( sz_read < 0 ? errno : 0, system_category() ); - } - - // this code is based on Stevens and Rago, Advanced Programming in the - // UNIX envirnment, 2nd Ed., ISBN 0-201-43307-9, page 49 - error_code path_max( std::size_t & result ) - { -# ifdef PATH_MAX - static std::size_t max = PATH_MAX; -# else - static std::size_t max = 0; -# endif - if ( max == 0 ) - { - errno = 0; - long tmp = ::pathconf( "/", _PC_NAME_MAX ); - if ( tmp < 0 ) - { - if ( errno == 0 ) // indeterminate - max = 4096; // guess - else return error_code( errno, system_category() ); - } - else max = static_cast<std::size_t>( tmp + 1 ); // relative root - } - result = max; - return ok; - } - - BOOST_FILESYSTEM_DECL error_code - dir_itr_first( void *& handle, void *& buffer, - const std::string & dir, std::string & target, - file_status &, file_status & ) - { - if ( (handle = ::opendir( dir.c_str() )) == 0 ) - return error_code( errno, system_category() ); - target = std::string( "." ); // string was static but caused trouble - // when iteration called from dtor, after - // static had already been destroyed - std::size_t path_size (0); // initialization quiets gcc warning - error_code ec = path_max( path_size ); - if ( ec ) return ec; - dirent de; - buffer = std::malloc( (sizeof(dirent) - sizeof(de.d_name)) - + path_size + 1 ); // + 1 for "/0" - return ok; - } - - BOOST_FILESYSTEM_DECL error_code - dir_itr_close( void *& handle, void*& buffer ) - { - std::free( buffer ); - buffer = 0; - if ( handle == 0 ) return ok; - DIR * h( static_cast<DIR*>(handle) ); - handle = 0; - return error_code( ::closedir( h ) == 0 ? 0 : errno, system_category() ); - } - - // warning: the only dirent member updated is d_name - inline int readdir_r_simulator( DIR * dirp, struct dirent * entry, - struct dirent ** result ) // *result set to 0 on end of directory - { - errno = 0; - - # if !defined(__CYGWIN__) \ - && defined(_POSIX_THREAD_SAFE_FUNCTIONS) \ - && defined(_SC_THREAD_SAFE_FUNCTIONS) \ - && (_POSIX_THREAD_SAFE_FUNCTIONS+0 >= 0) \ - && (!defined(__hpux) || defined(_REENTRANT)) \ - && (!defined(_AIX) || defined(__THREAD_SAFE)) - if ( ::sysconf( _SC_THREAD_SAFE_FUNCTIONS ) >= 0 ) - { return ::readdir_r( dirp, entry, result ); } - # endif - - struct dirent * p; - *result = 0; - if ( (p = ::readdir( dirp )) == 0 ) - return errno; - std::strcpy( entry->d_name, p->d_name ); - *result = entry; - return 0; - } - - BOOST_FILESYSTEM_DECL error_code - dir_itr_increment( void *& handle, void *& buffer, - std::string & target, file_status & sf, file_status & symlink_sf ) - { - BOOST_ASSERT( buffer != 0 ); - dirent * entry( static_cast<dirent *>(buffer) ); - dirent * result; - int return_code; - if ( (return_code = readdir_r_simulator( static_cast<DIR*>(handle), - entry, &result )) != 0 ) return error_code( errno, system_category() ); - if ( result == 0 ) return dir_itr_close( handle, buffer ); - target = entry->d_name; -# ifdef BOOST_FILESYSTEM_STATUS_CACHE - if ( entry->d_type == DT_UNKNOWN ) // filesystem does not supply d_type value - { - sf = symlink_sf = fs::file_status(fs::status_unknown); - } - else // filesystem supplies d_type value - { - if ( entry->d_type == DT_DIR ) - sf = symlink_sf = fs::file_status( fs::directory_file ); - else if ( entry->d_type == DT_REG ) - sf = symlink_sf = fs::file_status( fs::regular_file ); - else if ( entry->d_type == DT_LNK ) - { - sf = fs::file_status( fs::status_unknown ); - symlink_sf = fs::file_status( fs::symlink_file ); - } - else sf = symlink_sf = fs::file_status( fs::status_unknown ); - } -# else - sf = symlink_sf = fs::file_status( fs::status_unknown ); -# endif - return ok; - } - -# endif - } // namespace detail - } // namespace filesystem2 -} // namespace boost diff --git a/3rdParty/Boost/src/libs/filesystem/v2/src/v2_path.cpp b/3rdParty/Boost/src/libs/filesystem/v2/src/v2_path.cpp deleted file mode 100644 index 16f6583..0000000 --- a/3rdParty/Boost/src/libs/filesystem/v2/src/v2_path.cpp +++ /dev/null @@ -1,177 +0,0 @@ -// path.cpp ----------------------------------------------------------------// - -// Copyright 2005 Beman Dawes - -// 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) - -// See library home page at http://www.boost.org/libs/filesystem - -//----------------------------------------------------------------------------// - -// define BOOST_FILESYSTEM_SOURCE so that <boost/filesystem/config.hpp> knows -// the library is being built (possibly exporting rather than importing code) -#define BOOST_FILESYSTEM_SOURCE - -#ifndef BOOST_SYSTEM_NO_DEPRECATED -# define BOOST_SYSTEM_NO_DEPRECATED -#endif - -#include <boost/filesystem/v2/config.hpp> - -#ifndef BOOST_FILESYSTEM2_NARROW_ONLY - -#include <boost/filesystem/v2/path.hpp> -#include <boost/scoped_array.hpp> - -#include <locale> -#include <boost/cerrno.hpp> -#include <boost/system/error_code.hpp> - -#include <cwchar> // for std::mbstate_t - -#if defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__) -# include <boost/filesystem/detail/utf8_codecvt_facet.hpp> -#endif - - -namespace -{ - // std::locale construction can throw (if LC_MESSAGES is wrong, for example), - // so a static at function scope is used to ensure that exceptions can be - // caught. (A previous version was at namespace scope, so initialization - // occurred before main(), preventing exceptions from being caught.) - std::locale & loc() - { -#if !defined(macintosh) && !defined(__APPLE__) && !defined(__APPLE_CC__) - // ISO C calls this "the locale-specific native environment": - static std::locale lc(""); -#else // Mac OS - // "All BSD system functions expect their string parameters to be in UTF-8 encoding - // and nothing else." - // See http://developer.apple.com/mac/library/documentation/MacOSX/Conceptual/BPInternational/Articles/FileEncodings.html - std::locale global_loc = std::locale(); // Mac OS doesn't support locale("") - static std::locale lc(global_loc, - new boost::filesystem::detail::utf8_codecvt_facet); -#endif - return lc; - } - - const std::codecvt<wchar_t, char, std::mbstate_t> *& - converter() - { - static const std::codecvt<wchar_t, char, std::mbstate_t> * - cvtr( - &std::use_facet<std::codecvt<wchar_t, char, std::mbstate_t> > - ( loc() ) ); - return cvtr; - } - - bool locked(false); -} // unnamed namespace - -namespace boost -{ - namespace filesystem2 - { - bool wpath_traits::imbue( const std::locale & new_loc, const std::nothrow_t & ) - { - if ( locked ) return false; - locked = true; - loc() = new_loc; - converter() = &std::use_facet - <std::codecvt<wchar_t, char, std::mbstate_t> >( loc() ); - return true; - } - - void wpath_traits::imbue( const std::locale & new_loc ) - { - if ( locked ) BOOST_FILESYSTEM_THROW( - wfilesystem_error( - "boost::filesystem::wpath_traits::imbue() after lockdown", - make_error_code( system::errc::not_supported ) ) ); - imbue( new_loc, std::nothrow ); - } - - //namespace detail - //{ - // BOOST_FILESYSTEM_DECL - // const char * what( const char * sys_err_what, - // const path & path1, const path & path2, std::string & target) - // { - // try - // { - // if ( target.empty() ) - // { - // target = sys_err_what; - // if ( !path1.empty() ) - // { - // target += ": \""; - // target += path1.file_string(); - // target += "\""; - // } - // if ( !path2.empty() ) - // { - // target += ", \""; - // target += path2.file_string(); - // target += "\""; - // } - // } - // return target.c_str(); - // } - // catch (...) - // { - // return sys_err_what; - // } - // } - //} - -# ifdef BOOST_POSIX_API - -// Because this is POSIX only code, we don't have to worry about ABI issues -// described in http://www.boost.org/more/separate_compilation.html - - wpath_traits::external_string_type - wpath_traits::to_external( const wpath & ph, - const internal_string_type & src ) - { - locked = true; - std::size_t work_size( converter()->max_length() * (src.size()+1) ); - boost::scoped_array<char> work( new char[ work_size ] ); - std::mbstate_t state = std::mbstate_t(); // perhaps unneeded, but cuts bug reports - const internal_string_type::value_type * from_next; - external_string_type::value_type * to_next; - if ( converter()->out( - state, src.c_str(), src.c_str()+src.size(), from_next, work.get(), - work.get()+work_size, to_next ) != std::codecvt_base::ok ) - BOOST_FILESYSTEM_THROW( boost::filesystem::wfilesystem_error( - "boost::filesystem::wpath::to_external conversion error", - ph, system::error_code( system::errc::invalid_argument, system::system_category() ) ) ); - *to_next = '\0'; - return external_string_type( work.get() ); - } - - wpath_traits::internal_string_type - wpath_traits::to_internal( const external_string_type & src ) - { - locked = true; - std::size_t work_size( src.size()+1 ); - boost::scoped_array<wchar_t> work( new wchar_t[ work_size ] ); - std::mbstate_t state = std::mbstate_t(); // perhaps unneeded, but cuts bug reports - const external_string_type::value_type * from_next; - internal_string_type::value_type * to_next; - if ( converter()->in( - state, src.c_str(), src.c_str()+src.size(), from_next, work.get(), - work.get()+work_size, to_next ) != std::codecvt_base::ok ) - BOOST_FILESYSTEM_THROW( boost::filesystem::wfilesystem_error( - "boost::filesystem::wpath::to_internal conversion error", - system::error_code( system::errc::invalid_argument, system::system_category() ) ) ); - *to_next = L'\0'; - return internal_string_type( work.get() ); - } -# endif // BOOST_POSIX_API - - } // namespace filesystem2 -} // namespace boost - -#endif // ifndef BOOST_FILESYSTEM2_NARROW_ONLY diff --git a/3rdParty/Boost/src/libs/filesystem/v2/src/v2_portability.cpp b/3rdParty/Boost/src/libs/filesystem/v2/src/v2_portability.cpp deleted file mode 100644 index 4d27543..0000000 --- a/3rdParty/Boost/src/libs/filesystem/v2/src/v2_portability.cpp +++ /dev/null @@ -1,119 +0,0 @@ -// portability.cpp ---------------------------------------------------------// - -// Copyright 2002-2005 Beman Dawes -// 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 library home page at http://www.boost.org/libs/filesystem - -//----------------------------------------------------------------------------// - -// define BOOST_FILESYSTEM_SOURCE so that <boost/filesystem/config.hpp> knows -// the library is being built (possibly exporting rather than importing code) -#define BOOST_FILESYSTEM_SOURCE - -#ifndef BOOST_SYSTEM_NO_DEPRECATED -# define BOOST_SYSTEM_NO_DEPRECATED -#endif - -#include <boost/filesystem/v2/config.hpp> -#include <boost/filesystem/v2/path.hpp> - -namespace fs = boost::filesystem2; - -#include <cstring> // SGI MIPSpro compilers need this - -# ifdef BOOST_NO_STDC_NAMESPACE - namespace std { using ::strerror; } -# endif - -//----------------------------------------------------------------------------// - -namespace -{ - const char invalid_chars[] = - "\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F" - "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F" - "<>:\"/\\|"; - // note that the terminating '\0' is part of the string - thus the size below - // is sizeof(invalid_chars) rather than sizeof(invalid_chars)-1. I - const std::string windows_invalid_chars( invalid_chars, sizeof(invalid_chars) ); - - const std::string valid_posix( - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._-" ); - -} // unnamed namespace - -namespace boost -{ - namespace filesystem2 - { - - // name_check functions ----------------------------------------------// - -# ifdef BOOST_WINDOWS - BOOST_FILESYSTEM_DECL bool native( const std::string & name ) - { - return windows_name( name ); - } -# else - BOOST_FILESYSTEM_DECL bool native( const std::string & name ) - { - return name.size() != 0 - && name[0] != ' ' - && name.find('/') == std::string::npos; - } -# endif - - BOOST_FILESYSTEM_DECL bool portable_posix_name( const std::string & name ) - { - return name.size() != 0 - && name.find_first_not_of( valid_posix ) == std::string::npos; - } - - BOOST_FILESYSTEM_DECL bool windows_name( const std::string & name ) - { - return name.size() != 0 - && name[0] != ' ' - && name.find_first_of( windows_invalid_chars ) == std::string::npos - && *(name.end()-1) != ' ' - && (*(name.end()-1) != '.' - || name.length() == 1 || name == ".."); - } - - BOOST_FILESYSTEM_DECL bool portable_name( const std::string & name ) - { - return - name.size() != 0 - && ( name == "." - || name == ".." - || (windows_name( name ) - && portable_posix_name( name ) - && name[0] != '.' && name[0] != '-')); - } - - BOOST_FILESYSTEM_DECL bool portable_directory_name( const std::string & name ) - { - return - name == "." - || name == ".." - || (portable_name( name ) - && name.find('.') == std::string::npos); - } - - BOOST_FILESYSTEM_DECL bool portable_file_name( const std::string & name ) - { - std::string::size_type pos; - return - portable_name( name ) - && name != "." - && name != ".." - && ( (pos = name.find( '.' )) == std::string::npos - || (name.find( '.', pos+1 ) == std::string::npos - && (pos + 5) > name.length() )) - ; - } - - } // namespace filesystem2 -} // namespace boost diff --git a/3rdParty/Boost/src/libs/filesystem/v3/src/codecvt_error_category.cpp b/3rdParty/Boost/src/libs/filesystem/v3/src/codecvt_error_category.cpp deleted file mode 100644 index b35b4a9..0000000 --- a/3rdParty/Boost/src/libs/filesystem/v3/src/codecvt_error_category.cpp +++ /dev/null @@ -1,93 +0,0 @@ -// codecvt_error_category implementation file ----------------------------------------// - -// Copyright Beman Dawes 2009 - -// Distributed under the Boost Software License, Version 1.0. -// See http://www.boost.org/LICENSE_1_0.txt) - -// Library home page at http://www.boost.org/libs/filesystem - -//--------------------------------------------------------------------------------------// - -#include <boost/config.hpp> -#if !defined( BOOST_NO_STD_WSTRING ) -// Boost.Filesystem V3 and later requires std::wstring support. -// During the transition to V3, libraries are compiled with both V2 and V3 sources. -// On old compilers that don't support V3 anyhow, we just skip everything so the compile -// will succeed and the library can be built. - -#include <boost/config/warning_disable.hpp> - -// define BOOST_FILESYSTEM_SOURCE so that <boost/filesystem/config.hpp> knows -// the library is being built (possibly exporting rather than importing code) -#define BOOST_FILESYSTEM_SOURCE - -#ifndef BOOST_SYSTEM_NO_DEPRECATED -# define BOOST_SYSTEM_NO_DEPRECATED -#endif - -#include <boost/filesystem/v3/config.hpp> -#include <boost/filesystem/v3/path_traits.hpp> -#include <boost/system/error_code.hpp> -#include <locale> -#include <vector> -#include <cstdlib> -#include <cassert> - -//--------------------------------------------------------------------------------------// - -namespace -{ - class codecvt_error_cat : public boost::system::error_category - { - public: - codecvt_error_cat(){} - const char* name() const; - std::string message(int ev) const; - }; - - const char* codecvt_error_cat::name() const - { - return "codecvt"; - } - - std::string codecvt_error_cat::message(int ev) const - { - std::string str; - switch (ev) - { - case std::codecvt_base::ok: - str = "ok"; - break; - case std::codecvt_base::partial: - str = "partial"; - break; - case std::codecvt_base::error: - str = "error"; - break; - case std::codecvt_base::noconv: - str = "noconv"; - break; - default: - str = "unknown error"; - } - return str; - } - -} // unnamed namespace - -namespace boost -{ - namespace filesystem3 - { - - BOOST_FILESYSTEM_DECL const boost::system::error_category& codecvt_error_category() - { - static const codecvt_error_cat codecvt_error_cat_const; - return codecvt_error_cat_const; - } - - } // namespace filesystem3 -} // namespace boost - -#endif // no wide character support diff --git a/3rdParty/Boost/src/libs/filesystem/v3/src/filesystem_utf8_codecvt_facet.cpp b/3rdParty/Boost/src/libs/filesystem/v3/src/filesystem_utf8_codecvt_facet.cpp deleted file mode 100644 index 1849a1a..0000000 --- a/3rdParty/Boost/src/libs/filesystem/v3/src/filesystem_utf8_codecvt_facet.cpp +++ /dev/null @@ -1,23 +0,0 @@ -// Copyright Vladimir Prus 2004. -// 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_SYSTEM_NO_DEPRECATED -# define BOOST_SYSTEM_NO_DEPRECATED -#endif - -#define BOOST_FILESYSTEM_SOURCE -#include <boost/filesystem/config.hpp> - -#define BOOST_UTF8_BEGIN_NAMESPACE \ - namespace boost { namespace filesystem { namespace detail { - -#define BOOST_UTF8_END_NAMESPACE }}} -#define BOOST_UTF8_DECL BOOST_FILESYSTEM_DECL - -#include "libs/detail/utf8_codecvt_facet.cpp" - -#undef BOOST_UTF8_BEGIN_NAMESPACE -#undef BOOST_UTF8_END_NAMESPACE -#undef BOOST_UTF8_DECL diff --git a/3rdParty/Boost/src/libs/filesystem/v3/src/operations.cpp b/3rdParty/Boost/src/libs/filesystem/v3/src/operations.cpp deleted file mode 100644 index 2460c1d..0000000 --- a/3rdParty/Boost/src/libs/filesystem/v3/src/operations.cpp +++ /dev/null @@ -1,1975 +0,0 @@ -// operations.cpp --------------------------------------------------------------------// - -// Copyright 2002-2009 Beman Dawes -// Copyright 2001 Dietmar Kuehl - -// Distributed under the Boost Software License, Version 1.0. -// See http://www.boost.org/LICENSE_1_0.txt - -// See library home page at http://www.boost.org/libs/filesystem - -//--------------------------------------------------------------------------------------// - -#include <boost/config.hpp> -#if !defined( BOOST_NO_STD_WSTRING ) -// Boost.Filesystem V3 and later requires std::wstring support. -// During the transition to V3, libraries are compiled with both V2 and V3 sources. -// On old compilers that don't support V3 anyhow, we just skip everything so the compile -// will succeed and the library can be built. - -// define BOOST_FILESYSTEM_SOURCE so that <boost/filesystem/config.hpp> knows -// the library is being built (possibly exporting rather than importing code) - -#define BOOST_FILESYSTEM_SOURCE - -#ifndef BOOST_SYSTEM_NO_DEPRECATED -# define BOOST_SYSTEM_NO_DEPRECATED -#endif - -#ifndef _POSIX_PTHREAD_SEMANTICS -# define _POSIX_PTHREAD_SEMANTICS // Sun readdir_r()needs this -#endif - -#if !(defined(__HP_aCC) && defined(_ILP32) && \ - !defined(_STATVFS_ACPP_PROBLEMS_FIXED)) -#define _FILE_OFFSET_BITS 64 // at worst, these defines may have no effect, -#endif -#if !defined(__PGI) -#define __USE_FILE_OFFSET64 // but that is harmless on Windows and on POSIX - // 64-bit systems or on 32-bit systems which don't have files larger - // than can be represented by a traditional POSIX/UNIX off_t type. - // OTOH, defining them should kick in 64-bit off_t's (and thus - // st_size)on 32-bit systems that provide the Large File - // Support (LFS)interface, such as Linux, Solaris, and IRIX. - // The defines are given before any headers are included to - // ensure that they are available to all included headers. - // That is required at least on Solaris, and possibly on other - // systems as well. -#else -#define _FILE_OFFSET_BITS 64 -#endif - -#include <boost/filesystem/v3/operations.hpp> -#include <boost/scoped_array.hpp> -#include <boost/detail/workaround.hpp> -#include <cstdlib> // for malloc, free -#include <vector> - -#ifdef BOOST_FILEYSTEM_INCLUDE_IOSTREAM -# include <iostream> -#endif - -namespace fs = boost::filesystem3; -using boost::filesystem3::path; -using boost::filesystem3::filesystem_error; -using boost::system::error_code; -using boost::system::error_category; -using boost::system::system_category; -using std::string; -using std::wstring; - -# ifdef BOOST_POSIX_API - -# include <sys/types.h> -# if !defined(__APPLE__) && !defined(__OpenBSD__) -# include <sys/statvfs.h> -# define BOOST_STATVFS statvfs -# define BOOST_STATVFS_F_FRSIZE vfs.f_frsize -# else -# ifdef __OpenBSD__ -# include <sys/param.h> -# endif -# include <sys/mount.h> -# define BOOST_STATVFS statfs -# define BOOST_STATVFS_F_FRSIZE static_cast<boost::uintmax_t>(vfs.f_bsize) -# endif -# include <dirent.h> -# include <unistd.h> -# include <fcntl.h> -# include <utime.h> -# include "limits.h" - -# else // BOOST_WINDOW_API - -# if (defined(__MINGW32__) || defined(__CYGWIN__)) && !defined(WINVER) - // Versions of MinGW or Cygwin that support Filesystem V3 support at least WINVER 0x501. - // See MinGW's windef.h -# define WINVER 0x501 -# endif -# include <windows.h> -# include <winnt.h> -# if !defined(_WIN32_WINNT) -# define _WIN32_WINNT 0x0500 -# endif -# if defined(__BORLANDC__) || defined(__MWERKS__) -# if defined(__BORLANDC__) - using std::time_t; -# endif -# include <utime.h> -# else -# include <sys/utime.h> -# endif - -// REPARSE_DATA_BUFFER related definitions are found in ntifs.h, which is part of the -// Windows Device Driver Kit. Since that's inconvenient, the definitions are provided -// here. See http://msdn.microsoft.com/en-us/library/ms791514.aspx - -#if !defined(REPARSE_DATA_BUFFER_HEADER_SIZE) // mingw winnt.h does provide the defs - -#define SYMLINK_FLAG_RELATIVE 1 - -typedef struct _REPARSE_DATA_BUFFER { - ULONG ReparseTag; - USHORT ReparseDataLength; - USHORT Reserved; - union { - struct { - USHORT SubstituteNameOffset; - USHORT SubstituteNameLength; - USHORT PrintNameOffset; - USHORT PrintNameLength; - ULONG Flags; - WCHAR PathBuffer[1]; - /* Example of distinction between substitute and print names: - mklink /d ldrive c:\ - SubstituteName: c:\\??\ - PrintName: c:\ - */ - } SymbolicLinkReparseBuffer; - struct { - USHORT SubstituteNameOffset; - USHORT SubstituteNameLength; - USHORT PrintNameOffset; - USHORT PrintNameLength; - WCHAR PathBuffer[1]; - } MountPointReparseBuffer; - struct { - UCHAR DataBuffer[1]; - } GenericReparseBuffer; - }; -} REPARSE_DATA_BUFFER, *PREPARSE_DATA_BUFFER; - -#define REPARSE_DATA_BUFFER_HEADER_SIZE \ - FIELD_OFFSET(REPARSE_DATA_BUFFER, GenericReparseBuffer) - -#endif - -#ifndef MAXIMUM_REPARSE_DATA_BUFFER_SIZE -#define MAXIMUM_REPARSE_DATA_BUFFER_SIZE ( 16 * 1024 ) -#endif - -# ifndef FSCTL_GET_REPARSE_POINT -# define FSCTL_GET_REPARSE_POINT 0x900a8 -# endif - -# ifndef IO_REPARSE_TAG_SYMLINK -# define IO_REPARSE_TAG_SYMLINK (0xA000000CL) -# endif - -# endif // BOOST_WINDOWS_API - -// BOOST_FILESYSTEM_STATUS_CACHE enables file_status cache in -// dir_itr_increment. The config tests are placed here because some of the -// macros being tested come from dirent.h. -// -// TODO: find out what macros indicate dirent::d_type present in more libraries -# if defined(BOOST_WINDOWS_API)\ - || defined(_DIRENT_HAVE_D_TYPE)// defined by GNU C library if d_type present -# define BOOST_FILESYSTEM_STATUS_CACHE -# endif - -#include <sys/stat.h> // even on Windows some functions use stat() -#include <string> -#include <cstring> -#include <cstdio> // for remove, rename -#include <cerrno> -#include <cassert> -// #include <iostream> // for debugging only; comment out when not in use - -// POSIX/Windows macros ----------------------------------------------------// - -// Portions of the POSIX and Windows API's are very similar, except for name, -// order of arguments, and meaning of zero/non-zero returns. The macros below -// abstract away those differences. They follow Windows naming and order of -// arguments, and return true to indicate no error occurred. [POSIX naming, -// order of arguments, and meaning of return were followed initially, but -// found to be less clear and cause more coding errors.] - -# if defined(BOOST_POSIX_API) - -// POSIX uses a 0 return to indicate success -# define BOOST_ERRNO errno -# define BOOST_SET_CURRENT_DIRECTORY(P)(::chdir(P)== 0) -# define BOOST_CREATE_DIRECTORY(P)(::mkdir(P, S_IRWXU|S_IRWXG|S_IRWXO)== 0) -# define BOOST_CREATE_HARD_LINK(F,T)(::link(T, F)== 0) -# define BOOST_CREATE_SYMBOLIC_LINK(F,T,Flag)(::symlink(T, F)== 0) -# define BOOST_REMOVE_DIRECTORY(P)(::rmdir(P)== 0) -# define BOOST_DELETE_FILE(P)(::unlink(P)== 0) -# define BOOST_COPY_DIRECTORY(F,T)(!(::stat(from.c_str(), &from_stat)!= 0\ - || ::mkdir(to.c_str(),from_stat.st_mode)!= 0)) -# define BOOST_COPY_FILE(F,T,FailIfExistsBool)copy_file_api(F, T, FailIfExistsBool) -# define BOOST_MOVE_FILE(OLD,NEW)(::rename(OLD, NEW)== 0) -# define BOOST_RESIZE_FILE(P,SZ)(::truncate(P, SZ)== 0) - -# define BOOST_ERROR_NOT_SUPPORTED ENOSYS -# define BOOST_ERROR_ALREADY_EXISTS EEXIST - -# else // BOOST_WINDOWS_API - -// Windows uses a non-0 return to indicate success -# define BOOST_ERRNO ::GetLastError() -# define BOOST_SET_CURRENT_DIRECTORY(P)(::SetCurrentDirectoryW(P)!= 0) -# define BOOST_CREATE_DIRECTORY(P)(::CreateDirectoryW(P, 0)!= 0) -# define BOOST_CREATE_HARD_LINK(F,T)(create_hard_link_api(F, T, 0)!= 0) -# define BOOST_CREATE_SYMBOLIC_LINK(F,T,Flag)(create_symbolic_link_api(F, T, Flag)!= 0) -# define BOOST_REMOVE_DIRECTORY(P)(::RemoveDirectoryW(P)!= 0) -# define BOOST_DELETE_FILE(P)(::DeleteFileW(P)!= 0) -# define BOOST_COPY_DIRECTORY(F,T)(::CreateDirectoryExW(F, T, 0)!= 0) -# define BOOST_COPY_FILE(F,T,FailIfExistsBool)(::CopyFileW(F, T, FailIfExistsBool)!= 0) -# define BOOST_MOVE_FILE(OLD,NEW)(::MoveFileExW(OLD, NEW, MOVEFILE_REPLACE_EXISTING)!= 0) -# define BOOST_RESIZE_FILE(P,SZ)(resize_file_api(P, SZ)!= 0) -# define BOOST_READ_SYMLINK(P,T) - -# define BOOST_ERROR_ALREADY_EXISTS ERROR_ALREADY_EXISTS -# define BOOST_ERROR_NOT_SUPPORTED ERROR_NOT_SUPPORTED - -# endif - -//--------------------------------------------------------------------------------------// -// // -// helpers (all operating systems) // -// // -//--------------------------------------------------------------------------------------// - -namespace -{ - -# ifdef BOOST_POSIX_API - const char dot = '.'; -# else - const wchar_t dot = L'.'; -# endif - - fs::file_type query_file_type(const path& p, error_code* ec); - - boost::filesystem3::directory_iterator end_dir_itr; - - const std::size_t buf_size(128); - const error_code ok; - - bool error(bool was_error, error_code* ec, const string& message) - { - if (!was_error) - { - if (ec != 0) ec->clear(); - } - else - { // error - if (ec == 0) - BOOST_FILESYSTEM_THROW(filesystem_error(message, - error_code(BOOST_ERRNO, system_category()))); - else - ec->assign(BOOST_ERRNO, system_category()); - } - return was_error; - } - - bool error(bool was_error, const path& p, error_code* ec, const string& message) - { - if (!was_error) - { - if (ec != 0) ec->clear(); - } - else - { // error - if (ec == 0) - BOOST_FILESYSTEM_THROW(filesystem_error(message, - p, error_code(BOOST_ERRNO, system_category()))); - else - ec->assign(BOOST_ERRNO, system_category()); - } - return was_error; - } - - bool error(bool was_error, const path& p1, const path& p2, error_code* ec, - const string& message) - { - if (!was_error) - { - if (ec != 0) ec->clear(); - } - else - { // error - if (ec == 0) - BOOST_FILESYSTEM_THROW(filesystem_error(message, - p1, p2, error_code(BOOST_ERRNO, system_category()))); - else - ec->assign(BOOST_ERRNO, system_category()); - } - return was_error; - } - - bool error(bool was_error, const error_code& result, - const path& p, error_code* ec, const string& message) - // Overwrites ec if there has already been an error - { - if (!was_error) - { - if (ec != 0) ec->clear(); - } - else - { // error - if (ec == 0) - BOOST_FILESYSTEM_THROW(filesystem_error(message, p, result)); - else - *ec = result; - } - return was_error; - } - - bool error(bool was_error, const error_code& result, - const path& p1, const path& p2, error_code* ec, const string& message) - // Overwrites ec if there has already been an error - { - if (!was_error) - { - if (ec != 0) ec->clear(); - } - else - { // error - if (ec == 0) - BOOST_FILESYSTEM_THROW(filesystem_error(message, p1, p2, result)); - else - *ec = result; - } - return was_error; - } - - bool is_empty_directory(const path& p) - { - return fs::directory_iterator(p)== end_dir_itr; - } - - bool remove_directory(const path& p) // true if succeeds - { return BOOST_REMOVE_DIRECTORY(p.c_str()); } - - bool remove_file(const path& p) // true if succeeds - { return BOOST_DELETE_FILE(p.c_str()); } - - // called by remove and remove_all_aux - bool remove_file_or_directory(const path& p, fs::file_type type, error_code* ec) - // return true if file removed, false if not removed - { - if (type == fs::file_not_found) - { - if (ec != 0) ec->clear(); - return false; - } - - if (type == fs::directory_file -# ifdef BOOST_WINDOWS_API - || type == fs::_detail_directory_symlink -# endif - ) - { - if (error(!remove_directory(p), p, ec, "boost::filesystem::remove")) - return false; - } - else - { - if (error(!remove_file(p), p, ec, "boost::filesystem::remove")) - return false; - } - return true; - } - - boost::uintmax_t remove_all_aux(const path& p, fs::file_type type, - error_code* ec) - { - boost::uintmax_t count = 1; - - if (type == fs::directory_file) // but not a directory symlink - { - for (fs::directory_iterator itr(p); - itr != end_dir_itr; ++itr) - { - fs::file_type tmp_type = query_file_type(itr->path(), ec); - if (ec != 0 && *ec) - return count; - count += remove_all_aux(itr->path(), tmp_type, ec); - } - } - remove_file_or_directory(p, type, ec); - return count; - } - -#ifdef BOOST_POSIX_API - -//--------------------------------------------------------------------------------------// -// // -// POSIX-specific helpers // -// // -//--------------------------------------------------------------------------------------// - - bool not_found_error(int errval) - { - return errno == ENOENT || errno == ENOTDIR; - } - - bool // true if ok - copy_file_api(const std::string& from_p, - const std::string& to_p, bool fail_if_exists) - { - const std::size_t buf_sz = 32768; - boost::scoped_array<char> buf(new char [buf_sz]); - int infile=-1, outfile=-1; // -1 means not open - - // bug fixed: code previously did a stat()on the from_file first, but that - // introduced a gratuitous race condition; the stat()is now done after the open() - - if ((infile = ::open(from_p.c_str(), O_RDONLY))< 0) - { return false; } - - struct stat from_stat; - if (::stat(from_p.c_str(), &from_stat)!= 0) - { return false; } - - int oflag = O_CREAT | O_WRONLY | O_TRUNC; - if (fail_if_exists) - oflag |= O_EXCL; - if ((outfile = ::open(to_p.c_str(), oflag, from_stat.st_mode))< 0) - { - int open_errno = errno; - BOOST_ASSERT(infile >= 0); - ::close(infile); - errno = open_errno; - return false; - } - - ssize_t sz, sz_read=1, sz_write; - while (sz_read > 0 - && (sz_read = ::read(infile, buf.get(), buf_sz))> 0) - { - // Allow for partial writes - see Advanced Unix Programming (2nd Ed.), - // Marc Rochkind, Addison-Wesley, 2004, page 94 - sz_write = 0; - do - { - if ((sz = ::write(outfile, buf.get() + sz_write, - sz_read - sz_write))< 0) - { - sz_read = sz; // cause read loop termination - break; // and error to be thrown after closes - } - sz_write += sz; - } while (sz_write < sz_read); - } - - if (::close(infile)< 0)sz_read = -1; - if (::close(outfile)< 0)sz_read = -1; - - return sz_read >= 0; - } - - inline fs::file_type query_file_type(const path& p, error_code* ec) - { - return fs::detail::symlink_status(p, ec).type(); - } - -# else - -//--------------------------------------------------------------------------------------// -// // -// Windows-specific helpers // -// // -//--------------------------------------------------------------------------------------// - - bool not_found_error(int errval) - { - return errval == ERROR_FILE_NOT_FOUND - || errval == ERROR_PATH_NOT_FOUND - || errval == ERROR_INVALID_NAME // "tools/jam/src/:sys:stat.h", "//foo" - || errval == ERROR_INVALID_DRIVE // USB card reader with no card inserted - || errval == ERROR_NOT_READY // CD/DVD drive with no disc inserted - || errval == ERROR_INVALID_PARAMETER // ":sys:stat.h" - || errval == ERROR_BAD_PATHNAME // "//nosuch" on Win64 - || errval == ERROR_BAD_NETPATH; // "//nosuch" on Win32 - } - - // these constants come from inspecting some Microsoft sample code - std::time_t to_time_t(const FILETIME & ft) - { - __int64 t = (static_cast<__int64>(ft.dwHighDateTime)<< 32) - + ft.dwLowDateTime; -# if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 // > VC++ 7.0 - t -= 116444736000000000LL; -# else - t -= 116444736000000000; -# endif - t /= 10000000; - return static_cast<std::time_t>(t); - } - - void to_FILETIME(std::time_t t, FILETIME & ft) - { - __int64 temp = t; - temp *= 10000000; -# if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 // > VC++ 7.0 - temp += 116444736000000000LL; -# else - temp += 116444736000000000; -# endif - ft.dwLowDateTime = static_cast<DWORD>(temp); - ft.dwHighDateTime = static_cast<DWORD>(temp >> 32); - } - - // Thanks to Jeremy Maitin-Shepard for much help and for permission to - // base the equivalent()implementation on portions of his - // file-equivalence-win32.cpp experimental code. - - struct handle_wrapper - { - HANDLE handle; - handle_wrapper(HANDLE h) - : handle(h){} - ~handle_wrapper() - { - if (handle != INVALID_HANDLE_VALUE) - ::CloseHandle(handle); - } - }; - - HANDLE create_file_handle(const path& p, DWORD dwDesiredAccess, - DWORD dwShareMode, LPSECURITY_ATTRIBUTES lpSecurityAttributes, - DWORD dwCreationDisposition, DWORD dwFlagsAndAttributes, - HANDLE hTemplateFile) - { - return ::CreateFileW(p.c_str(), dwDesiredAccess, dwShareMode, - lpSecurityAttributes, dwCreationDisposition, dwFlagsAndAttributes, - hTemplateFile); - } - - bool is_reparse_point_a_symlink(const path& p) - { - handle_wrapper h(create_file_handle(p, FILE_READ_EA, - FILE_SHARE_READ | FILE_SHARE_WRITE | FILE_SHARE_DELETE, NULL, OPEN_EXISTING, - FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT, NULL)); - if (h.handle == INVALID_HANDLE_VALUE) - return false; - - boost::scoped_array<char> buf(new char [MAXIMUM_REPARSE_DATA_BUFFER_SIZE]); - - // Query the reparse data - DWORD dwRetLen; - BOOL result = ::DeviceIoControl(h.handle, FSCTL_GET_REPARSE_POINT, NULL, 0, buf.get(), - MAXIMUM_REPARSE_DATA_BUFFER_SIZE, &dwRetLen, NULL); - if (!result) return false; - - return reinterpret_cast<const REPARSE_DATA_BUFFER*>(buf.get()) - ->ReparseTag == IO_REPARSE_TAG_SYMLINK; - } - - inline std::size_t get_full_path_name( - const path& src, std::size_t len, wchar_t* buf, wchar_t** p) - { - return static_cast<std::size_t>( - ::GetFullPathNameW(src.c_str(), static_cast<DWORD>(len), buf, p)); - } - - fs::file_status process_status_failure(const path& p, error_code* ec) - { - int errval(::GetLastError()); - if (ec != 0) // always report errval, even though some - ec->assign(errval, system_category()); // errval values are not status_errors - - if (not_found_error(errval)) - { - return fs::file_status(fs::file_not_found); - } - else if ((errval == ERROR_SHARING_VIOLATION)) - { - return fs::file_status(fs::type_unknown); - } - if (ec == 0) - BOOST_FILESYSTEM_THROW(filesystem_error("boost::filesystem::status", - p, error_code(errval, system_category()))); - return fs::file_status(fs::status_error); - } - - // differs from symlink_status() in that directory symlinks are reported as - // _detail_directory_symlink, as required on Windows by remove() and its helpers. - fs::file_type query_file_type(const path& p, error_code* ec) - { - DWORD attr(::GetFileAttributesW(p.c_str())); - if (attr == 0xFFFFFFFF) - { - return process_status_failure(p, ec).type(); - } - - if (ec != 0) ec->clear(); - - if (attr & FILE_ATTRIBUTE_REPARSE_POINT) - { - if (is_reparse_point_a_symlink(p)) - return (attr & FILE_ATTRIBUTE_DIRECTORY) - ? fs::_detail_directory_symlink - : fs::symlink_file; - return fs::reparse_file; - } - - return (attr & FILE_ATTRIBUTE_DIRECTORY) - ? fs::directory_file - : fs::regular_file; - } - - BOOL resize_file_api(const wchar_t* p, boost::uintmax_t size) - { - HANDLE handle = CreateFileW(p, GENERIC_WRITE, 0, 0, OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, 0); - LARGE_INTEGER sz; - sz.QuadPart = size; - return handle != INVALID_HANDLE_VALUE - && ::SetFilePointerEx(handle, sz, 0, FILE_BEGIN) - && ::SetEndOfFile(handle) - && ::CloseHandle(handle); - } - - // Windows kernel32.dll functions that may or may not be present - // must be accessed through pointers - - typedef BOOL (WINAPI *PtrCreateHardLinkW)( - /*__in*/ LPCWSTR lpFileName, - /*__in*/ LPCWSTR lpExistingFileName, - /*__reserved*/ LPSECURITY_ATTRIBUTES lpSecurityAttributes - ); - - PtrCreateHardLinkW create_hard_link_api = PtrCreateHardLinkW( - ::GetProcAddress( - ::GetModuleHandle(TEXT("kernel32.dll")), "CreateHardLinkW")); - - typedef BOOLEAN (WINAPI *PtrCreateSymbolicLinkW)( - /*__in*/ LPCWSTR lpSymlinkFileName, - /*__in*/ LPCWSTR lpTargetFileName, - /*__in*/ DWORD dwFlags - ); - - PtrCreateSymbolicLinkW create_symbolic_link_api = PtrCreateSymbolicLinkW( - ::GetProcAddress( - ::GetModuleHandle(TEXT("kernel32.dll")), "CreateSymbolicLinkW")); - -#endif - -//#ifdef BOOST_WINDOWS_API -// -// -// inline bool get_free_disk_space(const std::wstring& ph, -// PULARGE_INTEGER avail, PULARGE_INTEGER total, PULARGE_INTEGER free) -// { return ::GetDiskFreeSpaceExW(ph.c_str(), avail, total, free)!= 0; } -// -//#endif - -} // unnamed namespace - -//--------------------------------------------------------------------------------------// -// // -// operations functions declared in operations.hpp // -// in alphabetic order // -// // -//--------------------------------------------------------------------------------------// - -namespace boost -{ -namespace filesystem3 -{ - - BOOST_FILESYSTEM_DECL - path absolute(const path& p, const path& base) - { -// if ( p.empty() || p.is_absolute() ) -// return p; -// // recursively calling absolute is sub-optimal, but is simple -// path abs_base(base.is_absolute() ? base : absolute(base)); -//# ifdef BOOST_WINDOWS_API -// if (p.has_root_directory()) -// return abs_base.root_name() / p; -// // !p.has_root_directory -// if (p.has_root_name()) -// return p.root_name() -// / abs_base.root_directory() / abs_base.relative_path() / p.relative_path(); -// // !p.has_root_name() -//# endif -// return abs_base / p; - - // recursively calling absolute is sub-optimal, but is sure and simple - path abs_base(base.is_absolute() ? base : absolute(base)); - - // store expensive to compute values that are needed multiple times - path p_root_name (p.root_name()); - path base_root_name (abs_base.root_name()); - path p_root_directory (p.root_directory()); - - if (p.empty()) - return abs_base; - - if (!p_root_name.empty()) // p.has_root_name() - { - if (p_root_directory.empty()) // !p.has_root_directory() - return p_root_name / abs_base.root_directory() - / abs_base.relative_path() / p.relative_path(); - // p is absolute, so fall through to return p at end of block - } - - else if (!p_root_directory.empty()) // p.has_root_directory() - { -# ifdef BOOST_POSIX_API - // POSIX can have root name it it is a network path - if (base_root_name.empty()) // !abs_base.has_root_name() - return p; -# endif - return base_root_name / p; - } - - else - { - return abs_base / p; - } - - return p; // p.is_absolute() is true - } - -namespace detail -{ - BOOST_FILESYSTEM_DECL bool possible_large_file_size_support() - { -# ifdef BOOST_POSIX_API - struct stat lcl_stat; - return sizeof(lcl_stat.st_size)> 4; -# else - return true; -# endif - } - - BOOST_FILESYSTEM_DECL - void copy(const path& from, const path& to, system::error_code* ec) - { - file_status s(symlink_status(from, *ec)); - if (ec != 0 && *ec) return; - - if(is_symlink(s)) - { - copy_symlink(from, to, *ec); - } - else if(is_directory(s)) - { - copy_directory(from, to, *ec); - } - else if(is_regular_file(s)) - { - copy_file(from, to, copy_option::fail_if_exists, *ec); - } - else - { - if (ec == 0) - BOOST_FILESYSTEM_THROW(filesystem_error("boost::filesystem::copy", - from, to, error_code(BOOST_ERROR_NOT_SUPPORTED, system_category()))); - ec->assign(BOOST_ERROR_NOT_SUPPORTED, system_category()); - } - } - - BOOST_FILESYSTEM_DECL - void copy_directory(const path& from, const path& to, system::error_code* ec) - { -# ifdef BOOST_POSIX_API - struct stat from_stat; -# endif - error(!BOOST_COPY_DIRECTORY(from.c_str(), to.c_str()), - from, to, ec, "boost::filesystem::copy_directory"); - } - - BOOST_FILESYSTEM_DECL - void copy_file(const path& from, const path& to, - BOOST_SCOPED_ENUM(copy_option)option, - error_code* ec) - { - error(!BOOST_COPY_FILE(from.c_str(), to.c_str(), - option == copy_option::fail_if_exists), - from, to, ec, "boost::filesystem::copy_file"); - } - - BOOST_FILESYSTEM_DECL - void copy_symlink(const path& existing_symlink, const path& new_symlink, - system::error_code* ec) - { -# if defined(_WIN32_WINNT) && _WIN32_WINNT < 0x0600 - error(true, error_code(BOOST_ERROR_NOT_SUPPORTED, system_category()), - new_symlink, existing_symlink, ec, - "boost::filesystem::copy_symlink"); - -# else // modern Windows or BOOST_POSIX_API - path p(read_symlink(existing_symlink, ec)); - if (ec != 0 && *ec) return; - create_symlink(p, new_symlink, ec); - -# endif - } - - BOOST_FILESYSTEM_DECL - bool create_directories(const path& p, system::error_code* ec) - { - if (p.empty() || exists(p)) - { - if (!p.empty() && !is_directory(p)) - { - if (ec == 0) - BOOST_FILESYSTEM_THROW(filesystem_error( - "boost::filesystem::create_directories", p, - error_code(system::errc::file_exists, system::generic_category()))); - else ec->assign(system::errc::file_exists, system::generic_category()); - } - return false; - } - - // First create branch, by calling ourself recursively - create_directories(p.parent_path(), ec); - // Now that parent's path exists, create the directory - create_directory(p, ec); - return true; - } - - BOOST_FILESYSTEM_DECL - bool create_directory(const path& p, error_code* ec) - { - if (BOOST_CREATE_DIRECTORY(p.c_str())) - { - if (ec != 0) ec->clear(); - return true; - } - - // attempt to create directory failed - int errval(BOOST_ERRNO); // save reason for failure - error_code dummy; - if (errval == BOOST_ERROR_ALREADY_EXISTS && is_directory(p, dummy)) - { - if (ec != 0) ec->clear(); - return false; - } - - // attempt to create directory failed && it doesn't already exist - if (ec == 0) - BOOST_FILESYSTEM_THROW(filesystem_error("boost::filesystem::create_directory", - p, error_code(errval, system_category()))); - else - ec->assign(errval, system_category()); - return false; - } - - BOOST_FILESYSTEM_DECL - void create_directory_symlink(const path& to, const path& from, - system::error_code* ec) - { -# if defined(BOOST_WINDOWS_API) && _WIN32_WINNT < 0x0600 // SDK earlier than Vista and Server 2008 - - error(true, error_code(BOOST_ERROR_NOT_SUPPORTED, system_category()), to, from, ec, - "boost::filesystem::create_directory_symlink"); -# else - -# if defined(BOOST_WINDOWS_API) && _WIN32_WINNT >= 0x0600 - // see if actually supported by Windows runtime dll - if (error(!create_symbolic_link_api, - error_code(BOOST_ERROR_NOT_SUPPORTED, system_category()), - to, from, ec, - "boost::filesystem::create_directory_symlink")) - return; -# endif - - error(!BOOST_CREATE_SYMBOLIC_LINK(from.c_str(), to.c_str(), SYMBOLIC_LINK_FLAG_DIRECTORY), - to, from, ec, "boost::filesystem::create_directory_symlink"); -# endif - } - - BOOST_FILESYSTEM_DECL - void create_hard_link(const path& to, const path& from, error_code* ec) - { - -# if defined(BOOST_WINDOWS_API) && _WIN32_WINNT < 0x0500 // SDK earlier than Win 2K - - error(true, error_code(BOOST_ERROR_NOT_SUPPORTED, system_category()), to, from, ec, - "boost::filesystem::create_hard_link"); -# else - -# if defined(BOOST_WINDOWS_API) && _WIN32_WINNT >= 0x0500 - // see if actually supported by Windows runtime dll - if (error(!create_hard_link_api, - error_code(BOOST_ERROR_NOT_SUPPORTED, system_category()), - to, from, ec, - "boost::filesystem::create_hard_link")) - return; -# endif - - error(!BOOST_CREATE_HARD_LINK(from.c_str(), to.c_str()), to, from, ec, - "boost::filesystem::create_hard_link"); -# endif - } - - BOOST_FILESYSTEM_DECL - void create_symlink(const path& to, const path& from, error_code* ec) - { -# if defined(BOOST_WINDOWS_API) && _WIN32_WINNT < 0x0600 // SDK earlier than Vista and Server 2008 - error(true, error_code(BOOST_ERROR_NOT_SUPPORTED, system_category()), to, from, ec, - "boost::filesystem::create_directory_symlink"); -# else - -# if defined(BOOST_WINDOWS_API) && _WIN32_WINNT >= 0x0600 - // see if actually supported by Windows runtime dll - if (error(!create_symbolic_link_api, - error_code(BOOST_ERROR_NOT_SUPPORTED, system_category()), - to, from, ec, - "boost::filesystem::create_symlink")) - return; -# endif - - error(!BOOST_CREATE_SYMBOLIC_LINK(from.c_str(), to.c_str(), 0), - to, from, ec, "boost::filesystem::create_symlink"); -# endif - } - - BOOST_FILESYSTEM_DECL - path current_path(error_code* ec) - { -# ifdef BOOST_POSIX_API - path cur; - for (long path_max = 128;; path_max *=2)// loop 'til buffer large enough - { - boost::scoped_array<char> - buf(new char[static_cast<std::size_t>(path_max)]); - if (::getcwd(buf.get(), static_cast<std::size_t>(path_max))== 0) - { - if (error(errno != ERANGE - // bug in some versions of the Metrowerks C lib on the Mac: wrong errno set -# if defined(__MSL__) && (defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__)) - && errno != 0 -# endif - , ec, "boost::filesystem::current_path")) - { - break; - } - } - else - { - cur = buf.get(); - if (ec != 0) ec->clear(); - break; - } - } - return cur; - -# else - DWORD sz; - if ((sz = ::GetCurrentDirectoryW(0, NULL))== 0)sz = 1; - boost::scoped_array<path::value_type> buf(new path::value_type[sz]); - error(::GetCurrentDirectoryW(sz, buf.get())== 0, ec, - "boost::filesystem::current_path"); - return path(buf.get()); -# endif - } - - - BOOST_FILESYSTEM_DECL - void current_path(const path& p, system::error_code* ec) - { - error(!BOOST_SET_CURRENT_DIRECTORY(p.c_str()), - p, ec, "boost::filesystem::current_path"); - } - - BOOST_FILESYSTEM_DECL - bool equivalent(const path& p1, const path& p2, system::error_code* ec) - { -# ifdef BOOST_POSIX_API - struct stat s2; - int e2(::stat(p2.c_str(), &s2)); - struct stat s1; - int e1(::stat(p1.c_str(), &s1)); - - if (e1 != 0 || e2 != 0) - { - // if one is invalid and the other isn't then they aren't equivalent, - // but if both are invalid then it is an error - error (e1 != 0 && e2 != 0, p1, p2, ec, "boost::filesystem::equivalent"); - return false; - } - - // both stats now known to be valid - return s1.st_dev == s2.st_dev && s1.st_ino == s2.st_ino - // According to the POSIX stat specs, "The st_ino and st_dev fields - // taken together uniquely identify the file within the system." - // Just to be sure, size and mod time are also checked. - && s1.st_size == s2.st_size && s1.st_mtime == s2.st_mtime; - -# else // Windows - - // Note well: Physical location on external media is part of the - // equivalence criteria. If there are no open handles, physical location - // can change due to defragmentation or other relocations. Thus handles - // must be held open until location information for both paths has - // been retrieved. - - // p2 is done first, so any error reported is for p1 - handle_wrapper h2( - create_file_handle( - p2.c_str(), - 0, - FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, - 0, - OPEN_EXISTING, - FILE_FLAG_BACKUP_SEMANTICS, - 0)); - - handle_wrapper h1( - create_file_handle( - p1.c_str(), - 0, - FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, - 0, - OPEN_EXISTING, - FILE_FLAG_BACKUP_SEMANTICS, - 0)); - - if (h1.handle == INVALID_HANDLE_VALUE - || h2.handle == INVALID_HANDLE_VALUE) - { - // if one is invalid and the other isn't, then they aren't equivalent, - // but if both are invalid then it is an error - error(h1.handle == INVALID_HANDLE_VALUE - && h2.handle == INVALID_HANDLE_VALUE, p1, p2, ec, - "boost::filesystem::equivalent"); - return false; - } - - // at this point, both handles are known to be valid - - BY_HANDLE_FILE_INFORMATION info1, info2; - - if (error(!::GetFileInformationByHandle(h1.handle, &info1), - p1, p2, ec, "boost::filesystem::equivalent")) - return false; - - if (error(!::GetFileInformationByHandle(h2.handle, &info2), - p1, p2, ec, "boost::filesystem::equivalent")) - return false; - - // In theory, volume serial numbers are sufficient to distinguish between - // devices, but in practice VSN's are sometimes duplicated, so last write - // time and file size are also checked. - return - info1.dwVolumeSerialNumber == info2.dwVolumeSerialNumber - && info1.nFileIndexHigh == info2.nFileIndexHigh - && info1.nFileIndexLow == info2.nFileIndexLow - && info1.nFileSizeHigh == info2.nFileSizeHigh - && info1.nFileSizeLow == info2.nFileSizeLow - && info1.ftLastWriteTime.dwLowDateTime - == info2.ftLastWriteTime.dwLowDateTime - && info1.ftLastWriteTime.dwHighDateTime - == info2.ftLastWriteTime.dwHighDateTime; - -# endif - } - - BOOST_FILESYSTEM_DECL - boost::uintmax_t file_size(const path& p, error_code* ec) - { -# ifdef BOOST_POSIX_API - - struct stat path_stat; - if (error(::stat(p.c_str(), &path_stat)!= 0, - p, ec, "boost::filesystem::file_size")) - return static_cast<boost::uintmax_t>(-1); - if (error(!S_ISREG(path_stat.st_mode), - error_code(EPERM, system_category()), - p, ec, "boost::filesystem::file_size")) - return static_cast<boost::uintmax_t>(-1); - - return static_cast<boost::uintmax_t>(path_stat.st_size); - -# else // Windows - - // assume uintmax_t is 64-bits on all Windows compilers - - WIN32_FILE_ATTRIBUTE_DATA fad; - - if (error(::GetFileAttributesExW(p.c_str(), ::GetFileExInfoStandard, &fad)== 0, - p, ec, "boost::filesystem::file_size")) - return static_cast<boost::uintmax_t>(-1); - - if (error((fad.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY)!= 0, - error_code(ERROR_NOT_SUPPORTED, system_category()), - p, ec, "boost::filesystem::file_size")) - return static_cast<boost::uintmax_t>(-1); - - return (static_cast<boost::uintmax_t>(fad.nFileSizeHigh) - << (sizeof(fad.nFileSizeLow)*8)) + fad.nFileSizeLow; -# endif - } - - BOOST_FILESYSTEM_DECL - boost::uintmax_t hard_link_count(const path& p, system::error_code* ec) - { -# ifdef BOOST_POSIX_API - - struct stat path_stat; - return error(::stat(p.c_str(), &path_stat)!= 0, - p, ec, "boost::filesystem::hard_link_count") - ? 0 - : static_cast<boost::uintmax_t>(path_stat.st_nlink); - -# else // Windows - - // Link count info is only available through GetFileInformationByHandle - BY_HANDLE_FILE_INFORMATION info; - handle_wrapper h( - create_file_handle(p.c_str(), 0, - FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, 0, - OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0)); - return - !error(h.handle == INVALID_HANDLE_VALUE, - p, ec, "boost::filesystem::hard_link_count") - && !error(::GetFileInformationByHandle(h.handle, &info)== 0, - p, ec, "boost::filesystem::hard_link_count") - ? info.nNumberOfLinks - : 0; -# endif - } - - BOOST_FILESYSTEM_DECL - path initial_path(error_code* ec) - { - static path init_path; - if (init_path.empty()) - init_path = current_path(ec); - else if (ec != 0) ec->clear(); - return init_path; - } - - BOOST_FILESYSTEM_DECL - bool is_empty(const path& p, system::error_code* ec) - { -# ifdef BOOST_POSIX_API - - struct stat path_stat; - if (error(::stat(p.c_str(), &path_stat)!= 0, - p, ec, "boost::filesystem::is_empty")) - return false; - return S_ISDIR(path_stat.st_mode) - ? is_empty_directory(p) - : path_stat.st_size == 0; -# else - - WIN32_FILE_ATTRIBUTE_DATA fad; - if (error(::GetFileAttributesExW(p.c_str(), ::GetFileExInfoStandard, &fad)== 0, - p, ec, "boost::filesystem::is_empty")) - return false; - - if (ec != 0) ec->clear(); - return - (fad.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) - ? is_empty_directory(p) - : (!fad.nFileSizeHigh && !fad.nFileSizeLow); -# endif - } - - BOOST_FILESYSTEM_DECL - std::time_t last_write_time(const path& p, system::error_code* ec) - { -# ifdef BOOST_POSIX_API - - struct stat path_stat; - if (error(::stat(p.c_str(), &path_stat)!= 0, - p, ec, "boost::filesystem::last_write_time")) - return std::time_t(-1); - return path_stat.st_mtime; - -# else - - handle_wrapper hw( - create_file_handle(p.c_str(), 0, - FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, 0, - OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0)); - - if (error(hw.handle == INVALID_HANDLE_VALUE, - p, ec, "boost::filesystem::last_write_time")) - return std::time_t(-1); - - FILETIME lwt; - - if (error(::GetFileTime(hw.handle, 0, 0, &lwt)== 0, - p, ec, "boost::filesystem::last_write_time")) - return std::time_t(-1); - - return to_time_t(lwt); -# endif - } - - BOOST_FILESYSTEM_DECL - void last_write_time(const path& p, const std::time_t new_time, - system::error_code* ec) - { -# ifdef BOOST_POSIX_API - - struct stat path_stat; - if (error(::stat(p.c_str(), &path_stat)!= 0, - p, ec, "boost::filesystem::last_write_time")) - return; - ::utimbuf buf; - buf.actime = path_stat.st_atime; // utime()updates access time too:-( - buf.modtime = new_time; - error(::utime(p.c_str(), &buf)!= 0, - p, ec, "boost::filesystem::last_write_time"); - -# else - - handle_wrapper hw( - create_file_handle(p.c_str(), FILE_WRITE_ATTRIBUTES, - FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, 0, - OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0)); - - if (error(hw.handle == INVALID_HANDLE_VALUE, - p, ec, "boost::filesystem::last_write_time")) - return; - - FILETIME lwt; - to_FILETIME(new_time, lwt); - - error(::SetFileTime(hw.handle, 0, 0, &lwt)== 0, - p, ec, "boost::filesystem::last_write_time"); -# endif - } - - BOOST_FILESYSTEM_DECL - path read_symlink(const path& p, system::error_code* ec) - { - path symlink_path; - -# ifdef BOOST_POSIX_API - - for (std::size_t path_max = 64;; path_max *= 2)// loop 'til buffer large enough - { - boost::scoped_array<char> buf(new char[path_max]); - ssize_t result; - if ((result=::readlink(p.c_str(), buf.get(), path_max))== -1) - { - if (ec == 0) - BOOST_FILESYSTEM_THROW(filesystem_error("boost::filesystem::read_symlink", - p, error_code(errno, system_category()))); - else ec->assign(errno, system_category()); - break; - } - else - { - if(result != static_cast<ssize_t>(path_max)) - { - symlink_path.assign(buf.get(), buf.get() + result); - if (ec != 0) ec->clear(); - break; - } - } - } - -# elif _WIN32_WINNT < 0x0600 // SDK earlier than Vista and Server 2008 - error(true, error_code(BOOST_ERROR_NOT_SUPPORTED, system_category()), p, ec, - "boost::filesystem::read_symlink"); -# else // Vista and Server 2008 SDK, or later - - union info_t - { - char buf[REPARSE_DATA_BUFFER_HEADER_SIZE+MAXIMUM_REPARSE_DATA_BUFFER_SIZE]; - REPARSE_DATA_BUFFER rdb; - } info; - - handle_wrapper h( - create_file_handle(p.c_str(), GENERIC_READ, 0, 0, OPEN_EXISTING, - FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT, 0)); - - if (error(h.handle == INVALID_HANDLE_VALUE, p, ec, "boost::filesystem::read_symlink")) - return symlink_path; - - DWORD sz; - - if (!error(::DeviceIoControl(h.handle, FSCTL_GET_REPARSE_POINT, - 0, 0, info.buf, sizeof(info), &sz, 0) == 0, p, ec, - "boost::filesystem::read_symlink" )) - symlink_path.assign( - static_cast<wchar_t*>(info.rdb.SymbolicLinkReparseBuffer.PathBuffer) - + info.rdb.SymbolicLinkReparseBuffer.PrintNameOffset/sizeof(wchar_t), - static_cast<wchar_t*>(info.rdb.SymbolicLinkReparseBuffer.PathBuffer) - + info.rdb.SymbolicLinkReparseBuffer.PrintNameOffset/sizeof(wchar_t) - + info.rdb.SymbolicLinkReparseBuffer.PrintNameLength/sizeof(wchar_t)); -# endif - return symlink_path; - } - - BOOST_FILESYSTEM_DECL - bool remove(const path& p, error_code* ec) - { - error_code tmp_ec; - file_type type = query_file_type(p, &tmp_ec); - if (error(type == status_error, tmp_ec, p, ec, - "boost::filesystem::remove")) - return false; - - // Since POSIX remove() is specified to work with either files or directories, in a - // perfect world it could just be called. But some important real-world operating - // systems (Windows, Mac OS X, for example) don't implement the POSIX spec. So - // remove_file_or_directory() is always called to kep it simple. - return remove_file_or_directory(p, type, ec); - } - - BOOST_FILESYSTEM_DECL - boost::uintmax_t remove_all(const path& p, error_code* ec) - { - error_code tmp_ec; - file_type type = query_file_type(p, &tmp_ec); - if (error(type == status_error, tmp_ec, p, ec, - "boost::filesystem::remove_all")) - return 0; - - return (type != status_error && type != file_not_found) // exists - ? remove_all_aux(p, type, ec) - : 0; - } - - BOOST_FILESYSTEM_DECL - void rename(const path& old_p, const path& new_p, error_code* ec) - { - error(!BOOST_MOVE_FILE(old_p.c_str(), new_p.c_str()), old_p, new_p, ec, - "boost::filesystem::rename"); - } - - BOOST_FILESYSTEM_DECL - void resize_file(const path& p, uintmax_t size, system::error_code* ec) - { - error(!BOOST_RESIZE_FILE(p.c_str(), size), p, ec, "boost::filesystem::resize_file"); - } - - BOOST_FILESYSTEM_DECL - space_info space(const path& p, error_code* ec) - { -# ifdef BOOST_POSIX_API - struct BOOST_STATVFS vfs; - space_info info; - if (!error(::BOOST_STATVFS(p.c_str(), &vfs)!= 0, - p, ec, "boost::filesystem::space")) - { - info.capacity - = static_cast<boost::uintmax_t>(vfs.f_blocks)* BOOST_STATVFS_F_FRSIZE; - info.free - = static_cast<boost::uintmax_t>(vfs.f_bfree)* BOOST_STATVFS_F_FRSIZE; - info.available - = static_cast<boost::uintmax_t>(vfs.f_bavail)* BOOST_STATVFS_F_FRSIZE; - } - -# else - ULARGE_INTEGER avail, total, free; - space_info info; - - if (!error(::GetDiskFreeSpaceExW(p.c_str(), &avail, &total, &free)== 0, - p, ec, "boost::filesystem::space")) - { - info.capacity - = (static_cast<boost::uintmax_t>(total.HighPart)<< 32) - + total.LowPart; - info.free - = (static_cast<boost::uintmax_t>(free.HighPart)<< 32) - + free.LowPart; - info.available - = (static_cast<boost::uintmax_t>(avail.HighPart)<< 32) - + avail.LowPart; - } - -# endif - - else - { - info.capacity = info.free = info.available = 0; - } - return info; - } - - BOOST_FILESYSTEM_DECL - file_status status(const path& p, error_code* ec) - { -# ifdef BOOST_POSIX_API - - struct stat path_stat; - if (::stat(p.c_str(), &path_stat)!= 0) - { - if (ec != 0) // always report errno, even though some - ec->assign(errno, system_category()); // errno values are not status_errors - - if (not_found_error(errno)) - { - return fs::file_status(fs::file_not_found); - } - if (ec == 0) - BOOST_FILESYSTEM_THROW(filesystem_error("boost::filesystem::status", - p, error_code(errno, system_category()))); - return fs::file_status(fs::status_error); - } - if (ec != 0) ec->clear();; - if (S_ISDIR(path_stat.st_mode)) - return fs::file_status(fs::directory_file); - if (S_ISREG(path_stat.st_mode)) - return fs::file_status(fs::regular_file); - if (S_ISBLK(path_stat.st_mode)) - return fs::file_status(fs::block_file); - if (S_ISCHR(path_stat.st_mode)) - return fs::file_status(fs::character_file); - if (S_ISFIFO(path_stat.st_mode)) - return fs::file_status(fs::fifo_file); - if (S_ISSOCK(path_stat.st_mode)) - return fs::file_status(fs::socket_file); - return fs::file_status(fs::type_unknown); - -# else // Windows - - DWORD attr(::GetFileAttributesW(p.c_str())); - if (attr == 0xFFFFFFFF) - { - return process_status_failure(p, ec); - } - - // reparse point handling - if (attr & FILE_ATTRIBUTE_REPARSE_POINT) - { - handle_wrapper h( - create_file_handle( - p.c_str(), - 0, // dwDesiredAccess; attributes only - FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE, - 0, // lpSecurityAttributes - OPEN_EXISTING, - FILE_FLAG_BACKUP_SEMANTICS, - 0)); // hTemplateFile - if (h.handle == INVALID_HANDLE_VALUE) - { - return process_status_failure(p, ec); - } - - if (!is_reparse_point_a_symlink(p)) - return file_status(reparse_file); - } - - if (ec != 0) ec->clear(); - return (attr & FILE_ATTRIBUTE_DIRECTORY) - ? file_status(directory_file) - : file_status(regular_file); - -# endif - } - - BOOST_FILESYSTEM_DECL - file_status symlink_status(const path& p, error_code* ec) - { -# ifdef BOOST_POSIX_API - - struct stat path_stat; - if (::lstat(p.c_str(), &path_stat)!= 0) - { - if (ec != 0) // always report errno, even though some - ec->assign(errno, system_category()); // errno values are not status_errors - - if (errno == ENOENT || errno == ENOTDIR) // these are not errors - { - return fs::file_status(fs::file_not_found); - } - if (ec == 0) - BOOST_FILESYSTEM_THROW(filesystem_error("boost::filesystem::status", - p, error_code(errno, system_category()))); - return fs::file_status(fs::status_error); - } - if (ec != 0) ec->clear(); - if (S_ISREG(path_stat.st_mode)) - return fs::file_status(fs::regular_file); - if (S_ISDIR(path_stat.st_mode)) - return fs::file_status(fs::directory_file); - if (S_ISLNK(path_stat.st_mode)) - return fs::file_status(fs::symlink_file); - if (S_ISBLK(path_stat.st_mode)) - return fs::file_status(fs::block_file); - if (S_ISCHR(path_stat.st_mode)) - return fs::file_status(fs::character_file); - if (S_ISFIFO(path_stat.st_mode)) - return fs::file_status(fs::fifo_file); - if (S_ISSOCK(path_stat.st_mode)) - return fs::file_status(fs::socket_file); - return fs::file_status(fs::type_unknown); - -# else // Windows - - DWORD attr(::GetFileAttributesW(p.c_str())); - if (attr == 0xFFFFFFFF) - { - return process_status_failure(p, ec); - } - - if (ec != 0) ec->clear(); - - if (attr & FILE_ATTRIBUTE_REPARSE_POINT) - return is_reparse_point_a_symlink(p) - ? file_status(symlink_file) - : file_status(reparse_file); - - return (attr & FILE_ATTRIBUTE_DIRECTORY) - ? file_status(directory_file) - : file_status(regular_file); - -# endif - } - - // contributed by Jeff Flinn - BOOST_FILESYSTEM_DECL - path temp_directory_path(system::error_code* ec) - { -# ifdef BOOST_POSIX_API - const char* val = 0; - - (val = std::getenv("TMPDIR" )) || - (val = std::getenv("TMP" )) || - (val = std::getenv("TEMP" )) || - (val = std::getenv("TEMPDIR")); - - path p((val!=0) ? val : "/tmp"); - - if (p.empty() || (ec&&!is_directory(p, *ec))||(!ec&&!is_directory(p))) - { - errno = ENOTDIR; - error(true, p, ec, "boost::filesystem::temp_directory_path"); - return p; - } - - return p; - -# else // Windows - - std::vector<path::value_type> buf(GetTempPathW(0, NULL)); - - if (buf.empty() || GetTempPathW(buf.size(), &buf[0])==0) - { - if(!buf.empty()) ::SetLastError(ENOTDIR); - error(true, ec, "boost::filesystem::temp_directory_path"); - return path(); - } - - buf.pop_back(); - - path p(buf.begin(), buf.end()); - - if ((ec&&!is_directory(p, *ec))||(!ec&&!is_directory(p))) - { - ::SetLastError(ENOTDIR); - error(true, p, ec, "boost::filesystem::temp_directory_path"); - return path(); - } - - return p; -# endif - } - - BOOST_FILESYSTEM_DECL - path system_complete(const path& p, system::error_code* ec) - { -# ifdef BOOST_POSIX_API - return (p.empty() || p.is_absolute()) - ? p : current_path()/ p; - -# else - if (p.empty()) - { - if (ec != 0) ec->clear(); - return p; - } - wchar_t buf[buf_size]; - wchar_t* pfn; - std::size_t len = get_full_path_name(p, buf_size, buf, &pfn); - - if (error(len == 0, p, ec, "boost::filesystem::system_complete")) - return path(); - - if (len < buf_size)// len does not include null termination character - return path(&buf[0]); - - boost::scoped_array<wchar_t> big_buf(new wchar_t[len]); - - return error(get_full_path_name(p, len , big_buf.get(), &pfn)== 0, - p, ec, "boost::filesystem::system_complete") - ? path() - : path(big_buf.get()); -# endif - } - -} // namespace detail - -//--------------------------------------------------------------------------------------// -// // -// directory_entry // -// // -//--------------------------------------------------------------------------------------// - - file_status - directory_entry::m_get_status(system::error_code* ec) const - { - if (!status_known(m_status)) - { - // optimization: if the symlink status is known, and it isn't a symlink, - // then status and symlink_status are identical so just copy the - // symlink status to the regular status. - if (status_known(m_symlink_status) - && !is_symlink(m_symlink_status)) - { - m_status = m_symlink_status; - if (ec != 0) ec->clear(); - } - else m_status = detail::status(m_path, ec); - } - else if (ec != 0) ec->clear(); - return m_status; - } - - file_status - directory_entry::m_get_symlink_status(system::error_code* ec) const - { - if (!status_known(m_symlink_status)) - m_symlink_status = detail::symlink_status(m_path, ec); - else if (ec != 0) ec->clear(); - return m_symlink_status; - } - -// dispatch directory_entry supplied here rather than in -// <boost/filesystem/path_traits.hpp>, thus avoiding header circularity. -// test cases are in operations_unit_test.cpp - -namespace path_traits -{ - void dispatch(const directory_entry & de, -# ifdef BOOST_WINDOWS_API - std::wstring& to, -# else - std::string& to, -# endif - const codecvt_type &) - { - to = de.path().native(); - } - -} // namespace path_traits -} // namespace filesystem3 -} // namespace boost - -//--------------------------------------------------------------------------------------// -// // -// directory_iterator // -// // -//--------------------------------------------------------------------------------------// - -namespace -{ -# ifdef BOOST_POSIX_API - - error_code path_max(std::size_t & result) - // this code is based on Stevens and Rago, Advanced Programming in the - // UNIX envirnment, 2nd Ed., ISBN 0-201-43307-9, page 49 - { -# ifdef PATH_MAX - static std::size_t max = PATH_MAX; -# else - static std::size_t max = 0; -# endif - if (max == 0) - { - errno = 0; - long tmp = ::pathconf("/", _PC_NAME_MAX); - if (tmp < 0) - { - if (errno == 0)// indeterminate - max = 4096; // guess - else return error_code(errno, system_category()); - } - else max = static_cast<std::size_t>(tmp + 1); // relative root - } - result = max; - return ok; - } - -#if defined(__PGI) && defined(__USE_FILE_OFFSET64) -#define dirent dirent64 -#endif - - error_code dir_itr_first(void *& handle, void *& buffer, - const char* dir, string& target, - fs::file_status &, fs::file_status &) - { - if ((handle = ::opendir(dir))== 0) - return error_code(errno, system_category()); - target = string("."); // string was static but caused trouble - // when iteration called from dtor, after - // static had already been destroyed - std::size_t path_size (0); // initialization quiets gcc warning (ticket #3509) - error_code ec = path_max(path_size); - if (ec)return ec; - dirent de; - buffer = std::malloc((sizeof(dirent) - sizeof(de.d_name)) - + path_size + 1); // + 1 for "/0" - return ok; - } - - // warning: the only dirent member updated is d_name - inline int readdir_r_simulator(DIR * dirp, struct dirent * entry, - struct dirent ** result)// *result set to 0 on end of directory - { - errno = 0; - -# if !defined(__CYGWIN__)\ - && defined(_POSIX_THREAD_SAFE_FUNCTIONS)\ - && defined(_SC_THREAD_SAFE_FUNCTIONS)\ - && (_POSIX_THREAD_SAFE_FUNCTIONS+0 >= 0)\ - && (!defined(__hpux) || defined(_REENTRANT)) \ - && (!defined(_AIX) || defined(__THREAD_SAFE)) - if (::sysconf(_SC_THREAD_SAFE_FUNCTIONS)>= 0) - { return ::readdir_r(dirp, entry, result); } -# endif - - struct dirent * p; - *result = 0; - if ((p = ::readdir(dirp))== 0) - return errno; - std::strcpy(entry->d_name, p->d_name); - *result = entry; - return 0; - } - - error_code dir_itr_increment(void *& handle, void *& buffer, - string& target, fs::file_status & sf, fs::file_status & symlink_sf) - { - BOOST_ASSERT(buffer != 0); - dirent * entry(static_cast<dirent *>(buffer)); - dirent * result; - int return_code; - if ((return_code = readdir_r_simulator(static_cast<DIR*>(handle), - entry, &result))!= 0)return error_code(errno, system_category()); - if (result == 0) - return fs::detail::dir_itr_close(handle, buffer); - target = entry->d_name; -# ifdef BOOST_FILESYSTEM_STATUS_CACHE - if (entry->d_type == DT_UNKNOWN) // filesystem does not supply d_type value - { - sf = symlink_sf = fs::file_status(fs::status_error); - } - else // filesystem supplies d_type value - { - if (entry->d_type == DT_DIR) - sf = symlink_sf = fs::file_status(fs::directory_file); - else if (entry->d_type == DT_REG) - sf = symlink_sf = fs::file_status(fs::regular_file); - else if (entry->d_type == DT_LNK) - { - sf = fs::file_status(fs::status_error); - symlink_sf = fs::file_status(fs::symlink_file); - } - else sf = symlink_sf = fs::file_status(fs::status_error); - } -# else - sf = symlink_sf = fs::file_status(fs::status_error); -# endif - return ok; - } - -# else // BOOST_WINDOWS_API - - error_code dir_itr_first(void *& handle, const fs::path& dir, - wstring& target, fs::file_status & sf, fs::file_status & symlink_sf) - // Note: an empty root directory has no "." or ".." entries, so this - // causes a ERROR_FILE_NOT_FOUND error which we do not considered an - // error. It is treated as eof instead. - { - // use a form of search Sebastian Martel reports will work with Win98 - wstring dirpath(dir.wstring()); - dirpath += (dirpath.empty() - || (dirpath[dirpath.size()-1] != L'\\' - && dirpath[dirpath.size()-1] != L'/' - && dirpath[dirpath.size()-1] != L':'))? L"\\*" : L"*"; - - WIN32_FIND_DATAW data; - if ((handle = ::FindFirstFileW(dirpath.c_str(), &data)) - == INVALID_HANDLE_VALUE) - { - handle = 0; - return error_code( (::GetLastError() == ERROR_FILE_NOT_FOUND - // Windows Mobile returns ERROR_NO_MORE_FILES; see ticket #3551 - || ::GetLastError() == ERROR_NO_MORE_FILES) - ? 0 : ::GetLastError(), system_category() ); - } - target = data.cFileName; - if (data.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) - // reparse points are complex, so don't try to handle them here - { sf.type(fs::status_error); symlink_sf.type(fs::status_error); } - else if (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) - { sf.type(fs::directory_file); symlink_sf.type(fs::directory_file); } - else - { sf.type(fs::regular_file); symlink_sf.type(fs::regular_file); } - return error_code(); - } - - error_code dir_itr_increment(void *& handle, wstring& target, - fs::file_status & sf, fs::file_status & symlink_sf) - { - WIN32_FIND_DATAW data; - if (::FindNextFileW(handle, &data)== 0)// fails - { - int error = ::GetLastError(); - fs::detail::dir_itr_close(handle); - return error_code(error == ERROR_NO_MORE_FILES ? 0 : error, system_category()); - } - target = data.cFileName; - if (data.dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT) - // reparse points are complex, so don't try to handle them here - { sf.type(fs::status_error); symlink_sf.type(fs::status_error); } - else if (data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) - { sf.type(fs::directory_file); symlink_sf.type(fs::directory_file); } - else - { sf.type(fs::regular_file); symlink_sf.type(fs::regular_file); } - return error_code(); - } -#endif - - const error_code not_found_error_code ( -# ifdef BOOST_WINDOWS_API - ERROR_PATH_NOT_FOUND -# else - ENOENT -# endif - , system_category()); - -} // unnamed namespace - -namespace boost -{ -namespace filesystem3 -{ - -namespace detail -{ - // dir_itr_close is called both from the ~dir_itr_imp()destructor - // and dir_itr_increment() - BOOST_FILESYSTEM_DECL - system::error_code dir_itr_close( // never throws - void *& handle -# if defined(BOOST_POSIX_API) - , void *& buffer -# endif - ) - { -# ifdef BOOST_POSIX_API - std::free(buffer); - buffer = 0; - if (handle == 0)return ok; - DIR * h(static_cast<DIR*>(handle)); - handle = 0; - return error_code(::closedir(h)== 0 ? 0 : errno, system_category()); - -# else - if (handle != 0) - { - ::FindClose(handle); - handle = 0; - } - return ok; - -# endif - } - - void directory_iterator_construct(directory_iterator& it, - const path& p, system::error_code* ec) - { - if (error(p.empty(), not_found_error_code, p, ec, - "boost::filesystem::directory_iterator::construct"))return; - - path::string_type filename; - file_status file_stat, symlink_file_stat; - error_code result = dir_itr_first(it.m_imp->handle, -# if defined(BOOST_POSIX_API) - it.m_imp->buffer, -# endif - p.c_str(), filename, file_stat, symlink_file_stat); - - if (result) - { - it.m_imp.reset(); - error(true, result, p, - ec, "boost::filesystem::directory_iterator::construct"); - return; - } - - if (it.m_imp->handle == 0)it.m_imp.reset(); // eof, so make end iterator - else // not eof - { - it.m_imp->dir_entry.assign(p / filename, - file_stat, symlink_file_stat); - if (filename[0] == dot // dot or dot-dot - && (filename.size()== 1 - || (filename[1] == dot - && filename.size()== 2))) - { it.increment(); } - } - } - - void directory_iterator_increment(directory_iterator& it, - system::error_code* ec) - { - BOOST_ASSERT(it.m_imp.get() && "attempt to increment end iterator"); - BOOST_ASSERT(it.m_imp->handle != 0 && "internal program error"); - - path::string_type filename; - file_status file_stat, symlink_file_stat; - system::error_code temp_ec; - - for (;;) - { - temp_ec = dir_itr_increment(it.m_imp->handle, -# if defined(BOOST_POSIX_API) - it.m_imp->buffer, -# endif - filename, file_stat, symlink_file_stat); - - if (temp_ec) - { - it.m_imp.reset(); - if (ec == 0) - BOOST_FILESYSTEM_THROW( - filesystem_error("boost::filesystem::directory_iterator::operator++", - it.m_imp->dir_entry.path().parent_path(), - error_code(BOOST_ERRNO, system_category()))); - ec->assign(BOOST_ERRNO, system_category()); - return; - } - else if (ec != 0) ec->clear(); - - if (it.m_imp->handle == 0) // eof, make end - { - it.m_imp.reset(); - return; - } - - if (!(filename[0] == dot // !(dot or dot-dot) - && (filename.size()== 1 - || (filename[1] == dot - && filename.size()== 2)))) - { - it.m_imp->dir_entry.replace_filename( - filename, file_stat, symlink_file_stat); - return; - } - } - } -} // namespace detail -} // namespace filesystem3 -} // namespace boost - -#endif // no wide character support diff --git a/3rdParty/Boost/src/libs/filesystem/v3/src/path.cpp b/3rdParty/Boost/src/libs/filesystem/v3/src/path.cpp deleted file mode 100644 index cc30570..0000000 --- a/3rdParty/Boost/src/libs/filesystem/v3/src/path.cpp +++ /dev/null @@ -1,793 +0,0 @@ -// filesystem path.cpp ------------------------------------------------------------- // - -// Copyright Beman Dawes 2008 - -// Distributed under the Boost Software License, Version 1.0. -// See http://www.boost.org/LICENSE_1_0.txt - -// Library home page: http://www.boost.org/libs/filesystem - -#include <boost/config.hpp> -#if !defined( BOOST_NO_STD_WSTRING ) -// Boost.Filesystem V3 and later requires std::wstring support. -// During the transition to V3, libraries are compiled with both V2 and V3 sources. -// On old compilers that don't support V3 anyhow, we just skip everything so the compile -// will succeed and the library can be built. - -// define BOOST_FILESYSTEM_SOURCE so that <boost/system/config.hpp> knows -// the library is being built (possibly exporting rather than importing code) -#define BOOST_FILESYSTEM_SOURCE - -#ifndef BOOST_SYSTEM_NO_DEPRECATED -# define BOOST_SYSTEM_NO_DEPRECATED -#endif - -#include <boost/filesystem/v3/config.hpp> -#include <boost/filesystem/v3/path.hpp> -#include <boost/scoped_array.hpp> -#include <boost/system/error_code.hpp> -#include <boost/assert.hpp> -#include <algorithm> -#include <cstddef> -#include <cstring> -#include <cassert> - -#ifdef BOOST_WINDOWS_API -# include "windows_file_codecvt.hpp" -# include <windows.h> -#elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__) -# include <boost/filesystem/detail/utf8_codecvt_facet.hpp> -#endif - -#ifdef BOOST_FILESYSTEM_DEBUG -# include <iostream> -# include <iomanip> -#endif - -namespace fs = boost::filesystem3; - -using boost::filesystem3::path; - -using std::string; -using std::wstring; - -using boost::system::error_code; - -#ifndef BOOST_FILESYSTEM_CODECVT_BUF_SIZE -# define BOOST_FILESYSTEM_CODECVT_BUF_SIZE 256 -#endif - -//--------------------------------------------------------------------------------------// -// // -// class path helpers // -// // -//--------------------------------------------------------------------------------------// - -namespace -{ - //------------------------------------------------------------------------------------// - // miscellaneous class path helpers // - //------------------------------------------------------------------------------------// - - typedef path::value_type value_type; - typedef path::string_type string_type; - typedef string_type::size_type size_type; - - const std::size_t default_codecvt_buf_size = BOOST_FILESYSTEM_CODECVT_BUF_SIZE; - -# ifdef BOOST_WINDOWS_API - - const wchar_t separator = L'/'; - const wchar_t preferred_separator = L'\\'; - const wchar_t* const separators = L"/\\"; - const wchar_t* separator_string = L"/"; - const wchar_t* preferred_separator_string = L"\\"; - const wchar_t colon = L':'; - const wchar_t dot = L'.'; - const fs::path dot_path(L"."); - const fs::path dot_dot_path(L".."); - -# else - - const char separator = '/'; - const char preferred_separator = '/'; - const char* const separators = "/"; - const char* separator_string = "/"; - const char* preferred_separator_string = "/"; - const char colon = ':'; - const char dot = '.'; - const fs::path dot_path("."); - const fs::path dot_dot_path(".."); - -# endif - - inline bool is_separator(fs::path::value_type c) - { - return c == separator -# ifdef BOOST_WINDOWS_API - || c == preferred_separator -# endif - ; - } - - bool is_non_root_separator(const string_type& str, size_type pos); - // pos is position of the separator - - size_type filename_pos(const string_type& str, - size_type end_pos); // end_pos is past-the-end position - // Returns: 0 if str itself is filename (or empty) - - size_type root_directory_start(const string_type& path, size_type size); - // Returns: npos if no root_directory found - - void first_element( - const string_type& src, - size_type& element_pos, - size_type& element_size, -# if !BOOST_WORKAROUND(BOOST_MSVC, <= 1310) // VC++ 7.1 - size_type size = string_type::npos -# else - size_type size = -1 -# endif - ); - -} // unnamed namespace - -//--------------------------------------------------------------------------------------// -// // -// class path implementation // -// // -//--------------------------------------------------------------------------------------// - -namespace boost -{ -namespace filesystem3 -{ - - path & path::operator/=(const path & p) - { - if (p.empty()) - return *this; - if (!is_separator(*p.m_pathname.begin())) - m_append_separator_if_needed(); - m_pathname += p.m_pathname; - return *this; - } - -# ifdef BOOST_WINDOWS_API - - const std::string path::generic_string(const codecvt_type& cvt) const - { - path tmp(*this); - tmp.make_preferred(); - return tmp.string(cvt); - } - - const std::wstring path::generic_wstring() const - { - path tmp(*this); - tmp.make_preferred(); - return tmp.wstring(); - } - -# endif // BOOST_WINDOWS_API - - // m_append_separator_if_needed ----------------------------------------------------// - - path::string_type::size_type path::m_append_separator_if_needed() - { - if (!m_pathname.empty() && -# ifdef BOOST_WINDOWS_API - *(m_pathname.end()-1) != colon && -# endif - !is_separator(*(m_pathname.end()-1))) - { - string_type::size_type tmp(m_pathname.size()); - m_pathname += preferred_separator; - return tmp; - } - return 0; - } - - // m_erase_redundant_separator -----------------------------------------------------// - - void path::m_erase_redundant_separator(string_type::size_type sep_pos) - { - if (sep_pos // a separator was added - && sep_pos < m_pathname.size() // and something was appended - && (m_pathname[sep_pos+1] == separator // and it was also separator -# ifdef BOOST_WINDOWS_API - || m_pathname[sep_pos+1] == preferred_separator // or preferred_separator -# endif -)) { m_pathname.erase(sep_pos, 1); } // erase the added separator - } - - // modifiers -----------------------------------------------------------------------// - -# ifdef BOOST_WINDOWS_API - path & path::make_preferred() - { - std::replace(m_pathname.begin(), m_pathname.end(), L'\\', L'/'); - return *this; - } -# endif - - path& path::remove_filename() - { - m_pathname.erase(m_parent_path_end()); - return *this; - } - - path & path::replace_extension(const path & source) - { - // erase existing extension if any - size_type pos(m_pathname.rfind(dot)); - if (pos != string_type::npos && pos >= filename_pos(m_pathname, m_pathname.size())) - m_pathname.erase(pos); - - // append source extension if any - pos = source.m_pathname.rfind(dot); - if (pos != string_type::npos) - m_pathname += source.c_str() + pos; - - return *this; - } - - // decomposition -------------------------------------------------------------------// - - path path::root_path() const - { - path temp(root_name()); - if (!root_directory().empty()) temp.m_pathname += root_directory().c_str(); - return temp; - } - - path path::root_name() const - { - iterator itr(begin()); - - return (itr.m_pos != m_pathname.size() - && ( - (itr.m_element.m_pathname.size() > 1 - && is_separator(itr.m_element.m_pathname[0]) - && is_separator(itr.m_element.m_pathname[1]) - ) -# ifdef BOOST_WINDOWS_API - || itr.m_element.m_pathname[itr.m_element.m_pathname.size()-1] == colon -# endif - )) - ? itr.m_element - : path(); - } - - path path::root_directory() const - { - size_type pos(root_directory_start(m_pathname, m_pathname.size())); - - return pos == string_type::npos - ? path() - : path(m_pathname.c_str() + pos, m_pathname.c_str() + pos + 1); - } - - path path::relative_path() const - { - iterator itr(begin()); - - for (; itr.m_pos != m_pathname.size() - && (is_separator(itr.m_element.m_pathname[0]) -# ifdef BOOST_WINDOWS_API - || itr.m_element.m_pathname[itr.m_element.m_pathname.size()-1] == colon -# endif - ); ++itr) {} - - return path(m_pathname.c_str() + itr.m_pos); - } - - string_type::size_type path::m_parent_path_end() const - { - size_type end_pos(filename_pos(m_pathname, m_pathname.size())); - - bool filename_was_separator(m_pathname.size() - && is_separator(m_pathname[end_pos])); - - // skip separators unless root directory - size_type root_dir_pos(root_directory_start(m_pathname, end_pos)); - for (; - end_pos > 0 - && (end_pos-1) != root_dir_pos - && is_separator(m_pathname[end_pos-1]) - ; - --end_pos) {} - - return (end_pos == 1 && root_dir_pos == 0 && filename_was_separator) - ? string_type::npos - : end_pos; - } - - path path::parent_path() const - { - size_type end_pos(m_parent_path_end()); - return end_pos == string_type::npos - ? path() - : path(m_pathname.c_str(), m_pathname.c_str() + end_pos); - } - - path path::filename() const - { - size_type pos(filename_pos(m_pathname, m_pathname.size())); - return (m_pathname.size() - && pos - && is_separator(m_pathname[pos]) - && is_non_root_separator(m_pathname, pos)) - ? dot_path - : path(m_pathname.c_str() + pos); - } - - path path::stem() const - { - path name(filename()); - if (name == dot_path || name == dot_dot_path) return name; - size_type pos(name.m_pathname.rfind(dot)); - return pos == string_type::npos - ? name - : path(name.m_pathname.c_str(), name.m_pathname.c_str() + pos); - } - - path path::extension() const - { - path name(filename()); - if (name == dot_path || name == dot_dot_path) return path(); - size_type pos(name.m_pathname.rfind(dot)); - return pos == string_type::npos - ? path() - : path(name.m_pathname.c_str() + pos); - } - - // m_normalize ----------------------------------------------------------------------// - - path& path::m_normalize() - { - if (m_pathname.empty()) return *this; - - path temp; - iterator start(begin()); - iterator last(end()); - iterator stop(last--); - for (iterator itr(start); itr != stop; ++itr) - { - // ignore "." except at start and last - if (itr->native().size() == 1 - && (itr->native())[0] == dot - && itr != start - && itr != last) continue; - - // ignore a name and following ".." - if (!temp.empty() - && itr->native().size() == 2 - && (itr->native())[0] == dot - && (itr->native())[1] == dot) // dot dot - { - string_type lf(temp.filename().native()); - if (lf.size() > 0 - && (lf.size() != 1 - || (lf[0] != dot - && lf[0] != separator)) - && (lf.size() != 2 - || (lf[0] != dot - && lf[1] != dot -# ifdef BOOST_WINDOWS_API - && lf[1] != colon -# endif - ) - ) - ) - { - temp.remove_filename(); - // if not root directory, must also remove "/" if any - if (temp.m_pathname.size() > 0 - && temp.m_pathname[temp.m_pathname.size()-1] - == separator) - { - string_type::size_type rds( - root_directory_start(temp.m_pathname, temp.m_pathname.size())); - if (rds == string_type::npos - || rds != temp.m_pathname.size()-1) - { temp.m_pathname.erase(temp.m_pathname.size()-1); } - } - - iterator next(itr); - if (temp.empty() && ++next != stop - && next == last && *last == dot_path) temp /= dot_path; - continue; - } - } - - temp /= *itr; - }; - - if (temp.empty()) temp /= dot_path; - m_pathname = temp.m_pathname; - return *this; - } - -} // namespace filesystem3 -} // namespace boost - -//--------------------------------------------------------------------------------------// -// // -// class path helpers implementation // -// // -//--------------------------------------------------------------------------------------// - -namespace -{ - - // is_non_root_separator -------------------------------------------------// - - bool is_non_root_separator(const string_type & str, size_type pos) - // pos is position of the separator - { - BOOST_ASSERT(!str.empty() && is_separator(str[pos]) - && "precondition violation"); - - // subsequent logic expects pos to be for leftmost slash of a set - while (pos > 0 && is_separator(str[pos-1])) - --pos; - - return pos != 0 - && (pos <= 2 || !is_separator(str[1]) - || str.find_first_of(separators, 2) != pos) -# ifdef BOOST_WINDOWS_API - && (pos !=2 || str[1] != colon) -# endif - ; - } - - // filename_pos --------------------------------------------------------------------// - - size_type filename_pos(const string_type & str, - size_type end_pos) // end_pos is past-the-end position - // return 0 if str itself is filename (or empty) - { - // case: "//" - if (end_pos == 2 - && is_separator(str[0]) - && is_separator(str[1])) return 0; - - // case: ends in "/" - if (end_pos && is_separator(str[end_pos-1])) - return end_pos-1; - - // set pos to start of last element - size_type pos(str.find_last_of(separators, end_pos-1)); - -# ifdef BOOST_WINDOWS_API - if (pos == string_type::npos) - pos = str.find_last_of(colon, end_pos-2); -# endif - - return (pos == string_type::npos // path itself must be a filename (or empty) - || (pos == 1 && is_separator(str[0]))) // or net - ? 0 // so filename is entire string - : pos + 1; // or starts after delimiter - } - - // root_directory_start ------------------------------------------------------------// - - size_type root_directory_start(const string_type & path, size_type size) - // return npos if no root_directory found - { - -# ifdef BOOST_WINDOWS_API - // case "c:/" - if (size > 2 - && path[1] == colon - && is_separator(path[2])) return 2; -# endif - - // case "//" - if (size == 2 - && is_separator(path[0]) - && is_separator(path[1])) return string_type::npos; - - // case "//net {/}" - if (size > 3 - && is_separator(path[0]) - && is_separator(path[1]) - && !is_separator(path[2])) - { - string_type::size_type pos(path.find_first_of(separators, 2)); - return pos < size ? pos : string_type::npos; - } - - // case "/" - if (size > 0 && is_separator(path[0])) return 0; - - return string_type::npos; - } - - // first_element --------------------------------------------------------------------// - // sets pos and len of first element, excluding extra separators - // if src.empty(), sets pos,len, to 0,0. - - void first_element( - const string_type & src, - size_type & element_pos, - size_type & element_size, - size_type size -) - { - if (size == string_type::npos) size = src.size(); - element_pos = 0; - element_size = 0; - if (src.empty()) return; - - string_type::size_type cur(0); - - // deal with // [network] - if (size >= 2 && is_separator(src[0]) - && is_separator(src[1]) - && (size == 2 - || !is_separator(src[2]))) - { - cur += 2; - element_size += 2; - } - - // leading (not non-network) separator - else if (is_separator(src[0])) - { - ++element_size; - // bypass extra leading separators - while (cur+1 < size - && is_separator(src[cur+1])) - { - ++cur; - ++element_pos; - } - return; - } - - // at this point, we have either a plain name, a network name, - // or (on Windows only) a device name - - // find the end - while (cur < size -# ifdef BOOST_WINDOWS_API - && src[cur] != colon -# endif - && !is_separator(src[cur])) - { - ++cur; - ++element_size; - } - -# ifdef BOOST_WINDOWS_API - if (cur == size) return; - // include device delimiter - if (src[cur] == colon) - { ++element_size; } -# endif - - return; - } - -} // unnammed namespace - -//--------------------------------------------------------------------------------------// -// // -// class path::iterator implementation // -// // -//--------------------------------------------------------------------------------------// - -namespace boost -{ -namespace filesystem3 -{ - - path::iterator path::begin() const - { - iterator itr; - itr.m_path_ptr = this; - size_type element_size; - first_element(m_pathname, itr.m_pos, element_size); - itr.m_element = m_pathname.substr(itr.m_pos, element_size); - if (itr.m_element.m_pathname == preferred_separator_string) - itr.m_element.m_pathname = separator_string; // needed for Windows, harmless on POSIX - return itr; - } - - path::iterator path::end() const - { - iterator itr; - itr.m_path_ptr = this; - itr.m_pos = m_pathname.size(); - return itr; - } - - void path::m_path_iterator_increment(path::iterator & it) - { - BOOST_ASSERT(it.m_pos < it.m_path_ptr->m_pathname.size() && "path::basic_iterator increment past end()"); - - // increment to position past current element - it.m_pos += it.m_element.m_pathname.size(); - - // if end reached, create end basic_iterator - if (it.m_pos == it.m_path_ptr->m_pathname.size()) - { - it.m_element.clear(); - return; - } - - // both POSIX and Windows treat paths that begin with exactly two separators specially - bool was_net(it.m_element.m_pathname.size() > 2 - && is_separator(it.m_element.m_pathname[0]) - && is_separator(it.m_element.m_pathname[1]) - && !is_separator(it.m_element.m_pathname[2])); - - // process separator (Windows drive spec is only case not a separator) - if (is_separator(it.m_path_ptr->m_pathname[it.m_pos])) - { - // detect root directory - if (was_net -# ifdef BOOST_WINDOWS_API - // case "c:/" - || it.m_element.m_pathname[it.m_element.m_pathname.size()-1] == colon -# endif - ) - { - it.m_element.m_pathname = separator; - return; - } - - // bypass separators - while (it.m_pos != it.m_path_ptr->m_pathname.size() - && is_separator(it.m_path_ptr->m_pathname[it.m_pos])) - { ++it.m_pos; } - - // detect trailing separator, and treat it as ".", per POSIX spec - if (it.m_pos == it.m_path_ptr->m_pathname.size() - && is_non_root_separator(it.m_path_ptr->m_pathname, it.m_pos-1)) - { - --it.m_pos; - it.m_element = dot_path; - return; - } - } - - // get next element - size_type end_pos(it.m_path_ptr->m_pathname.find_first_of(separators, it.m_pos)); - if (end_pos == string_type::npos) end_pos = it.m_path_ptr->m_pathname.size(); - it.m_element = it.m_path_ptr->m_pathname.substr(it.m_pos, end_pos - it.m_pos); - } - - void path::m_path_iterator_decrement(path::iterator & it) - { - BOOST_ASSERT(it.m_pos && "path::iterator decrement past begin()"); - - size_type end_pos(it.m_pos); - - // if at end and there was a trailing non-root '/', return "." - if (it.m_pos == it.m_path_ptr->m_pathname.size() - && it.m_path_ptr->m_pathname.size() > 1 - && is_separator(it.m_path_ptr->m_pathname[it.m_pos-1]) - && is_non_root_separator(it.m_path_ptr->m_pathname, it.m_pos-1) - ) - { - --it.m_pos; - it.m_element = dot_path; - return; - } - - size_type root_dir_pos(root_directory_start(it.m_path_ptr->m_pathname, end_pos)); - - // skip separators unless root directory - for ( - ; - end_pos > 0 - && (end_pos-1) != root_dir_pos - && is_separator(it.m_path_ptr->m_pathname[end_pos-1]) - ; - --end_pos) {} - - it.m_pos = filename_pos(it.m_path_ptr->m_pathname, end_pos); - it.m_element = it.m_path_ptr->m_pathname.substr(it.m_pos, end_pos - it.m_pos); - if (it.m_element.m_pathname == preferred_separator_string) - it.m_element.m_pathname = separator_string; // needed for Windows, harmless on POSIX - } - -} // namespace filesystem3 -} // namespace boost - -//--------------------------------------------------------------------------------------// -// // -// detail helpers // -// // -//--------------------------------------------------------------------------------------// - -namespace -{ - - //------------------------------------------------------------------------------------// - // locale helpers // - //------------------------------------------------------------------------------------// - - // std::locale construction can throw (if LC_MESSAGES is wrong, for example), - // so a static at function scope is used to ensure that exceptions can be - // caught. (A previous version was at namespace scope, so initialization - // occurred before main(), preventing exceptions from being caught.) - - std::locale default_locale() - { -# ifdef BOOST_WINDOWS_API - std::locale global_loc = std::locale(); - std::locale loc(global_loc, new windows_file_codecvt); - return loc; - -# elif defined(macintosh) || defined(__APPLE__) || defined(__APPLE_CC__) - // "All BSD system functions expect their string parameters to be in UTF-8 encoding - // and nothing else." http://developer.apple.com/mac/library/documentation/MacOSX/Conceptual/BPInternational/Articles/FileEncodings.html - // - // "The kernel will reject any filename that is not a valid UTF-8 string, and it will - // even be normalized (to Unicode NFD) before stored on disk, at least when using HFS. - // The right way to deal with it would be to always convert the filename to UTF-8 - // before trying to open/create a file." http://lists.apple.com/archives/unix-porting/2007/Sep/msg00023.html - // - // "How a file name looks at the API level depends on the API. Current Carbon APIs - // handle file names as an array of UTF-16 characters; POSIX ones handle them as an - // array of UTF-8, which is why UTF-8 works well in Terminal. How it's stored on disk - // depends on the disk format; HFS+ uses UTF-16, but that's not important in most - // cases." http://lists.apple.com/archives/applescript-users/2002/Sep/msg00319.html - // - // Many thanks to Peter Dimov for digging out the above references! - std::locale global_loc = std::locale(); - std::locale loc(global_loc, new boost::filesystem::detail::utf8_codecvt_facet); - return loc; - -# else - // ISO C calls this "the locale-specific native environment": - return std::locale(""); - -# endif - } - - std::locale & path_locale() - { - static std::locale loc(default_locale()); - return loc; - } - -} // unnamed namespace - -//--------------------------------------------------------------------------------------// -// path::imbue implementation // -//--------------------------------------------------------------------------------------// - -namespace boost -{ -namespace filesystem3 -{ - - const path::codecvt_type *& - path::wchar_t_codecvt_facet() - { - static const std::codecvt<wchar_t, char, std::mbstate_t> * - facet( - &std::use_facet<std::codecvt<wchar_t, char, std::mbstate_t> > - (path_locale())); - return facet; - } - - std::locale path::imbue(const std::locale & loc) - { - std::locale temp(path_locale()); - path_locale() = loc; - wchar_t_codecvt_facet() = &std::use_facet - <std::codecvt<wchar_t, char, std::mbstate_t> >(path_locale()); - return temp; - } - -} // namespace filesystem3 -} // namespace boost - -#endif // no wide character support diff --git a/3rdParty/Boost/src/libs/filesystem/v3/src/path_traits.cpp b/3rdParty/Boost/src/libs/filesystem/v3/src/path_traits.cpp deleted file mode 100644 index 6606437..0000000 --- a/3rdParty/Boost/src/libs/filesystem/v3/src/path_traits.cpp +++ /dev/null @@ -1,209 +0,0 @@ -// filesystem path_traits.cpp --------------------------------------------------------// - -// Copyright Beman Dawes 2008, 2009 - -// Distributed under the Boost Software License, Version 1.0. -// See http://www.boost.org/LICENSE_1_0.txt - -// Library home page: http://www.boost.org/libs/filesystem - -//--------------------------------------------------------------------------------------// - -#include <boost/config.hpp> -#if !defined( BOOST_NO_STD_WSTRING ) -// Boost.Filesystem V3 and later requires std::wstring support. -// During the transition to V3, libraries are compiled with both V2 and V3 sources. -// On old compilers that don't support V3 anyhow, we just skip everything so the compile -// will succeed and the library can be built. - -// define BOOST_FILESYSTEM_SOURCE so that <boost/system/config.hpp> knows -// the library is being built (possibly exporting rather than importing code) -#define BOOST_FILESYSTEM_SOURCE - -#ifndef BOOST_SYSTEM_NO_DEPRECATED -# define BOOST_SYSTEM_NO_DEPRECATED -#endif - -#include <boost/filesystem/v3/config.hpp> -#include <boost/filesystem/v3/path_traits.hpp> -#include <boost/system/system_error.hpp> -#include <boost/scoped_array.hpp> -#include <locale> // for codecvt_base::result -#include <cstring> // for strlen -#include <cwchar> // for wcslen - -namespace pt = boost::filesystem3::path_traits; -namespace fs = boost::filesystem3; -namespace bs = boost::system; - -//--------------------------------------------------------------------------------------// -// configuration // -//--------------------------------------------------------------------------------------// - -#ifndef BOOST_FILESYSTEM_CODECVT_BUF_SIZE -# define BOOST_FILESYSTEM_CODECVT_BUF_SIZE 256 -#endif - -namespace { - - const std::size_t default_codecvt_buf_size = BOOST_FILESYSTEM_CODECVT_BUF_SIZE; - - -//--------------------------------------------------------------------------------------// -// // -// The public convert() functions do buffer management, and then forward to the // -// convert_aux() functions for the actual call to the codecvt facet. // -// // -//--------------------------------------------------------------------------------------// - -//--------------------------------------------------------------------------------------// -// convert_aux const char* to wstring // -//--------------------------------------------------------------------------------------// - - void convert_aux( - const char* from, - const char* from_end, - wchar_t* to, wchar_t* to_end, - std::wstring & target, - const pt::codecvt_type & cvt) - { - //std::cout << std::hex - // << " from=" << std::size_t(from) - // << " from_end=" << std::size_t(from_end) - // << " to=" << std::size_t(to) - // << " to_end=" << std::size_t(to_end) - // << std::endl; - - std::mbstate_t state = std::mbstate_t(); // perhaps unneeded, but cuts bug reports - const char* from_next; - wchar_t* to_next; - - std::codecvt_base::result res; - - if ((res=cvt.in(state, from, from_end, from_next, - to, to_end, to_next)) != std::codecvt_base::ok) - { - //std::cout << " result is " << static_cast<int>(res) << std::endl; - BOOST_FILESYSTEM_THROW(bs::system_error(res, fs::codecvt_error_category(), - "boost::filesystem::path codecvt to wstring")); - } - target.append(to, to_next); - } - -//--------------------------------------------------------------------------------------// -// convert_aux const wchar_t* to string // -//--------------------------------------------------------------------------------------// - - void convert_aux( - const wchar_t* from, - const wchar_t* from_end, - char* to, char* to_end, - std::string & target, - const pt::codecvt_type & cvt) - { - //std::cout << std::hex - // << " from=" << std::size_t(from) - // << " from_end=" << std::size_t(from_end) - // << " to=" << std::size_t(to) - // << " to_end=" << std::size_t(to_end) - // << std::endl; - - std::mbstate_t state = std::mbstate_t(); // perhaps unneeded, but cuts bug reports - const wchar_t* from_next; - char* to_next; - - std::codecvt_base::result res; - - if ((res=cvt.out(state, from, from_end, from_next, - to, to_end, to_next)) != std::codecvt_base::ok) - { - //std::cout << " result is " << static_cast<int>(res) << std::endl; - BOOST_FILESYSTEM_THROW(bs::system_error(res, fs::codecvt_error_category(), - "boost::filesystem::path codecvt to string")); - } - target.append(to, to_next); - } - -} // unnamed namespace - -//--------------------------------------------------------------------------------------// -// path_traits // -//--------------------------------------------------------------------------------------// - -namespace boost { namespace filesystem3 { namespace path_traits { - -//--------------------------------------------------------------------------------------// -// convert const char* to wstring // -//--------------------------------------------------------------------------------------// - - BOOST_FILESYSTEM_DECL - void convert(const char* from, - const char* from_end, // 0 for null terminated MBCS - std::wstring & to, - const codecvt_type & cvt) - { - BOOST_ASSERT(from); - - if (!from_end) // null terminated - { - from_end = from + std::strlen(from); - } - - if (from == from_end) return; - - std::size_t buf_size = (from_end - from) * 3; // perhaps too large, but that's OK - - // dynamically allocate a buffer only if source is unusually large - if (buf_size > default_codecvt_buf_size) - { - boost::scoped_array< wchar_t > buf(new wchar_t [buf_size]); - convert_aux(from, from_end, buf.get(), buf.get()+buf_size, to, cvt); - } - else - { - wchar_t buf[default_codecvt_buf_size]; - convert_aux(from, from_end, buf, buf+default_codecvt_buf_size, to, cvt); - } - } - -//--------------------------------------------------------------------------------------// -// convert const wchar_t* to string // -//--------------------------------------------------------------------------------------// - - BOOST_FILESYSTEM_DECL - void convert(const wchar_t* from, - const wchar_t* from_end, // 0 for null terminated MBCS - std::string & to, - const codecvt_type & cvt) - { - BOOST_ASSERT(from); - - if (!from_end) // null terminated - { - from_end = from + std::wcslen(from); - } - - if (from == from_end) return; - - // The codecvt length functions may not be implemented, and I don't really - // understand them either. Thus this code is just a guess; if it turns - // out the buffer is too small then an error will be reported and the code - // will have to be fixed. - std::size_t buf_size = (from_end - from) * 4; // perhaps too large, but that's OK - buf_size += 4; // encodings like shift-JIS need some prefix space - - // dynamically allocate a buffer only if source is unusually large - if (buf_size > default_codecvt_buf_size) - { - boost::scoped_array< char > buf(new char [buf_size]); - convert_aux(from, from_end, buf.get(), buf.get()+buf_size, to, cvt); - } - else - { - char buf[default_codecvt_buf_size]; - convert_aux(from, from_end, buf, buf+default_codecvt_buf_size, to, cvt); - } - } -}}} // namespace boost::filesystem3::path_traits - -#endif // no wide character support diff --git a/3rdParty/Boost/src/libs/filesystem/v3/src/portability.cpp b/3rdParty/Boost/src/libs/filesystem/v3/src/portability.cpp deleted file mode 100644 index 31e0176..0000000 --- a/3rdParty/Boost/src/libs/filesystem/v3/src/portability.cpp +++ /dev/null @@ -1,128 +0,0 @@ -// portability.cpp -------------------------------------------------------------------// - -// Copyright 2002-2005 Beman Dawes -// 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 library home page at http://www.boost.org/libs/filesystem - -//--------------------------------------------------------------------------------------// - -#include <boost/config.hpp> -#if !defined( BOOST_NO_STD_WSTRING ) -// Boost.Filesystem V3 and later requires std::wstring support. -// During the transition to V3, libraries are compiled with both V2 and V3 sources. -// On old compilers that don't support V3 anyhow, we just skip everything so the compile -// will succeed and the library can be built. - -// define BOOST_FILESYSTEM_SOURCE so that <boost/filesystem/config.hpp> knows -// the library is being built (possibly exporting rather than importing code) -#define BOOST_FILESYSTEM_SOURCE - -#ifndef BOOST_SYSTEM_NO_DEPRECATED -# define BOOST_SYSTEM_NO_DEPRECATED -#endif - -#include <boost/filesystem/v3/config.hpp> -#include <boost/filesystem/v3/path.hpp> - -namespace fs = boost::filesystem3; - -#include <cstring> // SGI MIPSpro compilers need this - -# ifdef BOOST_NO_STDC_NAMESPACE - namespace std { using ::strerror; } -# endif - -//--------------------------------------------------------------------------------------// - -namespace -{ - const char invalid_chars[] = - "\x01\x02\x03\x04\x05\x06\x07\x08\x09\x0A\x0B\x0C\x0D\x0E\x0F" - "\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1A\x1B\x1C\x1D\x1E\x1F" - "<>:\"/\\|"; - // note that the terminating '\0' is part of the string - thus the size below - // is sizeof(invalid_chars) rather than sizeof(invalid_chars)-1. I - const std::string windows_invalid_chars(invalid_chars, sizeof(invalid_chars)); - - const std::string valid_posix( - "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789._-"); - -} // unnamed namespace - -namespace boost -{ - namespace filesystem3 - { - - // name_check functions ----------------------------------------------// - -# ifdef BOOST_WINDOWS - BOOST_FILESYSTEM_DECL bool native(const std::string & name) - { - return windows_name(name); - } -# else - BOOST_FILESYSTEM_DECL bool native(const std::string & name) - { - return name.size() != 0 - && name[0] != ' ' - && name.find('/') == std::string::npos; - } -# endif - - BOOST_FILESYSTEM_DECL bool portable_posix_name(const std::string & name) - { - return name.size() != 0 - && name.find_first_not_of(valid_posix) == std::string::npos; - } - - BOOST_FILESYSTEM_DECL bool windows_name(const std::string & name) - { - return name.size() != 0 - && name[0] != ' ' - && name.find_first_of(windows_invalid_chars) == std::string::npos - && *(name.end()-1) != ' ' - && (*(name.end()-1) != '.' - || name.length() == 1 || name == ".."); - } - - BOOST_FILESYSTEM_DECL bool portable_name(const std::string & name) - { - return - name.size() != 0 - && (name == "." - || name == ".." - || (windows_name(name) - && portable_posix_name(name) - && name[0] != '.' && name[0] != '-')); - } - - BOOST_FILESYSTEM_DECL bool portable_directory_name(const std::string & name) - { - return - name == "." - || name == ".." - || (portable_name(name) - && name.find('.') == std::string::npos); - } - - BOOST_FILESYSTEM_DECL bool portable_file_name(const std::string & name) - { - std::string::size_type pos; - return - portable_name(name) - && name != "." - && name != ".." - && ((pos = name.find('.')) == std::string::npos - || (name.find('.', pos+1) == std::string::npos - && (pos + 5) > name.length())) - ; - } - - } // namespace filesystem3 -} // namespace boost - -#endif // no wide character support diff --git a/3rdParty/Boost/src/libs/filesystem/v3/src/unique_path.cpp b/3rdParty/Boost/src/libs/filesystem/v3/src/unique_path.cpp deleted file mode 100644 index 1569b32..0000000 --- a/3rdParty/Boost/src/libs/filesystem/v3/src/unique_path.cpp +++ /dev/null @@ -1,151 +0,0 @@ -// filesystem system_crypt_random.cpp ------------------------------------------------// - -// Copyright Beman Dawes 2010 - -// Distributed under the Boost Software License, Version 1.0. -// See http://www.boost.org/LICENSE_1_0.txt - -// Library home page: http://www.boost.org/libs/filesystem - -//--------------------------------------------------------------------------------------// - -#include <boost/config.hpp> -#if !defined( BOOST_NO_STD_WSTRING ) -// Boost.Filesystem V3 and later requires std::wstring support. -// During the transition to V3, libraries are compiled with both V2 and V3 sources. -// On old compilers that don't support V3 anyhow, we just skip everything so the compile -// will succeed and the library can be built. - -// define BOOST_FILESYSTEM_SOURCE so that <boost/filesystem/config.hpp> knows -// the library is being built (possibly exporting rather than importing code) -#define BOOST_FILESYSTEM_SOURCE - -#ifndef BOOST_SYSTEM_NO_DEPRECATED -# define BOOST_SYSTEM_NO_DEPRECATED -#endif - -#include <boost/filesystem/v3/operations.hpp> - -# ifdef BOOST_POSIX_API -# include <fcntl.h> -# else // BOOST_WINDOWS_API -# include <windows.h> -# include <wincrypt.h> -# pragma comment(lib, "Advapi32.lib") -# endif - -namespace { - -void fail(int err, boost::system::error_code* ec) -{ - if (ec == 0) - BOOST_FILESYSTEM_THROW( boost::system::system_error(err, - boost::system::system_category(), - "boost::filesystem::unique_path")); - - ec->assign(err, boost::system::system_category()); - return; -} - -void system_crypt_random(void* buf, std::size_t len, boost::system::error_code* ec) -{ -# ifdef BOOST_POSIX_API - - int file = open("/dev/urandom", O_RDONLY); - if (file == -1) - { - file = open("/dev/random", O_RDONLY); - if (file == -1) - { - fail(errno, ec); - return; - } - } - - size_t bytes_read = 0; - while (bytes_read < len) - { - ssize_t n = read(file, buf, len - bytes_read); - if (n == -1) - { - close(file); - fail(errno, ec); - return; - } - bytes_read += n; - buf = static_cast<char*>(buf) + n; - } - - close(file); - -# else // BOOST_WINDOWS_API - - HCRYPTPROV handle; - int errval = 0; - - if (!::CryptAcquireContextW(&handle, 0, 0, PROV_RSA_FULL, 0)) - { - errval = ::GetLastError(); - if (errval == NTE_BAD_KEYSET) - { - if (!::CryptAcquireContextW(&handle, 0, 0, PROV_RSA_FULL, CRYPT_NEWKEYSET)) - { - errval = ::GetLastError(); - } - else errval = 0; - } - } - - if (!errval) - { - BOOL gen_ok = ::CryptGenRandom(handle, len, static_cast<unsigned char*>(buf)); - if (!gen_ok) - errval = ::GetLastError(); - ::CryptReleaseContext(handle, 0); - } - - if (!errval) return; - - fail(errval, ec); -# endif -} - -} // unnamed namespace - -namespace boost { namespace filesystem3 { namespace detail { - -BOOST_FILESYSTEM_DECL -path unique_path(const path& model, system::error_code* ec) -{ - std::wstring s (model.wstring()); // std::string ng for MBCS encoded POSIX - const wchar_t hex[] = L"0123456789abcdef"; - const int n_ran = 16; - const int max_nibbles = 2 * n_ran; // 4-bits per nibble - char ran[n_ran]; - - int nibbles_used = max_nibbles; - for(std::wstring::size_type i=0; i < s.size(); ++i) - { - if (s[i] == L'%') // digit request - { - if (nibbles_used == max_nibbles) - { - system_crypt_random(ran, sizeof(ran), ec); - if (ec != 0 && *ec) - return ""; - nibbles_used = 0; - } - int c = ran[nibbles_used/2]; - c >>= 4 * (nibbles_used++ & 1); // if odd, shift right 1 nibble - s[i] = hex[c & 0xf]; // convert to hex digit and replace - } - } - - if (ec != 0) ec->clear(); - - return s; -} - -}}} - -#endif // no wide character support diff --git a/3rdParty/Boost/src/libs/filesystem/v3/src/windows_file_codecvt.cpp b/3rdParty/Boost/src/libs/filesystem/v3/src/windows_file_codecvt.cpp deleted file mode 100644 index ae9f9f2..0000000 --- a/3rdParty/Boost/src/libs/filesystem/v3/src/windows_file_codecvt.cpp +++ /dev/null @@ -1,83 +0,0 @@ -// filesystem windows_file_codecvt.cpp -----------------------------------------// - -// Copyright Beman Dawes 2009 - -// Distributed under the Boost Software License, Version 1.0. -// See http://www.boost.org/LICENSE_1_0.txt - -// Library home page: http://www.boost.org/libs/filesystem - -//--------------------------------------------------------------------------------------// - -#include <boost/config.hpp> -#if !defined( BOOST_NO_STD_WSTRING ) -// Boost.Filesystem V3 and later requires std::wstring support. -// During the transition to V3, libraries are compiled with both V2 and V3 sources. -// On old compilers that don't support V3 anyhow, we just skip everything so the compile -// will succeed and the library can be built. - -// define BOOST_FILESYSTEM_SOURCE so that <boost/system/config.hpp> knows -// the library is being built (possibly exporting rather than importing code) -#define BOOST_FILESYSTEM_SOURCE - -#ifndef BOOST_SYSTEM_NO_DEPRECATED -# define BOOST_SYSTEM_NO_DEPRECATED -#endif - -#include <boost/filesystem/v3/config.hpp> -#include <cwchar> // for mbstate_t - -#ifdef BOOST_WINDOWS_API - -#include "windows_file_codecvt.hpp" - -// Versions of MinGW prior to GCC 4.6 requires this -#ifndef WINVER -# define WINVER 0x0500 -#endif - -#include <windows.h> - - std::codecvt_base::result windows_file_codecvt::do_in( - std::mbstate_t &, - const char* from, const char* from_end, const char*& from_next, - wchar_t* to, wchar_t* to_end, wchar_t*& to_next) const - { - UINT codepage = AreFileApisANSI() ? CP_THREAD_ACP : CP_OEMCP; - - int count; - if ((count = ::MultiByteToWideChar(codepage, MB_PRECOMPOSED, from, - from_end - from, to, to_end - to)) == 0) - { - return error; // conversion failed - } - - from_next = from_end; - to_next = to + count; - *to_next = L'\0'; - return ok; - } - - std::codecvt_base::result windows_file_codecvt::do_out( - std::mbstate_t &, - const wchar_t* from, const wchar_t* from_end, const wchar_t* & from_next, - char* to, char* to_end, char* & to_next) const - { - UINT codepage = AreFileApisANSI() ? CP_THREAD_ACP : CP_OEMCP; - - int count; - if ((count = ::WideCharToMultiByte(codepage, WC_NO_BEST_FIT_CHARS, from, - from_end - from, to, to_end - to, 0, 0)) == 0) - { - return error; // conversion failed - } - - from_next = from_end; - to_next = to + count; - *to_next = '\0'; - return ok; - } - - # endif // BOOST_WINDOWS_API - -#endif // no wide character support diff --git a/3rdParty/Boost/src/libs/filesystem/v3/src/windows_file_codecvt.hpp b/3rdParty/Boost/src/libs/filesystem/v3/src/windows_file_codecvt.hpp deleted file mode 100644 index d845d37..0000000 --- a/3rdParty/Boost/src/libs/filesystem/v3/src/windows_file_codecvt.hpp +++ /dev/null @@ -1,56 +0,0 @@ -// filesystem windows_file_codecvt.hpp -----------------------------------------------// - -// Copyright Beman Dawes 2009 - -// Distributed under the Boost Software License, Version 1.0. -// See http://www.boost.org/LICENSE_1_0.txt - -// Library home page: http://www.boost.org/libs/filesystem - -#ifndef BOOST_FILESYSTEM3_WIN_FILE_CODECVT_HPP -#define BOOST_FILESYSTEM3_WIN_FILE_CODECVT_HPP - -#include <boost/filesystem/v3/config.hpp> -#include <locale> - - //------------------------------------------------------------------------------------// - // // - // class windows_file_codecvt // - // // - // Warning: partial implementation; even do_in and do_out only partially meet the // - // standard library specifications as the "to" buffer must hold the entire result. // - // // - //------------------------------------------------------------------------------------// - - class BOOST_FILESYSTEM_DECL windows_file_codecvt - : public std::codecvt< wchar_t, char, std::mbstate_t > - { - public: - explicit windows_file_codecvt() - : std::codecvt<wchar_t, char, std::mbstate_t>() {} - protected: - - virtual bool do_always_noconv() const throw() { return false; } - - // seems safest to assume variable number of characters since we don't - // actually know what codepage is active - virtual int do_encoding() const throw() { return 0; } - - virtual std::codecvt_base::result do_in(std::mbstate_t& state, - const char* from, const char* from_end, const char*& from_next, - wchar_t* to, wchar_t* to_end, wchar_t*& to_next) 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) const; - - virtual std::codecvt_base::result do_unshift(std::mbstate_t&, - char* /*from*/, char* /*to*/, char* & /*next*/) const { return ok; } - - virtual int do_length(std::mbstate_t&, - const char* /*from*/, const char* /*from_end*/, std::size_t /*max*/) const { return 0; } - - virtual int do_max_length() const throw () { return 0; } - }; - -#endif // BOOST_FILESYSTEM3_WIN_FILE_CODECVT_HPP diff --git a/3rdParty/Boost/src/libs/program_options/src/cmdline.cpp b/3rdParty/Boost/src/libs/program_options/src/cmdline.cpp index be31385..cd9a5fe 100644 --- a/3rdParty/Boost/src/libs/program_options/src/cmdline.cpp +++ b/3rdParty/Boost/src/libs/program_options/src/cmdline.cpp @@ -34,64 +34,43 @@ namespace boost { namespace program_options { using namespace std; using namespace boost::program_options::command_line_style; - invalid_syntax:: - invalid_syntax(const string& tokens, kind_t kind) - : error(error_message(kind).append(" in '").append(tokens).append("'")) - , m_tokens(tokens) - , m_kind(kind) - {} string - invalid_syntax::error_message(kind_t kind) + invalid_syntax::get_template(kind_t kind) { // Initially, store the message in 'const char*' variable, // to avoid conversion to string in all cases. const char* msg; switch(kind) { + case empty_adjacent_parameter: + msg = "the argument for option '%canonical_option%' should follow immediately after the equal sign"; + break; + case missing_parameter: + msg = "the required argument for option '%canonical_option%' is missing"; + break; + case unrecognized_line: + msg = "the options configuration file contains an invalid line '%invalid_line%'"; + break; + // none of the following are currently used: case long_not_allowed: - msg = "long options are not allowed"; + msg = "the unabbreviated option '%canonical_option%' is not valid"; break; case long_adjacent_not_allowed: - msg = "parameters adjacent to long options not allowed"; + msg = "the unabbreviated option '%canonical_option%' does not take any arguments"; break; case short_adjacent_not_allowed: - msg = "parameters adjust to short options are not allowed"; - break; - case empty_adjacent_parameter: - msg = "adjacent parameter is empty"; - break; - case missing_parameter: - msg = "required parameter is missing"; + msg = "the abbreviated option '%canonical_option%' does not take any arguments"; break; case extra_parameter: - msg = "extra parameter"; - break; - case unrecognized_line: - msg = "unrecognized line"; + msg = "option '%canonical_option%' does not take any arguments"; break; default: - msg = "unknown error"; + msg = "unknown command line syntax error for '%s'"; } return msg; } - invalid_syntax::kind_t - invalid_syntax::kind() const - { - return m_kind; - } - - const string& - invalid_syntax::tokens() const - { - return m_tokens; - } - - invalid_command_line_syntax:: - invalid_command_line_syntax(const string& tokens, kind_t kind) - : invalid_syntax(tokens, kind) - {} }} @@ -156,15 +135,26 @@ namespace boost { namespace program_options { namespace detail { const char* error = 0; if (allow_some_long && !(style & long_allow_adjacent) && !(style & long_allow_next)) - error = "style disallows parameters for long options"; + error = "boost::program_options misconfiguration: " + "choose one or other of 'command_line_style::long_allow_next' " + "(whitespace separated arguments) or " + "'command_line_style::long_allow_adjacent' ('=' separated arguments) for " + "long options."; if (!error && (style & allow_short) && !(style & short_allow_adjacent) && !(style & short_allow_next)) - error = "style disallows parameters for short options"; + error = "boost::program_options misconfiguration: " + "choose one or other of 'command_line_style::short_allow_next' " + "(whitespace separated arguments) or " + "'command_line_style::short_allow_adjacent' ('=' separated arguments) for " + "short options."; if (!error && (style & allow_short) && !(style & allow_dash_for_short) && !(style & allow_slash_for_short)) - error = "style disallows all characters for short options"; + error = "boost::program_options misconfiguration: " + "choose one or other of 'command_line_style::allow_slash_for_short' " + "(slashes) or 'command_line_style::allow_dash_for_short' (dashes) for " + "short options."; if (error) boost::throw_exception(invalid_command_line_style(error)); @@ -192,6 +182,23 @@ namespace boost { namespace program_options { namespace detail { m_positional = &positional; } + int + cmdline::get_canonical_option_prefix() + { + if (m_style & allow_long) + return allow_long; + + if (m_style & allow_long_disguise) + return allow_long_disguise; + + if ((m_style & allow_short) && (m_style & allow_dash_for_short)) + return allow_dash_for_short; + + if ((m_style & allow_short) && (m_style & allow_slash_for_short)) + return allow_slash_for_short; + + return 0; + } vector<option> cmdline::run() @@ -242,7 +249,7 @@ namespace boost { namespace program_options { namespace detail { bool ok = false; for(unsigned i = 0; i < style_parsers.size(); ++i) { - unsigned current_size = args.size(); + unsigned current_size = static_cast<unsigned>(args.size()); vector<option> next = style_parsers[i](args); // Check that option names @@ -277,7 +284,7 @@ namespace boost { namespace program_options { namespace detail { } /* If an key option is followed by a positional option, - can can consume more tokens (e.g. it's multitoke option), + can can consume more tokens (e.g. it's multitoken option), give those tokens to it. */ vector<option> result2; for (unsigned i = 0; i < result.size(); ++i) @@ -288,11 +295,21 @@ namespace boost { namespace program_options { namespace detail { if (opt.string_key.empty()) continue; - const option_description* xd = - m_desc->find_nothrow(opt.string_key, - is_style_active(allow_guessing), - is_style_active(long_case_insensitive), - is_style_active(short_case_insensitive)); + const option_description* xd; + try + { + xd = m_desc->find_nothrow(opt.string_key, + is_style_active(allow_guessing), + is_style_active(long_case_insensitive), + is_style_active(short_case_insensitive)); + } + catch(error_with_option_name& e) + { + // add context and rethrow + e.add_context(opt.string_key, opt.original_tokens[0], get_canonical_option_prefix()); + throw; + } + if (!xd) continue; @@ -304,7 +321,7 @@ namespace boost { namespace program_options { namespace detail { // We only allow to grab tokens that are not already // recognized as key options. - int can_take_more = max_tokens - opt.value.size(); + int can_take_more = max_tokens - static_cast<int>(opt.value.size()); unsigned j = i+1; for (; can_take_more && j < result.size(); --can_take_more, ++j) { @@ -383,92 +400,112 @@ namespace boost { namespace program_options { namespace detail { if (opt.string_key.empty()) return; - // First check that the option is valid, and get its description. - const option_description* xd = m_desc->find_nothrow(opt.string_key, - is_style_active(allow_guessing), - is_style_active(long_case_insensitive), - is_style_active(short_case_insensitive)); + // + // Be defensive: + // will have no original token if option created by handle_additional_parser() + std::string original_token_for_exceptions = opt.string_key; + if (opt.original_tokens.size()) + original_token_for_exceptions = opt.original_tokens[0]; - if (!xd) + try { - if (m_allow_unregistered) { - opt.unregistered = true; - return; - } else { - boost::throw_exception(unknown_option(opt.string_key)); - } - } - const option_description& d = *xd; + // First check that the option is valid, and get its description. + const option_description* xd = m_desc->find_nothrow(opt.string_key, + is_style_active(allow_guessing), + is_style_active(long_case_insensitive), + is_style_active(short_case_insensitive)); - // Canonize the name - opt.string_key = d.key(opt.string_key); + if (!xd) + { + if (m_allow_unregistered) { + opt.unregistered = true; + return; + } else { + boost::throw_exception(unknown_option()); + } + } + const option_description& d = *xd; - // We check that the min/max number of tokens for the option - // agrees with the number of tokens we have. The 'adjacent_value' - // (the value in --foo=1) counts as a separate token, and if present - // must be consumed. The following tokens on the command line may be - // left unconsumed. + // Canonize the name + opt.string_key = d.key(opt.string_key); - // We don't check if those tokens look like option, or not! + // We check that the min/max number of tokens for the option + // agrees with the number of tokens we have. The 'adjacent_value' + // (the value in --foo=1) counts as a separate token, and if present + // must be consumed. The following tokens on the command line may be + // left unconsumed. - unsigned min_tokens = d.semantic()->min_tokens(); - unsigned max_tokens = d.semantic()->max_tokens(); - - unsigned present_tokens = opt.value.size() + other_tokens.size(); - - if (present_tokens >= min_tokens) - { - if (!opt.value.empty() && max_tokens == 0) - { - boost::throw_exception(invalid_command_line_syntax(opt.string_key, - invalid_command_line_syntax::extra_parameter)); - } - - // If an option wants, at minimum, N tokens, we grab them there, - // when adding these tokens as values to current option we check - // if they look like options - if (opt.value.size() <= min_tokens) - { - min_tokens -= opt.value.size(); - } - else - { - min_tokens = 0; - } + // We don't check if those tokens look like option, or not! - // Everything's OK, move the values to the result. - for(;!other_tokens.empty() && min_tokens--; ) + unsigned min_tokens = d.semantic()->min_tokens(); + unsigned max_tokens = d.semantic()->max_tokens(); + + unsigned present_tokens = static_cast<unsigned>(opt.value.size() + other_tokens.size()); + + if (present_tokens >= min_tokens) { - // check if extra parameter looks like a known option - // we use style parsers to check if it is syntactically an option, - // additionally we check if an option_description exists - vector<option> followed_option; - vector<string> next_token(1, other_tokens[0]); - for (unsigned i = 0; followed_option.empty() && i < style_parsers.size(); ++i) + if (!opt.value.empty() && max_tokens == 0) + { + boost::throw_exception( + invalid_command_line_syntax(invalid_command_line_syntax::extra_parameter)); + } + + // If an option wants, at minimum, N tokens, we grab them there, + // when adding these tokens as values to current option we check + // if they look like options + if (opt.value.size() <= min_tokens) { - followed_option = style_parsers[i](next_token); + min_tokens -= static_cast<unsigned>(opt.value.size()); } - if (!followed_option.empty()) + else { - const option_description* od = m_desc->find_nothrow(other_tokens[0], - is_style_active(allow_guessing), - is_style_active(long_case_insensitive), - is_style_active(short_case_insensitive)); - if (od) - boost::throw_exception(invalid_command_line_syntax(opt.string_key, - invalid_command_line_syntax::missing_parameter)); + min_tokens = 0; + } + + // Everything's OK, move the values to the result. + for(;!other_tokens.empty() && min_tokens--; ) + { + // check if extra parameter looks like a known option + // we use style parsers to check if it is syntactically an option, + // additionally we check if an option_description exists + vector<option> followed_option; + vector<string> next_token(1, other_tokens[0]); + for (unsigned i = 0; followed_option.empty() && i < style_parsers.size(); ++i) + { + followed_option = style_parsers[i](next_token); + } + if (!followed_option.empty()) + { + original_token_for_exceptions = other_tokens[0]; + const option_description* od = m_desc->find_nothrow(other_tokens[0], + is_style_active(allow_guessing), + is_style_active(long_case_insensitive), + is_style_active(short_case_insensitive)); + if (od) + boost::throw_exception( + invalid_command_line_syntax(invalid_command_line_syntax::missing_parameter)); + } + opt.value.push_back(other_tokens[0]); + opt.original_tokens.push_back(other_tokens[0]); + other_tokens.erase(other_tokens.begin()); } - opt.value.push_back(other_tokens[0]); - opt.original_tokens.push_back(other_tokens[0]); - other_tokens.erase(other_tokens.begin()); } - } - else - { - boost::throw_exception(invalid_command_line_syntax(opt.string_key, - invalid_command_line_syntax::missing_parameter)); + else + { + boost::throw_exception( + invalid_command_line_syntax(invalid_command_line_syntax::missing_parameter)); + } + } + // use only original token for unknown_option / ambiguous_option since by definition + // they are unrecognised / unparsable + catch(error_with_option_name& e) + { + // add context and rethrow + e.add_context(opt.string_key, original_token_for_exceptions, get_canonical_option_prefix()); + throw; } + } vector<option> @@ -486,8 +523,11 @@ namespace boost { namespace program_options { namespace detail { name = tok.substr(2, p-2); adjacent = tok.substr(p+1); if (adjacent.empty()) - boost::throw_exception( invalid_command_line_syntax(name, - invalid_command_line_syntax::empty_adjacent_parameter) ); + boost::throw_exception( invalid_command_line_syntax( + invalid_command_line_syntax::empty_adjacent_parameter, + name, + name, + get_canonical_option_prefix()) ); } else { @@ -523,9 +563,20 @@ namespace boost { namespace program_options { namespace detail { // of token is considered to be value, not further grouped // option. for(;;) { - const option_description* d - = m_desc->find_nothrow(name, false, false, - is_style_active(short_case_insensitive)); + const option_description* d; + try + { + + d = m_desc->find_nothrow(name, false, false, + is_style_active(short_case_insensitive)); + } + catch(error_with_option_name& e) + { + // add context and rethrow + e.add_context(name, name, get_canonical_option_prefix()); + throw; + } + // FIXME: check for 'allow_sticky'. if (d && (m_style & allow_sticky) && @@ -589,15 +640,24 @@ namespace boost { namespace program_options { namespace detail { ((tok[0] == '-' && tok[1] != '-') || ((m_style & allow_slash_for_short) && tok[0] == '/'))) { - if (m_desc->find_nothrow(tok.substr(1, tok.find('=')-1), - is_style_active(allow_guessing), - is_style_active(long_case_insensitive), - is_style_active(short_case_insensitive))) + try + { + if (m_desc->find_nothrow(tok.substr(1, tok.find('=')-1), + is_style_active(allow_guessing), + is_style_active(long_case_insensitive), + is_style_active(short_case_insensitive))) + { + args[0].insert(0, "-"); + if (args[0][1] == '/') + args[0][1] = '-'; + return parse_long_option(args); + } + } + catch(error_with_option_name& e) { - args[0].insert(0, "-"); - if (args[0][1] == '/') - args[0][1] = '-'; - return parse_long_option(args); + // add context and rethrow + e.add_context(tok, tok, get_canonical_option_prefix()); + throw; } } return vector<option>(); diff --git a/3rdParty/Boost/src/libs/program_options/src/config_file.cpp b/3rdParty/Boost/src/libs/program_options/src/config_file.cpp index a12844c..f2a57b4 100644 --- a/3rdParty/Boost/src/libs/program_options/src/config_file.cpp +++ b/3rdParty/Boost/src/libs/program_options/src/config_file.cpp @@ -57,7 +57,9 @@ namespace boost { namespace program_options { namespace detail { bad_prefixes = true; } if (bad_prefixes) - boost::throw_exception(error("bad prefixes")); + boost::throw_exception(error("options '" + string(name) + "' and '" + + *i + "*' will both match the same " + "arguments from the configuration file")); allowed_prefixes.insert(s); } } @@ -117,7 +119,7 @@ namespace boost { namespace program_options { namespace detail { break; } else { - boost::throw_exception(invalid_syntax(s, invalid_syntax::unrecognized_line)); + boost::throw_exception(invalid_config_file_syntax(s, invalid_syntax::unrecognized_line)); } } } diff --git a/3rdParty/Boost/src/libs/program_options/src/options_description.cpp b/3rdParty/Boost/src/libs/program_options/src/options_description.cpp index 0d8dfd4..343bd30 100644 --- a/3rdParty/Boost/src/libs/program_options/src/options_description.cpp +++ b/3rdParty/Boost/src/libs/program_options/src/options_description.cpp @@ -137,6 +137,31 @@ namespace boost { namespace program_options { return m_short_name; } + std::string + option_description::canonical_display_name(int prefix_style) const + { + if (!m_long_name.empty()) + { + if (prefix_style == command_line_style::allow_long) + return "--" + m_long_name; + if (prefix_style == command_line_style::allow_long_disguise) + return "-" + m_long_name; + } + // sanity check: m_short_name[0] should be '-' or '/' + if (m_short_name.length() == 2) + { + if (prefix_style == command_line_style::allow_slash_for_short) + return string("/") + m_short_name[1]; + if (prefix_style == command_line_style::allow_dash_for_short) + return string("-") + m_short_name[1]; + } + if (!m_long_name.empty()) + return m_long_name; + else + return m_short_name; + } + + const std::string& option_description::long_name() const { @@ -174,10 +199,13 @@ namespace boost { namespace program_options { option_description::format_name() const { if (!m_short_name.empty()) - return string(m_short_name).append(" [ --"). - append(m_long_name).append(" ]"); - else - return string("--").append(m_long_name); + { + return m_long_name.empty() + ? m_short_name + : string(m_short_name).append(" [ --"). + append(m_long_name).append(" ]"); + } + return string("--").append(m_long_name); } std::string @@ -289,7 +317,7 @@ namespace boost { namespace program_options { const option_description* d = find_nothrow(name, approx, long_ignore_case, short_ignore_case); if (!d) - boost::throw_exception(unknown_option(name)); + boost::throw_exception(unknown_option()); return *d; } @@ -337,8 +365,7 @@ namespace boost { namespace program_options { } } if (full_matches.size() > 1) - boost::throw_exception( - ambiguous_option(name, full_matches)); + boost::throw_exception(ambiguous_option(full_matches)); // If we have a full match, and an approximate match, // ignore approximate match instead of reporting error. @@ -346,8 +373,7 @@ namespace boost { namespace program_options { // "--all" on the command line should select the first one, // without ambiguity. if (full_matches.empty() && approximate_matches.size() > 1) - boost::throw_exception( - ambiguous_option(name, approximate_matches)); + boost::throw_exception(ambiguous_option(approximate_matches)); return found.get(); } @@ -396,7 +422,7 @@ namespace boost { namespace program_options { if (count(par.begin(), par.end(), '\t') > 1) { boost::throw_exception(program_options::error( - "Only one tab per paragraph is allowed")); + "Only one tab per paragraph is allowed in the options description")); } // erase tab from string @@ -443,7 +469,7 @@ namespace boost { namespace program_options { // Take care to never increment the iterator past // the end, since MSVC 8.0 (brokenly), assumes that // doing that, even if no access happens, is a bug. - unsigned remaining = distance(line_begin, par_end); + unsigned remaining = static_cast<unsigned>(std::distance(line_begin, par_end)); string::const_iterator line_end = line_begin + ((remaining < line_length) ? remaining : line_length); @@ -463,7 +489,7 @@ namespace boost { namespace program_options { { // is last_space within the second half ot the // current line - if (static_cast<unsigned>(distance(last_space, line_end)) < + if (static_cast<unsigned>(std::distance(last_space, line_end)) < (line_length / 2)) { line_end = last_space; @@ -476,8 +502,8 @@ namespace boost { namespace program_options { if (first_line) { - indent += par_indent; - line_length -= par_indent; // there's less to work with now + indent += static_cast<unsigned>(par_indent); + line_length -= static_cast<unsigned>(par_indent); // there's less to work with now first_line = false; } @@ -566,7 +592,7 @@ namespace boost { namespace program_options { os.put(' '); } } else { - for(unsigned pad = first_column_width - ss.str().size(); pad > 0; --pad) + for(unsigned pad = first_column_width - static_cast<unsigned>(ss.str().size()); pad > 0; --pad) { os.put(' '); } diff --git a/3rdParty/Boost/src/libs/program_options/src/parsers.cpp b/3rdParty/Boost/src/libs/program_options/src/parsers.cpp index bc3b858..2361a48 100644 --- a/3rdParty/Boost/src/libs/program_options/src/parsers.cpp +++ b/3rdParty/Boost/src/libs/program_options/src/parsers.cpp @@ -45,7 +45,10 @@ // See: http://article.gmane.org/gmane.comp.lib.boost.devel/103843 // See: http://lists.gnu.org/archive/html/bug-guile/2004-01/msg00013.html #if defined(__APPLE__) && defined(__DYNAMIC__) -#include <crt_externs.h> +// The proper include for this is crt_externs.h, however it's not +// available on iOS. The right replacement is not known. See +// https://svn.boost.org/trac/boost/ticket/5053 +extern "C" { extern char ***_NSGetEnviron(void); } #define environ (*_NSGetEnviron()) #else #if defined(__MWERKS__) @@ -85,7 +88,8 @@ namespace boost { namespace program_options { basic_parsed_options<wchar_t> ::basic_parsed_options(const parsed_options& po) : description(po.description), - utf8_encoded_options(po) + utf8_encoded_options(po), + m_options_prefix(po.m_options_prefix) { for (unsigned i = 0; i < po.options.size(); ++i) options.push_back(woption_from_option(po.options[i])); @@ -107,7 +111,7 @@ namespace boost { namespace program_options { if (d.long_name().empty()) boost::throw_exception( - error("long name required for config file")); + error("abbreviated option names are not permitted in options configuration files")); allowed_options.insert(d.long_name()); } diff --git a/3rdParty/Boost/src/libs/program_options/src/positional_options.cpp b/3rdParty/Boost/src/libs/program_options/src/positional_options.cpp index 55995d7..72dc0d6 100644 --- a/3rdParty/Boost/src/libs/program_options/src/positional_options.cpp +++ b/3rdParty/Boost/src/libs/program_options/src/positional_options.cpp @@ -34,7 +34,7 @@ namespace boost { namespace program_options { positional_options_description::max_total_count() const { return m_trailing.empty() ? - m_names.size() : (std::numeric_limits<unsigned>::max)(); + static_cast<unsigned>(m_names.size()) : (std::numeric_limits<unsigned>::max)(); } const std::string& diff --git a/3rdParty/Boost/src/libs/program_options/src/program_options_utf8_codecvt_facet.cpp b/3rdParty/Boost/src/libs/program_options/src/program_options_utf8_codecvt_facet.cpp index c0fd7c0..2e4c532 100644 --- a/3rdParty/Boost/src/libs/program_options/src/program_options_utf8_codecvt_facet.cpp +++ b/3rdParty/Boost/src/libs/program_options/src/program_options_utf8_codecvt_facet.cpp @@ -12,7 +12,7 @@ #define BOOST_UTF8_END_NAMESPACE }}} #define BOOST_UTF8_DECL BOOST_PROGRAM_OPTIONS_DECL -#include "../../detail/utf8_codecvt_facet.cpp" +#include <boost/detail/utf8_codecvt_facet.ipp> #undef BOOST_UTF8_BEGIN_NAMESPACE diff --git a/3rdParty/Boost/src/libs/program_options/src/value_semantic.cpp b/3rdParty/Boost/src/libs/program_options/src/value_semantic.cpp index f5770f1..5314029 100644 --- a/3rdParty/Boost/src/libs/program_options/src/value_semantic.cpp +++ b/3rdParty/Boost/src/libs/program_options/src/value_semantic.cpp @@ -7,6 +7,8 @@ #include <boost/program_options/config.hpp> #include <boost/program_options/value_semantic.hpp> #include <boost/program_options/detail/convert.hpp> +#include <boost/program_options/detail/cmdline.hpp> +#include <set> #include <cctype> @@ -14,6 +16,22 @@ namespace boost { namespace program_options { using namespace std; + +#ifndef BOOST_NO_STD_WSTRING + namespace + { + std::string convert_value(const std::wstring& s) + { + try { + return to_local_8_bit(s); + } + catch(const std::exception&) { + return "<unrepresentable unicode string>"; + } + } + } +#endif + void value_semantic_codecvt_helper<char>:: parse(boost::any& value_store, @@ -139,7 +157,7 @@ namespace boost { namespace program_options { else if (s == "off" || s == "no" || s == "0" || s == "false") v = any(false); else - boost::throw_exception(validation_error(validation_error::invalid_bool_value, s)); + boost::throw_exception(invalid_bool_value(s)); } // This is blatant copy-paste. However, templating this will cause a problem, @@ -161,7 +179,7 @@ namespace boost { namespace program_options { else if (s == L"off" || s == L"no" || s == L"0" || s == L"false") v = any(false); else - boost::throw_exception(validation_error(validation_error::invalid_bool_value)); + boost::throw_exception(invalid_bool_value(convert_value(s))); } #endif BOOST_PROGRAM_OPTIONS_DECL @@ -194,120 +212,212 @@ namespace boost { namespace program_options { invalid_option_value:: invalid_option_value(const std::string& bad_value) - : validation_error(validation_error::invalid_option_value, bad_value) - {} - -#ifndef BOOST_NO_STD_WSTRING - namespace + : validation_error(validation_error::invalid_option_value) { - std::string convert_value(const std::wstring& s) - { - try { - return to_local_8_bit(s); - } - catch(const std::exception&) { - return "<unrepresentable unicode string>"; - } - } + set_substitute("value", bad_value); } +#ifndef BOOST_NO_STD_WSTRING invalid_option_value:: invalid_option_value(const std::wstring& bad_value) - : validation_error(validation_error::invalid_option_value, convert_value(bad_value)) - {} -#endif - const std::string& - unknown_option::get_option_name() const throw() - { - return m_option_name; + : validation_error(validation_error::invalid_option_value) + { + set_substitute("value", convert_value(bad_value)); } +#endif - const std::string& - ambiguous_option::get_option_name() const throw() - { - return m_option_name; - } - - const std::vector<std::string>& - ambiguous_option::alternatives() const throw() + + + invalid_bool_value:: + invalid_bool_value(const std::string& bad_value) + : validation_error(validation_error::invalid_bool_value) { - return m_alternatives; + set_substitute("value", bad_value); } - void - multiple_values::set_option_name(const std::string& option_name) + + + + + + error_with_option_name::error_with_option_name( const std::string& template_, + const std::string& option_name, + const std::string& original_token, + int option_style) : + error(template_), + m_option_style(option_style), + m_error_template(template_) { - m_option_name = option_name; + // parameter | placeholder | value + // --------- | ----------- | ----- + set_substitute_default("canonical_option", "option '%canonical_option%'", "option"); + set_substitute_default("value", "argument ('%value%')", "argument"); + set_substitute_default("prefix", "%prefix%", ""); + m_substitutions["option"] = option_name; + m_substitutions["original_token"] = original_token; } - const std::string& - multiple_values::get_option_name() const throw() + + const char* error_with_option_name::what() const throw() { - return m_option_name; + // will substitute tokens each time what is run() + substitute_placeholders(m_error_template); + + return m_message.c_str(); } - - void - multiple_occurrences::set_option_name(const std::string& option_name) + + void error_with_option_name::replace_token(const string& from, const string& to) const { - m_option_name = option_name; + while (1) + { + std::size_t pos = m_message.find(from.c_str(), 0, from.length()); + // not found: all replaced + if (pos == std::string::npos) + return; + m_message.replace(pos, from.length(), to); + } } - const std::string& - multiple_occurrences::get_option_name() const throw() + string error_with_option_name::get_canonical_option_prefix() const { - return m_option_name; + switch (m_option_style) + { + case command_line_style::allow_dash_for_short: + return "-"; + case command_line_style::allow_slash_for_short: + return "/"; + case command_line_style::allow_long_disguise: + return "-"; + case command_line_style::allow_long: + return "--"; + case 0: + return ""; + } + throw std::logic_error("error_with_option_name::m_option_style can only be " + "one of [0, allow_dash_for_short, allow_slash_for_short, " + "allow_long_disguise or allow_long]"); } - - validation_error:: - validation_error(kind_t kind, - const std::string& option_value, - const std::string& option_name) - : error("") - , m_kind(kind) - , m_option_name(option_name) - , m_option_value(option_value) - , m_message(error_message(kind)) + + + string error_with_option_name::get_canonical_option_name() const { - if (!option_value.empty()) - { - m_message.append(std::string("'") + option_value + std::string("'")); - } + if (!m_substitutions.find("option")->second.length()) + return m_substitutions.find("original_token")->second; + + string original_token = strip_prefixes(m_substitutions.find("original_token")->second); + string option_name = strip_prefixes(m_substitutions.find("option")->second); + + // For long options, use option name + if (m_option_style == command_line_style::allow_long || + m_option_style == command_line_style::allow_long_disguise) + return get_canonical_option_prefix() + option_name; + + // For short options use first letter of original_token + if (m_option_style && original_token.length()) + return get_canonical_option_prefix() + original_token[0]; + + // no prefix + return option_name; } - void - validation_error::set_option_name(const std::string& option_name) + + void error_with_option_name::substitute_placeholders(const string& error_template) const { - m_option_name = option_name; + m_message = error_template; + std::map<std::string, std::string> substitutions(m_substitutions); + substitutions["canonical_option"] = get_canonical_option_name(); + substitutions["prefix"] = get_canonical_option_prefix(); + + + // + // replace placeholder with defaults if values are missing + // + for (map<string, string_pair>::const_iterator iter = m_substitution_defaults.begin(); + iter != m_substitution_defaults.end(); ++iter) + { + // missing parameter: use default + if (substitutions.count(iter->first) == 0 || + substitutions[iter->first].length() == 0) + replace_token(iter->second.first, iter->second.second); + } + + + // + // replace placeholder with values + // placeholder are denoted by surrounding '%' + // + for (map<string, string>::iterator iter = substitutions.begin(); + iter != substitutions.end(); ++iter) + replace_token('%' + iter->first + '%', iter->second); } - const std::string& - validation_error::get_option_name() const throw() + + void ambiguous_option::substitute_placeholders(const string& original_error_template) const { - return m_option_name; + // For short forms, all alternatives must be identical, by + // definition, to the specified option, so we don't need to + // display alternatives + if (m_option_style == command_line_style::allow_dash_for_short || + m_option_style == command_line_style::allow_slash_for_short) + { + error_with_option_name::substitute_placeholders(original_error_template); + return; + } + + + string error_template = original_error_template; + // remove duplicates using std::set + std::set<std::string> alternatives_set (m_alternatives.begin(), m_alternatives.end()); + std::vector<std::string> alternatives_vec (alternatives_set.begin(), alternatives_set.end()); + + error_template += " and matches "; + // Being very cautious: should be > 1 alternative! + if (alternatives_vec.size() > 1) + { + for (unsigned i = 0; i < alternatives_vec.size() - 1; ++i) + error_template += "'%prefix%" + alternatives_vec[i] + "', "; + error_template += "and "; + } + + // there is a programming error if multiple options have the same name... + if (m_alternatives.size() > 1 && alternatives_vec.size() == 1) + error_template += "different versions of "; + + error_template += "'%prefix%" + alternatives_vec.back() + "'"; + + + // use inherited logic + error_with_option_name::substitute_placeholders(error_template); } - std::string - validation_error::error_message(kind_t kind) + + + + + + string + validation_error::get_template(kind_t kind) { // Initially, store the message in 'const char*' variable, // to avoid conversion to std::string in all cases. const char* msg; switch(kind) { - case multiple_values_not_allowed: - msg = "multiple values not allowed"; - break; - case at_least_one_value_required: - msg = "at least one value required"; - break; case invalid_bool_value: - msg = "invalid bool value"; + msg = "the argument ('%value%') for option '%canonical_option%' is invalid. Valid choices are 'on|off', 'yes|no', '1|0' and 'true|false'"; break; case invalid_option_value: - msg = "invalid option value"; + msg = "the argument ('%value%') for option '%canonical_option%' is invalid"; + break; + case multiple_values_not_allowed: + msg = "option '%canonical_option%' only takes a single argument"; + break; + case at_least_one_value_required: + msg = "option '%canonical_option%' requires at least one argument"; break; + // currently unused case invalid_option: - msg = "invalid option"; + msg = "option '%canonical_option%' is not valid"; break; default: msg = "unknown error"; @@ -315,21 +425,4 @@ namespace boost { namespace program_options { return msg; } - const char* - validation_error::what() const throw() - { - if (!m_option_name.empty()) - { - m_message = "in option '" + m_option_name + "': " - + error_message(m_kind); - } - return m_message.c_str(); - } - - const std::string& - required_option::get_option_name() const throw() - { - return m_option_name; - } - }} diff --git a/3rdParty/Boost/src/libs/program_options/src/variables_map.cpp b/3rdParty/Boost/src/libs/program_options/src/variables_map.cpp index 29b1de9..caf354e 100644 --- a/3rdParty/Boost/src/libs/program_options/src/variables_map.cpp +++ b/3rdParty/Boost/src/libs/program_options/src/variables_map.cpp @@ -38,65 +38,68 @@ namespace boost { namespace program_options { // Declared once, to please Intel in VC++ mode; unsigned i; - // First, convert/store all given options - for (i = 0; i < options.options.size(); ++i) { + // Declared here so can be used to provide context for exceptions + string option_name; + string original_token; - const string& name = options.options[i].string_key; - // Skip positional options without name - if (name.empty()) - continue; - - // Ignore unregistered option. The 'unregistered' - // field can be true only if user has explicitly asked - // to allow unregistered options. We can't store them - // to variables map (lacking any information about paring), - // so just ignore them. - if (options.options[i].unregistered) - continue; - - // If option has final value, skip this assignment - if (xm.m_final.count(name)) - continue; - - const option_description& d = desc.find(name, false, - false, false); + try + { - variable_value& v = m[name]; - if (v.defaulted()) { - // Explicit assignment here erases defaulted value - v = variable_value(); - } - - try { + // First, convert/store all given options + for (i = 0; i < options.options.size(); ++i) { + + option_name = options.options[i].string_key; + original_token = options.options[i].original_tokens.size() ? + options.options[i].original_tokens[0] : + option_name; + // Skip positional options without name + if (option_name.empty()) + continue; + + // Ignore unregistered option. The 'unregistered' + // field can be true only if user has explicitly asked + // to allow unregistered options. We can't store them + // to variables map (lacking any information about paring), + // so just ignore them. + if (options.options[i].unregistered) + continue; + + // If option has final value, skip this assignment + if (xm.m_final.count(option_name)) + continue; + + string original_token = options.options[i].original_tokens.size() ? + options.options[i].original_tokens[0] : ""; + const option_description& d = desc.find(option_name, false, + false, false); + + variable_value& v = m[option_name]; + if (v.defaulted()) { + // Explicit assignment here erases defaulted value + v = variable_value(); + } + d.semantic()->parse(v.value(), options.options[i].value, utf8); + + v.m_value_semantic = d.semantic(); + + // The option is not composing, and the value is explicitly + // provided. Ignore values of this option for subsequent + // calls to 'store'. We store this to a temporary set, + // so that several assignment inside *this* 'store' call + // are allowed. + if (!d.semantic()->is_composing()) + new_final.insert(option_name); } + } #ifndef BOOST_NO_EXCEPTIONS - catch(validation_error& e) - { - e.set_option_name(name); - throw; - } - catch(multiple_occurrences& e) - { - e.set_option_name(name); - throw; - } - catch(multiple_values& e) - { - e.set_option_name(name); - throw; - } -#endif - v.m_value_semantic = d.semantic(); - - // The option is not composing, and the value is explicitly - // provided. Ignore values of this option for subsequent - // calls to 'store'. We store this to a temporary set, - // so that several assignment inside *this* 'store' call - // are allowed. - if (!d.semantic()->is_composing()) - new_final.insert(name); + catch(error_with_option_name& e) + { + // add context and rethrow + e.add_context(option_name, original_token, options.m_options_prefix); + throw; } +#endif xm.m_final.insert(new_final.begin(), new_final.end()); @@ -127,7 +130,14 @@ namespace boost { namespace program_options { // add empty value if this is an required option if (d.semantic()->is_required()) { - xm.m_required.insert(key); + + // For option names specified in multiple ways, e.g. on the command line, + // config file etc, the following precedence rules apply: + // "--" > ("-" or "/") > "" + // Precedence is set conveniently by a single call to length() + string canonical_name = d.canonical_display_name(options.m_options_prefix); + if (canonical_name.length() > xm.m_required[key].length()) + xm.m_required[key] = canonical_name; } } } @@ -182,6 +192,13 @@ namespace boost { namespace program_options { : abstract_variables_map(next) {} + void variables_map::clear() + { + std::map<std::string, variable_value>::clear(); + m_final.clear(); + m_required.clear(); + } + const variable_value& variables_map::get(const std::string& name) const { @@ -197,15 +214,16 @@ namespace boost { namespace program_options { variables_map::notify() { // This checks if all required options occur - for (set<string>::const_iterator r = m_required.begin(); + for (map<string, string>::const_iterator r = m_required.begin(); r != m_required.end(); ++r) { - const string& opt = *r; + const string& opt = r->first; + const string& display_opt = r->second; map<string, variable_value>::const_iterator iter = find(opt); if (iter == end() || iter->second.empty()) { - boost::throw_exception(required_option(opt)); + boost::throw_exception(required_option(display_opt)); } } diff --git a/3rdParty/Boost/src/libs/program_options/src/winmain.cpp b/3rdParty/Boost/src/libs/program_options/src/winmain.cpp index 8a7c43f..6220043 100644 --- a/3rdParty/Boost/src/libs/program_options/src/winmain.cpp +++ b/3rdParty/Boost/src/libs/program_options/src/winmain.cpp @@ -7,6 +7,8 @@ #include <boost/program_options/parsers.hpp> #include <cctype> +using std::size_t; + #ifdef _WIN32 namespace boost { namespace program_options { @@ -89,7 +91,7 @@ namespace boost { namespace program_options { { std::vector<std::wstring> result; std::vector<std::string> aux = split_winmain(to_internal(cmdline)); - for (unsigned i = 0, e = aux.size(); i < e; ++i) + for (size_t i = 0, e = aux.size(); i < e; ++i) result.push_back(from_utf8(aux[i])); return result; } diff --git a/3rdParty/Boost/src/libs/regex/src/c_regex_traits.cpp b/3rdParty/Boost/src/libs/regex/src/c_regex_traits.cpp index a99de14..6701020 100644 --- a/3rdParty/Boost/src/libs/regex/src/c_regex_traits.cpp +++ b/3rdParty/Boost/src/libs/regex/src/c_regex_traits.cpp @@ -21,6 +21,7 @@ #include <boost/config.hpp> #include <boost/detail/workaround.hpp> +#include "internals.hpp" #if !BOOST_WORKAROUND(__BORLANDC__, < 0x560) @@ -107,26 +108,6 @@ c_regex_traits<char>::string_type BOOST_REGEX_CALL c_regex_traits<char>::transfo return result; } -enum -{ - char_class_space=1<<0, - char_class_print=1<<1, - char_class_cntrl=1<<2, - char_class_upper=1<<3, - char_class_lower=1<<4, - char_class_alpha=1<<5, - char_class_digit=1<<6, - char_class_punct=1<<7, - char_class_xdigit=1<<8, - char_class_alnum=char_class_alpha|char_class_digit, - char_class_graph=char_class_alnum|char_class_punct, - char_class_blank=1<<9, - char_class_word=1<<10, - char_class_unicode=1<<11, - char_class_horizontal=1<<12, - char_class_vertical=1<<13 -}; - c_regex_traits<char>::char_class_type BOOST_REGEX_CALL c_regex_traits<char>::lookup_classname(const char* p1, const char* p2) { static const char_class_type masks[] = diff --git a/3rdParty/Boost/src/libs/regex/src/cregex.cpp b/3rdParty/Boost/src/libs/regex/src/cregex.cpp index 5c27330..8d69139 100644 --- a/3rdParty/Boost/src/libs/regex/src/cregex.cpp +++ b/3rdParty/Boost/src/libs/regex/src/cregex.cpp @@ -361,11 +361,24 @@ void BuildFileList(std::list<std::string>* pl, const char* files, bool recurse) while(dstart != dend) { + // Verify that sprintf will not overflow: + if(std::strlen(dstart.path()) + std::strlen(directory_iterator::separator()) + std::strlen(ptr) >= MAX_PATH) + { + // Oops overflow, skip this item: + ++dstart; + continue; + } #if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(_WIN32_WCE) && !defined(UNDER_CE) - (::sprintf_s)(buf, sizeof(buf), "%s%s%s", dstart.path(), directory_iterator::separator(), ptr); + int r = (::sprintf_s)(buf, sizeof(buf), "%s%s%s", dstart.path(), directory_iterator::separator(), ptr); #else - (std::sprintf)(buf, "%s%s%s", dstart.path(), directory_iterator::separator(), ptr); + int r = (std::sprintf)(buf, "%s%s%s", dstart.path(), directory_iterator::separator(), ptr); #endif + if(r < 0) + { + // sprintf failed, skip this item: + ++dstart; + continue; + } BuildFileList(pl, buf, recurse); ++dstart; } diff --git a/3rdParty/Boost/src/libs/regex/src/fileiter.cpp b/3rdParty/Boost/src/libs/regex/src/fileiter.cpp index ff1d111..780a12f 100644 --- a/3rdParty/Boost/src/libs/regex/src/fileiter.cpp +++ b/3rdParty/Boost/src/libs/regex/src/fileiter.cpp @@ -19,6 +19,7 @@ #define BOOST_REGEX_SOURCE +#include <boost/config.hpp> #include <climits> #include <stdexcept> #include <string> @@ -847,10 +848,16 @@ bool iswild(const char* mask, const char* name) unsigned _fi_attributes(const char* root, const char* name) { char buf[MAX_PATH]; + // verify that we can not overflow: + if(std::strlen(root) + std::strlen(_fi_sep) + std::strlen(name) >= MAX_PATH) + return 0; + int r; if( ( (root[0] == *_fi_sep) || (root[0] == *_fi_sep_alt) ) && (root[1] == '\0') ) - (std::sprintf)(buf, "%s%s", root, name); + r = (std::sprintf)(buf, "%s%s", root, name); else - (std::sprintf)(buf, "%s%s%s", root, _fi_sep, name); + r = (std::sprintf)(buf, "%s%s%s", root, _fi_sep, name); + if(r < 0) + return 0; // sprintf failed DIR* d = opendir(buf); if(d) { @@ -870,6 +877,7 @@ _fi_find_handle _fi_FindFirstFile(const char* lpFileName, _fi_find_data* lpFindF { if(_fi_FindNextFile(dat, lpFindFileData)) return dat; + closedir(h); } delete dat; return 0; diff --git a/3rdParty/Boost/src/libs/regex/src/internals.hpp b/3rdParty/Boost/src/libs/regex/src/internals.hpp new file mode 100644 index 0000000..3a15cc6 --- /dev/null +++ b/3rdParty/Boost/src/libs/regex/src/internals.hpp @@ -0,0 +1,35 @@ +/* + * + * Copyright (c) 2011 + * John Maddock + * + * 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) + * + */ + +#ifndef BOOST_REGEX_SRC_INTERNALS_HPP +#define BOOST_REGEX_SRC_INTERNALS_HPP + +enum +{ + char_class_space=1<<0, + char_class_print=1<<1, + char_class_cntrl=1<<2, + char_class_upper=1<<3, + char_class_lower=1<<4, + char_class_alpha=1<<5, + char_class_digit=1<<6, + char_class_punct=1<<7, + char_class_xdigit=1<<8, + char_class_alnum=char_class_alpha|char_class_digit, + char_class_graph=char_class_alnum|char_class_punct, + char_class_blank=1<<9, + char_class_word=1<<10, + char_class_unicode=1<<11, + char_class_horizontal=1<<12, + char_class_vertical=1<<13 +}; + +#endif // BOOST_REGEX_SRC_INTERNALS_HPP diff --git a/3rdParty/Boost/src/libs/regex/src/posix_api.cpp b/3rdParty/Boost/src/libs/regex/src/posix_api.cpp index 37ed422..e59c19e 100644 --- a/3rdParty/Boost/src/libs/regex/src/posix_api.cpp +++ b/3rdParty/Boost/src/libs/regex/src/posix_api.cpp @@ -18,6 +18,7 @@ #define BOOST_REGEX_SOURCE +#include <boost/config.hpp> #include <cstdio> #include <boost/regex.hpp> #include <boost/cregex.hpp> @@ -167,11 +168,17 @@ BOOST_REGEX_DECL regsize_t BOOST_REGEX_CCALL regerrorA(int code, const regex_tA* { if(std::strcmp(e->re_endp, names[i]) == 0) { + // + // We're converting an integer i to a string, and since i <= REG_E_UNKNOWN + // a five character string is *always* large enough: + // #if BOOST_WORKAROUND(BOOST_MSVC, >= 1400) && !defined(_WIN32_WCE) && !defined(UNDER_CE) - (::sprintf_s)(localbuf, 5, "%d", i); + int r = (::sprintf_s)(localbuf, 5, "%d", i); #else - (std::sprintf)(localbuf, "%d", i); + int r = (std::sprintf)(localbuf, "%d", i); #endif + if(r < 0) + return 0; // sprintf failed if(std::strlen(localbuf) < buf_size) re_detail::strcpy_s(buf, buf_size, localbuf); return std::strlen(localbuf) + 1; diff --git a/3rdParty/Boost/src/libs/regex/src/regex.cpp b/3rdParty/Boost/src/libs/regex/src/regex.cpp index 27ac43c..ea20a06 100644 --- a/3rdParty/Boost/src/libs/regex/src/regex.cpp +++ b/3rdParty/Boost/src/libs/regex/src/regex.cpp @@ -19,6 +19,7 @@ #define BOOST_REGEX_SOURCE +#include <boost/config.hpp> #include <new> #include <boost/regex.hpp> #include <boost/throw_exception.hpp> diff --git a/3rdParty/Boost/src/libs/regex/src/regex_raw_buffer.cpp b/3rdParty/Boost/src/libs/regex/src/regex_raw_buffer.cpp index 7a8de80..f75f0a5 100644 --- a/3rdParty/Boost/src/libs/regex/src/regex_raw_buffer.cpp +++ b/3rdParty/Boost/src/libs/regex/src/regex_raw_buffer.cpp @@ -18,6 +18,7 @@ #define BOOST_REGEX_SOURCE +#include <boost/config.hpp> #include <memory> #include <cstring> #include <boost/assert.hpp> @@ -45,7 +46,8 @@ void BOOST_REGEX_CALL raw_storage::resize(size_type n) // allocate and copy data: register pointer ptr = static_cast<pointer>(::operator new(newsize)); BOOST_REGEX_NOEH_ASSERT(ptr) - std::memcpy(ptr, start, datasize); + if(start) + std::memcpy(ptr, start, datasize); // get rid of old buffer: ::operator delete(start); diff --git a/3rdParty/Boost/src/libs/regex/src/wc_regex_traits.cpp b/3rdParty/Boost/src/libs/regex/src/wc_regex_traits.cpp index a9e96d9..b3d2c5a 100644 --- a/3rdParty/Boost/src/libs/regex/src/wc_regex_traits.cpp +++ b/3rdParty/Boost/src/libs/regex/src/wc_regex_traits.cpp @@ -22,6 +22,7 @@ #include <boost/detail/workaround.hpp> #include <memory> #include <string> +#include "internals.hpp" #if defined(_DLL_CPPLIB) && !defined(_M_CEE_PURE) && defined(_NATIVE_WCHAR_T_DEFINED) \ && !(defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION) || defined(__STD_RWCOMPILER_H__) || defined(_RWSTD_VER))\ @@ -147,26 +148,6 @@ c_regex_traits<wchar_t>::string_type BOOST_REGEX_CALL c_regex_traits<wchar_t>::t return result; } -enum -{ - char_class_space=1<<0, - char_class_print=1<<1, - char_class_cntrl=1<<2, - char_class_upper=1<<3, - char_class_lower=1<<4, - char_class_alpha=1<<5, - char_class_digit=1<<6, - char_class_punct=1<<7, - char_class_xdigit=1<<8, - char_class_alnum=char_class_alpha|char_class_digit, - char_class_graph=char_class_alnum|char_class_punct, - char_class_blank=1<<9, - char_class_word=1<<10, - char_class_unicode=1<<11, - char_class_horizontal=1<<12, - char_class_vertical=1<<13 -}; - c_regex_traits<wchar_t>::char_class_type BOOST_REGEX_CALL c_regex_traits<wchar_t>::lookup_classname(const wchar_t* p1, const wchar_t* p2) { static const char_class_type masks[] = diff --git a/3rdParty/Boost/src/libs/regex/src/wide_posix_api.cpp b/3rdParty/Boost/src/libs/regex/src/wide_posix_api.cpp index 3c693c6..ff5c90d 100644 --- a/3rdParty/Boost/src/libs/regex/src/wide_posix_api.cpp +++ b/3rdParty/Boost/src/libs/regex/src/wide_posix_api.cpp @@ -74,7 +74,7 @@ const wchar_t* wnames[] = { }; } -typedef boost::basic_regex<wchar_t, c_regex_traits<wchar_t> > c_regex_type; +typedef boost::basic_regex<wchar_t, c_regex_traits<wchar_t> > wc_regex_type; BOOST_REGEX_DECL int BOOST_REGEX_CCALL regcompW(regex_tW* expression, const wchar_t* ptr, int f) { @@ -84,7 +84,7 @@ BOOST_REGEX_DECL int BOOST_REGEX_CCALL regcompW(regex_tW* expression, const wcha #ifndef BOOST_NO_EXCEPTIONS try{ #endif - expression->guts = new c_regex_type(); + expression->guts = new wc_regex_type(); #ifndef BOOST_NO_EXCEPTIONS } catch(...) { @@ -134,9 +134,9 @@ BOOST_REGEX_DECL int BOOST_REGEX_CCALL regcompW(regex_tW* expression, const wcha try{ #endif expression->re_magic = wmagic_value; - static_cast<c_regex_type*>(expression->guts)->set_expression(ptr, p2, flags); - expression->re_nsub = static_cast<c_regex_type*>(expression->guts)->mark_count() - 1; - result = static_cast<c_regex_type*>(expression->guts)->error_code(); + static_cast<wc_regex_type*>(expression->guts)->set_expression(ptr, p2, flags); + expression->re_nsub = static_cast<wc_regex_type*>(expression->guts)->mark_count() - 1; + result = static_cast<wc_regex_type*>(expression->guts)->error_code(); #ifndef BOOST_NO_EXCEPTIONS } catch(const boost::regex_error& be) @@ -215,7 +215,7 @@ BOOST_REGEX_DECL regsize_t BOOST_REGEX_CCALL regerrorW(int code, const regex_tW* { std::string p; if((e) && (e->re_magic == wmagic_value)) - p = static_cast<c_regex_type*>(e->guts)->get_traits().error_string(static_cast< ::boost::regex_constants::error_type>(code)); + p = static_cast<wc_regex_type*>(e->guts)->get_traits().error_string(static_cast< ::boost::regex_constants::error_type>(code)); else { p = re_detail::get_default_error_string(static_cast< ::boost::regex_constants::error_type>(code)); @@ -264,7 +264,7 @@ BOOST_REGEX_DECL int BOOST_REGEX_CCALL regexecW(const regex_tW* expression, cons #endif if(expression->re_magic == wmagic_value) { - result = regex_search(start, end, m, *static_cast<c_regex_type*>(expression->guts), flags); + result = regex_search(start, end, m, *static_cast<wc_regex_type*>(expression->guts), flags); } else return result; @@ -301,7 +301,7 @@ BOOST_REGEX_DECL void BOOST_REGEX_CCALL regfreeW(regex_tW* expression) { if(expression->re_magic == wmagic_value) { - delete static_cast<c_regex_type*>(expression->guts); + delete static_cast<wc_regex_type*>(expression->guts); } expression->re_magic = 0; } diff --git a/3rdParty/Boost/src/libs/signals/src/named_slot_map.cpp b/3rdParty/Boost/src/libs/signals/src/named_slot_map.cpp index 1ddde63..ac9a292 100644 --- a/3rdParty/Boost/src/libs/signals/src/named_slot_map.cpp +++ b/3rdParty/Boost/src/libs/signals/src/named_slot_map.cpp @@ -24,7 +24,7 @@ typedef slot_container_type::iterator group_iterator; typedef slot_container_type::const_iterator const_group_iterator; -#if BOOST_WORKAROUND(_MSC_VER, <= 1600) +#if BOOST_WORKAROUND(_MSC_VER, <= 1700) void named_slot_map_iterator::decrement() { assert(false); } void named_slot_map_iterator::advance(difference_type) { assert(false); } #endif @@ -102,7 +102,7 @@ void named_slot_map::disconnect(const stored_group& name) i->first.disconnect(); i = next; } - groups.erase(group); + groups.erase((const_group_iterator) group); } } @@ -125,7 +125,7 @@ void named_slot_map::remove_disconnected_slots() } // Clear out empty groups - if (empty(g)) groups.erase(g++); + if (empty(g)) groups.erase((const_group_iterator) g++); else ++g; } } diff --git a/3rdParty/Boost/src/libs/system/src/error_code.cpp b/3rdParty/Boost/src/libs/system/src/error_code.cpp index bcdbea9..6772d15 100644 --- a/3rdParty/Boost/src/libs/system/src/error_code.cpp +++ b/3rdParty/Boost/src/libs/system/src/error_code.cpp @@ -74,7 +74,7 @@ namespace // strerror_r is preferred because it is always thread safe, // however, we fallback to strerror in certain cases because: // -- Windows doesn't provide strerror_r. - // -- HP and Sundo provide strerror_r on newer systems, but there is + // -- HP and Sun do provide strerror_r on newer systems, but there is // no way to tell if is available at runtime and in any case their // versions of strerror are thread safe anyhow. // -- Linux only sometimes provides strerror_r. @@ -84,6 +84,7 @@ namespace # if defined(BOOST_WINDOWS_API) || defined(__hpux) || defined(__sun)\ || (defined(__linux) && (!defined(__USE_XOPEN2K) || defined(BOOST_SYSTEM_USE_STRERROR)))\ || (defined(__osf__) && !defined(_REENTRANT))\ + || (defined(__INTEGRITY))\ || (defined(__vms))\ || (defined(__QNXNTO__)) const char * c_str = std::strerror( ev ); diff --git a/3rdParty/Boost/src/libs/thread/src/future.cpp b/3rdParty/Boost/src/libs/thread/src/future.cpp new file mode 100755 index 0000000..33980f5 --- /dev/null +++ b/3rdParty/Boost/src/libs/thread/src/future.cpp @@ -0,0 +1,61 @@ +// (C) Copyright 2012 Vicente J. Botet Escriba +// 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) + +#include <boost/thread/detail/config.hpp> +#ifndef BOOST_NO_EXCEPTIONS + + +#include <boost/thread/future.hpp> + +namespace boost +{ + + namespace thread_detail + { + + class future_error_category : + public boost::system::error_category + { + public: + virtual const char* name() const; //BOOST_NOEXCEPT; + virtual std::string message(int ev) const; + }; + + const char* + future_error_category::name() const //BOOST_NOEXCEPT + { + return "future"; + } + + std::string + future_error_category::message(int ev) const + { + switch (BOOST_SCOPED_ENUM_NATIVE(future_errc)(ev)) + { + case future_errc::broken_promise: + return std::string("The associated promise has been destructed prior " + "to the associated state becoming ready."); + case future_errc::future_already_retrieved: + return std::string("The future has already been retrieved from " + "the promise or packaged_task."); + case future_errc::promise_already_satisfied: + return std::string("The state of the promise has already been set."); + case future_errc::no_state: + return std::string("Operation not permitted on an object without " + "an associated state."); + } + return std::string("unspecified future_errc value\n"); + } + } + + const system::error_category& + future_category() BOOST_NOEXCEPT + { + static thread_detail::future_error_category f; + return f; + } + +} +#endif diff --git a/3rdParty/Boost/src/libs/thread/src/pthread/once.cpp b/3rdParty/Boost/src/libs/thread/src/pthread/once.cpp index 6e3722a..d5fd656 100644 --- a/3rdParty/Boost/src/libs/thread/src/pthread/once.cpp +++ b/3rdParty/Boost/src/libs/thread/src/pthread/once.cpp @@ -1,6 +1,6 @@ // Copyright (C) 2007 Anthony Williams // -// Distributed under the Boost Software License, Version 1.0. (See accompanying +// 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 __STDC_CONSTANT_MACROS @@ -8,12 +8,13 @@ #include <boost/assert.hpp> #include <pthread.h> #include <stdlib.h> +#include <memory> namespace boost { namespace detail { - BOOST_THREAD_DECL boost::uintmax_t once_global_epoch=UINTMAX_C(~0); + BOOST_THREAD_DECL thread_detail::uintmax_atomic_t once_global_epoch=BOOST_THREAD_DETAIL_UINTMAX_ATOMIC_MAX_C; BOOST_THREAD_DECL pthread_mutex_t once_epoch_mutex=PTHREAD_MUTEX_INITIALIZER; BOOST_THREAD_DECL pthread_cond_t once_epoch_cv = PTHREAD_COND_INITIALIZER; @@ -21,31 +22,51 @@ namespace boost { pthread_key_t epoch_tss_key; pthread_once_t epoch_tss_key_flag=PTHREAD_ONCE_INIT; - - extern "C" void delete_epoch_tss_data(void* data) + + extern "C" { - free(data); + static void delete_epoch_tss_data(void* data) + { + free(data); + } + + static void create_epoch_tss_key() + { + BOOST_VERIFY(!pthread_key_create(&epoch_tss_key,delete_epoch_tss_data)); + } } - extern "C" void create_epoch_tss_key() +#if defined BOOST_THREAD_PATCH + const pthread_once_t pthread_once_init_value=PTHREAD_ONCE_INIT; + struct BOOST_THREAD_DECL delete_epoch_tss_key_on_dlclose_t { - BOOST_VERIFY(!pthread_key_create(&epoch_tss_key,delete_epoch_tss_data)); - } - + delete_epoch_tss_key_on_dlclose_t() + { + } + ~delete_epoch_tss_key_on_dlclose_t() + { + if(memcmp(&epoch_tss_key_flag, &pthread_once_init_value, sizeof(pthread_once_t))) + { + pthread_key_delete(epoch_tss_key); + } + } + }; + delete_epoch_tss_key_on_dlclose_t delete_epoch_tss_key_on_dlclose; +#endif } - - boost::uintmax_t& get_once_per_thread_epoch() + + thread_detail::uintmax_atomic_t& get_once_per_thread_epoch() { BOOST_VERIFY(!pthread_once(&epoch_tss_key_flag,create_epoch_tss_key)); void* data=pthread_getspecific(epoch_tss_key); if(!data) { - data=malloc(sizeof(boost::uintmax_t)); + data=malloc(sizeof(thread_detail::uintmax_atomic_t)); BOOST_VERIFY(!pthread_setspecific(epoch_tss_key,data)); - *static_cast<boost::uintmax_t*>(data)=UINTMAX_C(~0); + *static_cast<thread_detail::uintmax_atomic_t*>(data)=BOOST_THREAD_DETAIL_UINTMAX_ATOMIC_MAX_C; } - return *static_cast<boost::uintmax_t*>(data); + return *static_cast<thread_detail::uintmax_atomic_t*>(data); } } - + } diff --git a/3rdParty/Boost/src/libs/thread/src/pthread/thread.cpp b/3rdParty/Boost/src/libs/thread/src/pthread/thread.cpp index 187c024..c83eac1 100644 --- a/3rdParty/Boost/src/libs/thread/src/pthread/thread.cpp +++ b/3rdParty/Boost/src/libs/thread/src/pthread/thread.cpp @@ -1,20 +1,22 @@ // Copyright (C) 2001-2003 // William E. Kempf // Copyright (C) 2007-8 Anthony Williams +// (C) Copyright 2011 Vicente J. Botet Escriba // -// Distributed under the Boost Software License, Version 1.0. (See accompanying +// 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/thread/detail/config.hpp> #include <boost/thread/thread.hpp> #include <boost/thread/xtime.hpp> -#include <boost/thread/condition.hpp> +#include <boost/thread/condition_variable.hpp> #include <boost/thread/locks.hpp> #include <boost/thread/once.hpp> #include <boost/thread/tss.hpp> #include <boost/throw_exception.hpp> -#ifdef __linux__ + +#ifdef __GLIBC__ #include <sys/sysinfo.h> #elif defined(__APPLE__) || defined(__FreeBSD__) #include <sys/types.h> @@ -23,14 +25,25 @@ #include <unistd.h> #endif -#include "timeconv.inl" +#include "./timeconv.inl" + +#pragma GCC diagnostic ignored "-Wreturn-type" namespace boost { namespace detail { thread_data_base::~thread_data_base() - {} + { + { + for (notify_list_t::iterator i = notify.begin(), e = notify.end(); + i != e; ++i) + { + i->second->unlock(); + i->first->notify_all(); + } + } + } struct thread_exit_callback_node { @@ -45,12 +58,16 @@ namespace boost namespace { +#ifdef BOOST_THREAD_PROVIDES_ONCE_CXX11 + boost::once_flag current_thread_tls_init_flag; +#else boost::once_flag current_thread_tls_init_flag=BOOST_ONCE_INIT; +#endif pthread_key_t current_thread_tls_key; extern "C" { - void tls_destructor(void* data) + static void tls_destructor(void* data) { boost::detail::thread_data_base* thread_info=static_cast<boost::detail::thread_data_base*>(data); if(thread_info) @@ -86,14 +103,31 @@ namespace boost } } } - + +#if defined BOOST_THREAD_PATCH + + struct delete_current_thread_tls_key_on_dlclose_t + { + delete_current_thread_tls_key_on_dlclose_t() + { + } + ~delete_current_thread_tls_key_on_dlclose_t() + { + if (current_thread_tls_init_flag.epoch!=BOOST_ONCE_INITIAL_FLAG_VALUE) + { + pthread_key_delete(current_thread_tls_key); + } + } + }; + delete_current_thread_tls_key_on_dlclose_t delete_current_thread_tls_key_on_dlclose; +#endif void create_current_thread_tls_key() { BOOST_VERIFY(!pthread_key_create(¤t_thread_tls_key,&tls_destructor)); } } - + boost::detail::thread_data_base* get_current_thread_data() { boost::call_once(current_thread_tls_init_flag,create_current_thread_tls_key); @@ -106,26 +140,27 @@ namespace boost BOOST_VERIFY(!pthread_setspecific(current_thread_tls_key,new_data)); } } - + namespace { extern "C" { - void* thread_proxy(void* param) + static void* thread_proxy(void* param) { boost::detail::thread_data_ptr thread_info = static_cast<boost::detail::thread_data_base*>(param)->self; thread_info->self.reset(); detail::set_current_thread_data(thread_info.get()); - try + BOOST_TRY { thread_info->run(); } - catch(thread_interrupted const&) + BOOST_CATCH (thread_interrupted const&) { } + BOOST_CATCH_END // Removed as it stops the debugger identifying the cause of the exception // Unhandled exceptions still cause the application to terminate -// catch(...) +// BOOST_CATCH(...) // { // std::terminate(); // } @@ -146,9 +181,11 @@ namespace boost { interrupt_enabled=false; } - + void run() {} + void notify_all_at_thread_exit(condition_variable*, mutex*) + {} private: externally_launched_thread(externally_launched_thread&); @@ -177,7 +214,7 @@ namespace boost } - thread::thread() + thread::thread() BOOST_NOEXCEPT {} void thread::start_thread() @@ -187,15 +224,47 @@ namespace boost if (res != 0) { thread_info->self.reset(); - boost::throw_exception(thread_resource_error()); + boost::throw_exception(thread_resource_error(res, "boost thread: failed in pthread_create")); } } - thread::~thread() + void thread::start_thread(const attributes& attr) { - detach(); + thread_info->self=thread_info; + const attributes::native_handle_type* h = attr.native_handle(); + int res = pthread_create(&thread_info->thread_handle, h, &thread_proxy, thread_info.get()); + if (res != 0) + { + thread_info->self.reset(); + boost::throw_exception(thread_resource_error()); + } + int detached_state; + res = pthread_attr_getdetachstate(h, &detached_state); + if (res != 0) + { + thread_info->self.reset(); + boost::throw_exception(thread_resource_error()); + } + if (PTHREAD_CREATE_DETACHED==detached_state) + { + detail::thread_data_ptr local_thread_info; + thread_info.swap(local_thread_info); + + if(local_thread_info) + { + //lock_guard<mutex> lock(local_thread_info->data_mutex); + if(!local_thread_info->join_started) + { + //BOOST_VERIFY(!pthread_detach(local_thread_info->thread_handle)); + local_thread_info->join_started=true; + local_thread_info->joined=true; + } + } + } } + + detail::thread_data_ptr thread::get_thread_info BOOST_PREVENT_MACRO_SUBSTITUTION () const { return thread_info; @@ -203,11 +272,15 @@ namespace boost void thread::join() { + if (this_thread::get_id() == get_id()) + { + boost::throw_exception(thread_resource_error(system::errc::resource_deadlock_would_occur, "boost thread: trying joining itself")); + } detail::thread_data_ptr const local_thread_info=(get_thread_info)(); if(local_thread_info) { bool do_join=false; - + { unique_lock<mutex> lock(local_thread_info->data_mutex); while(!local_thread_info->done) @@ -215,7 +288,7 @@ namespace boost local_thread_info->done_condition.wait(lock); } do_join=!local_thread_info->join_started; - + if(do_join) { local_thread_info->join_started=true; @@ -236,32 +309,42 @@ namespace boost local_thread_info->joined=true; local_thread_info->done_condition.notify_all(); } - + if(thread_info==local_thread_info) { thread_info.reset(); } } + else + { +#ifdef BOOST_THREAD_THROW_IF_PRECONDITION_NOT_SATISFIED + boost::throw_exception(thread_resource_error(system::errc::invalid_argument, "boost thread: thread not joinable")); +#endif + } } - bool thread::timed_join(system_time const& wait_until) + bool thread::do_try_join_until(struct timespec const &timeout) { + if (this_thread::get_id() == get_id()) + { + boost::throw_exception(thread_resource_error(system::errc::resource_deadlock_would_occur, "boost thread: trying joining itself")); + } detail::thread_data_ptr const local_thread_info=(get_thread_info)(); if(local_thread_info) { bool do_join=false; - + { unique_lock<mutex> lock(local_thread_info->data_mutex); while(!local_thread_info->done) { - if(!local_thread_info->done_condition.timed_wait(lock,wait_until)) + if(!local_thread_info->done_condition.do_timed_wait(lock,timeout)) { return false; } } do_join=!local_thread_info->join_started; - + if(do_join) { local_thread_info->join_started=true; @@ -282,16 +365,22 @@ namespace boost local_thread_info->joined=true; local_thread_info->done_condition.notify_all(); } - + if(thread_info==local_thread_info) { thread_info.reset(); } + return true; + } + else + { +#ifdef BOOST_THREAD_THROW_IF_PRECONDITION_NOT_SATISFIED + boost::throw_exception(thread_resource_error(system::errc::invalid_argument, "boost thread: thread not joinable")); +#endif } - return true; } - bool thread::joinable() const + bool thread::joinable() const BOOST_NOEXCEPT { return (get_thread_info)(); } @@ -301,7 +390,7 @@ namespace boost { detail::thread_data_ptr local_thread_info; thread_info.swap(local_thread_info); - + if(local_thread_info) { lock_guard<mutex> lock(local_thread_info->data_mutex); @@ -316,20 +405,24 @@ namespace boost namespace this_thread { - + +#ifdef __DECXXX + /// Workaround of DECCXX issue of incorrect template substitution + template<> +#endif void sleep(const system_time& st) { detail::thread_data_base* const thread_info=detail::get_current_thread_data(); - + if(thread_info) { unique_lock<mutex> lk(thread_info->sleep_mutex); - while(thread_info->sleep_condition.timed_wait(lk,st)); + while(thread_info->sleep_condition.timed_wait(lk,st)) {} } else { xtime const xt=get_xtime(st); - + for (int foo=0; foo < 5; ++foo) { # if defined(BOOST_HAS_PTHREAD_DELAY_NP) @@ -339,7 +432,7 @@ namespace boost # elif defined(BOOST_HAS_NANOSLEEP) timespec ts; to_timespec_duration(xt, ts); - + // nanosleep takes a timespec that is an offset, not // an absolute time. nanosleep(&ts, 0); @@ -350,14 +443,14 @@ namespace boost cond.timed_wait(lock, xt); # endif xtime cur; - xtime_get(&cur, TIME_UTC); + xtime_get(&cur, TIME_UTC_); if (xtime_cmp(xt, cur) <= 0) return; } } } - void yield() + void yield() BOOST_NOEXCEPT { # if defined(BOOST_HAS_SCHED_YIELD) BOOST_VERIFY(!sched_yield()); @@ -365,13 +458,12 @@ namespace boost BOOST_VERIFY(!pthread_yield()); # else xtime xt; - xtime_get(&xt, TIME_UTC); + xtime_get(&xt, TIME_UTC_); sleep(xt); # endif } } - - unsigned thread::hardware_concurrency() + unsigned thread::hardware_concurrency() BOOST_NOEXCEPT { #if defined(PTW32_VERSION) || defined(__hpux) return pthread_num_processors_np(); @@ -382,15 +474,19 @@ namespace boost #elif defined(BOOST_HAS_UNISTD_H) && defined(_SC_NPROCESSORS_ONLN) int const count=sysconf(_SC_NPROCESSORS_ONLN); return (count>0)?count:0; -#elif defined(_GNU_SOURCE) +#elif defined(__GLIBC__) return get_nprocs(); #else return 0; #endif } - thread::id thread::get_id() const + thread::id thread::get_id() const BOOST_NOEXCEPT { + #if defined BOOST_THREAD_PROVIDES_BASIC_THREAD_ID + //return local_thread_info->thread_handle; + return const_cast<thread*>(this)->native_handle(); + #else detail::thread_data_ptr const local_thread_info=(get_thread_info)(); if(local_thread_info) { @@ -398,8 +494,9 @@ namespace boost } else { - return id(); + return id(); } + #endif } void thread::interrupt() @@ -417,7 +514,7 @@ namespace boost } } - bool thread::interruption_requested() const + bool thread::interruption_requested() const BOOST_NOEXCEPT { detail::thread_data_ptr const local_thread_info=(get_thread_info)(); if(local_thread_info) @@ -444,19 +541,24 @@ namespace boost return pthread_t(); } } - - + + namespace this_thread { - thread::id get_id() + thread::id get_id() BOOST_NOEXCEPT { + #if defined BOOST_THREAD_PROVIDES_BASIC_THREAD_ID + return pthread_self(); + #else boost::detail::thread_data_base* const thread_info=get_or_make_current_thread_data(); return thread::id(thread_info?thread_info->shared_from_this():detail::thread_data_ptr()); + #endif } void interruption_point() { +#ifndef BOOST_NO_EXCEPTIONS boost::detail::thread_data_base* const thread_info=detail::get_current_thread_data(); if(thread_info && thread_info->interrupt_enabled) { @@ -467,15 +569,16 @@ namespace boost throw thread_interrupted(); } } +#endif } - - bool interruption_enabled() + + bool interruption_enabled() BOOST_NOEXCEPT { boost::detail::thread_data_base* const thread_info=detail::get_current_thread_data(); return thread_info && thread_info->interrupt_enabled; } - - bool interruption_requested() + + bool interruption_requested() BOOST_NOEXCEPT { boost::detail::thread_data_base* const thread_info=detail::get_current_thread_data(); if(!thread_info) @@ -489,7 +592,7 @@ namespace boost } } - disable_interruption::disable_interruption(): + disable_interruption::disable_interruption() BOOST_NOEXCEPT: interruption_was_enabled(interruption_enabled()) { if(interruption_was_enabled) @@ -497,8 +600,8 @@ namespace boost detail::get_current_thread_data()->interrupt_enabled=false; } } - - disable_interruption::~disable_interruption() + + disable_interruption::~disable_interruption() BOOST_NOEXCEPT { if(detail::get_current_thread_data()) { @@ -506,15 +609,15 @@ namespace boost } } - restore_interruption::restore_interruption(disable_interruption& d) + restore_interruption::restore_interruption(disable_interruption& d) BOOST_NOEXCEPT { if(d.interruption_was_enabled) { detail::get_current_thread_data()->interrupt_enabled=true; } } - - restore_interruption::~restore_interruption() + + restore_interruption::~restore_interruption() BOOST_NOEXCEPT { if(detail::get_current_thread_data()) { @@ -545,7 +648,7 @@ namespace boost return ¤t_node->second; } } - return NULL; + return 0; } void* get_tss_data(void const* key) @@ -554,7 +657,7 @@ namespace boost { return current_node->value; } - return NULL; + return 0; } void add_new_tss_node(void const* key, @@ -570,7 +673,7 @@ namespace boost detail::thread_data_base* const current_thread_data(get_or_make_current_thread_data()); current_thread_data->tss_data.erase(key); } - + void set_tss_data(void const* key, boost::shared_ptr<tss_cleanup_function> func, void* tss_data,bool cleanup_existing) @@ -591,12 +694,21 @@ namespace boost erase_tss_node(key); } } - else + else if(func || (tss_data!=0)) { add_new_tss_node(key,func,tss_data); } } } + BOOST_THREAD_DECL void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk) + { + detail::thread_data_base* const current_thread_data(detail::get_current_thread_data()); + if(current_thread_data) + { + current_thread_data->notify_all_at_thread_exit(&cond, lk.release()); + } + } + } diff --git a/3rdParty/Boost/src/libs/thread/src/pthread/timeconv.inl b/3rdParty/Boost/src/libs/thread/src/pthread/timeconv.inl index b75a135..cab7c55 100644 --- a/3rdParty/Boost/src/libs/thread/src/pthread/timeconv.inl +++ b/3rdParty/Boost/src/libs/thread/src/pthread/timeconv.inl @@ -20,8 +20,8 @@ const int NANOSECONDS_PER_MICROSECOND = 1000; inline void to_time(int milliseconds, boost::xtime& xt) { int res = 0; - res = boost::xtime_get(&xt, boost::TIME_UTC); - BOOST_ASSERT(res == boost::TIME_UTC); + res = boost::xtime_get(&xt, boost::TIME_UTC_); + BOOST_ASSERT(res == boost::TIME_UTC_); (void)res; xt.sec += (milliseconds / MILLISECONDS_PER_SECOND); xt.nsec += ((milliseconds % MILLISECONDS_PER_SECOND) * @@ -33,7 +33,6 @@ inline void to_time(int milliseconds, boost::xtime& xt) xt.nsec -= NANOSECONDS_PER_SECOND; } } - #if defined(BOOST_HAS_PTHREADS) inline void to_timespec(const boost::xtime& xt, timespec& ts) { @@ -57,8 +56,8 @@ inline void to_timespec_duration(const boost::xtime& xt, timespec& ts) { boost::xtime cur; int res = 0; - res = boost::xtime_get(&cur, boost::TIME_UTC); - BOOST_ASSERT(res == boost::TIME_UTC); + res = boost::xtime_get(&cur, boost::TIME_UTC_); + BOOST_ASSERT(res == boost::TIME_UTC_); (void)res; if (boost::xtime_cmp(xt, cur) <= 0) { @@ -88,8 +87,8 @@ inline void to_duration(boost::xtime xt, int& milliseconds) { boost::xtime cur; int res = 0; - res = boost::xtime_get(&cur, boost::TIME_UTC); - BOOST_ASSERT(res == boost::TIME_UTC); + res = boost::xtime_get(&cur, boost::TIME_UTC_); + BOOST_ASSERT(res == boost::TIME_UTC_); (void)res; if (boost::xtime_cmp(xt, cur) <= 0) milliseconds = 0; @@ -110,8 +109,8 @@ inline void to_microduration(boost::xtime xt, int& microseconds) { boost::xtime cur; int res = 0; - res = boost::xtime_get(&cur, boost::TIME_UTC); - BOOST_ASSERT(res == boost::TIME_UTC); + res = boost::xtime_get(&cur, boost::TIME_UTC_); + BOOST_ASSERT(res == boost::TIME_UTC_); (void)res; if (boost::xtime_cmp(xt, cur) <= 0) microseconds = 0; diff --git a/3rdParty/Boost/src/libs/thread/src/tss_null.cpp b/3rdParty/Boost/src/libs/thread/src/tss_null.cpp index e93ba0f..b5029f1 100644 --- a/3rdParty/Boost/src/libs/thread/src/tss_null.cpp +++ b/3rdParty/Boost/src/libs/thread/src/tss_null.cpp @@ -8,7 +8,7 @@ #if defined(BOOST_HAS_WINTHREADS) && (defined(BOOST_THREAD_BUILD_LIB) || defined(BOOST_THREAD_TEST) || defined(UNDER_CE)) && (!defined(_MSC_VER) || defined(UNDER_CE)) -namespace boost +namespace boost { /* This file is a "null" implementation of tss cleanup; it's @@ -32,7 +32,7 @@ namespace boost longer needed and can be removed. */ } - + } #endif //defined(BOOST_HAS_WINTHREADS) && defined(BOOST_THREAD_BUILD_LIB) && !defined(_MSC_VER) diff --git a/3rdParty/Boost/src/libs/thread/src/win32/thread.cpp b/3rdParty/Boost/src/libs/thread/src/win32/thread.cpp index 05c7a6c..5a26f5e 100644 --- a/3rdParty/Boost/src/libs/thread/src/win32/thread.cpp +++ b/3rdParty/Boost/src/libs/thread/src/win32/thread.cpp @@ -4,29 +4,60 @@ // (C) Copyright 2007 Anthony Williams // (C) Copyright 2007 David Deakins +#ifndef _WIN32_WINNT #define _WIN32_WINNT 0x400 +#endif + +#ifndef WINVER #define WINVER 0x400 +#endif #include <boost/thread/thread.hpp> -#include <algorithm> -#include <windows.h> -#ifndef UNDER_CE -#include <process.h> -#endif -#include <stdio.h> #include <boost/thread/once.hpp> #include <boost/thread/tss.hpp> +#include <boost/thread/condition_variable.hpp> +#include <boost/thread/detail/tss_hooks.hpp> + #include <boost/assert.hpp> #include <boost/throw_exception.hpp> -#include <boost/thread/detail/tss_hooks.hpp> #include <boost/date_time/posix_time/conversion.hpp> +#include <memory> +#include <algorithm> +#ifndef UNDER_CE +#include <process.h> +#endif +#include <stdio.h> +#include <windows.h> + namespace boost { + namespace detail + { + thread_data_base::~thread_data_base() + { + { + for (notify_list_t::iterator i = notify.begin(), e = notify.end(); + i != e; ++i) + { + i->second->unlock(); + i->first->notify_all(); + } + } + } + } namespace { +#ifdef BOOST_THREAD_PROVIDES_ONCE_CXX11 + boost::once_flag current_thread_tls_init_flag; +#else boost::once_flag current_thread_tls_init_flag=BOOST_ONCE_INIT; - DWORD current_thread_tls_key=0; +#endif +#if defined(UNDER_CE) + // Windows CE does not define the TLS_OUT_OF_INDEXES constant. +#define TLS_OUT_OF_INDEXES 0xFFFFFFFF +#endif + DWORD current_thread_tls_key=TLS_OUT_OF_INDEXES; void create_current_thread_tls_key() { @@ -37,16 +68,16 @@ namespace boost void cleanup_tls_key() { - if(current_thread_tls_key) + if(current_thread_tls_key!=TLS_OUT_OF_INDEXES) { TlsFree(current_thread_tls_key); - current_thread_tls_key=0; + current_thread_tls_key=TLS_OUT_OF_INDEXES; } } detail::thread_data_base* get_current_thread_data() { - if(!current_thread_tls_key) + if(current_thread_tls_key==TLS_OUT_OF_INDEXES) { return 0; } @@ -56,13 +87,13 @@ namespace boost void set_current_thread_data(detail::thread_data_base* new_data) { boost::call_once(current_thread_tls_init_flag,create_current_thread_tls_key); - if(current_thread_tls_key) + if(current_thread_tls_key!=TLS_OUT_OF_INDEXES) BOOST_VERIFY(TlsSetValue(current_thread_tls_key,new_data)); else boost::throw_exception(thread_resource_error()); } -#ifdef BOOST_NO_THREADEX +#ifndef BOOST_HAS_THREADEX // Windows CE doesn't define _beginthreadex struct ThreadProxyData @@ -75,22 +106,25 @@ namespace boost DWORD WINAPI ThreadProxy(LPVOID args) { - ThreadProxyData* data=reinterpret_cast<ThreadProxyData*>(args); + std::auto_ptr<ThreadProxyData> data(reinterpret_cast<ThreadProxyData*>(args)); DWORD ret=data->start_address_(data->arglist_); - delete data; return ret; } - + typedef void* uintptr_t; - inline uintptr_t const _beginthreadex(void* security, unsigned stack_size, unsigned (__stdcall* start_address)(void*), + inline uintptr_t _beginthreadex(void* security, unsigned stack_size, unsigned (__stdcall* start_address)(void*), void* arglist, unsigned initflag, unsigned* thrdaddr) { DWORD threadID; + ThreadProxyData* data = new ThreadProxyData(start_address,arglist); HANDLE hthread=CreateThread(static_cast<LPSECURITY_ATTRIBUTES>(security),stack_size,ThreadProxy, - new ThreadProxyData(start_address,arglist),initflag,&threadID); - if (hthread!=0) - *thrdaddr=threadID; + data,initflag,&threadID); + if (hthread==0) { + delete data; + return 0; + } + *thrdaddr=threadID; return reinterpret_cast<uintptr_t const>(hthread); } @@ -111,19 +145,6 @@ namespace boost {} }; - struct tss_data_node - { - void const* key; - boost::shared_ptr<boost::detail::tss_cleanup_function> func; - void* value; - tss_data_node* next; - - tss_data_node(void const* key_,boost::shared_ptr<boost::detail::tss_cleanup_function> func_,void* value_, - tss_data_node* next_): - key(key_),func(func_),value(value_),next(next_) - {} - }; - } namespace @@ -133,7 +154,7 @@ namespace boost detail::thread_data_ptr current_thread_data(get_current_thread_data(),false); if(current_thread_data) { - while(current_thread_data->tss_data || current_thread_data->thread_exit_callbacks) + while(! current_thread_data->tss_data.empty() || current_thread_data->thread_exit_callbacks) { while(current_thread_data->thread_exit_callbacks) { @@ -146,36 +167,43 @@ namespace boost } boost::detail::heap_delete(current_node); } - while(current_thread_data->tss_data) + for(std::map<void const*,detail::tss_data_node>::iterator next=current_thread_data->tss_data.begin(), + current, + end=current_thread_data->tss_data.end(); + next!=end;) { - detail::tss_data_node* const current_node=current_thread_data->tss_data; - current_thread_data->tss_data=current_node->next; - if(current_node->func) + current=next; + ++next; + if(current->second.func && (current->second.value!=0)) { - (*current_node->func)(current_node->value); + (*current->second.func)(current->second.value); } - boost::detail::heap_delete(current_node); + current_thread_data->tss_data.erase(current); } } - + set_current_thread_data(0); } } - + unsigned __stdcall thread_start_function(void* param) { detail::thread_data_base* const thread_info(reinterpret_cast<detail::thread_data_base*>(param)); set_current_thread_data(thread_info); - try +#ifndef BOOST_NO_EXCEPTIONS + try // BOOST_NO_EXCEPTIONS protected +#endif { thread_info->run(); } - catch(thread_interrupted const&) +#ifndef BOOST_NO_EXCEPTIONS + catch(thread_interrupted const&) // BOOST_NO_EXCEPTIONS protected { } +#endif // Removed as it stops the debugger identifying the cause of the exception // Unhandled exceptions still cause the application to terminate -// catch(...) +// catch(...) // BOOST_NO_EXCEPTIONS protected // { // std::terminate(); // } @@ -184,7 +212,7 @@ namespace boost } } - thread::thread() + thread::thread() BOOST_NOEXCEPT {} void thread::start_thread() @@ -199,6 +227,19 @@ namespace boost ResumeThread(thread_info->thread_handle); } + void thread::start_thread(const attributes& attr) + { + //uintptr_t const new_thread=_beginthreadex(attr.get_security(),attr.get_stack_size(),&thread_start_function,thread_info.get(),CREATE_SUSPENDED,&thread_info->id); + uintptr_t const new_thread=_beginthreadex(0,static_cast<unsigned int>(attr.get_stack_size()),&thread_start_function,thread_info.get(),CREATE_SUSPENDED,&thread_info->id); + if(!new_thread) + { + boost::throw_exception(thread_resource_error()); + } + intrusive_ptr_add_ref(thread_info.get()); + thread_info->thread_handle=(detail::win32::handle)(new_thread); + ResumeThread(thread_info->thread_handle); + } + thread::thread(detail::thread_data_ptr data): thread_info(data) {} @@ -213,9 +254,12 @@ namespace boost ++count; interruption_enabled=false; } - + void run() {} + void notify_all_at_thread_exit(condition_variable*, mutex*) + {} + private: externally_launched_thread(externally_launched_thread&); void operator=(externally_launched_thread&); @@ -224,15 +268,19 @@ namespace boost void make_external_thread_data() { externally_launched_thread* me=detail::heap_new<externally_launched_thread>(); - try +#ifndef BOOST_NO_EXCEPTIONS + try // BOOST_NO_EXCEPTIONS protected +#endif { set_current_thread_data(me); } - catch(...) +#ifndef BOOST_NO_EXCEPTIONS + catch(...) // BOOST_NO_EXCEPTIONS protected { detail::heap_delete(me); - throw; + throw; // BOOST_NO_EXCEPTIONS protected } +#endif } detail::thread_data_base* get_or_make_current_thread_data() @@ -245,48 +293,73 @@ namespace boost } return current_thread_data; } - - } - thread::~thread() - { - detach(); } - - thread::id thread::get_id() const + + thread::id thread::get_id() const BOOST_NOEXCEPT { + #if defined BOOST_THREAD_PROVIDES_BASIC_THREAD_ID + detail::thread_data_ptr local_thread_info=(get_thread_info)(); + return local_thread_info?local_thread_info->id:0; + //return const_cast<thread*>(this)->native_handle(); + #else return thread::id((get_thread_info)()); + #endif } - bool thread::joinable() const + bool thread::joinable() const BOOST_NOEXCEPT { return (get_thread_info)(); } - void thread::join() { + if (this_thread::get_id() == get_id()) + { + boost::throw_exception(thread_resource_error(system::errc::resource_deadlock_would_occur, "boost thread: trying joining itself")); + } detail::thread_data_ptr local_thread_info=(get_thread_info)(); if(local_thread_info) { this_thread::interruptible_wait(local_thread_info->thread_handle,detail::timeout::sentinel()); release_handle(); } + else + { +#ifdef BOOST_THREAD_THROW_IF_PRECONDITION_NOT_SATISFIED + boost::throw_exception(thread_resource_error(system::errc::invalid_argument, "boost thread: thread not joinable")); +#endif + } } bool thread::timed_join(boost::system_time const& wait_until) { - detail::thread_data_ptr local_thread_info=(get_thread_info)(); - if(local_thread_info) - { - if(!this_thread::interruptible_wait(local_thread_info->thread_handle,get_milliseconds_until(wait_until))) - { - return false; - } - release_handle(); - } - return true; + return do_try_join_until(get_milliseconds_until(wait_until)); } - + + bool thread::do_try_join_until(uintmax_t milli) + { + if (this_thread::get_id() == get_id()) + { + boost::throw_exception(thread_resource_error(system::errc::resource_deadlock_would_occur, "boost thread: trying joining itself")); + } + detail::thread_data_ptr local_thread_info=(get_thread_info)(); + if(local_thread_info) + { + if(!this_thread::interruptible_wait(local_thread_info->thread_handle,milli)) + { + return false; + } + release_handle(); + return true; + } + else + { +#ifdef BOOST_THREAD_THROW_IF_PRECONDITION_NOT_SATISFIED + boost::throw_exception(thread_resource_error(system::errc::invalid_argument, "boost thread: thread not joinable")); +#endif + } + } + void thread::detach() { release_handle(); @@ -296,7 +369,7 @@ namespace boost { thread_info=0; } - + void thread::interrupt() { detail::thread_data_ptr local_thread_info=(get_thread_info)(); @@ -305,20 +378,20 @@ namespace boost local_thread_info->interrupt(); } } - - bool thread::interruption_requested() const + + bool thread::interruption_requested() const BOOST_NOEXCEPT { detail::thread_data_ptr local_thread_info=(get_thread_info)(); return local_thread_info.get() && (detail::win32::WaitForSingleObject(local_thread_info->interruption_handle,0)==0); } - - unsigned thread::hardware_concurrency() + + unsigned thread::hardware_concurrency() BOOST_NOEXCEPT { SYSTEM_INFO info={{0}}; GetSystemInfo(&info); return info.dwNumberOfProcessors; } - + thread::native_handle_type thread::native_handle() { detail::thread_data_ptr local_thread_info=(get_thread_info)(); @@ -369,7 +442,7 @@ namespace boost target_time.abs_time.time_of_day().ticks_per_second(); if(ticks_per_second>hundred_nanoseconds_in_one_second) { - posix_time::time_duration::tick_type const + posix_time::time_duration::tick_type const ticks_per_hundred_nanoseconds= ticks_per_second/hundred_nanoseconds_in_one_second; due_time.QuadPart+= @@ -387,7 +460,7 @@ namespace boost return due_time; } } - + bool interruptible_wait(detail::win32::handle handle_to_wait_for,detail::timeout target_time) { @@ -408,10 +481,10 @@ namespace boost } detail::win32::handle_manager timer_handle; - + #ifndef UNDER_CE unsigned const min_timer_wait_period=20; - + if(!target_time.is_sentinel()) { detail::timeout::remaining_time const time_left=target_time.remaining_milliseconds(); @@ -422,7 +495,7 @@ namespace boost if(timer_handle!=0) { LARGE_INTEGER due_time=get_due_time(target_time); - + bool const set_time_succeeded=SetWaitableTimer(timer_handle,&due_time,0,0,0,false)!=0; if(set_time_succeeded) { @@ -438,17 +511,17 @@ namespace boost } } #endif - + bool const using_timer=timeout_index!=~0u; detail::timeout::remaining_time time_left(0); - + do { if(!using_timer) { time_left=target_time.remaining_milliseconds(); } - + if(handle_count) { unsigned long const notified_index=detail::win32::WaitForMultipleObjects(handle_count,handles,false,using_timer?INFINITE:time_left.milliseconds); @@ -482,9 +555,14 @@ namespace boost return false; } - thread::id get_id() + thread::id get_id() BOOST_NOEXCEPT { + #if defined BOOST_THREAD_PROVIDES_BASIC_THREAD_ID + //return detail::win32::GetCurrentThread(); + return detail::win32::GetCurrentThreadId(); + #else return thread::id(get_or_make_current_thread_data()); + #endif } void interruption_point() @@ -495,23 +573,23 @@ namespace boost throw thread_interrupted(); } } - - bool interruption_enabled() + + bool interruption_enabled() BOOST_NOEXCEPT { return get_current_thread_data() && get_current_thread_data()->interruption_enabled; } - - bool interruption_requested() + + bool interruption_requested() BOOST_NOEXCEPT { return get_current_thread_data() && (detail::win32::WaitForSingleObject(get_current_thread_data()->interruption_handle,0)==0); } - void yield() + void yield() BOOST_NOEXCEPT { detail::win32::Sleep(0); } - - disable_interruption::disable_interruption(): + + disable_interruption::disable_interruption() BOOST_NOEXCEPT: interruption_was_enabled(interruption_enabled()) { if(interruption_was_enabled) @@ -519,8 +597,8 @@ namespace boost get_current_thread_data()->interruption_enabled=false; } } - - disable_interruption::~disable_interruption() + + disable_interruption::~disable_interruption() BOOST_NOEXCEPT { if(get_current_thread_data()) { @@ -528,15 +606,15 @@ namespace boost } } - restore_interruption::restore_interruption(disable_interruption& d) + restore_interruption::restore_interruption(disable_interruption& d) BOOST_NOEXCEPT { if(d.interruption_was_enabled) { get_current_thread_data()->interruption_enabled=true; } } - - restore_interruption::~restore_interruption() + + restore_interruption::~restore_interruption() BOOST_NOEXCEPT { if(get_current_thread_data()) { @@ -561,14 +639,11 @@ namespace boost detail::thread_data_base* const current_thread_data(get_current_thread_data()); if(current_thread_data) { - detail::tss_data_node* current_node=current_thread_data->tss_data; - while(current_node) + std::map<void const*,tss_data_node>::iterator current_node= + current_thread_data->tss_data.find(key); + if(current_node!=current_thread_data->tss_data.end()) { - if(current_node->key==key) - { - return current_node; - } - current_node=current_node->next; + return ¤t_node->second; } } return NULL; @@ -582,24 +657,44 @@ namespace boost } return NULL; } - - void set_tss_data(void const* key,boost::shared_ptr<tss_cleanup_function> func,void* tss_data,bool cleanup_existing) + + void add_new_tss_node(void const* key, + boost::shared_ptr<tss_cleanup_function> func, + void* tss_data) + { + detail::thread_data_base* const current_thread_data(get_or_make_current_thread_data()); + current_thread_data->tss_data.insert(std::make_pair(key,tss_data_node(func,tss_data))); + } + + void erase_tss_node(void const* key) + { + detail::thread_data_base* const current_thread_data(get_or_make_current_thread_data()); + current_thread_data->tss_data.erase(key); + } + + void set_tss_data(void const* key, + boost::shared_ptr<tss_cleanup_function> func, + void* tss_data,bool cleanup_existing) { if(tss_data_node* const current_node=find_tss_data(key)) { - if(cleanup_existing && current_node->func.get() && current_node->value) + if(cleanup_existing && current_node->func && (current_node->value!=0)) { (*current_node->func)(current_node->value); } - current_node->func=func; - current_node->value=tss_data; + if(func || (tss_data!=0)) + { + current_node->func=func; + current_node->value=tss_data; + } + else + { + erase_tss_node(key); + } } - else if(func && tss_data) + else if(func || (tss_data!=0)) { - detail::thread_data_base* const current_thread_data(get_or_make_current_thread_data()); - tss_data_node* const new_node= - heap_new<tss_data_node>(key,func,tss_data,current_thread_data->tss_data); - current_thread_data->tss_data=new_node; + add_new_tss_node(key,func,tss_data); } } } @@ -619,6 +714,14 @@ namespace boost boost::run_thread_exit_callbacks(); } + BOOST_THREAD_DECL void notify_all_at_thread_exit(condition_variable& cond, unique_lock<mutex> lk) + { + detail::thread_data_base* const current_thread_data(get_current_thread_data()); + if(current_thread_data) + { + current_thread_data->notify_all_at_thread_exit(&cond, lk.release()); + } + } } diff --git a/3rdParty/Boost/src/libs/thread/src/win32/timeconv.inl b/3rdParty/Boost/src/libs/thread/src/win32/timeconv.inl index 5ec3b17..c646783 100644 --- a/3rdParty/Boost/src/libs/thread/src/win32/timeconv.inl +++ b/3rdParty/Boost/src/libs/thread/src/win32/timeconv.inl @@ -17,8 +17,8 @@ const int NANOSECONDS_PER_MICROSECOND = 1000; inline void to_time(int milliseconds, boost::xtime& xt) { int res = 0; - res = boost::xtime_get(&xt, boost::TIME_UTC); - assert(res == boost::TIME_UTC); + res = boost::xtime_get(&xt, boost::TIME_UTC_); + assert(res == boost::TIME_UTC_); xt.sec += (milliseconds / MILLISECONDS_PER_SECOND); xt.nsec += ((milliseconds % MILLISECONDS_PER_SECOND) * @@ -54,8 +54,8 @@ inline void to_timespec_duration(const boost::xtime& xt, timespec& ts) { boost::xtime cur; int res = 0; - res = boost::xtime_get(&cur, boost::TIME_UTC); - assert(res == boost::TIME_UTC); + res = boost::xtime_get(&cur, boost::TIME_UTC_); + assert(res == boost::TIME_UTC_); if (boost::xtime_cmp(xt, cur) <= 0) { @@ -85,8 +85,8 @@ inline void to_duration(boost::xtime xt, int& milliseconds) { boost::xtime cur; int res = 0; - res = boost::xtime_get(&cur, boost::TIME_UTC); - assert(res == boost::TIME_UTC); + res = boost::xtime_get(&cur, boost::TIME_UTC_); + assert(res == boost::TIME_UTC_); if (boost::xtime_cmp(xt, cur) <= 0) milliseconds = 0; @@ -107,8 +107,8 @@ inline void to_microduration(boost::xtime xt, int& microseconds) { boost::xtime cur; int res = 0; - res = boost::xtime_get(&cur, boost::TIME_UTC); - assert(res == boost::TIME_UTC); + res = boost::xtime_get(&cur, boost::TIME_UTC_); + assert(res == boost::TIME_UTC_); if (boost::xtime_cmp(xt, cur) <= 0) microseconds = 0; diff --git a/3rdParty/Boost/src/libs/thread/src/win32/tss_dll.cpp b/3rdParty/Boost/src/libs/thread/src/win32/tss_dll.cpp index 9699a12..2dc019f 100644 --- a/3rdParty/Boost/src/libs/thread/src/win32/tss_dll.cpp +++ b/3rdParty/Boost/src/libs/thread/src/win32/tss_dll.cpp @@ -5,6 +5,7 @@ #include <boost/thread/detail/config.hpp> + #if defined(BOOST_HAS_WINTHREADS) && defined(BOOST_THREAD_BUILD_DLL) #include <boost/thread/detail/tss_hooks.hpp> diff --git a/3rdParty/Boost/src/libs/thread/src/win32/tss_pe.cpp b/3rdParty/Boost/src/libs/thread/src/win32/tss_pe.cpp index 8ef045b..1654b19 100644 --- a/3rdParty/Boost/src/libs/thread/src/win32/tss_pe.cpp +++ b/3rdParty/Boost/src/libs/thread/src/win32/tss_pe.cpp @@ -1,4 +1,4 @@ -// $Id: tss_pe.cpp 66259 2010-10-29 23:27:00Z anthonyw $ +// $Id: tss_pe.cpp 79373 2012-07-09 05:55:01Z viboes $ // (C) Copyright Aaron W. LaFramboise, Roland Schwarz, Michael Glassford 2004. // (C) Copyright 2007 Roland Schwarz // (C) Copyright 2007 Anthony Williams @@ -11,7 +11,7 @@ #if defined(BOOST_HAS_WINTHREADS) && defined(BOOST_THREAD_BUILD_LIB) -#if defined(__MINGW32__) && !defined(_WIN64) +#if (defined(__MINGW32__) && !defined(_WIN64)) || defined(__MINGW64__) || (__MINGW64_VERSION_MAJOR) #include <boost/thread/detail/tss_hooks.hpp> @@ -25,7 +25,7 @@ namespace boost } namespace { - void NTAPI on_tls_callback(void* h, DWORD dwReason, PVOID pv) + void NTAPI on_tls_callback(void* , DWORD dwReason, PVOID ) { switch (dwReason) { @@ -38,7 +38,8 @@ namespace { } } -#if (__MINGW32_MAJOR_VERSION >3) || ((__MINGW32_MAJOR_VERSION==3) && (__MINGW32_MINOR_VERSION>=18)) +#if defined(__MINGW64__) || (__MINGW64_VERSION_MAJOR) || (__MINGW32_MAJOR_VERSION >3) || \ + ((__MINGW32_MAJOR_VERSION==3) && (__MINGW32_MINOR_VERSION>=18)) extern "C" { PIMAGE_TLS_CALLBACK __crt_xl_tls_callback__ __attribute__ ((section(".CRT$XLB"))) = on_tls_callback; diff --git a/3rdParty/Boost/src/tools/bcp/add_path.cpp b/3rdParty/Boost/src/tools/bcp/add_path.cpp index 2ed4a94..3643bdb 100644 --- a/3rdParty/Boost/src/tools/bcp/add_path.cpp +++ b/3rdParty/Boost/src/tools/bcp/add_path.cpp @@ -193,6 +193,14 @@ void bcp_implementation::add_file(const fs::path& p) // static const std::pair<fs::path, fs::path> specials[] = { + std::pair<fs::path, fs::path>("boost/filesystem/convenience.hpp", "boost/filesystem.hpp"), + std::pair<fs::path, fs::path>("boost/filesystem/exception.hpp", "boost/filesystem.hpp"), + std::pair<fs::path, fs::path>("boost/filesystem/fstream.hpp", "boost/filesystem.hpp"), + std::pair<fs::path, fs::path>("boost/filesystem/operations.hpp", "boost/filesystem.hpp"), + std::pair<fs::path, fs::path>("boost/filesystem/path.hpp", "boost/filesystem.hpp"), + std::pair<fs::path, fs::path>("boost/filesystem.hpp", "libs/filesystem/build"), + std::pair<fs::path, fs::path>("boost/filesystem.hpp", "libs/filesystem/v2"), + std::pair<fs::path, fs::path>("boost/filesystem.hpp", "libs/filesystem/v3"), std::pair<fs::path, fs::path>("boost/config.hpp", "boost/config"), std::pair<fs::path, fs::path>("tools/build/allyourbase.jam", "Jamrules"), std::pair<fs::path, fs::path>("tools/build/allyourbase.jam", "project-root.jam"), @@ -204,6 +212,12 @@ static const std::pair<fs::path, fs::path> std::pair<fs::path, fs::path>("tools/build/v2/boost-build.jam", "project-root.jam"), std::pair<fs::path, fs::path>("tools/build/v2/boost-build.jam", "boost-build.jam"), std::pair<fs::path, fs::path>("tools/build/v2/boost-build.jam", "Jamfile.v2"), + std::pair<fs::path, fs::path>("tools/build/v2/boost-build.jam", "boostcpp.jam"), + std::pair<fs::path, fs::path>("tools/build/v2/boost-build.jam", "bootstrap.bat"), + std::pair<fs::path, fs::path>("tools/build/v2/boost-build.jam", "bootstrap.sh"), + std::pair<fs::path, fs::path>("tools/build/v2/boost-build.jam", "Jamroot"), + std::pair<fs::path, fs::path>("tools/build/v2/boost-build.jam", "INSTALL"), + std::pair<fs::path, fs::path>("tools/build/v2/boost-build.jam", "LICENSE_1_0.txt"), std::pair<fs::path, fs::path>("boost/preprocessor/iterate.hpp", "boost/preprocessor/iteration"), std::pair<fs::path, fs::path>("boost/preprocessor/slot/slot.hpp", "boost/preprocessor/slot/detail"), std::pair<fs::path, fs::path>("boost/function.hpp", "boost/function/detail"), @@ -321,7 +335,7 @@ void bcp_implementation::add_file_dependencies(const fs::path& p, bool scanfile) // Now we need to scan for Boost.Preprocessor includes that // are included via preprocessor iteration: // - static const boost::regex ppfiles("^[[:blank:]]*#[[:blank:]]*define[[:blank:]]+(?:BOOST_PP_FILENAME|BOOST_PP_ITERATION_PARAMS|BOOST_PP_INDIRECT_SELF)[^\\n]+?[\"<]([^\">]+)[\">]"); + static const boost::regex ppfiles("^[[:blank:]]*#[[:blank:]]*define[[:blank:]]+(?:BOOST_PP_FILENAME|BOOST_PP_ITERATION_PARAMS|BOOST_PP_INDIRECT_SELF)(?:[^\\n]|\\\\\\n)+?[\"<]([^\">]+)[\">]"); i = boost::regex_token_iterator<const char*>(view.begin(), view.end(), ppfiles, 1); while(i != j) { @@ -484,7 +498,8 @@ void bcp_implementation::add_file_dependencies(const fs::path& p, bool scanfile) // static const boost::regex lib1("boost/([^\\./]+)(?!detail).*"); boost::smatch swhat; - if(boost::regex_match(p.string(), swhat, lib1)) + std::string gs(p.generic_string()); + if(boost::regex_match(gs, swhat, lib1)) { add_dependent_lib(swhat.str(1), p, view); } @@ -492,7 +507,8 @@ void bcp_implementation::add_file_dependencies(const fs::path& p, bool scanfile) // and this one catches boost/x/y/whatever (for example numeric/ublas): // static const boost::regex lib2("boost/([^/]+/[^/]+)/(?!detail).*"); - if(boost::regex_match(p.string(), swhat, lib2)) + gs = p.generic_string(); + if(boost::regex_match(gs, swhat, lib2)) { add_dependent_lib(swhat.str(1), p, view); } diff --git a/3rdParty/Boost/src/tools/bcp/bcp_imp.cpp b/3rdParty/Boost/src/tools/bcp/bcp_imp.cpp index 5801735..cfce215 100644 --- a/3rdParty/Boost/src/tools/bcp/bcp_imp.cpp +++ b/3rdParty/Boost/src/tools/bcp/bcp_imp.cpp @@ -121,7 +121,7 @@ void bcp_implementation::set_namespace_list(bool b) fs::path get_short_path(const fs::path& p) { // truncate path no more than "x/y": - std::string s = p.string(); + std::string s = p.generic_string(); std::string::size_type n = s.find('/'); if(n != std::string::npos) { @@ -244,7 +244,7 @@ int bcp_implementation::run() std::cout << "\n\nThe top level namespaces found for header and source files were:\n"; while(i != j) { - if(regex_match(i->second.string(), important_file)) + if(regex_match(i->second.generic_string(), important_file)) std::cout << i->first << " (from " << i->second << ")" << std::endl; ++i; } @@ -253,7 +253,7 @@ int bcp_implementation::run() std::cout << "\n\nThe top level namespaces found for all other source files were:\n"; while(i != j) { - if(!regex_match(i->second.string(), important_file)) + if(!regex_match(i->second.generic_string(), important_file)) std::cout << i->first << " (from " << i->second << ")" << std::endl; ++i; } diff --git a/3rdParty/Boost/src/tools/bcp/copy_path.cpp b/3rdParty/Boost/src/tools/bcp/copy_path.cpp index 85b5de1..497dcd5 100644 --- a/3rdParty/Boost/src/tools/bcp/copy_path.cpp +++ b/3rdParty/Boost/src/tools/bcp/copy_path.cpp @@ -63,7 +63,7 @@ void bcp_implementation::copy_path(const fs::path& p) static std::vector<char> v1, v2; v1.clear(); v2.clear(); - std::ifstream is((m_boost_path / p).string().c_str()); + std::ifstream is((m_boost_path / p).c_str()); std::copy(std::istreambuf_iterator<char>(is), std::istreambuf_iterator<char>(), std::back_inserter(v1)); static boost::regex libname_matcher; @@ -78,9 +78,9 @@ void bcp_implementation::copy_path(const fs::path& p) std::ofstream os; if(m_unix_lines) - os.open((m_dest_path / p).string().c_str(), std::ios_base::binary | std::ios_base::out); + os.open((m_dest_path / p).c_str(), std::ios_base::binary | std::ios_base::out); else - os.open((m_dest_path / p).string().c_str(), std::ios_base::out); + os.open((m_dest_path / p).c_str(), std::ios_base::out); os.write(&*v1.begin(), v1.size()); os.close(); } @@ -89,7 +89,7 @@ void bcp_implementation::copy_path(const fs::path& p) static std::vector<char> v1, v2; v1.clear(); v2.clear(); - std::ifstream is((m_boost_path / p).string().c_str()); + std::ifstream is((m_boost_path / p).c_str()); std::copy(std::istreambuf_iterator<char>(is), std::istreambuf_iterator<char>(), std::back_inserter(v1)); static boost::regex libname_matcher; @@ -111,9 +111,9 @@ void bcp_implementation::copy_path(const fs::path& p) std::ofstream os; if(m_unix_lines) - os.open((m_dest_path / p).string().c_str(), std::ios_base::binary | std::ios_base::out); + os.open((m_dest_path / p).c_str(), std::ios_base::binary | std::ios_base::out); else - os.open((m_dest_path / p).string().c_str(), std::ios_base::out); + os.open((m_dest_path / p).c_str(), std::ios_base::out); os.write(&*v1.begin(), v1.size()); os.close(); } @@ -127,14 +127,14 @@ void bcp_implementation::copy_path(const fs::path& p) static std::vector<char> v1, v2; v1.clear(); v2.clear(); - std::ifstream is((m_boost_path / p).string().c_str()); + std::ifstream is((m_boost_path / p).c_str()); std::copy(std::istreambuf_iterator<char>(is), std::istreambuf_iterator<char>(), std::back_inserter(v1)); static const boost::regex namespace_matcher( "(?|" "(namespace\\s+)boost(_\\w+)?(?:(\\s*::\\s*)phoenix)?" "|" - "(namespace\\s+)(adstl|phoenix|rapidxml)\\>" + "(namespace\\s+(?:detail::)?)(adstl|phoenix|rapidxml)\\>" "|" "()\\<boost((?:_(?!intrusive_tags)\\w+)?\\s*(?:::))(?:(\\s*)phoenix)?" "|" @@ -154,11 +154,15 @@ void bcp_implementation::copy_path(const fs::path& p) "|" "(BOOST_CLASS_REQUIRE4?[^;]*)boost((?:_\\w+)?\\s*,)" "|" + "(::tr1::|TR1_DECL\\s+)boost(_\\w+\\s*)" // math tr1 + "|" + "(\\(\\s*)boost(\\s*\\))\\s*(\\(\\s*)phoenix(\\s*\\))" + "|" "(\\(\\s*)boost(\\s*\\))" ")" ); - regex_replace(std::back_inserter(v2), v1.begin(), v1.end(), namespace_matcher, "$1" + m_namespace_name + "$2(?3$3" + m_namespace_name + "phoenix)", boost::regex_constants::format_all); + regex_replace(std::back_inserter(v2), v1.begin(), v1.end(), namespace_matcher, "$1" + m_namespace_name + "$2(?3$3" + m_namespace_name + "phoenix?4$4)", boost::regex_constants::format_all); std::swap(v1, v2); v2.clear(); @@ -191,31 +195,31 @@ void bcp_implementation::copy_path(const fs::path& p) "\\s*\\{.*" "\\})([^\\{\\};]*)\\z" */ - "namespace\\s+" + m_namespace_name + - "\\s*\\{" + "(namespace)(\\s+)(" + m_namespace_name + ")" + "(adstl|phoenix|rapidxml)?(\\s*\\{)" ); regex_replace(std::back_inserter(v2), v1.begin(), v1.end(), namespace_alias, - "namespace " + m_namespace_name + "{} namespace boost = " + m_namespace_name + "; namespace " + m_namespace_name + "{"); + "$1 $3$4 {} $1 (?4$4:boost) = $3$4; $1$2$3$4$5", boost::regex_constants::format_all); std::swap(v1, v2); v2.clear(); } std::ofstream os; if(m_unix_lines) - os.open((m_dest_path / p).string().c_str(), std::ios_base::binary | std::ios_base::out); + os.open((m_dest_path / p).c_str(), std::ios_base::binary | std::ios_base::out); else - os.open((m_dest_path / p).string().c_str(), std::ios_base::out); + os.open((m_dest_path / p).c_str(), std::ios_base::out); if(v1.size()) os.write(&*v1.begin(), v1.size()); os.close(); } else if(m_unix_lines && !is_binary_file(p)) { - std::ifstream is((m_boost_path / p).string().c_str()); + std::ifstream is((m_boost_path / p).c_str()); std::istreambuf_iterator<char> isi(is); std::istreambuf_iterator<char> end; - std::ofstream os((m_dest_path / p).string().c_str(), std::ios_base::binary | std::ios_base::out); + std::ofstream os((m_dest_path / p).c_str(), std::ios_base::binary | std::ios_base::out); std::ostreambuf_iterator<char> osi(os); std::copy(isi, end, osi); diff --git a/3rdParty/Boost/src/tools/bcp/file_types.cpp b/3rdParty/Boost/src/tools/bcp/file_types.cpp index 7fc6850..297d304 100644 --- a/3rdParty/Boost/src/tools/bcp/file_types.cpp +++ b/3rdParty/Boost/src/tools/bcp/file_types.cpp @@ -23,7 +23,7 @@ bool bcp_implementation::is_source_file(const fs::path& p) ")", boost::regex::perl | boost::regex::icase ); - return boost::regex_match(p.filename().string(), e); + return boost::regex_match(p.filename().generic_string(), e); } bool bcp_implementation::is_html_file(const fs::path& p) @@ -34,7 +34,7 @@ bool bcp_implementation::is_html_file(const fs::path& p) "html?|css" ")" ); - return boost::regex_match(p.filename().string(), e); + return boost::regex_match(p.filename().generic_string(), e); } bool bcp_implementation::is_binary_file(const fs::path& p) @@ -52,7 +52,7 @@ bool bcp_implementation::is_binary_file(const fs::path& p) "|" "(Jamfile|makefile|configure)", boost::regex::perl | boost::regex::icase); - return !boost::regex_match(p.leaf().string(), e); + return !boost::regex_match(p.leaf().generic_string(), e); } @@ -67,6 +67,6 @@ bool bcp_implementation::is_jam_file(const fs::path& p) "(Jamfile|Jamroot)\\.?", boost::regex::perl | boost::regex::icase ); - return boost::regex_match(p.filename().string(), e); + return boost::regex_match(p.filename().generic_string(), e); } diff --git a/3rdParty/Boost/src/tools/bcp/fileview.cpp b/3rdParty/Boost/src/tools/bcp/fileview.cpp index ec9e71a..54b3758 100644 --- a/3rdParty/Boost/src/tools/bcp/fileview.cpp +++ b/3rdParty/Boost/src/tools/bcp/fileview.cpp @@ -38,7 +38,7 @@ fileview::~fileview() { } -fileview::fileview(const fileview& that) +fileview::fileview(const fileview& ) { } @@ -57,7 +57,7 @@ void fileview::close() void fileview::open(const boost::filesystem::path& p) { cow(); - std::ifstream is(p.string().c_str()); + std::ifstream is(p.c_str()); if(!is) { std::string msg("Bad file name: "); diff --git a/3rdParty/Boost/src/tools/bcp/licence_info.cpp b/3rdParty/Boost/src/tools/bcp/licence_info.cpp index ab34b83..0e527fa 100644 --- a/3rdParty/Boost/src/tools/bcp/licence_info.cpp +++ b/3rdParty/Boost/src/tools/bcp/licence_info.cpp @@ -705,7 +705,7 @@ std::pair<const license_info*, int> get_licenses() ) , }; - return std::pair<const license_info*, int>(licenses, sizeof(licenses)/sizeof(licenses[0])); + return std::pair<const license_info*, int>(licenses, static_cast<int>(sizeof(licenses)/sizeof(licenses[0]))); } std::string format_authors_name(const std::string& name) diff --git a/3rdParty/Boost/src/tools/bcp/main.cpp b/3rdParty/Boost/src/tools/bcp/main.cpp index 28a5491..aab1502 100644 --- a/3rdParty/Boost/src/tools/bcp/main.cpp +++ b/3rdParty/Boost/src/tools/bcp/main.cpp @@ -47,7 +47,7 @@ void show_usage() "output-path: the path to which files will be copied\n"; } -bool filesystem_name_check( const std::string & name ) +bool filesystem_name_check( const std::string & ) { return true; } diff --git a/3rdParty/Boost/src/tools/bcp/output_licence_info.cpp b/3rdParty/Boost/src/tools/bcp/output_licence_info.cpp index 2349acc..d42268f 100644 --- a/3rdParty/Boost/src/tools/bcp/output_licence_info.cpp +++ b/3rdParty/Boost/src/tools/bcp/output_licence_info.cpp @@ -28,6 +28,8 @@ struct split_path const fs::path& file; split_path(const fs::path& r, const fs::path& f) : root(r), file(f){} +private: + split_path& operator=(const split_path&); }; std::ostream& operator << (std::ostream& os, const split_path& p) diff --git a/3rdParty/Boost/src/tools/bcp/path_operations.cpp b/3rdParty/Boost/src/tools/bcp/path_operations.cpp index 24ca6fe..aebbc4e 100644 --- a/3rdParty/Boost/src/tools/bcp/path_operations.cpp +++ b/3rdParty/Boost/src/tools/bcp/path_operations.cpp @@ -21,8 +21,8 @@ namespace std{ int compare_paths(const fs::path& a, const fs::path& b) { - const std::string& as = a.string(); - const std::string& bs = b.string(); + const std::string& as = a.generic_string(); + const std::string& bs = b.generic_string(); std::string::const_iterator i, j, k, l; i = as.begin(); j = as.end(); diff --git a/3rdParty/Boost/src/tools/bcp/scan_cvs_path.cpp b/3rdParty/Boost/src/tools/bcp/scan_cvs_path.cpp index 3c5eb2e..6d2eb3a 100644 --- a/3rdParty/Boost/src/tools/bcp/scan_cvs_path.cpp +++ b/3rdParty/Boost/src/tools/bcp/scan_cvs_path.cpp @@ -31,7 +31,7 @@ void bcp_implementation::scan_cvs_path(const fs::path& p) static const boost::regex dir_expression("^(?:A\\s+)?D/([^/\\n]+)/"); static const int file_subs[] = {1,2,}; - for(int entry = 0; entry < sizeof(file_list)/sizeof(file_list[0]); ++entry) + for(std::size_t entry = 0; entry < sizeof(file_list)/sizeof(file_list[0]); ++entry) { fs::path entries(m_boost_path / p / file_list[entry]); if(fs::exists(entries)) diff --git a/3rdParty/Boost/src/tools/bcp/scan_licence.cpp b/3rdParty/Boost/src/tools/bcp/scan_licence.cpp index d1bf0bb..c061583 100644 --- a/3rdParty/Boost/src/tools/bcp/scan_licence.cpp +++ b/3rdParty/Boost/src/tools/bcp/scan_licence.cpp @@ -27,8 +27,8 @@ context_before_license(const fileview& v, fileview::const_iterator start, { char last_char = '\0'; while (start != v.begin() && context_lines >= 0) { - if (*start == '\r' || *start == '\n' - && (last_char == *start || (last_char != '\r' && last_char != '\n'))) + if ((*start == '\r') || (*start == '\n') + && ((last_char == *start) || ((last_char != '\r') && (last_char != '\n')))) --context_lines; last_char = *start; diff --git a/3rdParty/Boost/update.sh b/3rdParty/Boost/update.sh index 45dfd44..2560adf 100755 --- a/3rdParty/Boost/update.sh +++ b/3rdParty/Boost/update.sh @@ -24,6 +24,8 @@ fi filesystem.hpp \ filesystem/fstream.hpp \ format.hpp \ + lambda/lambda.hpp \ + lambda/bind.hpp \ logic/tribool.hpp \ noncopyable.hpp \ numeric/conversion/cast.hpp \ @@ -53,9 +55,8 @@ for lib in $LIBS; do rm -rf $TARGET_DIR/libs/$lib/build $TARGET_DIR/libs/$lib/*.doc $TARGET_DIR/libs/$lib/src/*.doc $TARGET_DIR/libs/$lib/src/CMakeLists.txt $TARGET_DIR/libs/$lib/test done rm -rf $TARGET_DIR/tools/bcp/*.html $TARGET_DIR/libs/test $TARGET_DIR/doc $TARGET_DIR/boost.png $TARGET_DIR/boost/test $TARGET_DIR/tools/bcp/Jamfile.v2 $TARGET_DIR/tools/bcp/doc $TARGET_DIR/tools/bcp/test $TARGET_DIR/Jamroot -rm -rf $TARGET_DIR/libs/filesystem/v2/build $TARGET_DIR/libs/filesystem/v3/build -mv $TARGET_DIR/libs/filesystem/v3/src/utf8_codecvt_facet.cpp $TARGET_DIR/libs/filesystem/v3/src/filesystem_utf8_codecvt_facet.cpp +mv $TARGET_DIR/libs/filesystem/src/utf8_codecvt_facet.cpp $TARGET_DIR/libs/filesystem/src/filesystem_utf8_codecvt_facet.cpp mv $TARGET_DIR/libs/program_options/src/utf8_codecvt_facet.cpp $TARGET_DIR/libs/program_options/src/program_options_utf8_codecvt_facet.cpp for diff in *.diff; do -- cgit v0.10.2-6-g49f6