Squashed 'boost/' content from commit b4feb19f2

git-subtree-dir: boost
git-subtree-split: b4feb19f287ee92d87a9624b5d36b7cf46aeadeb
This commit is contained in:
Bill Somerville
2018-06-09 21:48:32 +01:00
commit 4ebe6417a5
12444 changed files with 2327021 additions and 0 deletions
+37
View File
@@ -0,0 +1,37 @@
# Boost.Atomic Library Jamfile
#
# Copyright Helge Bahmann 2011.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
import common ;
project boost/atomic
: requirements
<threading>multi
<link>shared:<define>BOOST_ATOMIC_DYN_LINK=1
<link>static:<define>BOOST_ATOMIC_STATIC_LINK=1
<define>BOOST_ATOMIC_SOURCE
<target-os>windows:<define>BOOST_USE_WINDOWS_H
<target-os>windows:<define>_WIN32_WINNT=0x0500
<toolset>gcc,<target-os>windows:<linkflags>"-lkernel32"
: usage-requirements
<link>shared:<define>BOOST_ATOMIC_DYN_LINK=1
<link>static:<define>BOOST_ATOMIC_STATIC_LINK=1
: source-location ../src
;
alias atomic_sources
: lockpool.cpp
;
explicit atomic_sources ;
lib boost_atomic
: atomic_sources
;
boost-install boost_atomic ;
+161
View File
@@ -0,0 +1,161 @@
/*
* Distributed under the Boost Software License, Version 1.0.
* (See accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt)
*
* Copyright (c) 2011 Helge Bahmann
* Copyright (c) 2013-2014 Andrey Semashev
*/
/*!
* \file lockpool.cpp
*
* This file contains implementation of the lockpool used to emulate atomic ops.
*/
#include <cstddef>
#include <boost/config.hpp>
#include <boost/assert.hpp>
#include <boost/memory_order.hpp>
#include <boost/atomic/capabilities.hpp>
#if BOOST_ATOMIC_FLAG_LOCK_FREE == 2
#include <boost/atomic/detail/operations_lockfree.hpp>
#elif !defined(BOOST_HAS_PTHREADS)
#error Boost.Atomic: Unsupported target platform, POSIX threads are required when native atomic operations are not available
#else
#include <pthread.h>
#define BOOST_ATOMIC_USE_PTHREAD
#endif
#include <boost/atomic/detail/lockpool.hpp>
#include <boost/atomic/detail/pause.hpp>
#if defined(BOOST_MSVC)
#pragma warning(push)
// 'struct_name' : structure was padded due to __declspec(align())
#pragma warning(disable: 4324)
#endif
namespace boost {
namespace atomics {
namespace detail {
namespace {
// This seems to be the maximum across all modern CPUs
// NOTE: This constant is made as a macro because some compilers (gcc 4.4 for one) don't allow enums or namespace scope constants in alignment attributes
#define BOOST_ATOMIC_CACHE_LINE_SIZE 64
#if defined(BOOST_ATOMIC_USE_PTHREAD)
typedef pthread_mutex_t lock_type;
#else
typedef atomics::detail::operations< 1u, false > lock_operations;
typedef lock_operations::storage_type lock_type;
#endif
enum
{
padding_size = (sizeof(lock_type) <= BOOST_ATOMIC_CACHE_LINE_SIZE ?
(BOOST_ATOMIC_CACHE_LINE_SIZE - sizeof(lock_type)) :
(BOOST_ATOMIC_CACHE_LINE_SIZE - sizeof(lock_type) % BOOST_ATOMIC_CACHE_LINE_SIZE))
};
template< unsigned int PaddingSize >
struct BOOST_ALIGNMENT(BOOST_ATOMIC_CACHE_LINE_SIZE) padded_lock
{
lock_type lock;
// The additional padding is needed to avoid false sharing between locks
char padding[PaddingSize];
};
template< >
struct BOOST_ALIGNMENT(BOOST_ATOMIC_CACHE_LINE_SIZE) padded_lock< 0u >
{
lock_type lock;
};
typedef padded_lock< padding_size > padded_lock_t;
static padded_lock_t g_lock_pool[41]
#if defined(BOOST_ATOMIC_USE_PTHREAD)
=
{
{ PTHREAD_MUTEX_INITIALIZER }, { PTHREAD_MUTEX_INITIALIZER }, { PTHREAD_MUTEX_INITIALIZER }, { PTHREAD_MUTEX_INITIALIZER }, { PTHREAD_MUTEX_INITIALIZER },
{ PTHREAD_MUTEX_INITIALIZER }, { PTHREAD_MUTEX_INITIALIZER }, { PTHREAD_MUTEX_INITIALIZER }, { PTHREAD_MUTEX_INITIALIZER }, { PTHREAD_MUTEX_INITIALIZER },
{ PTHREAD_MUTEX_INITIALIZER }, { PTHREAD_MUTEX_INITIALIZER }, { PTHREAD_MUTEX_INITIALIZER }, { PTHREAD_MUTEX_INITIALIZER }, { PTHREAD_MUTEX_INITIALIZER },
{ PTHREAD_MUTEX_INITIALIZER }, { PTHREAD_MUTEX_INITIALIZER }, { PTHREAD_MUTEX_INITIALIZER }, { PTHREAD_MUTEX_INITIALIZER }, { PTHREAD_MUTEX_INITIALIZER },
{ PTHREAD_MUTEX_INITIALIZER }, { PTHREAD_MUTEX_INITIALIZER }, { PTHREAD_MUTEX_INITIALIZER }, { PTHREAD_MUTEX_INITIALIZER }, { PTHREAD_MUTEX_INITIALIZER },
{ PTHREAD_MUTEX_INITIALIZER }, { PTHREAD_MUTEX_INITIALIZER }, { PTHREAD_MUTEX_INITIALIZER }, { PTHREAD_MUTEX_INITIALIZER }, { PTHREAD_MUTEX_INITIALIZER },
{ PTHREAD_MUTEX_INITIALIZER }, { PTHREAD_MUTEX_INITIALIZER }, { PTHREAD_MUTEX_INITIALIZER }, { PTHREAD_MUTEX_INITIALIZER }, { PTHREAD_MUTEX_INITIALIZER },
{ PTHREAD_MUTEX_INITIALIZER }, { PTHREAD_MUTEX_INITIALIZER }, { PTHREAD_MUTEX_INITIALIZER }, { PTHREAD_MUTEX_INITIALIZER }, { PTHREAD_MUTEX_INITIALIZER },
{ PTHREAD_MUTEX_INITIALIZER }
}
#endif
;
} // namespace
#if !defined(BOOST_ATOMIC_USE_PTHREAD)
// NOTE: This function must NOT be inline. Otherwise MSVC 9 will sometimes generate broken code for modulus operation which result in crashes.
BOOST_ATOMIC_DECL lockpool::scoped_lock::scoped_lock(const volatile void* addr) BOOST_NOEXCEPT :
m_lock(&g_lock_pool[reinterpret_cast< std::size_t >(addr) % (sizeof(g_lock_pool) / sizeof(*g_lock_pool))].lock)
{
while (lock_operations::test_and_set(*static_cast< lock_type* >(m_lock), memory_order_acquire))
{
do
{
atomics::detail::pause();
}
while (!!lock_operations::load(*static_cast< lock_type* >(m_lock), memory_order_relaxed));
}
}
BOOST_ATOMIC_DECL lockpool::scoped_lock::~scoped_lock() BOOST_NOEXCEPT
{
lock_operations::clear(*static_cast< lock_type* >(m_lock), memory_order_release);
}
BOOST_ATOMIC_DECL void signal_fence() BOOST_NOEXCEPT;
#else // !defined(BOOST_ATOMIC_USE_PTHREAD)
BOOST_ATOMIC_DECL lockpool::scoped_lock::scoped_lock(const volatile void* addr) BOOST_NOEXCEPT :
m_lock(&g_lock_pool[reinterpret_cast< std::size_t >(addr) % (sizeof(g_lock_pool) / sizeof(*g_lock_pool))].lock)
{
BOOST_VERIFY(pthread_mutex_lock(static_cast< pthread_mutex_t* >(m_lock)) == 0);
}
BOOST_ATOMIC_DECL lockpool::scoped_lock::~scoped_lock() BOOST_NOEXCEPT
{
BOOST_VERIFY(pthread_mutex_unlock(static_cast< pthread_mutex_t* >(m_lock)) == 0);
}
#endif // !defined(BOOST_ATOMIC_USE_PTHREAD)
BOOST_ATOMIC_DECL void lockpool::thread_fence() BOOST_NOEXCEPT
{
#if BOOST_ATOMIC_THREAD_FENCE > 0
atomics::detail::thread_fence(memory_order_seq_cst);
#else
// Emulate full fence by locking/unlocking a mutex
scoped_lock lock(0);
#endif
}
BOOST_ATOMIC_DECL void lockpool::signal_fence() BOOST_NOEXCEPT
{
// This function is intentionally non-inline, even if empty. This forces the compiler to treat its call as a compiler barrier.
#if BOOST_ATOMIC_SIGNAL_FENCE > 0
atomics::detail::signal_fence(memory_order_seq_cst);
#endif
}
} // namespace detail
} // namespace atomics
} // namespace boost
#if defined(BOOST_MSVC)
#pragma warning(pop)
#endif
+118
View File
@@ -0,0 +1,118 @@
# Boost Chrono Library Build Jamfile
# Copyright Beman Dawes 2002, 2006, 2008
# Copyright 2009-2012 Vicente J.Botet Escriba.
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or www.boost.org/LICENSE_1_0.txt)
# See library home page at http://www.boost.org/libs/chrono
project boost/chrono
: source-location ../src
: requirements
<target-os>freebsd:<linkflags>"-lrt"
<target-os>linux:<linkflags>"-lrt -lpthread"
<toolset>pgi:<linkflags>"-lrt"
#<threading>single:<define>BOOST_CHRONO_THREAD_DISABLED
<library>/boost/system//boost_system
#<define>BOOST_ERROR_CODE_HEADER_ONLY
#<define>BOOST_SYSTEM_INLINED
#<define>BOOST_COMMON_TYPE_USES_STATIC_ASSERT
#<define>BOOST_RATIO_USES_STATIC_ASSERT
#<define>BOOST_CHRONO_USES_STATIC_ASSERT
#<define>BOOST_COMMON_TYPE_USES_MPL_ASSERT
#<define>BOOST_RATIO_USES_MPL_ASSERT
#<define>BOOST_CHRONO_USES_MPL_ASSERT
#<define>BOOST_COMMON_TYPE_USES_ARRAY_ASSERT
#<define>BOOST_RATIO_USES_ARRAY_ASSERT
#<define>BOOST_CHRONO_USES_ARRAY_ASSERT
<toolset>sun:<define>__typeof__=__typeof__
<define>BOOST_SYSTEM_NO_DEPRECATED
#<toolset>gcc-3.4.4:<linkflags>--enable-auto-import
#<toolset>gcc-4.3.4:<linkflags>--enable-auto-import
#<toolset>gcc-mingw-4.4.0:<linkflags>--enable-auto-import
#<toolset>gcc-mingw-4.5.0:<linkflags>--enable-auto-import
<warnings>all
<toolset>gcc:<cxxflags>-Wextra
#<toolset>gcc:<cxxflags>-pedantic
<toolset>clang:<warnings>on
<toolset>gcc:<cxxflags>-Wno-long-long
#<toolset>gcc:<cxxflags>-Wno-variadic-macros
<toolset>gcc-4:<cxxflags>-Wno-variadic-macros
<toolset>gcc-5:<cxxflags>-Wno-variadic-macros
<toolset>darwin:<cxxflags>-Wextra
<toolset>darwin:<cxxflags>-pedantic
<toolset>darwin:<cxxflags>-Wno-long-long
#<toolset>darwin:<cxxflags>-Wno-variadic-macros
<toolset>darwin-4:<cxxflags>-Wno-variadic-macros
<toolset>darwin-5:<cxxflags>-Wno-variadic-macros
#<toolset>pathscale:<cxxflags>-Wextra
<toolset>pathscale:<cxxflags>-Wno-long-long
<toolset>pathscale:<cxxflags>-pedantic
<toolset>clang:<cxxflags>-Wextra
<toolset>clang:<cxxflags>-pedantic
<toolset>clang:<cxxflags>-Wno-long-long
<toolset>clang:<cxxflags>-Wno-variadic-macros
<toolset>gcc-4.4.0,<target-os>windows:<cxxflags>-fdiagnostics-show-option
<toolset>gcc-4.5.0,<target-os>windows:<cxxflags>-fdiagnostics-show-option
<toolset>gcc-4.6.0,<target-os>windows:<cxxflags>-fdiagnostics-show-option
<toolset>gcc-4.6.3,<target-os>windows:<cxxflags>-fdiagnostics-show-option
<toolset>gcc-4.7.0,<target-os>windows:<cxxflags>-fdiagnostics-show-option
<toolset>gcc-4.8.0,<target-os>windows:<cxxflags>-fdiagnostics-show-option
<toolset>msvc:<cxxflags>/wd4512
# Note: Some of the remarks from the Intel compiler are disabled
# remark #193: zero used for undefined preprocessing identifier "XXX"
# remark #304: access control not specified ("public" by default)
# remark #383: value copied to temporary, reference to temporary used
# remark #444: destructor for base class "XXX" (declared at line YYY") is not virtual
# remark #593: variable "XXX" was set but never used
# remark #981: operands are evaluated in unspecified order
# remark #1418: external function definition with no prior declaration
# remark #2415: variable "XXX" of static storage duration was declared but never referenced
<toolset>intel:<cxxflags>-wd193,304,383,444
<toolset>intel:<cxxflags>-wd593,981
<toolset>intel:<cxxflags>-wd1418
<toolset>intel:<cxxflags>-wd2415
: usage-requirements # pass these requirement to dependents (i.e. users)
<threading>single:<define>BOOST_CHRONO_THREAD_DISABLED
<library>/boost/system//boost_system
#<define>BOOST_ERROR_CODE_HEADER_ONLY
#<define>BOOST_SYSTEM_INLINED
#<define>BOOST_COMMON_TYPE_USES_STATIC_ASSERT
#<define>BOOST_RATIO_USES_STATIC_ASSERT
#<define>BOOST_CHRONO_USES_STATIC_ASSERT
#<define>BOOST_COMMON_TYPE_USES_MPL_ASSERT
#<define>BOOST_RATIO_USES_MPL_ASSERT
#<define>BOOST_CHRONO_USES_MPL_ASSERT
#<define>BOOST_COMMON_TYPE_USES_ARRAY_ASSERT
#<define>BOOST_RATIO_USES_ARRAY_ASSERT
#<define>BOOST_CHRONO_USES_ARRAY_ASSERT
#<toolset>vacpp:<define>BOOST_COMMON_TYPE_DONT_USE_TYPEOF
<toolset>vacpp:<define>BOOST_TYPEOF_EMULATION
<toolset>sun:<define>__typeof__=__typeof__
<define>BOOST_SYSTEM_NO_DEPRECATED
<link>shared:<define>BOOST_CHRONO_DYN_LINK=1
<link>static:<define>BOOST_CHRONO_STATIC_LINK=1
<toolset>gcc-3.4.4:<linkflags>--enable-auto-import
<toolset>gcc-4.3.4:<linkflags>--enable-auto-import
<toolset>gcc-4.4.0,<target-os>windows:<linkflags>--enable-auto-import
<toolset>gcc-4.5.0,<target-os>windows:<linkflags>--enable-auto-import
;
SOURCES = chrono thread_clock process_cpu_clocks ;
lib boost_chrono
: $(SOURCES).cpp
:
<link>shared:<define>BOOST_ALL_DYN_LINK=1 # tell source we're building dll's
<link>static:<define>BOOST_All_STATIC_LINK=1 # tell source we're building static lib's
;
+15
View File
@@ -0,0 +1,15 @@
// chrono.cpp --------------------------------------------------------------//
// Copyright Beman Dawes 2008
// Copyright Vicente J. Botet Escriba 2009-2010
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
// define BOOST_CHRONO_SOURCE so that <boost/filesystem/config.hpp> knows
// the library is being built (possibly exporting rather than importing code)
#define BOOST_CHRONO_SOURCE
#include <boost/chrono/detail/inlined/chrono.hpp>
+18
View File
@@ -0,0 +1,18 @@
// boost process_cpu_clocks.cpp -----------------------------------------------------------//
// Copyright 2009-2010 Vicente J. Botet Escriba
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
// See http://www.boost.org/libs/chrono for documentation.
//--------------------------------------------------------------------------------------//
// define BOOST_CHRONO_SOURCE so that <boost/chrono/config.hpp> knows
// the library is being built (possibly exporting rather than importing code)
#define BOOST_CHRONO_SOURCE
#include <boost/chrono/detail/inlined/process_cpu_clocks.hpp>
+19
View File
@@ -0,0 +1,19 @@
// boost thread_clock.cpp -----------------------------------------------------------//
// Copyright 2010 Vicente J. Botet Escriba
// Distributed under the Boost Software License, Version 1.0.
// See http://www.boost.org/LICENSE_1_0.txt
// See http://www.boost.org/libs/chrono for documentation.
//--------------------------------------------------------------------------------------//
// define BOOST_CHRONO_SOURCE so that <boost/chrono/config.hpp> knows
// the library is being built (possibly exporting rather than importing code)
#define BOOST_CHRONO_SOURCE
#include <boost/chrono/detail/inlined/thread_clock.hpp>
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,22 @@
# circular_buffer.idx index script file
# for Boost.circular_buffer Quickbook Doxygen documentation Auto-indexing forcircular_buffer library.
# Copyright (c) 2011 Paul A. Bristow
# Copyright (c) 2003 - 2008 Jan Gaspar
# boost-no-inspect
# Use, modification and distribution is subject to the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt
# or copy at http://www.boost.org/LICENSE_1_0.txt)
# All header files, recursing down to include sub-folders.
!scan-path "boost/circular_buffer" ".*\.hpp" true
# All example source files, assuming no sub-folders.
!scan-path "libs/circular_buffer/example" ".*\.cpp"
@@ -0,0 +1,626 @@
[article Boost.Circular Buffer
[quickbook 1.6]
[id circular_buffer]
[copyright 2003-2013 Jan Gaspar]
[license
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
[@http://www.boost.org/LICENSE_1_0.txt])
]
[authors [Gaspar, Jan]]
[source-mode c++]
]
[/ Links - by (most common) convention, prefixed with double underscore so not confused with other names.]
[def __alert [$./images/alert.png]] [/ Examples of your own images (in doc/html/images/ .]
[def __tip [$./images/tip.png]]
[/ If you provide a file type like .png, you will probably find that the file is missing in the pdf version.]
[/ This is because the default file type specified is .png in html, but .svg for pdf version.]
[/ Some links to external sources.]
[/ You often want to link more than once, so using a def ensures you always refer to the same location.]
[def __boost [@http://www.boost.org/ Boost]] [/Boost.org]
[def __boostroot [@boost: Boost root]] [/ Your boost root]
[/Note the custom boost root url schema for linking to files within the Boost distribution.]
[/Note It can't be used for images, nor for pdf, so not so useful.]
[/def __boostlicense [@http://www.boost.org/LICENSE_1_0.txt Boost License]]
[/ Or refer to your most recent version of Boost.]
[def __boostlicense [@boost:/LICENSE_1_0.txt Boost License]]
[def __boostbook [@http://www.boost.org/doc/html/boostbook.html BoostBook]]
[def __boostbook_docs [@http://www.boost.org/doc/libs/1_53_0/doc/html/boostbook.html BoostBook documentation]]
[def __quickbook [@http://www.boost.org/doc/tools/quickbook/index.html Quickbook]]
[def __quickbook_syntax [@http://www.boost.org/doc/libs/1_53_0/doc/html/quickbook/ref.html Quickbook Syntax Compendium]]
[def __docbook [@http://www.docbook.org/ DocBook]]
[def __doxygen [@http://www.doxygen.org/ Doxygen]]
[def __autoindex [@boost:/tools/auto_index/doc/html/index.html AutoIndex]]
[def __pdf [@http://www.adobe.com/products/acrobat/adobepdf.html PDF]]
[def __textpad [@http://www.textpad.com Textpad]]
[def __emacs [@http://www.gnu.org/software/emacs/ GNU emacs]]
[def __css [@http://en.wikipedia.org/wiki/Cascading_Style_Sheets Cascading Style Sheet]]
[def __intro [link circular_buffer.intro Introduction]] [/Link to a Quickbook section (see below).]
[def __docbook_params [@http://docbook.sourceforge.net/release/xsl/current/doc/ Docbook xsl:param format options]]
[def __cb [classref boost::circular_buffer circular_buffer]]
[def __cbso [classref boost::circular_buffer_space_optimized circular_buffer_space_optimized]]
[def __min_capacity [memberref boost::circular_buffer_space_optimized::min_capacity() min_capacity]]
[def __capacity_control [memberref boost::circular_buffer_space_optimized::capacity_control () capacity_control ]]
[def __debug_support [link circular_buffer.implmentation.debug_support debug support]]
[include ../../../tools/auto_index/include/auto_index_helpers.qbk]
[/ Must be first included file!]
[note A printer-friendly PDF version of this manual is also available.]
[section:intro Introduction]
A Circular Buffer.
[h2 Description]
The term [@http://en.wikipedia.org/wiki/Circular_buffer circular buffer]
(also called a ['ring] or ['cyclic buffer])
refers to an area in memory which is used to store incoming data.
When the buffer is filled,
new data is written starting at the beginning of the buffer and overwriting the old.
[classref boost::circular_buffer] is a STL compliant container.
It is a kind of sequence similar to [@http://www.sgi.com/tech/stl/List.html std::list]
or [@http://www.sgi.com/tech/stl/Deque.html std::deque].
It supports random access iterators, constant time insert and erase operations
at the beginning or the end of the buffer and interoperability with std algorithms.
The __cb is especially designed to provide [*fixed capacity] storage.
When its capacity is exhausted, newly inserted elements will cause elements
to be overwritten, either at the beginning or end of the buffer
(depending on what insert operation is used).
The __cb only allocates memory when created,
when the capacity is adjusted explicitly,
or as necessary to accommodate resizing or assign operations.
[$../../libs/circular_buffer/doc/images/circular_buffer.png]
There is also a __cbso version available.
[$../../libs/circular_buffer/doc/images/space_optimized.png]
__cbso is an adaptation of the __cb
which [*does not allocate memory all at once when created],
instead it allocates memory as needed.
The predictive memory allocation is similar to typical `std::vector` implementation.
Memory is automatically freed as the size of the container decreases.
The memory allocation process of the space-optimized circular buffer.
The __min_capacity of the capacity controller represents
the minimal guaranteed amount of allocated memory.
The allocated memory will never drop under this value.
The default value of the `min_capacity` is set to 0.
The `min_capacity` can be set using the constructor parameter __capacity_control
or the function `set_capacity`.
The space-optimized version is, of course, a little slower.
[endsect] [/section:intro Introduction]
[section:example Circular_buffer example]
Here is a simple example to introduce the class __cb.
[import ../example/circular_buffer_example.cpp]
[circular_buffer_example_1]
This example shows contruction, inserting elements, overwriting and popping.
[circular_buffer_example_2]
[/circular_buffer_example_output - there is no output for this example]
You can see the full example code at [@boost:libs/circular_buffer/example/circular_buffer_example.cpp circular_buffer_example.cpp].
The full annotated description is in the C++ Reference section.
[endsect] [/section:example circular_buffer example]
[section:rationale Rationale]
The basic motivation behind the __cb was to create a container which would [*work seamlessly with STL].
Additionally, the design of the __cb was guided by the following principles:
* Maximum ['efficiency] for envisaged applications.
* Suitable for ['general purpose use].
* The behaviour of the buffer as ['intuitive] as possible.
* Suitable for ['specialization] by means of adaptors. (The __cbso is such an example of the adaptor.)
* Easy to ['debug]. (See Debug Support for details.)
In order to achieve maximum efficiency, the __cb and __cbso store their elements in a
[*contiguous region of memory], which then enables:
* Use of fixed memory and no implicit or unexpected memory allocation.
* Fast constant-time insertion and removal of elements from the front and back.
* Fast constant-time random access of elements.
* Suitability for real-time and performance critical applications.
Possible applications of the circular buffer include:
* Storage of the ['most recently received samples], overwriting the oldest as new samples arrive.
* As an underlying container for a ['bounded buffer]
(see the Bounded Buffer example, code at [@boost:libs/circular_buffer/example/circular_buffer_bound_example.cpp circular_buffer_bound_example.cpp]).
* A kind of ['cache] storing a specified number of last inserted elements.
* Efficient fixed capacity ['FIFO (First In, First Out)],
* Efficient fixed capacity ['LIFO (Last In, First Out)] queue which removes the oldest (inserted as first) elements when full.
[endsect] [/section:rationale Rationale]
[section:implementation Implementation ]
The following paragraphs describe issues that had to be considered during the implementation of the circular_buffer:
[h3 Thread-Safety]
The thread-safety of the __cb is the same as the thread-safety of containers in most STL implementations.
This means the __cb is not fully thread-safe.
The thread-safety is guaranteed only in the sense that simultaneous accesses
to distinct instances of the __cb are safe,
and simultaneous read accesses to a shared __cb are safe.
If multiple threads access a single __cb,
and at least one of the threads may potentially write,
then the user is responsible for ensuring mutual exclusion between the threads during the container accesses.
The mutual exclusion between the threads can be achieved by wrapping
operations of the underlying __cb with a lock acquisition and release.
(See the Bounded Buffer example code at [@boost:libs/circular_buffer/example/circular_buffer_bound_example.cpp circular_buffer_bound_example.cpp])
[h3 Overwrite Operation]
Overwrite operation occurs when an element is inserted into a full __cb -
the old element is being overwritten by the new one.
There was a discussion what exactly "overwriting of an element" means during the formal review.
It may be either a destruction of the original element and
a consequent inplace construction of a new element
or it may be an assignment of a new element into an old one.
The __cb implements assignment because it is more effective.
From the point of business logic of a stored element,
the destruction/construction operation and assignment usually mean the same.
However, in very rare cases (if in any) they may differ.
If there is a requirement for elements to be destructed/constructed instead of being assigned,
consider implementing a wrapper of the element which would implement the assign operator,
and store the wrappers instead.
It is necessary to note that storing such wrappers has a drawback.
The destruction/construction will be invoked on every assignment of the wrapper -
not only when a wrapper is being overwritten (when the buffer is full)
but also when the stored wrappers are being shifted
(e.g. as a result of insertion into the middle of container).
[h3 Writing to a Full Buffer]
There are several options how to cope if a data source produces more data than can fit in the fixed-sized buffer:
* Inform the data source to wait until there is room in the buffer (e.g. by throwing an overflow exception).
* If the oldest data is the most important, ignore new data from the source until there is room in the buffer again.
* If the latest data is the most important, write over the oldest data.
* Let the producer to be responsible for checking the size of the buffer prior writing into it.
It is apparent that the __cb implements the third option.
But it may be less apparent it does not implement any other option -
especially the first two.
One can get an impression that the __cb should implement first three options
and offer a mechanism of choosing among them. This impression is wrong.
The __cb was designed and optimized to be circular
(which means overwriting the oldest data when full).
If such a controlling mechanism had been enabled,
it would just complicate the matters
and the usage of the __cb would be probably less straightforward.
Moreover, the first two options (and the fourth option as well)
do not require the buffer to be circular at all.
If there is a need for the first or second option, consider implementing an adaptor of e.g. std::vector.
In this case the __cb is not suitable for adapting, because,
contrary to std::vector, it bears an overhead for its circular behaviour.
[h3 Reading/Removing from an Empty Buffer]
When reading or removing an element from an empty buffer,
the buffer should be able to notify the data consumer
(e.g. by throwing underflow exception) that there are no elements stored in it.
The __cb does not implement such a behaviour for two reasons:
* It would introduce a performance overhead.
* No other std container implements it this way.
It is considered to be a bug to read or remove an element
(e.g. by calling [memberref boost::circular_buffer::front() front()]
or [memberref boost::circular_buffer::pop_back() pop_back()])
from an empty std container and from an empty __cb as well.
The data consumer has to test if the container is not empty before reading/removing from it by testing
[memberref boost::circular_buffer::empty empty()].
However, when reading from the __cb,
there is an option to rely on the [memberref boost::circular_buffer::at() at()]
method which throws an exception when the index is out of range.
[h3 Iterator Invalidation]
An iterator is usually considered to be invalidated if an element,
the iterator pointed to, had been removed or overwritten by an another element.
This definition is enforced by the Debug Support and is documented for every method.
However, some applications utilizing __cb may require less strict definition:
an iterator is invalid only if it points to an uninitialized memory.
Consider following example:
[import ../example/circular_buffer_iter_example.cpp]
[circular_buffer_iter_example_1]
The iterator does not point to the original element any more
(and is considered to be invalid from the "strict" point of view)
but it still points to the same valid place in the memory.
This "soft" definition of iterator invalidation is supported by the __cb
but should be considered as an implementation detail rather than a full-fledged feature.
The rules when the iterator is still valid can be inferred from the code in
[@boost:libs/circular_buffer/test/soft_iterator_invalidation.cpp soft_iterator_invalidation.cpp].
[h3 Move emulation and rvalues]
Since Boost 1.54.0 support for move semantics was implemented using
the [@boost:libs/move/index.html Boost.Move] library.
If rvalue references are available __cb will use them, but if not it uses a close,
but imperfect emulation. On such compilers:
* Non-copyable objects can be stored in the containers.
They can be constructed in place using `emplace`, or if they support
Boost.Move, moved into place.
* The containers themselves are not movable.
* Argument forwarding is not perfect.
__cb will use rvalues and move emulations for value types only if move constructor and move assignment operator of the value type do not throw;
or if the value type has no copy constructor.
Some methods won't use move constructor for the value type at all, if the constructor throws. This is
required for data consistency and avoidance of situations, when aftrer an exception __cb
contains moved away objects along with the good ones.
See documentation for [@boost:libs/type_traits/doc/html/boost_typetraits/reference/is_copy_constructible.html `is_copy_constructible`], [@boost:libs/type_traits/doc/html/boost_typetraits/reference/is_nothrow_move_assignable.html `is_nothrow_move_assignable`] and [@boost:libs/type_traits/doc/html/boost_typetraits/reference/is_nothrow_move_constructible.html `is_nothrow_move_constructible`] type triats.
There you'll find information about how to make constructor of class noexcept and how to make a non-copyable
class in C++03 and C++98.
Performance of __cb will *greatly improve* if value type has noexcept move constructor and noexcept move assignment.
[h3 Exceptions of move_if_noexcept(T&)]
Reference documentation of the __cb contains notes like "Throws: See Exceptions of `move_if_noexcept(T&)`".
That note means the following: `move_if_noexcept(T& value)` does not throws exceptions at all, but it returns
`value` as rvalue reference only if class `T` have noexcept move constructor and noexcept move assignment operator;
or if it has no copy constructor. Otherwise `move_if_noexcept(T& value)` returns `value` as const reference.
This leads us to the following situation:
* If `value` has a noexcept move constructor and noexcept move assignment operator, then no exceptions will be thrown at all.
* If `value` has a throwing move constructor and some copy constructor, then method may throw exceptions of copy constructor.
* If `value` has no copy constructor, then method may throw exceptions of move constructor.
`move_if_noexcept(T&)` uses [@boost:libs/move/index.html Boost.Move], [@boost:libs/type_traits/doc/html/boost_typetraits/reference/is_copy_constructible.html `is_copy_constructible`], [@boost:libs/type_traits/doc/html/boost_typetraits/reference/is_nothrow_move_assignable.html `is_nothrow_move_assignable`] and [@boost:libs/type_traits/doc/html/boost_typetraits/reference/is_nothrow_move_constructible.html `is_nothrow_move_constructible`] type triats.
[h3 Caveats]
The __cb should not be used for storing pointers to dynamically allocated objects.
When a circular buffer becomes full, further insertion will overwrite the stored pointers
- resulting in a [*memory leak]. One recommend alternative is the use of smart pointers, for example
[@http://www.boost.org/doc/libs/1_53_0/libs/smart_ptr/smart_ptr.htm Boost Smart pointers].
[@http://en.wikipedia.org/wiki/Std::auto_ptr std::auto_ptr]
[caution Any container of `std::auto_ptr` is considered particularly hazardous.]
[tip Never create a circular buffer of `std::auto_ptr`.
Refer to Scott Meyers' excellent book Effective STL for a detailed discussion.
(Meyers S., Effective STL: 50 Specific Ways to Improve Your Use of the Standard Template Library.
Addison-Wesley, 2001.)
]
While internals of a __cb are circular, [*iterators are not].
Iterators of a __cb are only valid for the range `\[begin(), end()\]`,
so for example: iterators `(begin() - 1)` and `(end() + 1)` are both invalid.
[h3 Debug Support]
In order to help a programmer to avoid and find common bugs,
the __cb can be enabled to provide a kind of debug support.
When the debugging functionality is enabled, the __cb maintains a list of valid iterators.
As soon as any element gets destroyed all iterators pointing to this element
are removed from this list and explicitly invalidated (an invalidation flag is set).
The debug support also consists of many assertions (`BOOST_ASSERT` macros)
which ensure the __cb and its iterators are used in the correct manner at runtime.
In case an invalid iterator is used, the assertion will report an error.
The connection of explicit iterator invalidation and assertions
makes a very robust debug technique which catches most of the errors.
Moreover, the uninitialized memory allocated by __cb is filled with the value `0xcc` in the debug mode.
When debugging the code, this can help the programmer to recognize the initialized memory from the uninitialized.
For details refer the source code [@boost:boost/circular_buffer/debug.hpp circular_buffer/debug.hpp].
[caution Since the debugging code makes __cb and its iterators more interconnected, thread safety guarantees of __cb
are different when debug support is enabled. In addition to the container itself, all iterators tracked by the container
(including any copies thereof) must be protected from concurrent access. In particular, this includes copying, destroying or
obtaining iterators from the container, even if for read-only access.]
The debug support is disabled by default. To enable it, one has to define `BOOST_CB_ENABLE_DEBUG` macro with the value of 1
while compiling the code using __cb.
[h3 Compatibility with Interprocess library]
The __cb is compatible with the [@boost:libs/interprocess/index.html Boost.Interprocess]
[/ This should be in @boost:libs/interprocess/doc/index.html ]
library used for interprocess communication.
Considering that the circular_buffer's debug support relies on 'raw' pointers
(which is not permited by the Interprocess library)
the code has to compiled with debug support disabled (i.e. with `BOOST_CB_ENABLE_DEBUG` macro not defined or defined to 0).
Not doing that will cause the compilation to fail.
[endsect] [/section:implementation Implementation ]
[section:examples More Examples]
[h3 Summing all the values in a circular buffer]
[import ../example/circular_buffer_sum_example.cpp]
[circular_buffer_sum_example_1]
[/circular_buffer_example_output - there is no output for this example]
The __cb has a capacity of three `int`.
Therefore, the size of the buffer will never exceed three.
The `std::accumulate` algorithm evaluates the sum of the stored elements.
The semantics of the __cb can be inferred from the assertions.
You can see the full example code at [@boost:libs/circular_buffer/example/circular_buffer_sum_example.cpp circular_buffer_sum_example.cpp].
[h3 Bounded Buffer Example]
The bounded buffer is normally used in a producer-consumer mode:
producer threads produce items and store them in the container
and consumer threads remove these items and process them.
The bounded buffer has to guarantee that
* producers do not insert items into the container when the container is full,
* consumers do not try to remove items when the container is empty,
* each produced item is consumed by exactly one consumer.
[import ../example/circular_buffer_bound_example.cpp]
[circular_buffer_bound_example_1]
[/ there is no output for this example]
The bounded_buffer relies on [@boost:/doc/html/thread.html Boost.Thread]
and [@boost:libs/bind/index.html Boost.Bind] libraries
and [@boost:libs/utility/call_traits.htm Boost.call_traits utility].
The [memberref boost::circular_buffer::push_front() push_front()]
method is called by the producer thread in order to insert a new item into the buffer.
The method locks the mutex and waits until there is a space for the new item.
(The mutex is unlocked during the waiting stage and has to be regained when the condition is met.)
If there is a space in the buffer available,
the execution continues and the method inserts the item at the end of the __cb.
Then it increments the number of unread items and unlocks the mutex
(in case an exception is thrown before the mutex is unlocked,
the mutex is unlocked automatically by the destructor of the scoped_lock).
At last the method notifies one of the consumer threads
waiting for a new item to be inserted into the buffer.
The [memberref boost::circular_buffer::pop_back() pop_back()]
method is called by the consumer thread in order to read the next item from the buffer.
The method locks the mutex and waits until there is an unread item in the buffer.
If there is at least one unread item,
the method decrements the number of unread items and reads the next item from the __cb.
Then it unlocks the mutex and notifies one of the producer threads
waiting for the buffer to free a space for the next item.
The `bounded buffer::pop_back()`
method [*does not remove the item] but the item is left
in the circular_buffer which then [*replaces it with a new one]
(inserted by a producer) when the circular_buffer is full.
This technique is more effective than removing the item
explicitly by calling the [memberref boost::circular_buffer::pop_back() circular_buffer::pop_back()]
method of the __cb.
This claim is based on the assumption that an assignment (replacement)
of a new item into an old one is more effective than a destruction
(removal) of an old item and a consequent inplace construction (insertion) of a new item.
For comparison of bounded buffers based on different containers compile and
run [@boost:libs/circular_buffer/test/bounded_buffer_comparison.cpp bounded_buffer_comparison.cpp].
The test should reveal the bounded buffer based on the __cb is most effective
closely followed by the `std::deque` based bounded buffer.
(In reality, the result may differ sometimes because the test
is always affected by external factors such as immediate CPU load.)
[import ../test/bounded_buffer_comparison.cpp]
You can see the full test code at [@boost:libs/circular_buffer/test/bounded_buffer_comparison.cpp bounded_buffer_comparison.cpp],
and an example of output is [bounded_buffer_comparison_output].
[endsect] [/section:examples More examples]
[section:headers Header Files]
The circular buffer library is defined in the file [@boost:boost/circular_buffer.hpp circular_buffer.hpp].
#include <boost/circular_buffer.hpp>
(There is also a forward declaration for the __cb
in the header file [@boost:boost/circular_buffer_fwd.hpp circular_buffer_fwd.hpp]).
The __cb is defined in the file [@boost:boost/circular_buffer/base.hpp base.hpp].
The __cbso is defined in the file [@boost:boost/circular_buffer/space_optimized.hpp space_optimized.hpp].
[endsect] [/section:headers Header Files]
[section:concepts Modelled Concepts]
[@http://www.sgi.com/tech/stl/RandomAccessContainer.html Random Access Container],
[@http://www.sgi.com/tech/stl/FrontInsertionSequence.html Front Insertion Sequence], and
[@http://www.sgi.com/tech/stl/BackInsertionSequence.html Back Insertion sequence]
[endsect] [/section:concepts Modelled Concepts]
[section:template_params Template Parameters]
[table:templ Template parameter requirements
[[parameter] [Requirements]]
[[T] [The type of the elements stored in the circular_buffer.
The T has to be [@boost:libs/utility/Assignable.html Assignable]
and [@boost:libs/utility/CopyConstructible.html CopyConstructible].
Moreover T has to be [@http://www.sgi.com/tech/stl/DefaultConstructible.html DefaultConstructible]
if supplied as a default parameter when invoking some of the circular_buffer's methods,
e.g. `insert(iterator pos, const value_type& item = value_type())`.
And [@http://www.sgi.com/tech/stl/EqualityComparable.html EqualityComparable]
and/or [@boost:libs/utility/LessThanComparable.html LessThanComparable]
if the circular_buffer will be compared with another container.]]
[[Alloc] [The allocator type used for all internal memory management.
The Alloc has to meet the allocator requirements imposed by STL.]]
]
[endsect] [/section:template_params Template Parameters]
[section:tickets Trac Tickets]
Report and view bugs and features by adding a ticket at [@https://svn.boost.org/trac/boost Boost.Trac].
Existing open tickets for this library alone can be viewed
[@https://svn.boost.org/trac/boost/query?status=assigned&status=new&status=reopened&component=circular_buffer&col=id&col=summary&col=status&col=owner&col=type&col=milestone&order=priority here].
Existing tickets for this library - including closed ones - can be viewed
[@https://svn.boost.org/trac/boost/query?status=assigned&status=closed&status=new&status=reopened&component=circular_buffer&col=id&col=summary&col=status&col=owner&col=type&col=milestone&order=priority here].
Type: Bugs
[@https://svn.boost.org/trac/boost/ticket/4100 #4100] Some boost classes have sizeof that depends on NDEBUG.
[@https://svn.boost.org/trac/boost/ticket/5362 #5362] circular_buffer does not compile with BOOST_NO_EXCEPTIONS.
[@https://svn.boost.org/trac/boost/ticket/6277 #6277] Checked iterators are not threadsafe.
[@https://svn.boost.org/trac/boost/ticket/6747 #6747] Circular_Buffer / Bounded_Buffer inside Template class problem.
[@https://svn.boost.org/trac/boost/ticket/7025 #7025] circular buffer reports warning: " type qualifiers ignored on function return type" while compile.
[@https://svn.boost.org/trac/boost/ticket/7950 #7950] Eliminate W4-warnings under VS2005.
[@https://svn.boost.org/trac/boost/ticket/8012 #8012] Inconsistency in `linearize()`.
[@https://svn.boost.org/trac/boost/ticket/8438 #8438] `vector` & __cb storage misbehave when using compiler optimizations.
Type: Feature Requests
[@https://svn.boost.org/trac/boost/ticket/5511 #5511] Documentation needs some improvement.
[@https://svn.boost.org/trac/boost/ticket/7888 #7888] circular_buffer should support move semantics.
Type: Patches
[@https://svn.boost.org/trac/boost/ticket/8032 #8032] Warning fixes in circular_buffer.
[endsect] [/section:tickets Trac Tickets]
[section:release Release Notes]
[h4 Boost 1.56]
* C++11 allocator model support implemented by Glen Fernandes using Boost allocator_traits.
[h4 Boost 1.55]
* Documentation refactored by Paul A. Bristow using Quickbook, Doxygen and Autoindexing.
* Rvalue references emulation added by Antony Polukhin using Boost.Move.
[h4 Boost 1.42]
* Added methods erase_begin(size_type) and erase_end(size_type) with constant complexity for such types of stored elements which do not need an explicit destruction e.g. int or double.
* Similarly changed implementation of the clear() method and the destructor so their complexity is now constant for such types of stored elements which do not require an explicit destruction (the complexity for other types remains linear).
[h4 Boost 1.37]
*Added new methods is_linearized() and rotate(const_iterator).
* Fixed bugs:
[@https://svn.boost.org/trac/boost/ticket/1987 #1987] Patch to make circular_buffer.hpp #includes absolute.
[@https://svn.boost.org/trac/boost/ticket/1852 #1852] Copy constructor does not copy capacity.
[h4 Boost 1.36]
* Changed behaviour of the circular_buffer(const allocator_type&) constructor.
Since this version the constructor does not allocate any memory and both capacity and size are set to zero.
* Fixed bug:
[@https://svn.boost.org/trac/boost/ticket/191 #1919] Default constructed circular buffer throws std::bad_alloc.
[h4 Boost 1.35]
* Initial release.
[endsect] [/section:release Release Notes]
[section:acknowledgements Acknowledgements]
Thomas Witt in 2002 produced a prototype called cyclic buffer.
The circular_buffer has a short history. Its first version was a std::deque adaptor.
This container was not very effective because of many reallocations when inserting/removing an element.
Thomas Wenish did a review of this version and
motivated me to create a circular buffer which allocates memory at once when created.
The second version adapted `std::vector` but it has been abandoned soon
because of limited control over iterator invalidation.
The current version is a full-fledged STL compliant container.
Pavel Vozenilek did a thorough review of this version and came with many good ideas and improvements.
The idea of the space optimized circular buffer has been introduced by Pavel Vozenilek.
Also, I would like to thank Howard Hinnant, Nigel Stewart and everyone
who participated at the formal review for valuable comments and ideas.
Paul A. Bristow refactored the documentation in 2013 to use the full power of Quickbook, Doxygen and Autoindexing.
[endsect] [/section:acknowledgements Acknowledgements]
[section:version_id Documentation Version Info]
Last edit to Quickbook file __FILENAME__ was at __TIME__ on __DATE__.
[tip This should appear on the pdf version
(but may be redundant on a html version where the last edit date is on the first (home) page).]
[warning Home page "Last revised" is GMT, not local time. Last edit date is local time.]
[/See also Adobe Reader pdf File Properties for creation date, and PDF producer, version and page count.]
[endsect] [/section:version_id Version Info]
[xinclude autodoc.xml] [/ Using Doxygen reference documentation.]
[/ The position of this in the Quickbook determines the location of the Doxygen references section.]
[/ Index(es) should be invoked in the main module, not within a section.]
'''
<index/>
'''
[/ circular_buffer.qbk
Copyright 2013 Paul A. Bristow.
Copyright 2003-2008 Jan Gaspar.
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE_1_0.txt or copy at
http://www.boost.org/LICENSE_1_0.txt).
]
Binary file not shown.

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 25 KiB

+219
View File
@@ -0,0 +1,219 @@
# Boost.circular_buffer library documentation Jamfile.v2
#
# Copyright Paul A. Bristow 2013.
# Copyright Jan Gaspar 2003-2008.
# Use, modification and distribution is subject to
# the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt
# or copy at http://www.boost.org/LICENSE_1_0.txt)
path-constant nav_images : html/images/ ; # png and svg images for home, next, note, tip...
path-constant images_location : html/images ; # location of my SVG and PNG images referenced by Quickbook.
path-constant pdf_images_location : .. ; # location of SVG and PNG images referenced by pdf.
path-constant here : . ; # location of /doc folder.
# echo "nav_images = " $(nav_images) ; # "nav_images = I:\boost-trunk\libs\circular_buffer\doc\html\images
# echo "images_location = " $(images_location) ; # images_location = I:\boost-trunk\libs\circular_buffer\doc\html\images
# echo "pdf_images_location = " $(pdf_images_location) #
import modules ;
using auto-index ;
using doxygen ; # Required if you want to use Doxygen.
using quickbook ;
doxygen autodoc
:
# List all the files individually (RECURSIVE=NO ).
[ glob ../../../boost/circular_buffer.hpp ]
[ glob ../../../boost/circular_buffer/base.hpp ]
[ glob ../../../boost/circular_buffer/space_optimized.hpp ]
[ glob ../../../boost/circular_buffer/details.hpp ] # Needed for capacity_control at least.
[ glob ../../../boost/circular_buffer/debug.hpp ] # not needed?
:
# Pass some setting parameters to Doxygen.
<doxygen:param>WARNINGS=YES # Default NO, but useful to see warnings, especially in a logfile.
# It is also wise to to set a warnings logfile like this:
<doxygen:param>WARN_LOGFILE=AutoDoxywarnings.log # This may not be empty (usually not a good sign!), depending on options chosen.
# Much better to send message to a logfile than the default stderr.
# and make sure that there are no Doxygen errors or significant warnings in the log file.
<doxygen:param>RECURSIVE=NO # Search recursively down .hpp and .cpp subdirectories.
<doxygen:param>EXTRACT_ALL=NO
<doxygen:param>EXTRACT_PRIVATE=NO # NO means do not extract info about private member functions and data.
<doxygen:param>HIDE_UNDOC_MEMBERS=YES # Only show members that have some documentation like \param, \return ...
<doxygen:param>MACRO_EXPANSION=YES # YES will expand all macro names in the source code (default = NO).
<doxygen:param>EXPAND_ONLY_PREDEF=YES # If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES
# then the macro expansion is limited to the macros specified with the PREDEFINED and EXPAND_AS_DEFINED tags.
# If EXPAND_ONLY_PREDEF tag can be used to specify a list of macro names that should be expanded (as defined).
# The PREDEFINED tag can be used to specify one or more macro names that are defined
# before the preprocessor is started (similar to the -D option of gcc).
# The argument of the tag is a list of macros of the form:
# name or name=definition (no spaces).
# If the definition and the "=" are omitted, "=1" is assumed.
# To prevent a macro definition from being undefined via #undef or
# recursively expanded use the := operator instead of the = operator.
# See http://www.stack.nl/~dimitri/doxygen/config.html#cfg_predefined.
# static char *malloc BOOST_PREVENT_MACRO_SUBSTITUTION(const size_type bytes);
# will not produce a helpful Doxygen output, so
# replace some with more helpful text, or none, for example:
<doxygen:param>"PREDEFINED= \\
\"BOOST_PREVENT_MACRO_SUBSTITUTION\" \\
\"BOOST_STATIC_CONSTANT(T,V)=static x const y\" \\
\"BOOST_UNITS_AUTO_STATIC_CONSTANT(a,b)=static const auto a = b\" \\
\"BOOST_DEDUCED_TYPENAME=typename\" \\
\"BOOST_CONSTEXPR=constexpr\" \\
\"BOOST_CONTAINER_NOEXCEPT=noexcept\" \\
\"BOOST_CONTAINER_NOEXCEPT_IF(T)=noexcept(T)\" \\
\"BOOST_UNITS_TYPEOF(a)=typeof(a)\" \\
\"BOOST_UNITS_HAS_TYPEOF=1\" \\
\"BOOST_MPL_ASSERT(expr)=\" \\
\"BOOST_ASSERT(expr)=\" \\
\"BOOST_RV_REF(T)=T &&\" \\
\"ASSERT(x)=assert(x)\" \\
\"__cplusplus \""
# BOOST_PREVENT_MACRO_SUBSTITUTION, will not be replaced by ,
# BOOST_STATIC_CONSTANT will be replaced by "static x const y",
# BOOST_DEDUCED_TYPENAME will be replaced by "typename",
# BOOST_CONSTEXPR will be replaced by "constexpr".
<doxygen:param>EXCLUDE_SYMBOLS=*_throws
# <doxygen:param>IMAGE_PATH="../images" # for circular_buffer.png
# See autodoxywarnings.log to check this is correct.
# The syntax hoops to jump through are 'interesting' for more than one PREDEFINED,
# and to permit spaces within definitions (use double quotes).
# Don't forget that every double quote " needs a preceeding \trip character!
# and that each trailing continuation \ needs a preceeding \trip character too!
# And finally that if more than one item is included (as here) the whole is
# enclosed in "PREDEFINED=... ", but without a leading \. Go figure...
# A grep for PREDEFINED= in jamfiles will reveal even more complex examples.
# Boost Libraries with useful examples are: Accumulators, Interprocess, MPI, Random, Units, Expressive.
# Optionally, you can provide a Reference section name specific for your library, for example:
<xsl:param>"boost.doxygen.reftitle=Boost.Circular_buffer C++ Reference"
;
xml circular_buffer : circular_buffer.qbk ;
using boostbook ;
boostbook standalone
:
circular_buffer
:
# General settings
# =================
<format>html:<xsl:param>boost.root=../../../..
<format>html:<xsl:param>img.src.path=../../../../doc/html/
<format>docbook:<xsl:param>boost.root=boost:
# Options for html and pdf
# ========================
# No indent on body text:
<xsl:param>body.start.indent=0pt
# Margin size:
<xsl:param>page.margin.inner=0.5in
# Margin size:
<xsl:param>page.margin.outer=0.5in
# Yes, we want graphics for admonishments:
<xsl:param>admon.graphics=1
# HTML options:
# =============
# Use graphics icons not text for navigation:
<xsl:param>navig.graphics=1
# How far down we chunk nested sections, basically all of them:
<xsl:param>chunk.section.depth=2
# Don't put the first section on the same page as the TOC itself:
<xsl:param>chunk.first.sections=1
# How far down sections get TOC's
<xsl:param>toc.section.depth=4
# Max depth in each TOC:
<xsl:param>toc.max.depth=2
# How far down we go with TOC's
<xsl:param>generate.section.toc.level=10
# Horizontal ? spacing in table cells.
<format>html:<xsl:param>html.cellspacing=3 # pixels
# Vertical spacing in table cells.
<format>html:<xsl:param>html.cellpadding=5 # pixels
# Not sure if these are right way round?
<auto-index>on # Turns on index (or off).
# Turns on (or off) index-verbose for diagnostic info (using /bin auto-index-verbose folders).
<auto-index-verbose>on
<format>pdf:<auto-index-internal>off # on (or off) to use internally generated indexes.
<format>html:<xsl:param>index.on.type=1 # = 1 For the native stylesheets to generate multiple different indexes.
<auto-index-script>circular_buffer.idx # Specifies the name of the script to load for circular_buffer.
<auto-index-prefix>../../.. # Will get you back up to /circular_buffer, so !scan-path "boost/circular_buffer/" is where *.hpp will be,
# and /libs/circular_buffer for other files.
# Without this would need !scan-path "../../../boost/circular_buffer"
# Used by Quickbook to invoke indexing.
# Required by boost-trunk/doc/ see jamfile.v2 to use auto-index.
# Choose indexing method for html:
<format>html:<auto-index-internal>on
<format>docbook:<auto-index-internal>on
# PDF Options:
# ============
# TOC Generation: this is needed for FOP-0.9 and later:
<format>pdf:<xsl:param>fop1.extensions=0
# Or enable this if you're using XEP:
<format>pdf:<xsl:param>xep.extensions=1
# TOC generation: this is needed for FOP 0.2, but must not be set to zero for FOP-0.9!
<format>pdf:<xsl:param>fop.extensions=0
# No indent on body text:
<xsl:param>body.start.indent=0pt
# Margin size:
<xsl:param>page.margin.inner=0.5in
# Margin size:
<xsl:param>page.margin.outer=0.5in
# Yes, we want graphics for admonishments:
<xsl:param>admon.graphics=1
# Set these one for PDF generation *only*:
# default png graphics are awful in PDF form,
# better use SVG instead:
<format>pdf:<xsl:param>admon.graphics.extension=".svg"
#<format>pdf:<xsl:param>admon.graphics.extension=".png" # Only png images are available.
# Don't need this, default path works OK:
#<format>pdf:<xsl:param>admon.graphics.path=$(nav_images)/ # next, prev, note, tip ... for pdf.
<format>pdf:<xsl:param>use.role.for.mediaobject=1
<format>pdf:<xsl:param>preferred.mediaobject.role=print
<format>pdf:<xsl:param>img.src.path=$(pdf_images_location)/ # graphics (diagrams) for pdf.
<format>pdf:<xsl:param>draft.mode="no"
<format>pdf:<xsl:param>boost.url.prefix=../../../..
<dependency>autodoc #
<dependency>png_install
;
# Install (copy) the 'master' copies of all icon images (both PNG and SVG)
# and the Boost logo from your current Boost-root
# to the local /doc/html/images folder so that html is complete and standalone.
install png_install : [ glob $(here)/*.png ] : <location>$(here)/../../../doc/html/images ;
# install pdf-install : standalone : <install-type>PDF <location>. ;
# Effectively copies the file from \bin folder to the \doc folder,
# but will not work as expected if doxygen and/or autoindex is used
# because a modified pdf file is created, so this command
# will rename the file to the expected filename, here circular_buffer.pdf.
install pdfinstall : standalone : <install-type>PDF <location>. <name>circular_buffer.pdf ;
###############################################################################
alias boostdoc
: standalone/<format>docbook
:
:
: ;
explicit boostdoc ;
alias boostrelease ;
explicit boostrelease ;
@@ -0,0 +1,316 @@
// Comparison of bounded buffers based on different containers.
// Copyright (c) 2003-2008 Jan Gaspar
// Copyright 2013 Paul A. Bristow. Added some Quickbook snippet markers.
// Use, modification, and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#include <boost/circular_buffer.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/thread/condition.hpp>
#include <boost/thread/thread.hpp>
#include <boost/call_traits.hpp>
#include <boost/progress.hpp>
#include <boost/bind.hpp>
#include <deque>
#include <list>
#include <string>
#include <iostream>
const unsigned long QUEUE_SIZE = 1000L;
const unsigned long TOTAL_ELEMENTS = QUEUE_SIZE * 1000L;
template <class T>
class bounded_buffer {
public:
typedef boost::circular_buffer<T> container_type;
typedef typename container_type::size_type size_type;
typedef typename container_type::value_type value_type;
typedef typename boost::call_traits<value_type>::param_type param_type;
explicit bounded_buffer(size_type capacity) : m_unread(0), m_container(capacity) {}
void push_front(param_type item) {
boost::mutex::scoped_lock lock(m_mutex);
m_not_full.wait(lock, boost::bind(&bounded_buffer<value_type>::is_not_full, this));
m_container.push_front(item);
++m_unread;
lock.unlock();
m_not_empty.notify_one();
}
void pop_back(value_type* pItem) {
boost::mutex::scoped_lock lock(m_mutex);
m_not_empty.wait(lock, boost::bind(&bounded_buffer<value_type>::is_not_empty, this));
*pItem = m_container[--m_unread];
lock.unlock();
m_not_full.notify_one();
}
private:
bounded_buffer(const bounded_buffer&); // Disabled copy constructor
bounded_buffer& operator = (const bounded_buffer&); // Disabled assign operator
bool is_not_empty() const { return m_unread > 0; }
bool is_not_full() const { return m_unread < m_container.capacity(); }
size_type m_unread;
container_type m_container;
boost::mutex m_mutex;
boost::condition m_not_empty;
boost::condition m_not_full;
};
template <class T>
class bounded_buffer_space_optimized {
public:
typedef boost::circular_buffer_space_optimized<T> container_type;
typedef typename container_type::size_type size_type;
typedef typename container_type::value_type value_type;
typedef typename boost::call_traits<value_type>::param_type param_type;
explicit bounded_buffer_space_optimized(size_type capacity) : m_container(capacity) {}
void push_front(param_type item) {
boost::mutex::scoped_lock lock(m_mutex);
m_not_full.wait(lock, boost::bind(&bounded_buffer_space_optimized<value_type>::is_not_full, this));
m_container.push_front(item);
lock.unlock();
m_not_empty.notify_one();
}
void pop_back(value_type* pItem) {
boost::mutex::scoped_lock lock(m_mutex);
m_not_empty.wait(lock, boost::bind(&bounded_buffer_space_optimized<value_type>::is_not_empty, this));
*pItem = m_container.back();
m_container.pop_back();
lock.unlock();
m_not_full.notify_one();
}
private:
bounded_buffer_space_optimized(const bounded_buffer_space_optimized&); // Disabled copy constructor
bounded_buffer_space_optimized& operator = (const bounded_buffer_space_optimized&); // Disabled assign operator
bool is_not_empty() const { return m_container.size() > 0; }
bool is_not_full() const { return m_container.size() < m_container.capacity(); }
container_type m_container;
boost::mutex m_mutex;
boost::condition m_not_empty;
boost::condition m_not_full;
};
template <class T>
class bounded_buffer_deque_based {
public:
typedef std::deque<T> container_type;
typedef typename container_type::size_type size_type;
typedef typename container_type::value_type value_type;
typedef typename boost::call_traits<value_type>::param_type param_type;
explicit bounded_buffer_deque_based(size_type capacity) : m_capacity(capacity) {}
void push_front(param_type item) {
boost::mutex::scoped_lock lock(m_mutex);
m_not_full.wait(lock, boost::bind(&bounded_buffer_deque_based<value_type>::is_not_full, this));
m_container.push_front(item);
lock.unlock();
m_not_empty.notify_one();
}
void pop_back(value_type* pItem) {
boost::mutex::scoped_lock lock(m_mutex);
m_not_empty.wait(lock, boost::bind(&bounded_buffer_deque_based<value_type>::is_not_empty, this));
*pItem = m_container.back();
m_container.pop_back();
lock.unlock();
m_not_full.notify_one();
}
private:
bounded_buffer_deque_based(const bounded_buffer_deque_based&); // Disabled copy constructor
bounded_buffer_deque_based& operator = (const bounded_buffer_deque_based&); // Disabled assign operator
bool is_not_empty() const { return m_container.size() > 0; }
bool is_not_full() const { return m_container.size() < m_capacity; }
const size_type m_capacity;
container_type m_container;
boost::mutex m_mutex;
boost::condition m_not_empty;
boost::condition m_not_full;
};
template <class T>
class bounded_buffer_list_based {
public:
typedef std::list<T> container_type;
typedef typename container_type::size_type size_type;
typedef typename container_type::value_type value_type;
typedef typename boost::call_traits<value_type>::param_type param_type;
explicit bounded_buffer_list_based(size_type capacity) : m_capacity(capacity) {}
void push_front(param_type item) {
boost::mutex::scoped_lock lock(m_mutex);
m_not_full.wait(lock, boost::bind(&bounded_buffer_list_based<value_type>::is_not_full, this));
m_container.push_front(item);
lock.unlock();
m_not_empty.notify_one();
}
void pop_back(value_type* pItem) {
boost::mutex::scoped_lock lock(m_mutex);
m_not_empty.wait(lock, boost::bind(&bounded_buffer_list_based<value_type>::is_not_empty, this));
*pItem = m_container.back();
m_container.pop_back();
lock.unlock();
m_not_full.notify_one();
}
private:
bounded_buffer_list_based(const bounded_buffer_list_based&); // Disabled copy constructor
bounded_buffer_list_based& operator = (const bounded_buffer_list_based&); // Disabled assign operator
bool is_not_empty() const { return m_container.size() > 0; }
bool is_not_full() const { return m_container.size() < m_capacity; }
const size_type m_capacity;
container_type m_container;
boost::mutex m_mutex;
boost::condition m_not_empty;
boost::condition m_not_full;
};
template<class Buffer>
class Consumer {
typedef typename Buffer::value_type value_type;
Buffer* m_container;
value_type m_item;
public:
Consumer(Buffer* buffer) : m_container(buffer) {}
void operator()() {
for (unsigned long i = 0L; i < TOTAL_ELEMENTS; ++i) {
m_container->pop_back(&m_item);
}
}
};
template<class Buffer>
class Producer {
typedef typename Buffer::value_type value_type;
Buffer* m_container;
public:
Producer(Buffer* buffer) : m_container(buffer) {}
void operator()() {
for (unsigned long i = 0L; i < TOTAL_ELEMENTS; ++i) {
m_container->push_front(value_type());
}
}
};
template<class Buffer>
void fifo_test(Buffer* buffer) {
// Start of measurement
boost::progress_timer progress;
// Initialize the buffer with some values before launching producer and consumer threads.
for (unsigned long i = QUEUE_SIZE / 2L; i > 0; --i) {
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x581))
buffer->push_front(Buffer::value_type());
#else
buffer->push_front(BOOST_DEDUCED_TYPENAME Buffer::value_type());
#endif
}
Consumer<Buffer> consumer(buffer);
Producer<Buffer> producer(buffer);
// Start the threads.
boost::thread consume(consumer);
boost::thread produce(producer);
// Wait for completion.
consume.join();
produce.join();
// End of measurement
}
int main(int /*argc*/, char* /*argv*/[]) {
bounded_buffer<int> bb_int(QUEUE_SIZE);
std::cout << "bounded_buffer<int> ";
fifo_test(&bb_int);
bounded_buffer_space_optimized<int> bb_space_optimized_int(QUEUE_SIZE);
std::cout << "bounded_buffer_space_optimized<int> ";
fifo_test(&bb_space_optimized_int);
bounded_buffer_deque_based<int> bb_deque_based_int(QUEUE_SIZE);
std::cout << "bounded_buffer_deque_based<int> ";
fifo_test(&bb_deque_based_int);
bounded_buffer_list_based<int> bb_list_based_int(QUEUE_SIZE);
std::cout << "bounded_buffer_list_based<int> ";
fifo_test(&bb_list_based_int);
bounded_buffer<std::string> bb_string(QUEUE_SIZE);
std::cout << "bounded_buffer<std::string> ";
fifo_test(&bb_string);
bounded_buffer_space_optimized<std::string> bb_space_optimized_string(QUEUE_SIZE);
std::cout << "bounded_buffer_space_optimized<std::string> ";
fifo_test(&bb_space_optimized_string);
bounded_buffer_deque_based<std::string> bb_deque_based_string(QUEUE_SIZE);
std::cout << "bounded_buffer_deque_based<std::string> ";
fifo_test(&bb_deque_based_string);
bounded_buffer_list_based<std::string> bb_list_based_string(QUEUE_SIZE);
std::cout << "bounded_buffer_list_based<std::string> ";
fifo_test(&bb_list_based_string);
return 0;
}
/*
//[bounded_buffer_comparison_output
Description: Autorun "J:\Cpp\Misc\Debug\bounded_buffer_comparison.exe"
bounded_buffer<int> 5.15 s
bounded_buffer_space_optimized<int> 5.71 s
bounded_buffer_deque_based<int> 15.57 s
bounded_buffer_list_based<int> 17.33 s
bounded_buffer<std::string> 24.49 s
bounded_buffer_space_optimized<std::string> 28.33 s
bounded_buffer_deque_based<std::string> 29.45 s
bounded_buffer_list_based<std::string> 31.29 s
//] //[bounded_buffer_comparison_output]
*/
@@ -0,0 +1,191 @@
// Copyright 2003-2008 Jan Gaspar.
// Copyright 2013 Paul A. Bristow. Added some Quickbook snippet markers.
// Distributed under the Boost Software License, Version 1.0.
// (See the accompanying file LICENSE_1_0.txt
// or a copy at <http://www.boost.org/LICENSE_1_0.txt>.)
//[circular_buffer_bound_example_1
/*`
This example shows how the `circular_buffer` can be utilized
as an underlying container of the bounded buffer.
*/
#include <boost/circular_buffer.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/thread/condition.hpp>
#include <boost/thread/thread.hpp>
#include <boost/call_traits.hpp>
#include <boost/bind.hpp>
#include <boost/timer/timer.hpp> // for auto_cpu_timer
template <class T>
class bounded_buffer
{
public:
typedef boost::circular_buffer<T> container_type;
typedef typename container_type::size_type size_type;
typedef typename container_type::value_type value_type;
typedef typename boost::call_traits<value_type>::param_type param_type;
explicit bounded_buffer(size_type capacity) : m_unread(0), m_container(capacity) {}
void push_front(typename boost::call_traits<value_type>::param_type item)
{ // `param_type` represents the "best" way to pass a parameter of type `value_type` to a method.
boost::mutex::scoped_lock lock(m_mutex);
m_not_full.wait(lock, boost::bind(&bounded_buffer<value_type>::is_not_full, this));
m_container.push_front(item);
++m_unread;
lock.unlock();
m_not_empty.notify_one();
}
void pop_back(value_type* pItem) {
boost::mutex::scoped_lock lock(m_mutex);
m_not_empty.wait(lock, boost::bind(&bounded_buffer<value_type>::is_not_empty, this));
*pItem = m_container[--m_unread];
lock.unlock();
m_not_full.notify_one();
}
private:
bounded_buffer(const bounded_buffer&); // Disabled copy constructor.
bounded_buffer& operator = (const bounded_buffer&); // Disabled assign operator.
bool is_not_empty() const { return m_unread > 0; }
bool is_not_full() const { return m_unread < m_container.capacity(); }
size_type m_unread;
container_type m_container;
boost::mutex m_mutex;
boost::condition m_not_empty;
boost::condition m_not_full;
}; //
//] [/circular_buffer_bound_example_1]
const unsigned long queue_size = 1000L;
const unsigned long total_elements = queue_size * 1000L;
//[circular_buffer_bound_example_2]
/*`To demonstrate, create two classes to exercise the buffer.
The producer class fills the buffer with elements.
The consumer class consumes the buffer contents.
*/
template<class Buffer>
class Producer
{
typedef typename Buffer::value_type value_type;
Buffer* m_container;
public:
Producer(Buffer* buffer) : m_container(buffer)
{}
void operator()()
{
for (unsigned long i = 0L; i < total_elements; ++i)
{
m_container->push_front(value_type());
}
}
};
template<class Buffer>
class Consumer
{
typedef typename Buffer::value_type value_type;
Buffer* m_container;
value_type m_item;
public:
Consumer(Buffer* buffer) : m_container(buffer)
{}
void operator()()
{
for (unsigned long i = 0L; i < total_elements; ++i)
{
m_container->pop_back(&m_item);
}
}
};
/*`Create a first-int first-out test of the bound_buffer.
Include a call to boost::progress_timer
[@http://www.boost.org/doc/libs/1_53_0/libs/timer/doc/cpu_timers.html CPU timer]
*/
template<class Buffer>
void fifo_test(Buffer* buffer)
{
// Start of timing.
boost::timer::auto_cpu_timer progress;
// Initialize the buffer with some values before launching producer and consumer threads.
for (unsigned long i = queue_size / 2L; i > 0; --i)
{
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x581))
buffer->push_front(Buffer::value_type());
#else
buffer->push_front(BOOST_DEDUCED_TYPENAME Buffer::value_type());
#endif
}
// Construct the threads.
Consumer<Buffer> consumer(buffer);
Producer<Buffer> producer(buffer);
// Start the threads.
boost::thread consume(consumer);
boost::thread produce(producer);
// Wait for completion.
consume.join();
produce.join();
// End of timing.
// destructor of boost::timer::auto_cpu_timer will output the time to std::cout.
}
//] [/circular_buffer_bound_example_2]
int main()
{
//[circular_buffer_bound_example_3]
//`Construct a bounded_buffer to hold the chosen type, here int.
bounded_buffer<int> bb_int(queue_size);
std::cout << "Testing bounded_buffer<int> ";
//`Start the fifo test.
fifo_test(&bb_int);
//` destructor of boost::timer::auto_cpu_timer will output the time to std::cout
//] [/circular_buffer_bound_example_3]
return 0;
} // int main()
/*
//[circular_buffer_bound_output
Description: Autorun "J:\Cpp\Misc\Debug\circular_buffer_bound_example.exe"
Testing bounded_buffer<int> 15.010692s wall, 9.188459s user + 7.207246s system = 16.395705s CPU (109.2%)
//] [/circular_buffer_bound_output]
*/
@@ -0,0 +1,63 @@
// Copyright 2003-2008 Jan Gaspar.
// Copyright 2013 Paul A. Bristow. Added some Quickbook snippet markers.
// Distributed under the Boost Software License, Version 1.0.
// (See the accompanying file LICENSE_1_0.txt
// or a copy at <http://www.boost.org/LICENSE_1_0.txt>.)
//[circular_buffer_example_1
/*`For all examples, we need this include:
*/
#include <boost/circular_buffer.hpp>
//] [/circular_buffer_example_1]
int main()
{
//[circular_buffer_example_2
// Create a circular buffer with a capacity for 3 integers.
boost::circular_buffer<int> cb(3);
// Insert threee elements into the buffer.
cb.push_back(1);
cb.push_back(2);
cb.push_back(3);
int a = cb[0]; // a == 1
int b = cb[1]; // b == 2
int c = cb[2]; // c == 3
// The buffer is full now, so pushing subsequent
// elements will overwrite the front-most elements.
cb.push_back(4); // Overwrite 1 with 4.
cb.push_back(5); // Overwrite 2 with 5.
// The buffer now contains 3, 4 and 5.
a = cb[0]; // a == 3
b = cb[1]; // b == 4
c = cb[2]; // c == 5
// Elements can be popped from either the front or the back.
cb.pop_back(); // 5 is removed.
cb.pop_front(); // 3 is removed.
// Leaving only one element with value = 4.
int d = cb[0]; // d == 4
//] [/circular_buffer_example_2]
return 0;
}
/*
//[circular_buffer_example_output
There is no output from this example.
//] [/circular_buffer_example_output]
*/
@@ -0,0 +1,14 @@
echo off
rem quickbook doxgen auto-index docs template circular_buffer_html_index.bat
rem echo circular_buffer_html_index_%date%_%time:~0,2%_%time:~3,2%.log
rem The DOS time format is assumed 12:34 and the : separator is not used.
set t=%time% /T
set tim=%t:~0,2%%t:~3,2%
rem pick just hours and minutes.
rem time may include leading space, like " 915", so remove space.
set tim=%tim: =%
rem boost-no-inspect
rem cd \boost-trunk/circular_buffer\libs\circular_buffer\example
bjam -a > circular_buffer_examples_%date%_%tim%.log
if not ERRORLEVEL 0 (echo Errorlevel is %ERRORLEVEL%) else (echo OK)
pause
@@ -0,0 +1,40 @@
// Copyright 2003-2008 Jan Gaspar.
// Copyright 2013 Paul A. Bristow. Added some Quickbook snippet markers.
// Distributed under the Boost Software License, Version 1.0.
// (See the accompanying file LICENSE_1_0.txt
// or a copy at <http://www.boost.org/LICENSE_1_0.txt>.)
#undef BOOST_CB_ENABLE_DEBUG
//[circular_buffer_iter_example_1
/*`
*/
#define BOOST_CB_ENABLE_DEBUG 0 // The Debug Support has to be disabled, otherwise the code produces a runtime error.
#include <boost/circular_buffer.hpp>
#include <boost/assert.hpp>
#include <assert.h>
int main(int /*argc*/, char* /*argv*/[])
{
boost::circular_buffer<int> cb(3);
cb.push_back(1);
cb.push_back(2);
cb.push_back(3);
boost::circular_buffer<int>::iterator it = cb.begin();
assert(*it == 1);
cb.push_back(4);
assert(*it == 4); // The iterator still points to the initialized memory.
return 0;
}
//] [/circular_buffer_iter_example_1]
@@ -0,0 +1,64 @@
// Copyright 2003-2008 Jan Gaspar.
// Copyright 2013 Paul A. Bristow. Added some Quickbook snippet markers.
// Distributed under the Boost Software License, Version 1.0.
// (See the accompanying file LICENSE_1_0.txt
// or a copy at <http://www.boost.org/LICENSE_1_0.txt>.)
//[circular_buffer_sum_example_1
/*`This example shows several functions, including summing all valid values.
*/
#include <boost/circular_buffer.hpp>
#include <numeric>
#include <assert.h>
int main(int /*argc*/, char* /*argv*/[])
{
// Create a circular buffer of capacity 3.
boost::circular_buffer<int> cb(3);
assert(cb.capacity() == 3);
// Check is empty.
assert(cb.size() == 0);
assert(cb.empty());
// Insert some elements into the circular buffer.
cb.push_back(1);
cb.push_back(2);
// Assertions to check push_backs have expected effect.
assert(cb[0] == 1);
assert(cb[1] == 2);
assert(!cb.full());
assert(cb.size() == 2);
assert(cb.capacity() == 3);
// Insert some other elements.
cb.push_back(3);
cb.push_back(4);
// Evaluate the sum of all elements.
int sum = std::accumulate(cb.begin(), cb.end(), 0);
// Assertions to check state.
assert(sum == 9);
assert(cb[0] == 2);
assert(cb[1] == 3);
assert(cb[2] == 4);
assert(*cb.begin() == 2);
assert(cb.front() == 2);
assert(cb.back() == 4);
assert(cb.full());
assert(cb.size() == 3);
assert(cb.capacity() == 3);
return 0;
}
//] [/circular_buffer_sum_example_1]
/*
There is no output from this example.
*/
+42
View File
@@ -0,0 +1,42 @@
# Copyright Paul A. Bristow 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)
# jamfile.v2 to run all circular_buffer examples.
# bring in the rules for testing.
import testing ;
project
: requirements
<library>/boost/system//boost_system
<library>/boost/thread//boost_thread
#<define>BOOST_ALL_NO_LIB=1
<threading>multi
<toolset>gcc:<cxxflags>-Wno-missing-braces
<toolset>darwin:<cxxflags>-Wno-missing-braces
<toolset>acc:<cxxflags>+W2068,2461,2236,4070
<toolset>intel:<cxxflags>-Qwd264,239
<toolset>msvc:<warnings>all
<toolset>msvc:<asynch-exceptions>on
<toolset>msvc:<define>_CRT_SECURE_NO_DEPRECATE
<toolset>msvc:<define>_SCL_SECURE_NO_DEPRECATE
<toolset>msvc:<define>_SCL_SECURE_NO_WARNINGS
<toolset>msvc:<define>_CRT_SECURE_NO_WARNINGS
<toolset>msvc:<cxxflags>/wd4996
<toolset>msvc:<cxxflags>/wd4512
<toolset>msvc:<cxxflags>/wd4610
<toolset>msvc:<cxxflags>/wd4510
<toolset>msvc:<cxxflags>/wd4127
<toolset>msvc:<cxxflags>/wd4701
<toolset>msvc:<cxxflags>/wd4127
<toolset>msvc:<cxxflags>/wd4305
;
run bounded_buffer_comparison.cpp ;
run circular_buffer_iter_example.cpp ;
run circular_buffer_sum_example.cpp ;
run circular_buffer_bound_example.cpp ../../thread/build//boost_thread ../../timer/build//boost_timer ;
+25
View File
@@ -0,0 +1,25 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="refresh" content="0; URL=../../doc/html/circular_buffer.html">
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>
Redirection
</title>
</head>
<body>
Automatic redirection failed, please go to
<a href="../../doc/html/circular_buffer.html"> ../../doc/html/circular_buffer.html</a>.
<p>
<small>Copyright © 2003-2008 Jan Gaspar, 2013 Paul A. Bristow</small>
</p>
<p>
<small>Use, modification, and distribution is subject to the Boost Software License, Version 1.0.<br>
(See accompanying file <code>LICENSE_1_0.txt</code> or copy at <a href=
"http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt</a>)</small>
</p>
</body>
</html>
+14
View File
@@ -0,0 +1,14 @@
{
"key": "circular_buffer",
"name": "Circular Buffer",
"authors": [
"Jan Gaspar"
],
"description": "A STL compliant container also known as ring or cyclic buffer.",
"category": [
"Containers"
],
"maintainers": [
"Jan Gaspar <jano_gaspar -at- yahoo.com>"
]
}
+32
View File
@@ -0,0 +1,32 @@
# Boost circular_buffer test Jamfile.
#
# Copyright (c) 2003-2008 Jan Gaspar
#
# Distributed under the Boost Software License, Version 1.0. (See
# accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
# Added warning suppression Paul A. Bristow 25 Nov 2008
# Bring in rules for testing.
import testing ;
project
: requirements
<toolset>msvc:<warnings>all
<toolset>msvc:<asynch-exceptions>on
<toolset>msvc:<define>_SCL_SECURE_NO_WARNINGS
<toolset>msvc:<cxxflags>/wd4996 # 'function': was declared deprecated
<toolset>msvc:<cxxflags>/wd4244 # conversion from 'int' to 'unsigned short', possible loss of data
# in date-time
;
test-suite "circular_buffer"
: [ run base_test.cpp : : : <threading>single : ]
[ run space_optimized_test.cpp : : : <threading>single : ]
[ run base_test.cpp : : : <threading>single <define>"BOOST_CB_ENABLE_DEBUG=1" : base_test_dbg ]
[ run space_optimized_test.cpp : : : <threading>single <define>"BOOST_CB_ENABLE_DEBUG=1" : space_optimized_test_dbg ]
[ run soft_iterator_invalidation.cpp : : : <threading>single : ]
[ run constant_erase_test.cpp : : : <threading>single : ]
[ compile bounded_buffer_comparison.cpp : <threading>multi : ]
;
+865
View File
@@ -0,0 +1,865 @@
// Test of the base circular buffer container.
// Copyright (c) 2003-2008 Jan Gaspar
// Copyright (c) 2013 Antony Polukhin
// Use, modification, and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#include "test.hpp"
#define CB_CONTAINER circular_buffer
#include "common.ipp"
void iterator_constructor_and_assign_test() {
circular_buffer<MyInteger> cb(4, 3);
circular_buffer<MyInteger>::iterator it = cb.begin();
circular_buffer<MyInteger>::iterator itCopy;
itCopy = it;
it = it;
circular_buffer<MyInteger>::const_iterator cit;
cit = it;
circular_buffer<MyInteger>::const_iterator end1 = cb.end();
circular_buffer<MyInteger>::const_iterator end2 = end1;
BOOST_CHECK(itCopy == it);
BOOST_CHECK(cit == it);
BOOST_CHECK(end1 == end2);
BOOST_CHECK(it != end1);
BOOST_CHECK(cit != end2);
}
void iterator_reference_test() {
circular_buffer<Dummy> cb(3, Dummy());
circular_buffer<Dummy>::iterator it = cb.begin();
circular_buffer<Dummy>::const_iterator cit = cb.begin() + 1;
BOOST_CHECK((*it).m_n == Dummy::eVar);
BOOST_CHECK((*it).fnc() == Dummy::eFnc);
BOOST_CHECK((*cit).const_fnc() == Dummy::eConst);
BOOST_CHECK((*it).virtual_fnc() == Dummy::eVirtual);
BOOST_CHECK(it->m_n == Dummy::eVar);
BOOST_CHECK(it->fnc() == Dummy::eFnc);
BOOST_CHECK(cit->const_fnc() == Dummy::eConst);
BOOST_CHECK(it->virtual_fnc() == Dummy::eVirtual);
}
void iterator_difference_test() {
circular_buffer<MyInteger> cb(5, 1);
cb.push_back(2);
circular_buffer<MyInteger>::iterator it1 = cb.begin() + 2;
circular_buffer<MyInteger>::iterator it2 = cb.begin() + 3;
circular_buffer<MyInteger>::const_iterator begin = cb.begin();
circular_buffer<MyInteger>::iterator end = cb.end();
BOOST_CHECK(begin - begin == 0);
BOOST_CHECK(end - cb.begin() == 5);
BOOST_CHECK(end - end == 0);
BOOST_CHECK(begin - cb.end() == -5);
BOOST_CHECK(it1 - cb.begin() == 2);
BOOST_CHECK(it1 - begin == 2);
BOOST_CHECK(end - it1 == 3);
BOOST_CHECK(it2 - it1 == 1);
BOOST_CHECK(it1 - it2 == -1);
BOOST_CHECK(it2 - it2 == 0);
}
void iterator_increment_test() {
circular_buffer<MyInteger> cb(10, 1);
cb.push_back(2);
circular_buffer<MyInteger>::iterator it1 = cb.begin();
circular_buffer<MyInteger>::iterator it2 = cb.begin() + 5;
circular_buffer<MyInteger>::iterator it3 = cb.begin() + 9;
it1++;
it2++;
++it3;
BOOST_CHECK(it1 == cb.begin() + 1);
BOOST_CHECK(it2 == cb.begin() + 6);
BOOST_CHECK(it3 == cb.end());
}
void iterator_decrement_test() {
circular_buffer<MyInteger> cb(10, 1);
cb.push_back(2);
circular_buffer<MyInteger>::iterator it1= cb.end();
circular_buffer<MyInteger>::iterator it2= cb.end() - 5;
circular_buffer<MyInteger>::iterator it3= cb.end() - 9;
--it1;
it2--;
--it3;
BOOST_CHECK(it1 == cb.end() - 1);
BOOST_CHECK(it2 == cb.end() - 6);
BOOST_CHECK(it3 == cb.begin());
}
void iterator_addition_test() {
circular_buffer<MyInteger> cb(10, 1);
cb.push_back(2);
cb.push_back(2);
circular_buffer<MyInteger>::iterator it1 = cb.begin() + 2;
circular_buffer<MyInteger>::iterator it2 = cb.end();
circular_buffer<MyInteger>::iterator it3 = cb.begin() + 5;
circular_buffer<MyInteger>::iterator it4 = cb.begin() + 9;
it1 += 3;
it2 += 0;
it3 += 5;
it4 += -2;
BOOST_CHECK(it1 == 5 + cb.begin());
BOOST_CHECK(it2 == cb.end());
BOOST_CHECK(it3 == cb.end());
BOOST_CHECK(it4 + 3 == cb.end());
BOOST_CHECK((-3) + it4 == cb.begin() + 4);
BOOST_CHECK(cb.begin() + 0 == cb.begin());
}
void iterator_subtraction_test() {
circular_buffer<MyInteger> cb(10, 1);
cb.push_back(2);
cb.push_back(2);
cb.push_back(2);
circular_buffer<MyInteger>::iterator it1 = cb.begin();
circular_buffer<MyInteger>::iterator it2 = cb.end();
circular_buffer<MyInteger>::iterator it3 = cb.end() - 5;
circular_buffer<MyInteger>::iterator it4 = cb.begin() + 7;
it1 -= -2;
it2 -= 0;
it3 -= 5;
BOOST_CHECK(it1 == cb.begin() + 2);
BOOST_CHECK(it2 == cb.end());
BOOST_CHECK(it3 == cb.begin());
BOOST_CHECK(it4 - 7 == cb.begin());
BOOST_CHECK(it4 - (-3) == cb.end());
BOOST_CHECK(cb.begin() - 0 == cb.begin());
}
void iterator_element_access_test() {
circular_buffer<MyInteger> cb(10);
cb.push_back(1);
cb.push_back(2);
cb.push_back(3);
cb.push_back(4);
cb.push_back(5);
cb.push_back(6);
circular_buffer<MyInteger>::iterator it = cb.begin() + 1;
BOOST_CHECK(it[0] == 2);
BOOST_CHECK(it[-1] == 1);
BOOST_CHECK(it[2] == 4);
}
void iterator_comparison_test() {
circular_buffer<MyInteger> cb(5, 1);
cb.push_back(2);
circular_buffer<MyInteger>::iterator it = cb.begin() + 2;
circular_buffer<MyInteger>::const_iterator begin = cb.begin();
circular_buffer<MyInteger>::iterator end = cb.end();
BOOST_CHECK(begin == begin);
BOOST_CHECK(end > cb.begin());
BOOST_CHECK(begin < end);
BOOST_CHECK(end > begin);
BOOST_CHECK(end == end);
BOOST_CHECK(begin < cb.end());
BOOST_CHECK(!(begin + 1 > cb.end()));
BOOST_CHECK(it > cb.begin());
BOOST_CHECK(end > it);
BOOST_CHECK(begin >= begin);
BOOST_CHECK(end >= cb.begin());
BOOST_CHECK(end <= end);
BOOST_CHECK(begin <= cb.end());
BOOST_CHECK(it >= cb.begin());
BOOST_CHECK(end >= it);
BOOST_CHECK(!(begin + 4 < begin + 4));
BOOST_CHECK(begin + 4 < begin + 5);
BOOST_CHECK(!(begin + 5 < begin + 4));
BOOST_CHECK(it < end - 1);
BOOST_CHECK(!(end - 1 < it));
}
void iterator_invalidation_test() {
#if BOOST_CB_ENABLE_DEBUG
circular_buffer<MyInteger>::iterator it1;
circular_buffer<MyInteger>::const_iterator it2;
circular_buffer<MyInteger>::iterator it3;
circular_buffer<MyInteger>::const_iterator it4;
circular_buffer<MyInteger>::const_iterator it5;
circular_buffer<MyInteger>::const_iterator it6;
BOOST_CHECK(it1.is_valid(0));
BOOST_CHECK(it2.is_valid(0));
BOOST_CHECK(it3.is_valid(0));
BOOST_CHECK(it4.is_valid(0));
BOOST_CHECK(it5.is_valid(0));
BOOST_CHECK(it6.is_valid(0));
{
circular_buffer<MyInteger> cb(5, 0);
const circular_buffer<MyInteger> ccb(5, 0);
it1 = cb.begin();
it2 = ccb.begin();
it3 = cb.end();
it4 = it1;
it5 = it2;
it6 = it1;
BOOST_CHECK(it1.is_valid(&cb));
BOOST_CHECK(it2.is_valid(&ccb));
BOOST_CHECK(it3.is_valid(&cb));
BOOST_CHECK(it4.is_valid(&cb));
BOOST_CHECK(it5.is_valid(&ccb));
BOOST_CHECK(it6.is_valid(&cb));
}
BOOST_CHECK(it1.is_valid(0));
BOOST_CHECK(it2.is_valid(0));
BOOST_CHECK(it3.is_valid(0));
BOOST_CHECK(it4.is_valid(0));
BOOST_CHECK(it5.is_valid(0));
BOOST_CHECK(it6.is_valid(0));
circular_buffer<MyInteger> cb(10, 0);
it1 = cb.end();
cb.clear();
BOOST_CHECK(it1.is_valid(&cb));
cb.push_back(1);
cb.push_back(2);
cb.push_back(3);
int i = 0;
for (it2 = cb.begin(); it2 != it1; it2++, i++);
BOOST_CHECK(i == 3);
circular_buffer<MyInteger> cb1(10, 0);
circular_buffer<MyInteger> cb2(20, 0);
it1 = cb1.end();
it2 = cb2.begin();
BOOST_CHECK(it1.is_valid(&cb1));
BOOST_CHECK(it2.is_valid(&cb2));
cb1.swap(cb2);
BOOST_CHECK(!it1.is_valid(&cb1));
BOOST_CHECK(!it2.is_valid(&cb2));
it1 = cb1.begin() + 3;
it2 = cb1.begin();
cb1.push_back(1);
BOOST_CHECK(it1.is_valid(&cb1));
BOOST_CHECK(!it2.is_valid(&cb1));
BOOST_CHECK(*it2.m_it == 1);
circular_buffer<MyInteger> cb3(5);
cb3.push_back(1);
cb3.push_back(2);
cb3.push_back(3);
cb3.push_back(4);
cb3.push_back(5);
it1 = cb3.begin() + 2;
it2 = cb3.begin();
cb3.insert(cb3.begin() + 3, 6);
BOOST_CHECK(it1.is_valid(&cb3));
BOOST_CHECK(!it2.is_valid(&cb3));
BOOST_CHECK(*it2.m_it == 5);
it1 = cb3.begin() + 3;
it2 = cb3.end() - 1;
cb3.push_front(7);
BOOST_CHECK(it1.is_valid(&cb3));
BOOST_CHECK(!it2.is_valid(&cb3));
BOOST_CHECK(*it2.m_it == 7);
circular_buffer<MyInteger> cb4(5);
cb4.push_back(1);
cb4.push_back(2);
cb4.push_back(3);
cb4.push_back(4);
cb4.push_back(5);
it1 = cb4.begin() + 3;
it2 = cb4.begin();
cb4.rinsert(cb4.begin() + 2, 6);
BOOST_CHECK(it1.is_valid(&cb4));
BOOST_CHECK(!it2.is_valid(&cb4));
BOOST_CHECK(*it2.m_it == 2);
it1 = cb1.begin() + 5;
it2 = cb1.end() - 1;
cb1.pop_back();
BOOST_CHECK(it1.is_valid(&cb1));
BOOST_CHECK(!it2.is_valid(&cb1));
it1 = cb1.begin() + 5;
it2 = cb1.begin();
cb1.pop_front();
BOOST_CHECK(it1.is_valid(&cb1));
BOOST_CHECK(!it2.is_valid(&cb1));
circular_buffer<MyInteger> cb5(20, 0);
it1 = cb5.begin() + 5;
it2 = it3 = cb5.begin() + 15;
cb5.erase(cb5.begin() + 10);
BOOST_CHECK(it1.is_valid(&cb5));
BOOST_CHECK(!it2.is_valid(&cb5));
BOOST_CHECK(!it3.is_valid(&cb5));
it1 = cb5.begin() + 1;
it2 = it3 = cb5.begin() + 8;
cb5.erase(cb5.begin() + 3, cb5.begin() + 7);
BOOST_CHECK(it1.is_valid(&cb5));
BOOST_CHECK(!it2.is_valid(&cb5));
BOOST_CHECK(!it3.is_valid(&cb5));
circular_buffer<MyInteger> cb6(20, 0);
it4 = it1 = cb6.begin() + 5;
it2 = cb6.begin() + 15;
cb6.rerase(cb6.begin() + 10);
BOOST_CHECK(!it1.is_valid(&cb6));
BOOST_CHECK(!it4.is_valid(&cb6));
BOOST_CHECK(it2.is_valid(&cb6));
it4 = it1 = cb6.begin() + 1;
it2 = cb6.begin() + 8;
cb6.rerase(cb6.begin() + 3, cb6.begin() + 7);
BOOST_CHECK(!it1.is_valid(&cb6));
BOOST_CHECK(!it4.is_valid(&cb6));
BOOST_CHECK(it2.is_valid(&cb6));
circular_buffer<MyInteger> cb7(10, 1);
cb7.push_back(2);
cb7.push_back(3);
cb7.push_back(4);
it1 = cb7.end();
it2 = cb7.begin();
it3 = cb7.begin() + 6;
cb7.linearize();
BOOST_CHECK(it1.is_valid(&cb7));
BOOST_CHECK(!it2.is_valid(&cb7));
BOOST_CHECK(!it3.is_valid(&cb7));
it1 = cb7.end();
it2 = cb7.begin();
it3 = cb7.begin() + 6;
cb7.linearize();
BOOST_CHECK(it1.is_valid(&cb7));
BOOST_CHECK(it2.is_valid(&cb7));
BOOST_CHECK(it3.is_valid(&cb7));
cb7.push_back(5);
cb7.push_back(6);
it1 = cb7.end();
it2 = cb7.begin();
it3 = cb7.begin() + 6;
cb7.set_capacity(10);
BOOST_CHECK(it1.is_valid(&cb7));
BOOST_CHECK(it2.is_valid(&cb7));
BOOST_CHECK(it3.is_valid(&cb7));
cb7.set_capacity(20);
BOOST_CHECK(it1.is_valid(&cb7));
BOOST_CHECK(!it2.is_valid(&cb7));
BOOST_CHECK(!it3.is_valid(&cb7));
cb7.push_back(7);
it1 = cb7.end();
it2 = cb7.begin();
it3 = cb7.begin() + 6;
cb7.set_capacity(10);
BOOST_CHECK(it1.is_valid(&cb7));
BOOST_CHECK(!it2.is_valid(&cb7));
BOOST_CHECK(!it3.is_valid(&cb7));
cb7.push_back(8);
cb7.push_back(9);
it1 = cb7.end();
it2 = cb7.begin();
it3 = cb7.begin() + 6;
cb7.rset_capacity(10);
BOOST_CHECK(it1.is_valid(&cb7));
BOOST_CHECK(it2.is_valid(&cb7));
BOOST_CHECK(it3.is_valid(&cb7));
cb7.rset_capacity(20);
BOOST_CHECK(it1.is_valid(&cb7));
BOOST_CHECK(!it2.is_valid(&cb7));
BOOST_CHECK(!it3.is_valid(&cb7));
cb7.push_back(10);
it1 = cb7.end();
it2 = cb7.begin();
it3 = cb7.begin() + 6;
cb7.rset_capacity(10);
BOOST_CHECK(it1.is_valid(&cb7));
BOOST_CHECK(!it2.is_valid(&cb7));
BOOST_CHECK(!it3.is_valid(&cb7));
circular_buffer<MyInteger> cb8(10, 1);
cb8.push_back(2);
cb8.push_back(3);
it1 = cb8.end();
it2 = cb8.begin();
it3 = cb8.begin() + 6;
cb8.resize(10);
BOOST_CHECK(it1.is_valid(&cb8));
BOOST_CHECK(it2.is_valid(&cb8));
BOOST_CHECK(it3.is_valid(&cb8));
cb8.resize(20);
BOOST_CHECK(it1.is_valid(&cb8));
BOOST_CHECK(!it2.is_valid(&cb8));
BOOST_CHECK(!it3.is_valid(&cb8));
cb8.push_back(4);
it1 = cb8.end();
it2 = cb8.begin();
it3 = cb8.begin() + 6;
it4 = cb8.begin() + 12;
cb8.resize(10);
BOOST_CHECK(it1.is_valid(&cb8));
BOOST_CHECK(it2.is_valid(&cb8));
BOOST_CHECK(it3.is_valid(&cb8));
BOOST_CHECK(!it4.is_valid(&cb8));
cb8.set_capacity(10);
cb8.push_back(5);
cb8.push_back(6);
it1 = cb8.end();
it2 = cb8.begin();
it3 = cb8.begin() + 6;
cb8.rresize(10);
BOOST_CHECK(it1.is_valid(&cb8));
BOOST_CHECK(it2.is_valid(&cb8));
BOOST_CHECK(it3.is_valid(&cb8));
cb8.rresize(20);
BOOST_CHECK(it1.is_valid(&cb8));
BOOST_CHECK(!it2.is_valid(&cb8));
BOOST_CHECK(!it3.is_valid(&cb8));
cb8.push_back(7);
it1 = cb8.end();
it2 = cb8.begin();
it3 = cb8.begin() + 6;
it4 = cb8.begin() + 12;
cb8.rresize(10);
BOOST_CHECK(it1.is_valid(&cb8));
BOOST_CHECK(!it2.is_valid(&cb8));
BOOST_CHECK(!it3.is_valid(&cb8));
BOOST_CHECK(it4.is_valid(&cb8));
circular_buffer<MyInteger> cb9(15, 1);
it1 = cb9.end();
it2 = cb9.begin();
it3 = cb9.begin() + 6;
it4 = cb9.begin() + 12;
cb9 = cb8;
BOOST_CHECK(it1.is_valid(&cb9));
BOOST_CHECK(!it2.is_valid(&cb9));
BOOST_CHECK(!it3.is_valid(&cb9));
BOOST_CHECK(!it4.is_valid(&cb9));
circular_buffer<MyInteger> cb10(10, 1);
it1 = cb10.end();
it2 = cb10.begin();
it3 = cb10.begin() + 3;
it4 = cb10.begin() + 7;
cb10.assign(5, 2);
BOOST_CHECK(it1.is_valid(&cb10));
BOOST_CHECK(!it2.is_valid(&cb10));
BOOST_CHECK(!it3.is_valid(&cb10));
BOOST_CHECK(!it4.is_valid(&cb10));
circular_buffer<MyInteger> cb11(10, 1);
it1 = cb11.end();
it2 = cb11.begin();
it3 = cb11.begin() + 3;
it4 = cb11.begin() + 7;
cb11.assign(15, 5, 2);
BOOST_CHECK(it1.is_valid(&cb11));
BOOST_CHECK(!it2.is_valid(&cb11));
BOOST_CHECK(!it3.is_valid(&cb11));
BOOST_CHECK(!it4.is_valid(&cb11));
circular_buffer<MyInteger> cb12(10, 1);
it1 = cb12.end();
it2 = cb12.begin();
it3 = cb12.begin() + 3;
it4 = cb12.begin() + 7;
cb12.assign(cb11.begin(), cb11.end());
BOOST_CHECK(it1.is_valid(&cb12));
BOOST_CHECK(!it2.is_valid(&cb12));
BOOST_CHECK(!it3.is_valid(&cb12));
BOOST_CHECK(!it4.is_valid(&cb12));
circular_buffer<MyInteger> cb13(10, 1);
it1 = cb13.end();
it2 = cb13.begin();
it3 = cb13.begin() + 3;
it4 = cb13.begin() + 7;
cb13.assign(15, cb11.begin(), cb11.end());
BOOST_CHECK(it1.is_valid(&cb13));
BOOST_CHECK(!it2.is_valid(&cb13));
BOOST_CHECK(!it3.is_valid(&cb13));
BOOST_CHECK(!it4.is_valid(&cb13));
circular_buffer<MyInteger> cb14(10);
cb14.push_back(1);
cb14.push_back(2);
cb14.push_back(3);
cb14.push_back(4);
cb14.push_back(5);
cb14.push_back(6);
cb14.push_back(7);
it1 = cb14.end();
it2 = cb14.begin() + 2;
it3 = cb14.begin() + 1;
it4 = cb14.begin() + 5;
cb14.rotate(it2);
BOOST_CHECK(it1.is_valid(&cb14));
BOOST_CHECK(it2.is_valid(&cb14));
BOOST_CHECK(!it3.is_valid(&cb14));
BOOST_CHECK(it4.is_valid(&cb14));
circular_buffer<MyInteger> cb15(7);
cb15.push_back(1);
cb15.push_back(2);
cb15.push_back(3);
cb15.push_back(4);
cb15.push_back(5);
cb15.push_back(6);
cb15.push_back(7);
cb15.push_back(8);
cb15.push_back(9);
it1 = cb15.end();
it2 = cb15.begin() + 2;
it3 = cb15.begin() + 1;
it4 = cb15.begin() + 5;
cb15.rotate(it3);
BOOST_CHECK(it1.is_valid(&cb15));
BOOST_CHECK(it2.is_valid(&cb15));
BOOST_CHECK(it3.is_valid(&cb15));
BOOST_CHECK(it4.is_valid(&cb15));
circular_buffer<MyInteger> cb16(10);
cb16.push_back(1);
cb16.push_back(2);
cb16.push_back(3);
cb16.push_back(4);
cb16.push_back(5);
cb16.push_back(6);
cb16.push_back(7);
it1 = cb16.end();
it2 = cb16.begin() + 6;
it3 = cb16.begin();
it4 = cb16.begin() + 5;
cb16.rotate(it4);
BOOST_CHECK(it1.is_valid(&cb16));
BOOST_CHECK(!it2.is_valid(&cb16));
BOOST_CHECK(it3.is_valid(&cb16));
BOOST_CHECK(!it4.is_valid(&cb16));
#endif // #if BOOST_CB_ENABLE_DEBUG
}
// basic exception safety test (it is useful to use any memory-leak detection tool)
void exception_safety_test() {
#if !defined(BOOST_NO_EXCEPTIONS)
circular_buffer<MyInteger> cb1(3, 5);
MyInteger::set_exception_trigger(3);
BOOST_CHECK_THROW(cb1.set_capacity(5), std::exception);
BOOST_CHECK(cb1.capacity() == 3);
MyInteger::set_exception_trigger(3);
BOOST_CHECK_THROW(cb1.rset_capacity(5), std::exception);
BOOST_CHECK(cb1.capacity() == 3);
generic_test(cb1);
MyInteger::set_exception_trigger(3);
BOOST_CHECK_THROW(circular_buffer<MyInteger> cb2(5, 10), std::exception);
circular_buffer<MyInteger> cb3(5, 10);
MyInteger::set_exception_trigger(3);
BOOST_CHECK_THROW(circular_buffer<MyInteger> cb4(cb3), std::exception);
vector<MyInteger> v(5, MyInteger(10));
MyInteger::set_exception_trigger(3);
BOOST_CHECK_THROW(circular_buffer<MyInteger> cb5(8, v.begin(), v.end()), std::exception);
circular_buffer<MyInteger> cb6(5, 10);
circular_buffer<MyInteger> cb7(8, 3);
MyInteger::set_exception_trigger(3);
BOOST_CHECK_THROW(cb7 = cb6, std::exception);
BOOST_CHECK(cb7.size() == 8);
BOOST_CHECK(cb7.capacity() == 8);
BOOST_CHECK(cb7[0] == 3);
BOOST_CHECK(cb7[7] == 3);
generic_test(cb7);
circular_buffer<MyInteger> cb8(5, 10);
MyInteger::set_exception_trigger(2);
BOOST_CHECK_THROW(cb8.push_front(1), std::exception);
circular_buffer<MyInteger> cb9(5);
cb9.push_back(1);
cb9.push_back(2);
cb9.push_back(3);
MyInteger::set_exception_trigger(3);
BOOST_CHECK_THROW(cb9.insert(cb9.begin() + 1, 4), std::exception);
circular_buffer<MyInteger> cb10(5);
cb10.push_back(1);
cb10.push_back(2);
cb10.push_back(3);
MyInteger::set_exception_trigger(3);
BOOST_CHECK_THROW(cb10.rinsert(cb10.begin() + 1, 4), std::exception);
circular_buffer<MyInteger> cb11(5);
cb11.push_back(1);
cb11.push_back(2);
MyInteger::set_exception_trigger(2);
BOOST_CHECK_THROW(cb11.rinsert(cb11.begin(), 1), std::exception);
circular_buffer<MyInteger> cb12(5, 1);
MyInteger::set_exception_trigger(3);
BOOST_CHECK_THROW(cb12.assign(4, 2), std::exception);
circular_buffer<MyInteger> cb13(5, 1);
MyInteger::set_exception_trigger(3);
BOOST_CHECK_THROW(cb13.assign(6, 2), std::exception);
circular_buffer<MyInteger> cb14(5);
cb14.push_back(1);
cb14.push_back(2);
MyInteger::set_exception_trigger(3);
BOOST_CHECK_THROW(cb14.insert(cb14.begin(), 10, 3), std::exception);
circular_buffer<MyInteger> cb15(5);
cb15.push_back(1);
cb15.push_back(2);
MyInteger::set_exception_trigger(3);
BOOST_CHECK_THROW(cb15.insert(cb15.end(), 10, 3), std::exception);
circular_buffer<MyInteger> cb16(5);
cb16.push_back(1);
cb16.push_back(2);
MyInteger::set_exception_trigger(3);
BOOST_CHECK_THROW(cb16.rinsert(cb16.begin(), 10, 3), std::exception);
circular_buffer<MyInteger> cb17(5);
cb17.push_back(1);
cb17.push_back(2);
MyInteger::set_exception_trigger(3);
BOOST_CHECK_THROW(cb17.rinsert(cb17.end(), 10, 3), std::exception);
circular_buffer<MyInteger> cb18(5, 0);
cb18.push_back(1);
cb18.push_back(2);
cb18.pop_front();
MyInteger::set_exception_trigger(4);
BOOST_CHECK_THROW(cb18.linearize(), std::exception);
circular_buffer<MyInteger> cb19(5, 0);
cb19.push_back(1);
cb19.push_back(2);
MyInteger::set_exception_trigger(5);
BOOST_CHECK_THROW(cb19.linearize(), std::exception);
circular_buffer<MyInteger> cb20(5, 0);
cb20.push_back(1);
cb20.push_back(2);
MyInteger::set_exception_trigger(6);
BOOST_CHECK_THROW(cb20.linearize(), std::exception);
circular_buffer<MyInteger> cb21(5);
cb21.push_back(1);
cb21.push_back(2);
cb21.push_back(3);
MyInteger::set_exception_trigger(2);
BOOST_CHECK_THROW(cb21.insert(cb21.begin() + 1, 4), std::exception);
circular_buffer<MyInteger> cb22(5);
cb22.push_back(1);
cb22.push_back(2);
cb22.push_back(3);
MyInteger::set_exception_trigger(2);
BOOST_CHECK_THROW(cb22.insert(cb22.end(), 4), std::exception);
circular_buffer<MyInteger> cb23(5, 0);
MyInteger::set_exception_trigger(2);
BOOST_CHECK_THROW(cb23.insert(cb23.begin() + 1, 4), std::exception);
circular_buffer<MyInteger> cb24(5);
cb24.push_back(1);
cb24.push_back(2);
cb24.push_back(3);
MyInteger::set_exception_trigger(2);
BOOST_CHECK_THROW(cb24.rinsert(cb24.begin() + 1, 4), std::exception);
circular_buffer<MyInteger> cb25(5, 0);
MyInteger::set_exception_trigger(2);
BOOST_CHECK_THROW(cb25.rinsert(cb25.begin() + 3, 4), std::exception);
circular_buffer<MyInteger> cb26(5);
cb26.push_back(1);
cb26.push_back(2);
MyInteger::set_exception_trigger(5);
BOOST_CHECK_THROW(cb26.insert(cb26.begin(), 10, 3), std::exception);
circular_buffer<MyInteger> cb27(5);
cb27.push_back(1);
cb27.push_back(2);
MyInteger::set_exception_trigger(5);
BOOST_CHECK_THROW(cb27.insert(cb27.end(), 10, 3), std::exception);
circular_buffer<MyInteger> cb28(5);
cb28.push_back(1);
cb28.push_back(2);
MyInteger::set_exception_trigger(5);
BOOST_CHECK_THROW(cb28.rinsert(cb28.begin(), 10, 3), std::exception);
circular_buffer<MyInteger> cb29(5);
cb29.push_back(1);
cb29.push_back(2);
MyInteger::set_exception_trigger(5);
BOOST_CHECK_THROW(cb29.rinsert(cb29.end(), 10, 3), std::exception);
circular_buffer<MyInteger> cb30(10);
cb30.push_back(1);
cb30.push_back(2);
cb30.push_back(3);
MyInteger::set_exception_trigger(2);
BOOST_CHECK_THROW(cb30.rinsert(cb30.begin(), 10, 3), std::exception);
#endif // #if !defined(BOOST_NO_EXCEPTIONS)
}
void move_container_values_except() {
move_container_values_impl<noncopyable_movable_except_t>();
}
template <class T>
void move_container_values_resetting_impl() {
typedef T noncopyable_movable_test_t;
CB_CONTAINER<noncopyable_movable_test_t> cb1(1);
noncopyable_movable_test_t var;
cb1.push_back();
cb1.push_back(boost::move(var));
BOOST_CHECK(!cb1.back().is_moved());
BOOST_CHECK(var.is_moved());
BOOST_CHECK(cb1.size() == 1);
var = boost::move(cb1.back());
BOOST_CHECK(cb1.back().is_moved());
cb1.push_front(boost::move(var));
BOOST_CHECK(!cb1.front().is_moved());
BOOST_CHECK(var.is_moved());
BOOST_CHECK(cb1.size() == 1);
var = boost::move(cb1.back());
BOOST_CHECK(cb1.back().is_moved());
cb1.push_back();
BOOST_CHECK(!cb1.back().is_moved());
BOOST_CHECK(cb1.size() == 1);
var = boost::move(cb1.back());
BOOST_CHECK(cb1.back().is_moved());
cb1.push_front();
BOOST_CHECK(!cb1.front().is_moved());
BOOST_CHECK(cb1.size() == 1);
var = boost::move(cb1.back());
BOOST_CHECK(cb1.back().is_moved());
cb1.insert(cb1.begin());
// If the circular_buffer is full and the pos points to begin(),
// then the item will not be inserted.
BOOST_CHECK(cb1.front().is_moved());
BOOST_CHECK(cb1.size() == 1);
var = boost::move(cb1.back());
BOOST_CHECK(cb1.back().is_moved());
cb1.insert(cb1.begin(), boost::move(var));
// If the circular_buffer is full and the pos points to begin(),
// then the item will not be inserted.
BOOST_CHECK(cb1.front().is_moved());
BOOST_CHECK(cb1.size() == 1);
var = boost::move(cb1.back());
BOOST_CHECK(cb1.back().is_moved());
cb1.rinsert(cb1.begin());
BOOST_CHECK(!cb1.back().is_moved());
BOOST_CHECK(cb1.size() == 1);
var = boost::move(cb1.back());
BOOST_CHECK(cb1.back().is_moved());
var.reinit();
cb1.rinsert(cb1.begin(), boost::move(var));
BOOST_CHECK(!cb1.back().is_moved());
BOOST_CHECK(cb1.size() == 1);
var = boost::move(cb1.back());
BOOST_CHECK(cb1.back().is_moved());
cb1.rinsert(cb1.end());
BOOST_CHECK(cb1.back().is_moved());
BOOST_CHECK(cb1.size() == 1);
var = boost::move(cb1.back());
BOOST_CHECK(cb1.back().is_moved());
var.reinit();
cb1.rinsert(cb1.end(), boost::move(var));
BOOST_CHECK(cb1.back().is_moved());
BOOST_CHECK(cb1.size() == 1);
var = boost::move(cb1.back());
BOOST_CHECK(cb1.back().is_moved());
cb1.push_back();
BOOST_CHECK(!cb1[0].is_moved());
const int val = cb1[0].value();
cb1.linearize();
BOOST_CHECK(!cb1[0].is_moved());
BOOST_CHECK(cb1[0].value() == val);
cb1.rotate(cb1.begin());
BOOST_CHECK(!cb1[0].is_moved());
BOOST_CHECK(cb1[0].value() == val);
}
void move_container_values_resetting_except() {
move_container_values_resetting_impl<noncopyable_movable_except_t>();
}
void move_container_values_resetting_noexcept() {
move_container_values_resetting_impl<noncopyable_movable_noexcept_t>();
}
// test main
test_suite* init_unit_test_suite(int /*argc*/, char* /*argv*/[]) {
test_suite* tests = BOOST_TEST_SUITE("Unit tests for the circular_buffer.");
add_common_tests(tests);
tests->add(BOOST_TEST_CASE(&iterator_constructor_and_assign_test));
tests->add(BOOST_TEST_CASE(&iterator_reference_test));
tests->add(BOOST_TEST_CASE(&iterator_difference_test));
tests->add(BOOST_TEST_CASE(&iterator_increment_test));
tests->add(BOOST_TEST_CASE(&iterator_decrement_test));
tests->add(BOOST_TEST_CASE(&iterator_addition_test));
tests->add(BOOST_TEST_CASE(&iterator_subtraction_test));
tests->add(BOOST_TEST_CASE(&iterator_element_access_test));
tests->add(BOOST_TEST_CASE(&iterator_comparison_test));
tests->add(BOOST_TEST_CASE(&iterator_invalidation_test));
tests->add(BOOST_TEST_CASE(&exception_safety_test));
tests->add(BOOST_TEST_CASE(&move_container_values_except));
tests->add(BOOST_TEST_CASE(&move_container_values_resetting_except));
tests->add(BOOST_TEST_CASE(&move_container_values_resetting_noexcept));
return tests;
}
@@ -0,0 +1,316 @@
// Comparison of bounded buffers based on different containers.
// Copyright (c) 2003-2008 Jan Gaspar
// Copyright 2013 Paul A. Bristow. Added some Quickbook snippet markers.
// Use, modification, and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#include <boost/circular_buffer.hpp>
#include <boost/thread/mutex.hpp>
#include <boost/thread/condition_variable.hpp>
#include <boost/thread/thread.hpp>
#include <boost/call_traits.hpp>
#include <boost/progress.hpp>
#include <boost/bind.hpp>
#include <deque>
#include <list>
#include <string>
#include <iostream>
const unsigned long QUEUE_SIZE = 1000L;
const unsigned long TOTAL_ELEMENTS = QUEUE_SIZE * 1000L;
template <class T>
class bounded_buffer {
public:
typedef boost::circular_buffer<T> container_type;
typedef typename container_type::size_type size_type;
typedef typename container_type::value_type value_type;
typedef typename boost::call_traits<value_type>::param_type param_type;
explicit bounded_buffer(size_type capacity) : m_unread(0), m_container(capacity) {}
void push_front(param_type item) {
boost::unique_lock<boost::mutex> lock(m_mutex);
m_not_full.wait(lock, boost::bind(&bounded_buffer<value_type>::is_not_full, this));
m_container.push_front(item);
++m_unread;
lock.unlock();
m_not_empty.notify_one();
}
void pop_back(value_type* pItem) {
boost::unique_lock<boost::mutex> lock(m_mutex);
m_not_empty.wait(lock, boost::bind(&bounded_buffer<value_type>::is_not_empty, this));
*pItem = m_container[--m_unread];
lock.unlock();
m_not_full.notify_one();
}
private:
bounded_buffer(const bounded_buffer&); // Disabled copy constructor
bounded_buffer& operator = (const bounded_buffer&); // Disabled assign operator
bool is_not_empty() const { return m_unread > 0; }
bool is_not_full() const { return m_unread < m_container.capacity(); }
size_type m_unread;
container_type m_container;
boost::mutex m_mutex;
boost::condition_variable m_not_empty;
boost::condition_variable m_not_full;
};
template <class T>
class bounded_buffer_space_optimized {
public:
typedef boost::circular_buffer_space_optimized<T> container_type;
typedef typename container_type::size_type size_type;
typedef typename container_type::value_type value_type;
typedef typename boost::call_traits<value_type>::param_type param_type;
explicit bounded_buffer_space_optimized(size_type capacity) : m_container(capacity) {}
void push_front(param_type item) {
boost::unique_lock<boost::mutex> lock(m_mutex);
m_not_full.wait(lock, boost::bind(&bounded_buffer_space_optimized<value_type>::is_not_full, this));
m_container.push_front(item);
lock.unlock();
m_not_empty.notify_one();
}
void pop_back(value_type* pItem) {
boost::unique_lock<boost::mutex> lock(m_mutex);
m_not_empty.wait(lock, boost::bind(&bounded_buffer_space_optimized<value_type>::is_not_empty, this));
*pItem = m_container.back();
m_container.pop_back();
lock.unlock();
m_not_full.notify_one();
}
private:
bounded_buffer_space_optimized(const bounded_buffer_space_optimized&); // Disabled copy constructor
bounded_buffer_space_optimized& operator = (const bounded_buffer_space_optimized&); // Disabled assign operator
bool is_not_empty() const { return m_container.size() > 0; }
bool is_not_full() const { return m_container.size() < m_container.capacity(); }
container_type m_container;
boost::mutex m_mutex;
boost::condition_variable m_not_empty;
boost::condition_variable m_not_full;
};
template <class T>
class bounded_buffer_deque_based {
public:
typedef std::deque<T> container_type;
typedef typename container_type::size_type size_type;
typedef typename container_type::value_type value_type;
typedef typename boost::call_traits<value_type>::param_type param_type;
explicit bounded_buffer_deque_based(size_type capacity) : m_capacity(capacity) {}
void push_front(param_type item) {
boost::unique_lock<boost::mutex> lock(m_mutex);
m_not_full.wait(lock, boost::bind(&bounded_buffer_deque_based<value_type>::is_not_full, this));
m_container.push_front(item);
lock.unlock();
m_not_empty.notify_one();
}
void pop_back(value_type* pItem) {
boost::unique_lock<boost::mutex> lock(m_mutex);
m_not_empty.wait(lock, boost::bind(&bounded_buffer_deque_based<value_type>::is_not_empty, this));
*pItem = m_container.back();
m_container.pop_back();
lock.unlock();
m_not_full.notify_one();
}
private:
bounded_buffer_deque_based(const bounded_buffer_deque_based&); // Disabled copy constructor
bounded_buffer_deque_based& operator = (const bounded_buffer_deque_based&); // Disabled assign operator
bool is_not_empty() const { return m_container.size() > 0; }
bool is_not_full() const { return m_container.size() < m_capacity; }
const size_type m_capacity;
container_type m_container;
boost::mutex m_mutex;
boost::condition_variable m_not_empty;
boost::condition_variable m_not_full;
};
template <class T>
class bounded_buffer_list_based {
public:
typedef std::list<T> container_type;
typedef typename container_type::size_type size_type;
typedef typename container_type::value_type value_type;
typedef typename boost::call_traits<value_type>::param_type param_type;
explicit bounded_buffer_list_based(size_type capacity) : m_capacity(capacity) {}
void push_front(param_type item) {
boost::unique_lock<boost::mutex> lock(m_mutex);
m_not_full.wait(lock, boost::bind(&bounded_buffer_list_based<value_type>::is_not_full, this));
m_container.push_front(item);
lock.unlock();
m_not_empty.notify_one();
}
void pop_back(value_type* pItem) {
boost::unique_lock<boost::mutex> lock(m_mutex);
m_not_empty.wait(lock, boost::bind(&bounded_buffer_list_based<value_type>::is_not_empty, this));
*pItem = m_container.back();
m_container.pop_back();
lock.unlock();
m_not_full.notify_one();
}
private:
bounded_buffer_list_based(const bounded_buffer_list_based&); // Disabled copy constructor
bounded_buffer_list_based& operator = (const bounded_buffer_list_based&); // Disabled assign operator
bool is_not_empty() const { return m_container.size() > 0; }
bool is_not_full() const { return m_container.size() < m_capacity; }
const size_type m_capacity;
container_type m_container;
boost::mutex m_mutex;
boost::condition_variable m_not_empty;
boost::condition_variable m_not_full;
};
template<class Buffer>
class Consumer {
typedef typename Buffer::value_type value_type;
Buffer* m_container;
value_type m_item;
public:
Consumer(Buffer* buffer) : m_container(buffer) {}
void operator()() {
for (unsigned long i = 0L; i < TOTAL_ELEMENTS; ++i) {
m_container->pop_back(&m_item);
}
}
};
template<class Buffer>
class Producer {
typedef typename Buffer::value_type value_type;
Buffer* m_container;
public:
Producer(Buffer* buffer) : m_container(buffer) {}
void operator()() {
for (unsigned long i = 0L; i < TOTAL_ELEMENTS; ++i) {
m_container->push_front(value_type());
}
}
};
template<class Buffer>
void fifo_test(Buffer* buffer) {
// Start of measurement
boost::progress_timer progress;
// Initialize the buffer with some values before launching producer and consumer threads.
for (unsigned long i = QUEUE_SIZE / 2L; i > 0; --i) {
#if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x581))
buffer->push_front(Buffer::value_type());
#else
buffer->push_front(BOOST_DEDUCED_TYPENAME Buffer::value_type());
#endif
}
Consumer<Buffer> consumer(buffer);
Producer<Buffer> producer(buffer);
// Start the threads.
boost::thread consume(consumer);
boost::thread produce(producer);
// Wait for completion.
consume.join();
produce.join();
// End of measurement
}
int main(int /*argc*/, char* /*argv*/[]) {
bounded_buffer<int> bb_int(QUEUE_SIZE);
std::cout << "bounded_buffer<int> ";
fifo_test(&bb_int);
bounded_buffer_space_optimized<int> bb_space_optimized_int(QUEUE_SIZE);
std::cout << "bounded_buffer_space_optimized<int> ";
fifo_test(&bb_space_optimized_int);
bounded_buffer_deque_based<int> bb_deque_based_int(QUEUE_SIZE);
std::cout << "bounded_buffer_deque_based<int> ";
fifo_test(&bb_deque_based_int);
bounded_buffer_list_based<int> bb_list_based_int(QUEUE_SIZE);
std::cout << "bounded_buffer_list_based<int> ";
fifo_test(&bb_list_based_int);
bounded_buffer<std::string> bb_string(QUEUE_SIZE);
std::cout << "bounded_buffer<std::string> ";
fifo_test(&bb_string);
bounded_buffer_space_optimized<std::string> bb_space_optimized_string(QUEUE_SIZE);
std::cout << "bounded_buffer_space_optimized<std::string> ";
fifo_test(&bb_space_optimized_string);
bounded_buffer_deque_based<std::string> bb_deque_based_string(QUEUE_SIZE);
std::cout << "bounded_buffer_deque_based<std::string> ";
fifo_test(&bb_deque_based_string);
bounded_buffer_list_based<std::string> bb_list_based_string(QUEUE_SIZE);
std::cout << "bounded_buffer_list_based<std::string> ";
fifo_test(&bb_list_based_string);
return 0;
}
/*
//[bounded_buffer_comparison_output
Description: Autorun "J:\Cpp\Misc\Debug\bounded_buffer_comparison.exe"
bounded_buffer<int> 5.15 s
bounded_buffer_space_optimized<int> 5.71 s
bounded_buffer_deque_based<int> 15.57 s
bounded_buffer_list_based<int> 17.33 s
bounded_buffer<std::string> 24.49 s
bounded_buffer_space_optimized<std::string> 28.33 s
bounded_buffer_deque_based<std::string> 29.45 s
bounded_buffer_list_based<std::string> 31.29 s
//] //[bounded_buffer_comparison_output]
*/
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,185 @@
// Special tests for erase_begin, erase_end and clear methods.
// Copyright (c) 2009 Jan Gaspar
// Use, modification, and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#include "test.hpp"
int MyInteger::ms_exception_trigger = 0;
int InstanceCounter::ms_count = 0;
void erase_begin_test() {
circular_buffer<int> cb1(5);
cb1.push_back(1);
cb1.push_back(2);
cb1.push_back(3);
cb1.push_back(4);
cb1.push_back(5);
cb1.push_back(6);
circular_buffer<int>::pointer p = &cb1[0];
cb1.erase_begin(2);
BOOST_CHECK(cb1.size() == 3);
BOOST_CHECK(cb1[0] == 4);
BOOST_CHECK(cb1[1] == 5);
BOOST_CHECK(cb1[2] == 6);
cb1.erase_begin(3);
BOOST_CHECK(cb1.empty());
BOOST_CHECK(*p == 2);
BOOST_CHECK(*(p + 1) == 3);
BOOST_CHECK(*(p + 2) == 4);
cb1.push_back(10);
cb1.push_back(11);
cb1.push_back(12);
BOOST_CHECK(cb1.size() == 3);
BOOST_CHECK(cb1[0] == 10);
BOOST_CHECK(cb1[1] == 11);
BOOST_CHECK(cb1[2] == 12);
circular_buffer<InstanceCounter> cb2(5, InstanceCounter());
BOOST_CHECK(cb2.size() == 5);
BOOST_CHECK(InstanceCounter::count() == 5);
cb2.erase_begin(2);
BOOST_CHECK(cb2.size() == 3);
BOOST_CHECK(InstanceCounter::count() == 3);
circular_buffer<MyInteger> cb3(5);
cb3.push_back(1);
cb3.push_back(2);
cb3.push_back(3);
cb3.push_back(4);
cb3.push_back(5);
cb3.push_back(6);
cb3.erase_begin(2);
BOOST_CHECK(cb3.size() == 3);
BOOST_CHECK(cb3[0] == 4);
BOOST_CHECK(cb3[1] == 5);
BOOST_CHECK(cb3[2] == 6);
}
void erase_end_test() {
circular_buffer<int> cb1(5);
cb1.push_back(1);
cb1.push_back(2);
cb1.push_back(3);
cb1.push_back(4);
cb1.push_back(5);
cb1.push_back(6);
circular_buffer<int>::pointer p = &cb1[3];
cb1.erase_end(2);
BOOST_CHECK(cb1.size() == 3);
BOOST_CHECK(cb1[0] == 2);
BOOST_CHECK(cb1[1] == 3);
BOOST_CHECK(cb1[2] ==4);
cb1.erase_end(3);
BOOST_CHECK(cb1.empty());
BOOST_CHECK(*p == 5);
BOOST_CHECK(*(p - 1) == 4);
BOOST_CHECK(*(p - 2) == 3);
cb1.push_back(10);
cb1.push_back(11);
cb1.push_back(12);
BOOST_CHECK(cb1.size() == 3);
BOOST_CHECK(cb1[0] == 10);
BOOST_CHECK(cb1[1] == 11);
BOOST_CHECK(cb1[2] == 12);
circular_buffer<InstanceCounter> cb2(5, InstanceCounter());
BOOST_CHECK(cb2.size() == 5);
BOOST_CHECK(InstanceCounter::count() == 5);
cb2.erase_end(2);
BOOST_CHECK(cb2.size() == 3);
BOOST_CHECK(InstanceCounter::count() == 3);
circular_buffer<MyInteger> cb3(5);
cb3.push_back(1);
cb3.push_back(2);
cb3.push_back(3);
cb3.push_back(4);
cb3.push_back(5);
cb3.push_back(6);
cb3.erase_end(2);
BOOST_CHECK(cb3.size() == 3);
BOOST_CHECK(cb3[0] == 2);
BOOST_CHECK(cb3[1] == 3);
BOOST_CHECK(cb3[2] == 4);
}
void clear_test() {
circular_buffer<int> cb1(5);
cb1.push_back(1);
cb1.push_back(2);
cb1.push_back(3);
cb1.push_back(4);
cb1.push_back(5);
cb1.push_back(6);
circular_buffer<int>::pointer p = &cb1[0];
cb1.clear();
BOOST_CHECK(cb1.empty());
BOOST_CHECK(*p == 2);
BOOST_CHECK(*(p + 1) == 3);
BOOST_CHECK(*(p + 2) == 4);
BOOST_CHECK(*(p + 3) == 5);
BOOST_CHECK(*(p - 1) == 6);
circular_buffer<InstanceCounter> cb2(5, InstanceCounter());
BOOST_CHECK(cb2.size() == 5);
BOOST_CHECK(InstanceCounter::count() == 5);
cb2.clear();
BOOST_CHECK(cb2.empty());
BOOST_CHECK(InstanceCounter::count() == 0);
circular_buffer<MyInteger> cb3(5);
cb3.push_back(1);
cb3.push_back(2);
cb3.push_back(3);
cb3.push_back(4);
cb3.push_back(5);
cb3.push_back(6);
cb3.clear();
BOOST_CHECK(cb3.empty());
}
// test main
test_suite* init_unit_test_suite(int /*argc*/, char* /*argv*/[]) {
test_suite* tests = BOOST_TEST_SUITE("Unit tests for erase_begin/end and clear methods of the circular_buffer.");
tests->add(BOOST_TEST_CASE(&erase_begin_test));
tests->add(BOOST_TEST_CASE(&erase_end_test));
tests->add(BOOST_TEST_CASE(&clear_test));
return tests;
}
@@ -0,0 +1,745 @@
// Demonstration of rules when an iterator is considered to be valid if the soft
// iterator invalidation definition is applied.
// Note: The soft iterator invalidation definition CAN NOT be applied
// to the space optimized circular buffer.
// Copyright (c) 2003-2008 Jan Gaspar
// Use, modification, and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#include "test.hpp"
// test of the example (introduced in the documentation)
void validity_example_test() {
circular_buffer<int> cb(3);
cb.push_back(1);
cb.push_back(2);
cb.push_back(3);
circular_buffer<int>::iterator it = cb.begin();
BOOST_CHECK(*it == 1);
cb.push_back(4);
BOOST_CHECK(*it == 4);
}
void validity_insert_test() {
int array[] = { 1, 2, 3 };
// memory placement: { 1, 2, 3 }
// circular buffer: { 1, 2, 3 }
circular_buffer<int> cb(4, array, array + 3);
// it1 -> 1, it2 -> 2, it3 -> 3
circular_buffer<int>::iterator it1 = cb.begin();
circular_buffer<int>::iterator it2 = cb.begin() + 1;
circular_buffer<int>::iterator it3 = cb.begin() + 2;
cb.insert(cb.begin() + 1, 4);
// memory placement: { 1, 4, 2, 3 }
// circular buffer: { 1, 4, 2, 3 }
BOOST_CHECK(*it1 == 1);
BOOST_CHECK(*it2 == 4);
BOOST_CHECK(*it3 == 2);
BOOST_CHECK(cb[0] == 1);
BOOST_CHECK(cb[1] == 4);
BOOST_CHECK(cb[2] == 2);
BOOST_CHECK(cb[3] == 3);
// it4 -> 3
circular_buffer<int>::iterator it4 = it1 + 3;
cb.insert(cb.begin() + 1, 5);
// memory placement: { 3, 5, 4, 2 }
// circular buffer: { 5, 4, 2, 3 }
BOOST_CHECK(*it1 == 3);
BOOST_CHECK(*it2 == 5);
BOOST_CHECK(*it3 == 4);
BOOST_CHECK(*it4 == 2);
BOOST_CHECK(cb[0] == 5);
BOOST_CHECK(cb[1] == 4);
BOOST_CHECK(cb[2] == 2);
BOOST_CHECK(cb[3] == 3);
}
void validity_insert_n_test() {
// memory placement: { 1, 2, 3 }
// circular buffer: { 1, 2, 3 }
circular_buffer<int> cb(5);
cb.push_back(1);
cb.push_back(2);
cb.push_back(3);
// it1 -> 1, it2 -> 2, it3 -> 3
circular_buffer<int>::iterator it1 = cb.begin();
circular_buffer<int>::iterator it2 = cb.begin() + 1;
circular_buffer<int>::iterator it3 = cb.begin() + 2;
cb.insert(cb.begin() + 1, 2, 4);
// memory placement: { 1, 4, 4, 2, 3 }
// circular buffer: { 1, 4, 4, 2, 3 }
BOOST_CHECK(*it1 == 1);
BOOST_CHECK(*it2 == 4);
BOOST_CHECK(*it3 == 4);
BOOST_CHECK(cb[0] == 1);
BOOST_CHECK(cb[1] == 4);
BOOST_CHECK(cb[2] == 4);
BOOST_CHECK(cb[3] == 2);
BOOST_CHECK(cb[4] == 3);
// it4 -> 2, it5 -> 3
circular_buffer<int>::iterator it4 = it1 + 3;
circular_buffer<int>::iterator it5 = it1 + 4;
cb.insert(cb.begin() + 1, 2, 5);
// memory placement: { 3, 5, 4, 4, 2 } - 5 inserted only once
// circular buffer: { 5, 4, 4, 2, 3 }
BOOST_CHECK(*it1 == 3);
BOOST_CHECK(*it2 == 5);
BOOST_CHECK(*it3 == 4);
BOOST_CHECK(*it4 == 4);
BOOST_CHECK(*it5 == 2);
BOOST_CHECK(cb[0] == 5);
BOOST_CHECK(cb[1] == 4);
BOOST_CHECK(cb[2] == 4);
BOOST_CHECK(cb[3] == 2);
BOOST_CHECK(cb[4] == 3);
}
void validity_insert_range_test() {
vector<int> v1;
v1.push_back(4);
v1.push_back(5);
vector<int> v2;
v2.push_back(6);
v2.push_back(7);
// memory placement: { 1, 2, 3 }
// circular buffer: { 1, 2, 3 }
circular_buffer<int> cb1(5);
cb1.push_back(1);
cb1.push_back(2);
cb1.push_back(3);
// it11 -> 1, it12 -> 2, it13 -> 3
circular_buffer<int>::iterator it11 = cb1.begin();
circular_buffer<int>::iterator it12 = cb1.begin() + 1;
circular_buffer<int>::iterator it13 = cb1.begin() + 2;
cb1.insert(cb1.begin() + 1, v1.begin(), v1.end());
// memory placement: { 1, 4, 5, 2, 3 }
// circular buffer: { 1, 4, 5, 2, 3 }
BOOST_CHECK(*it11 == 1);
BOOST_CHECK(*it12 == 4);
BOOST_CHECK(*it13 == 5);
BOOST_CHECK(cb1[0] == 1);
BOOST_CHECK(cb1[1] == 4);
BOOST_CHECK(cb1[2] == 5);
BOOST_CHECK(cb1[3] == 2);
BOOST_CHECK(cb1[4] == 3);
// it14 -> 2, it15 -> 3
circular_buffer<int>::iterator it14 = it11 + 3;
circular_buffer<int>::iterator it15 = it11 + 4;
cb1.insert(cb1.begin() + 1, v2.begin(), v2.end());
// memory placement: { 3, 7, 4, 5, 2 } - 7 inserted only
// circular buffer: { 7, 4, 5, 2, 3 }
BOOST_CHECK(*it11 == 3);
BOOST_CHECK(*it12 == 7);
BOOST_CHECK(*it13 == 4);
BOOST_CHECK(*it14 == 5);
BOOST_CHECK(*it15 == 2);
BOOST_CHECK(cb1[0] == 7);
BOOST_CHECK(cb1[1] == 4);
BOOST_CHECK(cb1[2] == 5);
BOOST_CHECK(cb1[3] == 2);
BOOST_CHECK(cb1[4] == 3);
// memory placement: { 1, 2, 3 }
// circular buffer: { 1, 2, 3 }
circular_buffer<int> cb2(5);
cb2.push_back(1);
cb2.push_back(2);
cb2.push_back(3);
// it21 -> 1, it22 -> 2, it23 -> 3
circular_buffer<int>::iterator it21 = cb2.begin();
circular_buffer<int>::iterator it22 = cb2.begin() + 1;
circular_buffer<int>::iterator it23 = cb2.begin() + 2;
cb2.insert(cb2.begin() + 1, MyInputIterator(v1.begin()), MyInputIterator(v1.end()));
// memory placement: { 1, 4, 5, 2, 3 }
// circular buffer: { 1, 4, 5, 2, 3 }
BOOST_CHECK(*it21 == 1);
BOOST_CHECK(*it22 == 4);
BOOST_CHECK(*it23 == 5);
BOOST_CHECK(cb2[0] == 1);
BOOST_CHECK(cb2[1] == 4);
BOOST_CHECK(cb2[2] == 5);
BOOST_CHECK(cb2[3] == 2);
BOOST_CHECK(cb2[4] == 3);
// it24 -> 2, it25 -> 3
circular_buffer<int>::iterator it24 = it21 + 3;
circular_buffer<int>::iterator it25 = it21 + 4;
cb2.insert(cb2.begin() + 1, MyInputIterator(v2.begin()), MyInputIterator(v2.end()));
// memory placement: { 2, 3, 7, 4, 5 } - using input iterator inserts all items even if they are later replaced
// circular buffer: { 7, 4, 5, 2, 3 }
BOOST_CHECK(*it21 == 2);
BOOST_CHECK(*it22 == 3);
BOOST_CHECK(*it23 == 7);
BOOST_CHECK(*it24 == 4);
BOOST_CHECK(*it25 == 5);
BOOST_CHECK(cb2[0] == 7);
BOOST_CHECK(cb2[1] == 4);
BOOST_CHECK(cb2[2] == 5);
BOOST_CHECK(cb2[3] == 2);
BOOST_CHECK(cb2[4] == 3);
}
void validity_rinsert_test() {
int array[] = { 1, 2, 3 };
// memory placement: { 1, 2, 3 }
// circular buffer: { 1, 2, 3 }
circular_buffer<int> cb(4, array, array + 3);
// it1 -> 1, it2 -> 2, it3 -> 3
circular_buffer<int>::iterator it1 = cb.begin();
circular_buffer<int>::iterator it2 = cb.begin() + 1;
circular_buffer<int>::iterator it3 = cb.begin() + 2;
cb.rinsert(cb.begin() + 2, 4);
// memory placement: { 2, 4, 3, 1 }
// circular buffer: { 1, 2, 4, 3 }
BOOST_CHECK(*it1 == 2);
BOOST_CHECK(*it2 == 4);
BOOST_CHECK(*it3 == 3);
BOOST_CHECK(cb[0] == 1);
BOOST_CHECK(cb[1] == 2);
BOOST_CHECK(cb[2] == 4);
BOOST_CHECK(cb[3] == 3);
// it4 -> 1
circular_buffer<int>::iterator it4 = it1 - 1;
cb.rinsert(cb.begin() + 2, 5);
// memory placement: { 5, 4, 1, 2 }
// circular buffer: { 1, 2, 5, 4 }
BOOST_CHECK(*it1 == 5);
BOOST_CHECK(*it2 == 4);
BOOST_CHECK(*it3 == 1);
BOOST_CHECK(*it4 == 2);
BOOST_CHECK(cb[0] == 1);
BOOST_CHECK(cb[1] == 2);
BOOST_CHECK(cb[2] == 5);
BOOST_CHECK(cb[3] == 4);
}
void validity_rinsert_n_test() {
// memory placement: { 1, 2, 3 }
// circular buffer: { 1, 2, 3 }
circular_buffer<int> cb(5);
cb.push_back(1);
cb.push_back(2);
cb.push_back(3);
// it1 -> 1, it2 -> 2, it3 -> 3
circular_buffer<int>::iterator it1 = cb.begin();
circular_buffer<int>::iterator it2 = cb.begin() + 1;
circular_buffer<int>::iterator it3 = cb.begin() + 2;
cb.rinsert(cb.begin() + 2, 2, 4);
// memory placement: { 4, 4, 3, 1, 2 }
// circular buffer: { 1, 2, 4, 4, 3 }
BOOST_CHECK(*it1 == 4);
BOOST_CHECK(*it2 == 4);
BOOST_CHECK(*it3 == 3);
BOOST_CHECK(cb[0] == 1);
BOOST_CHECK(cb[1] == 2);
BOOST_CHECK(cb[2] == 4);
BOOST_CHECK(cb[3] == 4);
BOOST_CHECK(cb[4] == 3);
// it4 -> 1, it5 -> 2
circular_buffer<int>::iterator it4 = it1 - 2;
circular_buffer<int>::iterator it5 = it1 - 1;
cb.rinsert(cb.begin() + 4, 2, 5);
// memory placement: { 4, 5, 1, 2, 4 } - 5 inserted only once
// circular buffer: { 1, 2, 4, 4, 5 }
BOOST_CHECK(*it1 == 4);
BOOST_CHECK(*it2 == 5);
BOOST_CHECK(*it3 == 1);
BOOST_CHECK(*it4 == 2);
BOOST_CHECK(*it5 == 4);
BOOST_CHECK(cb[0] == 1);
BOOST_CHECK(cb[1] == 2);
BOOST_CHECK(cb[2] == 4);
BOOST_CHECK(cb[3] == 4);
BOOST_CHECK(cb[4] == 5);
}
void validity_rinsert_range_test() {
vector<int> v1;
v1.push_back(4);
v1.push_back(5);
vector<int> v2;
v2.push_back(6);
v2.push_back(7);
// memory placement: { 1, 2, 3 }
// circular buffer: { 1, 2, 3 }
circular_buffer<int> cb1(5);
cb1.push_back(1);
cb1.push_back(2);
cb1.push_back(3);
// it1 -> 1, it2 -> 2, it3 -> 3
circular_buffer<int>::iterator it11 = cb1.begin();
circular_buffer<int>::iterator it12 = cb1.begin() + 1;
circular_buffer<int>::iterator it13 = cb1.begin() + 2;
cb1.rinsert(cb1.begin() + 2, v1.begin(), v1.end());
// memory placement: { 4, 5, 3, 1, 2 }
// circular buffer: { 1, 2, 4, 5, 3 }
BOOST_CHECK(*it11 == 4);
BOOST_CHECK(*it12 == 5);
BOOST_CHECK(*it13 == 3);
BOOST_CHECK(cb1[0] == 1);
BOOST_CHECK(cb1[1] == 2);
BOOST_CHECK(cb1[2] == 4);
BOOST_CHECK(cb1[3] == 5);
BOOST_CHECK(cb1[4] == 3);
// it14 -> 1, it15 -> 2
circular_buffer<int>::iterator it14 = it11 - 2;
circular_buffer<int>::iterator it15 = it11 - 1;
cb1.rinsert(cb1.begin() + 4, v2.begin(), v2.end());
// memory placement: { 5, 6, 1, 2, 4 } - 6 inserted only
// circular buffer: { 1, 2, 4, 5, 6 }
BOOST_CHECK(*it11 == 5);
BOOST_CHECK(*it12 == 6);
BOOST_CHECK(*it13 == 1);
BOOST_CHECK(*it14 == 2);
BOOST_CHECK(*it15 == 4);
BOOST_CHECK(cb1[0] == 1);
BOOST_CHECK(cb1[1] == 2);
BOOST_CHECK(cb1[2] == 4);
BOOST_CHECK(cb1[3] == 5);
BOOST_CHECK(cb1[4] == 6);
// memory placement: { 1, 2, 3 }
// circular buffer: { 1, 2, 3 }
circular_buffer<int> cb2(5);
cb2.push_back(1);
cb2.push_back(2);
cb2.push_back(3);
// it1 -> 1, it2 -> 2, it3 -> 3
circular_buffer<int>::iterator it21 = cb2.begin();
circular_buffer<int>::iterator it22 = cb2.begin() + 1;
circular_buffer<int>::iterator it23 = cb2.begin() + 2;
cb2.rinsert(cb2.begin() + 2, MyInputIterator(v1.begin()), MyInputIterator(v1.end()));
// memory placement: { 4, 5, 3, 1, 2 }
// circular buffer: { 1, 2, 4, 5, 3 }
BOOST_CHECK(*it21 == 4);
BOOST_CHECK(*it22 == 5);
BOOST_CHECK(*it23 == 3);
BOOST_CHECK(cb2[0] == 1);
BOOST_CHECK(cb2[1] == 2);
BOOST_CHECK(cb2[2] == 4);
BOOST_CHECK(cb2[3] == 5);
BOOST_CHECK(cb2[4] == 3);
// it24 -> 1, it25 -> 2
circular_buffer<int>::iterator it24 = it21 - 2;
circular_buffer<int>::iterator it25 = it21 - 1;
cb2.rinsert(cb2.begin() + 4, MyInputIterator(v2.begin()), MyInputIterator(v2.end()));
// memory placement: { 5, 6, 1, 2, 4 }
// circular buffer: { 1, 2, 4, 5, 6 }
BOOST_CHECK(*it21 == 5);
BOOST_CHECK(*it22 == 6);
BOOST_CHECK(*it23 == 1);
BOOST_CHECK(*it24 == 2);
BOOST_CHECK(*it25 == 4);
BOOST_CHECK(cb2[0] == 1);
BOOST_CHECK(cb2[1] == 2);
BOOST_CHECK(cb2[2] == 4);
BOOST_CHECK(cb2[3] == 5);
BOOST_CHECK(cb2[4] == 6);
}
void validity_erase_test() {
// memory placement: { 4, 5, 1, 2, 3 }
// circular buffer: { 1, 2, 3, 4, 5 }
circular_buffer<int> cb(5);
cb.push_back(-1);
cb.push_back(0);
cb.push_back(1);
cb.push_back(2);
cb.push_back(3);
cb.push_back(4);
cb.push_back(5);
// it1 -> 1, it2 -> 2, it3 -> 3, it4 -> 4
circular_buffer<int>::iterator it1 = cb.begin();
circular_buffer<int>::iterator it2 = cb.begin() + 1;
circular_buffer<int>::iterator it3 = cb.begin() + 2;
circular_buffer<int>::iterator it4 = cb.begin() + 3;
cb.erase(cb.begin() + 1);
// memory placement: { 5, X, 1, 3, 4 }
// circular buffer: { 1, 3, 4, 5 }
BOOST_CHECK(*it1 == 1);
BOOST_CHECK(*it2 == 3);
BOOST_CHECK(*it3 == 4);
BOOST_CHECK(*it4 == 5);
BOOST_CHECK(cb[0] == 1);
BOOST_CHECK(cb[1] == 3);
BOOST_CHECK(cb[2] == 4);
BOOST_CHECK(cb[3] == 5);
}
void validity_erase_range_test() {
// memory placement: { 4, 5, 6, 1, 2, 3 }
// circular buffer: { 1, 2, 3, 4, 5, 6 }
circular_buffer<int> cb(6);
cb.push_back(-2);
cb.push_back(-1);
cb.push_back(0);
cb.push_back(1);
cb.push_back(2);
cb.push_back(3);
cb.push_back(4);
cb.push_back(5);
cb.push_back(6);
// it1 -> 1, it2 -> 2, it3 -> 3, it4 -> 4
circular_buffer<int>::iterator it1 = cb.begin();
circular_buffer<int>::iterator it2 = cb.begin() + 1;
circular_buffer<int>::iterator it3 = cb.begin() + 2;
circular_buffer<int>::iterator it4 = cb.begin() + 3;
cb.erase(cb.begin() + 2, cb.begin() + 4);
// memory placement: { 6, X, X, 1, 2, 5 }
// circular buffer: { 1, 2, 5, 6 }
BOOST_CHECK(*it1 == 1);
BOOST_CHECK(*it2 == 2);
BOOST_CHECK(*it3 == 5);
BOOST_CHECK(*it4 == 6);
BOOST_CHECK(cb[0] == 1);
BOOST_CHECK(cb[1] == 2);
BOOST_CHECK(cb[2] == 5);
BOOST_CHECK(cb[3] == 6);
}
void validity_rerase_test() {
// memory placement: { 4, 5, 1, 2, 3 }
// circular buffer: { 1, 2, 3, 4, 5 }
circular_buffer<int> cb(5);
cb.push_back(-1);
cb.push_back(0);
cb.push_back(1);
cb.push_back(2);
cb.push_back(3);
cb.push_back(4);
cb.push_back(5);
// it1 -> 2, it2 -> 3, it3 -> 4, it4 -> 5
circular_buffer<int>::iterator it1 = cb.begin() + 1;
circular_buffer<int>::iterator it2 = cb.begin() + 2;
circular_buffer<int>::iterator it3 = cb.begin() + 3;
circular_buffer<int>::iterator it4 = cb.begin() + 4;
cb.rerase(cb.begin() + 1);
// memory placement: { 4, 5, X, 1, 3 }
// circular buffer: { 1, 3, 4, 5 }
BOOST_CHECK(*it1 == 1);
BOOST_CHECK(*it2 == 3);
BOOST_CHECK(*it3 == 4);
BOOST_CHECK(*it4 == 5);
BOOST_CHECK(cb[0] == 1);
BOOST_CHECK(cb[1] == 3);
BOOST_CHECK(cb[2] == 4);
BOOST_CHECK(cb[3] == 5);
}
void validity_rerase_range_test() {
// memory placement: { 4, 5, 6, 1, 2, 3 }
// circular buffer: { 1, 2, 3, 4, 5, 6 }
circular_buffer<int> cb(6);
cb.push_back(-2);
cb.push_back(-1);
cb.push_back(0);
cb.push_back(1);
cb.push_back(2);
cb.push_back(3);
cb.push_back(4);
cb.push_back(5);
cb.push_back(6);
// it1 -> 3, it2 -> 4, it3 -> 5, it4 -> 6
circular_buffer<int>::iterator it1 = cb.begin() + 2;
circular_buffer<int>::iterator it2 = cb.begin() + 3;
circular_buffer<int>::iterator it3 = cb.begin() + 4;
circular_buffer<int>::iterator it4 = cb.begin() + 5;
cb.rerase(cb.begin() + 2, cb.begin() + 4);
// memory placement: { 2, 5, 6, X, X, 1 }
// circular buffer: { 1, 2, 5, 6 }
BOOST_CHECK(*it1 == 1);
BOOST_CHECK(*it2 == 2);
BOOST_CHECK(*it3 == 5);
BOOST_CHECK(*it4 == 6);
BOOST_CHECK(cb[0] == 1);
BOOST_CHECK(cb[1] == 2);
BOOST_CHECK(cb[2] == 5);
BOOST_CHECK(cb[3] == 6);
}
void validity_linearize_test() {
// memory placement: { 3, 1, 2 }
// circular buffer: { 1, 2, 3 }
circular_buffer<int> cb(3);
cb.push_back(0);
cb.push_back(1);
cb.push_back(2);
cb.push_back(3);
// it1 -> 1, it2 -> 2, it3 -> 3
circular_buffer<int>::iterator it1 = cb.begin();
circular_buffer<int>::iterator it2 = cb.begin() + 1;
circular_buffer<int>::iterator it3 = cb.begin() + 2;
cb.linearize();
// memory placement: { 1, 2, 3 }
// circular buffer: { 1, 2, 3 }
BOOST_CHECK(*it1 == 2);
BOOST_CHECK(*it2 == 3);
BOOST_CHECK(*it3 == 1);
BOOST_CHECK(cb[0] == 1);
BOOST_CHECK(cb[1] == 2);
BOOST_CHECK(cb[2] == 3);
}
void validity_swap_test() {
// memory placement: { 3, 1, 2 }
// circular buffer: { 1, 2, 3 }
circular_buffer<int> cb1(3);
cb1.push_back(0);
cb1.push_back(1);
cb1.push_back(2);
cb1.push_back(3);
// it11 -> 1, it12 -> 2, it13 -> 3
circular_buffer<int>::iterator it11 = cb1.begin();
circular_buffer<int>::iterator it12 = cb1.begin() + 1;
circular_buffer<int>::iterator it13 = cb1.begin() + 2;
// memory placement: { 4, 5, 6 }
// circular buffer: { 4, 5, 6 }
circular_buffer<int> cb2(5);
cb2.push_back(4);
cb2.push_back(5);
cb2.push_back(6);
// it21 -> 4, it22 -> 5, it23 -> 6
circular_buffer<int>::iterator it21 = cb2.begin();
circular_buffer<int>::iterator it22 = cb2.begin() + 1;
circular_buffer<int>::iterator it23 = cb2.begin() + 2;
cb1.swap(cb2);
// Although iterators refer to the original elements,
// their interal state is inconsistent and no other operation
// (except dereferencing) can be invoked on them any more.
BOOST_CHECK(*it11 == 1);
BOOST_CHECK(*it12 == 2);
BOOST_CHECK(*it13 == 3);
BOOST_CHECK(*it21 == 4);
BOOST_CHECK(*it22 == 5);
BOOST_CHECK(*it23 == 6);
BOOST_CHECK(cb1[0] == 4);
BOOST_CHECK(cb1[1] == 5);
BOOST_CHECK(cb1[2] == 6);
BOOST_CHECK(cb2[0] == 1);
BOOST_CHECK(cb2[1] == 2);
BOOST_CHECK(cb2[2] == 3);
}
void validity_push_back_test() {
// memory placement: { 3, 1, 2 }
// circular buffer: { 1, 2, 3 }
circular_buffer<int> cb(3);
cb.push_back(0);
cb.push_back(1);
cb.push_back(2);
cb.push_back(3);
// it1 -> 1, it2 -> 2, it3 -> 3
circular_buffer<int>::iterator it1 = cb.begin();
circular_buffer<int>::iterator it2 = cb.begin() + 1;
circular_buffer<int>::iterator it3 = cb.begin() + 2;
cb.push_back(4);
// memory placement: { 3, 4, 2 }
// circular buffer: { 2, 3, 4 }
BOOST_CHECK(*it1 == 4);
BOOST_CHECK(*it2 == 2);
BOOST_CHECK(*it3 == 3);
BOOST_CHECK(cb[0] == 2);
BOOST_CHECK(cb[1] == 3);
BOOST_CHECK(cb[2] == 4);
}
void validity_push_front_test() {
// memory placement: { 3, 1, 2 }
// circular buffer: { 1, 2, 3 }
circular_buffer<int> cb(3);
cb.push_back(0);
cb.push_back(1);
cb.push_back(2);
cb.push_back(3);
// it1 -> 1, it2 -> 2, it3 -> 3
circular_buffer<int>::iterator it1 = cb.begin();
circular_buffer<int>::iterator it2 = cb.begin() + 1;
circular_buffer<int>::iterator it3 = cb.begin() + 2;
cb.push_front(4);
// memory placement: { 4, 1, 2 }
// circular buffer: { 4, 1, 2 }
BOOST_CHECK(*it1 == 1);
BOOST_CHECK(*it2 == 2);
BOOST_CHECK(*it3 == 4);
BOOST_CHECK(cb[0] == 4);
BOOST_CHECK(cb[1] == 1);
BOOST_CHECK(cb[2] == 2);
}
void validity_pop_back_test() {
// memory placement: { 3, 1, 2 }
// circular buffer: { 1, 2, 3 }
circular_buffer<int> cb(3);
cb.push_back(0);
cb.push_back(1);
cb.push_back(2);
cb.push_back(3);
// it1 -> 1, it2 -> 2
circular_buffer<int>::iterator it1 = cb.begin();
circular_buffer<int>::iterator it2 = cb.begin() + 1;
cb.pop_back();
// memory placement: { X, 1, 2 }
// circular buffer: { 1, 2 }
BOOST_CHECK(*it1 == 1);
BOOST_CHECK(*it2 == 2);
BOOST_CHECK(cb[0] == 1);
BOOST_CHECK(cb[1] == 2);
}
void validity_pop_front_test() {
// memory placement: { 3, 1, 2 }
// circular buffer: { 1, 2, 3 }
circular_buffer<int> cb(3);
cb.push_back(0);
cb.push_back(1);
cb.push_back(2);
cb.push_back(3);
// it1 -> 2, it2 -> 3
circular_buffer<int>::iterator it1 = cb.begin() + 1;
circular_buffer<int>::iterator it2 = cb.begin() + 2;
cb.pop_front();
// memory placement: { 3, X, 2 }
// circular buffer: { 2, 3 }
BOOST_CHECK(*it1 == 2);
BOOST_CHECK(*it2 == 3);
BOOST_CHECK(cb[0] == 2);
BOOST_CHECK(cb[1] == 3);
}
// test main
test_suite* init_unit_test_suite(int /*argc*/, char* /*argv*/[]) {
test_suite* tests = BOOST_TEST_SUITE("Unit tests for the iterator of the circular_buffer.");
tests->add(BOOST_TEST_CASE(&validity_example_test));
tests->add(BOOST_TEST_CASE(&validity_insert_test));
tests->add(BOOST_TEST_CASE(&validity_insert_n_test));
tests->add(BOOST_TEST_CASE(&validity_insert_range_test));
tests->add(BOOST_TEST_CASE(&validity_rinsert_test));
tests->add(BOOST_TEST_CASE(&validity_rinsert_n_test));
tests->add(BOOST_TEST_CASE(&validity_rinsert_range_test));
tests->add(BOOST_TEST_CASE(&validity_erase_test));
tests->add(BOOST_TEST_CASE(&validity_erase_range_test));
tests->add(BOOST_TEST_CASE(&validity_rerase_test));
tests->add(BOOST_TEST_CASE(&validity_rerase_range_test));
tests->add(BOOST_TEST_CASE(&validity_linearize_test));
tests->add(BOOST_TEST_CASE(&validity_swap_test));
tests->add(BOOST_TEST_CASE(&validity_push_back_test));
tests->add(BOOST_TEST_CASE(&validity_push_front_test));
tests->add(BOOST_TEST_CASE(&validity_pop_back_test));
tests->add(BOOST_TEST_CASE(&validity_pop_front_test));
return tests;
}
@@ -0,0 +1,196 @@
// Test of the space optimized adaptor of the circular buffer.
// Copyright (c) 2003-2008 Jan Gaspar
// Use, modification, and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#include "test.hpp"
#define CB_CONTAINER circular_buffer_space_optimized
#include "common.ipp"
typedef circular_buffer_space_optimized<MyInteger> cb_space_optimized;
typedef cb_space_optimized::capacity_type capacity_ctrl;
// min_capacity test (it is useful to use a debug tool)
void min_capacity_test() {
vector<int> v;
v.push_back(1);
v.push_back(2);
v.push_back(3);
v.push_back(4);
v.push_back(5);
cb_space_optimized cb1(capacity_ctrl(10, 10));
cb_space_optimized cb2(capacity_ctrl(10, 5), 1);
cb_space_optimized cb3(capacity_ctrl(20, 10), v.begin(), v.end());
BOOST_CHECK(cb1.size() == 0);
BOOST_CHECK(cb1.capacity().capacity() == 10);
BOOST_CHECK(cb1.capacity().min_capacity() == 10);
BOOST_CHECK(cb2[0] == 1);
BOOST_CHECK(cb2.size() == 10);
BOOST_CHECK(cb2.capacity() == 10);
BOOST_CHECK(cb2.capacity().min_capacity() == 5);
BOOST_CHECK(cb3[0] == 1);
BOOST_CHECK(cb3.size() == 5);
BOOST_CHECK(cb3.capacity() == 20);
BOOST_CHECK(cb3.capacity().min_capacity() == 10);
BOOST_CHECK(cb1.capacity().min_capacity() <= cb1.internal_capacity());
BOOST_CHECK(cb2.capacity().min_capacity() <= cb2.internal_capacity());
BOOST_CHECK(cb3.capacity().min_capacity() <= cb3.internal_capacity());
cb2.erase(cb2.begin() + 2, cb2.end());
BOOST_CHECK(cb2.size() == 2);
BOOST_CHECK(cb2.capacity().min_capacity() <= cb2.internal_capacity());
cb2.clear();
cb3.clear();
BOOST_CHECK(cb2.empty());
BOOST_CHECK(cb3.empty());
BOOST_CHECK(cb2.capacity().min_capacity() <= cb2.internal_capacity());
BOOST_CHECK(cb3.capacity().min_capacity() <= cb3.internal_capacity());
}
void capacity_control_test() {
circular_buffer_space_optimized<int>::capacity_type c1 = 10;
circular_buffer_space_optimized<int>::capacity_type c2 =
circular_buffer_space_optimized<int>::capacity_type(20, 5);
circular_buffer_space_optimized<int>::capacity_type c3 = c2;
BOOST_CHECK(c1.capacity() == 10);
BOOST_CHECK(c1.min_capacity() == 0);
BOOST_CHECK(c2.capacity() == 20);
BOOST_CHECK(c2.min_capacity() == 5);
BOOST_CHECK(c3.capacity() == 20);
BOOST_CHECK(c3.min_capacity() == 5);
c1 = c2;
BOOST_CHECK(c1.capacity() == 20);
BOOST_CHECK(c1.min_capacity() == 5);
}
void specific_constructors_test() {
cb_space_optimized cb1;
BOOST_CHECK(cb1.capacity() == 0);
BOOST_CHECK(cb1.capacity().min_capacity() == 0);
BOOST_CHECK(cb1.internal_capacity() == 0);
BOOST_CHECK(cb1.size() == 0);
cb1.push_back(1);
cb1.push_back(2);
cb1.push_back(3);
BOOST_CHECK(cb1.size() == 0);
BOOST_CHECK(cb1.capacity() == 0);
vector<int> v;
v.push_back(1);
v.push_back(2);
v.push_back(3);
cb_space_optimized cb2(v.begin(), v.end());
BOOST_CHECK(cb2.capacity() == 3);
BOOST_CHECK(cb2.capacity().min_capacity() == 0);
BOOST_CHECK(cb2.size() == 3);
}
void shrink_to_fit_test() {
cb_space_optimized cb(1000);
cb.push_back(1);
cb.push_back(2);
cb.push_back(3);
BOOST_CHECK(cb.size() == 3);
BOOST_CHECK(cb.capacity() == 1000);
size_t internal_capacity = cb.internal_capacity();
cb_space_optimized(cb).swap(cb);
BOOST_CHECK(cb.size() == 3);
BOOST_CHECK(cb.capacity() == 1000);
BOOST_CHECK(internal_capacity >= cb.internal_capacity());
}
void iterator_invalidation_test() {
#if BOOST_CB_ENABLE_DEBUG
cb_space_optimized cb1(10, 1);
cb1.push_back(2);
cb1.push_back(3);
cb1.push_back(4);
cb_space_optimized::iterator it1 = cb1.end();
cb_space_optimized::const_iterator it2 = cb1.begin();
cb_space_optimized::iterator it3 = cb1.begin() + 6;
cb1.set_capacity(10);
BOOST_CHECK(it1.is_valid(&cb1));
BOOST_CHECK(!it2.is_valid(&cb1));
BOOST_CHECK(!it3.is_valid(&cb1));
it1 = cb1.end();
it2 = cb1.begin();
it3 = cb1.begin() + 6;
cb1.rset_capacity(10);
BOOST_CHECK(it1.is_valid(&cb1));
BOOST_CHECK(!it2.is_valid(&cb1));
BOOST_CHECK(!it3.is_valid(&cb1));
it1 = cb1.end();
it2 = cb1.begin();
it3 = cb1.begin() + 6;
cb1.resize(10);
BOOST_CHECK(it1.is_valid(&cb1));
BOOST_CHECK(!it2.is_valid(&cb1));
BOOST_CHECK(!it3.is_valid(&cb1));
it1 = cb1.end();
it2 = cb1.begin();
it3 = cb1.begin() + 6;
cb1.rresize(10);
BOOST_CHECK(it1.is_valid(&cb1));
BOOST_CHECK(!it2.is_valid(&cb1));
BOOST_CHECK(!it3.is_valid(&cb1));
{
cb_space_optimized cb2(10, 1);
cb2.push_back(2);
cb2.push_back(3);
cb2.push_back(4);
it1 = cb2.end();
it2 = cb2.begin();
it3 = cb2.begin() + 6;
}
BOOST_CHECK(!it1.is_valid(&cb1));
BOOST_CHECK(!it2.is_valid(&cb1));
BOOST_CHECK(!it3.is_valid(&cb1));
#endif // #if BOOST_CB_ENABLE_DEBUG
}
// test main
test_suite* init_unit_test_suite(int /*argc*/, char* /*argv*/[]) {
test_suite* tests = BOOST_TEST_SUITE("Unit tests for the circular_buffer_space_optimized.");
add_common_tests(tests);
tests->add(BOOST_TEST_CASE(&min_capacity_test));
tests->add(BOOST_TEST_CASE(&capacity_control_test));
tests->add(BOOST_TEST_CASE(&specific_constructors_test));
tests->add(BOOST_TEST_CASE(&shrink_to_fit_test));
tests->add(BOOST_TEST_CASE(&iterator_invalidation_test));
return tests;
}
+146
View File
@@ -0,0 +1,146 @@
// Header file for the test of the circular buffer library.
// Copyright (c) 2003-2008 Jan Gaspar
// Use, modification, and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#if !defined(BOOST_CIRCULAR_BUFFER_TEST_HPP)
#define BOOST_CIRCULAR_BUFFER_TEST_HPP
#if defined(_MSC_VER) && _MSC_VER >= 1200
#pragma once
#endif
#define BOOST_CB_TEST
#include <boost/circular_buffer.hpp>
#include <boost/test/included/unit_test.hpp>
#include <boost/iterator.hpp>
#include <iterator>
#include <numeric>
#include <vector>
#if !defined(BOOST_NO_EXCEPTIONS)
#include <exception>
#endif
// Integer (substitute for int) - more appropriate for testing
class MyInteger {
private:
int* m_pValue;
static int ms_exception_trigger;
void check_exception() {
if (ms_exception_trigger > 0) {
if (--ms_exception_trigger == 0) {
delete m_pValue;
m_pValue = 0;
#if !defined(BOOST_NO_EXCEPTIONS)
throw std::exception();
#endif
}
}
}
public:
MyInteger() : m_pValue(new int(0)) { check_exception(); }
MyInteger(int i) : m_pValue(new int(i)) { check_exception(); }
MyInteger(const MyInteger& src) : m_pValue(new int(src)) { check_exception(); }
~MyInteger() { delete m_pValue; }
MyInteger& operator = (const MyInteger& src) {
if (this == &src)
return *this;
check_exception();
delete m_pValue;
m_pValue = new int(src);
return *this;
}
operator int () const { return *m_pValue; }
static void set_exception_trigger(int n) { ms_exception_trigger = n; }
};
// default constructible class
class MyDefaultConstructible
{
public:
MyDefaultConstructible() : m_n(1) {}
MyDefaultConstructible(int n) : m_n(n) {}
int m_n;
};
// class counting instances of self
class InstanceCounter {
public:
InstanceCounter() { increment(); }
InstanceCounter(const InstanceCounter& y) { y.increment(); }
~InstanceCounter() { decrement(); }
static int count() { return ms_count; }
private:
void increment() const { ++ms_count; }
void decrement() const { --ms_count; }
static int ms_count;
};
// dummy class suitable for iterator referencing test
class Dummy {
public:
enum DummyEnum {
eVar,
eFnc,
eConst,
eVirtual
};
Dummy() : m_n(eVar) {}
DummyEnum fnc() { return eFnc; }
DummyEnum const_fnc() const { return eConst; }
virtual DummyEnum virtual_fnc() { return eVirtual; }
DummyEnum m_n;
};
// simulator of an input iterator
struct MyInputIterator
: boost::iterator<std::input_iterator_tag, int, ptrdiff_t, int*, int&> {
typedef std::vector<int>::iterator vector_iterator;
typedef int value_type;
typedef int* pointer;
typedef int& reference;
typedef size_t size_type;
typedef ptrdiff_t difference_type;
explicit MyInputIterator(const vector_iterator& it) : m_it(it) {}
MyInputIterator& operator = (const MyInputIterator& it) {
if (this == &it)
return *this;
m_it = it.m_it;
return *this;
}
reference operator * () const { return *m_it; }
pointer operator -> () const { return &(operator*()); }
MyInputIterator& operator ++ () {
++m_it;
return *this;
}
MyInputIterator operator ++ (int) {
MyInputIterator tmp = *this;
++*this;
return tmp;
}
bool operator == (const MyInputIterator& it) const { return m_it == it.m_it; }
bool operator != (const MyInputIterator& it) const { return m_it != it.m_it; }
private:
vector_iterator m_it;
};
#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_MSVC_STD_ITERATOR)
inline std::input_iterator_tag iterator_category(const MyInputIterator&) {
return std::input_iterator_tag();
}
inline int* value_type(const MyInputIterator&) { return 0; }
inline ptrdiff_t* distance_type(const MyInputIterator&) { return 0; }
#endif // #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) && !defined(BOOST_MSVC_STD_ITERATOR)
using boost::unit_test::test_suite;
using namespace boost;
using namespace std;
#endif // #if !defined(BOOST_CIRCULAR_BUFFER_TEST_HPP)
+220
View File
@@ -0,0 +1,220 @@
#
# *** DO NOT EDIT THIS FILE BY HAND ***
# This file was automatically generated on Mon Dec 12 19:37:08 2016
# by libs/config/tools/generate.cpp
# Copyright John Maddock.
# Use, modification and distribution are subject to the
# Boost Software License, Version 1.0. (See accompanying file
# LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
import modules ;
import path ;
import testing ;
rule run-simple ( requirements * : target-name )
{
obj $(target-name)_obj : test_case.cpp : $(requirements) ;
explicit $(target-name)_obj ;
unit-test $(target-name) : $(target-name)_obj : $(requirements) ;
explicit $(target-name) ;
}
run-simple <define>TEST_BOOST_HAS_TWO_ARG_USE_FACET : two_arg_use_facet ;
run-simple <define>TEST_BOOST_HAS_BETHREADS : bethreads ;
run-simple <define>TEST_BOOST_HAS_CLOCK_GETTIME : clock_gettime ;
run-simple <define>TEST_BOOST_HAS_DIRENT_H : dirent_h ;
run-simple <define>TEST_BOOST_HAS_EXPM1 : expm1 ;
run-simple <define>TEST_BOOST_HAS_FLOAT128 : float128 ;
run-simple <define>TEST_BOOST_HAS_FTIME : ftime ;
run-simple <define>TEST_BOOST_HAS_GETSYSTEMTIMEASFILETIME : getsystemtimeasfiletime ;
run-simple <define>TEST_BOOST_HAS_GETTIMEOFDAY : gettimeofday ;
run-simple <define>TEST_BOOST_HAS_HASH : hash ;
run-simple <define>TEST_BOOST_HAS_INT128 : int128 ;
run-simple <define>TEST_BOOST_HAS_LOG1P : log1p ;
run-simple <define>TEST_BOOST_HAS_LONG_LONG : long_long ;
run-simple <define>TEST_BOOST_HAS_MACRO_USE_FACET : macro_use_facet ;
run-simple <define>TEST_BOOST_HAS_MS_INT64 : ms_int64 ;
run-simple <define>TEST_BOOST_HAS_NANOSLEEP : nanosleep ;
run-simple <define>TEST_BOOST_HAS_NL_TYPES_H : nl_types_h ;
run-simple <define>TEST_BOOST_HAS_NRVO : nrvo ;
run-simple <define>TEST_BOOST_HAS_PARTIAL_STD_ALLOCATOR : partial_std_allocator ;
run-simple <define>TEST_BOOST_HAS_PTHREAD_DELAY_NP : pthread_delay_np ;
run-simple <define>TEST_BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE : pthread_mutexattr_settype ;
run-simple <define>TEST_BOOST_HAS_PTHREAD_YIELD : pthread_yield ;
run-simple <define>TEST_BOOST_HAS_PTHREADS : pthreads ;
run-simple <define>TEST_BOOST_HAS_RVALUE_REFS : rvalue_refs ;
run-simple <define>TEST_BOOST_HAS_SCHED_YIELD : sched_yield ;
run-simple <define>TEST_BOOST_HAS_SGI_TYPE_TRAITS : sgi_type_traits ;
run-simple <define>TEST_BOOST_HAS_SIGACTION : sigaction ;
run-simple <define>TEST_BOOST_HAS_SLIST : slist ;
run-simple <define>TEST_BOOST_HAS_STATIC_ASSERT : static_assert ;
run-simple <define>TEST_BOOST_HAS_STDINT_H : stdint_h ;
run-simple <define>TEST_BOOST_HAS_STLP_USE_FACET : stlp_use_facet ;
run-simple <define>TEST_BOOST_HAS_TR1_ARRAY : tr1_array ;
run-simple <define>TEST_BOOST_HAS_TR1_BIND : tr1_bind ;
run-simple <define>TEST_BOOST_HAS_TR1_COMPLEX_OVERLOADS : tr1_complex_overloads ;
run-simple <define>TEST_BOOST_HAS_TR1_COMPLEX_INVERSE_TRIG : tr1_complex_inverse_trig ;
run-simple <define>TEST_BOOST_HAS_TR1_FUNCTION : tr1_function ;
run-simple <define>TEST_BOOST_HAS_TR1_HASH : tr1_hash ;
run-simple <define>TEST_BOOST_HAS_TR1_MEM_FN : tr1_mem_fn ;
run-simple <define>TEST_BOOST_HAS_TR1_RANDOM : tr1_random ;
run-simple <define>TEST_BOOST_HAS_TR1_REFERENCE_WRAPPER : tr1_reference_wrapper ;
run-simple <define>TEST_BOOST_HAS_TR1_REGEX : tr1_regex ;
run-simple <define>TEST_BOOST_HAS_TR1_RESULT_OF : tr1_result_of ;
run-simple <define>TEST_BOOST_HAS_TR1_SHARED_PTR : tr1_shared_ptr ;
run-simple <define>TEST_BOOST_HAS_TR1_TUPLE : tr1_tuple ;
run-simple <define>TEST_BOOST_HAS_TR1_TYPE_TRAITS : tr1_type_traits ;
run-simple <define>TEST_BOOST_HAS_TR1_UNORDERED_MAP : tr1_unordered_map ;
run-simple <define>TEST_BOOST_HAS_TR1_UNORDERED_SET : tr1_unordered_set ;
run-simple <define>TEST_BOOST_HAS_TR1_UTILITY : tr1_utility ;
run-simple <define>TEST_BOOST_HAS_UNISTD_H : unistd_h ;
run-simple <define>TEST_BOOST_HAS_VARIADIC_TMPL : variadic_tmpl ;
run-simple <define>TEST_BOOST_MSVC6_MEMBER_TEMPLATES : boost_msvc6_member_templates ;
run-simple <define>TEST_BOOST_MSVC_STD_ITERATOR : boost_msvc_std_iterator ;
run-simple <define>TEST_BOOST_HAS_WINTHREADS : winthreads ;
run-simple <define>TEST_BOOST_NO_ADL_BARRIER : adl_barrier ;
run-simple <define>TEST_BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP : argument_dependent_lookup ;
run-simple <define>TEST_BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS : array_type_specializations ;
run-simple <define>TEST_BOOST_NO_CXX11_AUTO_DECLARATIONS : cxx11_auto_declarations ;
run-simple <define>TEST_BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS : cxx11_auto_multideclarations ;
run-simple <define>TEST_BOOST_NO_AUTO_PTR : auto_ptr ;
run-simple <define>TEST_BOOST_BCB_PARTIAL_SPECIALIZATION_BUG : boost_bcb_partial_specialization_bug ;
run-simple <define>TEST_BOOST_NO_CXX11_CHAR16_T : cxx11_char16_t ;
run-simple <define>TEST_BOOST_NO_CXX11_CHAR32_T : cxx11_char32_t ;
run-simple <define>TEST_BOOST_NO_COMPLETE_VALUE_INITIALIZATION : complete_value_initialization ;
run-simple <define>TEST_BOOST_NO_CXX11_CONSTEXPR : cxx11_constexpr ;
run-simple <define>TEST_BOOST_NO_CTYPE_FUNCTIONS : ctype_functions ;
run-simple <define>TEST_BOOST_NO_CV_SPECIALIZATIONS : cv_specializations ;
run-simple <define>TEST_BOOST_NO_CV_VOID_SPECIALIZATIONS : cv_void_specializations ;
run-simple <define>TEST_BOOST_NO_CWCHAR : cwchar ;
run-simple <define>TEST_BOOST_NO_CWCTYPE : cwctype ;
run-simple <define>TEST_BOOST_NO_CXX11_ADDRESSOF : cxx11_addressof ;
run-simple <define>TEST_BOOST_NO_CXX11_ALIGNAS : cxx11_alignas ;
run-simple <define>TEST_BOOST_NO_CXX11_ALLOCATOR : cxx11_allocator ;
run-simple <define>TEST_BOOST_NO_CXX11_ATOMIC_SMART_PTR : cxx11_atomic_smart_ptr ;
run-simple <define>TEST_BOOST_NO_CXX11_FINAL : cxx11_final ;
run-simple <define>TEST_BOOST_NO_CXX11_HDR_ARRAY : cxx11_hdr_array ;
run-simple <define>TEST_BOOST_NO_CXX11_HDR_ATOMIC : cxx11_hdr_atomic ;
run-simple <define>TEST_BOOST_NO_CXX11_HDR_CHRONO : cxx11_hdr_chrono ;
run-simple <define>TEST_BOOST_NO_CXX11_HDR_CODECVT : cxx11_hdr_codecvt ;
run-simple <define>TEST_BOOST_NO_CXX11_HDR_CONDITION_VARIABLE : cxx11_hdr_condition_variable ;
run-simple <define>TEST_BOOST_NO_CXX11_HDR_FORWARD_LIST : cxx11_hdr_forward_list ;
run-simple <define>TEST_BOOST_NO_CXX11_HDR_FUTURE : cxx11_hdr_future ;
run-simple <define>TEST_BOOST_NO_CXX11_HDR_INITIALIZER_LIST : cxx11_hdr_initializer_list ;
run-simple <define>TEST_BOOST_NO_CXX11_HDR_MUTEX : cxx11_hdr_mutex ;
run-simple <define>TEST_BOOST_NO_CXX11_HDR_RANDOM : cxx11_hdr_random ;
run-simple <define>TEST_BOOST_NO_CXX11_HDR_RATIO : cxx11_hdr_ratio ;
run-simple <define>TEST_BOOST_NO_CXX11_HDR_REGEX : cxx11_hdr_regex ;
run-simple <define>TEST_BOOST_NO_CXX11_HDR_SYSTEM_ERROR : cxx11_hdr_system_error ;
run-simple <define>TEST_BOOST_NO_CXX11_HDR_THREAD : cxx11_hdr_thread ;
run-simple <define>TEST_BOOST_NO_CXX11_HDR_TUPLE : cxx11_hdr_tuple ;
run-simple <define>TEST_BOOST_NO_CXX11_HDR_TYPE_TRAITS : cxx11_hdr_type_traits ;
run-simple <define>TEST_BOOST_NO_CXX11_HDR_TYPEINDEX : cxx11_hdr_typeindex ;
run-simple <define>TEST_BOOST_NO_CXX11_HDR_UNORDERED_MAP : cxx11_hdr_unordered_map ;
run-simple <define>TEST_BOOST_NO_CXX11_HDR_UNORDERED_SET : cxx11_hdr_unordered_set ;
run-simple <define>TEST_BOOST_NO_CXX11_INLINE_NAMESPACES : cxx11_inline_namespaces ;
run-simple <define>TEST_BOOST_NO_CXX11_NON_PUBLIC_DEFAULTED_FUNCTIONS : cxx11_non_public_defaulted_functions ;
run-simple <define>TEST_BOOST_NO_CXX11_NUMERIC_LIMITS : cxx11_numeric_limits ;
run-simple <define>TEST_BOOST_NO_CXX11_REF_QUALIFIERS : cxx11_ref_qualifiers ;
run-simple <define>TEST_BOOST_NO_CXX11_SMART_PTR : cxx11_smart_ptr ;
run-simple <define>TEST_BOOST_NO_CXX11_STD_ALIGN : cxx11_std_align ;
run-simple <define>TEST_BOOST_NO_CXX11_THREAD_LOCAL : cxx11_thread_local ;
run-simple <define>TEST_BOOST_NO_CXX11_TRAILING_RESULT_TYPES : cxx11_trailing_result_types ;
run-simple <define>TEST_BOOST_NO_CXX11_USER_DEFINED_LITERALS : cxx11_user_defined_literals ;
run-simple <define>TEST_BOOST_NO_CXX14_BINARY_LITERALS : cxx14_binary_literals ;
run-simple <define>TEST_BOOST_NO_CXX14_CONSTEXPR : cxx14_constexpr ;
run-simple <define>TEST_BOOST_NO_CXX14_DECLTYPE_AUTO : cxx14_decltype_auto ;
run-simple <define>TEST_BOOST_NO_CXX14_DIGIT_SEPARATORS : cxx14_digit_separators ;
run-simple <define>TEST_BOOST_NO_CXX14_GENERIC_LAMBDAS : cxx14_generic_lambdas ;
run-simple <define>TEST_BOOST_NO_CXX14_HDR_SHARED_MUTEX : cxx14_hdr_shared_mutex ;
run-simple <define>TEST_BOOST_NO_CXX14_INITIALIZED_LAMBDA_CAPTURES : cxx14_initialized_lambda_captures ;
run-simple <define>TEST_BOOST_NO_CXX14_AGGREGATE_NSDMI : cxx14_aggregate_nsdmi ;
run-simple <define>TEST_BOOST_NO_CXX14_RETURN_TYPE_DEDUCTION : cxx14_return_type_deduction ;
run-simple <define>TEST_BOOST_NO_CXX14_STD_EXCHANGE : cxx14_std_exchange ;
run-simple <define>TEST_BOOST_NO_CXX14_VARIABLE_TEMPLATES : cxx14_variable_templates ;
run-simple <define>TEST_BOOST_NO_CXX17_STD_APPLY : cxx17_std_apply ;
run-simple <define>TEST_BOOST_NO_CXX17_STD_INVOKE : cxx17_std_invoke ;
run-simple <define>TEST_BOOST_NO_CXX11_HDR_FUNCTIONAL : cxx11_hdr_functional ;
run-simple <define>TEST_BOOST_NO_CXX11_DECLTYPE : cxx11_decltype ;
run-simple <define>TEST_BOOST_NO_CXX11_DECLTYPE_N3276 : cxx11_decltype_n3276 ;
run-simple <define>TEST_BOOST_DEDUCED_TYPENAME : boost_deduced_typename ;
run-simple <define>TEST_BOOST_NO_CXX11_DEFAULTED_FUNCTIONS : cxx11_defaulted_functions ;
run-simple <define>TEST_BOOST_NO_CXX11_DELETED_FUNCTIONS : cxx11_deleted_functions ;
run-simple <define>TEST_BOOST_NO_DEPENDENT_NESTED_DERIVATIONS : dependent_nested_derivations ;
run-simple <define>TEST_BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS : dependent_types_in_template_value_parameters ;
run-simple <define>TEST_BOOST_NO_EXCEPTION_STD_NAMESPACE : exception_std_namespace ;
run-simple <define>TEST_BOOST_NO_EXCEPTIONS : exceptions ;
run-simple <define>TEST_BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS : explicit_function_template_arguments ;
run-simple <define>TEST_BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS : cxx11_explicit_conversion_operators ;
run-simple <define>TEST_BOOST_NO_CXX11_EXTERN_TEMPLATE : cxx11_extern_template ;
run-simple <define>TEST_BOOST_NO_FENV_H : fenv_h ;
run-simple <define>TEST_BOOST_NO_CXX11_FIXED_LENGTH_VARIADIC_TEMPLATE_EXPANSION_PACKS : cxx11_fixed_length_variadic_template_expansion_packs ;
run-simple <define>TEST_BOOST_NO_FUNCTION_TEMPLATE_ORDERING : function_template_ordering ;
run-simple <define>TEST_BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS : cxx11_function_template_default_args ;
run-simple <define>TEST_BOOST_NO_FUNCTION_TYPE_SPECIALIZATIONS : function_type_specializations ;
run-simple <define>TEST_BOOST_NO_MS_INT64_NUMERIC_LIMITS : ms_int64_numeric_limits ;
run-simple <define>TEST_BOOST_NO_INCLASS_MEMBER_INITIALIZATION : inclass_member_initialization ;
run-simple <define>TEST_BOOST_NO_INTEGRAL_INT64_T : integral_int64_t ;
run-simple <define>TEST_BOOST_NO_IOSFWD : iosfwd ;
run-simple <define>TEST_BOOST_NO_IOSTREAM : iostream ;
run-simple <define>TEST_BOOST_NO_IS_ABSTRACT : is_abstract ;
run-simple <define>TEST_BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS : templated_iterator_constructors ;
run-simple <define>TEST_BOOST_NO_CXX11_LAMBDAS : cxx11_lambdas ;
run-simple <define>TEST_BOOST_NO_LIMITS : limits ;
run-simple <define>TEST_BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS : limits_compile_time_constants ;
run-simple <define>TEST_BOOST_NO_LONG_LONG_NUMERIC_LIMITS : long_long_numeric_limits ;
run-simple <define>TEST_BOOST_NO_LONG_LONG : long_long ;
run-simple <define>TEST_BOOST_NO_MEMBER_FUNCTION_SPECIALIZATIONS : member_function_specializations ;
run-simple <define>TEST_BOOST_NO_MEMBER_TEMPLATE_KEYWORD : member_template_keyword ;
run-simple <define>TEST_BOOST_NO_POINTER_TO_MEMBER_TEMPLATE_PARAMETERS : pointer_to_member_template_parameters ;
run-simple <define>TEST_BOOST_NO_MEMBER_TEMPLATE_FRIENDS : member_template_friends ;
run-simple <define>TEST_BOOST_NO_MEMBER_TEMPLATES : member_templates ;
run-simple <define>TEST_BOOST_NO_NESTED_FRIENDSHIP : nested_friendship ;
run-simple <define>TEST_BOOST_NO_CXX11_NOEXCEPT : cxx11_noexcept ;
run-simple <define>TEST_BOOST_NO_CXX11_NULLPTR : cxx11_nullptr ;
run-simple <define>TEST_BOOST_NO_OPERATORS_IN_NAMESPACE : operators_in_namespace ;
run-simple <define>TEST_BOOST_NO_PARTIAL_SPECIALIZATION_IMPLICIT_DEFAULT_ARGS : partial_specialization_implicit_default_args ;
run-simple <define>TEST_BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION : template_partial_specialization ;
run-simple <define>TEST_BOOST_NO_PRIVATE_IN_AGGREGATE : private_in_aggregate ;
run-simple <define>TEST_BOOST_NO_POINTER_TO_MEMBER_CONST : pointer_to_member_const ;
run-simple <define>TEST_BOOST_NO_CXX11_RANGE_BASED_FOR : cxx11_range_based_for ;
run-simple <define>TEST_BOOST_NO_CXX11_RAW_LITERALS : cxx11_raw_literals ;
run-simple <define>TEST_BOOST_NO_UNREACHABLE_RETURN_DETECTION : unreachable_return_detection ;
run-simple <define>TEST_BOOST_NO_RTTI : rtti ;
run-simple <define>TEST_BOOST_NO_CXX11_RVALUE_REFERENCES : cxx11_rvalue_references ;
run-simple <define>TEST_BOOST_NO_CXX11_SCOPED_ENUMS : cxx11_scoped_enums ;
run-simple <define>TEST_BOOST_NO_SFINAE : sfinae ;
run-simple <define>TEST_BOOST_NO_SFINAE_EXPR : sfinae_expr ;
run-simple <define>TEST_BOOST_NO_STRINGSTREAM : stringstream ;
run-simple <define>TEST_BOOST_NO_CXX11_STATIC_ASSERT : cxx11_static_assert ;
run-simple <define>TEST_BOOST_NO_STD_ALLOCATOR : std_allocator ;
run-simple <define>TEST_BOOST_NO_STD_DISTANCE : std_distance ;
run-simple <define>TEST_BOOST_NO_STD_ITERATOR_TRAITS : std_iterator_traits ;
run-simple <define>TEST_BOOST_NO_STD_ITERATOR : std_iterator ;
run-simple <define>TEST_BOOST_NO_STD_LOCALE : std_locale ;
run-simple <define>TEST_BOOST_NO_STD_MESSAGES : std_messages ;
run-simple <define>TEST_BOOST_NO_STD_MIN_MAX : std_min_max ;
run-simple <define>TEST_BOOST_NO_STD_OUTPUT_ITERATOR_ASSIGN : std_output_iterator_assign ;
run-simple <define>TEST_BOOST_NO_STD_TYPEINFO : std_typeinfo ;
run-simple <define>TEST_BOOST_NO_STD_USE_FACET : std_use_facet ;
run-simple <define>TEST_BOOST_NO_STD_WSTREAMBUF : std_wstreambuf ;
run-simple <define>TEST_BOOST_NO_STD_WSTRING : std_wstring ;
run-simple <define>TEST_BOOST_NO_STDC_NAMESPACE : stdc_namespace ;
run-simple <define>TEST_BOOST_NO_SWPRINTF : swprintf ;
run-simple <define>TEST_BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS : cxx11_local_class_template_parameters ;
run-simple <define>TEST_BOOST_NO_CXX11_TEMPLATE_ALIASES : cxx11_template_aliases ;
run-simple <define>TEST_BOOST_NO_TEMPLATED_IOSTREAMS : templated_iostreams ;
run-simple <define>TEST_BOOST_NO_TEMPLATE_TEMPLATES : template_templates ;
run-simple <define>TEST_BOOST_NO_TWO_PHASE_NAME_LOOKUP : two_phase_name_lookup ;
run-simple <define>TEST_BOOST_NO_TYPEID : typeid ;
run-simple <define>TEST_BOOST_NO_TYPENAME_WITH_CTOR : typename_with_ctor ;
run-simple <define>TEST_BOOST_NO_CXX11_UNICODE_LITERALS : cxx11_unicode_literals ;
run-simple <define>TEST_BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX : cxx11_unified_initialization_syntax ;
run-simple <define>TEST_BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL : boost_function_scope_using_declaration_breaks_adl ;
run-simple <define>TEST_BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE : using_declaration_overloads_from_typename_base ;
run-simple <define>TEST_BOOST_NO_USING_TEMPLATE : using_template ;
run-simple <define>TEST_BOOST_NO_CXX11_VARIADIC_MACROS : cxx11_variadic_macros ;
run-simple <define>TEST_BOOST_NO_CXX11_VARIADIC_TEMPLATES : cxx11_variadic_templates ;
run-simple <define>TEST_BOOST_NO_VOID_RETURNS : void_returns ;
run-simple <define>TEST_BOOST_NO_INTRINSIC_WCHAR_T : intrinsic_wchar_t ;
+9
View File
@@ -0,0 +1,9 @@
// 32.cpp
//
// Copyright (c) 2012 Steven Watanabe
//
// Distributed under the Boost Software License Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
int test[sizeof(void*) == 4? 1 : -1];
+9
View File
@@ -0,0 +1,9 @@
// 64.cpp
//
// Copyright (c) 2012 Steven Watanabe
//
// Distributed under the Boost Software License Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
int test[sizeof(void*) == 8? 1 : -1];
@@ -0,0 +1,23 @@
# Jamfile.jam
#
# Copyright 2012 Steven Watanabe
#
# Distributed under the Boost Software License Version 1.0. (See
# accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)
project /boost/architecture
: requirements
-<conditional>@boostcpp.deduce-address-model
-<conditional>@boostcpp.deduce-architecture
;
obj 32 : 32.cpp ;
obj 64 : 64.cpp ;
obj arm : arm.cpp ;
obj combined : combined.cpp ;
obj mips1 : mips1.cpp ;
obj power : power.cpp ;
obj sparc : sparc.cpp ;
obj x86 : x86.cpp ;
+15
View File
@@ -0,0 +1,15 @@
// arm.cpp
//
// Copyright (c) 2012 Steven Watanabe
//
// Distributed under the Boost Software License Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#if !defined(__arm__) && !defined(__thumb__) && \
!defined(__TARGET_ARCH_ARM) && !defined(__TARGET_ARCH_THUMB) && \
!defined(_ARM) && !defined(_M_ARM) && \
!defined(__aarch64__)
#error "Not ARM"
#endif
@@ -0,0 +1,21 @@
// combined.cpp
//
// Copyright (c) 2012 Steven Watanabe
// 2014 Oliver Kowalke
//
// Distributed under the Boost Software License Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#if !defined(i386) && !defined(__i386__) && !defined(__i386) \
&& !defined(__i486__) && !defined(__i586__) && !defined(__i686__) \
&& !defined(_M_IX86) && !defined(__X86__) && !defined(_X86_) \
&& !defined(__THW_INTEL__) && !defined(__I86__) && !defined(__INTEL__) \
&& !defined(__amd64__) && !defined(__x86_64__) && !defined(__amd64) \
&& !defined(__x86_64) && !defined(_M_X64) \
&& !defined(__powerpc) && !defined(__powerpc__) && !defined(__ppc) \
&& !defined(__ppc__) && !defined(_M_PPC) && !defined(_ARCH_PPC) \
&& !defined(__POWERPC__) && !defined(__PPCGECKO__) \
&& !defined(__PPCBROADWAY) && !defined(_XENON)
#error "Not combined"
#endif
+11
View File
@@ -0,0 +1,11 @@
// mips1.cpp
//
// Copyright (c) 2012 Steven Watanabe
//
// Distributed under the Boost Software License Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#if !((defined(__mips) && __mips == 1) || defined(_MIPS_ISA_MIPS1) || defined(_R3000))
#error "Not MIPS1"
#endif
+14
View File
@@ -0,0 +1,14 @@
// power.cpp
//
// Copyright (c) 2012 Steven Watanabe
//
// Distributed under the Boost Software License Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#if !defined(__powerpc) && !defined(__powerpc__) && !defined(__ppc) \
&& !defined(__ppc__) && !defined(_M_PPC) && !defined(_ARCH_PPC) \
&& !defined(__POWERPC__) && !defined(__PPCGECKO__) \
&& !defined(__PPCBROADWAY) && !defined(_XENON)
#error "Not PPC"
#endif
+11
View File
@@ -0,0 +1,11 @@
// power.cpp
//
// Copyright (c) 2012 Steven Watanabe
//
// Distributed under the Boost Software License Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#if !defined(__sparc__) && !defined(__sparc)
#error "Not SPARC"
#endif
+16
View File
@@ -0,0 +1,16 @@
// x86.cpp
//
// Copyright (c) 2012 Steven Watanabe
//
// Distributed under the Boost Software License Version 1.0. (See
// accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
#if !defined(i386) && !defined(__i386__) && !defined(__i386) \
&& !defined(__i486__) && !defined(__i586__) && !defined(__i686__) \
&& !defined(_M_IX86) && !defined(__X86__) && !defined(_X86_) \
&& !defined(__THW_INTEL__) && !defined(__I86__) && !defined(__INTEL__) \
&& !defined(__amd64__) && !defined(__x86_64__) && !defined(__amd64) \
&& !defined(__x86_64) && !defined(_M_X64)
#error "Not x86"
#endif
+21
View File
@@ -0,0 +1,21 @@
# Copyright John Maddock.
# Use, modification and distribution are subject to the
# Boost Software License, Version 1.0. (See accompanying file
# LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
import modules ;
rule requires ( names + )
{
local config-binding = [ modules.binding $(__name__) ] ;
local result ;
for name in $(names)
{
local msg = "Boost.Config Feature Check: " ;
msg += $(name) ;
result += [ check-target-builds $(config-binding:D)//$(name) $(msg:J=) : : <build>no ] ;
}
return $(result) ;
}
+809
View File
@@ -0,0 +1,809 @@
// This file was automatically generated on Mon Dec 12 19:37:08 2016
// by libs/config/tools/generate.cpp
// Copyright John Maddock 2002-4.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for the most recent version.//
// Revision $Id$
//
#ifdef TEST_BOOST_HAS_TWO_ARG_USE_FACET
# include "../test/boost_has_2arg_use_facet.ipp"
namespace test = boost_has_two_arg_use_facet;
#endif
#ifdef TEST_BOOST_HAS_BETHREADS
# include "../test/boost_has_bethreads.ipp"
namespace test = boost_has_bethreads;
#endif
#ifdef TEST_BOOST_HAS_CLOCK_GETTIME
# include "../test/boost_has_clock_gettime.ipp"
namespace test = boost_has_clock_gettime;
#endif
#ifdef TEST_BOOST_HAS_DIRENT_H
# include "../test/boost_has_dirent_h.ipp"
namespace test = boost_has_dirent_h;
#endif
#ifdef TEST_BOOST_HAS_EXPM1
# include "../test/boost_has_expm1.ipp"
namespace test = boost_has_expm1;
#endif
#ifdef TEST_BOOST_HAS_FLOAT128
# include "../test/boost_has_float128.ipp"
namespace test = boost_has_float128;
#endif
#ifdef TEST_BOOST_HAS_FTIME
# include "../test/boost_has_ftime.ipp"
namespace test = boost_has_ftime;
#endif
#ifdef TEST_BOOST_HAS_GETSYSTEMTIMEASFILETIME
# include "../test/boost_has_getsystemtimeasfiletime.ipp"
namespace test = boost_has_getsystemtimeasfiletime;
#endif
#ifdef TEST_BOOST_HAS_GETTIMEOFDAY
# include "../test/boost_has_gettimeofday.ipp"
namespace test = boost_has_gettimeofday;
#endif
#ifdef TEST_BOOST_HAS_HASH
# include "../test/boost_has_hash.ipp"
namespace test = boost_has_hash;
#endif
#ifdef TEST_BOOST_HAS_INT128
# include "../test/boost_has_int128.ipp"
namespace test = boost_has_int128;
#endif
#ifdef TEST_BOOST_HAS_LOG1P
# include "../test/boost_has_log1p.ipp"
namespace test = boost_has_log1p;
#endif
#ifdef TEST_BOOST_HAS_LONG_LONG
# include "../test/boost_has_long_long.ipp"
namespace test = boost_has_long_long;
#endif
#ifdef TEST_BOOST_HAS_MACRO_USE_FACET
# include "../test/boost_has_macro_use_facet.ipp"
namespace test = boost_has_macro_use_facet;
#endif
#ifdef TEST_BOOST_HAS_MS_INT64
# include "../test/boost_has_ms_int64.ipp"
namespace test = boost_has_ms_int64;
#endif
#ifdef TEST_BOOST_HAS_NANOSLEEP
# include "../test/boost_has_nanosleep.ipp"
namespace test = boost_has_nanosleep;
#endif
#ifdef TEST_BOOST_HAS_NL_TYPES_H
# include "../test/boost_has_nl_types_h.ipp"
namespace test = boost_has_nl_types_h;
#endif
#ifdef TEST_BOOST_HAS_NRVO
# include "../test/boost_has_nrvo.ipp"
namespace test = boost_has_nrvo;
#endif
#ifdef TEST_BOOST_HAS_PARTIAL_STD_ALLOCATOR
# include "../test/boost_has_part_alloc.ipp"
namespace test = boost_has_partial_std_allocator;
#endif
#ifdef TEST_BOOST_HAS_PTHREAD_DELAY_NP
# include "../test/boost_has_pthread_delay_np.ipp"
namespace test = boost_has_pthread_delay_np;
#endif
#ifdef TEST_BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE
# include "../test/boost_has_pthread_ma_st.ipp"
namespace test = boost_has_pthread_mutexattr_settype;
#endif
#ifdef TEST_BOOST_HAS_PTHREAD_YIELD
# include "../test/boost_has_pthread_yield.ipp"
namespace test = boost_has_pthread_yield;
#endif
#ifdef TEST_BOOST_HAS_PTHREADS
# include "../test/boost_has_pthreads.ipp"
namespace test = boost_has_pthreads;
#endif
#ifdef TEST_BOOST_HAS_RVALUE_REFS
# include "../test/boost_has_rvalue_refs.ipp"
namespace test = boost_has_rvalue_refs;
#endif
#ifdef TEST_BOOST_HAS_SCHED_YIELD
# include "../test/boost_has_sched_yield.ipp"
namespace test = boost_has_sched_yield;
#endif
#ifdef TEST_BOOST_HAS_SGI_TYPE_TRAITS
# include "../test/boost_has_sgi_type_traits.ipp"
namespace test = boost_has_sgi_type_traits;
#endif
#ifdef TEST_BOOST_HAS_SIGACTION
# include "../test/boost_has_sigaction.ipp"
namespace test = boost_has_sigaction;
#endif
#ifdef TEST_BOOST_HAS_SLIST
# include "../test/boost_has_slist.ipp"
namespace test = boost_has_slist;
#endif
#ifdef TEST_BOOST_HAS_STATIC_ASSERT
# include "../test/boost_has_static_assert.ipp"
namespace test = boost_has_static_assert;
#endif
#ifdef TEST_BOOST_HAS_STDINT_H
# include "../test/boost_has_stdint_h.ipp"
namespace test = boost_has_stdint_h;
#endif
#ifdef TEST_BOOST_HAS_STLP_USE_FACET
# include "../test/boost_has_stlp_use_facet.ipp"
namespace test = boost_has_stlp_use_facet;
#endif
#ifdef TEST_BOOST_HAS_TR1_ARRAY
# include "../test/boost_has_tr1_array.ipp"
namespace test = boost_has_tr1_array;
#endif
#ifdef TEST_BOOST_HAS_TR1_BIND
# include "../test/boost_has_tr1_bind.ipp"
namespace test = boost_has_tr1_bind;
#endif
#ifdef TEST_BOOST_HAS_TR1_COMPLEX_OVERLOADS
# include "../test/boost_has_tr1_complex_over.ipp"
namespace test = boost_has_tr1_complex_overloads;
#endif
#ifdef TEST_BOOST_HAS_TR1_COMPLEX_INVERSE_TRIG
# include "../test/boost_has_tr1_complex_trig.ipp"
namespace test = boost_has_tr1_complex_inverse_trig;
#endif
#ifdef TEST_BOOST_HAS_TR1_FUNCTION
# include "../test/boost_has_tr1_function.ipp"
namespace test = boost_has_tr1_function;
#endif
#ifdef TEST_BOOST_HAS_TR1_HASH
# include "../test/boost_has_tr1_hash.ipp"
namespace test = boost_has_tr1_hash;
#endif
#ifdef TEST_BOOST_HAS_TR1_MEM_FN
# include "../test/boost_has_tr1_mem_fn.ipp"
namespace test = boost_has_tr1_mem_fn;
#endif
#ifdef TEST_BOOST_HAS_TR1_RANDOM
# include "../test/boost_has_tr1_random.ipp"
namespace test = boost_has_tr1_random;
#endif
#ifdef TEST_BOOST_HAS_TR1_REFERENCE_WRAPPER
# include "../test/boost_has_tr1_ref_wrap.ipp"
namespace test = boost_has_tr1_reference_wrapper;
#endif
#ifdef TEST_BOOST_HAS_TR1_REGEX
# include "../test/boost_has_tr1_regex.ipp"
namespace test = boost_has_tr1_regex;
#endif
#ifdef TEST_BOOST_HAS_TR1_RESULT_OF
# include "../test/boost_has_tr1_result_of.ipp"
namespace test = boost_has_tr1_result_of;
#endif
#ifdef TEST_BOOST_HAS_TR1_SHARED_PTR
# include "../test/boost_has_tr1_shared_ptr.ipp"
namespace test = boost_has_tr1_shared_ptr;
#endif
#ifdef TEST_BOOST_HAS_TR1_TUPLE
# include "../test/boost_has_tr1_tuple.ipp"
namespace test = boost_has_tr1_tuple;
#endif
#ifdef TEST_BOOST_HAS_TR1_TYPE_TRAITS
# include "../test/boost_has_tr1_type_traits.ipp"
namespace test = boost_has_tr1_type_traits;
#endif
#ifdef TEST_BOOST_HAS_TR1_UNORDERED_MAP
# include "../test/boost_has_tr1_unordered_map.ipp"
namespace test = boost_has_tr1_unordered_map;
#endif
#ifdef TEST_BOOST_HAS_TR1_UNORDERED_SET
# include "../test/boost_has_tr1_unordered_set.ipp"
namespace test = boost_has_tr1_unordered_set;
#endif
#ifdef TEST_BOOST_HAS_TR1_UTILITY
# include "../test/boost_has_tr1_utility.ipp"
namespace test = boost_has_tr1_utility;
#endif
#ifdef TEST_BOOST_HAS_UNISTD_H
# include "../test/boost_has_unistd_h.ipp"
namespace test = boost_has_unistd_h;
#endif
#ifdef TEST_BOOST_HAS_VARIADIC_TMPL
# include "../test/boost_has_variadic_tmpl.ipp"
namespace test = boost_has_variadic_tmpl;
#endif
#ifdef TEST_BOOST_MSVC6_MEMBER_TEMPLATES
# include "../test/boost_has_vc6_mem_templ.ipp"
namespace test = boost_msvc6_member_templates;
#endif
#ifdef TEST_BOOST_MSVC_STD_ITERATOR
# include "../test/boost_has_vc_iterator.ipp"
namespace test = boost_msvc_std_iterator;
#endif
#ifdef TEST_BOOST_HAS_WINTHREADS
# include "../test/boost_has_winthreads.ipp"
namespace test = boost_has_winthreads;
#endif
#ifdef TEST_BOOST_NO_ADL_BARRIER
# include "../test/boost_no_adl_barrier.ipp"
namespace test = boost_no_adl_barrier;
#endif
#ifdef TEST_BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP
# include "../test/boost_no_arg_dep_lookup.ipp"
namespace test = boost_no_argument_dependent_lookup;
#endif
#ifdef TEST_BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS
# include "../test/boost_no_array_type_spec.ipp"
namespace test = boost_no_array_type_specializations;
#endif
#ifdef TEST_BOOST_NO_CXX11_AUTO_DECLARATIONS
# include "../test/boost_no_auto_declarations.ipp"
namespace test = boost_no_cxx11_auto_declarations;
#endif
#ifdef TEST_BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS
# include "../test/boost_no_auto_multidecl.ipp"
namespace test = boost_no_cxx11_auto_multideclarations;
#endif
#ifdef TEST_BOOST_NO_AUTO_PTR
# include "../test/boost_no_auto_ptr.ipp"
namespace test = boost_no_auto_ptr;
#endif
#ifdef TEST_BOOST_BCB_PARTIAL_SPECIALIZATION_BUG
# include "../test/boost_no_bcb_partial_spec.ipp"
namespace test = boost_bcb_partial_specialization_bug;
#endif
#ifdef TEST_BOOST_NO_CXX11_CHAR16_T
# include "../test/boost_no_char16_t.ipp"
namespace test = boost_no_cxx11_char16_t;
#endif
#ifdef TEST_BOOST_NO_CXX11_CHAR32_T
# include "../test/boost_no_char32_t.ipp"
namespace test = boost_no_cxx11_char32_t;
#endif
#ifdef TEST_BOOST_NO_COMPLETE_VALUE_INITIALIZATION
# include "../test/boost_no_com_value_init.ipp"
namespace test = boost_no_complete_value_initialization;
#endif
#ifdef TEST_BOOST_NO_CXX11_CONSTEXPR
# include "../test/boost_no_constexpr.ipp"
namespace test = boost_no_cxx11_constexpr;
#endif
#ifdef TEST_BOOST_NO_CTYPE_FUNCTIONS
# include "../test/boost_no_ctype_functions.ipp"
namespace test = boost_no_ctype_functions;
#endif
#ifdef TEST_BOOST_NO_CV_SPECIALIZATIONS
# include "../test/boost_no_cv_spec.ipp"
namespace test = boost_no_cv_specializations;
#endif
#ifdef TEST_BOOST_NO_CV_VOID_SPECIALIZATIONS
# include "../test/boost_no_cv_void_spec.ipp"
namespace test = boost_no_cv_void_specializations;
#endif
#ifdef TEST_BOOST_NO_CWCHAR
# include "../test/boost_no_cwchar.ipp"
namespace test = boost_no_cwchar;
#endif
#ifdef TEST_BOOST_NO_CWCTYPE
# include "../test/boost_no_cwctype.ipp"
namespace test = boost_no_cwctype;
#endif
#ifdef TEST_BOOST_NO_CXX11_ADDRESSOF
# include "../test/boost_no_cxx11_addressof.ipp"
namespace test = boost_no_cxx11_addressof;
#endif
#ifdef TEST_BOOST_NO_CXX11_ALIGNAS
# include "../test/boost_no_cxx11_alignas.ipp"
namespace test = boost_no_cxx11_alignas;
#endif
#ifdef TEST_BOOST_NO_CXX11_ALLOCATOR
# include "../test/boost_no_cxx11_allocator.ipp"
namespace test = boost_no_cxx11_allocator;
#endif
#ifdef TEST_BOOST_NO_CXX11_ATOMIC_SMART_PTR
# include "../test/boost_no_cxx11_atomic_sp.ipp"
namespace test = boost_no_cxx11_atomic_smart_ptr;
#endif
#ifdef TEST_BOOST_NO_CXX11_FINAL
# include "../test/boost_no_cxx11_final.ipp"
namespace test = boost_no_cxx11_final;
#endif
#ifdef TEST_BOOST_NO_CXX11_HDR_ARRAY
# include "../test/boost_no_cxx11_hdr_array.ipp"
namespace test = boost_no_cxx11_hdr_array;
#endif
#ifdef TEST_BOOST_NO_CXX11_HDR_ATOMIC
# include "../test/boost_no_cxx11_hdr_atomic.ipp"
namespace test = boost_no_cxx11_hdr_atomic;
#endif
#ifdef TEST_BOOST_NO_CXX11_HDR_CHRONO
# include "../test/boost_no_cxx11_hdr_chrono.ipp"
namespace test = boost_no_cxx11_hdr_chrono;
#endif
#ifdef TEST_BOOST_NO_CXX11_HDR_CODECVT
# include "../test/boost_no_cxx11_hdr_codecvt.ipp"
namespace test = boost_no_cxx11_hdr_codecvt;
#endif
#ifdef TEST_BOOST_NO_CXX11_HDR_CONDITION_VARIABLE
# include "../test/boost_no_cxx11_hdr_condition_variable.ipp"
namespace test = boost_no_cxx11_hdr_condition_variable;
#endif
#ifdef TEST_BOOST_NO_CXX11_HDR_FORWARD_LIST
# include "../test/boost_no_cxx11_hdr_forward_list.ipp"
namespace test = boost_no_cxx11_hdr_forward_list;
#endif
#ifdef TEST_BOOST_NO_CXX11_HDR_FUTURE
# include "../test/boost_no_cxx11_hdr_future.ipp"
namespace test = boost_no_cxx11_hdr_future;
#endif
#ifdef TEST_BOOST_NO_CXX11_HDR_INITIALIZER_LIST
# include "../test/boost_no_cxx11_hdr_initializer_list.ipp"
namespace test = boost_no_cxx11_hdr_initializer_list;
#endif
#ifdef TEST_BOOST_NO_CXX11_HDR_MUTEX
# include "../test/boost_no_cxx11_hdr_mutex.ipp"
namespace test = boost_no_cxx11_hdr_mutex;
#endif
#ifdef TEST_BOOST_NO_CXX11_HDR_RANDOM
# include "../test/boost_no_cxx11_hdr_random.ipp"
namespace test = boost_no_cxx11_hdr_random;
#endif
#ifdef TEST_BOOST_NO_CXX11_HDR_RATIO
# include "../test/boost_no_cxx11_hdr_ratio.ipp"
namespace test = boost_no_cxx11_hdr_ratio;
#endif
#ifdef TEST_BOOST_NO_CXX11_HDR_REGEX
# include "../test/boost_no_cxx11_hdr_regex.ipp"
namespace test = boost_no_cxx11_hdr_regex;
#endif
#ifdef TEST_BOOST_NO_CXX11_HDR_SYSTEM_ERROR
# include "../test/boost_no_cxx11_hdr_system_error.ipp"
namespace test = boost_no_cxx11_hdr_system_error;
#endif
#ifdef TEST_BOOST_NO_CXX11_HDR_THREAD
# include "../test/boost_no_cxx11_hdr_thread.ipp"
namespace test = boost_no_cxx11_hdr_thread;
#endif
#ifdef TEST_BOOST_NO_CXX11_HDR_TUPLE
# include "../test/boost_no_cxx11_hdr_tuple.ipp"
namespace test = boost_no_cxx11_hdr_tuple;
#endif
#ifdef TEST_BOOST_NO_CXX11_HDR_TYPE_TRAITS
# include "../test/boost_no_cxx11_hdr_type_traits.ipp"
namespace test = boost_no_cxx11_hdr_type_traits;
#endif
#ifdef TEST_BOOST_NO_CXX11_HDR_TYPEINDEX
# include "../test/boost_no_cxx11_hdr_typeindex.ipp"
namespace test = boost_no_cxx11_hdr_typeindex;
#endif
#ifdef TEST_BOOST_NO_CXX11_HDR_UNORDERED_MAP
# include "../test/boost_no_cxx11_hdr_unordered_map.ipp"
namespace test = boost_no_cxx11_hdr_unordered_map;
#endif
#ifdef TEST_BOOST_NO_CXX11_HDR_UNORDERED_SET
# include "../test/boost_no_cxx11_hdr_unordered_set.ipp"
namespace test = boost_no_cxx11_hdr_unordered_set;
#endif
#ifdef TEST_BOOST_NO_CXX11_INLINE_NAMESPACES
# include "../test/boost_no_cxx11_inline_namespaces.ipp"
namespace test = boost_no_cxx11_inline_namespaces;
#endif
#ifdef TEST_BOOST_NO_CXX11_NON_PUBLIC_DEFAULTED_FUNCTIONS
# include "../test/boost_no_cxx11_non_pub_def_fun.ipp"
namespace test = boost_no_cxx11_non_public_defaulted_functions;
#endif
#ifdef TEST_BOOST_NO_CXX11_NUMERIC_LIMITS
# include "../test/boost_no_cxx11_numeric_limits.ipp"
namespace test = boost_no_cxx11_numeric_limits;
#endif
#ifdef TEST_BOOST_NO_CXX11_REF_QUALIFIERS
# include "../test/boost_no_cxx11_ref_qualifiers.ipp"
namespace test = boost_no_cxx11_ref_qualifiers;
#endif
#ifdef TEST_BOOST_NO_CXX11_SMART_PTR
# include "../test/boost_no_cxx11_smart_ptr.ipp"
namespace test = boost_no_cxx11_smart_ptr;
#endif
#ifdef TEST_BOOST_NO_CXX11_STD_ALIGN
# include "../test/boost_no_cxx11_std_align.ipp"
namespace test = boost_no_cxx11_std_align;
#endif
#ifdef TEST_BOOST_NO_CXX11_THREAD_LOCAL
# include "../test/boost_no_cxx11_thread_local.ipp"
namespace test = boost_no_cxx11_thread_local;
#endif
#ifdef TEST_BOOST_NO_CXX11_TRAILING_RESULT_TYPES
# include "../test/boost_no_cxx11_trailing_result_types.ipp"
namespace test = boost_no_cxx11_trailing_result_types;
#endif
#ifdef TEST_BOOST_NO_CXX11_USER_DEFINED_LITERALS
# include "../test/boost_no_cxx11_user_lit.ipp"
namespace test = boost_no_cxx11_user_defined_literals;
#endif
#ifdef TEST_BOOST_NO_CXX14_BINARY_LITERALS
# include "../test/boost_no_cxx14_binary_literals.ipp"
namespace test = boost_no_cxx14_binary_literals;
#endif
#ifdef TEST_BOOST_NO_CXX14_CONSTEXPR
# include "../test/boost_no_cxx14_constexpr.ipp"
namespace test = boost_no_cxx14_constexpr;
#endif
#ifdef TEST_BOOST_NO_CXX14_DECLTYPE_AUTO
# include "../test/boost_no_cxx14_decltype_auto.ipp"
namespace test = boost_no_cxx14_decltype_auto;
#endif
#ifdef TEST_BOOST_NO_CXX14_DIGIT_SEPARATORS
# include "../test/boost_no_cxx14_digit_separator.ipp"
namespace test = boost_no_cxx14_digit_separators;
#endif
#ifdef TEST_BOOST_NO_CXX14_GENERIC_LAMBDAS
# include "../test/boost_no_cxx14_generic_lambda.ipp"
namespace test = boost_no_cxx14_generic_lambdas;
#endif
#ifdef TEST_BOOST_NO_CXX14_HDR_SHARED_MUTEX
# include "../test/boost_no_cxx14_hdr_shared_mutex.ipp"
namespace test = boost_no_cxx14_hdr_shared_mutex;
#endif
#ifdef TEST_BOOST_NO_CXX14_INITIALIZED_LAMBDA_CAPTURES
# include "../test/boost_no_cxx14_lambda_capture.ipp"
namespace test = boost_no_cxx14_initialized_lambda_captures;
#endif
#ifdef TEST_BOOST_NO_CXX14_AGGREGATE_NSDMI
# include "../test/boost_no_cxx14_member_init.ipp"
namespace test = boost_no_cxx14_aggregate_nsdmi;
#endif
#ifdef TEST_BOOST_NO_CXX14_RETURN_TYPE_DEDUCTION
# include "../test/boost_no_cxx14_return_type_ded.ipp"
namespace test = boost_no_cxx14_return_type_deduction;
#endif
#ifdef TEST_BOOST_NO_CXX14_STD_EXCHANGE
# include "../test/boost_no_cxx14_std_exchange.ipp"
namespace test = boost_no_cxx14_std_exchange;
#endif
#ifdef TEST_BOOST_NO_CXX14_VARIABLE_TEMPLATES
# include "../test/boost_no_cxx14_var_templ.ipp"
namespace test = boost_no_cxx14_variable_templates;
#endif
#ifdef TEST_BOOST_NO_CXX17_STD_APPLY
# include "../test/boost_no_cxx17_std_apply.ipp"
namespace test = boost_no_cxx17_std_apply;
#endif
#ifdef TEST_BOOST_NO_CXX17_STD_INVOKE
# include "../test/boost_no_cxx17_std_invoke.ipp"
namespace test = boost_no_cxx17_std_invoke;
#endif
#ifdef TEST_BOOST_NO_CXX11_HDR_FUNCTIONAL
# include "../test/boost_no_cxx_hdr_functional.ipp"
namespace test = boost_no_cxx11_hdr_functional;
#endif
#ifdef TEST_BOOST_NO_CXX11_DECLTYPE
# include "../test/boost_no_decltype.ipp"
namespace test = boost_no_cxx11_decltype;
#endif
#ifdef TEST_BOOST_NO_CXX11_DECLTYPE_N3276
# include "../test/boost_no_decltype_n3276.ipp"
namespace test = boost_no_cxx11_decltype_n3276;
#endif
#ifdef TEST_BOOST_DEDUCED_TYPENAME
# include "../test/boost_no_ded_typename.ipp"
namespace test = boost_deduced_typename;
#endif
#ifdef TEST_BOOST_NO_CXX11_DEFAULTED_FUNCTIONS
# include "../test/boost_no_defaulted_functions.ipp"
namespace test = boost_no_cxx11_defaulted_functions;
#endif
#ifdef TEST_BOOST_NO_CXX11_DELETED_FUNCTIONS
# include "../test/boost_no_deleted_functions.ipp"
namespace test = boost_no_cxx11_deleted_functions;
#endif
#ifdef TEST_BOOST_NO_DEPENDENT_NESTED_DERIVATIONS
# include "../test/boost_no_dep_nested_class.ipp"
namespace test = boost_no_dependent_nested_derivations;
#endif
#ifdef TEST_BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS
# include "../test/boost_no_dep_val_param.ipp"
namespace test = boost_no_dependent_types_in_template_value_parameters;
#endif
#ifdef TEST_BOOST_NO_EXCEPTION_STD_NAMESPACE
# include "../test/boost_no_excep_std.ipp"
namespace test = boost_no_exception_std_namespace;
#endif
#ifdef TEST_BOOST_NO_EXCEPTIONS
# include "../test/boost_no_exceptions.ipp"
namespace test = boost_no_exceptions;
#endif
#ifdef TEST_BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS
# include "../test/boost_no_exp_func_tem_arg.ipp"
namespace test = boost_no_explicit_function_template_arguments;
#endif
#ifdef TEST_BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
# include "../test/boost_no_explicit_cvt_ops.ipp"
namespace test = boost_no_cxx11_explicit_conversion_operators;
#endif
#ifdef TEST_BOOST_NO_CXX11_EXTERN_TEMPLATE
# include "../test/boost_no_extern_template.ipp"
namespace test = boost_no_cxx11_extern_template;
#endif
#ifdef TEST_BOOST_NO_FENV_H
# include "../test/boost_no_fenv_h.ipp"
namespace test = boost_no_fenv_h;
#endif
#ifdef TEST_BOOST_NO_CXX11_FIXED_LENGTH_VARIADIC_TEMPLATE_EXPANSION_PACKS
# include "../test/boost_no_fixed_len_variadic_templates.ipp"
namespace test = boost_no_cxx11_fixed_length_variadic_template_expansion_packs;
#endif
#ifdef TEST_BOOST_NO_FUNCTION_TEMPLATE_ORDERING
# include "../test/boost_no_func_tmp_order.ipp"
namespace test = boost_no_function_template_ordering;
#endif
#ifdef TEST_BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS
# include "../test/boost_no_function_template_default_args.ipp"
namespace test = boost_no_cxx11_function_template_default_args;
#endif
#ifdef TEST_BOOST_NO_FUNCTION_TYPE_SPECIALIZATIONS
# include "../test/boost_no_function_type_spec.ipp"
namespace test = boost_no_function_type_specializations;
#endif
#ifdef TEST_BOOST_NO_MS_INT64_NUMERIC_LIMITS
# include "../test/boost_no_i64_limits.ipp"
namespace test = boost_no_ms_int64_numeric_limits;
#endif
#ifdef TEST_BOOST_NO_INCLASS_MEMBER_INITIALIZATION
# include "../test/boost_no_inline_memb_init.ipp"
namespace test = boost_no_inclass_member_initialization;
#endif
#ifdef TEST_BOOST_NO_INTEGRAL_INT64_T
# include "../test/boost_no_integral_int64_t.ipp"
namespace test = boost_no_integral_int64_t;
#endif
#ifdef TEST_BOOST_NO_IOSFWD
# include "../test/boost_no_iosfwd.ipp"
namespace test = boost_no_iosfwd;
#endif
#ifdef TEST_BOOST_NO_IOSTREAM
# include "../test/boost_no_iostream.ipp"
namespace test = boost_no_iostream;
#endif
#ifdef TEST_BOOST_NO_IS_ABSTRACT
# include "../test/boost_no_is_abstract.ipp"
namespace test = boost_no_is_abstract;
#endif
#ifdef TEST_BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
# include "../test/boost_no_iter_construct.ipp"
namespace test = boost_no_templated_iterator_constructors;
#endif
#ifdef TEST_BOOST_NO_CXX11_LAMBDAS
# include "../test/boost_no_lambdas.ipp"
namespace test = boost_no_cxx11_lambdas;
#endif
#ifdef TEST_BOOST_NO_LIMITS
# include "../test/boost_no_limits.ipp"
namespace test = boost_no_limits;
#endif
#ifdef TEST_BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
# include "../test/boost_no_limits_const_exp.ipp"
namespace test = boost_no_limits_compile_time_constants;
#endif
#ifdef TEST_BOOST_NO_LONG_LONG_NUMERIC_LIMITS
# include "../test/boost_no_ll_limits.ipp"
namespace test = boost_no_long_long_numeric_limits;
#endif
#ifdef TEST_BOOST_NO_LONG_LONG
# include "../test/boost_no_long_long.ipp"
namespace test = boost_no_long_long;
#endif
#ifdef TEST_BOOST_NO_MEMBER_FUNCTION_SPECIALIZATIONS
# include "../test/boost_no_mem_func_spec.ipp"
namespace test = boost_no_member_function_specializations;
#endif
#ifdef TEST_BOOST_NO_MEMBER_TEMPLATE_KEYWORD
# include "../test/boost_no_mem_tem_keyword.ipp"
namespace test = boost_no_member_template_keyword;
#endif
#ifdef TEST_BOOST_NO_POINTER_TO_MEMBER_TEMPLATE_PARAMETERS
# include "../test/boost_no_mem_tem_pnts.ipp"
namespace test = boost_no_pointer_to_member_template_parameters;
#endif
#ifdef TEST_BOOST_NO_MEMBER_TEMPLATE_FRIENDS
# include "../test/boost_no_mem_templ_frnds.ipp"
namespace test = boost_no_member_template_friends;
#endif
#ifdef TEST_BOOST_NO_MEMBER_TEMPLATES
# include "../test/boost_no_mem_templates.ipp"
namespace test = boost_no_member_templates;
#endif
#ifdef TEST_BOOST_NO_NESTED_FRIENDSHIP
# include "../test/boost_no_nested_friendship.ipp"
namespace test = boost_no_nested_friendship;
#endif
#ifdef TEST_BOOST_NO_CXX11_NOEXCEPT
# include "../test/boost_no_noexcept.ipp"
namespace test = boost_no_cxx11_noexcept;
#endif
#ifdef TEST_BOOST_NO_CXX11_NULLPTR
# include "../test/boost_no_nullptr.ipp"
namespace test = boost_no_cxx11_nullptr;
#endif
#ifdef TEST_BOOST_NO_OPERATORS_IN_NAMESPACE
# include "../test/boost_no_ops_in_namespace.ipp"
namespace test = boost_no_operators_in_namespace;
#endif
#ifdef TEST_BOOST_NO_PARTIAL_SPECIALIZATION_IMPLICIT_DEFAULT_ARGS
# include "../test/boost_no_part_spec_def_args.ipp"
namespace test = boost_no_partial_specialization_implicit_default_args;
#endif
#ifdef TEST_BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
# include "../test/boost_no_partial_spec.ipp"
namespace test = boost_no_template_partial_specialization;
#endif
#ifdef TEST_BOOST_NO_PRIVATE_IN_AGGREGATE
# include "../test/boost_no_priv_aggregate.ipp"
namespace test = boost_no_private_in_aggregate;
#endif
#ifdef TEST_BOOST_NO_POINTER_TO_MEMBER_CONST
# include "../test/boost_no_ptr_mem_const.ipp"
namespace test = boost_no_pointer_to_member_const;
#endif
#ifdef TEST_BOOST_NO_CXX11_RANGE_BASED_FOR
# include "../test/boost_no_range_based_for.ipp"
namespace test = boost_no_cxx11_range_based_for;
#endif
#ifdef TEST_BOOST_NO_CXX11_RAW_LITERALS
# include "../test/boost_no_raw_literals.ipp"
namespace test = boost_no_cxx11_raw_literals;
#endif
#ifdef TEST_BOOST_NO_UNREACHABLE_RETURN_DETECTION
# include "../test/boost_no_ret_det.ipp"
namespace test = boost_no_unreachable_return_detection;
#endif
#ifdef TEST_BOOST_NO_RTTI
# include "../test/boost_no_rtti.ipp"
namespace test = boost_no_rtti;
#endif
#ifdef TEST_BOOST_NO_CXX11_RVALUE_REFERENCES
# include "../test/boost_no_rvalue_references.ipp"
namespace test = boost_no_cxx11_rvalue_references;
#endif
#ifdef TEST_BOOST_NO_CXX11_SCOPED_ENUMS
# include "../test/boost_no_scoped_enums.ipp"
namespace test = boost_no_cxx11_scoped_enums;
#endif
#ifdef TEST_BOOST_NO_SFINAE
# include "../test/boost_no_sfinae.ipp"
namespace test = boost_no_sfinae;
#endif
#ifdef TEST_BOOST_NO_SFINAE_EXPR
# include "../test/boost_no_sfinae_expr.ipp"
namespace test = boost_no_sfinae_expr;
#endif
#ifdef TEST_BOOST_NO_STRINGSTREAM
# include "../test/boost_no_sstream.ipp"
namespace test = boost_no_stringstream;
#endif
#ifdef TEST_BOOST_NO_CXX11_STATIC_ASSERT
# include "../test/boost_no_static_assert.ipp"
namespace test = boost_no_cxx11_static_assert;
#endif
#ifdef TEST_BOOST_NO_STD_ALLOCATOR
# include "../test/boost_no_std_allocator.ipp"
namespace test = boost_no_std_allocator;
#endif
#ifdef TEST_BOOST_NO_STD_DISTANCE
# include "../test/boost_no_std_distance.ipp"
namespace test = boost_no_std_distance;
#endif
#ifdef TEST_BOOST_NO_STD_ITERATOR_TRAITS
# include "../test/boost_no_std_iter_traits.ipp"
namespace test = boost_no_std_iterator_traits;
#endif
#ifdef TEST_BOOST_NO_STD_ITERATOR
# include "../test/boost_no_std_iterator.ipp"
namespace test = boost_no_std_iterator;
#endif
#ifdef TEST_BOOST_NO_STD_LOCALE
# include "../test/boost_no_std_locale.ipp"
namespace test = boost_no_std_locale;
#endif
#ifdef TEST_BOOST_NO_STD_MESSAGES
# include "../test/boost_no_std_messages.ipp"
namespace test = boost_no_std_messages;
#endif
#ifdef TEST_BOOST_NO_STD_MIN_MAX
# include "../test/boost_no_std_min_max.ipp"
namespace test = boost_no_std_min_max;
#endif
#ifdef TEST_BOOST_NO_STD_OUTPUT_ITERATOR_ASSIGN
# include "../test/boost_no_std_oi_assign.ipp"
namespace test = boost_no_std_output_iterator_assign;
#endif
#ifdef TEST_BOOST_NO_STD_TYPEINFO
# include "../test/boost_no_std_typeinfo.ipp"
namespace test = boost_no_std_typeinfo;
#endif
#ifdef TEST_BOOST_NO_STD_USE_FACET
# include "../test/boost_no_std_use_facet.ipp"
namespace test = boost_no_std_use_facet;
#endif
#ifdef TEST_BOOST_NO_STD_WSTREAMBUF
# include "../test/boost_no_std_wstreambuf.ipp"
namespace test = boost_no_std_wstreambuf;
#endif
#ifdef TEST_BOOST_NO_STD_WSTRING
# include "../test/boost_no_std_wstring.ipp"
namespace test = boost_no_std_wstring;
#endif
#ifdef TEST_BOOST_NO_STDC_NAMESPACE
# include "../test/boost_no_stdc_namespace.ipp"
namespace test = boost_no_stdc_namespace;
#endif
#ifdef TEST_BOOST_NO_SWPRINTF
# include "../test/boost_no_swprintf.ipp"
namespace test = boost_no_swprintf;
#endif
#ifdef TEST_BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS
# include "../test/boost_no_tem_local_classes.ipp"
namespace test = boost_no_cxx11_local_class_template_parameters;
#endif
#ifdef TEST_BOOST_NO_CXX11_TEMPLATE_ALIASES
# include "../test/boost_no_template_aliases.ipp"
namespace test = boost_no_cxx11_template_aliases;
#endif
#ifdef TEST_BOOST_NO_TEMPLATED_IOSTREAMS
# include "../test/boost_no_template_streams.ipp"
namespace test = boost_no_templated_iostreams;
#endif
#ifdef TEST_BOOST_NO_TEMPLATE_TEMPLATES
# include "../test/boost_no_template_template.ipp"
namespace test = boost_no_template_templates;
#endif
#ifdef TEST_BOOST_NO_TWO_PHASE_NAME_LOOKUP
# include "../test/boost_no_two_phase_lookup.ipp"
namespace test = boost_no_two_phase_name_lookup;
#endif
#ifdef TEST_BOOST_NO_TYPEID
# include "../test/boost_no_typeid.ipp"
namespace test = boost_no_typeid;
#endif
#ifdef TEST_BOOST_NO_TYPENAME_WITH_CTOR
# include "../test/boost_no_typename_with_ctor.ipp"
namespace test = boost_no_typename_with_ctor;
#endif
#ifdef TEST_BOOST_NO_CXX11_UNICODE_LITERALS
# include "../test/boost_no_unicode_literals.ipp"
namespace test = boost_no_cxx11_unicode_literals;
#endif
#ifdef TEST_BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX
# include "../test/boost_no_unified_init.ipp"
namespace test = boost_no_cxx11_unified_initialization_syntax;
#endif
#ifdef TEST_BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL
# include "../test/boost_no_using_breaks_adl.ipp"
namespace test = boost_function_scope_using_declaration_breaks_adl;
#endif
#ifdef TEST_BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE
# include "../test/boost_no_using_decl_overld.ipp"
namespace test = boost_no_using_declaration_overloads_from_typename_base;
#endif
#ifdef TEST_BOOST_NO_USING_TEMPLATE
# include "../test/boost_no_using_template.ipp"
namespace test = boost_no_using_template;
#endif
#ifdef TEST_BOOST_NO_CXX11_VARIADIC_MACROS
# include "../test/boost_no_variadic_macros.ipp"
namespace test = boost_no_cxx11_variadic_macros;
#endif
#ifdef TEST_BOOST_NO_CXX11_VARIADIC_TEMPLATES
# include "../test/boost_no_variadic_templates.ipp"
namespace test = boost_no_cxx11_variadic_templates;
#endif
#ifdef TEST_BOOST_NO_VOID_RETURNS
# include "../test/boost_no_void_returns.ipp"
namespace test = boost_no_void_returns;
#endif
#ifdef TEST_BOOST_NO_INTRINSIC_WCHAR_T
# include "../test/boost_no_wchar_t.ipp"
namespace test = boost_no_intrinsic_wchar_t;
#endif
int main( int, char *[] )
{
return test::test();
}
+106
View File
@@ -0,0 +1,106 @@
#
# Copyright John Maddock 2008.
# Use, modification and distribution are subject to the
# Boost Software License, Version 1.0. (See accompanying file
# LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#
# If you need to alter build preferences then set them in
# the template defined in options_v2.jam.
#
project
: requirements
<toolset>gcc:<cxxflags>-Wno-deprecated-declarations
;
import modules ;
import ../checks/config : requires ;
local is_unix = [ modules.peek : UNIX ] ;
lib atomic ;
lib pthread ;
lib rt ;
exe has_atomic_lib : config_info.cpp atomic ;
explicit has_atomic_lib ;
exe has_pthread_lib : config_info.cpp pthread ;
explicit has_pthread_lib ;
exe has_rt_lib : config_info.cpp rt ;
explicit has_rt_lib ;
test-suite config
:
[ compile config_test_c.c ]
[ run config_test.cpp
: #args
: #input-files
: #requirements
<threading>multi
[ check-target-builds has_atomic_lib : <source>atomic ]
[ check-target-builds has_pthread_lib : <source>pthread ]
[ check-target-builds has_rt_lib : <source>rt ]
: config_test_threaded
]
[ run config_test.cpp
: #args
: #input-files
: #requirements
<threading>single <toolset>msvc:<runtime-link>static <toolset>msvc:<link>static
[ check-target-builds has_atomic_lib : <source>atomic ]
[ check-target-builds has_pthread_lib : <source>pthread ]
[ check-target-builds has_rt_lib : <source>rt ]
]
[ run config_test.cpp
: #args
: #input-files
: #requirements
<rtti>off
[ check-target-builds has_atomic_lib : <source>atomic ]
[ check-target-builds has_pthread_lib : <source>pthread ]
[ check-target-builds has_rt_lib : <source>rt ]
: config_test_no_rtti
]
[ run config_test.cpp
: #args
: #input-files
: #requirements
<exception-handling>off
[ check-target-builds has_atomic_lib : <source>atomic ]
[ check-target-builds has_pthread_lib : <source>pthread ]
[ check-target-builds has_rt_lib : <source>rt ]
: config_test_no_except
]
[ run config_info.cpp : : : <test-info>always_show_run_output <threading>single <toolset>msvc:<runtime-link>static <toolset>msvc:<link>static ]
[ run config_info.cpp : : : <test-info>always_show_run_output <threading>multi : config_info_threaded ]
[ run config_info.cpp : : : <test-info>always_show_run_output <rtti>off : config_info_no_rtti ]
[ run config_info.cpp : : : <test-info>always_show_run_output <exception-handling>off : config_info_no_except ]
[ run math_info.cpp : : : <test-info>always_show_run_output <toolset>borland:<runtime-link>static <toolset>borland:<link>static ]
[ run abi/abi_test.cpp abi/main.cpp ]
[ run limits_test.cpp ]
[ run link/main.cpp link//link_test
: #args
: #input-files
: #requirements
<runtime-link>shared
<define>BOOST_DYN_LINK=1
<define>BOOST_CONFIG_NO_LIB=1
:
config_link_test
]
[ compile-fail threads/test_thread_fail1.cpp ]
[ compile-fail threads/test_thread_fail2.cpp ]
[ compile boost_fallthrough_test.cpp : [ check-target-builds has_clang_implicit_fallthrough "Clang implicit fallthrough" : <toolset>clang:<cxxflags>"-std=c++11 -Wimplicit-fallthrough" <warnings-as-errors>on <warnings>all ] ]
[ compile helper_macro_test.cpp ]
[ run cstdint_test.cpp : : : <warnings>all <toolset>gcc:<cxxflags>"-Wno-long-long -Wextra" <toolset>darwin:<cxxflags>-Wno-long-long ]
[ run cstdint_test2.cpp : : : <warnings>all <toolset>gcc:<cxxflags>"-Wno-long-long -Wextra" <toolset>darwin:<cxxflags>-Wno-long-long ]
[ compile cstdint_include_test.cpp : <warnings>all <toolset>gcc:<cxxflags>-Wextra ]
[ run config_build_check.cpp : : : [ requires int128 cxx11_constexpr cxx11_user_defined_literals ] ]
;
obj has_clang_implicit_fallthrough : cmd_line_check.cpp :
<toolset>clang:<cxxflags>"-std=c++11 -Wimplicit-fallthrough" <warnings-as-errors>on <warnings>all ;
explicit has_clang_implicit_fallthrough ;
+27
View File
@@ -0,0 +1,27 @@
// (C) Copyright John Maddock 2003.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for the most recent version.
#include "abi_test.hpp"
char abi_test::virtual_one()const
{
return c;
}
boost::int32_t abi_test::virtual_two()const
{
return i;
}
abi_test::abi_test()
{
c = 0x12;
i = 0x5678;
}
+54
View File
@@ -0,0 +1,54 @@
// (C) Copyright John Maddock 2003.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for the most recent version.
#ifndef BOOST_ABI_TEST_HPP
#define BOOST_ABI_TEST_HPP
#include <boost/config.hpp>
#include <boost/cstdint.hpp>
#ifdef BOOST_HAS_ABI_HEADERS
#include BOOST_ABI_PREFIX
#endif
//
// the following class is designed to break if the ABI
// it's compiled with does not match that of the client
// calling it....
//
struct empty{};
class abi_test : protected empty
{
private:
empty e;
char c;
boost::int32_t i;
public:
inline char inline_one()const
{ return c; }
inline boost::int32_t inline_two()const
{ return i; }
virtual char virtual_one()const;
virtual boost::int32_t virtual_two()const;
abi_test();
};
#ifdef BOOST_HAS_ABI_HEADERS
#include BOOST_ABI_SUFFIX
#endif
#endif // BOOST_ABI_TEST_HPP
+31
View File
@@ -0,0 +1,31 @@
// (C) Copyright John Maddock 2003.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for the most recent version.
//
// before we do anything else, we need to mess with the compilers ABI:
//
#include <boost/config.hpp>
#ifdef BOOST_MSVC
#pragma pack(1)
#elif defined(__BORLANDC__)
#pragma option -Ve- -Vx- -a1 -b-
#endif
#include <stdio.h>
#include "abi_test.hpp"
int main()
{
abi_test t;
if((t.inline_one() != t.virtual_one()) || (t.inline_two() != t.virtual_two()))
{
fwrite("Failed ABI test", 1, 15, stdout);
return -1;
}
return 0;
}
+619
View File
@@ -0,0 +1,619 @@
#
# Regression test Jamfile for boost configuration setup.
# *** DO NOT EDIT THIS FILE BY HAND ***
# This file was automatically generated on Mon Dec 12 19:37:08 2016
# by libs/config/tools/generate.cpp
# Copyright John Maddock.
# Use, modification and distribution are subject to the
# Boost Software License, Version 1.0. (See accompanying file
# LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#
# If you need to alter build preferences then set them in
# the template defined in options_v2.jam.
#
path-constant DOT : . ;
include $(DOT)/options_v2.jam ;
run ../config_info.cpp : : : <threading>single <toolset>msvc:<runtime-link>static <toolset>msvc:<link>static ;
run ../config_info.cpp : : : <threading>multi : config_info_threaded ;
run ../math_info.cpp : : : <toolset>borland:<runtime-link>static <toolset>borland:<link>static ;
run ../config_test.cpp : : : <threading>single <toolset>msvc:<runtime-link>static <toolset>msvc:<link>static ;
run ../config_test.cpp : : : <threading>multi : config_test_threaded ;
run ../limits_test.cpp ../../../test/build//boost_test_exec_monitor ;
run ../abi/abi_test.cpp ../abi/main.cpp ;
test-suite "BOOST_HAS_TWO_ARG_USE_FACET" :
[ run ../has_2arg_use_facet_pass.cpp ]
[ compile-fail ../has_2arg_use_facet_fail.cpp ] ;
test-suite "BOOST_HAS_BETHREADS" :
[ run ../has_bethreads_pass.cpp ]
[ compile-fail ../has_bethreads_fail.cpp ] ;
test-suite "BOOST_HAS_CLOCK_GETTIME" :
[ run ../has_clock_gettime_pass.cpp ]
[ compile-fail ../has_clock_gettime_fail.cpp ] ;
test-suite "BOOST_HAS_DIRENT_H" :
[ run ../has_dirent_h_pass.cpp ]
[ compile-fail ../has_dirent_h_fail.cpp ] ;
test-suite "BOOST_HAS_EXPM1" :
[ run ../has_expm1_pass.cpp ]
[ compile-fail ../has_expm1_fail.cpp ] ;
test-suite "BOOST_HAS_FLOAT128" :
[ run ../has_float128_pass.cpp ]
[ compile-fail ../has_float128_fail.cpp ] ;
test-suite "BOOST_HAS_FTIME" :
[ run ../has_ftime_pass.cpp ]
[ compile-fail ../has_ftime_fail.cpp ] ;
test-suite "BOOST_HAS_GETSYSTEMTIMEASFILETIME" :
[ run ../has_getsystemtimeasfiletime_pass.cpp ]
[ compile-fail ../has_getsystemtimeasfiletime_fail.cpp ] ;
test-suite "BOOST_HAS_GETTIMEOFDAY" :
[ run ../has_gettimeofday_pass.cpp ]
[ compile-fail ../has_gettimeofday_fail.cpp ] ;
test-suite "BOOST_HAS_HASH" :
[ run ../has_hash_pass.cpp ]
[ compile-fail ../has_hash_fail.cpp ] ;
test-suite "BOOST_HAS_INT128" :
[ run ../has_int128_pass.cpp ]
[ compile-fail ../has_int128_fail.cpp ] ;
test-suite "BOOST_HAS_LOG1P" :
[ run ../has_log1p_pass.cpp ]
[ compile-fail ../has_log1p_fail.cpp ] ;
test-suite "BOOST_HAS_LONG_LONG" :
[ run ../has_long_long_pass.cpp ]
[ compile-fail ../has_long_long_fail.cpp ] ;
test-suite "BOOST_HAS_MACRO_USE_FACET" :
[ run ../has_macro_use_facet_pass.cpp ]
[ compile-fail ../has_macro_use_facet_fail.cpp ] ;
test-suite "BOOST_HAS_MS_INT64" :
[ run ../has_ms_int64_pass.cpp ]
[ compile-fail ../has_ms_int64_fail.cpp ] ;
test-suite "BOOST_HAS_NANOSLEEP" :
[ run ../has_nanosleep_pass.cpp ]
[ compile-fail ../has_nanosleep_fail.cpp ] ;
test-suite "BOOST_HAS_NL_TYPES_H" :
[ run ../has_nl_types_h_pass.cpp ]
[ compile-fail ../has_nl_types_h_fail.cpp ] ;
test-suite "BOOST_HAS_NRVO" :
[ run ../has_nrvo_pass.cpp ]
[ compile-fail ../has_nrvo_fail.cpp ] ;
test-suite "BOOST_HAS_PARTIAL_STD_ALLOCATOR" :
[ run ../has_part_alloc_pass.cpp ]
[ compile-fail ../has_part_alloc_fail.cpp ] ;
test-suite "BOOST_HAS_PTHREAD_DELAY_NP" :
[ run ../has_pthread_delay_np_pass.cpp ]
[ compile-fail ../has_pthread_delay_np_fail.cpp ] ;
test-suite "BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE" :
[ run ../has_pthread_ma_st_pass.cpp ]
[ compile-fail ../has_pthread_ma_st_fail.cpp ] ;
test-suite "BOOST_HAS_PTHREAD_YIELD" :
[ run ../has_pthread_yield_pass.cpp ]
[ compile-fail ../has_pthread_yield_fail.cpp ] ;
test-suite "BOOST_HAS_PTHREADS" :
[ run ../has_pthreads_pass.cpp ]
[ compile-fail ../has_pthreads_fail.cpp ] ;
test-suite "BOOST_HAS_RVALUE_REFS" :
[ run ../has_rvalue_refs_pass.cpp ]
[ compile-fail ../has_rvalue_refs_fail.cpp ] ;
test-suite "BOOST_HAS_SCHED_YIELD" :
[ run ../has_sched_yield_pass.cpp ]
[ compile-fail ../has_sched_yield_fail.cpp ] ;
test-suite "BOOST_HAS_SGI_TYPE_TRAITS" :
[ run ../has_sgi_type_traits_pass.cpp ]
[ compile-fail ../has_sgi_type_traits_fail.cpp ] ;
test-suite "BOOST_HAS_SIGACTION" :
[ run ../has_sigaction_pass.cpp ]
[ compile-fail ../has_sigaction_fail.cpp ] ;
test-suite "BOOST_HAS_SLIST" :
[ run ../has_slist_pass.cpp ]
[ compile-fail ../has_slist_fail.cpp ] ;
test-suite "BOOST_HAS_STATIC_ASSERT" :
[ run ../has_static_assert_pass.cpp ]
[ compile-fail ../has_static_assert_fail.cpp ] ;
test-suite "BOOST_HAS_STDINT_H" :
[ run ../has_stdint_h_pass.cpp ]
[ compile-fail ../has_stdint_h_fail.cpp ] ;
test-suite "BOOST_HAS_STLP_USE_FACET" :
[ run ../has_stlp_use_facet_pass.cpp ]
[ compile-fail ../has_stlp_use_facet_fail.cpp ] ;
test-suite "BOOST_HAS_TR1_ARRAY" :
[ run ../has_tr1_array_pass.cpp ]
[ compile-fail ../has_tr1_array_fail.cpp ] ;
test-suite "BOOST_HAS_TR1_BIND" :
[ run ../has_tr1_bind_pass.cpp ]
[ compile-fail ../has_tr1_bind_fail.cpp ] ;
test-suite "BOOST_HAS_TR1_COMPLEX_OVERLOADS" :
[ run ../has_tr1_complex_over_pass.cpp ]
[ compile-fail ../has_tr1_complex_over_fail.cpp ] ;
test-suite "BOOST_HAS_TR1_COMPLEX_INVERSE_TRIG" :
[ run ../has_tr1_complex_trig_pass.cpp ]
[ compile-fail ../has_tr1_complex_trig_fail.cpp ] ;
test-suite "BOOST_HAS_TR1_FUNCTION" :
[ run ../has_tr1_function_pass.cpp ]
[ compile-fail ../has_tr1_function_fail.cpp ] ;
test-suite "BOOST_HAS_TR1_HASH" :
[ run ../has_tr1_hash_pass.cpp ]
[ compile-fail ../has_tr1_hash_fail.cpp ] ;
test-suite "BOOST_HAS_TR1_MEM_FN" :
[ run ../has_tr1_mem_fn_pass.cpp ]
[ compile-fail ../has_tr1_mem_fn_fail.cpp ] ;
test-suite "BOOST_HAS_TR1_RANDOM" :
[ run ../has_tr1_random_pass.cpp ]
[ compile-fail ../has_tr1_random_fail.cpp ] ;
test-suite "BOOST_HAS_TR1_REFERENCE_WRAPPER" :
[ run ../has_tr1_ref_wrap_pass.cpp ]
[ compile-fail ../has_tr1_ref_wrap_fail.cpp ] ;
test-suite "BOOST_HAS_TR1_REGEX" :
[ run ../has_tr1_regex_pass.cpp ]
[ compile-fail ../has_tr1_regex_fail.cpp ] ;
test-suite "BOOST_HAS_TR1_RESULT_OF" :
[ run ../has_tr1_result_of_pass.cpp ]
[ compile-fail ../has_tr1_result_of_fail.cpp ] ;
test-suite "BOOST_HAS_TR1_SHARED_PTR" :
[ run ../has_tr1_shared_ptr_pass.cpp ]
[ compile-fail ../has_tr1_shared_ptr_fail.cpp ] ;
test-suite "BOOST_HAS_TR1_TUPLE" :
[ run ../has_tr1_tuple_pass.cpp ]
[ compile-fail ../has_tr1_tuple_fail.cpp ] ;
test-suite "BOOST_HAS_TR1_TYPE_TRAITS" :
[ run ../has_tr1_type_traits_pass.cpp ]
[ compile-fail ../has_tr1_type_traits_fail.cpp ] ;
test-suite "BOOST_HAS_TR1_UNORDERED_MAP" :
[ run ../has_tr1_unordered_map_pass.cpp ]
[ compile-fail ../has_tr1_unordered_map_fail.cpp ] ;
test-suite "BOOST_HAS_TR1_UNORDERED_SET" :
[ run ../has_tr1_unordered_set_pass.cpp ]
[ compile-fail ../has_tr1_unordered_set_fail.cpp ] ;
test-suite "BOOST_HAS_TR1_UTILITY" :
[ run ../has_tr1_utility_pass.cpp ]
[ compile-fail ../has_tr1_utility_fail.cpp ] ;
test-suite "BOOST_HAS_UNISTD_H" :
[ run ../has_unistd_h_pass.cpp ]
[ compile-fail ../has_unistd_h_fail.cpp ] ;
test-suite "BOOST_HAS_VARIADIC_TMPL" :
[ run ../has_variadic_tmpl_pass.cpp ]
[ compile-fail ../has_variadic_tmpl_fail.cpp ] ;
test-suite "BOOST_MSVC6_MEMBER_TEMPLATES" :
[ run ../has_vc6_mem_templ_pass.cpp ]
[ compile-fail ../has_vc6_mem_templ_fail.cpp ] ;
test-suite "BOOST_MSVC_STD_ITERATOR" :
[ run ../has_vc_iterator_pass.cpp ]
[ compile-fail ../has_vc_iterator_fail.cpp ] ;
test-suite "BOOST_HAS_WINTHREADS" :
[ run ../has_winthreads_pass.cpp ]
[ compile-fail ../has_winthreads_fail.cpp ] ;
test-suite "BOOST_NO_ADL_BARRIER" :
[ run ../no_adl_barrier_pass.cpp ]
[ compile-fail ../no_adl_barrier_fail.cpp ] ;
test-suite "BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP" :
[ run ../no_arg_dep_lookup_pass.cpp ]
[ compile-fail ../no_arg_dep_lookup_fail.cpp ] ;
test-suite "BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS" :
[ run ../no_array_type_spec_pass.cpp ]
[ compile-fail ../no_array_type_spec_fail.cpp ] ;
test-suite "BOOST_NO_CXX11_AUTO_DECLARATIONS" :
[ run ../no_auto_declarations_pass.cpp ]
[ compile-fail ../no_auto_declarations_fail.cpp ] ;
test-suite "BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS" :
[ run ../no_auto_multidecl_pass.cpp ]
[ compile-fail ../no_auto_multidecl_fail.cpp ] ;
test-suite "BOOST_NO_AUTO_PTR" :
[ run ../no_auto_ptr_pass.cpp ]
[ compile-fail ../no_auto_ptr_fail.cpp ] ;
test-suite "BOOST_BCB_PARTIAL_SPECIALIZATION_BUG" :
[ run ../no_bcb_partial_spec_pass.cpp ]
[ compile-fail ../no_bcb_partial_spec_fail.cpp ] ;
test-suite "BOOST_NO_CXX11_CHAR16_T" :
[ run ../no_char16_t_pass.cpp ]
[ compile-fail ../no_char16_t_fail.cpp ] ;
test-suite "BOOST_NO_CXX11_CHAR32_T" :
[ run ../no_char32_t_pass.cpp ]
[ compile-fail ../no_char32_t_fail.cpp ] ;
test-suite "BOOST_NO_COMPLETE_VALUE_INITIALIZATION" :
[ run ../no_com_value_init_pass.cpp ]
[ compile-fail ../no_com_value_init_fail.cpp ] ;
test-suite "BOOST_NO_CXX11_CONSTEXPR" :
[ run ../no_constexpr_pass.cpp ]
[ compile-fail ../no_constexpr_fail.cpp ] ;
test-suite "BOOST_NO_CTYPE_FUNCTIONS" :
[ run ../no_ctype_functions_pass.cpp ]
[ compile-fail ../no_ctype_functions_fail.cpp ] ;
test-suite "BOOST_NO_CV_SPECIALIZATIONS" :
[ run ../no_cv_spec_pass.cpp ]
[ compile-fail ../no_cv_spec_fail.cpp ] ;
test-suite "BOOST_NO_CV_VOID_SPECIALIZATIONS" :
[ run ../no_cv_void_spec_pass.cpp ]
[ compile-fail ../no_cv_void_spec_fail.cpp ] ;
test-suite "BOOST_NO_CWCHAR" :
[ run ../no_cwchar_pass.cpp ]
[ compile-fail ../no_cwchar_fail.cpp ] ;
test-suite "BOOST_NO_CWCTYPE" :
[ run ../no_cwctype_pass.cpp ]
[ compile-fail ../no_cwctype_fail.cpp ] ;
test-suite "BOOST_NO_CXX11_ADDRESSOF" :
[ run ../no_cxx11_addressof_pass.cpp ]
[ compile-fail ../no_cxx11_addressof_fail.cpp ] ;
test-suite "BOOST_NO_CXX11_ALIGNAS" :
[ run ../no_cxx11_alignas_pass.cpp ]
[ compile-fail ../no_cxx11_alignas_fail.cpp ] ;
test-suite "BOOST_NO_CXX11_ALLOCATOR" :
[ run ../no_cxx11_allocator_pass.cpp ]
[ compile-fail ../no_cxx11_allocator_fail.cpp ] ;
test-suite "BOOST_NO_CXX11_ATOMIC_SMART_PTR" :
[ run ../no_cxx11_atomic_sp_pass.cpp ]
[ compile-fail ../no_cxx11_atomic_sp_fail.cpp ] ;
test-suite "BOOST_NO_CXX11_FINAL" :
[ run ../no_cxx11_final_pass.cpp ]
[ compile-fail ../no_cxx11_final_fail.cpp ] ;
test-suite "BOOST_NO_CXX11_HDR_ARRAY" :
[ run ../no_cxx11_hdr_array_pass.cpp ]
[ compile-fail ../no_cxx11_hdr_array_fail.cpp ] ;
test-suite "BOOST_NO_CXX11_HDR_ATOMIC" :
[ run ../no_cxx11_hdr_atomic_pass.cpp ]
[ compile-fail ../no_cxx11_hdr_atomic_fail.cpp ] ;
test-suite "BOOST_NO_CXX11_HDR_CHRONO" :
[ run ../no_cxx11_hdr_chrono_pass.cpp ]
[ compile-fail ../no_cxx11_hdr_chrono_fail.cpp ] ;
test-suite "BOOST_NO_CXX11_HDR_CODECVT" :
[ run ../no_cxx11_hdr_codecvt_pass.cpp ]
[ compile-fail ../no_cxx11_hdr_codecvt_fail.cpp ] ;
test-suite "BOOST_NO_CXX11_HDR_CONDITION_VARIABLE" :
[ run ../no_cxx11_hdr_condition_variable_pass.cpp ]
[ compile-fail ../no_cxx11_hdr_condition_variable_fail.cpp ] ;
test-suite "BOOST_NO_CXX11_HDR_FORWARD_LIST" :
[ run ../no_cxx11_hdr_forward_list_pass.cpp ]
[ compile-fail ../no_cxx11_hdr_forward_list_fail.cpp ] ;
test-suite "BOOST_NO_CXX11_HDR_FUTURE" :
[ run ../no_cxx11_hdr_future_pass.cpp ]
[ compile-fail ../no_cxx11_hdr_future_fail.cpp ] ;
test-suite "BOOST_NO_CXX11_HDR_INITIALIZER_LIST" :
[ run ../no_cxx11_hdr_initializer_list_pass.cpp ]
[ compile-fail ../no_cxx11_hdr_initializer_list_fail.cpp ] ;
test-suite "BOOST_NO_CXX11_HDR_MUTEX" :
[ run ../no_cxx11_hdr_mutex_pass.cpp ]
[ compile-fail ../no_cxx11_hdr_mutex_fail.cpp ] ;
test-suite "BOOST_NO_CXX11_HDR_RANDOM" :
[ run ../no_cxx11_hdr_random_pass.cpp ]
[ compile-fail ../no_cxx11_hdr_random_fail.cpp ] ;
test-suite "BOOST_NO_CXX11_HDR_RATIO" :
[ run ../no_cxx11_hdr_ratio_pass.cpp ]
[ compile-fail ../no_cxx11_hdr_ratio_fail.cpp ] ;
test-suite "BOOST_NO_CXX11_HDR_REGEX" :
[ run ../no_cxx11_hdr_regex_pass.cpp ]
[ compile-fail ../no_cxx11_hdr_regex_fail.cpp ] ;
test-suite "BOOST_NO_CXX11_HDR_SYSTEM_ERROR" :
[ run ../no_cxx11_hdr_system_error_pass.cpp ]
[ compile-fail ../no_cxx11_hdr_system_error_fail.cpp ] ;
test-suite "BOOST_NO_CXX11_HDR_THREAD" :
[ run ../no_cxx11_hdr_thread_pass.cpp ]
[ compile-fail ../no_cxx11_hdr_thread_fail.cpp ] ;
test-suite "BOOST_NO_CXX11_HDR_TUPLE" :
[ run ../no_cxx11_hdr_tuple_pass.cpp ]
[ compile-fail ../no_cxx11_hdr_tuple_fail.cpp ] ;
test-suite "BOOST_NO_CXX11_HDR_TYPE_TRAITS" :
[ run ../no_cxx11_hdr_type_traits_pass.cpp ]
[ compile-fail ../no_cxx11_hdr_type_traits_fail.cpp ] ;
test-suite "BOOST_NO_CXX11_HDR_TYPEINDEX" :
[ run ../no_cxx11_hdr_typeindex_pass.cpp ]
[ compile-fail ../no_cxx11_hdr_typeindex_fail.cpp ] ;
test-suite "BOOST_NO_CXX11_HDR_UNORDERED_MAP" :
[ run ../no_cxx11_hdr_unordered_map_pass.cpp ]
[ compile-fail ../no_cxx11_hdr_unordered_map_fail.cpp ] ;
test-suite "BOOST_NO_CXX11_HDR_UNORDERED_SET" :
[ run ../no_cxx11_hdr_unordered_set_pass.cpp ]
[ compile-fail ../no_cxx11_hdr_unordered_set_fail.cpp ] ;
test-suite "BOOST_NO_CXX11_INLINE_NAMESPACES" :
[ run ../no_cxx11_inline_namespaces_pass.cpp ]
[ compile-fail ../no_cxx11_inline_namespaces_fail.cpp ] ;
test-suite "BOOST_NO_CXX11_NON_PUBLIC_DEFAULTED_FUNCTIONS" :
[ run ../no_cxx11_non_pub_def_fun_pass.cpp ]
[ compile-fail ../no_cxx11_non_pub_def_fun_fail.cpp ] ;
test-suite "BOOST_NO_CXX11_NUMERIC_LIMITS" :
[ run ../no_cxx11_numeric_limits_pass.cpp ]
[ compile-fail ../no_cxx11_numeric_limits_fail.cpp ] ;
test-suite "BOOST_NO_CXX11_REF_QUALIFIERS" :
[ run ../no_cxx11_ref_qualifiers_pass.cpp ]
[ compile-fail ../no_cxx11_ref_qualifiers_fail.cpp ] ;
test-suite "BOOST_NO_CXX11_SMART_PTR" :
[ run ../no_cxx11_smart_ptr_pass.cpp ]
[ compile-fail ../no_cxx11_smart_ptr_fail.cpp ] ;
test-suite "BOOST_NO_CXX11_STD_ALIGN" :
[ run ../no_cxx11_std_align_pass.cpp ]
[ compile-fail ../no_cxx11_std_align_fail.cpp ] ;
test-suite "BOOST_NO_CXX11_THREAD_LOCAL" :
[ run ../no_cxx11_thread_local_pass.cpp ]
[ compile-fail ../no_cxx11_thread_local_fail.cpp ] ;
test-suite "BOOST_NO_CXX11_TRAILING_RESULT_TYPES" :
[ run ../no_cxx11_trailing_result_types_pass.cpp ]
[ compile-fail ../no_cxx11_trailing_result_types_fail.cpp ] ;
test-suite "BOOST_NO_CXX11_USER_DEFINED_LITERALS" :
[ run ../no_cxx11_user_lit_pass.cpp ]
[ compile-fail ../no_cxx11_user_lit_fail.cpp ] ;
test-suite "BOOST_NO_CXX14_BINARY_LITERALS" :
[ run ../no_cxx14_binary_literals_pass.cpp ]
[ compile-fail ../no_cxx14_binary_literals_fail.cpp ] ;
test-suite "BOOST_NO_CXX14_CONSTEXPR" :
[ run ../no_cxx14_constexpr_pass.cpp ]
[ compile-fail ../no_cxx14_constexpr_fail.cpp ] ;
test-suite "BOOST_NO_CXX14_DECLTYPE_AUTO" :
[ run ../no_cxx14_decltype_auto_pass.cpp ]
[ compile-fail ../no_cxx14_decltype_auto_fail.cpp ] ;
test-suite "BOOST_NO_CXX14_DIGIT_SEPARATORS" :
[ run ../no_cxx14_digit_separator_pass.cpp ]
[ compile-fail ../no_cxx14_digit_separator_fail.cpp ] ;
test-suite "BOOST_NO_CXX14_GENERIC_LAMBDAS" :
[ run ../no_cxx14_generic_lambda_pass.cpp ]
[ compile-fail ../no_cxx14_generic_lambda_fail.cpp ] ;
test-suite "BOOST_NO_CXX14_HDR_SHARED_MUTEX" :
[ run ../no_cxx14_hdr_shared_mutex_pass.cpp ]
[ compile-fail ../no_cxx14_hdr_shared_mutex_fail.cpp ] ;
test-suite "BOOST_NO_CXX14_INITIALIZED_LAMBDA_CAPTURES" :
[ run ../no_cxx14_lambda_capture_pass.cpp ]
[ compile-fail ../no_cxx14_lambda_capture_fail.cpp ] ;
test-suite "BOOST_NO_CXX14_AGGREGATE_NSDMI" :
[ run ../no_cxx14_member_init_pass.cpp ]
[ compile-fail ../no_cxx14_member_init_fail.cpp ] ;
test-suite "BOOST_NO_CXX14_RETURN_TYPE_DEDUCTION" :
[ run ../no_cxx14_return_type_ded_pass.cpp ]
[ compile-fail ../no_cxx14_return_type_ded_fail.cpp ] ;
test-suite "BOOST_NO_CXX14_STD_EXCHANGE" :
[ run ../no_cxx14_std_exchange_pass.cpp ]
[ compile-fail ../no_cxx14_std_exchange_fail.cpp ] ;
test-suite "BOOST_NO_CXX14_VARIABLE_TEMPLATES" :
[ run ../no_cxx14_var_templ_pass.cpp ]
[ compile-fail ../no_cxx14_var_templ_fail.cpp ] ;
test-suite "BOOST_NO_CXX17_STD_APPLY" :
[ run ../no_cxx17_std_apply_pass.cpp ]
[ compile-fail ../no_cxx17_std_apply_fail.cpp ] ;
test-suite "BOOST_NO_CXX17_STD_INVOKE" :
[ run ../no_cxx17_std_invoke_pass.cpp ]
[ compile-fail ../no_cxx17_std_invoke_fail.cpp ] ;
test-suite "BOOST_NO_CXX11_HDR_FUNCTIONAL" :
[ run ../no_cxx_hdr_functional_pass.cpp ]
[ compile-fail ../no_cxx_hdr_functional_fail.cpp ] ;
test-suite "BOOST_NO_CXX11_DECLTYPE" :
[ run ../no_decltype_pass.cpp ]
[ compile-fail ../no_decltype_fail.cpp ] ;
test-suite "BOOST_NO_CXX11_DECLTYPE_N3276" :
[ run ../no_decltype_n3276_pass.cpp ]
[ compile-fail ../no_decltype_n3276_fail.cpp ] ;
test-suite "BOOST_DEDUCED_TYPENAME" :
[ run ../no_ded_typename_pass.cpp ]
[ compile-fail ../no_ded_typename_fail.cpp ] ;
test-suite "BOOST_NO_CXX11_DEFAULTED_FUNCTIONS" :
[ run ../no_defaulted_functions_pass.cpp ]
[ compile-fail ../no_defaulted_functions_fail.cpp ] ;
test-suite "BOOST_NO_CXX11_DELETED_FUNCTIONS" :
[ run ../no_deleted_functions_pass.cpp ]
[ compile-fail ../no_deleted_functions_fail.cpp ] ;
test-suite "BOOST_NO_DEPENDENT_NESTED_DERIVATIONS" :
[ run ../no_dep_nested_class_pass.cpp ]
[ compile-fail ../no_dep_nested_class_fail.cpp ] ;
test-suite "BOOST_NO_DEPENDENT_TYPES_IN_TEMPLATE_VALUE_PARAMETERS" :
[ run ../no_dep_val_param_pass.cpp ]
[ compile-fail ../no_dep_val_param_fail.cpp ] ;
test-suite "BOOST_NO_EXCEPTION_STD_NAMESPACE" :
[ run ../no_excep_std_pass.cpp ]
[ compile-fail ../no_excep_std_fail.cpp ] ;
test-suite "BOOST_NO_EXCEPTIONS" :
[ run ../no_exceptions_pass.cpp ]
[ compile-fail ../no_exceptions_fail.cpp ] ;
test-suite "BOOST_NO_EXPLICIT_FUNCTION_TEMPLATE_ARGUMENTS" :
[ run ../no_exp_func_tem_arg_pass.cpp ]
[ compile-fail ../no_exp_func_tem_arg_fail.cpp ] ;
test-suite "BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS" :
[ run ../no_explicit_cvt_ops_pass.cpp ]
[ compile-fail ../no_explicit_cvt_ops_fail.cpp ] ;
test-suite "BOOST_NO_CXX11_EXTERN_TEMPLATE" :
[ run ../no_extern_template_pass.cpp ]
[ compile-fail ../no_extern_template_fail.cpp ] ;
test-suite "BOOST_NO_FENV_H" :
[ run ../no_fenv_h_pass.cpp ]
[ compile-fail ../no_fenv_h_fail.cpp ] ;
test-suite "BOOST_NO_CXX11_FIXED_LENGTH_VARIADIC_TEMPLATE_EXPANSION_PACKS" :
[ run ../no_fixed_len_variadic_templates_pass.cpp ]
[ compile-fail ../no_fixed_len_variadic_templates_fail.cpp ] ;
test-suite "BOOST_NO_FUNCTION_TEMPLATE_ORDERING" :
[ run ../no_func_tmp_order_pass.cpp ]
[ compile-fail ../no_func_tmp_order_fail.cpp ] ;
test-suite "BOOST_NO_CXX11_FUNCTION_TEMPLATE_DEFAULT_ARGS" :
[ run ../no_function_template_default_args_pass.cpp ]
[ compile-fail ../no_function_template_default_args_fail.cpp ] ;
test-suite "BOOST_NO_FUNCTION_TYPE_SPECIALIZATIONS" :
[ run ../no_function_type_spec_pass.cpp ]
[ compile-fail ../no_function_type_spec_fail.cpp ] ;
test-suite "BOOST_NO_MS_INT64_NUMERIC_LIMITS" :
[ run ../no_i64_limits_pass.cpp ]
[ compile-fail ../no_i64_limits_fail.cpp ] ;
test-suite "BOOST_NO_INCLASS_MEMBER_INITIALIZATION" :
[ run ../no_inline_memb_init_pass.cpp ]
[ compile-fail ../no_inline_memb_init_fail.cpp ] ;
test-suite "BOOST_NO_INTEGRAL_INT64_T" :
[ run ../no_integral_int64_t_pass.cpp ]
[ compile-fail ../no_integral_int64_t_fail.cpp ] ;
test-suite "BOOST_NO_IOSFWD" :
[ run ../no_iosfwd_pass.cpp ]
[ compile-fail ../no_iosfwd_fail.cpp ] ;
test-suite "BOOST_NO_IOSTREAM" :
[ run ../no_iostream_pass.cpp ]
[ compile-fail ../no_iostream_fail.cpp ] ;
test-suite "BOOST_NO_IS_ABSTRACT" :
[ run ../no_is_abstract_pass.cpp ]
[ compile-fail ../no_is_abstract_fail.cpp ] ;
test-suite "BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS" :
[ run ../no_iter_construct_pass.cpp ]
[ compile-fail ../no_iter_construct_fail.cpp ] ;
test-suite "BOOST_NO_CXX11_LAMBDAS" :
[ run ../no_lambdas_pass.cpp ]
[ compile-fail ../no_lambdas_fail.cpp ] ;
test-suite "BOOST_NO_LIMITS" :
[ run ../no_limits_pass.cpp ]
[ compile-fail ../no_limits_fail.cpp ] ;
test-suite "BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS" :
[ run ../no_limits_const_exp_pass.cpp ]
[ compile-fail ../no_limits_const_exp_fail.cpp ] ;
test-suite "BOOST_NO_LONG_LONG_NUMERIC_LIMITS" :
[ run ../no_ll_limits_pass.cpp ]
[ compile-fail ../no_ll_limits_fail.cpp ] ;
test-suite "BOOST_NO_LONG_LONG" :
[ run ../no_long_long_pass.cpp ]
[ compile-fail ../no_long_long_fail.cpp ] ;
test-suite "BOOST_NO_MEMBER_FUNCTION_SPECIALIZATIONS" :
[ run ../no_mem_func_spec_pass.cpp ]
[ compile-fail ../no_mem_func_spec_fail.cpp ] ;
test-suite "BOOST_NO_MEMBER_TEMPLATE_KEYWORD" :
[ run ../no_mem_tem_keyword_pass.cpp ]
[ compile-fail ../no_mem_tem_keyword_fail.cpp ] ;
test-suite "BOOST_NO_POINTER_TO_MEMBER_TEMPLATE_PARAMETERS" :
[ run ../no_mem_tem_pnts_pass.cpp ]
[ compile-fail ../no_mem_tem_pnts_fail.cpp ] ;
test-suite "BOOST_NO_MEMBER_TEMPLATE_FRIENDS" :
[ run ../no_mem_templ_frnds_pass.cpp ]
[ compile-fail ../no_mem_templ_frnds_fail.cpp ] ;
test-suite "BOOST_NO_MEMBER_TEMPLATES" :
[ run ../no_mem_templates_pass.cpp ]
[ compile-fail ../no_mem_templates_fail.cpp ] ;
test-suite "BOOST_NO_NESTED_FRIENDSHIP" :
[ run ../no_nested_friendship_pass.cpp ]
[ compile-fail ../no_nested_friendship_fail.cpp ] ;
test-suite "BOOST_NO_CXX11_NOEXCEPT" :
[ run ../no_noexcept_pass.cpp ]
[ compile-fail ../no_noexcept_fail.cpp ] ;
test-suite "BOOST_NO_CXX11_NULLPTR" :
[ run ../no_nullptr_pass.cpp ]
[ compile-fail ../no_nullptr_fail.cpp ] ;
test-suite "BOOST_NO_OPERATORS_IN_NAMESPACE" :
[ run ../no_ops_in_namespace_pass.cpp ]
[ compile-fail ../no_ops_in_namespace_fail.cpp ] ;
test-suite "BOOST_NO_PARTIAL_SPECIALIZATION_IMPLICIT_DEFAULT_ARGS" :
[ run ../no_part_spec_def_args_pass.cpp ]
[ compile-fail ../no_part_spec_def_args_fail.cpp ] ;
test-suite "BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION" :
[ run ../no_partial_spec_pass.cpp ]
[ compile-fail ../no_partial_spec_fail.cpp ] ;
test-suite "BOOST_NO_PRIVATE_IN_AGGREGATE" :
[ run ../no_priv_aggregate_pass.cpp ]
[ compile-fail ../no_priv_aggregate_fail.cpp ] ;
test-suite "BOOST_NO_POINTER_TO_MEMBER_CONST" :
[ run ../no_ptr_mem_const_pass.cpp ]
[ compile-fail ../no_ptr_mem_const_fail.cpp ] ;
test-suite "BOOST_NO_CXX11_RANGE_BASED_FOR" :
[ run ../no_range_based_for_pass.cpp ]
[ compile-fail ../no_range_based_for_fail.cpp ] ;
test-suite "BOOST_NO_CXX11_RAW_LITERALS" :
[ run ../no_raw_literals_pass.cpp ]
[ compile-fail ../no_raw_literals_fail.cpp ] ;
test-suite "BOOST_NO_UNREACHABLE_RETURN_DETECTION" :
[ run ../no_ret_det_pass.cpp ]
[ compile-fail ../no_ret_det_fail.cpp ] ;
test-suite "BOOST_NO_RTTI" :
[ run ../no_rtti_pass.cpp ]
[ compile-fail ../no_rtti_fail.cpp ] ;
test-suite "BOOST_NO_CXX11_RVALUE_REFERENCES" :
[ run ../no_rvalue_references_pass.cpp ]
[ compile-fail ../no_rvalue_references_fail.cpp ] ;
test-suite "BOOST_NO_CXX11_SCOPED_ENUMS" :
[ run ../no_scoped_enums_pass.cpp ]
[ compile-fail ../no_scoped_enums_fail.cpp ] ;
test-suite "BOOST_NO_SFINAE" :
[ run ../no_sfinae_pass.cpp ]
[ compile-fail ../no_sfinae_fail.cpp ] ;
test-suite "BOOST_NO_SFINAE_EXPR" :
[ run ../no_sfinae_expr_pass.cpp ]
[ compile-fail ../no_sfinae_expr_fail.cpp ] ;
test-suite "BOOST_NO_STRINGSTREAM" :
[ run ../no_sstream_pass.cpp ]
[ compile-fail ../no_sstream_fail.cpp ] ;
test-suite "BOOST_NO_CXX11_STATIC_ASSERT" :
[ run ../no_static_assert_pass.cpp ]
[ compile-fail ../no_static_assert_fail.cpp ] ;
test-suite "BOOST_NO_STD_ALLOCATOR" :
[ run ../no_std_allocator_pass.cpp ]
[ compile-fail ../no_std_allocator_fail.cpp ] ;
test-suite "BOOST_NO_STD_DISTANCE" :
[ run ../no_std_distance_pass.cpp ]
[ compile-fail ../no_std_distance_fail.cpp ] ;
test-suite "BOOST_NO_STD_ITERATOR_TRAITS" :
[ run ../no_std_iter_traits_pass.cpp ]
[ compile-fail ../no_std_iter_traits_fail.cpp ] ;
test-suite "BOOST_NO_STD_ITERATOR" :
[ run ../no_std_iterator_pass.cpp ]
[ compile-fail ../no_std_iterator_fail.cpp ] ;
test-suite "BOOST_NO_STD_LOCALE" :
[ run ../no_std_locale_pass.cpp ]
[ compile-fail ../no_std_locale_fail.cpp ] ;
test-suite "BOOST_NO_STD_MESSAGES" :
[ run ../no_std_messages_pass.cpp ]
[ compile-fail ../no_std_messages_fail.cpp ] ;
test-suite "BOOST_NO_STD_MIN_MAX" :
[ run ../no_std_min_max_pass.cpp ]
[ compile-fail ../no_std_min_max_fail.cpp ] ;
test-suite "BOOST_NO_STD_OUTPUT_ITERATOR_ASSIGN" :
[ run ../no_std_oi_assign_pass.cpp ]
[ compile-fail ../no_std_oi_assign_fail.cpp ] ;
test-suite "BOOST_NO_STD_TYPEINFO" :
[ run ../no_std_typeinfo_pass.cpp ]
[ compile-fail ../no_std_typeinfo_fail.cpp ] ;
test-suite "BOOST_NO_STD_USE_FACET" :
[ run ../no_std_use_facet_pass.cpp ]
[ compile-fail ../no_std_use_facet_fail.cpp ] ;
test-suite "BOOST_NO_STD_WSTREAMBUF" :
[ run ../no_std_wstreambuf_pass.cpp ]
[ compile-fail ../no_std_wstreambuf_fail.cpp ] ;
test-suite "BOOST_NO_STD_WSTRING" :
[ run ../no_std_wstring_pass.cpp ]
[ compile-fail ../no_std_wstring_fail.cpp ] ;
test-suite "BOOST_NO_STDC_NAMESPACE" :
[ run ../no_stdc_namespace_pass.cpp ]
[ compile-fail ../no_stdc_namespace_fail.cpp ] ;
test-suite "BOOST_NO_SWPRINTF" :
[ run ../no_swprintf_pass.cpp ]
[ compile-fail ../no_swprintf_fail.cpp ] ;
test-suite "BOOST_NO_CXX11_LOCAL_CLASS_TEMPLATE_PARAMETERS" :
[ run ../no_tem_local_classes_pass.cpp ]
[ compile-fail ../no_tem_local_classes_fail.cpp ] ;
test-suite "BOOST_NO_CXX11_TEMPLATE_ALIASES" :
[ run ../no_template_aliases_pass.cpp ]
[ compile-fail ../no_template_aliases_fail.cpp ] ;
test-suite "BOOST_NO_TEMPLATED_IOSTREAMS" :
[ run ../no_template_streams_pass.cpp ]
[ compile-fail ../no_template_streams_fail.cpp ] ;
test-suite "BOOST_NO_TEMPLATE_TEMPLATES" :
[ run ../no_template_template_pass.cpp ]
[ compile-fail ../no_template_template_fail.cpp ] ;
test-suite "BOOST_NO_TWO_PHASE_NAME_LOOKUP" :
[ run ../no_two_phase_lookup_pass.cpp ]
[ compile-fail ../no_two_phase_lookup_fail.cpp ] ;
test-suite "BOOST_NO_TYPEID" :
[ run ../no_typeid_pass.cpp ]
[ compile-fail ../no_typeid_fail.cpp ] ;
test-suite "BOOST_NO_TYPENAME_WITH_CTOR" :
[ run ../no_typename_with_ctor_pass.cpp ]
[ compile-fail ../no_typename_with_ctor_fail.cpp ] ;
test-suite "BOOST_NO_CXX11_UNICODE_LITERALS" :
[ run ../no_unicode_literals_pass.cpp ]
[ compile-fail ../no_unicode_literals_fail.cpp ] ;
test-suite "BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX" :
[ run ../no_unified_init_pass.cpp ]
[ compile-fail ../no_unified_init_fail.cpp ] ;
test-suite "BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL" :
[ run ../no_using_breaks_adl_pass.cpp ]
[ compile-fail ../no_using_breaks_adl_fail.cpp ] ;
test-suite "BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE" :
[ run ../no_using_decl_overld_pass.cpp ]
[ compile-fail ../no_using_decl_overld_fail.cpp ] ;
test-suite "BOOST_NO_USING_TEMPLATE" :
[ run ../no_using_template_pass.cpp ]
[ compile-fail ../no_using_template_fail.cpp ] ;
test-suite "BOOST_NO_CXX11_VARIADIC_MACROS" :
[ run ../no_variadic_macros_pass.cpp ]
[ compile-fail ../no_variadic_macros_fail.cpp ] ;
test-suite "BOOST_NO_CXX11_VARIADIC_TEMPLATES" :
[ run ../no_variadic_templates_pass.cpp ]
[ compile-fail ../no_variadic_templates_fail.cpp ] ;
test-suite "BOOST_NO_VOID_RETURNS" :
[ run ../no_void_returns_pass.cpp ]
[ compile-fail ../no_void_returns_fail.cpp ] ;
test-suite "BOOST_NO_INTRINSIC_WCHAR_T" :
[ run ../no_wchar_t_pass.cpp ]
[ compile-fail ../no_wchar_t_fail.cpp ] ;
+12
View File
@@ -0,0 +1,12 @@
# copyright John Maddock 2003
# Use, modification and distribution are subject to the
# Boost Software License, Version 1.0. (See accompanying file
# LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
project
: requirements
# threading tests require thread support turned on:
<threading>multi
;
local test-requirements = <library>../../test/build//boost_test_exec_monitor ;
@@ -0,0 +1,20 @@
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#include <boost/config.hpp>
int test(int n)
{
switch (n)
{
case 0:
n++;
BOOST_FALLTHROUGH;
case 1:
n++;
break;
}
return n;
}
@@ -0,0 +1,32 @@
// (C) Copyright John Maddock 2001.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for most recent version.
// MACRO: BOOST_HAS_TWO_ARG_USE_FACET
// TITLE: two argument version of use_facet
// DESCRIPTION: The standard library lacks a conforming std::use_facet,
// but has a two argument version that does the job.
// This is primarily for the Rogue Wave std lib.
#include <locale>
namespace boost_has_two_arg_use_facet{
int test()
{
std::locale l;
const std::ctype<char>& ct = std::use_facet(l, (std::ctype<char>*)0);
return 0;
}
}
+34
View File
@@ -0,0 +1,34 @@
// (C) Copyright John Maddock 2001.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for most recent version.
// MACRO: BOOST_HAS_BETHREADS
// TITLE: BeOS Threads
// DESCRIPTION: The platform supports BeOS style threads.
#include <OS.h>
namespace boost_has_bethreads{
int test()
{
sem_id mut = create_sem(1, "test");
if(mut > 0)
{
acquire_sem(mut);
release_sem(mut);
delete_sem(mut);
}
return 0;
}
}
@@ -0,0 +1,35 @@
// (C) Copyright John Maddock 2001.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for most recent version.
// MACRO: BOOST_HAS_CLOCK_GETTIME
// TITLE: clock_gettime
// DESCRIPTION: The platform supports POSIX standard API clock_gettime.
#include <time.h>
namespace boost_has_clock_gettime{
void f()
{
// this is never called, it just has to compile:
timespec tp;
int res = clock_gettime(CLOCK_REALTIME, &tp);
(void) &res;
}
int test()
{
return 0;
}
}
+30
View File
@@ -0,0 +1,30 @@
// (C) Copyright John Maddock 2002.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for most recent version.
// MACRO: BOOST_HAS_DIRENT_H
// TITLE: <dirent.h>
// DESCRIPTION: The platform has an <dirent.h>.
#include <dirent.h>
namespace boost_has_dirent_h{
int test()
{
DIR* pd = opendir("foobar");
if(pd) closedir(pd);
return 0;
}
}
+25
View File
@@ -0,0 +1,25 @@
// (C) Copyright John Maddock 2005.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for most recent version.
// MACRO: BOOST_HAS_EXPM1
// TITLE: expm1
// DESCRIPTION: The std lib has a C99-conforming expm1 function.
#include <math.h>
namespace boost_has_expm1{
int test()
{
double x = 0.5;
x = ::expm1(x);
(void)x;
return 0;
}
}
+29
View File
@@ -0,0 +1,29 @@
// (C) Copyright John Maddock 2012.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for most recent version.
// MACRO: BOOST_HAS_FLOAT128
// TITLE: __float128
// DESCRIPTION: The platform supports __float128.
#include <cstdlib>
namespace boost_has_float128{
int test()
{
#ifdef __GNUC__
__extension__ __float128 big_float = 0.0Q;
#else
__float128 big_float = 0.0Q;
#endif
(void)&big_float;
return 0;
}
}
+32
View File
@@ -0,0 +1,32 @@
// (C) Copyright John Maddock 2001.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for most recent version.
// MACRO: BOOST_HAS_FTIME
// TITLE: The platform has FTIME.
// DESCRIPTION: The platform supports the Win32 API type FTIME.
#include <windows.h>
namespace boost_has_ftime{
void f(FILETIME)
{
// this is never called, it just has to compile:
}
int test()
{
return 0;
}
}
@@ -0,0 +1,30 @@
// (C) Copyright John Maddock 2011.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for most recent version.
// MACRO: BOOST_HAS_GETSYSTEMTIMEASFILETIME
// TITLE: GetSystemTimeAsFileTime
// DESCRIPTION: The platform supports Win32 API GetSystemTimeAsFileTime.
#include <windows.h>
namespace boost_has_getsystemtimeasfiletime{
void f()
{
// this is never called, it just has to compile:
FILETIME ft;
GetSystemTimeAsFileTime(&ft);
}
int test()
{
return 0;
}
}
@@ -0,0 +1,35 @@
// (C) Copyright John Maddock 2001.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for most recent version.
// MACRO: BOOST_HAS_GETTIMEOFDAY
// TITLE: gettimeofday
// DESCRIPTION: The platform supports POSIX standard API gettimeofday.
#include <sys/time.h>
namespace boost_has_gettimeofday{
void f()
{
// this is never called, it just has to compile:
timeval tp;
int res = gettimeofday(&tp, 0);
(void) &res;
}
int test()
{
return 0;
}
}
+68
View File
@@ -0,0 +1,68 @@
// (C) Copyright John Maddock 2001.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for most recent version.
// MACRO: BOOST_HAS_HASH
// TITLE: <hashset> and <hashmap>
// DESCRIPTION: The C++ implementation provides the (SGI) hash_set
// or hash_map classes.
#if defined(__GLIBCXX__) || (defined(__GLIBCPP__) && __GLIBCPP__>=20020514) // GCC >= 3.1.0
# ifdef BOOST_NO_CXX11_STD_UNORDERED
# define BOOST_STD_EXTENSION_NAMESPACE __gnu_cxx
# define _BACKWARD_BACKWARD_WARNING_H 1 /* turn off warnings from the headers below */
# include <ext/hash_set>
# include <ext/hash_map>
# else
// If we have BOOST_NO_CXX11_STD_UNORDERED *not* defined, then we must
// not include the <ext/*> headers as they clash with the C++0x
// headers. ie in any given translation unit we can include one
// or the other, but not both.
# define DISABLE_BOOST_HAS_HASH_TEST
# endif
#else
#include <hash_set>
#include <hash_map>
#endif
#ifndef BOOST_STD_EXTENSION_NAMESPACE
#define BOOST_STD_EXTENSION_NAMESPACE std
#endif
namespace boost_has_hash{
#ifndef DISABLE_BOOST_HAS_HASH_TEST
template <class Key, class Eq, class Hash, class Alloc>
void foo(const BOOST_STD_EXTENSION_NAMESPACE::hash_set<Key,Eq,Hash,Alloc>& )
{
}
template <class Key, class T, class Eq, class Hash, class Alloc>
void foo(const BOOST_STD_EXTENSION_NAMESPACE::hash_map<Key,T,Eq,Hash,Alloc>& )
{
}
#endif
int test()
{
#ifndef DISABLE_BOOST_HAS_HASH_TEST
BOOST_STD_EXTENSION_NAMESPACE::hash_set<int> hs;
foo(hs);
BOOST_STD_EXTENSION_NAMESPACE::hash_map<int, long> hm;
foo(hm);
#endif
return 0;
}
}
+36
View File
@@ -0,0 +1,36 @@
// (C) Copyright John Maddock 2012.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for most recent version.
// MACRO: BOOST_HAS_INT128
// TITLE: __int128
// DESCRIPTION: The platform supports __int128.
#include <cstdlib>
namespace boost_has_int128{
int test()
{
#ifdef __GNUC__
__extension__ __int128 lli = 0;
__extension__ unsigned __int128 ulli = 0u;
#else
__int128 lli = 0;
unsigned __int128 ulli = 0u;
#endif
(void)&lli;
(void)&ulli;
return 0;
}
}
+24
View File
@@ -0,0 +1,24 @@
// (C) Copyright John Maddock 2005.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for most recent version.
// MACRO: BOOST_HAS_LOG1P
// TITLE: log1p
// DESCRIPTION: The std lib has a C99-conforming log1p function.
#include <math.h>
namespace boost_has_log1p{
int test()
{
double x = 0.5;
x = ::log1p(x);
(void)x;
return 0;
}
}
+36
View File
@@ -0,0 +1,36 @@
// (C) Copyright John Maddock 2001.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for most recent version.
// MACRO: BOOST_HAS_LONG_LONG
// TITLE: long long
// DESCRIPTION: The platform supports long long.
#include <cstdlib>
namespace boost_has_long_long{
int test()
{
#ifdef __GNUC__
__extension__ long long lli = 0LL;
__extension__ unsigned long long ulli = 0uLL;
#else
long long lli = 0LL;
unsigned long long ulli = 0uLL;
#endif
(void)&lli;
(void)&ulli;
return 0;
}
}
@@ -0,0 +1,35 @@
// (C) Copyright John Maddock 2001.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for most recent version.
// MACRO: BOOST_HAS_MACRO_USE_FACET
// TITLE: macro version of use_facet: _USE
// DESCRIPTION: The standard library lacks a conforming std::use_facet,
// but has a macro _USE(loc, Type) that does the job.
// This is primarily for the Dinkumware std lib.
#include <locale>
#ifndef _USE
#error "macro _USE not defined"
#endif
namespace boost_has_macro_use_facet{
int test()
{
std::locale l;
const std::ctype<char>& ct = std::_USE(l, std::ctype<char>);
return 0;
}
}
+32
View File
@@ -0,0 +1,32 @@
// (C) Copyright John Maddock 2001.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for most recent version.
// MACRO: BOOST_HAS_MS_INT64
// TITLE: __int64
// DESCRIPTION: The platform supports Microsoft style __int64.
#include <cstdlib>
namespace boost_has_ms_int64{
int test()
{
__int64 lli = 0i64;
unsigned __int64 ulli = 0ui64;
(void)lli;
(void)ulli;
return 0;
}
}
+36
View File
@@ -0,0 +1,36 @@
// (C) Copyright John Maddock 2001.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for most recent version.
// MACRO: BOOST_HAS_NANOSLEEP
// TITLE: nanosleep
// DESCRIPTION: The platform supports POSIX API nanosleep.
#include <time.h>
namespace boost_has_nanosleep{
void f()
{
// this is never called, it just has to compile:
timespec ts = {0, 0};
timespec rm;
int res = nanosleep(&ts, &rm);
(void) &res;
}
int test()
{
return 0;
}
}
+29
View File
@@ -0,0 +1,29 @@
// (C) Copyright John Maddock 2001.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for most recent version.
// MACRO: BOOST_HAS_NL_TYPES_H
// TITLE: <nl_types.h>
// DESCRIPTION: The platform has an <nl_types.h>.
#include <nl_types.h>
namespace boost_has_nl_types_h{
int test()
{
nl_catd cat = catopen("foo", 0);
if(cat >= 0) catclose(cat);
return 0;
}
}
+57
View File
@@ -0,0 +1,57 @@
// (C) Copyright Terje Slettebo 2001.
// (C) Copyright John Maddock 2001.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for most recent version.
// MACRO: BOOST_HAS_NRVO
// TITLE: Named return value optimisation.
// DESCRIPTION: Named return value optimisation.
namespace boost_has_nrvo
{
class test_class
{
public:
test_class() {}
test_class(const test_class&)
{
++copy_count;
}
static int copy_count;
};
int test_class::copy_count;
test_class f()
{
test_class nrv;
return nrv;
}
int test()
{
test_class::copy_count=0;
f();
return test_class::copy_count;
}
} // namespace boost_has_nrvo
+65
View File
@@ -0,0 +1,65 @@
// (C) Copyright John Maddock 2001.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for most recent version.
// MACRO: BOOST_HAS_PARTIAL_STD_ALLOCATOR
// TITLE: limited std::allocator support
// DESCRIPTION: The std lib has at least some kind of stanfard allocator
// with allocate/deallocate members and probably not much more.
#include <memory>
#if defined(__GNUC__) && ((__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 7)))
# define BOOST_UNUSED_ATTRIBUTE __attribute__((unused))
#else
# define BOOST_UNUSED_ATTRIBUTE
#endif
namespace boost_has_partial_std_allocator{
//
// test everything except rebind template members:
//
template <class T>
int test_allocator(const T& i)
{
typedef std::allocator<int> alloc1_t;
typedef typename alloc1_t::size_type size_type;
typedef typename alloc1_t::difference_type difference_type BOOST_UNUSED_ATTRIBUTE;
typedef typename alloc1_t::pointer pointer;
typedef typename alloc1_t::const_pointer const_pointer;
typedef typename alloc1_t::reference reference;
typedef typename alloc1_t::const_reference const_reference;
typedef typename alloc1_t::value_type value_type BOOST_UNUSED_ATTRIBUTE;
alloc1_t a1;
pointer p = a1.allocate(1);
const_pointer cp = p;
a1.construct(p,i);
size_type s = a1.max_size();
(void)s;
reference r = *p;
const_reference cr = *cp;
if(p != a1.address(r)) return -1;
if(cp != a1.address(cr)) return -1;
a1.destroy(p);
a1.deallocate(p,1);
return 0;
}
int test()
{
return test_allocator(0);
}
}
#undef BOOST_UNUSED_ATTRIBUTE
@@ -0,0 +1,35 @@
// (C) Copyright John Maddock 2001.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for most recent version.
// MACRO: BOOST_HAS_PTHREAD_DELAY_NP
// TITLE: pthread_delay_np
// DESCRIPTION: The platform supports non-standard pthread_delay_np API.
#include <pthread.h>
#include <time.h>
namespace boost_has_pthread_delay_np{
void f()
{
// this is never called, it just has to compile:
timespec ts;
int res = pthread_delay_np(&ts);
}
int test()
{
return 0;
}
}
@@ -0,0 +1,37 @@
// (C) Copyright John Maddock 2001.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for most recent version.
// MACRO: BOOST_HAS_PTHREAD_MUTEXATTR_SETTYPE
// TITLE: pthread_mutexattr_settype
// DESCRIPTION: The platform supports POSIX API pthread_mutexattr_settype.
#include <pthread.h>
namespace boost_has_pthread_mutexattr_settype{
void f()
{
// this is never called, it just has to compile:
pthread_mutexattr_t attr;
pthread_mutexattr_init(&attr);
int type = 0;
pthread_mutexattr_settype(&attr, type);
}
int test()
{
return 0;
}
}
@@ -0,0 +1,34 @@
// (C) Copyright John Maddock 2001.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for most recent version.
// MACRO: BOOST_HAS_PTHREAD_YIELD
// TITLE: pthread_yield
// DESCRIPTION: The platform supports non standard API pthread_yield.
#include <pthread.h>
namespace boost_has_pthread_yield{
void f()
{
// this is never called, it just has to compile:
int res = pthread_yield();
(void)res;
}
int test()
{
return 0;
}
}
+64
View File
@@ -0,0 +1,64 @@
// (C) Copyright John Maddock 2001.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for most recent version.
// MACRO: BOOST_HAS_PTHREADS
// TITLE: POSIX Threads
// DESCRIPTION: The platform supports POSIX style threads.
#include <pthread.h>
namespace boost_has_pthreads{
extern "C" void* thread_proc(void* arg)
{
return arg;
}
int test()
{
pthread_mutex_t mut;
int result = pthread_mutex_init(&mut, 0);
if(0 == result)
{
//
// Failure to be able to create and use a mutex
// is always a failure, even if the pthread
// library is just a non-functioning stub.
//
result |= pthread_mutex_lock(&mut);
result |= pthread_mutex_unlock(&mut);
result |= pthread_mutex_trylock(&mut);
result |= pthread_mutex_unlock(&mut);
result |= pthread_mutex_destroy(&mut);
//
// Try and create a thread, this is allowed
// to fail, in case we are linking to a pthread
// "stub" library.
//
pthread_t t;
int r = pthread_create(&t, 0, &thread_proc, 0);
// result |= r;
if(r == 0)
{
//
// If we can create a thread, then we must be able to join to it:
//
void* arg;
r = pthread_join(t, &arg);
result |= r;
}
}
return result;
}
}
@@ -0,0 +1,26 @@
// Copyright (C) 2007 Douglas Gregor
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for most recent version.
// MACRO: BOOST_HAS_RVALUE_REFS
// TITLE: rvalue references
// DESCRIPTION: The compiler supports C++0x rvalue references
namespace boost_has_rvalue_refs {
void g(int&) {}
template<typename F, typename T>
void forward(F f, T&& t) { f(static_cast<T&&>(t)); }
int test()
{
int x;
forward(g, x);
return 0;
}
}
@@ -0,0 +1,34 @@
// (C) Copyright John Maddock 2001.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for most recent version.
// MACRO: BOOST_HAS_SCHED_YIELD
// TITLE: sched_yield
// DESCRIPTION: The platform supports POSIX standard API sched_yield.
#include <pthread.h>
namespace boost_has_sched_yield{
void f()
{
// this is never called, it just has to compile:
int res = sched_yield();
(void) &res;
}
int test()
{
return 0;
}
}
@@ -0,0 +1,40 @@
// (C) Copyright John Maddock 2001.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for most recent version.
// MACRO: BOOST_HAS_SGI_TYPE_TRAITS
// TITLE: SGI style <type_traits.h>
// DESCRIPTION: The standard library has it's own type_traits implementation.
#include <type_traits.h>
namespace boost_has_sgi_type_traits{
struct foo_type{};
int test()
{
::__true_type t;
::__false_type f;
typedef ::__type_traits<int>::has_trivial_destructor td;
typedef ::__type_traits<double>::has_trivial_assignment_operator ta;
typedef ::__type_traits<float>::has_trivial_copy_constructor tc;
typedef ::__type_traits<char>::has_trivial_default_constructor tdc;
typedef ::__type_traits<foo_type>::is_POD_type isp;
(void) &t; // avoid "unused variable" warnings
(void) &f;
return 0;
}
}
+36
View File
@@ -0,0 +1,36 @@
// (C) Copyright John Maddock 2001.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for most recent version.
// MACRO: BOOST_HAS_SIGACTION
// TITLE: sigaction
// DESCRIPTION: The platform supports POSIX standard API sigaction.
#include <signal.h>
namespace boost_has_sigaction{
void f()
{
// this is never called, it just has to compile:
struct sigaction* sa1 = 0 ;
struct sigaction* sa2 = 0 ;
int res = sigaction(0, sa1, sa2);
(void) &res;
}
int test()
{
return 0;
}
}
+44
View File
@@ -0,0 +1,44 @@
// (C) Copyright John Maddock 2001.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for most recent version.
// MACRO: BOOST_HAS_SLIST
// TITLE: <slist>
// DESCRIPTION: The C++ implementation provides the (SGI) slist class.
#if defined(__GLIBCXX__) || (defined(__GLIBCPP__) && __GLIBCPP__>=20020514) // GCC >= 3.1.0
# define BOOST_STD_EXTENSION_NAMESPACE __gnu_cxx
#include <ext/slist>
#else
#include <slist>
#endif
#ifndef BOOST_STD_EXTENSION_NAMESPACE
#define BOOST_STD_EXTENSION_NAMESPACE std
#endif
namespace boost_has_slist{
template <class T, class Alloc>
void foo(const BOOST_STD_EXTENSION_NAMESPACE::slist<T,Alloc>& )
{
}
int test()
{
BOOST_STD_EXTENSION_NAMESPACE::slist<int> l;
foo(l);
return 0;
}
}
@@ -0,0 +1,20 @@
// Copyright (C) 2007 Douglas Gregor
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for most recent version.
// MACRO: BOOST_HAS_STATIC_ASSERT
// TITLE: static assertions
// DESCRIPTION: The compiler supports C++0x static assertions
namespace boost_has_static_assert {
int test()
{
static_assert(true, "OK");
return 0;
}
}
+48
View File
@@ -0,0 +1,48 @@
// (C) Copyright John Maddock 2001.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for most recent version.
// MACRO: BOOST_HAS_STDINT_H
// TITLE: stdint.h
// DESCRIPTION: There are no 1998 C++ Standard headers <stdint.h>
// or <cstdint>, although the 1999 C Standard does
// include <stdint.h>.
// If <stdint.h> is present, <boost/stdint.h> can make
// good use of it, so a flag is supplied (signalling
// presence; thus the default is not present, conforming
// to the current C++ standard).
# if defined(__hpux) || defined(__FreeBSD__) || defined(__IBMCPP__)
# include <inttypes.h>
# else
# include <stdint.h>
# endif
namespace boost_has_stdint_h{
int test()
{
int8_t i = 0;
#ifndef __QNX__
// QNX has these under non-standard names, our cstdint.hpp will find them however:
int_fast8_t j = 0;
int_least8_t k = 0;
(void)j;
(void)k;
#endif
(void)i;
return 0;
}
}
@@ -0,0 +1,31 @@
// (C) Copyright John Maddock 2001.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for most recent version.
// MACRO: BOOST_HAS_STLP_USE_FACET
// TITLE: STLport version of use_facet
// DESCRIPTION: The standard library lacks a conforming std::use_facet,
// but has a workaound class-version that does the job.
// This is primarily for the STLport std lib.
#include <locale>
namespace boost_has_stlp_use_facet{
int test()
{
std::locale l;
const std::ctype<char>& ct = *std::_Use_facet<std::ctype<char> >(l);
return 0;
}
}
+23
View File
@@ -0,0 +1,23 @@
// (C) Copyright John Maddock 2005.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for most recent version.
// MACRO: BOOST_HAS_TR1_ARRAY
// TITLE: std::tr1::array
// DESCRIPTION: The std lib has a tr1-conforming array library.
#include <array>
namespace boost_has_tr1_array{
using std::tr1::array;
int test()
{
return 0;
}
}
+23
View File
@@ -0,0 +1,23 @@
// (C) Copyright John Maddock 2005.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for most recent version.
// MACRO: BOOST_HAS_TR1_BIND
// TITLE: std::tr1::bind
// DESCRIPTION: The std lib has a tr1-conforming bind template function.
#include <functional>
namespace boost_has_tr1_bind{
using std::tr1::bind;
int test()
{
return 0;
}
}
@@ -0,0 +1,24 @@
// (C) Copyright John Maddock 2005.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for most recent version.
// MACRO: BOOST_HAS_TR1_COMPLEX_OVERLOADS
// TITLE: std::complex overloads
// DESCRIPTION: The std lib has a tr1-conforming set of std::complex overloads.
#include <complex>
namespace boost_has_tr1_complex_overloads{
int test()
{
std::arg(0);
std::conj(0.0);
return 0;
}
}
@@ -0,0 +1,30 @@
// (C) Copyright John Maddock 2005.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for most recent version.
// MACRO: BOOST_HAS_TR1_COMPLEX_INVERSE_TRIG
// TITLE: std::complex inverse trig functions
// DESCRIPTION: The std lib has a tr1-conforming set of std::complex inverse trig functions.
#include <complex>
namespace boost_has_tr1_complex_inverse_trig{
int test()
{
std::complex<double> cd;
std::asin(cd);
std::acos(cd);
std::atan(cd);
std::asinh(cd);
std::acosh(cd);
std::atanh(cd);
std::fabs(cd);
return 0;
}
}
@@ -0,0 +1,23 @@
// (C) Copyright John Maddock 2005.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for most recent version.
// MACRO: BOOST_HAS_TR1_FUNCTION
// TITLE: std::tr1::function
// DESCRIPTION: The std lib has a tr1-conforming function template class.
#include <functional>
namespace boost_has_tr1_function{
using std::tr1::function;
int test()
{
return 0;
}
}
+23
View File
@@ -0,0 +1,23 @@
// (C) Copyright John Maddock 2005.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for most recent version.
// MACRO: BOOST_HAS_TR1_HASH
// TITLE: std::tr1::hash
// DESCRIPTION: The std lib has a tr1-conforming hash function library.
#include <functional>
namespace boost_has_tr1_hash{
using std::tr1::hash;
int test()
{
return 0;
}
}
+23
View File
@@ -0,0 +1,23 @@
// (C) Copyright John Maddock 2005.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for most recent version.
// MACRO: BOOST_HAS_TR1_MEM_FN
// TITLE: std::tr1::mem_fn
// DESCRIPTION: The std lib has a tr1-conforming mem_fn template function.
#include <functional>
namespace boost_has_tr1_mem_fn{
using std::tr1::mem_fn;
int test()
{
return 0;
}
}
+23
View File
@@ -0,0 +1,23 @@
// (C) Copyright John Maddock 2005.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for most recent version.
// MACRO: BOOST_HAS_TR1_RANDOM
// TITLE: std::tr1::random
// DESCRIPTION: The std lib has a tr1-conforming random numer library.
#include <random>
namespace boost_has_tr1_random{
using std::tr1::variate_generator;
int test()
{
return 0;
}
}
@@ -0,0 +1,24 @@
// (C) Copyright John Maddock 2005.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for most recent version.
// MACRO: BOOST_HAS_TR1_REFERENCE_WRAPPER
// TITLE: std::tr1::reference_wrapper
// DESCRIPTION: The std lib has a tr1-conforming reference_wrapper.
#include <functional>
namespace boost_has_tr1_reference_wrapper{
int test()
{
int i;
std::tr1::reference_wrapper<int> r = std::tr1::ref(i);
(void)r;
return 0;
}
}
+24
View File
@@ -0,0 +1,24 @@
// (C) Copyright John Maddock 2005.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for most recent version.
// MACRO: BOOST_HAS_TR1_REGEX
// TITLE: std::tr1::regex
// DESCRIPTION: The std lib has a tr1-conforming regex library.
#include <regex>
namespace boost_has_tr1_regex{
using std::tr1::regex;
int test()
{
return 0;
}
}
@@ -0,0 +1,24 @@
// (C) Copyright John Maddock 2005.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for most recent version.
// MACRO: BOOST_HAS_TR1_RESULT_OF
// TITLE: std::tr1::result_of
// DESCRIPTION: The std lib has a tr1-conforming result_of template.
#include <functional>
namespace boost_has_tr1_result_of{
typedef std::tr1::result_of<int*(int)> r;
typedef r::type rr;
int test()
{
return 0;
}
}
@@ -0,0 +1,24 @@
// (C) Copyright John Maddock 2005.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for most recent version.
// MACRO: BOOST_HAS_TR1_SHARED_PTR
// TITLE: std::tr1::shared_ptr
// DESCRIPTION: The std lib has a tr1-conforming shrared_ptr.
#include <memory>
namespace boost_has_tr1_shared_ptr{
int test()
{
int i;
std::tr1::shared_ptr<int> r(new int());
(void)r;
return 0;
}
}
+23
View File
@@ -0,0 +1,23 @@
// (C) Copyright John Maddock 2005.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for most recent version.
// MACRO: BOOST_HAS_TR1_TUPLE
// TITLE: std::tr1::tuple
// DESCRIPTION: The std lib has a tr1-conforming tuple library.
#include <tuple>
namespace boost_has_tr1_tuple{
using std::tr1::tuple;
int test()
{
return 0;
}
}
@@ -0,0 +1,23 @@
// (C) Copyright John Maddock 2005.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for most recent version.
// MACRO: BOOST_HAS_TR1_TYPE_TRAITS
// TITLE: std::tr1::type_traits
// DESCRIPTION: The std lib has a tr1-conforming type traits library.
#include <type_traits>
namespace boost_has_tr1_type_traits{
using std::tr1::is_void;
int test()
{
return 0;
}
}
@@ -0,0 +1,24 @@
// (C) Copyright John Maddock 2005.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for most recent version.
// MACRO: BOOST_HAS_TR1_UNORDERED_MAP
// TITLE: std::tr1::unordered_map
// DESCRIPTION: The std lib has a tr1-conforming unordered map library.
#include <unordered_map>
namespace boost_has_tr1_unordered_map{
using std::tr1::unordered_map;
using std::tr1::unordered_multimap;
int test()
{
return 0;
}
}
@@ -0,0 +1,24 @@
// (C) Copyright John Maddock 2005.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for most recent version.
// MACRO: BOOST_HAS_TR1_UNORDERED_SET
// TITLE: std::tr1::unordered_set
// DESCRIPTION: The std lib has a tr1-conforming unordered set library.
#include <unordered_set>
namespace boost_has_tr1_unordered_set{
using std::tr1::unordered_set;
using std::tr1::unordered_multiset;
int test()
{
return 0;
}
}
@@ -0,0 +1,25 @@
// (C) Copyright John Maddock 2005.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for most recent version.
// MACRO: BOOST_HAS_TR1_UTILITY
// TITLE: std::tr1::utility
// DESCRIPTION: The std lib has a tr1-conforming utility header.
#include <utility>
namespace boost_has_tr1_utility{
using std::tr1::get;
using std::tr1::tuple_size;
using std::tr1::tuple_element;
int test()
{
return 0;
}
}
+26
View File
@@ -0,0 +1,26 @@
// (C) Copyright John Maddock 2001.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for most recent version.
// MACRO: BOOST_HAS_UNISTD_H
// TITLE: <unistd.h>
// DESCRIPTION: The Platform provides <unistd.h>.
#include <unistd.h>
namespace boost_has_unistd_h{
int test()
{
return 0;
}
}
@@ -0,0 +1,21 @@
// Copyright (C) 2007 Douglas Gregor
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for most recent version.
// MACRO: BOOST_HAS_VARIADIC_TMPL
// TITLE: variadic templates
// DESCRIPTION: The compiler supports C++0x variadic templates
namespace boost_has_variadic_tmpl {
template<typename... Elements> struct tuple {};
int test()
{
return 0;
}
}
@@ -0,0 +1,58 @@
// (C) Copyright John Maddock 2001.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for most recent version.
// MACRO: BOOST_MSVC6_MEMBER_TEMPLATES
// TITLE: microsoft member templates
// DESCRIPTION: Microsoft Visual C++ 6.0 has enough member
// template idiosyncrasies (being polite) that
// BOOST_NO_MEMBER_TEMPLATES is defined for this compiler.
// BOOST_MSVC6_MEMBER_TEMPLATES is defined to allow
// compiler specific workarounds.
#ifndef BOOST_NESTED_TEMPLATE
#define BOOST_NESTED_TEMPLATE template
#endif
namespace boost_msvc6_member_templates{
template <class T>
struct foo
{
template <class U>
struct nested
{
typedef foo<U> other;
};
template <class U>
void mfoo(const U&)
{
}
};
template <class T>
void vc6_mem_test(T i)
{
foo<double> f1;
typedef foo<T> ifoo;
f1.mfoo(i);
typedef typename ifoo::BOOST_NESTED_TEMPLATE nested<double> bound_t;
typedef typename bound_t::other other;
other o;
(void)o;
}
int test()
{
int i = 0;
vc6_mem_test(i);
return 0;
}
}
@@ -0,0 +1,40 @@
// (C) Copyright John Maddock 2001.
// Use, modification and distribution are subject to the
// Boost Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
// See http://www.boost.org/libs/config for most recent version.
// MACRO: BOOST_MSVC_STD_ITERATOR
// TITLE: microsoft's version of std::iterator
// DESCRIPTION: Microsoft's broken version of std::iterator
// is being used.
#include <iterator>
namespace boost_msvc_std_iterator{
int test()
{
typedef std::iterator<
std::random_access_iterator_tag,
int
> iterator_type_2;
typedef std::reverse_iterator<const char*, const char> r_it;
iterator_type_2::value_type v2 = 0;
iterator_type_2::iterator_category cat2;
//
// suppress some warnings:
//
(void)v2;
(void)cat2;
return 0;
}
}

Some files were not shown because too many files have changed in this diff Show More