mirror of
https://github.com/boostorg/detail.git
synced 2025-06-27 21:11:07 +02:00
Compare commits
1 Commits
svn-branch
...
svn-branch
Author | SHA1 | Date | |
---|---|---|---|
4a1d892184 |
@ -1,47 +0,0 @@
|
||||
// boost/detail/bitmask.hpp ------------------------------------------------//
|
||||
|
||||
// Copyright Beman Dawes 2006
|
||||
|
||||
// Distributed under the Boost Software License, Version 1.0
|
||||
// http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
// Usage: enum foo { a=1, b=2, c=4 };
|
||||
// BOOST_BITMASK( foo );
|
||||
//
|
||||
// void f( foo arg );
|
||||
// ...
|
||||
// f( a | c );
|
||||
|
||||
#ifndef BOOST_BITMASK_HPP
|
||||
#define BOOST_BITMASK_HPP
|
||||
|
||||
#include <boost/cstdint.hpp>
|
||||
|
||||
#define BOOST_BITMASK(Bitmask) \
|
||||
\
|
||||
inline Bitmask operator| (Bitmask x , Bitmask y ) \
|
||||
{ return static_cast<Bitmask>( static_cast<boost::int_least32_t>(x) \
|
||||
| static_cast<boost::int_least32_t>(y)); } \
|
||||
\
|
||||
inline Bitmask operator& (Bitmask x , Bitmask y ) \
|
||||
{ return static_cast<Bitmask>( static_cast<boost::int_least32_t>(x) \
|
||||
& static_cast<boost::int_least32_t>(y)); } \
|
||||
\
|
||||
inline Bitmask operator^ (Bitmask x , Bitmask y ) \
|
||||
{ return static_cast<Bitmask>( static_cast<boost::int_least32_t>(x) \
|
||||
^ static_cast<boost::int_least32_t>(y)); } \
|
||||
\
|
||||
inline Bitmask operator~ (Bitmask x ) \
|
||||
{ return static_cast<Bitmask>(~static_cast<boost::int_least32_t>(x)); } \
|
||||
\
|
||||
inline Bitmask & operator&=(Bitmask & x , Bitmask y) \
|
||||
{ x = x & y ; return x ; } \
|
||||
\
|
||||
inline Bitmask & operator|=(Bitmask & x , Bitmask y) \
|
||||
{ x = x | y ; return x ; } \
|
||||
\
|
||||
inline Bitmask & operator^=(Bitmask & x , Bitmask y) \
|
||||
{ x = x ^ y ; return x ; }
|
||||
|
||||
#endif // BOOST_BITMASK_HPP
|
||||
|
@ -1,92 +1,24 @@
|
||||
|
||||
// Copyright 2005-2011 Daniel James.
|
||||
// Copyright 2005-2008 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) && \
|
||||
!defined(BOOST_DETAIL_TEST_CONFIG_ONLY)
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// //
|
||||
// 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)
|
||||
#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))
|
||||
|
||||
#include <deque>
|
||||
#include <list>
|
||||
@ -101,6 +33,17 @@
|
||||
|
||||
#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
|
||||
@ -120,18 +63,17 @@ 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 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
|
||||
@ -154,9 +96,6 @@ namespace std
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif // BOOST_DETAIL_NO_CONTAINER_FWD &&
|
||||
// !defined(BOOST_DETAIL_TEST_FORCE_CONTAINER_FWD)
|
||||
|
||||
#endif // BOOST_DETAIL_TEST_CONFIG_ONLY
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
@ -1,11 +1,76 @@
|
||||
// Copyright 2013 Redshift Software Inc
|
||||
// Copyright 2005 Caleb Epstein
|
||||
// Copyright 2006 John Maddock
|
||||
// Copyright 2010 Rene Rivera
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompany-
|
||||
// ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997
|
||||
* Silicon Graphics Computer Systems, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Silicon Graphics makes no
|
||||
* representations about the suitability of this software for any
|
||||
* purpose. It is provided "as is" without express or implied warranty.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright notice reproduced from <boost/detail/limits.hpp>, from
|
||||
* which this code was originally taken.
|
||||
*
|
||||
* Modified by Caleb Epstein to use <endian.h> with GNU libc and to
|
||||
* defined the BOOST_ENDIAN macro.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_DETAIL_ENDIAN_HPP
|
||||
#define BOOST_DETAIL_ENDIAN_HPP
|
||||
|
||||
// Use the Predef library for the detection of endianess.
|
||||
#include <boost/predef/detail/endian_compat.h>
|
||||
// GNU libc offers the helpful header <endian.h> which defines
|
||||
// __BYTE_ORDER
|
||||
|
||||
#if defined (__GLIBC__)
|
||||
# include <endian.h>
|
||||
# if (__BYTE_ORDER == __LITTLE_ENDIAN)
|
||||
# define BOOST_LITTLE_ENDIAN
|
||||
# elif (__BYTE_ORDER == __BIG_ENDIAN)
|
||||
# define BOOST_BIG_ENDIAN
|
||||
# elif (__BYTE_ORDER == __PDP_ENDIAN)
|
||||
# define BOOST_PDP_ENDIAN
|
||||
# else
|
||||
# error Unknown machine endianness detected.
|
||||
# endif
|
||||
# define BOOST_BYTE_ORDER __BYTE_ORDER
|
||||
#elif defined(_BIG_ENDIAN) && !defined(_LITTLE_ENDIAN) || \
|
||||
defined(__BIG_ENDIAN__) && !defined(__LITTLE_ENDIAN__)
|
||||
# define BOOST_BIG_ENDIAN
|
||||
# define BOOST_BYTE_ORDER 4321
|
||||
#elif defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN) || \
|
||||
defined(__LITTLE_ENDIAN__) && !defined(__BIG_ENDIAN__)
|
||||
# define BOOST_LITTLE_ENDIAN
|
||||
# define BOOST_BYTE_ORDER 1234
|
||||
#elif defined(__sparc) || defined(__sparc__) \
|
||||
|| defined(_POWER) || defined(__powerpc__) \
|
||||
|| defined(__ppc__) || defined(__hpux) || defined(__hppa) \
|
||||
|| defined(_MIPSEB) || defined(_POWER) \
|
||||
|| defined(__s390__)
|
||||
# define BOOST_BIG_ENDIAN
|
||||
# define BOOST_BYTE_ORDER 4321
|
||||
#elif defined(__i386__) || defined(__alpha__) \
|
||||
|| defined(__ia64) || defined(__ia64__) \
|
||||
|| defined(_M_IX86) || defined(_M_IA64) \
|
||||
|| defined(_M_ALPHA) || defined(__amd64) \
|
||||
|| defined(__amd64__) || defined(_M_AMD64) \
|
||||
|| defined(__x86_64) || defined(__x86_64__) \
|
||||
|| defined(_M_X64) || defined(__bfin__)
|
||||
|
||||
# define BOOST_LITTLE_ENDIAN
|
||||
# define BOOST_BYTE_ORDER 1234
|
||||
#else
|
||||
# error The file boost/detail/endian.hpp needs to be set up for your CPU type.
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
@ -1,74 +0,0 @@
|
||||
/*=============================================================================
|
||||
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 */
|
||||
|
@ -1,6 +1,12 @@
|
||||
#ifndef BOOST_DETAIL_INTERLOCKED_HPP_INCLUDED
|
||||
#define BOOST_DETAIL_INTERLOCKED_HPP_INCLUDED
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
//
|
||||
// boost/detail/interlocked.hpp
|
||||
//
|
||||
@ -13,11 +19,6 @@
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
#if defined( BOOST_USE_WINDOWS_H )
|
||||
|
||||
# include <windows.h>
|
||||
@ -32,21 +33,6 @@
|
||||
|
||||
#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* );
|
||||
@ -61,8 +47,6 @@ 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) \
|
||||
@ -70,11 +54,7 @@ extern "C" long __cdecl InterlockedExchangeAdd( long*, long );
|
||||
|
||||
#elif defined( BOOST_MSVC ) || defined( BOOST_INTEL_WIN )
|
||||
|
||||
#if defined( BOOST_MSVC ) && BOOST_MSVC >= 1500
|
||||
|
||||
#include <intrin.h>
|
||||
|
||||
#elif defined( __CLRCALL_PURE_OR_CDECL )
|
||||
#if 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 * );
|
||||
@ -124,46 +104,23 @@ extern "C" void* __cdecl _InterlockedExchangePointer( void* volatile *, void* );
|
||||
# define BOOST_INTERLOCKED_EXCHANGE _InterlockedExchange
|
||||
# define BOOST_INTERLOCKED_EXCHANGE_ADD _InterlockedExchangeAdd
|
||||
|
||||
// Unlike __MINGW64__, __MINGW64_VERSION_MAJOR is defined by MinGW-w64 for both 32 and 64-bit targets.
|
||||
#elif defined(__MINGW64_VERSION_MAJOR)
|
||||
|
||||
// MinGW-w64 provides intrin.h for both 32 and 64-bit targets.
|
||||
#include <intrin.h>
|
||||
|
||||
# define BOOST_INTERLOCKED_INCREMENT _InterlockedIncrement
|
||||
# define BOOST_INTERLOCKED_DECREMENT _InterlockedDecrement
|
||||
# define BOOST_INTERLOCKED_COMPARE_EXCHANGE _InterlockedCompareExchange
|
||||
# define BOOST_INTERLOCKED_EXCHANGE _InterlockedExchange
|
||||
# define BOOST_INTERLOCKED_EXCHANGE_ADD _InterlockedExchangeAdd
|
||||
# if defined(__x86_64__) || defined(__x86_64)
|
||||
# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER _InterlockedCompareExchangePointer
|
||||
# define BOOST_INTERLOCKED_EXCHANGE_POINTER _InterlockedExchangePointer
|
||||
# else
|
||||
# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest,exchange,compare) \
|
||||
((void*)BOOST_INTERLOCKED_COMPARE_EXCHANGE((long volatile*)(dest),(long)(exchange),(long)(compare)))
|
||||
# define BOOST_INTERLOCKED_EXCHANGE_POINTER(dest,exchange) \
|
||||
((void*)BOOST_INTERLOCKED_EXCHANGE((long volatile*)(dest),(long)(exchange)))
|
||||
# endif
|
||||
|
||||
#elif defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || defined( __CYGWIN__ )
|
||||
|
||||
#define BOOST_INTERLOCKED_IMPORT __declspec(dllimport)
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
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 );
|
||||
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 );
|
||||
|
||||
# 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* );
|
||||
extern "C" __declspec(dllimport) void* __stdcall InterlockedCompareExchangePointer( void* volatile *, void*, void* );
|
||||
extern "C" __declspec(dllimport) void* __stdcall InterlockedExchangePointer( void* volatile *, void* );
|
||||
# endif
|
||||
|
||||
} // namespace detail
|
||||
|
@ -112,7 +112,7 @@ boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T
|
||||
#else
|
||||
|
||||
#define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3, (0, 25, "boost/detail/is_function_ref_tester.hpp"))
|
||||
(3, (0, 25, "boost/type_traits/detail/is_function_ref_tester.hpp"))
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
#endif // BOOST_TT_PREPROCESSING_MODE
|
||||
@ -133,4 +133,3 @@ boost::type_traits::yes_type is_function_ref_tester(R (&)(BOOST_PP_ENUM_PARAMS(i
|
||||
|
||||
#undef i
|
||||
#endif // BOOST_PP_IS_ITERATING
|
||||
|
||||
|
@ -70,10 +70,10 @@ namespace is_incrementable_
|
||||
# endif
|
||||
|
||||
// two check overloads help us identify which operator++ was picked
|
||||
char (& check_(tag) )[2];
|
||||
char (& check(tag) )[2];
|
||||
|
||||
template <class T>
|
||||
char check_(T const&);
|
||||
char check(T const&);
|
||||
|
||||
|
||||
template <class T>
|
||||
@ -83,7 +83,7 @@ namespace is_incrementable_
|
||||
|
||||
BOOST_STATIC_CONSTANT(
|
||||
bool
|
||||
, value = sizeof(is_incrementable_::check_(BOOST_comma(++x,0))) == 1
|
||||
, value = sizeof(is_incrementable_::check(BOOST_comma(++x,0))) == 1
|
||||
);
|
||||
};
|
||||
|
||||
@ -94,7 +94,7 @@ namespace is_incrementable_
|
||||
|
||||
BOOST_STATIC_CONSTANT(
|
||||
bool
|
||||
, value = sizeof(is_incrementable_::check_(BOOST_comma(x++,0))) == 1
|
||||
, value = sizeof(is_incrementable_::check(BOOST_comma(x++,0))) == 1
|
||||
);
|
||||
};
|
||||
|
||||
|
@ -1,56 +0,0 @@
|
||||
/*==============================================================================
|
||||
Copyright (c) 2010-2011 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)
|
||||
==============================================================================*/
|
||||
|
||||
#ifndef BOOST_DETAIL_SORTED_HPP
|
||||
#define BOOST_DETAIL_SORTED_HPP
|
||||
|
||||
#include <boost/detail/iterator.hpp>
|
||||
|
||||
#include <functional>
|
||||
|
||||
namespace boost {
|
||||
namespace detail {
|
||||
|
||||
template<class Iterator, class Comp>
|
||||
inline Iterator is_sorted_until (Iterator first, Iterator last, Comp c) {
|
||||
if (first == last)
|
||||
return last;
|
||||
|
||||
Iterator it = first; ++it;
|
||||
|
||||
for (; it != last; first = it, ++it)
|
||||
if (c(*it, *first))
|
||||
return it;
|
||||
|
||||
return it;
|
||||
}
|
||||
|
||||
template<class Iterator>
|
||||
inline Iterator is_sorted_until (Iterator first, Iterator last) {
|
||||
typedef typename boost::detail::iterator_traits<Iterator>::value_type
|
||||
value_type;
|
||||
|
||||
typedef std::less<value_type> c;
|
||||
|
||||
return ::boost::detail::is_sorted_until(first, last, c());
|
||||
}
|
||||
|
||||
template<class Iterator, class Comp>
|
||||
inline bool is_sorted (Iterator first, Iterator last, Comp c) {
|
||||
return ::boost::detail::is_sorted_until(first, last, c) == last;
|
||||
}
|
||||
|
||||
template<class Iterator>
|
||||
inline bool is_sorted (Iterator first, Iterator last) {
|
||||
return ::boost::detail::is_sorted_until(first, last) == last;
|
||||
}
|
||||
|
||||
} // detail
|
||||
} // boost
|
||||
|
||||
#endif // BOOST_DETAIL_SORTED_HPP
|
||||
|
@ -1,36 +0,0 @@
|
||||
// boost/detail/lightweight_main.hpp -------------------------------------------------//
|
||||
|
||||
// Copyright Beman Dawes 2010
|
||||
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#include <iostream>
|
||||
#include <exception>
|
||||
|
||||
//--------------------------------------------------------------------------------------//
|
||||
// //
|
||||
// exception reporting main() that calls cpp_main() //
|
||||
// //
|
||||
//--------------------------------------------------------------------------------------//
|
||||
|
||||
int cpp_main(int argc, char* argv[]);
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
try
|
||||
{
|
||||
return cpp_main(argc, argv);
|
||||
}
|
||||
|
||||
catch (const std::exception& ex)
|
||||
{
|
||||
std::cout
|
||||
<< "\nERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR ERROR\n"
|
||||
<< "\n****************************** std::exception *****************************\n"
|
||||
<< ex.what()
|
||||
<< "\n***************************************************************************\n"
|
||||
<< std::endl;
|
||||
}
|
||||
return 1;
|
||||
}
|
@ -11,68 +11,20 @@
|
||||
// boost/detail/lightweight_test.hpp - lightweight test library
|
||||
//
|
||||
// Copyright (c) 2002, 2009 Peter Dimov
|
||||
// Copyright (2) Beman Dawes 2010, 2011
|
||||
// Copyright (3) Ion Gaztanaga 2013
|
||||
//
|
||||
// Distributed under the 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 expression is false increases the error count
|
||||
// and outputs a message containing 'expression'
|
||||
//
|
||||
// BOOST_TEST(expression)
|
||||
//
|
||||
// ---------------
|
||||
//
|
||||
// Increases error count and outputs a message containing 'message'
|
||||
//
|
||||
// BOOST_ERROR(message)
|
||||
//
|
||||
// ---------------
|
||||
//
|
||||
// If 'expr1' != 'expr2' increases the error count
|
||||
// and outputs a message containing both expressions
|
||||
//
|
||||
// BOOST_TEST_EQ(expr1, expr2)
|
||||
//
|
||||
// ---------------
|
||||
//
|
||||
// If 'expr1' == 'expr2' increases the error count
|
||||
// and outputs a message containing both expressions
|
||||
//
|
||||
// BOOST_TEST_NE(expr1, expr2)
|
||||
//
|
||||
// ---------------
|
||||
//
|
||||
// If BOOST_NO_EXCEPTIONS is NOT defined and if 'expr' does not
|
||||
// throw an exception of type 'excep', increases the error count
|
||||
// and outputs a message containing the expression.
|
||||
//
|
||||
// If BOOST_NO_EXCEPTIONS is defined, this macro expands to nothing
|
||||
// and 'expr' is not evaluated.
|
||||
//
|
||||
// BOOST_TEST_THROWS(expr, excep)
|
||||
//
|
||||
// ---------------
|
||||
//
|
||||
// Returns the error count
|
||||
//
|
||||
// int boost::report_errors()
|
||||
//
|
||||
|
||||
#include <iostream>
|
||||
#include <boost/current_function.hpp>
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/detail/no_exceptions_support.hpp>
|
||||
|
||||
// IDE's like Visual Studio perform better if output goes to std::cout or
|
||||
// some other stream, so allow user to configure output stream:
|
||||
#ifndef BOOST_LIGHTWEIGHT_TEST_OSTREAM
|
||||
# define BOOST_LIGHTWEIGHT_TEST_OSTREAM std::cerr
|
||||
#endif
|
||||
#include <iostream>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
@ -80,103 +32,52 @@ namespace boost
|
||||
namespace detail
|
||||
{
|
||||
|
||||
struct report_errors_reminder
|
||||
{
|
||||
bool called_report_errors_function;
|
||||
report_errors_reminder() : called_report_errors_function(false) {}
|
||||
~report_errors_reminder()
|
||||
{
|
||||
BOOST_ASSERT(called_report_errors_function); // verify report_errors() was called
|
||||
}
|
||||
};
|
||||
|
||||
inline report_errors_reminder& report_errors_remind()
|
||||
{
|
||||
static report_errors_reminder r;
|
||||
return r;
|
||||
}
|
||||
|
||||
inline int & test_errors()
|
||||
{
|
||||
static int x = 0;
|
||||
report_errors_remind();
|
||||
return x;
|
||||
}
|
||||
|
||||
inline void test_failed_impl(char const * expr, char const * file, int line, char const * function)
|
||||
{
|
||||
BOOST_LIGHTWEIGHT_TEST_OSTREAM
|
||||
<< file << "(" << line << "): test '" << expr << "' failed in function '"
|
||||
<< function << "'" << std::endl;
|
||||
std::cerr << file << "(" << line << "): test '" << expr << "' failed in function '" << function << "'" << std::endl;
|
||||
++test_errors();
|
||||
}
|
||||
|
||||
inline void error_impl(char const * msg, char const * file, int line, char const * function)
|
||||
{
|
||||
BOOST_LIGHTWEIGHT_TEST_OSTREAM
|
||||
<< file << "(" << line << "): " << msg << " in function '"
|
||||
<< function << "'" << std::endl;
|
||||
std::cerr << file << "(" << line << "): " << msg << " in function '" << function << "'" << std::endl;
|
||||
++test_errors();
|
||||
}
|
||||
|
||||
inline void throw_failed_impl(char const * excep, char const * file, int line, char const * function)
|
||||
{
|
||||
BOOST_LIGHTWEIGHT_TEST_OSTREAM
|
||||
<< file << "(" << line << "): Exception '" << excep << "' not thrown in function '"
|
||||
<< function << "'" << std::endl;
|
||||
++test_errors();
|
||||
}
|
||||
|
||||
template<class T, class U> inline void test_eq_impl( char const * expr1, char const * expr2,
|
||||
char const * file, int line, char const * function, T const & t, U const & u )
|
||||
template<class T, class U> inline void test_eq_impl( char const * expr1, char const * expr2, char const * file, int line, char const * function, T const & t, U const & u )
|
||||
{
|
||||
if( t == u )
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
BOOST_LIGHTWEIGHT_TEST_OSTREAM
|
||||
<< file << "(" << line << "): test '" << expr1 << " == " << expr2
|
||||
std::cerr << file << "(" << line << "): test '" << expr1 << " == " << expr2
|
||||
<< "' failed in function '" << function << "': "
|
||||
<< "'" << t << "' != '" << u << "'" << std::endl;
|
||||
++test_errors();
|
||||
}
|
||||
}
|
||||
|
||||
template<class T, class U> inline void test_ne_impl( char const * expr1, char const * expr2,
|
||||
char const * file, int line, char const * function, T const & t, U const & u )
|
||||
{
|
||||
if( t != u )
|
||||
{
|
||||
}
|
||||
else
|
||||
{
|
||||
BOOST_LIGHTWEIGHT_TEST_OSTREAM
|
||||
<< file << "(" << line << "): test '" << expr1 << " != " << expr2
|
||||
<< "' failed in function '" << function << "': "
|
||||
<< "'" << t << "' == '" << u << "'" << std::endl;
|
||||
++test_errors();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
inline int report_errors()
|
||||
{
|
||||
detail::report_errors_remind().called_report_errors_function = true;
|
||||
|
||||
int errors = detail::test_errors();
|
||||
|
||||
if( errors == 0 )
|
||||
{
|
||||
BOOST_LIGHTWEIGHT_TEST_OSTREAM
|
||||
<< "No errors detected." << std::endl;
|
||||
std::cerr << "No errors detected." << std::endl;
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
BOOST_LIGHTWEIGHT_TEST_OSTREAM
|
||||
<< errors << " error" << (errors == 1? "": "s") << " detected." << std::endl;
|
||||
std::cerr << errors << " error" << (errors == 1? "": "s") << " detected." << std::endl;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@ -186,23 +87,5 @@ inline int report_errors()
|
||||
#define BOOST_TEST(expr) ((expr)? (void)0: ::boost::detail::test_failed_impl(#expr, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION))
|
||||
#define BOOST_ERROR(msg) ::boost::detail::error_impl(msg, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION)
|
||||
#define BOOST_TEST_EQ(expr1,expr2) ( ::boost::detail::test_eq_impl(#expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) )
|
||||
#define BOOST_TEST_NE(expr1,expr2) ( ::boost::detail::test_ne_impl(#expr1, #expr2, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION, expr1, expr2) )
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
#define BOOST_TEST_THROWS( EXPR, EXCEP ) \
|
||||
try { \
|
||||
EXPR; \
|
||||
::boost::detail::throw_failed_impl \
|
||||
(#EXCEP, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION); \
|
||||
} \
|
||||
catch(EXCEP const&) { \
|
||||
} \
|
||||
catch(...) { \
|
||||
::boost::detail::throw_failed_impl \
|
||||
(#EXCEP, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION); \
|
||||
} \
|
||||
//
|
||||
#else
|
||||
#define BOOST_TEST_THROWS( EXPR, EXCEP )
|
||||
#endif
|
||||
|
||||
#endif // #ifndef BOOST_DETAIL_LIGHTWEIGHT_TEST_HPP_INCLUDED
|
||||
|
@ -1,337 +1,56 @@
|
||||
// scoped_enum_emulation.hpp ---------------------------------------------------------//
|
||||
|
||||
// Copyright Beman Dawes, 2009
|
||||
// Copyright (C) 2011-2012 Vicente J. Botet Escriba
|
||||
// Copyright (C) 2012 Anthony Williams
|
||||
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
/*
|
||||
[section:scoped_enums Scoped Enums]
|
||||
|
||||
Generates C++0x scoped enums if the feature is present, otherwise emulates C++0x
|
||||
scoped enums with C++03 namespaces and enums. The Boost.Config BOOST_NO_CXX11_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_CXX11_SCOPED_ENUMS
|
||||
template <>
|
||||
struct BOOST_SYMBOL_VISIBLE is_error_code_enum<future_errc> : public true_type { };
|
||||
#endif
|
||||
|
||||
use
|
||||
|
||||
#ifdef BOOST_NO_CXX11_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]
|
||||
*/
|
||||
|
||||
// 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 );
|
||||
|
||||
#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
|
||||
|
||||
#ifdef BOOST_NO_CXX11_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_CXX11_SCOPED_ENUMS
|
||||
|
||||
template <typename EnumType>
|
||||
struct underlying_type
|
||||
{
|
||||
//typedef typename std::underlying_type<EnumType>::type type;
|
||||
};
|
||||
|
||||
template <typename EnumType>
|
||||
struct native_type
|
||||
{
|
||||
typedef EnumType type;
|
||||
};
|
||||
|
||||
template <typename UnderlyingType, typename EnumType>
|
||||
UnderlyingType underlying_cast(EnumType v)
|
||||
{
|
||||
return static_cast<UnderlyingType>(v);
|
||||
}
|
||||
|
||||
template <typename EnumType>
|
||||
inline
|
||||
EnumType native_value(EnumType e)
|
||||
{
|
||||
return e;
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
#ifdef BOOST_NO_CXX11_SCOPED_ENUMS
|
||||
|
||||
#ifndef BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
|
||||
|
||||
#define BOOST_SCOPED_ENUM_UT_DECLARE_CONVERSION_OPERATOR \
|
||||
explicit operator underlying_type() const { return get_underlying_value_(); }
|
||||
# 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_UT_DECLARE_CONVERSION_OPERATOR
|
||||
# define BOOST_SCOPED_ENUM_START(name) enum class name
|
||||
# define BOOST_SCOPED_ENUM_END
|
||||
# define BOOST_SCOPED_ENUM(name) name
|
||||
|
||||
#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_CXX11_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_CXX11_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_CXX11_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
|
||||
|
@ -92,7 +92,7 @@ namespace std {
|
||||
}
|
||||
#endif
|
||||
|
||||
#if defined(_CPPLIB_VER) && (_CPPLIB_VER < 540)
|
||||
#if !defined(__MSL_CPP__) && !defined(__LIBCOMO__)
|
||||
#define BOOST_CODECVT_DO_LENGTH_CONST const
|
||||
#else
|
||||
#define BOOST_CODECVT_DO_LENGTH_CONST
|
||||
|
@ -1,29 +0,0 @@
|
||||
// GetCurrentProcess.hpp --------------------------------------------------------------//
|
||||
|
||||
// Copyright 2010 Vicente J. Botet Escriba
|
||||
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
|
||||
#ifndef BOOST_DETAIL_WINAPI_GETCURRENTPROCESS_HPP
|
||||
#define BOOST_DETAIL_WINAPI_GETCURRENTPROCESS_HPP
|
||||
|
||||
#include <boost/detail/winapi/basic_types.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace detail {
|
||||
namespace winapi {
|
||||
#if defined( BOOST_USE_WINDOWS_H )
|
||||
using ::GetCurrentProcess;
|
||||
#else
|
||||
extern "C" __declspec(dllimport) HANDLE_ WINAPI GetCurrentProcess();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // BOOST_DETAIL_WINAPI_GETCURRENTPROCESS_HPP
|
@ -1,38 +0,0 @@
|
||||
// GetCurrentThread.hpp --------------------------------------------------------------//
|
||||
|
||||
// Copyright 2010 Vicente J. Botet Escriba
|
||||
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
|
||||
#ifndef BOOST_DETAIL_WINAPI_GETCURRENTTHREAD_HPP
|
||||
#define BOOST_DETAIL_WINAPI_GETCURRENTTHREAD_HPP
|
||||
|
||||
#include <boost/detail/winapi/basic_types.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace detail {
|
||||
namespace winapi {
|
||||
#if defined( UNDER_CE )
|
||||
// Windows CE define GetCurrentThread as an inline function in kfuncs.h
|
||||
inline HANDLE_ GetCurrentThread()
|
||||
{
|
||||
return ::GetCurrentThread();
|
||||
}
|
||||
#else
|
||||
#if defined( BOOST_USE_WINDOWS_H )
|
||||
using ::GetCurrentThread;
|
||||
#else
|
||||
extern "C" __declspec(dllimport) HANDLE_ WINAPI GetCurrentThread();
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // BOOST_DETAIL_WINAPI_GETCURRENTTHREAD_HPP
|
@ -1,31 +0,0 @@
|
||||
// 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_WINAPI_GETLASTERROR_HPP
|
||||
#define BOOST_DETAIL_WINAPI_GETLASTERROR_HPP
|
||||
|
||||
#include <boost/detail/winapi/basic_types.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace detail {
|
||||
namespace winapi {
|
||||
#if defined( BOOST_USE_WINDOWS_H )
|
||||
using ::GetLastError;
|
||||
#else
|
||||
extern "C" __declspec(dllimport) DWORD_ WINAPI
|
||||
GetLastError();
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // BOOST_DETAIL_WINAPI_GETLASTERROR_HPP
|
@ -1,39 +0,0 @@
|
||||
// GetProcessTimes.hpp --------------------------------------------------------------//
|
||||
|
||||
// Copyright 2010 Vicente J. Botet Escriba
|
||||
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
|
||||
#ifndef BOOST_DETAIL_WINAPI_GETPROCESSTIMES_HPP
|
||||
#define BOOST_DETAIL_WINAPI_GETPROCESSTIMES_HPP
|
||||
|
||||
#include <boost/detail/winapi/time.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace detail {
|
||||
namespace winapi {
|
||||
#if !defined(UNDER_CE) // Windows CE does not define GetProcessTimes
|
||||
#if defined( BOOST_USE_WINDOWS_H )
|
||||
using ::GetProcessTimes;
|
||||
#else
|
||||
extern "C" __declspec(dllimport) BOOL_ WINAPI
|
||||
GetProcessTimes(
|
||||
HANDLE_ hProcess,
|
||||
LPFILETIME_ lpCreationTime,
|
||||
LPFILETIME_ lpExitTime,
|
||||
LPFILETIME_ lpKernelTime,
|
||||
LPFILETIME_ lpUserTime
|
||||
);
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // BOOST_DETAIL_WINAPI_GETPROCESSTIMES_HPP
|
@ -1,37 +0,0 @@
|
||||
// GetThreadTimes.hpp --------------------------------------------------------------//
|
||||
|
||||
// Copyright 2010 Vicente J. Botet Escriba
|
||||
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
|
||||
#ifndef BOOST_DETAIL_WINAPI_GETTHREADTIMES_HPP
|
||||
#define BOOST_DETAIL_WINAPI_GETTHREADTIMES_HPP
|
||||
|
||||
#include <boost/detail/winapi/time.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace detail {
|
||||
namespace winapi {
|
||||
#if defined( BOOST_USE_WINDOWS_H )
|
||||
using ::GetThreadTimes;
|
||||
#else
|
||||
extern "C" __declspec(dllimport) BOOL_ WINAPI
|
||||
GetThreadTimes(
|
||||
HANDLE_ hThread,
|
||||
LPFILETIME_ lpCreationTime,
|
||||
LPFILETIME_ lpExitTime,
|
||||
LPFILETIME_ lpKernelTime,
|
||||
LPFILETIME_ lpUserTime
|
||||
);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // BOOST_DETAIL_WINAPI_GETTHREADTIMES_HPP
|
@ -1,33 +0,0 @@
|
||||
// LocalFree.hpp --------------------------------------------------------------//
|
||||
|
||||
// Copyright 2010 Vicente J. Botet Escriba
|
||||
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
|
||||
#ifndef BOOST_DETAIL_WINAPI_LOCALFREE_HPP
|
||||
#define BOOST_DETAIL_WINAPI_LOCALFREE_HPP
|
||||
|
||||
#include <boost/detail/winapi/basic_types.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace detail {
|
||||
namespace winapi {
|
||||
#if defined( BOOST_USE_WINDOWS_H )
|
||||
typedef HANDLE_ HLOCAL_;
|
||||
|
||||
using ::LocalFree;
|
||||
#else
|
||||
extern "C" typedef HANDLE_ HLOCAL_;
|
||||
extern "C" __declspec(dllimport) HLOCAL_ WINAPI
|
||||
LocalFree(HLOCAL_ hMem);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // BOOST_DETAIL_WINAPI_LOCALFREE_HPP
|
@ -1,116 +0,0 @@
|
||||
// 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_WINAPI_BASIC_TYPES_HPP
|
||||
#define BOOST_DETAIL_WINAPI_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
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace detail {
|
||||
namespace winapi {
|
||||
#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_WINAPI_TIME_HPP
|
@ -1,46 +0,0 @@
|
||||
// directory_management.hpp --------------------------------------------------------------//
|
||||
|
||||
// Copyright 2010 Vicente J. Botet Escriba
|
||||
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
|
||||
#ifndef BOOST_DETAIL_WINAPI_DIRECTORY_MANAGEMENT_HPP
|
||||
#define BOOST_DETAIL_WINAPI_DIRECTORY_MANAGEMENT_HPP
|
||||
|
||||
#include <boost/detail/winapi/basic_types.hpp>
|
||||
#include <boost/detail/winapi/security.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
namespace winapi
|
||||
{
|
||||
#if defined( BOOST_USE_WINDOWS_H )
|
||||
using ::CreateDirectory;
|
||||
using ::CreateDirectoryA;
|
||||
using ::GetTempPathA;
|
||||
using ::RemoveDirectoryA;
|
||||
#else
|
||||
extern "C" {
|
||||
__declspec(dllimport) int __stdcall
|
||||
CreateDirectory(LPCTSTR_, LPSECURITY_ATTRIBUTES_*);
|
||||
__declspec(dllimport) int __stdcall
|
||||
CreateDirectoryA(LPCTSTR_, interprocess_security_attributes*);
|
||||
__declspec(dllimport) int __stdcall
|
||||
GetTempPathA(unsigned long length, char *buffer);
|
||||
__declspec(dllimport) int __stdcall
|
||||
RemoveDirectoryA(LPCTSTR_);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // BOOST_DETAIL_WINAPI_THREAD_HPP
|
@ -1,55 +0,0 @@
|
||||
// dll.hpp --------------------------------------------------------------//
|
||||
|
||||
// Copyright 2010 Vicente J. Botet Escriba
|
||||
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
|
||||
#ifndef BOOST_DETAIL_WINAPI_DLL_HPP
|
||||
#define BOOST_DETAIL_WINAPI_DLL_HPP
|
||||
|
||||
#include <boost/detail/winapi/basic_types.hpp>
|
||||
#include <boost/detail/winapi/security.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
namespace winapi
|
||||
{
|
||||
#if defined( BOOST_USE_WINDOWS_H )
|
||||
using ::LoadLibrary;
|
||||
using ::FreeLibrary;
|
||||
using ::GetProcAddress;
|
||||
using ::GetModuleHandleA;
|
||||
#else
|
||||
extern "C" {
|
||||
__declspec(dllimport) HMODULE_ __stdcall
|
||||
LoadLibrary(
|
||||
LPCTSTR_ lpFileName
|
||||
);
|
||||
__declspec(dllimport) BOOL_ __stdcall
|
||||
FreeLibrary(
|
||||
HMODULE_ hModule
|
||||
);
|
||||
__declspec(dllimport) FARPROC_ __stdcall
|
||||
GetProcAddress(
|
||||
HMODULE_ hModule,
|
||||
LPCSTR_ lpProcName
|
||||
);
|
||||
__declspec(dllimport) FARPROC_ __stdcall
|
||||
GetModuleHandleA(
|
||||
LPCSTR_ lpProcName
|
||||
);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // BOOST_DETAIL_WINAPI_THREAD_HPP
|
@ -1,93 +0,0 @@
|
||||
// error_handling.hpp --------------------------------------------------------------//
|
||||
|
||||
// Copyright 2010 Vicente J. Botet Escriba
|
||||
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
|
||||
#ifndef BOOST_DETAIL_WINAPI_ERROR_HANDLING_HPP
|
||||
#define BOOST_DETAIL_WINAPI_ERROR_HANDLING_HPP
|
||||
|
||||
#include <boost/detail/winapi/basic_types.hpp>
|
||||
#include <boost/detail/winapi/GetCurrentThread.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace detail {
|
||||
namespace winapi {
|
||||
|
||||
#if defined( BOOST_USE_WINDOWS_H )
|
||||
using ::FormatMessageA;
|
||||
using ::FormatMessageW;
|
||||
|
||||
const int FORMAT_MESSAGE_ALLOCATE_BUFFER_= FORMAT_MESSAGE_ALLOCATE_BUFFER;
|
||||
const int FORMAT_MESSAGE_IGNORE_INSERTS_= FORMAT_MESSAGE_IGNORE_INSERTS;
|
||||
const int FORMAT_MESSAGE_FROM_STRING_= FORMAT_MESSAGE_FROM_STRING;
|
||||
const int FORMAT_MESSAGE_FROM_HMODULE_= FORMAT_MESSAGE_FROM_HMODULE;
|
||||
const int FORMAT_MESSAGE_FROM_SYSTEM_= FORMAT_MESSAGE_FROM_SYSTEM;
|
||||
const int FORMAT_MESSAGE_ARGUMENT_ARRAY_= FORMAT_MESSAGE_ARGUMENT_ARRAY;
|
||||
const int FORMAT_MESSAGE_MAX_WIDTH_MASK_= FORMAT_MESSAGE_MAX_WIDTH_MASK;
|
||||
|
||||
const char LANG_NEUTRAL_= LANG_NEUTRAL;
|
||||
const char LANG_INVARIANT_= LANG_INVARIANT;
|
||||
|
||||
const char SUBLANG_DEFAULT_= SUBLANG_DEFAULT; // user default
|
||||
inline WORD_ MAKELANGID_(WORD_ p, WORD_ s) {
|
||||
return MAKELANGID(p,s);
|
||||
}
|
||||
#else
|
||||
extern "C" {
|
||||
// using ::FormatMessageA;
|
||||
__declspec(dllimport)
|
||||
DWORD_
|
||||
WINAPI
|
||||
FormatMessageA(
|
||||
DWORD_ dwFlags,
|
||||
LPCVOID_ lpSource,
|
||||
DWORD_ dwMessageId,
|
||||
DWORD_ dwLanguageId,
|
||||
LPSTR_ lpBuffer,
|
||||
DWORD_ nSize,
|
||||
va_list *Arguments
|
||||
);
|
||||
|
||||
// using ::FormatMessageW;
|
||||
__declspec(dllimport)
|
||||
DWORD_
|
||||
WINAPI
|
||||
FormatMessageW(
|
||||
DWORD_ dwFlags,
|
||||
LPCVOID_ lpSource,
|
||||
DWORD_ dwMessageId,
|
||||
DWORD_ dwLanguageId,
|
||||
LPWSTR_ lpBuffer,
|
||||
DWORD_ nSize,
|
||||
va_list *Arguments
|
||||
);
|
||||
|
||||
const int FORMAT_MESSAGE_ALLOCATE_BUFFER_= 0x00000100;
|
||||
const int FORMAT_MESSAGE_IGNORE_INSERTS_= 0x00000200;
|
||||
const int FORMAT_MESSAGE_FROM_STRING_= 0x00000400;
|
||||
const int FORMAT_MESSAGE_FROM_HMODULE_= 0x00000800;
|
||||
const int FORMAT_MESSAGE_FROM_SYSTEM_= 0x00001000;
|
||||
const int FORMAT_MESSAGE_ARGUMENT_ARRAY_= 0x00002000;
|
||||
const int FORMAT_MESSAGE_MAX_WIDTH_MASK_= 0x000000FF;
|
||||
|
||||
const char LANG_NEUTRAL_= 0x00;
|
||||
const char LANG_INVARIANT_= 0x7f;
|
||||
|
||||
const char SUBLANG_DEFAULT_= 0x01; // user default
|
||||
inline WORD_ MAKELANGID_(WORD_ p, WORD_ s) {
|
||||
return ((((WORD_ )(s)) << 10) | (WORD_ )(p));
|
||||
}
|
||||
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // BOOST_DETAIL_WINAPI_ERROR_HANDLING_HPP
|
@ -1,130 +0,0 @@
|
||||
// thread.hpp --------------------------------------------------------------//
|
||||
|
||||
// Copyright 2010 Vicente J. Botet Escriba
|
||||
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
|
||||
#ifndef BOOST_DETAIL_WINAPI_FILE_MANAGEMENT_HPP
|
||||
#define BOOST_DETAIL_WINAPI_FILE_MANAGEMENT_HPP
|
||||
|
||||
#include <boost/detail/winapi/basic_types.hpp>
|
||||
#include <boost/detail/winapi/security.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
namespace winapi
|
||||
{
|
||||
#if defined( BOOST_USE_WINDOWS_H )
|
||||
using ::CreateFileA;
|
||||
using ::DeleteFileA;
|
||||
using ::FindFirstFileA;
|
||||
using ::FindNextFileA;
|
||||
using ::FindClose;
|
||||
using ::GetFileSizeEx;
|
||||
using ::MoveFileExA;
|
||||
using ::SetFileValidData;
|
||||
#else
|
||||
extern "C" {
|
||||
typedef struct _OVERLAPPED {
|
||||
ULONG_PTR Internal;
|
||||
ULONG_PTR InternalHigh;
|
||||
union {
|
||||
struct {
|
||||
DWORD Offset;
|
||||
DWORD OffsetHigh;
|
||||
} ;
|
||||
PVOID Pointer;
|
||||
} ;
|
||||
HANDLE hEvent;
|
||||
} OVERLAPPED, *LPOVERLAPPED;
|
||||
|
||||
|
||||
__declspec(dllimport) void * __stdcall
|
||||
CreateFileA (const char *, unsigned long, unsigned long, struct SECURITY_ATTRIBUTES_*, unsigned long, unsigned long, void *);
|
||||
__declspec(dllimport) int __stdcall
|
||||
DeleteFileA (const char *);
|
||||
__declspec(dllimport) void *__stdcall
|
||||
FindFirstFileA(const char *lpFileName, win32_find_data_t *lpFindFileData);
|
||||
__declspec(dllimport) int __stdcall
|
||||
FindNextFileA(void *hFindFile, win32_find_data_t *lpFindFileData);
|
||||
__declspec(dllimport) int __stdcall
|
||||
FindClose(void *hFindFile);
|
||||
__declspec(dllimport) BOOL __stdcall
|
||||
GetFileSizeEx(
|
||||
HANDLE_ hFile,
|
||||
PLARGE_INTEGER_ lpFileSize
|
||||
);
|
||||
__declspec(dllimport) int __stdcall
|
||||
MoveFileExA (const char *, const char *, unsigned long);
|
||||
__declspec(dllimport) BOOL_ __stdcall
|
||||
SetFileValidData(
|
||||
HANDLE_ hFile,
|
||||
LONGLONG_ ValidDataLength
|
||||
);
|
||||
__declspec(dllimport) BOOL_ __stdcall
|
||||
SetEndOfFile(
|
||||
HANDLE_ hFile
|
||||
);
|
||||
__declspec(dllimport) BOOL_ __stdcall
|
||||
SetFilePointerEx(
|
||||
HANDLE_ hFile,
|
||||
LARGE_INTEGER_ liDistanceToMove,
|
||||
PLARGE_INTEGER_ lpNewFilePointer,
|
||||
DWORD_ dwMoveMethod
|
||||
);
|
||||
__declspec(dllimport) BOOL_ __stdcall
|
||||
LockFile(
|
||||
HANDLE_ hFile,
|
||||
DWORD_ dwFileOffsetLow,
|
||||
DWORD_ dwFileOffsetHigh,
|
||||
DWORD_ nNumberOfBytesToLockLow,
|
||||
DWORD_ nNumberOfBytesToLockHigh
|
||||
);
|
||||
__declspec(dllimport) BOOL_ __stdcall
|
||||
UnlockFile(
|
||||
HANDLE_ hFile,
|
||||
DWORD_ dwFileOffsetLow,
|
||||
DWORD_ dwFileOffsetHigh,
|
||||
DWORD_ nNumberOfBytesToUnlockLow,
|
||||
DWORD_ nNumberOfBytesToUnlockHigh
|
||||
);
|
||||
__declspec(dllimport) BOOL_ __stdcall
|
||||
LockFileEx(
|
||||
HANDLE_ hFile,
|
||||
DWORD_ dwFlags,
|
||||
DWORD_ dwReserved,
|
||||
DWORD_ nNumberOfBytesToLockLow,
|
||||
DWORD_ nNumberOfBytesToLockHigh,
|
||||
LPOVERLAPPED_ lpOverlapped
|
||||
);
|
||||
__declspec(dllimport) BOOL_ __stdcall
|
||||
UnlockFileEx(
|
||||
HANDLE_ hFile,
|
||||
DWORD_ dwReserved,
|
||||
DWORD_ nNumberOfBytesToUnlockLow,
|
||||
DWORD_ nNumberOfBytesToUnlockHigh,
|
||||
LPOVERLAPPED_ lpOverlapped
|
||||
);
|
||||
__declspec(dllimport) BOOL_ __stdcall
|
||||
WriteFile(
|
||||
HANDLE_ hFile,
|
||||
LPCVOID_ lpBuffer,
|
||||
DWORD_ nNumberOfBytesToWrite,
|
||||
LPDWORD_ lpNumberOfBytesWritten,
|
||||
LPOVERLAPPED_ lpOverlapped
|
||||
);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // BOOST_DETAIL_WINAPI_THREAD_HPP
|
@ -1,40 +0,0 @@
|
||||
// memory.hpp --------------------------------------------------------------//
|
||||
|
||||
// Copyright 2010 Vicente J. Botet Escriba
|
||||
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
|
||||
#ifndef BOOST_DETAIL_WINAPI_HANDLES_HPP
|
||||
#define BOOST_DETAIL_WINAPI_HANDLES_HPP
|
||||
|
||||
#include <boost/detail/winapi/basic_types.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
namespace winapi
|
||||
{
|
||||
#if defined( BOOST_USE_WINDOWS_H )
|
||||
using ::CloseHandle;
|
||||
using ::DuplicateHandle;
|
||||
#else
|
||||
extern "C" {
|
||||
__declspec(dllimport) int __stdcall
|
||||
CloseHandle(void*);
|
||||
__declspec(dllimport) int __stdcall
|
||||
DuplicateHandle(void*,void*,void*,void**,unsigned long,int,unsigned long);
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // BOOST_DETAIL_WINAPI_HANDLES_HPP
|
@ -1,60 +0,0 @@
|
||||
// memory.hpp --------------------------------------------------------------//
|
||||
|
||||
// Copyright 2010 Vicente J. Botet Escriba
|
||||
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
|
||||
#ifndef BOOST_DETAIL_WINAPI_MEMORY_HPP
|
||||
#define BOOST_DETAIL_WINAPI_MEMORY_HPP
|
||||
|
||||
#include <boost/detail/winapi/basic_types.hpp>
|
||||
#include <boost/detail/winapi/security.hpp>
|
||||
#include <boost/detail/winapi/LocalFree.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
namespace winapi
|
||||
{
|
||||
#if defined( BOOST_USE_WINDOWS_H )
|
||||
using ::CreateFileMappingA;
|
||||
using ::FlushViewOfFile;
|
||||
using ::GetProcessHeap;
|
||||
using ::HeapAlloc;
|
||||
using ::HeapFree;
|
||||
using ::MapViewOfFileEx;
|
||||
using ::OpenFileMappingA;
|
||||
using ::UnmapViewOfFile;
|
||||
#else
|
||||
#undef HeapAlloc
|
||||
extern "C" {
|
||||
__declspec(dllimport) void * __stdcall
|
||||
CreateFileMappingA (void *, SECURITY_ATTRIBUTES_*, unsigned long, unsigned long, unsigned long, const char *);
|
||||
__declspec(dllimport) int __stdcall
|
||||
FlushViewOfFile (void *, std::size_t);
|
||||
__declspec(dllimport) HANDLE_ __stdcall
|
||||
GetProcessHeap();
|
||||
__declspec(dllimport) void* __stdcall
|
||||
HeapAlloc(HANDLE_,DWORD_,SIZE_T_);
|
||||
__declspec(dllimport) BOOL_ __stdcall
|
||||
HeapFree(HANDLE_,DWORD_,LPVOID_);
|
||||
__declspec(dllimport) void * __stdcall
|
||||
MapViewOfFileEx (void *, unsigned long, unsigned long, unsigned long, std::size_t, void*);
|
||||
__declspec(dllimport) void * __stdcall
|
||||
OpenFileMappingA (unsigned long, int, const char *);
|
||||
__declspec(dllimport) int __stdcall
|
||||
UnmapViewOfFile(void *);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // BOOST_DETAIL_WINAPI_MEMORY_HPP
|
@ -1,37 +0,0 @@
|
||||
// process.hpp --------------------------------------------------------------//
|
||||
|
||||
// Copyright 2010 Vicente J. Botet Escriba
|
||||
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
|
||||
#ifndef BOOST_DETAIL_WINAPI_PROCESS_HPP
|
||||
#define BOOST_DETAIL_WINAPI_PROCESS_HPP
|
||||
|
||||
#include <boost/detail/winapi/basic_types.hpp>
|
||||
#include <boost/detail/winapi/GetCurrentProcess.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace detail {
|
||||
namespace winapi {
|
||||
#if defined( BOOST_USE_WINDOWS_H )
|
||||
using ::GetCurrentProcessId;
|
||||
#else
|
||||
# ifndef UNDER_CE
|
||||
extern "C" {
|
||||
__declspec(dllimport) unsigned long __stdcall
|
||||
GetCurrentProcessId(void);
|
||||
}
|
||||
# else
|
||||
using ::GetCurrentProcessId;
|
||||
# endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // BOOST_DETAIL_WINAPI_PROCESS_HPP
|
@ -1,65 +0,0 @@
|
||||
// security.hpp --------------------------------------------------------------//
|
||||
|
||||
// Copyright 2010 Vicente J. Botet Escriba
|
||||
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
|
||||
#ifndef BOOST_DETAIL_WINAPI_SECURITY_HPP
|
||||
#define BOOST_DETAIL_WINAPI_SECURITY_HPP
|
||||
|
||||
#include <boost/detail/winapi/basic_types.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
namespace winapi
|
||||
{
|
||||
#if defined( BOOST_USE_WINDOWS_H )
|
||||
typedef ::SECURITY_ATTRIBUTES SECURITY_ATTRIBUTES_;
|
||||
typedef ::PSECURITY_ATTRIBUTES PSECURITY_ATTRIBUTES_;
|
||||
typedef ::LPSECURITY_ATTRIBUTES LPSECURITY_ATTRIBUTES_;
|
||||
|
||||
#else
|
||||
extern "C" {
|
||||
struct SECURITY_DESCRIPTOR_;
|
||||
typedef SECURITY_DESCRIPTOR_* PSECURITY_DESCRIPTOR_;
|
||||
typedef struct _ACL {
|
||||
BYTE_ AclRevision;
|
||||
BYTE_ Sbz1;
|
||||
WORD_ AclSize;
|
||||
WORD_ AceCount;
|
||||
WORD_ Sbz2;
|
||||
} ACL_, *PACL_;
|
||||
|
||||
typedef struct _SECURITY_ATTRIBUTES {
|
||||
DWORD_ nLength;
|
||||
LPVOID_ lpSecurityDescriptor;
|
||||
BOOL_ bInheritHandle;
|
||||
} SECURITY_ATTRIBUTES_, *PSECURITY_ATTRIBUTES_, *LPSECURITY_ATTRIBUTES_;
|
||||
|
||||
__declspec(dllimport) BOOL_ __stdcall
|
||||
InitializeSecurityDescriptor(
|
||||
PSECURITY_DESCRIPTOR_ pSecurityDescriptor,
|
||||
DWORD_ dwRevision
|
||||
);
|
||||
__declspec(dllimport) BOOL_ __stdcall
|
||||
SetSecurityDescriptorDacl(
|
||||
PSECURITY_DESCRIPTOR_ pSecurityDescriptor,
|
||||
BOOL_ bDaclPresent,
|
||||
PACL_ pDacl,
|
||||
BOOL_ bDaclDefaulted
|
||||
);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // BOOST_DETAIL_WINAPI_SECURITY_HPP
|
@ -1,146 +0,0 @@
|
||||
// synchronizaion.hpp --------------------------------------------------------------//
|
||||
|
||||
// Copyright 2010 Vicente J. Botet Escriba
|
||||
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
|
||||
#ifndef BOOST_DETAIL_WINAPI_SYNCHRONIZATION_HPP
|
||||
#define BOOST_DETAIL_WINAPI_SYNCHRONIZATION_HPP
|
||||
|
||||
#include <boost/detail/winapi/basic_types.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
namespace winapi
|
||||
{
|
||||
#if defined( BOOST_USE_WINDOWS_H )
|
||||
typedef ::CRITICAL_SECTION CRITICAL_SECTION_;
|
||||
typedef ::PAPCFUNC PAPCFUNC_;
|
||||
|
||||
using ::InitializeCriticalSection;
|
||||
using ::EnterCriticalSection;
|
||||
using ::TryEnterCriticalSection;
|
||||
using ::LeaveCriticalSection;
|
||||
using ::DeleteCriticalSection;
|
||||
|
||||
# ifdef BOOST_NO_ANSI_APIS
|
||||
using ::CreateMutexW;
|
||||
using ::CreateEventW;
|
||||
using ::OpenEventW;
|
||||
using ::CreateSemaphoreW;
|
||||
# else
|
||||
using ::CreateMutexA;
|
||||
using ::CreateEventA;
|
||||
using ::OpenEventA;
|
||||
using ::CreateSemaphoreA;
|
||||
# endif
|
||||
using ::ReleaseMutex;
|
||||
using ::ReleaseSemaphore;
|
||||
using ::SetEvent;
|
||||
using ::ResetEvent;
|
||||
using ::WaitForMultipleObjects;
|
||||
using ::WaitForSingleObject;
|
||||
using ::QueueUserAPC;
|
||||
|
||||
const DWORD_ infinite = INFINITE;
|
||||
const DWORD_ wait_abandoned = WAIT_ABANDONED;
|
||||
const DWORD_ wait_object_0 = WAIT_OBJECT_0;
|
||||
const DWORD_ wait_timeout = WAIT_TIMEOUT;
|
||||
const DWORD_ wait_failed = WAIT_FAILED;
|
||||
|
||||
#else // defined( BOOST_USE_WINDOWS_H )
|
||||
|
||||
extern "C" {
|
||||
|
||||
struct CRITICAL_SECTION_
|
||||
{
|
||||
struct critical_section_debug * DebugInfo;
|
||||
long LockCount;
|
||||
long RecursionCount;
|
||||
void * OwningThread;
|
||||
void * LockSemaphore;
|
||||
#if defined(_WIN64)
|
||||
unsigned __int64 SpinCount;
|
||||
#else
|
||||
unsigned long SpinCount;
|
||||
#endif
|
||||
};
|
||||
|
||||
__declspec(dllimport) void __stdcall
|
||||
InitializeCriticalSection(CRITICAL_SECTION_ *);
|
||||
__declspec(dllimport) void __stdcall
|
||||
EnterCriticalSection(CRITICAL_SECTION_ *);
|
||||
__declspec(dllimport) bool __stdcall
|
||||
TryEnterCriticalSection(CRITICAL_SECTION_ *);
|
||||
__declspec(dllimport) void __stdcall
|
||||
LeaveCriticalSection(CRITICAL_SECTION_ *);
|
||||
__declspec(dllimport) void __stdcall
|
||||
DeleteCriticalSection(CRITICAL_SECTION_ *);
|
||||
|
||||
struct _SECURITY_ATTRIBUTES;
|
||||
# ifdef BOOST_NO_ANSI_APIS
|
||||
__declspec(dllimport) void* __stdcall
|
||||
CreateMutexW(_SECURITY_ATTRIBUTES*,int,wchar_t const*);
|
||||
__declspec(dllimport) void* __stdcall
|
||||
CreateSemaphoreW(_SECURITY_ATTRIBUTES*,long,long,wchar_t const*);
|
||||
__declspec(dllimport) void* __stdcall
|
||||
CreateEventW(_SECURITY_ATTRIBUTES*,int,int,wchar_t const*);
|
||||
__declspec(dllimport) void* __stdcall
|
||||
OpenEventW(unsigned long,int,wchar_t const*);
|
||||
# else
|
||||
__declspec(dllimport) void* __stdcall
|
||||
CreateMutexA(_SECURITY_ATTRIBUTES*,int,char const*);
|
||||
__declspec(dllimport) void* __stdcall
|
||||
CreateSemaphoreA(_SECURITY_ATTRIBUTES*,long,long,char const*);
|
||||
__declspec(dllimport) void* __stdcall
|
||||
CreateEventA(_SECURITY_ATTRIBUTES*,int,int,char const*);
|
||||
__declspec(dllimport) void* __stdcall
|
||||
OpenEventA(unsigned long,int,char const*);
|
||||
# endif
|
||||
__declspec(dllimport) int __stdcall
|
||||
ReleaseMutex(void*);
|
||||
__declspec(dllimport) unsigned long __stdcall
|
||||
WaitForSingleObject(void*,unsigned long);
|
||||
__declspec(dllimport) unsigned long __stdcall
|
||||
WaitForMultipleObjects(unsigned long nCount,
|
||||
void* const * lpHandles,
|
||||
int bWaitAll,
|
||||
unsigned long dwMilliseconds);
|
||||
__declspec(dllimport) int __stdcall
|
||||
ReleaseSemaphore(void*,long,long*);
|
||||
typedef void (__stdcall *PAPCFUNC8)(ULONG_PTR_);
|
||||
__declspec(dllimport) unsigned long __stdcall
|
||||
QueueUserAPC(PAPCFUNC8,void*,ULONG_PTR_);
|
||||
# ifndef UNDER_CE
|
||||
__declspec(dllimport) int __stdcall
|
||||
SetEvent(void*);
|
||||
__declspec(dllimport) int __stdcall
|
||||
ResetEvent(void*);
|
||||
# else
|
||||
using ::SetEvent;
|
||||
using ::ResetEvent;
|
||||
# endif
|
||||
|
||||
} // extern "C"
|
||||
|
||||
const DWORD_ infinite = (DWORD_)0xFFFFFFFF;
|
||||
const DWORD_ wait_abandoned = 0x00000080L;
|
||||
const DWORD_ wait_object_0 = 0x00000000L;
|
||||
const DWORD_ wait_timeout = 0x00000102L;
|
||||
const DWORD_ wait_failed = (DWORD_)0xFFFFFFFF;
|
||||
|
||||
#endif // defined( BOOST_USE_WINDOWS_H )
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // BOOST_DETAIL_WINAPI_SYNCHRONIZATION_HPP
|
@ -1,52 +0,0 @@
|
||||
// system.hpp --------------------------------------------------------------//
|
||||
|
||||
// Copyright 2010 Vicente J. Botet Escriba
|
||||
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
|
||||
#ifndef BOOST_DETAIL_WINAPI_SYSTEM_HPP
|
||||
#define BOOST_DETAIL_WINAPI_SYSTEM_HPP
|
||||
|
||||
#include <boost/detail/winapi/basic_types.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace detail {
|
||||
namespace winapi {
|
||||
#if defined( BOOST_USE_WINDOWS_H )
|
||||
typedef ::SYSTEM_INFO SYSTEM_INFO_;
|
||||
extern "C" __declspec(dllimport) void __stdcall GetSystemInfo (struct system_info *);
|
||||
#else
|
||||
extern "C" {
|
||||
typedef struct _SYSTEM_INFO {
|
||||
union {
|
||||
DWORD_ dwOemId;
|
||||
struct {
|
||||
WORD_ wProcessorArchitecture;
|
||||
WORD_ wReserved;
|
||||
} dummy;
|
||||
} ;
|
||||
DWORD_ dwPageSize;
|
||||
LPVOID_ lpMinimumApplicationAddress;
|
||||
LPVOID_ lpMaximumApplicationAddress;
|
||||
DWORD_PTR_ dwActiveProcessorMask;
|
||||
DWORD_ dwNumberOfProcessors;
|
||||
DWORD_ dwProcessorType;
|
||||
DWORD_ dwAllocationGranularity;
|
||||
WORD_ wProcessorLevel;
|
||||
WORD_ wProcessorRevision;
|
||||
} SYSTEM_INFO_;
|
||||
|
||||
__declspec(dllimport) void __stdcall
|
||||
GetSystemInfo (struct system_info *);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif // BOOST_DETAIL_WINAPI_SYSTEM_HPP
|
@ -1,49 +0,0 @@
|
||||
// thread.hpp --------------------------------------------------------------//
|
||||
|
||||
// Copyright 2010 Vicente J. Botet Escriba
|
||||
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
|
||||
#ifndef BOOST_DETAIL_WINAPI_THREAD_HPP
|
||||
#define BOOST_DETAIL_WINAPI_THREAD_HPP
|
||||
|
||||
#include <boost/detail/winapi/basic_types.hpp>
|
||||
#include <boost/detail/winapi/GetCurrentThread.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
namespace winapi
|
||||
{
|
||||
#if defined( BOOST_USE_WINDOWS_H )
|
||||
using ::GetCurrentThreadId;
|
||||
using ::SleepEx;
|
||||
using ::Sleep;
|
||||
#else
|
||||
extern "C" {
|
||||
# ifndef UNDER_CE
|
||||
__declspec(dllimport) unsigned long __stdcall
|
||||
GetCurrentThreadId(void);
|
||||
__declspec(dllimport) unsigned long __stdcall
|
||||
SleepEx(unsigned long,int);
|
||||
__declspec(dllimport) void __stdcall
|
||||
Sleep(unsigned long);
|
||||
#else
|
||||
using ::GetCurrentThreadId;
|
||||
using ::SleepEx;
|
||||
using ::Sleep;
|
||||
#endif
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // BOOST_DETAIL_WINAPI_THREAD_HPP
|
@ -1,85 +0,0 @@
|
||||
// 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_WINAPI_TIME_HPP
|
||||
#define BOOST_DETAIL_WINAPI_TIME_HPP
|
||||
|
||||
#include <boost/detail/winapi/basic_types.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace detail {
|
||||
namespace winapi {
|
||||
#if defined( BOOST_USE_WINDOWS_H )
|
||||
typedef FILETIME FILETIME_;
|
||||
typedef PFILETIME PFILETIME_;
|
||||
typedef LPFILETIME LPFILETIME_;
|
||||
|
||||
typedef SYSTEMTIME SYSTEMTIME_;
|
||||
typedef SYSTEMTIME* PSYSTEMTIME_;
|
||||
|
||||
#ifdef BOOST_HAS_GETSYSTEMTIMEASFILETIME // 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_;
|
||||
|
||||
#ifdef BOOST_HAS_GETSYSTEMTIMEASFILETIME // Windows CE does not define GetSystemTimeAsFileTime
|
||||
__declspec(dllimport) void WINAPI
|
||||
GetSystemTimeAsFileTime(FILETIME_* lpFileTime);
|
||||
#endif
|
||||
__declspec(dllimport) int WINAPI
|
||||
FileTimeToLocalFileTime(const FILETIME_* lpFileTime,
|
||||
FILETIME_* lpLocalFileTime);
|
||||
__declspec(dllimport) void WINAPI
|
||||
GetSystemTime(SYSTEMTIME_* lpSystemTime);
|
||||
__declspec(dllimport) int WINAPI
|
||||
SystemTimeToFileTime(const SYSTEMTIME_* lpSystemTime,
|
||||
FILETIME_* lpFileTime);
|
||||
__declspec(dllimport) DWORD_ WINAPI
|
||||
GetTickCount();
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_HAS_GETSYSTEMTIMEASFILETIME
|
||||
inline void WINAPI GetSystemTimeAsFileTime(FILETIME_* lpFileTime)
|
||||
{
|
||||
SYSTEMTIME_ st;
|
||||
GetSystemTime(&st);
|
||||
SystemTimeToFileTime(&st, lpFileTime);
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endif // BOOST_DETAIL_WINAPI_TIME_HPP
|
@ -1,44 +0,0 @@
|
||||
// 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_WINAPI_TIMERS_HPP
|
||||
#define BOOST_DETAIL_WINAPI_TIMERS_HPP
|
||||
|
||||
#include <boost/detail/winapi/basic_types.hpp>
|
||||
|
||||
#ifdef BOOST_HAS_PRAGMA_ONCE
|
||||
#pragma once
|
||||
#endif
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
namespace winapi
|
||||
{
|
||||
#if defined( BOOST_USE_WINDOWS_H )
|
||||
using ::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_WINAPI_TIMERS_HPP
|
23
test/Jamfile
23
test/Jamfile
@ -1,23 +0,0 @@
|
||||
################################################################*# Jam #*#######
|
||||
# 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)
|
||||
################################################################################
|
||||
|
||||
build-project container_fwd ;
|
||||
|
||||
project detail/test
|
||||
: requirements
|
||||
<toolset>clang:<cxxflags>-Wno-unused
|
||||
<toolset>clang:<cxxflags>-Wno-tautological-compare
|
||||
<toolset>clang:<cxxflags>-ftemplate-depth-300
|
||||
<toolset>gcc:<cxxflags>-ftemplate-depth-300
|
||||
<toolset>darwin:<cxxflags>-ftemplate-depth-300
|
||||
;
|
||||
|
||||
for tests in [ glob *.cpp ] {
|
||||
run $(tests) : : : : $(tests:B) ;
|
||||
}
|
||||
|
||||
|
@ -1,29 +0,0 @@
|
||||
|
||||
# Copyright 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)
|
||||
|
||||
import testing ;
|
||||
|
||||
project detail/test/container_fwd
|
||||
: requirements
|
||||
<warnings>all
|
||||
<toolset>intel:<warnings>on
|
||||
<toolset>gcc:<cxxflags>"-pedantic -Wstrict-aliasing -fstrict-aliasing -Wextra -Wsign-promo -Wunused-parameter -Wconversion"
|
||||
<toolset>darwin:<cxxflags>"-pedantic -Wstrict-aliasing -fstrict-aliasing -Wextra -Wsign-promo -Wunused-parameter -Wconversion"
|
||||
<toolset>clang:<cxxflags>"-pedantic -Wextra -Wmismatched-tags"
|
||||
<warnings-as-errors>on
|
||||
;
|
||||
|
||||
run container_no_fwd_test.cpp ;
|
||||
run container_fwd_test.cpp : : : : container_fwd ;
|
||||
run container_fwd_test.cpp : :
|
||||
: <define>_STLP_DEBUG <define>_GLIBCXX_DEBUG
|
||||
: container_fwd_debug ;
|
||||
|
||||
compile-fail correctly_disable_fail.cpp
|
||||
: <warnings-as-errors>off
|
||||
: correctly_disable ;
|
||||
compile-fail correctly_disable_fail.cpp
|
||||
: <warnings-as-errors>off <define>_STLP_DEBUG <define>_GLIBCXX_DEBUG
|
||||
: correctly_disable_debug ;
|
@ -1,112 +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)
|
||||
|
||||
#include <boost/detail/container_fwd.hpp>
|
||||
|
||||
#if BOOST_WORKAROUND(__GNUC__, < 3) && \
|
||||
!defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION)
|
||||
template <class charT, class Allocator>
|
||||
static void test(
|
||||
std::basic_string<charT, std::string_char_traits<charT>, Allocator> const&)
|
||||
{
|
||||
}
|
||||
#else
|
||||
template <class charT, class Allocator>
|
||||
static void test(
|
||||
std::basic_string<charT, std::char_traits<charT>, Allocator> const&)
|
||||
{
|
||||
}
|
||||
#endif
|
||||
|
||||
template <class T, class Allocator>
|
||||
static void test(std::deque<T, Allocator> const&)
|
||||
{
|
||||
}
|
||||
|
||||
template <class T, class Allocator>
|
||||
static void test(std::list<T, Allocator> const&)
|
||||
{
|
||||
}
|
||||
|
||||
template <class T, class Allocator>
|
||||
static void test(std::vector<T, Allocator> const&)
|
||||
{
|
||||
}
|
||||
|
||||
template <class Key, class T, class Compare, class Allocator>
|
||||
static void test(std::map<Key, T, Compare, Allocator> const&)
|
||||
{
|
||||
}
|
||||
|
||||
template <class Key, class T, class Compare, class Allocator>
|
||||
static void test(std::multimap<Key, T, Compare, Allocator> const&)
|
||||
{
|
||||
}
|
||||
|
||||
template <class Key, class Compare, class Allocator>
|
||||
static void test(std::set<Key, Compare, Allocator> const&)
|
||||
{
|
||||
}
|
||||
|
||||
template <class Key, class Compare, class Allocator>
|
||||
static void test(std::multiset<Key, Compare, Allocator> const&)
|
||||
{
|
||||
}
|
||||
|
||||
template <std::size_t N>
|
||||
static void test(std::bitset<N> const&)
|
||||
{
|
||||
}
|
||||
|
||||
template <class T>
|
||||
static void test(std::complex<T> const&)
|
||||
{
|
||||
}
|
||||
|
||||
template <class X, class Y>
|
||||
static void test(std::pair<X, Y> const&)
|
||||
{
|
||||
}
|
||||
|
||||
#include <deque>
|
||||
#include <list>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <bitset>
|
||||
#include <string>
|
||||
#include <complex>
|
||||
#include <utility>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::deque<int> x1;
|
||||
std::list<std::string> x2;
|
||||
std::vector<float> x3;
|
||||
std::vector<bool> x4;
|
||||
std::map<int, int> x5;
|
||||
std::multimap<float, int*> x6;
|
||||
std::set<std::string> x7;
|
||||
std::multiset<std::vector<int> > x8;
|
||||
std::bitset<10> x9;
|
||||
std::string x10;
|
||||
std::complex<double> x11;
|
||||
std::pair<std::list<int>, char***> x12;
|
||||
|
||||
test(x1);
|
||||
test(x2);
|
||||
test(x3);
|
||||
test(x4);
|
||||
test(x5);
|
||||
test(x6);
|
||||
test(x7);
|
||||
test(x8);
|
||||
test(x9);
|
||||
test(x10);
|
||||
test(x11);
|
||||
test(x12);
|
||||
|
||||
return 0;
|
||||
}
|
@ -1,14 +0,0 @@
|
||||
|
||||
// Copyright 2010 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)
|
||||
|
||||
#define BOOST_DETAIL_NO_CONTAINER_FWD
|
||||
|
||||
#include <boost/detail/container_fwd.hpp>
|
||||
|
||||
int main()
|
||||
{
|
||||
std::set<int> x;
|
||||
std::vector<std::string> y;
|
||||
}
|
@ -1,43 +0,0 @@
|
||||
|
||||
// Copyright 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 tests if container forwarding is correctly disabled. If it isn't
|
||||
// disabled it causes a compile error (which causes the test to pass).
|
||||
// If it is disabled it tries container forwarding. If it doesn't work
|
||||
// then there will be a compile error, indicating that it is correctly
|
||||
// disabled. But if there isn't a compile error that indicates that
|
||||
// container forwarding might work.
|
||||
//
|
||||
// Since this test only tries std::vector, it might get it wrong but I didn't
|
||||
// want it to fail because of some incompatibility with a trickier class.
|
||||
|
||||
#define BOOST_DETAIL_TEST_CONFIG_ONLY
|
||||
#include <boost/detail/container_fwd.hpp>
|
||||
|
||||
#if !defined(BOOST_DETAIL_NO_CONTAINER_FWD)
|
||||
#error "Failing in order to pass test"
|
||||
#else
|
||||
#define BOOST_DETAIL_TEST_FORCE_CONTAINER_FWD
|
||||
|
||||
#undef BOOST_DETAIL_CONTAINER_FWD_HPP
|
||||
#undef BOOST_DETAIL_TEST_CONFIG_ONLY
|
||||
|
||||
#include <boost/detail/container_fwd.hpp>
|
||||
|
||||
template <class T, class Allocator>
|
||||
void test(std::vector<T, Allocator> const&)
|
||||
{
|
||||
}
|
||||
|
||||
#include <vector>
|
||||
|
||||
int main ()
|
||||
{
|
||||
std::vector<int> x;
|
||||
test(x);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -1,130 +0,0 @@
|
||||
/*==============================================================================
|
||||
Copyright (c) 2010-2011 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 <ios>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/array.hpp>
|
||||
#include <boost/detail/is_sorted.hpp>
|
||||
#include <boost/detail/lightweight_test.hpp>
|
||||
|
||||
template<class T>
|
||||
struct tracking_less: std::binary_function <T, T, bool> {
|
||||
typedef bool result_type;
|
||||
|
||||
#if defined(__PATHSCALE__)
|
||||
tracking_less (void) { }
|
||||
~tracking_less (void) { }
|
||||
#endif
|
||||
|
||||
bool operator() (T const& x, T const& y) const {
|
||||
std::cout << x << " < " << y << " == " << (x < y) << "\n";
|
||||
return x < y;
|
||||
}
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct tracking_less_equal: std::binary_function <T, T, bool> {
|
||||
typedef bool result_type;
|
||||
|
||||
#if defined(__PATHSCALE__)
|
||||
tracking_less_equal (void) { }
|
||||
~tracking_less_equal (void) { }
|
||||
#endif
|
||||
|
||||
bool operator() (T const& x, T const& y) const {
|
||||
std::cout << x << " <= " << y << " == " << (x <= y) << "\n";
|
||||
return x <= y;
|
||||
}
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct tracking_greater: std::binary_function <T, T, bool> {
|
||||
typedef bool result_type;
|
||||
|
||||
#if defined(__PATHSCALE__)
|
||||
tracking_greater (void) { }
|
||||
~tracking_greater (void) { }
|
||||
#endif
|
||||
|
||||
bool operator() (T const& x, T const& y) const {
|
||||
std::cout << x << " > " << y << " == " << (x > y) << "\n";
|
||||
return x > y;
|
||||
}
|
||||
};
|
||||
|
||||
template<class T>
|
||||
struct tracking_greater_equal: std::binary_function <T, T, bool> {
|
||||
typedef bool result_type;
|
||||
|
||||
#if defined(__PATHSCALE__)
|
||||
tracking_greater_equal (void) { }
|
||||
~tracking_greater_equal (void) { }
|
||||
#endif
|
||||
|
||||
bool operator() (T const& x, T const& y) const {
|
||||
std::cout << x << " >= " << y << " == " << (x >= y) << "\n";
|
||||
return x >= y;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
int main (void) {
|
||||
#define IS_SORTED ::boost::detail::is_sorted
|
||||
#define IS_SORTED_UNTIL ::boost::detail::is_sorted_until
|
||||
using boost::array;
|
||||
using boost::report_errors;
|
||||
|
||||
std::cout << std::boolalpha;
|
||||
|
||||
array<int, 10> a = { { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 } };
|
||||
array<int, 10> b = { { 0, 1, 1, 2, 5, 8, 13, 34, 55, 89 } };
|
||||
array<int, 10> c = { { 0, 1, -1, 2, -3, 5, -8, 13, -21, 34 } };
|
||||
|
||||
tracking_less<int> lt;
|
||||
tracking_less_equal<int> lte;
|
||||
tracking_greater<int> gt;
|
||||
tracking_greater_equal<int> gte;
|
||||
|
||||
BOOST_TEST_EQ(IS_SORTED_UNTIL(a.begin(), a.end()), a.end());
|
||||
BOOST_TEST_EQ(IS_SORTED_UNTIL(a.begin(), a.end(), lt), a.end());
|
||||
BOOST_TEST_EQ(IS_SORTED_UNTIL(a.begin(), a.end(), lte), a.end());
|
||||
BOOST_TEST_EQ(*IS_SORTED_UNTIL(a.rbegin(), a.rend(), gt), *a.rend());
|
||||
BOOST_TEST_EQ(*IS_SORTED_UNTIL(a.rbegin(), a.rend(), gte), *a.rend());
|
||||
|
||||
BOOST_TEST_EQ(IS_SORTED(a.begin(), a.end()), true);
|
||||
BOOST_TEST_EQ(IS_SORTED(a.begin(), a.end(), lt), true);
|
||||
BOOST_TEST_EQ(IS_SORTED(a.begin(), a.end(), lte), true);
|
||||
BOOST_TEST_EQ(IS_SORTED(a.rbegin(), a.rend(), gt), true);
|
||||
BOOST_TEST_EQ(IS_SORTED(a.rbegin(), a.rend(), gte), true);
|
||||
|
||||
BOOST_TEST_EQ(IS_SORTED_UNTIL(b.begin(), b.end()), b.end());
|
||||
BOOST_TEST_EQ(IS_SORTED_UNTIL(b.begin(), b.end(), lt), b.end());
|
||||
BOOST_TEST_EQ(IS_SORTED_UNTIL(b.begin(), b.end(), lte), &b[2]);
|
||||
BOOST_TEST_EQ(*IS_SORTED_UNTIL(b.rbegin(), b.rend(), gt), *b.rend());
|
||||
BOOST_TEST_EQ(*IS_SORTED_UNTIL(b.rbegin(), b.rend(), gte), b[2]);
|
||||
|
||||
BOOST_TEST_EQ(IS_SORTED(b.begin(), b.end()), true);
|
||||
BOOST_TEST_EQ(IS_SORTED(b.begin(), b.end(), lt), true);
|
||||
BOOST_TEST_EQ(IS_SORTED(b.begin(), b.end(), lte), false);
|
||||
BOOST_TEST_EQ(IS_SORTED(b.rbegin(), b.rend(), gt), true);
|
||||
BOOST_TEST_EQ(IS_SORTED(b.rbegin(), b.rend(), gte), false);
|
||||
|
||||
BOOST_TEST_EQ(IS_SORTED_UNTIL(c.begin(), c.end()), &c[2]);
|
||||
BOOST_TEST_EQ(IS_SORTED_UNTIL(c.begin(), c.end(), lt), &c[2]);
|
||||
BOOST_TEST_EQ(IS_SORTED_UNTIL(c.begin(), c.end(), lte), &c[2]);
|
||||
BOOST_TEST_EQ(*IS_SORTED_UNTIL(c.rbegin(), c.rend(), gt), c[7]);
|
||||
BOOST_TEST_EQ(*IS_SORTED_UNTIL(c.rbegin(), c.rend(), gte), c[7]);
|
||||
|
||||
BOOST_TEST_EQ(IS_SORTED(c.begin(), c.end()), false);
|
||||
BOOST_TEST_EQ(IS_SORTED(c.begin(), c.end(), lt), false);
|
||||
BOOST_TEST_EQ(IS_SORTED(c.begin(), c.end(), lte), false);
|
||||
BOOST_TEST_EQ(IS_SORTED(c.rbegin(), c.rend(), gt), false);
|
||||
BOOST_TEST_EQ(IS_SORTED(c.rbegin(), c.rend(), gte), false);
|
||||
|
||||
return report_errors();
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// utf8_codecvt_facet.ipp
|
||||
// utf8_codecvt_facet.cpp
|
||||
|
||||
// Copyright (c) 2001 Ronald Garcia, Indiana University (garcia@osl.iu.edu)
|
||||
// Andrew Lumsdaine, Indiana University (lums@osl.iu.edu).
|
Reference in New Issue
Block a user