update boost
This commit is contained in:
@@ -5,7 +5,7 @@
|
||||
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
// https://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_UUID_BASIC_NAME_GENERATOR_HPP
|
||||
#define BOOST_UUID_BASIC_NAME_GENERATOR_HPP
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* Copyright Andrey Semashev 2013.
|
||||
* Copyright Andrey Semashev 2013, 2022.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
* https://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
/*!
|
||||
* \file uuid/detail/config.hpp
|
||||
@@ -36,6 +36,10 @@
|
||||
#define BOOST_UUID_USE_SSE41
|
||||
#endif
|
||||
|
||||
#if defined(__AVX__) && !defined(BOOST_UUID_USE_AVX)
|
||||
#define BOOST_UUID_USE_AVX
|
||||
#endif
|
||||
|
||||
#elif defined(_MSC_VER)
|
||||
|
||||
#if (defined(_M_X64) || (defined(_M_IX86) && defined(_M_IX86_FP) && _M_IX86_FP >= 2)) && !defined(BOOST_UUID_USE_SSE2)
|
||||
@@ -43,6 +47,9 @@
|
||||
#endif
|
||||
|
||||
#if defined(__AVX__)
|
||||
#if !defined(BOOST_UUID_USE_AVX)
|
||||
#define BOOST_UUID_USE_AVX
|
||||
#endif
|
||||
#if !defined(BOOST_UUID_USE_SSE41)
|
||||
#define BOOST_UUID_USE_SSE41
|
||||
#endif
|
||||
@@ -57,6 +64,10 @@
|
||||
#endif
|
||||
|
||||
// More advanced ISA extensions imply less advanced are also available
|
||||
#if !defined(BOOST_UUID_USE_SSE41) && defined(BOOST_UUID_USE_AVX)
|
||||
#define BOOST_UUID_USE_SSE41
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_UUID_USE_SSE3) && defined(BOOST_UUID_USE_SSE41)
|
||||
#define BOOST_UUID_USE_SSE3
|
||||
#endif
|
||||
@@ -65,7 +76,11 @@
|
||||
#define BOOST_UUID_USE_SSE2
|
||||
#endif
|
||||
|
||||
#if !defined(BOOST_UUID_NO_SIMD) && !defined(BOOST_UUID_USE_SSE41) && !defined(BOOST_UUID_USE_SSE3) && !defined(BOOST_UUID_USE_SSE2)
|
||||
#if !defined(BOOST_UUID_NO_SIMD) && \
|
||||
!defined(BOOST_UUID_USE_AVX) && \
|
||||
!defined(BOOST_UUID_USE_SSE41) && \
|
||||
!defined(BOOST_UUID_USE_SSE3) && \
|
||||
!defined(BOOST_UUID_USE_SSE2)
|
||||
#define BOOST_UUID_NO_SIMD
|
||||
#endif
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
// https://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_UUID_MD5_HPP
|
||||
#define BOOST_UUID_MD5_HPP
|
||||
@@ -30,6 +30,7 @@
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/uuid/uuid.hpp> // for version
|
||||
#include <boost/predef/other/endian.h>
|
||||
#include <string.h>
|
||||
|
||||
namespace boost {
|
||||
@@ -287,12 +288,50 @@ private:
|
||||
memcpy(ctx->buffer, data, size);
|
||||
}
|
||||
|
||||
// This must remain consistent no matter the endianness
|
||||
#define BOOST_UUID_DETAIL_MD5_OUT(dst, src) \
|
||||
(dst)[0] = (unsigned char)(src); \
|
||||
(dst)[1] = (unsigned char)((src) >> 8); \
|
||||
(dst)[2] = (unsigned char)((src) >> 16); \
|
||||
(dst)[3] = (unsigned char)((src) >> 24);
|
||||
|
||||
//
|
||||
// A big-endian issue with MD5 results was resolved
|
||||
// in boost 1.71. If you generated md5 name-based uuids
|
||||
// with boost 1.66 through 1.70 and stored them, then
|
||||
// set the following compatibility flag to ensure that
|
||||
// your hash generation remains consistent.
|
||||
//
|
||||
#if defined(BOOST_UUID_COMPAT_PRE_1_71_MD5)
|
||||
#define BOOST_UUID_DETAIL_MD5_BYTE_OUT(dst, src) \
|
||||
BOOST_UUID_DETAIL_MD5_OUT(dst, src)
|
||||
#else
|
||||
//
|
||||
// We're copying into a byte buffer which is actually
|
||||
// backed by an unsigned int array, which later on
|
||||
// is then swabbed one more time by the basic name
|
||||
// generator. Therefore the logic here is reversed.
|
||||
// This was done to minimize the impact to existing
|
||||
// name-based hash generation. The correct fix would
|
||||
// be to make this and name generation endian-correct
|
||||
// but that would even break previously generated sha1
|
||||
// hashes too.
|
||||
//
|
||||
#if BOOST_ENDIAN_LITTLE_BYTE
|
||||
#define BOOST_UUID_DETAIL_MD5_BYTE_OUT(dst, src) \
|
||||
(dst)[0] = (unsigned char)((src) >> 24); \
|
||||
(dst)[1] = (unsigned char)((src) >> 16); \
|
||||
(dst)[2] = (unsigned char)((src) >> 8); \
|
||||
(dst)[3] = (unsigned char)(src);
|
||||
#else
|
||||
#define BOOST_UUID_DETAIL_MD5_BYTE_OUT(dst, src) \
|
||||
(dst)[0] = (unsigned char)(src); \
|
||||
(dst)[1] = (unsigned char)((src) >> 8); \
|
||||
(dst)[2] = (unsigned char)((src) >> 16); \
|
||||
(dst)[3] = (unsigned char)((src) >> 24);
|
||||
#endif
|
||||
#endif // BOOST_UUID_COMPAT_PRE_1_71_MD5
|
||||
|
||||
void MD5_Final(unsigned char *result, MD5_CTX *ctx)
|
||||
{
|
||||
unsigned long used, available;
|
||||
@@ -318,10 +357,10 @@ private:
|
||||
|
||||
body(ctx, ctx->buffer, 64);
|
||||
|
||||
BOOST_UUID_DETAIL_MD5_OUT(&result[0], ctx->a)
|
||||
BOOST_UUID_DETAIL_MD5_OUT(&result[4], ctx->b)
|
||||
BOOST_UUID_DETAIL_MD5_OUT(&result[8], ctx->c)
|
||||
BOOST_UUID_DETAIL_MD5_OUT(&result[12], ctx->d)
|
||||
BOOST_UUID_DETAIL_MD5_BYTE_OUT(&result[0], ctx->a)
|
||||
BOOST_UUID_DETAIL_MD5_BYTE_OUT(&result[4], ctx->b)
|
||||
BOOST_UUID_DETAIL_MD5_BYTE_OUT(&result[8], ctx->c)
|
||||
BOOST_UUID_DETAIL_MD5_BYTE_OUT(&result[12], ctx->d)
|
||||
|
||||
memset(ctx, 0, sizeof(*ctx));
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENCE_1_0.txt)
|
||||
// https://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Platform-specific random entropy provider
|
||||
//
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENCE_1_0.txt)
|
||||
// https://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// "A Replacement Call for Random"
|
||||
// https://man.openbsd.org/arc4random.3
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENCE_1_0.txt)
|
||||
// https://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// BCrypt provider for entropy
|
||||
//
|
||||
@@ -19,9 +19,13 @@
|
||||
|
||||
#if defined(BOOST_UUID_FORCE_AUTO_LINK) || (!defined(BOOST_ALL_NO_LIB) && !defined(BOOST_UUID_RANDOM_PROVIDER_NO_LIB))
|
||||
# define BOOST_LIB_NAME "bcrypt"
|
||||
# define BOOST_AUTO_LINK_NOMANGLE
|
||||
# include <boost/config/auto_link.hpp>
|
||||
# undef BOOST_AUTO_LINK_NOMANGLE
|
||||
# if defined(BOOST_AUTO_LINK_NOMANGLE)
|
||||
# include <boost/config/auto_link.hpp>
|
||||
# else
|
||||
# define BOOST_AUTO_LINK_NOMANGLE
|
||||
# include <boost/config/auto_link.hpp>
|
||||
# undef BOOST_AUTO_LINK_NOMANGLE
|
||||
# endif
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENCE_1_0.txt)
|
||||
// https://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Platform-specific random entropy provider platform detection
|
||||
//
|
||||
@@ -25,6 +25,12 @@
|
||||
#endif // defined(SYS_getrandom)
|
||||
#endif
|
||||
|
||||
// On Linux, getentropy is implemented via getrandom. If we know that getrandom is not supported by the kernel, getentropy
|
||||
// will certainly not work, even if libc provides a wrapper function for it. There is no reason, ever, to use getentropy on that platform.
|
||||
#if !defined(BOOST_UUID_RANDOM_PROVIDER_DISABLE_GETENTROPY) && (defined(__linux__) || defined(__linux) || defined(linux) || defined(__ANDROID__))
|
||||
#define BOOST_UUID_RANDOM_PROVIDER_DISABLE_GETENTROPY
|
||||
#endif
|
||||
|
||||
//
|
||||
// Platform Detection - will load in the correct header and
|
||||
// will define the class <tt>random_provider_base</tt>.
|
||||
@@ -54,7 +60,7 @@
|
||||
# define BOOST_UUID_RANDOM_PROVIDER_GETRANDOM
|
||||
# define BOOST_UUID_RANDOM_PROVIDER_NAME getrandom
|
||||
|
||||
#elif BOOST_LIB_C_GNU >= BOOST_VERSION_NUMBER(2, 25, 0) && !defined(BOOST_UUID_RANDOM_PROVIDER_FORCE_POSIX)
|
||||
#elif BOOST_LIB_C_GNU >= BOOST_VERSION_NUMBER(2, 25, 0) && !defined(BOOST_UUID_RANDOM_PROVIDER_FORCE_POSIX) && !defined(BOOST_UUID_RANDOM_PROVIDER_DISABLE_GETENTROPY)
|
||||
# define BOOST_UUID_RANDOM_PROVIDER_GETENTROPY
|
||||
# define BOOST_UUID_RANDOM_PROVIDER_NAME getentropy
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENCE_1_0.txt)
|
||||
// https://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// getentropy() capable platforms
|
||||
//
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENCE_1_0.txt)
|
||||
// https://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// getrandom() capable platforms
|
||||
//
|
||||
@@ -14,7 +14,7 @@
|
||||
#include <cerrno>
|
||||
#include <cstddef>
|
||||
|
||||
#if !defined(BOOST_UUID_RANDOM_PROVIDER_GETRANDOM_IMPL_GETRANDOM)
|
||||
#if !defined(BOOST_UUID_RANDOM_PROVIDER_GETRANDOM_IMPL_GETRANDOM) && !defined(BOOST_UUID_RANDOM_PROVIDER_GETRANDOM_DISABLE_LIBC_WRAPPER)
|
||||
#if BOOST_LIB_C_GNU >= BOOST_VERSION_NUMBER(2, 25, 0)
|
||||
#define BOOST_UUID_RANDOM_PROVIDER_GETRANDOM_HAS_LIBC_WRAPPER
|
||||
#elif defined(__has_include)
|
||||
@@ -22,7 +22,7 @@
|
||||
#define BOOST_UUID_RANDOM_PROVIDER_GETRANDOM_HAS_LIBC_WRAPPER
|
||||
#endif
|
||||
#endif
|
||||
#endif // !defined(BOOST_UUID_RANDOM_PROVIDER_GETRANDOM_IMPL_GETRANDOM)
|
||||
#endif // !defined(BOOST_UUID_RANDOM_PROVIDER_GETRANDOM_IMPL_GETRANDOM) && !defined(BOOST_UUID_RANDOM_PROVIDER_GETRANDOM_DISABLE_LIBC_WRAPPER)
|
||||
|
||||
#if defined(BOOST_UUID_RANDOM_PROVIDER_GETRANDOM_HAS_LIBC_WRAPPER)
|
||||
#include <sys/random.h>
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENCE_1_0.txt)
|
||||
// https://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Platform-specific random entropy provider platform definition
|
||||
//
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
* Distributed under the Boost Software License, Version 1.0. (See
|
||||
* accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
* https://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
*
|
||||
* Distributed under the Boost Software License, Version 1.0. (See
|
||||
* accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
* https://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
* $Id$
|
||||
*/
|
||||
@@ -27,9 +27,13 @@
|
||||
# else
|
||||
# define BOOST_LIB_NAME "advapi32"
|
||||
# endif
|
||||
# define BOOST_AUTO_LINK_NOMANGLE
|
||||
# include <boost/config/auto_link.hpp>
|
||||
# undef BOOST_AUTO_LINK_NOMANGLE
|
||||
# if defined(BOOST_AUTO_LINK_NOMANGLE)
|
||||
# include <boost/config/auto_link.hpp>
|
||||
# else
|
||||
# define BOOST_AUTO_LINK_NOMANGLE
|
||||
# include <boost/config/auto_link.hpp>
|
||||
# undef BOOST_AUTO_LINK_NOMANGLE
|
||||
# endif
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
// Copyright 2007 Andy Tompkins.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
// https://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Revision History
|
||||
// 29 May 2007 - Initial Revision
|
||||
@@ -186,7 +186,7 @@ inline void sha1::process_block()
|
||||
inline unsigned char sha1::get_version() const
|
||||
{
|
||||
// RFC 4122 Section 4.1.3
|
||||
return uuid::version_name_based_sha1;
|
||||
return uuid::version_name_based_sha1;
|
||||
}
|
||||
|
||||
inline void sha1::get_digest(digest_type& digest)
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
* Copyright Andy Tompkins 2006.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
* https://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
/*!
|
||||
* \file uuid/detail/uuid_generic.ipp
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
/*
|
||||
* Copyright Andrey Semashev 2013.
|
||||
* Copyright Andrey Semashev 2013, 2022.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
* https://www.boost.org/LICENSE_1_0.txt)
|
||||
*/
|
||||
/*!
|
||||
* \file uuid/detail/uuid_x86.ipp
|
||||
@@ -22,7 +22,7 @@
|
||||
#include <emmintrin.h>
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_MSVC) && defined(_M_X64) && !defined(BOOST_UUID_USE_SSE3) && (BOOST_MSVC < 1900 /* Fixed in Visual Studio 2015 */ )
|
||||
#if defined(BOOST_MSVC) && defined(_M_X64) && (BOOST_MSVC < 1900 /* Fixed in Visual Studio 2015 */ )
|
||||
// At least MSVC 9 (VS2008) and 12 (VS2013) have an optimizer bug that sometimes results in incorrect SIMD code
|
||||
// generated in Release x64 mode. In particular, it affects operator==, where the compiler sometimes generates
|
||||
// pcmpeqd with a memory opereand instead of movdqu followed by pcmpeqd. The problem is that uuid can be
|
||||
@@ -45,9 +45,7 @@ namespace detail {
|
||||
|
||||
BOOST_FORCEINLINE __m128i load_unaligned_si128(const uint8_t* p) BOOST_NOEXCEPT
|
||||
{
|
||||
#if defined(BOOST_UUID_USE_SSE3)
|
||||
return _mm_lddqu_si128(reinterpret_cast< const __m128i* >(p));
|
||||
#elif !defined(BOOST_UUID_DETAIL_MSVC_BUG981648)
|
||||
#if !defined(BOOST_UUID_DETAIL_MSVC_BUG981648) || defined(BOOST_UUID_USE_AVX)
|
||||
return _mm_loadu_si128(reinterpret_cast< const __m128i* >(p));
|
||||
#elif defined(BOOST_MSVC) && BOOST_MSVC >= 1600
|
||||
__m128i mm = _mm_loadu_si128(reinterpret_cast< const __m128i* >(p));
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENCE_1_0.txt)
|
||||
// https://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Entropy error class
|
||||
//
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
// https://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_UUID_NAME_GENERATOR_HPP
|
||||
#define BOOST_UUID_NAME_GENERATOR_HPP
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
// https://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_UUID_NAME_GENERATOR_MD5_HPP
|
||||
#define BOOST_UUID_NAME_GENERATOR_MD5_HPP
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
// https://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_UUID_NAME_GENERATOR_SHA1_HPP
|
||||
#define BOOST_UUID_NAME_GENERATOR_SHA1_HPP
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// Copyright 2010 Andy Tompkins.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
// https://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_UUID_NIL_GENERATOR_HPP
|
||||
#define BOOST_UUID_NIL_GENERATOR_HPP
|
||||
|
||||
@@ -4,7 +4,7 @@
|
||||
// Copyright 2017 James E. King III
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
// https://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_UUID_RANDOM_GENERATOR_HPP
|
||||
#define BOOST_UUID_RANDOM_GENERATOR_HPP
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// Copyright 2010 Andy Tompkins.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
// https://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_UUID_STRING_GENERATOR_HPP
|
||||
#define BOOST_UUID_STRING_GENERATOR_HPP
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// Copyright 2006 Andy Tompkins.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
// https://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Revision History
|
||||
// 06 Feb 2006 - Initial Revision
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// Copyright 2006 Andy Tompkins.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
// https://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Revision History
|
||||
// 06 Feb 2006 - Initial Revision
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENCE_1_0.txt)
|
||||
// https://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// std::hash support for uuid
|
||||
//
|
||||
@@ -13,7 +13,7 @@
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/container_hash/hash.hpp>
|
||||
#include <boost/uuid/uuid_io.hpp>
|
||||
#include <boost/uuid/uuid.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
@@ -31,7 +31,7 @@ namespace std
|
||||
{
|
||||
std::size_t operator () (const boost::uuids::uuid& value) const BOOST_NOEXCEPT
|
||||
{
|
||||
return boost::hash_value(to_string(value));
|
||||
return boost::uuids::hash_value(value);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// Copyright 2009 Andy Tompkins.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
// https://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Revision History
|
||||
// 20 Mar 2009 - Initial Revision
|
||||
@@ -146,23 +146,38 @@ inline wchar_t to_wchar(size_t i) {
|
||||
|
||||
} // namespace detail
|
||||
|
||||
inline std::string to_string(uuid const& u)
|
||||
template<class OutputIterator>
|
||||
OutputIterator to_chars(uuid const& u, OutputIterator out)
|
||||
{
|
||||
std::string result;
|
||||
result.reserve(36);
|
||||
|
||||
std::size_t i=0;
|
||||
for (uuid::const_iterator it_data = u.begin(); it_data!=u.end(); ++it_data, ++i) {
|
||||
const size_t hi = ((*it_data) >> 4) & 0x0F;
|
||||
result += detail::to_char(hi);
|
||||
*out++ = detail::to_char(hi);
|
||||
|
||||
const size_t lo = (*it_data) & 0x0F;
|
||||
result += detail::to_char(lo);
|
||||
*out++ = detail::to_char(lo);
|
||||
|
||||
if (i == 3 || i == 5 || i == 7 || i == 9) {
|
||||
result += '-';
|
||||
*out++ = '-';
|
||||
}
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
inline bool to_chars(uuid const& u, char* first, char* last)
|
||||
{
|
||||
if (last - first < 36) {
|
||||
return false;
|
||||
}
|
||||
to_chars(u, first);
|
||||
return true;
|
||||
}
|
||||
|
||||
inline std::string to_string(uuid const& u)
|
||||
{
|
||||
std::string result(36, char());
|
||||
// string::data() returns const char* before C++17
|
||||
to_chars(u, &result[0]);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
// Copyright 2007 Andy Tompkins.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
// https://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Revision History
|
||||
// 12 Nov 2007 - Initial Revision
|
||||
@@ -13,8 +13,19 @@
|
||||
#define BOOST_UUID_SERIALIZE_HPP
|
||||
|
||||
#include <boost/uuid/uuid.hpp>
|
||||
#include <boost/serialization/level.hpp>
|
||||
#include <boost/type_traits/integral_constant.hpp>
|
||||
|
||||
BOOST_CLASS_IMPLEMENTATION(boost::uuids::uuid, boost::serialization::primitive_type)
|
||||
// BOOST_CLASS_IMPLEMENTATION(boost::uuids::uuid, boost::serialization::primitive_type)
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace serialization
|
||||
{
|
||||
|
||||
template<class T> struct implementation_level_impl;
|
||||
template<> struct implementation_level_impl<const uuids::uuid>: boost::integral_constant<int, 1> {};
|
||||
|
||||
} // namespace serialization
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_UUID_SERIALIZE_HPP
|
||||
|
||||
Reference in New Issue
Block a user