Massive changes to the organisation of PolyVoxCore and PolyVoxYtil.
Also added start of logging capability.
This commit is contained in:
222
library/PolyVoxCore/include/boost/detail/algorithm.hpp
Normal file
222
library/PolyVoxCore/include/boost/detail/algorithm.hpp
Normal file
@ -0,0 +1,222 @@
|
||||
// (C) Copyright Jeremy Siek 2001.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompany-
|
||||
// ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
/*
|
||||
*
|
||||
* Copyright (c) 1994
|
||||
* Hewlett-Packard Company
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Hewlett-Packard Company makes no
|
||||
* representations about the suitability of this software for any
|
||||
* purpose. It is provided "as is" without express or implied warranty.
|
||||
*
|
||||
*
|
||||
* Copyright (c) 1996
|
||||
* Silicon Graphics Computer Systems, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Silicon Graphics makes no
|
||||
* representations about the suitability of this software for any
|
||||
* purpose. It is provided "as is" without express or implied warranty.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_ALGORITHM_HPP
|
||||
# define BOOST_ALGORITHM_HPP
|
||||
# include <boost/detail/iterator.hpp>
|
||||
// Algorithms on sequences
|
||||
//
|
||||
// The functions in this file have not yet gone through formal
|
||||
// review, and are subject to change. This is a work in progress.
|
||||
// They have been checked into the detail directory because
|
||||
// there are some graph algorithms that use these functions.
|
||||
|
||||
#include <algorithm>
|
||||
#include <vector>
|
||||
|
||||
namespace boost {
|
||||
|
||||
template <typename Iter1, typename Iter2>
|
||||
Iter1 begin(const std::pair<Iter1, Iter2>& p) { return p.first; }
|
||||
|
||||
template <typename Iter1, typename Iter2>
|
||||
Iter2 end(const std::pair<Iter1, Iter2>& p) { return p.second; }
|
||||
|
||||
template <typename Iter1, typename Iter2>
|
||||
typename boost::detail::iterator_traits<Iter1>::difference_type
|
||||
size(const std::pair<Iter1, Iter2>& p) {
|
||||
return std::distance(p.first, p.second);
|
||||
}
|
||||
|
||||
#if 0
|
||||
// These seem to interfere with the std::pair overloads :(
|
||||
template <typename Container>
|
||||
typename Container::iterator
|
||||
begin(Container& c) { return c.begin(); }
|
||||
|
||||
template <typename Container>
|
||||
typename Container::const_iterator
|
||||
begin(const Container& c) { return c.begin(); }
|
||||
|
||||
template <typename Container>
|
||||
typename Container::iterator
|
||||
end(Container& c) { return c.end(); }
|
||||
|
||||
template <typename Container>
|
||||
typename Container::const_iterator
|
||||
end(const Container& c) { return c.end(); }
|
||||
|
||||
template <typename Container>
|
||||
typename Container::size_type
|
||||
size(const Container& c) { return c.size(); }
|
||||
#else
|
||||
template <typename T>
|
||||
typename std::vector<T>::iterator
|
||||
begin(std::vector<T>& c) { return c.begin(); }
|
||||
|
||||
template <typename T>
|
||||
typename std::vector<T>::const_iterator
|
||||
begin(const std::vector<T>& c) { return c.begin(); }
|
||||
|
||||
template <typename T>
|
||||
typename std::vector<T>::iterator
|
||||
end(std::vector<T>& c) { return c.end(); }
|
||||
|
||||
template <typename T>
|
||||
typename std::vector<T>::const_iterator
|
||||
end(const std::vector<T>& c) { return c.end(); }
|
||||
|
||||
template <typename T>
|
||||
typename std::vector<T>::size_type
|
||||
size(const std::vector<T>& c) { return c.size(); }
|
||||
#endif
|
||||
|
||||
template <class ForwardIterator, class T>
|
||||
void iota(ForwardIterator first, ForwardIterator last, T value)
|
||||
{
|
||||
for (; first != last; ++first, ++value)
|
||||
*first = value;
|
||||
}
|
||||
template <typename Container, typename T>
|
||||
void iota(Container& c, const T& value)
|
||||
{
|
||||
iota(begin(c), end(c), value);
|
||||
}
|
||||
|
||||
// Also do version with 2nd container?
|
||||
template <typename Container, typename OutIter>
|
||||
OutIter copy(const Container& c, OutIter result) {
|
||||
return std::copy(begin(c), end(c), result);
|
||||
}
|
||||
|
||||
template <typename Container1, typename Container2>
|
||||
bool equal(const Container1& c1, const Container2& c2)
|
||||
{
|
||||
if (size(c1) != size(c2))
|
||||
return false;
|
||||
return std::equal(begin(c1), end(c1), begin(c2));
|
||||
}
|
||||
|
||||
template <typename Container>
|
||||
void sort(Container& c) { std::sort(begin(c), end(c)); }
|
||||
|
||||
template <typename Container, typename Predicate>
|
||||
void sort(Container& c, const Predicate& p) {
|
||||
std::sort(begin(c), end(c), p);
|
||||
}
|
||||
|
||||
template <typename Container>
|
||||
void stable_sort(Container& c) { std::stable_sort(begin(c), end(c)); }
|
||||
|
||||
template <typename Container, typename Predicate>
|
||||
void stable_sort(Container& c, const Predicate& p) {
|
||||
std::stable_sort(begin(c), end(c), p);
|
||||
}
|
||||
|
||||
template <typename InputIterator, typename Predicate>
|
||||
bool any_if(InputIterator first, InputIterator last, Predicate p)
|
||||
{
|
||||
return std::find_if(first, last, p) != last;
|
||||
}
|
||||
template <typename Container, typename Predicate>
|
||||
bool any_if(const Container& c, Predicate p)
|
||||
{
|
||||
return any_if(begin(c), end(c), p);
|
||||
}
|
||||
|
||||
template <typename InputIterator, typename T>
|
||||
bool container_contains(InputIterator first, InputIterator last, T value)
|
||||
{
|
||||
return std::find(first, last, value) != last;
|
||||
}
|
||||
template <typename Container, typename T>
|
||||
bool container_contains(const Container& c, const T& value)
|
||||
{
|
||||
return container_contains(begin(c), end(c), value);
|
||||
}
|
||||
|
||||
template <typename Container, typename T>
|
||||
std::size_t count(const Container& c, const T& value)
|
||||
{
|
||||
return std::count(begin(c), end(c), value);
|
||||
}
|
||||
|
||||
template <typename Container, typename Predicate>
|
||||
std::size_t count_if(const Container& c, Predicate p)
|
||||
{
|
||||
return std::count_if(begin(c), end(c), p);
|
||||
}
|
||||
|
||||
template <typename ForwardIterator>
|
||||
bool is_sorted(ForwardIterator first, ForwardIterator last)
|
||||
{
|
||||
if (first == last)
|
||||
return true;
|
||||
|
||||
ForwardIterator next = first;
|
||||
for (++next; next != last; first = next, ++next) {
|
||||
if (*next < *first)
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename ForwardIterator, typename StrictWeakOrdering>
|
||||
bool is_sorted(ForwardIterator first, ForwardIterator last,
|
||||
StrictWeakOrdering comp)
|
||||
{
|
||||
if (first == last)
|
||||
return true;
|
||||
|
||||
ForwardIterator next = first;
|
||||
for (++next; next != last; first = next, ++next) {
|
||||
if (comp(*next, *first))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <typename Container>
|
||||
bool is_sorted(const Container& c)
|
||||
{
|
||||
return is_sorted(begin(c), end(c));
|
||||
}
|
||||
|
||||
template <typename Container, typename StrictWeakOrdering>
|
||||
bool is_sorted(const Container& c, StrictWeakOrdering comp)
|
||||
{
|
||||
return is_sorted(begin(c), end(c), comp);
|
||||
}
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_ALGORITHM_HPP
|
193
library/PolyVoxCore/include/boost/detail/allocator_utilities.hpp
Normal file
193
library/PolyVoxCore/include/boost/detail/allocator_utilities.hpp
Normal file
@ -0,0 +1,193 @@
|
||||
/* Copyright 2003-2008 Joaquin M Lopez Munoz.
|
||||
* Distributed under the Boost Software License, Version 1.0.
|
||||
* (See accompanying file LICENSE_1_0.txt or copy at
|
||||
* http://www.boost.org/LICENSE_1_0.txt)
|
||||
*
|
||||
* See Boost website at http://www.boost.org/
|
||||
*/
|
||||
|
||||
#ifndef BOOST_DETAIL_ALLOCATOR_UTILITIES_HPP
|
||||
#define BOOST_DETAIL_ALLOCATOR_UTILITIES_HPP
|
||||
|
||||
#include <boost/config.hpp> /* keep it first to prevent nasty warns in MSVC */
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include <boost/mpl/aux_/msvc_never_true.hpp>
|
||||
#include <boost/mpl/eval_if.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <cstddef>
|
||||
#include <memory>
|
||||
#include <new>
|
||||
|
||||
namespace boost{
|
||||
|
||||
namespace detail{
|
||||
|
||||
/* Allocator adaption layer. Some stdlibs provide allocators without rebind
|
||||
* and template ctors. These facilities are simulated with the external
|
||||
* template class rebind_to and the aid of partial_std_allocator_wrapper.
|
||||
*/
|
||||
|
||||
namespace allocator{
|
||||
|
||||
/* partial_std_allocator_wrapper inherits the functionality of a std
|
||||
* allocator while providing a templatized ctor and other bits missing
|
||||
* in some stdlib implementation or another.
|
||||
*/
|
||||
|
||||
template<typename Type>
|
||||
class partial_std_allocator_wrapper:public std::allocator<Type>
|
||||
{
|
||||
public:
|
||||
/* Oddly enough, STLport does not define std::allocator<void>::value_type
|
||||
* when configured to work without partial template specialization.
|
||||
* No harm in supplying the definition here unconditionally.
|
||||
*/
|
||||
|
||||
typedef Type value_type;
|
||||
|
||||
partial_std_allocator_wrapper(){};
|
||||
|
||||
template<typename Other>
|
||||
partial_std_allocator_wrapper(const partial_std_allocator_wrapper<Other>&){}
|
||||
|
||||
partial_std_allocator_wrapper(const std::allocator<Type>& x):
|
||||
std::allocator<Type>(x)
|
||||
{
|
||||
};
|
||||
|
||||
#if defined(BOOST_DINKUMWARE_STDLIB)
|
||||
/* Dinkumware guys didn't provide a means to call allocate() without
|
||||
* supplying a hint, in disagreement with the standard.
|
||||
*/
|
||||
|
||||
Type* allocate(std::size_t n,const void* hint=0)
|
||||
{
|
||||
std::allocator<Type>& a=*this;
|
||||
return a.allocate(n,hint);
|
||||
}
|
||||
#endif
|
||||
|
||||
};
|
||||
|
||||
/* Detects whether a given allocator belongs to a defective stdlib not
|
||||
* having the required member templates.
|
||||
* Note that it does not suffice to check the Boost.Config stdlib
|
||||
* macros, as the user might have passed a custom, compliant allocator.
|
||||
* The checks also considers partial_std_allocator_wrapper to be
|
||||
* a standard defective allocator.
|
||||
*/
|
||||
|
||||
#if defined(BOOST_NO_STD_ALLOCATOR)&&\
|
||||
(defined(BOOST_HAS_PARTIAL_STD_ALLOCATOR)||defined(BOOST_DINKUMWARE_STDLIB))
|
||||
|
||||
template<typename Allocator>
|
||||
struct is_partial_std_allocator
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool,
|
||||
value=
|
||||
(is_same<
|
||||
std::allocator<BOOST_DEDUCED_TYPENAME Allocator::value_type>,
|
||||
Allocator
|
||||
>::value)||
|
||||
(is_same<
|
||||
partial_std_allocator_wrapper<
|
||||
BOOST_DEDUCED_TYPENAME Allocator::value_type>,
|
||||
Allocator
|
||||
>::value));
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
template<typename Allocator>
|
||||
struct is_partial_std_allocator
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(bool,value=false);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
/* rebind operations for defective std allocators */
|
||||
|
||||
template<typename Allocator,typename Type>
|
||||
struct partial_std_allocator_rebind_to
|
||||
{
|
||||
typedef partial_std_allocator_wrapper<Type> type;
|
||||
};
|
||||
|
||||
/* rebind operation in all other cases */
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC,<1300)
|
||||
/* Workaround for a problem in MSVC with dependent template typedefs
|
||||
* when doing rebinding of allocators.
|
||||
* Modeled after <boost/mpl/aux_/msvc_dtw.hpp> (thanks, Aleksey!)
|
||||
*/
|
||||
|
||||
template<typename Allocator>
|
||||
struct rebinder
|
||||
{
|
||||
template<bool> struct fake_allocator:Allocator{};
|
||||
template<> struct fake_allocator<true>
|
||||
{
|
||||
template<typename Type> struct rebind{};
|
||||
};
|
||||
|
||||
template<typename Type>
|
||||
struct result:
|
||||
fake_allocator<mpl::aux::msvc_never_true<Allocator>::value>::
|
||||
template rebind<Type>
|
||||
{
|
||||
};
|
||||
};
|
||||
#else
|
||||
template<typename Allocator>
|
||||
struct rebinder
|
||||
{
|
||||
template<typename Type>
|
||||
struct result
|
||||
{
|
||||
typedef typename Allocator::BOOST_NESTED_TEMPLATE
|
||||
rebind<Type>::other other;
|
||||
};
|
||||
};
|
||||
#endif
|
||||
|
||||
template<typename Allocator,typename Type>
|
||||
struct compliant_allocator_rebind_to
|
||||
{
|
||||
typedef typename rebinder<Allocator>::
|
||||
BOOST_NESTED_TEMPLATE result<Type>::other type;
|
||||
};
|
||||
|
||||
/* rebind front-end */
|
||||
|
||||
template<typename Allocator,typename Type>
|
||||
struct rebind_to:
|
||||
mpl::eval_if_c<
|
||||
is_partial_std_allocator<Allocator>::value,
|
||||
partial_std_allocator_rebind_to<Allocator,Type>,
|
||||
compliant_allocator_rebind_to<Allocator,Type>
|
||||
>
|
||||
{
|
||||
};
|
||||
|
||||
/* allocator-independent versions of construct and destroy */
|
||||
|
||||
template<typename Type>
|
||||
void construct(void* p,const Type& t)
|
||||
{
|
||||
new (p) Type(t);
|
||||
}
|
||||
|
||||
template<typename Type>
|
||||
void destroy(const Type* p)
|
||||
{
|
||||
p->~Type();
|
||||
}
|
||||
|
||||
} /* namespace boost::detail::allocator */
|
||||
|
||||
} /* namespace boost::detail */
|
||||
|
||||
} /* namespace boost */
|
||||
|
||||
#endif
|
119
library/PolyVoxCore/include/boost/detail/atomic_count.hpp
Normal file
119
library/PolyVoxCore/include/boost/detail/atomic_count.hpp
Normal file
@ -0,0 +1,119 @@
|
||||
#ifndef BOOST_DETAIL_ATOMIC_COUNT_HPP_INCLUDED
|
||||
#define BOOST_DETAIL_ATOMIC_COUNT_HPP_INCLUDED
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
//
|
||||
// boost/detail/atomic_count.hpp - thread/SMP safe reference counter
|
||||
//
|
||||
// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// typedef <implementation-defined> boost::detail::atomic_count;
|
||||
//
|
||||
// atomic_count a(n);
|
||||
//
|
||||
// (n is convertible to long)
|
||||
//
|
||||
// Effects: Constructs an atomic_count with an initial value of n
|
||||
//
|
||||
// a;
|
||||
//
|
||||
// Returns: (long) the current value of a
|
||||
//
|
||||
// ++a;
|
||||
//
|
||||
// Effects: Atomically increments the value of a
|
||||
// Returns: nothing
|
||||
//
|
||||
// --a;
|
||||
//
|
||||
// Effects: Atomically decrements the value of a
|
||||
// Returns: (long) zero if the new value of a is zero,
|
||||
// unspecified non-zero value otherwise (usually the new value)
|
||||
//
|
||||
// Important note: when --a returns zero, it must act as a
|
||||
// read memory barrier (RMB); i.e. the calling thread must
|
||||
// have a synchronized view of the memory
|
||||
//
|
||||
// On Intel IA-32 (x86) memory is always synchronized, so this
|
||||
// is not a problem.
|
||||
//
|
||||
// On many architectures the atomic instructions already act as
|
||||
// a memory barrier.
|
||||
//
|
||||
// This property is necessary for proper reference counting, since
|
||||
// a thread can update the contents of a shared object, then
|
||||
// release its reference, and another thread may immediately
|
||||
// release the last reference causing object destruction.
|
||||
//
|
||||
// The destructor needs to have a synchronized view of the
|
||||
// object to perform proper cleanup.
|
||||
//
|
||||
// Original example by Alexander Terekhov:
|
||||
//
|
||||
// Given:
|
||||
//
|
||||
// - a mutable shared object OBJ;
|
||||
// - two threads THREAD1 and THREAD2 each holding
|
||||
// a private smart_ptr object pointing to that OBJ.
|
||||
//
|
||||
// t1: THREAD1 updates OBJ (thread-safe via some synchronization)
|
||||
// and a few cycles later (after "unlock") destroys smart_ptr;
|
||||
//
|
||||
// t2: THREAD2 destroys smart_ptr WITHOUT doing any synchronization
|
||||
// with respect to shared mutable object OBJ; OBJ destructors
|
||||
// are called driven by smart_ptr interface...
|
||||
//
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#ifndef BOOST_HAS_THREADS
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
typedef long atomic_count;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#elif defined(BOOST_AC_USE_PTHREADS)
|
||||
# include <boost/detail/atomic_count_pthreads.hpp>
|
||||
|
||||
#elif defined( __GNUC__ ) && ( defined( __i386__ ) || defined( __x86_64__ ) )
|
||||
# include <boost/detail/atomic_count_gcc_x86.hpp>
|
||||
|
||||
#elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
|
||||
# include <boost/detail/atomic_count_win32.hpp>
|
||||
|
||||
#elif defined( __GNUC__ ) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 401 ) && !defined( __arm__ ) && !defined( __hppa ) && ( !defined( __INTEL_COMPILER ) || defined( __ia64__ ) )
|
||||
# include <boost/detail/atomic_count_sync.hpp>
|
||||
|
||||
#elif defined(__GLIBCPP__) || defined(__GLIBCXX__)
|
||||
# include <boost/detail/atomic_count_gcc.hpp>
|
||||
|
||||
#elif defined(BOOST_HAS_PTHREADS)
|
||||
|
||||
# define BOOST_AC_USE_PTHREADS
|
||||
# include <boost/detail/atomic_count_pthreads.hpp>
|
||||
|
||||
#else
|
||||
|
||||
// Use #define BOOST_DISABLE_THREADS to avoid the error
|
||||
#error Unrecognized threading platform
|
||||
|
||||
#endif
|
||||
|
||||
#endif // #ifndef BOOST_DETAIL_ATOMIC_COUNT_HPP_INCLUDED
|
@ -0,0 +1,68 @@
|
||||
#ifndef BOOST_DETAIL_ATOMIC_COUNT_GCC_HPP_INCLUDED
|
||||
#define BOOST_DETAIL_ATOMIC_COUNT_GCC_HPP_INCLUDED
|
||||
|
||||
//
|
||||
// boost/detail/atomic_count_gcc.hpp
|
||||
//
|
||||
// atomic_count for GNU libstdc++ v3
|
||||
//
|
||||
// http://gcc.gnu.org/onlinedocs/porting/Thread-safety.html
|
||||
//
|
||||
// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd.
|
||||
// Copyright (c) 2002 Lars Gullik Bj<42>nnes <larsbj@lyx.org>
|
||||
// Copyright 2003-2005 Peter Dimov
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
#include <bits/atomicity.h>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
#if defined(__GLIBCXX__) // g++ 3.4+
|
||||
|
||||
using __gnu_cxx::__atomic_add;
|
||||
using __gnu_cxx::__exchange_and_add;
|
||||
|
||||
#endif
|
||||
|
||||
class atomic_count
|
||||
{
|
||||
public:
|
||||
|
||||
explicit atomic_count(long v) : value_(v) {}
|
||||
|
||||
void operator++()
|
||||
{
|
||||
__atomic_add(&value_, 1);
|
||||
}
|
||||
|
||||
long operator--()
|
||||
{
|
||||
return __exchange_and_add(&value_, -1) - 1;
|
||||
}
|
||||
|
||||
operator long() const
|
||||
{
|
||||
return __exchange_and_add(&value_, 0);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
atomic_count(atomic_count const &);
|
||||
atomic_count & operator=(atomic_count const &);
|
||||
|
||||
mutable _Atomic_word value_;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // #ifndef BOOST_DETAIL_ATOMIC_COUNT_GCC_HPP_INCLUDED
|
@ -0,0 +1,84 @@
|
||||
#ifndef BOOST_DETAIL_ATOMIC_COUNT_GCC_X86_HPP_INCLUDED
|
||||
#define BOOST_DETAIL_ATOMIC_COUNT_GCC_X86_HPP_INCLUDED
|
||||
|
||||
//
|
||||
// boost/detail/atomic_count_gcc_x86.hpp
|
||||
//
|
||||
// atomic_count for g++ on 486+/AMD64
|
||||
//
|
||||
// Copyright 2007 Peter Dimov
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
class atomic_count
|
||||
{
|
||||
public:
|
||||
|
||||
explicit atomic_count( long v ) : value_( static_cast< int >( v ) ) {}
|
||||
|
||||
void operator++()
|
||||
{
|
||||
__asm__
|
||||
(
|
||||
"lock\n\t"
|
||||
"incl %0":
|
||||
"+m"( value_ ): // output (%0)
|
||||
: // inputs
|
||||
"cc" // clobbers
|
||||
);
|
||||
}
|
||||
|
||||
long operator--()
|
||||
{
|
||||
return atomic_exchange_and_add( &value_, -1 ) - 1;
|
||||
}
|
||||
|
||||
operator long() const
|
||||
{
|
||||
return atomic_exchange_and_add( &value_, 0 );
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
atomic_count(atomic_count const &);
|
||||
atomic_count & operator=(atomic_count const &);
|
||||
|
||||
mutable int value_;
|
||||
|
||||
private:
|
||||
|
||||
static int atomic_exchange_and_add( int * pw, int dv )
|
||||
{
|
||||
// int r = *pw;
|
||||
// *pw += dv;
|
||||
// return r;
|
||||
|
||||
int r;
|
||||
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"lock\n\t"
|
||||
"xadd %1, %0":
|
||||
"+m"( *pw ), "=r"( r ): // outputs (%0, %1)
|
||||
"1"( dv ): // inputs (%2 == %1)
|
||||
"memory", "cc" // clobbers
|
||||
);
|
||||
|
||||
return r;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // #ifndef BOOST_DETAIL_ATOMIC_COUNT_SYNC_HPP_INCLUDED
|
@ -0,0 +1,96 @@
|
||||
#ifndef BOOST_DETAIL_ATOMIC_COUNT_PTHREADS_HPP_INCLUDED
|
||||
#define BOOST_DETAIL_ATOMIC_COUNT_PTHREADS_HPP_INCLUDED
|
||||
|
||||
//
|
||||
// boost/detail/atomic_count_pthreads.hpp
|
||||
//
|
||||
// Copyright (c) 2001, 2002 Peter Dimov and Multi Media Ltd.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
//
|
||||
// The generic pthread_mutex-based implementation sometimes leads to
|
||||
// inefficiencies. Example: a class with two atomic_count members
|
||||
// can get away with a single mutex.
|
||||
//
|
||||
// Users can detect this situation by checking BOOST_AC_USE_PTHREADS.
|
||||
//
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
class atomic_count
|
||||
{
|
||||
private:
|
||||
|
||||
class scoped_lock
|
||||
{
|
||||
public:
|
||||
|
||||
scoped_lock(pthread_mutex_t & m): m_(m)
|
||||
{
|
||||
pthread_mutex_lock(&m_);
|
||||
}
|
||||
|
||||
~scoped_lock()
|
||||
{
|
||||
pthread_mutex_unlock(&m_);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
pthread_mutex_t & m_;
|
||||
};
|
||||
|
||||
public:
|
||||
|
||||
explicit atomic_count(long v): value_(v)
|
||||
{
|
||||
pthread_mutex_init(&mutex_, 0);
|
||||
}
|
||||
|
||||
~atomic_count()
|
||||
{
|
||||
pthread_mutex_destroy(&mutex_);
|
||||
}
|
||||
|
||||
void operator++()
|
||||
{
|
||||
scoped_lock lock(mutex_);
|
||||
++value_;
|
||||
}
|
||||
|
||||
long operator--()
|
||||
{
|
||||
scoped_lock lock(mutex_);
|
||||
return --value_;
|
||||
}
|
||||
|
||||
operator long() const
|
||||
{
|
||||
scoped_lock lock(mutex_);
|
||||
return value_;
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
atomic_count(atomic_count const &);
|
||||
atomic_count & operator=(atomic_count const &);
|
||||
|
||||
mutable pthread_mutex_t mutex_;
|
||||
long value_;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // #ifndef BOOST_DETAIL_ATOMIC_COUNT_PTHREADS_HPP_INCLUDED
|
@ -0,0 +1,59 @@
|
||||
#ifndef BOOST_DETAIL_ATOMIC_COUNT_SOLARIS_HPP_INCLUDED
|
||||
#define BOOST_DETAIL_ATOMIC_COUNT_SOLARIS_HPP_INCLUDED
|
||||
|
||||
//
|
||||
// boost/detail/atomic_count_solaris.hpp
|
||||
// based on: boost/detail/atomic_count_win32.hpp
|
||||
//
|
||||
// Copyright (c) 2001-2005 Peter Dimov
|
||||
// Copyright (c) 2006 Michael van der Westhuizen
|
||||
//
|
||||
// Distributed under the 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 <atomic.h>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
class atomic_count
|
||||
{
|
||||
public:
|
||||
|
||||
explicit atomic_count( uint32_t v ): value_( v )
|
||||
{
|
||||
}
|
||||
|
||||
long operator++()
|
||||
{
|
||||
return atomic_inc_32_nv( &value_ );
|
||||
}
|
||||
|
||||
long operator--()
|
||||
{
|
||||
return atomic_dec_32_nv( &value_ );
|
||||
}
|
||||
|
||||
operator uint32_t() const
|
||||
{
|
||||
return static_cast<uint32_t const volatile &>( value_ );
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
atomic_count( atomic_count const & );
|
||||
atomic_count & operator=( atomic_count const & );
|
||||
|
||||
uint32_t value_;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // #ifndef BOOST_DETAIL_ATOMIC_COUNT_SOLARIS_HPP_INCLUDED
|
@ -0,0 +1,61 @@
|
||||
#ifndef BOOST_DETAIL_ATOMIC_COUNT_SYNC_HPP_INCLUDED
|
||||
#define BOOST_DETAIL_ATOMIC_COUNT_SYNC_HPP_INCLUDED
|
||||
|
||||
//
|
||||
// boost/detail/atomic_count_sync.hpp
|
||||
//
|
||||
// atomic_count for g++ 4.1+
|
||||
//
|
||||
// http://gcc.gnu.org/onlinedocs/gcc-4.1.1/gcc/Atomic-Builtins.html
|
||||
//
|
||||
// Copyright 2007 Peter Dimov
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
#if defined( __ia64__ ) && defined( __INTEL_COMPILER )
|
||||
# include <ia64intrin.h>
|
||||
#endif
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
class atomic_count
|
||||
{
|
||||
public:
|
||||
|
||||
explicit atomic_count( long v ) : value_( v ) {}
|
||||
|
||||
void operator++()
|
||||
{
|
||||
__sync_add_and_fetch( &value_, 1 );
|
||||
}
|
||||
|
||||
long operator--()
|
||||
{
|
||||
return __sync_add_and_fetch( &value_, -1 );
|
||||
}
|
||||
|
||||
operator long() const
|
||||
{
|
||||
return __sync_fetch_and_add( &value_, 0 );
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
atomic_count(atomic_count const &);
|
||||
atomic_count & operator=(atomic_count const &);
|
||||
|
||||
mutable long value_;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // #ifndef BOOST_DETAIL_ATOMIC_COUNT_SYNC_HPP_INCLUDED
|
@ -0,0 +1,63 @@
|
||||
#ifndef BOOST_DETAIL_ATOMIC_COUNT_WIN32_HPP_INCLUDED
|
||||
#define BOOST_DETAIL_ATOMIC_COUNT_WIN32_HPP_INCLUDED
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
//
|
||||
// boost/detail/atomic_count_win32.hpp
|
||||
//
|
||||
// Copyright (c) 2001-2005 Peter Dimov
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
#include <boost/detail/interlocked.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
class atomic_count
|
||||
{
|
||||
public:
|
||||
|
||||
explicit atomic_count( long v ): value_( v )
|
||||
{
|
||||
}
|
||||
|
||||
long operator++()
|
||||
{
|
||||
return BOOST_INTERLOCKED_INCREMENT( &value_ );
|
||||
}
|
||||
|
||||
long operator--()
|
||||
{
|
||||
return BOOST_INTERLOCKED_DECREMENT( &value_ );
|
||||
}
|
||||
|
||||
operator long() const
|
||||
{
|
||||
return static_cast<long const volatile &>( value_ );
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
atomic_count( atomic_count const & );
|
||||
atomic_count & operator=( atomic_count const & );
|
||||
|
||||
long value_;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // #ifndef BOOST_DETAIL_ATOMIC_COUNT_WIN32_HPP_INCLUDED
|
59
library/PolyVoxCore/include/boost/detail/bad_weak_ptr.hpp
Normal file
59
library/PolyVoxCore/include/boost/detail/bad_weak_ptr.hpp
Normal file
@ -0,0 +1,59 @@
|
||||
#ifndef BOOST_BAD_WEAK_PTR_HPP_INCLUDED
|
||||
#define BOOST_BAD_WEAK_PTR_HPP_INCLUDED
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
//
|
||||
// detail/bad_weak_ptr.hpp
|
||||
//
|
||||
// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd.
|
||||
//
|
||||
// Distributed under the 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 <exception>
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
# pragma warn -8026 // Functions with excep. spec. are not expanded inline
|
||||
#endif
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
// The standard library that comes with Borland C++ 5.5.1, 5.6.4
|
||||
// defines std::exception and its members as having C calling
|
||||
// convention (-pc). When the definition of bad_weak_ptr
|
||||
// is compiled with -ps, the compiler issues an error.
|
||||
// Hence, the temporary #pragma option -pc below.
|
||||
|
||||
#if defined(__BORLANDC__) && __BORLANDC__ <= 0x564
|
||||
# pragma option push -pc
|
||||
#endif
|
||||
|
||||
class bad_weak_ptr: public std::exception
|
||||
{
|
||||
public:
|
||||
|
||||
virtual char const * what() const throw()
|
||||
{
|
||||
return "tr1::bad_weak_ptr";
|
||||
}
|
||||
};
|
||||
|
||||
#if defined(__BORLANDC__) && __BORLANDC__ <= 0x564
|
||||
# pragma option pop
|
||||
#endif
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
# pragma warn .8026 // Functions with excep. spec. are not expanded inline
|
||||
#endif
|
||||
|
||||
#endif // #ifndef BOOST_BAD_WEAK_PTR_HPP_INCLUDED
|
216
library/PolyVoxCore/include/boost/detail/binary_search.hpp
Normal file
216
library/PolyVoxCore/include/boost/detail/binary_search.hpp
Normal file
@ -0,0 +1,216 @@
|
||||
// Copyright (c) 2000 David Abrahams.
|
||||
// Distributed under the 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) 1994
|
||||
// Hewlett-Packard Company
|
||||
//
|
||||
// Permission to use, copy, modify, distribute and sell this software
|
||||
// and its documentation for any purpose is hereby granted without fee,
|
||||
// provided that the above copyright notice appear in all copies and
|
||||
// that both that copyright notice and this permission notice appear
|
||||
// in supporting documentation. Hewlett-Packard Company makes no
|
||||
// representations about the suitability of this software for any
|
||||
// purpose. It is provided "as is" without express or implied warranty.
|
||||
//
|
||||
// Copyright (c) 1996
|
||||
// Silicon Graphics Computer Systems, Inc.
|
||||
//
|
||||
// Permission to use, copy, modify, distribute and sell this software
|
||||
// and its documentation for any purpose is hereby granted without fee,
|
||||
// provided that the above copyright notice appear in all copies and
|
||||
// that both that copyright notice and this permission notice appear
|
||||
// in supporting documentation. Silicon Graphics makes no
|
||||
// representations about the suitability of this software for any
|
||||
// purpose. It is provided "as is" without express or implied warranty.
|
||||
//
|
||||
#ifndef BINARY_SEARCH_DWA_122600_H_
|
||||
# define BINARY_SEARCH_DWA_122600_H_
|
||||
|
||||
# include <boost/detail/iterator.hpp>
|
||||
# include <utility>
|
||||
|
||||
namespace boost { namespace detail {
|
||||
|
||||
template <class ForwardIter, class Tp>
|
||||
ForwardIter lower_bound(ForwardIter first, ForwardIter last,
|
||||
const Tp& val)
|
||||
{
|
||||
typedef detail::iterator_traits<ForwardIter> traits;
|
||||
|
||||
typename traits::difference_type len = boost::detail::distance(first, last);
|
||||
typename traits::difference_type half;
|
||||
ForwardIter middle;
|
||||
|
||||
while (len > 0) {
|
||||
half = len >> 1;
|
||||
middle = first;
|
||||
std::advance(middle, half);
|
||||
if (*middle < val) {
|
||||
first = middle;
|
||||
++first;
|
||||
len = len - half - 1;
|
||||
}
|
||||
else
|
||||
len = half;
|
||||
}
|
||||
return first;
|
||||
}
|
||||
|
||||
template <class ForwardIter, class Tp, class Compare>
|
||||
ForwardIter lower_bound(ForwardIter first, ForwardIter last,
|
||||
const Tp& val, Compare comp)
|
||||
{
|
||||
typedef detail::iterator_traits<ForwardIter> traits;
|
||||
|
||||
typename traits::difference_type len = boost::detail::distance(first, last);
|
||||
typename traits::difference_type half;
|
||||
ForwardIter middle;
|
||||
|
||||
while (len > 0) {
|
||||
half = len >> 1;
|
||||
middle = first;
|
||||
std::advance(middle, half);
|
||||
if (comp(*middle, val)) {
|
||||
first = middle;
|
||||
++first;
|
||||
len = len - half - 1;
|
||||
}
|
||||
else
|
||||
len = half;
|
||||
}
|
||||
return first;
|
||||
}
|
||||
|
||||
template <class ForwardIter, class Tp>
|
||||
ForwardIter upper_bound(ForwardIter first, ForwardIter last,
|
||||
const Tp& val)
|
||||
{
|
||||
typedef detail::iterator_traits<ForwardIter> traits;
|
||||
|
||||
typename traits::difference_type len = boost::detail::distance(first, last);
|
||||
typename traits::difference_type half;
|
||||
ForwardIter middle;
|
||||
|
||||
while (len > 0) {
|
||||
half = len >> 1;
|
||||
middle = first;
|
||||
std::advance(middle, half);
|
||||
if (val < *middle)
|
||||
len = half;
|
||||
else {
|
||||
first = middle;
|
||||
++first;
|
||||
len = len - half - 1;
|
||||
}
|
||||
}
|
||||
return first;
|
||||
}
|
||||
|
||||
template <class ForwardIter, class Tp, class Compare>
|
||||
ForwardIter upper_bound(ForwardIter first, ForwardIter last,
|
||||
const Tp& val, Compare comp)
|
||||
{
|
||||
typedef detail::iterator_traits<ForwardIter> traits;
|
||||
|
||||
typename traits::difference_type len = boost::detail::distance(first, last);
|
||||
typename traits::difference_type half;
|
||||
ForwardIter middle;
|
||||
|
||||
while (len > 0) {
|
||||
half = len >> 1;
|
||||
middle = first;
|
||||
std::advance(middle, half);
|
||||
if (comp(val, *middle))
|
||||
len = half;
|
||||
else {
|
||||
first = middle;
|
||||
++first;
|
||||
len = len - half - 1;
|
||||
}
|
||||
}
|
||||
return first;
|
||||
}
|
||||
|
||||
template <class ForwardIter, class Tp>
|
||||
std::pair<ForwardIter, ForwardIter>
|
||||
equal_range(ForwardIter first, ForwardIter last, const Tp& val)
|
||||
{
|
||||
typedef detail::iterator_traits<ForwardIter> traits;
|
||||
|
||||
typename traits::difference_type len = boost::detail::distance(first, last);
|
||||
typename traits::difference_type half;
|
||||
ForwardIter middle, left, right;
|
||||
|
||||
while (len > 0) {
|
||||
half = len >> 1;
|
||||
middle = first;
|
||||
std::advance(middle, half);
|
||||
if (*middle < val) {
|
||||
first = middle;
|
||||
++first;
|
||||
len = len - half - 1;
|
||||
}
|
||||
else if (val < *middle)
|
||||
len = half;
|
||||
else {
|
||||
left = boost::detail::lower_bound(first, middle, val);
|
||||
std::advance(first, len);
|
||||
right = boost::detail::upper_bound(++middle, first, val);
|
||||
return std::pair<ForwardIter, ForwardIter>(left, right);
|
||||
}
|
||||
}
|
||||
return std::pair<ForwardIter, ForwardIter>(first, first);
|
||||
}
|
||||
|
||||
template <class ForwardIter, class Tp, class Compare>
|
||||
std::pair<ForwardIter, ForwardIter>
|
||||
equal_range(ForwardIter first, ForwardIter last, const Tp& val,
|
||||
Compare comp)
|
||||
{
|
||||
typedef detail::iterator_traits<ForwardIter> traits;
|
||||
|
||||
typename traits::difference_type len = boost::detail::distance(first, last);
|
||||
typename traits::difference_type half;
|
||||
ForwardIter middle, left, right;
|
||||
|
||||
while (len > 0) {
|
||||
half = len >> 1;
|
||||
middle = first;
|
||||
std::advance(middle, half);
|
||||
if (comp(*middle, val)) {
|
||||
first = middle;
|
||||
++first;
|
||||
len = len - half - 1;
|
||||
}
|
||||
else if (comp(val, *middle))
|
||||
len = half;
|
||||
else {
|
||||
left = boost::detail::lower_bound(first, middle, val, comp);
|
||||
std::advance(first, len);
|
||||
right = boost::detail::upper_bound(++middle, first, val, comp);
|
||||
return std::pair<ForwardIter, ForwardIter>(left, right);
|
||||
}
|
||||
}
|
||||
return std::pair<ForwardIter, ForwardIter>(first, first);
|
||||
}
|
||||
|
||||
template <class ForwardIter, class Tp>
|
||||
bool binary_search(ForwardIter first, ForwardIter last,
|
||||
const Tp& val) {
|
||||
ForwardIter i = boost::detail::lower_bound(first, last, val);
|
||||
return i != last && !(val < *i);
|
||||
}
|
||||
|
||||
template <class ForwardIter, class Tp, class Compare>
|
||||
bool binary_search(ForwardIter first, ForwardIter last,
|
||||
const Tp& val,
|
||||
Compare comp) {
|
||||
ForwardIter i = boost::detail::lower_bound(first, last, val, comp);
|
||||
return i != last && !comp(val, *i);
|
||||
}
|
||||
|
||||
}} // namespace boost::detail
|
||||
|
||||
#endif // BINARY_SEARCH_DWA_122600_H_
|
164
library/PolyVoxCore/include/boost/detail/call_traits.hpp
Normal file
164
library/PolyVoxCore/include/boost/detail/call_traits.hpp
Normal file
@ -0,0 +1,164 @@
|
||||
// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000.
|
||||
// Use, modification and distribution are subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt).
|
||||
//
|
||||
// See http://www.boost.org/libs/utility for most recent version including documentation.
|
||||
|
||||
// call_traits: defines typedefs for function usage
|
||||
// (see libs/utility/call_traits.htm)
|
||||
|
||||
/* Release notes:
|
||||
23rd July 2000:
|
||||
Fixed array specialization. (JM)
|
||||
Added Borland specific fixes for reference types
|
||||
(issue raised by Steve Cleary).
|
||||
*/
|
||||
|
||||
#ifndef BOOST_DETAIL_CALL_TRAITS_HPP
|
||||
#define BOOST_DETAIL_CALL_TRAITS_HPP
|
||||
|
||||
#ifndef BOOST_CONFIG_HPP
|
||||
#include <boost/config.hpp>
|
||||
#endif
|
||||
#include <cstddef>
|
||||
|
||||
#include <boost/type_traits/is_arithmetic.hpp>
|
||||
#include <boost/type_traits/is_pointer.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
namespace boost{
|
||||
|
||||
namespace detail{
|
||||
|
||||
template <typename T, bool small_>
|
||||
struct ct_imp2
|
||||
{
|
||||
typedef const T& param_type;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct ct_imp2<T, true>
|
||||
{
|
||||
typedef const T param_type;
|
||||
};
|
||||
|
||||
template <typename T, bool isp, bool b1>
|
||||
struct ct_imp
|
||||
{
|
||||
typedef const T& param_type;
|
||||
};
|
||||
|
||||
template <typename T, bool isp>
|
||||
struct ct_imp<T, isp, true>
|
||||
{
|
||||
typedef typename ct_imp2<T, sizeof(T) <= sizeof(void*)>::param_type param_type;
|
||||
};
|
||||
|
||||
template <typename T, bool b1>
|
||||
struct ct_imp<T, true, b1>
|
||||
{
|
||||
typedef const T param_type;
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
struct call_traits
|
||||
{
|
||||
public:
|
||||
typedef T value_type;
|
||||
typedef T& reference;
|
||||
typedef const T& const_reference;
|
||||
//
|
||||
// C++ Builder workaround: we should be able to define a compile time
|
||||
// constant and pass that as a single template parameter to ct_imp<T,bool>,
|
||||
// however compiler bugs prevent this - instead pass three bool's to
|
||||
// ct_imp<T,bool,bool,bool> and add an extra partial specialisation
|
||||
// of ct_imp to handle the logic. (JM)
|
||||
typedef typename boost::detail::ct_imp<
|
||||
T,
|
||||
::boost::is_pointer<T>::value,
|
||||
::boost::is_arithmetic<T>::value
|
||||
>::param_type param_type;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct call_traits<T&>
|
||||
{
|
||||
typedef T& value_type;
|
||||
typedef T& reference;
|
||||
typedef const T& const_reference;
|
||||
typedef T& param_type; // hh removed const
|
||||
};
|
||||
|
||||
#if BOOST_WORKAROUND( __BORLANDC__, < 0x5A0 )
|
||||
// these are illegal specialisations; cv-qualifies applied to
|
||||
// references have no effect according to [8.3.2p1],
|
||||
// C++ Builder requires them though as it treats cv-qualified
|
||||
// references as distinct types...
|
||||
template <typename T>
|
||||
struct call_traits<T&const>
|
||||
{
|
||||
typedef T& value_type;
|
||||
typedef T& reference;
|
||||
typedef const T& const_reference;
|
||||
typedef T& param_type; // hh removed const
|
||||
};
|
||||
template <typename T>
|
||||
struct call_traits<T&volatile>
|
||||
{
|
||||
typedef T& value_type;
|
||||
typedef T& reference;
|
||||
typedef const T& const_reference;
|
||||
typedef T& param_type; // hh removed const
|
||||
};
|
||||
template <typename T>
|
||||
struct call_traits<T&const volatile>
|
||||
{
|
||||
typedef T& value_type;
|
||||
typedef T& reference;
|
||||
typedef const T& const_reference;
|
||||
typedef T& param_type; // hh removed const
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct call_traits< T * >
|
||||
{
|
||||
typedef T * value_type;
|
||||
typedef T * & reference;
|
||||
typedef T * const & const_reference;
|
||||
typedef T * const param_type; // hh removed const
|
||||
};
|
||||
#endif
|
||||
#if !defined(BOOST_NO_ARRAY_TYPE_SPECIALIZATIONS)
|
||||
template <typename T, std::size_t N>
|
||||
struct call_traits<T [N]>
|
||||
{
|
||||
private:
|
||||
typedef T array_type[N];
|
||||
public:
|
||||
// degrades array to pointer:
|
||||
typedef const T* value_type;
|
||||
typedef array_type& reference;
|
||||
typedef const array_type& const_reference;
|
||||
typedef const T* const param_type;
|
||||
};
|
||||
|
||||
template <typename T, std::size_t N>
|
||||
struct call_traits<const T [N]>
|
||||
{
|
||||
private:
|
||||
typedef const T array_type[N];
|
||||
public:
|
||||
// degrades array to pointer:
|
||||
typedef const T* value_type;
|
||||
typedef array_type& reference;
|
||||
typedef const array_type& const_reference;
|
||||
typedef const T* const param_type;
|
||||
};
|
||||
#endif
|
||||
|
||||
}
|
||||
|
||||
#endif // BOOST_DETAIL_CALL_TRAITS_HPP
|
146
library/PolyVoxCore/include/boost/detail/catch_exceptions.hpp
Normal file
146
library/PolyVoxCore/include/boost/detail/catch_exceptions.hpp
Normal file
@ -0,0 +1,146 @@
|
||||
// boost/catch_exceptions.hpp -----------------------------------------------//
|
||||
|
||||
// Copyright Beman Dawes 1995-2001. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying file
|
||||
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See http://www.boost.org/libs/test for documentation.
|
||||
|
||||
// Revision History
|
||||
// 13 Jun 01 report_exception() made inline. (John Maddock, Jesse Jones)
|
||||
// 26 Feb 01 Numerous changes suggested during formal review. (Beman)
|
||||
// 25 Jan 01 catch_exceptions.hpp code factored out of cpp_main.cpp.
|
||||
// 22 Jan 01 Remove test_tools dependencies to reduce coupling.
|
||||
// 5 Nov 00 Initial boost version (Beman Dawes)
|
||||
|
||||
#ifndef BOOST_CATCH_EXCEPTIONS_HPP
|
||||
#define BOOST_CATCH_EXCEPTIONS_HPP
|
||||
|
||||
// header dependencies are deliberately restricted to the standard library
|
||||
// to reduce coupling to other boost libraries.
|
||||
#include <string> // for string
|
||||
#include <new> // for bad_alloc
|
||||
#include <typeinfo> // for bad_cast, bad_typeid
|
||||
#include <exception> // for exception, bad_exception
|
||||
#include <stdexcept> // for std exception hierarchy
|
||||
#include <boost/cstdlib.hpp> // for exit codes
|
||||
# if __GNUC__ != 2 || __GNUC_MINOR__ > 96
|
||||
# include <ostream> // for ostream
|
||||
# else
|
||||
# include <iostream> // workaround GNU missing ostream header
|
||||
# endif
|
||||
|
||||
# if defined(__BORLANDC__) && (__BORLANDC__ <= 0x0551)
|
||||
# define BOOST_BUILT_IN_EXCEPTIONS_MISSING_WHAT
|
||||
# endif
|
||||
|
||||
#if defined(MPW_CPLUS) && (MPW_CPLUS <= 0x890)
|
||||
# define BOOST_BUILT_IN_EXCEPTIONS_MISSING_WHAT
|
||||
namespace std { class bad_typeid { }; }
|
||||
# endif
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
// A separate reporting function was requested during formal review.
|
||||
inline void report_exception( std::ostream & os,
|
||||
const char * name, const char * info )
|
||||
{ os << "\n** uncaught exception: " << name << " " << info << std::endl; }
|
||||
}
|
||||
|
||||
// catch_exceptions ------------------------------------------------------//
|
||||
|
||||
template< class Generator > // Generator is function object returning int
|
||||
int catch_exceptions( Generator function_object,
|
||||
std::ostream & out, std::ostream & err )
|
||||
{
|
||||
int result = 0; // quiet compiler warnings
|
||||
bool exception_thrown = true; // avoid setting result for each excptn type
|
||||
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
try
|
||||
{
|
||||
#endif
|
||||
result = function_object();
|
||||
exception_thrown = false;
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
}
|
||||
|
||||
// As a result of hard experience with strangely interleaved output
|
||||
// under some compilers, there is a lot of use of endl in the code below
|
||||
// where a simple '\n' might appear to do.
|
||||
|
||||
// The rules for catch & arguments are a bit different from function
|
||||
// arguments (ISO 15.3 paragraphs 18 & 19). Apparently const isn't
|
||||
// required, but it doesn't hurt and some programmers ask for it.
|
||||
|
||||
catch ( const char * ex )
|
||||
{ detail::report_exception( out, "", ex ); }
|
||||
catch ( const std::string & ex )
|
||||
{ detail::report_exception( out, "", ex.c_str() ); }
|
||||
|
||||
// std:: exceptions
|
||||
catch ( const std::bad_alloc & ex )
|
||||
{ detail::report_exception( out, "std::bad_alloc:", ex.what() ); }
|
||||
|
||||
# ifndef BOOST_BUILT_IN_EXCEPTIONS_MISSING_WHAT
|
||||
catch ( const std::bad_cast & ex )
|
||||
{ detail::report_exception( out, "std::bad_cast:", ex.what() ); }
|
||||
catch ( const std::bad_typeid & ex )
|
||||
{ detail::report_exception( out, "std::bad_typeid:", ex.what() ); }
|
||||
# else
|
||||
catch ( const std::bad_cast & )
|
||||
{ detail::report_exception( out, "std::bad_cast", "" ); }
|
||||
catch ( const std::bad_typeid & )
|
||||
{ detail::report_exception( out, "std::bad_typeid", "" ); }
|
||||
# endif
|
||||
|
||||
catch ( const std::bad_exception & ex )
|
||||
{ detail::report_exception( out, "std::bad_exception:", ex.what() ); }
|
||||
catch ( const std::domain_error & ex )
|
||||
{ detail::report_exception( out, "std::domain_error:", ex.what() ); }
|
||||
catch ( const std::invalid_argument & ex )
|
||||
{ detail::report_exception( out, "std::invalid_argument:", ex.what() ); }
|
||||
catch ( const std::length_error & ex )
|
||||
{ detail::report_exception( out, "std::length_error:", ex.what() ); }
|
||||
catch ( const std::out_of_range & ex )
|
||||
{ detail::report_exception( out, "std::out_of_range:", ex.what() ); }
|
||||
catch ( const std::range_error & ex )
|
||||
{ detail::report_exception( out, "std::range_error:", ex.what() ); }
|
||||
catch ( const std::overflow_error & ex )
|
||||
{ detail::report_exception( out, "std::overflow_error:", ex.what() ); }
|
||||
catch ( const std::underflow_error & ex )
|
||||
{ detail::report_exception( out, "std::underflow_error:", ex.what() ); }
|
||||
catch ( const std::logic_error & ex )
|
||||
{ detail::report_exception( out, "std::logic_error:", ex.what() ); }
|
||||
catch ( const std::runtime_error & ex )
|
||||
{ detail::report_exception( out, "std::runtime_error:", ex.what() ); }
|
||||
catch ( const std::exception & ex )
|
||||
{ detail::report_exception( out, "std::exception:", ex.what() ); }
|
||||
|
||||
catch ( ... )
|
||||
{ detail::report_exception( out, "unknown exception", "" ); }
|
||||
#endif // BOOST_NO_EXCEPTIONS
|
||||
|
||||
if ( exception_thrown ) result = boost::exit_exception_failure;
|
||||
|
||||
if ( result != 0 && result != exit_success )
|
||||
{
|
||||
out << std::endl << "**** returning with error code "
|
||||
<< result << std::endl;
|
||||
err
|
||||
<< "********** errors detected; see stdout for details ***********"
|
||||
<< std::endl;
|
||||
}
|
||||
#if !defined(BOOST_NO_CPP_MAIN_SUCCESS_MESSAGE)
|
||||
else { out << std::flush << "no errors detected" << std::endl; }
|
||||
#endif
|
||||
return result;
|
||||
} // catch_exceptions
|
||||
|
||||
} // boost
|
||||
|
||||
#endif // BOOST_CATCH_EXCEPTIONS_HPP
|
||||
|
443
library/PolyVoxCore/include/boost/detail/compressed_pair.hpp
Normal file
443
library/PolyVoxCore/include/boost/detail/compressed_pair.hpp
Normal file
@ -0,0 +1,443 @@
|
||||
// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000.
|
||||
// Use, modification and distribution are subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt).
|
||||
//
|
||||
// See http://www.boost.org/libs/utility for most recent version including documentation.
|
||||
|
||||
// compressed_pair: pair that "compresses" empty members
|
||||
// (see libs/utility/compressed_pair.htm)
|
||||
//
|
||||
// JM changes 25 Jan 2004:
|
||||
// For the case where T1 == T2 and both are empty, then first() and second()
|
||||
// should return different objects.
|
||||
// JM changes 25 Jan 2000:
|
||||
// Removed default arguments from compressed_pair_switch to get
|
||||
// C++ Builder 4 to accept them
|
||||
// rewriten swap to get gcc and C++ builder to compile.
|
||||
// added partial specialisations for case T1 == T2 to avoid duplicate constructor defs.
|
||||
|
||||
#ifndef BOOST_DETAIL_COMPRESSED_PAIR_HPP
|
||||
#define BOOST_DETAIL_COMPRESSED_PAIR_HPP
|
||||
|
||||
#include <algorithm>
|
||||
|
||||
#include <boost/type_traits/remove_cv.hpp>
|
||||
#include <boost/type_traits/is_empty.hpp>
|
||||
#include <boost/type_traits/is_same.hpp>
|
||||
#include <boost/call_traits.hpp>
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(push)
|
||||
# pragma warning(disable:4512)
|
||||
#endif
|
||||
namespace boost
|
||||
{
|
||||
|
||||
template <class T1, class T2>
|
||||
class compressed_pair;
|
||||
|
||||
|
||||
// compressed_pair
|
||||
|
||||
namespace details
|
||||
{
|
||||
// JM altered 26 Jan 2000:
|
||||
template <class T1, class T2, bool IsSame, bool FirstEmpty, bool SecondEmpty>
|
||||
struct compressed_pair_switch;
|
||||
|
||||
template <class T1, class T2>
|
||||
struct compressed_pair_switch<T1, T2, false, false, false>
|
||||
{static const int value = 0;};
|
||||
|
||||
template <class T1, class T2>
|
||||
struct compressed_pair_switch<T1, T2, false, true, true>
|
||||
{static const int value = 3;};
|
||||
|
||||
template <class T1, class T2>
|
||||
struct compressed_pair_switch<T1, T2, false, true, false>
|
||||
{static const int value = 1;};
|
||||
|
||||
template <class T1, class T2>
|
||||
struct compressed_pair_switch<T1, T2, false, false, true>
|
||||
{static const int value = 2;};
|
||||
|
||||
template <class T1, class T2>
|
||||
struct compressed_pair_switch<T1, T2, true, true, true>
|
||||
{static const int value = 4;};
|
||||
|
||||
template <class T1, class T2>
|
||||
struct compressed_pair_switch<T1, T2, true, false, false>
|
||||
{static const int value = 5;};
|
||||
|
||||
template <class T1, class T2, int Version> class compressed_pair_imp;
|
||||
|
||||
#ifdef __GNUC__
|
||||
// workaround for GCC (JM):
|
||||
using std::swap;
|
||||
#endif
|
||||
//
|
||||
// can't call unqualified swap from within classname::swap
|
||||
// as Koenig lookup rules will find only the classname::swap
|
||||
// member function not the global declaration, so use cp_swap
|
||||
// as a forwarding function (JM):
|
||||
template <typename T>
|
||||
inline void cp_swap(T& t1, T& t2)
|
||||
{
|
||||
#ifndef __GNUC__
|
||||
using std::swap;
|
||||
#endif
|
||||
swap(t1, t2);
|
||||
}
|
||||
|
||||
// 0 derive from neither
|
||||
|
||||
template <class T1, class T2>
|
||||
class compressed_pair_imp<T1, T2, 0>
|
||||
{
|
||||
public:
|
||||
typedef T1 first_type;
|
||||
typedef T2 second_type;
|
||||
typedef typename call_traits<first_type>::param_type first_param_type;
|
||||
typedef typename call_traits<second_type>::param_type second_param_type;
|
||||
typedef typename call_traits<first_type>::reference first_reference;
|
||||
typedef typename call_traits<second_type>::reference second_reference;
|
||||
typedef typename call_traits<first_type>::const_reference first_const_reference;
|
||||
typedef typename call_traits<second_type>::const_reference second_const_reference;
|
||||
|
||||
compressed_pair_imp() {}
|
||||
|
||||
compressed_pair_imp(first_param_type x, second_param_type y)
|
||||
: first_(x), second_(y) {}
|
||||
|
||||
compressed_pair_imp(first_param_type x)
|
||||
: first_(x) {}
|
||||
|
||||
compressed_pair_imp(second_param_type y)
|
||||
: second_(y) {}
|
||||
|
||||
first_reference first() {return first_;}
|
||||
first_const_reference first() const {return first_;}
|
||||
|
||||
second_reference second() {return second_;}
|
||||
second_const_reference second() const {return second_;}
|
||||
|
||||
void swap(::boost::compressed_pair<T1, T2>& y)
|
||||
{
|
||||
cp_swap(first_, y.first());
|
||||
cp_swap(second_, y.second());
|
||||
}
|
||||
private:
|
||||
first_type first_;
|
||||
second_type second_;
|
||||
};
|
||||
|
||||
// 1 derive from T1
|
||||
|
||||
template <class T1, class T2>
|
||||
class compressed_pair_imp<T1, T2, 1>
|
||||
: protected ::boost::remove_cv<T1>::type
|
||||
{
|
||||
public:
|
||||
typedef T1 first_type;
|
||||
typedef T2 second_type;
|
||||
typedef typename call_traits<first_type>::param_type first_param_type;
|
||||
typedef typename call_traits<second_type>::param_type second_param_type;
|
||||
typedef typename call_traits<first_type>::reference first_reference;
|
||||
typedef typename call_traits<second_type>::reference second_reference;
|
||||
typedef typename call_traits<first_type>::const_reference first_const_reference;
|
||||
typedef typename call_traits<second_type>::const_reference second_const_reference;
|
||||
|
||||
compressed_pair_imp() {}
|
||||
|
||||
compressed_pair_imp(first_param_type x, second_param_type y)
|
||||
: first_type(x), second_(y) {}
|
||||
|
||||
compressed_pair_imp(first_param_type x)
|
||||
: first_type(x) {}
|
||||
|
||||
compressed_pair_imp(second_param_type y)
|
||||
: second_(y) {}
|
||||
|
||||
first_reference first() {return *this;}
|
||||
first_const_reference first() const {return *this;}
|
||||
|
||||
second_reference second() {return second_;}
|
||||
second_const_reference second() const {return second_;}
|
||||
|
||||
void swap(::boost::compressed_pair<T1,T2>& y)
|
||||
{
|
||||
// no need to swap empty base class:
|
||||
cp_swap(second_, y.second());
|
||||
}
|
||||
private:
|
||||
second_type second_;
|
||||
};
|
||||
|
||||
// 2 derive from T2
|
||||
|
||||
template <class T1, class T2>
|
||||
class compressed_pair_imp<T1, T2, 2>
|
||||
: protected ::boost::remove_cv<T2>::type
|
||||
{
|
||||
public:
|
||||
typedef T1 first_type;
|
||||
typedef T2 second_type;
|
||||
typedef typename call_traits<first_type>::param_type first_param_type;
|
||||
typedef typename call_traits<second_type>::param_type second_param_type;
|
||||
typedef typename call_traits<first_type>::reference first_reference;
|
||||
typedef typename call_traits<second_type>::reference second_reference;
|
||||
typedef typename call_traits<first_type>::const_reference first_const_reference;
|
||||
typedef typename call_traits<second_type>::const_reference second_const_reference;
|
||||
|
||||
compressed_pair_imp() {}
|
||||
|
||||
compressed_pair_imp(first_param_type x, second_param_type y)
|
||||
: second_type(y), first_(x) {}
|
||||
|
||||
compressed_pair_imp(first_param_type x)
|
||||
: first_(x) {}
|
||||
|
||||
compressed_pair_imp(second_param_type y)
|
||||
: second_type(y) {}
|
||||
|
||||
first_reference first() {return first_;}
|
||||
first_const_reference first() const {return first_;}
|
||||
|
||||
second_reference second() {return *this;}
|
||||
second_const_reference second() const {return *this;}
|
||||
|
||||
void swap(::boost::compressed_pair<T1,T2>& y)
|
||||
{
|
||||
// no need to swap empty base class:
|
||||
cp_swap(first_, y.first());
|
||||
}
|
||||
|
||||
private:
|
||||
first_type first_;
|
||||
};
|
||||
|
||||
// 3 derive from T1 and T2
|
||||
|
||||
template <class T1, class T2>
|
||||
class compressed_pair_imp<T1, T2, 3>
|
||||
: protected ::boost::remove_cv<T1>::type,
|
||||
protected ::boost::remove_cv<T2>::type
|
||||
{
|
||||
public:
|
||||
typedef T1 first_type;
|
||||
typedef T2 second_type;
|
||||
typedef typename call_traits<first_type>::param_type first_param_type;
|
||||
typedef typename call_traits<second_type>::param_type second_param_type;
|
||||
typedef typename call_traits<first_type>::reference first_reference;
|
||||
typedef typename call_traits<second_type>::reference second_reference;
|
||||
typedef typename call_traits<first_type>::const_reference first_const_reference;
|
||||
typedef typename call_traits<second_type>::const_reference second_const_reference;
|
||||
|
||||
compressed_pair_imp() {}
|
||||
|
||||
compressed_pair_imp(first_param_type x, second_param_type y)
|
||||
: first_type(x), second_type(y) {}
|
||||
|
||||
compressed_pair_imp(first_param_type x)
|
||||
: first_type(x) {}
|
||||
|
||||
compressed_pair_imp(second_param_type y)
|
||||
: second_type(y) {}
|
||||
|
||||
first_reference first() {return *this;}
|
||||
first_const_reference first() const {return *this;}
|
||||
|
||||
second_reference second() {return *this;}
|
||||
second_const_reference second() const {return *this;}
|
||||
//
|
||||
// no need to swap empty bases:
|
||||
void swap(::boost::compressed_pair<T1,T2>&) {}
|
||||
};
|
||||
|
||||
// JM
|
||||
// 4 T1 == T2, T1 and T2 both empty
|
||||
// Originally this did not store an instance of T2 at all
|
||||
// but that led to problems beause it meant &x.first() == &x.second()
|
||||
// which is not true for any other kind of pair, so now we store an instance
|
||||
// of T2 just in case the user is relying on first() and second() returning
|
||||
// different objects (albeit both empty).
|
||||
template <class T1, class T2>
|
||||
class compressed_pair_imp<T1, T2, 4>
|
||||
: protected ::boost::remove_cv<T1>::type
|
||||
{
|
||||
public:
|
||||
typedef T1 first_type;
|
||||
typedef T2 second_type;
|
||||
typedef typename call_traits<first_type>::param_type first_param_type;
|
||||
typedef typename call_traits<second_type>::param_type second_param_type;
|
||||
typedef typename call_traits<first_type>::reference first_reference;
|
||||
typedef typename call_traits<second_type>::reference second_reference;
|
||||
typedef typename call_traits<first_type>::const_reference first_const_reference;
|
||||
typedef typename call_traits<second_type>::const_reference second_const_reference;
|
||||
|
||||
compressed_pair_imp() {}
|
||||
|
||||
compressed_pair_imp(first_param_type x, second_param_type y)
|
||||
: first_type(x), m_second(y) {}
|
||||
|
||||
compressed_pair_imp(first_param_type x)
|
||||
: first_type(x), m_second(x) {}
|
||||
|
||||
first_reference first() {return *this;}
|
||||
first_const_reference first() const {return *this;}
|
||||
|
||||
second_reference second() {return m_second;}
|
||||
second_const_reference second() const {return m_second;}
|
||||
|
||||
void swap(::boost::compressed_pair<T1,T2>&) {}
|
||||
private:
|
||||
T2 m_second;
|
||||
};
|
||||
|
||||
// 5 T1 == T2 and are not empty: //JM
|
||||
|
||||
template <class T1, class T2>
|
||||
class compressed_pair_imp<T1, T2, 5>
|
||||
{
|
||||
public:
|
||||
typedef T1 first_type;
|
||||
typedef T2 second_type;
|
||||
typedef typename call_traits<first_type>::param_type first_param_type;
|
||||
typedef typename call_traits<second_type>::param_type second_param_type;
|
||||
typedef typename call_traits<first_type>::reference first_reference;
|
||||
typedef typename call_traits<second_type>::reference second_reference;
|
||||
typedef typename call_traits<first_type>::const_reference first_const_reference;
|
||||
typedef typename call_traits<second_type>::const_reference second_const_reference;
|
||||
|
||||
compressed_pair_imp() {}
|
||||
|
||||
compressed_pair_imp(first_param_type x, second_param_type y)
|
||||
: first_(x), second_(y) {}
|
||||
|
||||
compressed_pair_imp(first_param_type x)
|
||||
: first_(x), second_(x) {}
|
||||
|
||||
first_reference first() {return first_;}
|
||||
first_const_reference first() const {return first_;}
|
||||
|
||||
second_reference second() {return second_;}
|
||||
second_const_reference second() const {return second_;}
|
||||
|
||||
void swap(::boost::compressed_pair<T1, T2>& y)
|
||||
{
|
||||
cp_swap(first_, y.first());
|
||||
cp_swap(second_, y.second());
|
||||
}
|
||||
private:
|
||||
first_type first_;
|
||||
second_type second_;
|
||||
};
|
||||
|
||||
} // details
|
||||
|
||||
template <class T1, class T2>
|
||||
class compressed_pair
|
||||
: private ::boost::details::compressed_pair_imp<T1, T2,
|
||||
::boost::details::compressed_pair_switch<
|
||||
T1,
|
||||
T2,
|
||||
::boost::is_same<typename remove_cv<T1>::type, typename remove_cv<T2>::type>::value,
|
||||
::boost::is_empty<T1>::value,
|
||||
::boost::is_empty<T2>::value>::value>
|
||||
{
|
||||
private:
|
||||
typedef details::compressed_pair_imp<T1, T2,
|
||||
::boost::details::compressed_pair_switch<
|
||||
T1,
|
||||
T2,
|
||||
::boost::is_same<typename remove_cv<T1>::type, typename remove_cv<T2>::type>::value,
|
||||
::boost::is_empty<T1>::value,
|
||||
::boost::is_empty<T2>::value>::value> base;
|
||||
public:
|
||||
typedef T1 first_type;
|
||||
typedef T2 second_type;
|
||||
typedef typename call_traits<first_type>::param_type first_param_type;
|
||||
typedef typename call_traits<second_type>::param_type second_param_type;
|
||||
typedef typename call_traits<first_type>::reference first_reference;
|
||||
typedef typename call_traits<second_type>::reference second_reference;
|
||||
typedef typename call_traits<first_type>::const_reference first_const_reference;
|
||||
typedef typename call_traits<second_type>::const_reference second_const_reference;
|
||||
|
||||
compressed_pair() : base() {}
|
||||
compressed_pair(first_param_type x, second_param_type y) : base(x, y) {}
|
||||
explicit compressed_pair(first_param_type x) : base(x) {}
|
||||
explicit compressed_pair(second_param_type y) : base(y) {}
|
||||
|
||||
first_reference first() {return base::first();}
|
||||
first_const_reference first() const {return base::first();}
|
||||
|
||||
second_reference second() {return base::second();}
|
||||
second_const_reference second() const {return base::second();}
|
||||
|
||||
void swap(compressed_pair& y) { base::swap(y); }
|
||||
};
|
||||
|
||||
// JM
|
||||
// Partial specialisation for case where T1 == T2:
|
||||
//
|
||||
template <class T>
|
||||
class compressed_pair<T, T>
|
||||
: private details::compressed_pair_imp<T, T,
|
||||
::boost::details::compressed_pair_switch<
|
||||
T,
|
||||
T,
|
||||
::boost::is_same<typename remove_cv<T>::type, typename remove_cv<T>::type>::value,
|
||||
::boost::is_empty<T>::value,
|
||||
::boost::is_empty<T>::value>::value>
|
||||
{
|
||||
private:
|
||||
typedef details::compressed_pair_imp<T, T,
|
||||
::boost::details::compressed_pair_switch<
|
||||
T,
|
||||
T,
|
||||
::boost::is_same<typename remove_cv<T>::type, typename remove_cv<T>::type>::value,
|
||||
::boost::is_empty<T>::value,
|
||||
::boost::is_empty<T>::value>::value> base;
|
||||
public:
|
||||
typedef T first_type;
|
||||
typedef T second_type;
|
||||
typedef typename call_traits<first_type>::param_type first_param_type;
|
||||
typedef typename call_traits<second_type>::param_type second_param_type;
|
||||
typedef typename call_traits<first_type>::reference first_reference;
|
||||
typedef typename call_traits<second_type>::reference second_reference;
|
||||
typedef typename call_traits<first_type>::const_reference first_const_reference;
|
||||
typedef typename call_traits<second_type>::const_reference second_const_reference;
|
||||
|
||||
compressed_pair() : base() {}
|
||||
compressed_pair(first_param_type x, second_param_type y) : base(x, y) {}
|
||||
#if !(defined(__SUNPRO_CC) && (__SUNPRO_CC <= 0x530))
|
||||
explicit
|
||||
#endif
|
||||
compressed_pair(first_param_type x) : base(x) {}
|
||||
|
||||
first_reference first() {return base::first();}
|
||||
first_const_reference first() const {return base::first();}
|
||||
|
||||
second_reference second() {return base::second();}
|
||||
second_const_reference second() const {return base::second();}
|
||||
|
||||
void swap(::boost::compressed_pair<T,T>& y) { base::swap(y); }
|
||||
};
|
||||
|
||||
template <class T1, class T2>
|
||||
inline
|
||||
void
|
||||
swap(compressed_pair<T1, T2>& x, compressed_pair<T1, T2>& y)
|
||||
{
|
||||
x.swap(y);
|
||||
}
|
||||
|
||||
} // boost
|
||||
|
||||
#ifdef BOOST_MSVC
|
||||
# pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif // BOOST_DETAIL_COMPRESSED_PAIR_HPP
|
||||
|
99
library/PolyVoxCore/include/boost/detail/container_fwd.hpp
Normal file
99
library/PolyVoxCore/include/boost/detail/container_fwd.hpp
Normal file
@ -0,0 +1,99 @@
|
||||
|
||||
// Copyright 2005-2008 Daniel James.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#if !defined(BOOST_DETAIL_CONTAINER_FWD_HPP)
|
||||
#define BOOST_DETAIL_CONTAINER_FWD_HPP
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
#if BOOST_WORKAROUND(__GNUC__, < 3) && !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION)
|
||||
#define BOOST_HASH_CHAR_TRAITS string_char_traits
|
||||
#else
|
||||
#define BOOST_HASH_CHAR_TRAITS char_traits
|
||||
#endif
|
||||
|
||||
#if (defined(__GLIBCXX__) && defined(_GLIBCXX_DEBUG)) \
|
||||
|| BOOST_WORKAROUND(__BORLANDC__, > 0x551) \
|
||||
|| BOOST_WORKAROUND(__DMC__, BOOST_TESTED_AT(0x842)) \
|
||||
|| (defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION))
|
||||
|
||||
#include <deque>
|
||||
#include <list>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <set>
|
||||
#include <bitset>
|
||||
#include <string>
|
||||
#include <complex>
|
||||
|
||||
#else
|
||||
|
||||
#include <cstddef>
|
||||
|
||||
#if !defined(__SGI_STL_PORT) && !defined(_STLPORT_VERSION) && \
|
||||
defined(__STL_CONFIG_H)
|
||||
|
||||
#define BOOST_CONTAINER_FWD_BAD_BITSET
|
||||
|
||||
#if !defined(__STL_NON_TYPE_TMPL_PARAM_BUG)
|
||||
#define BOOST_CONTAINER_FWD_BAD_DEQUE
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_CONTAINER_FWD_BAD_DEQUE)
|
||||
#include <deque>
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_CONTAINER_FWD_BAD_BITSET)
|
||||
#include <bitset>
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4099) // struct/class mismatch in fwd declarations
|
||||
#endif
|
||||
|
||||
namespace std
|
||||
{
|
||||
template <class T> class allocator;
|
||||
template <class charT, class traits, class Allocator> class basic_string;
|
||||
template <class charT> struct BOOST_HASH_CHAR_TRAITS;
|
||||
template <class T> class complex;
|
||||
}
|
||||
|
||||
// gcc 3.4 and greater
|
||||
namespace std
|
||||
{
|
||||
#if !defined(BOOST_CONTAINER_FWD_BAD_DEQUE)
|
||||
template <class T, class Allocator> class deque;
|
||||
#endif
|
||||
|
||||
template <class T, class Allocator> class list;
|
||||
template <class T, class Allocator> class vector;
|
||||
template <class Key, class T, class Compare, class Allocator> class map;
|
||||
template <class Key, class T, class Compare, class Allocator>
|
||||
class multimap;
|
||||
template <class Key, class Compare, class Allocator> class set;
|
||||
template <class Key, class Compare, class Allocator> class multiset;
|
||||
|
||||
#if !defined(BOOST_CONTAINER_FWD_BAD_BITSET)
|
||||
template <size_t N> class bitset;
|
||||
#endif
|
||||
template <class T1, class T2> struct pair;
|
||||
}
|
||||
|
||||
#if defined(BOOST_MSVC)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
229
library/PolyVoxCore/include/boost/detail/dynamic_bitset.hpp
Normal file
229
library/PolyVoxCore/include/boost/detail/dynamic_bitset.hpp
Normal file
@ -0,0 +1,229 @@
|
||||
// -----------------------------------------------------------
|
||||
//
|
||||
// Copyright (c) 2001-2002 Chuck Allison and Jeremy Siek
|
||||
// Copyright (c) 2003-2006, 2008 Gennaro Prota
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// -----------------------------------------------------------
|
||||
|
||||
#ifndef BOOST_DETAIL_DYNAMIC_BITSET_HPP
|
||||
#define BOOST_DETAIL_DYNAMIC_BITSET_HPP
|
||||
|
||||
#include <cstddef>
|
||||
#include "boost/config.hpp"
|
||||
#include "boost/detail/workaround.hpp"
|
||||
|
||||
|
||||
namespace boost {
|
||||
|
||||
namespace detail {
|
||||
namespace dynamic_bitset_impl {
|
||||
|
||||
// Gives (read-)access to the object representation
|
||||
// of an object of type T (3.9p4). CANNOT be used
|
||||
// on a base sub-object
|
||||
//
|
||||
template <typename T>
|
||||
inline const unsigned char * object_representation (T* p)
|
||||
{
|
||||
return static_cast<const unsigned char *>(static_cast<const void *>(p));
|
||||
}
|
||||
|
||||
template<typename T, int amount, int width /* = default */>
|
||||
struct shifter
|
||||
{
|
||||
static void left_shift(T & v) {
|
||||
amount >= width ? (v = 0)
|
||||
: (v >>= BOOST_DYNAMIC_BITSET_WRAP_CONSTANT(amount));
|
||||
}
|
||||
};
|
||||
|
||||
// ------- count function implementation --------------
|
||||
|
||||
typedef unsigned char byte_type;
|
||||
|
||||
// These two entities
|
||||
//
|
||||
// enum mode { access_by_bytes, access_by_blocks };
|
||||
// template <mode> struct mode_to_type {};
|
||||
//
|
||||
// were removed, since the regression logs (as of 24 Aug 2008)
|
||||
// showed that several compilers had troubles with recognizing
|
||||
//
|
||||
// const mode m = access_by_bytes
|
||||
//
|
||||
// as a constant expression
|
||||
//
|
||||
// * So, we'll use bool, instead of enum *.
|
||||
//
|
||||
template <bool value>
|
||||
struct value_to_type
|
||||
{
|
||||
value_to_type() {}
|
||||
};
|
||||
const bool access_by_bytes = true;
|
||||
const bool access_by_blocks = false;
|
||||
|
||||
|
||||
// the table: wrapped in a class template, so
|
||||
// that it is only instantiated if/when needed
|
||||
//
|
||||
template <bool dummy_name = true>
|
||||
struct count_table { static const byte_type table[]; };
|
||||
|
||||
template <>
|
||||
struct count_table<false> { /* no table */ };
|
||||
|
||||
|
||||
const unsigned int table_width = 8;
|
||||
template <bool b>
|
||||
const byte_type count_table<b>::table[] =
|
||||
{
|
||||
// Automatically generated by GPTableGen.exe v.1.0
|
||||
//
|
||||
0, 1, 1, 2, 1, 2, 2, 3, 1, 2, 2, 3, 2, 3, 3, 4, 1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5,
|
||||
1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
|
||||
1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
|
||||
2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
|
||||
1, 2, 2, 3, 2, 3, 3, 4, 2, 3, 3, 4, 3, 4, 4, 5, 2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6,
|
||||
2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
|
||||
2, 3, 3, 4, 3, 4, 4, 5, 3, 4, 4, 5, 4, 5, 5, 6, 3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7,
|
||||
3, 4, 4, 5, 4, 5, 5, 6, 4, 5, 5, 6, 5, 6, 6, 7, 4, 5, 5, 6, 5, 6, 6, 7, 5, 6, 6, 7, 6, 7, 7, 8
|
||||
};
|
||||
|
||||
|
||||
// overload for access by bytes
|
||||
//
|
||||
|
||||
template <typename Iterator>
|
||||
inline std::size_t do_count(Iterator first, std::size_t length,
|
||||
int /*dummy param*/,
|
||||
value_to_type<access_by_bytes>* )
|
||||
{
|
||||
std::size_t num = 0;
|
||||
if (length)
|
||||
{
|
||||
const byte_type * p = object_representation(&*first);
|
||||
length *= sizeof(*first);
|
||||
|
||||
do {
|
||||
num += count_table<>::table[*p];
|
||||
++p;
|
||||
--length;
|
||||
|
||||
} while (length);
|
||||
}
|
||||
|
||||
return num;
|
||||
}
|
||||
|
||||
|
||||
// overload for access by blocks
|
||||
//
|
||||
template <typename Iterator, typename ValueType>
|
||||
inline std::size_t do_count(Iterator first, std::size_t length, ValueType,
|
||||
value_to_type<access_by_blocks>*)
|
||||
{
|
||||
std::size_t num = 0;
|
||||
while (length){
|
||||
|
||||
ValueType value = *first;
|
||||
while (value) {
|
||||
num += count_table<>::table[value & ((1u<<table_width) - 1)];
|
||||
value >>= table_width;
|
||||
}
|
||||
|
||||
++first;
|
||||
--length;
|
||||
}
|
||||
|
||||
return num;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------
|
||||
|
||||
|
||||
// Some library implementations simply return a dummy
|
||||
// value such as
|
||||
//
|
||||
// size_type(-1) / sizeof(T)
|
||||
//
|
||||
// from vector<>::max_size. This tries to get more
|
||||
// meaningful info.
|
||||
//
|
||||
template <typename T>
|
||||
typename T::size_type vector_max_size_workaround(const T & v) {
|
||||
|
||||
typedef typename T::allocator_type allocator_type;
|
||||
|
||||
const typename allocator_type::size_type alloc_max =
|
||||
v.get_allocator().max_size();
|
||||
const typename T::size_type container_max = v.max_size();
|
||||
|
||||
return alloc_max < container_max?
|
||||
alloc_max :
|
||||
container_max;
|
||||
}
|
||||
|
||||
// for static_asserts
|
||||
template <typename T>
|
||||
struct allowed_block_type {
|
||||
enum { value = T(-1) > 0 }; // ensure T has no sign
|
||||
};
|
||||
|
||||
template <>
|
||||
struct allowed_block_type<bool> {
|
||||
enum { value = false };
|
||||
};
|
||||
|
||||
|
||||
template <typename T>
|
||||
struct is_numeric {
|
||||
enum { value = false };
|
||||
};
|
||||
|
||||
# define BOOST_dynamic_bitset_is_numeric(x) \
|
||||
template<> \
|
||||
struct is_numeric< x > { \
|
||||
enum { value = true }; \
|
||||
} /**/
|
||||
|
||||
BOOST_dynamic_bitset_is_numeric(bool);
|
||||
BOOST_dynamic_bitset_is_numeric(char);
|
||||
|
||||
#if !defined(BOOST_NO_INTRINSIC_WCHAR_T)
|
||||
BOOST_dynamic_bitset_is_numeric(wchar_t);
|
||||
#endif
|
||||
|
||||
BOOST_dynamic_bitset_is_numeric(signed char);
|
||||
BOOST_dynamic_bitset_is_numeric(short int);
|
||||
BOOST_dynamic_bitset_is_numeric(int);
|
||||
BOOST_dynamic_bitset_is_numeric(long int);
|
||||
|
||||
BOOST_dynamic_bitset_is_numeric(unsigned char);
|
||||
BOOST_dynamic_bitset_is_numeric(unsigned short);
|
||||
BOOST_dynamic_bitset_is_numeric(unsigned int);
|
||||
BOOST_dynamic_bitset_is_numeric(unsigned long);
|
||||
|
||||
#if defined(BOOST_HAS_LONG_LONG)
|
||||
BOOST_dynamic_bitset_is_numeric(::boost::long_long_type);
|
||||
BOOST_dynamic_bitset_is_numeric(::boost::ulong_long_type);
|
||||
#endif
|
||||
|
||||
// intentionally omitted
|
||||
//BOOST_dynamic_bitset_is_numeric(float);
|
||||
//BOOST_dynamic_bitset_is_numeric(double);
|
||||
//BOOST_dynamic_bitset_is_numeric(long double);
|
||||
|
||||
#undef BOOST_dynamic_bitset_is_numeric
|
||||
|
||||
} // dynamic_bitset_impl
|
||||
} // namespace detail
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // include guard
|
||||
|
73
library/PolyVoxCore/include/boost/detail/endian.hpp
Normal file
73
library/PolyVoxCore/include/boost/detail/endian.hpp
Normal file
@ -0,0 +1,73 @@
|
||||
// Copyright 2005 Caleb Epstein
|
||||
// Copyright 2006 John Maddock
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompany-
|
||||
// ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997
|
||||
* Silicon Graphics Computer Systems, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Silicon Graphics makes no
|
||||
* representations about the suitability of this software for any
|
||||
* purpose. It is provided "as is" without express or implied warranty.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Copyright notice reproduced from <boost/detail/limits.hpp>, from
|
||||
* which this code was originally taken.
|
||||
*
|
||||
* Modified by Caleb Epstein to use <endian.h> with GNU libc and to
|
||||
* defined the BOOST_ENDIAN macro.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_DETAIL_ENDIAN_HPP
|
||||
#define BOOST_DETAIL_ENDIAN_HPP
|
||||
|
||||
// GNU libc offers the helpful header <endian.h> which defines
|
||||
// __BYTE_ORDER
|
||||
|
||||
#if defined (__GLIBC__)
|
||||
# include <endian.h>
|
||||
# if (__BYTE_ORDER == __LITTLE_ENDIAN)
|
||||
# define BOOST_LITTLE_ENDIAN
|
||||
# elif (__BYTE_ORDER == __BIG_ENDIAN)
|
||||
# define BOOST_BIG_ENDIAN
|
||||
# elif (__BYTE_ORDER == __PDP_ENDIAN)
|
||||
# define BOOST_PDP_ENDIAN
|
||||
# else
|
||||
# error Unknown machine endianness detected.
|
||||
# endif
|
||||
# define BOOST_BYTE_ORDER __BYTE_ORDER
|
||||
#elif defined(_BIG_ENDIAN) && !defined(_LITTLE_ENDIAN)
|
||||
# define BOOST_BIG_ENDIAN
|
||||
# define BOOST_BYTE_ORDER 4321
|
||||
#elif defined(_LITTLE_ENDIAN) && !defined(_BIG_ENDIAN)
|
||||
# define BOOST_LITTLE_ENDIAN
|
||||
# define BOOST_BYTE_ORDER 1234
|
||||
#elif defined(__sparc) || defined(__sparc__) \
|
||||
|| defined(_POWER) || defined(__powerpc__) \
|
||||
|| defined(__ppc__) || defined(__hpux) \
|
||||
|| defined(_MIPSEB) || defined(_POWER) \
|
||||
|| defined(__s390__)
|
||||
# define BOOST_BIG_ENDIAN
|
||||
# define BOOST_BYTE_ORDER 4321
|
||||
#elif defined(__i386__) || defined(__alpha__) \
|
||||
|| defined(__ia64) || defined(__ia64__) \
|
||||
|| defined(_M_IX86) || defined(_M_IA64) \
|
||||
|| defined(_M_ALPHA) || defined(__amd64) \
|
||||
|| defined(__amd64__) || defined(_M_AMD64) \
|
||||
|| defined(__x86_64) || defined(__x86_64__) \
|
||||
|| defined(_M_X64) || defined(__bfin__)
|
||||
|
||||
# define BOOST_LITTLE_ENDIAN
|
||||
# define BOOST_BYTE_ORDER 1234
|
||||
#else
|
||||
# error The file boost/detail/endian.hpp needs to be set up for your CPU type.
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
@ -0,0 +1,29 @@
|
||||
|
||||
// (C) Copyright Matthias Troyerk 2006.
|
||||
// Use, modification and distribution are subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt).
|
||||
//
|
||||
// See http://www.boost.org/libs/type_traits for most recent version including documentation.
|
||||
|
||||
#ifndef BOOST_DETAIL_HAS_DEFAULT_CONSTRUCTOR_HPP_INCLUDED
|
||||
#define BOOST_DETAIL_HAS_DEFAULT_CONSTRUCTOR_HPP_INCLUDED
|
||||
|
||||
#include <boost/type_traits/has_trivial_constructor.hpp>
|
||||
|
||||
namespace boost { namespace detail {
|
||||
|
||||
/// type trait to check for a default constructor
|
||||
///
|
||||
/// The default implementation just checks for a trivial constructor.
|
||||
/// Using some compiler magic it might be possible to provide a better default
|
||||
|
||||
template <class T>
|
||||
struct has_default_constructor
|
||||
: public has_trivial_constructor<T>
|
||||
{};
|
||||
|
||||
} } // namespace boost::detail
|
||||
|
||||
|
||||
#endif // BOOST_DETAIL_HAS_DEFAULT_CONSTRUCTOR_HPP_INCLUDED
|
89
library/PolyVoxCore/include/boost/detail/identifier.hpp
Normal file
89
library/PolyVoxCore/include/boost/detail/identifier.hpp
Normal file
@ -0,0 +1,89 @@
|
||||
// boost/identifier.hpp ----------------------------------------------------//
|
||||
|
||||
// Copyright Beman Dawes 2006
|
||||
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// See documentation at http://www.boost.org/libs/utility
|
||||
|
||||
#ifndef BOOST_IDENTIFIER_HPP
|
||||
#define BOOST_IDENTIFIER_HPP
|
||||
|
||||
#include <boost/utility/enable_if.hpp>
|
||||
#include <boost/type_traits/is_base_of.hpp>
|
||||
#include <iosfwd>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
namespace detail
|
||||
{
|
||||
// class template identifier ---------------------------------------------//
|
||||
|
||||
// Always used as a base class so that different instantiations result in
|
||||
// different class types even if instantiated with the same value type T.
|
||||
|
||||
// Expected usage is that T is often an integer type, best passed by
|
||||
// value. There is no reason why T can't be a possibly larger class such as
|
||||
// std::string, best passed by const reference.
|
||||
|
||||
// This implementation uses pass by value, based on expected common uses.
|
||||
|
||||
template <typename T, typename D>
|
||||
class identifier
|
||||
{
|
||||
public:
|
||||
typedef T value_type;
|
||||
|
||||
const value_type value() const { return m_value; }
|
||||
void assign( value_type v ) { m_value = v; }
|
||||
|
||||
bool operator==( const D & rhs ) const { return m_value == rhs.m_value; }
|
||||
bool operator!=( const D & rhs ) const { return m_value != rhs.m_value; }
|
||||
bool operator< ( const D & rhs ) const { return m_value < rhs.m_value; }
|
||||
bool operator<=( const D & rhs ) const { return m_value <= rhs.m_value; }
|
||||
bool operator> ( const D & rhs ) const { return m_value > rhs.m_value; }
|
||||
bool operator>=( const D & rhs ) const { return m_value >= rhs.m_value; }
|
||||
|
||||
typedef void (*unspecified_bool_type)(D); // without the D, unspecified_bool_type
|
||||
static void unspecified_bool_true(D){} // conversion allows relational operators
|
||||
// between different identifier types
|
||||
|
||||
operator unspecified_bool_type() const { return m_value == value_type() ? 0 : unspecified_bool_true; }
|
||||
bool operator!() const { return m_value == value_type(); }
|
||||
|
||||
// constructors are protected so that class can only be used as a base class
|
||||
protected:
|
||||
identifier() {}
|
||||
explicit identifier( value_type v ) : m_value(v) {}
|
||||
|
||||
#if !defined(BOOST_MSVC) || BOOST_MSVC > 1300 // 1300 == VC++ 7.0 bug workaround
|
||||
private:
|
||||
#endif
|
||||
T m_value;
|
||||
};
|
||||
|
||||
//#ifndef BOOST_NO_SFINAE
|
||||
|
||||
// template <class Ostream, class Id>
|
||||
// typename enable_if< is_base_of< identifier< typename Id::value_type, Id >, Id >,
|
||||
// Ostream & >::type operator<<( Ostream & os, const Id & id )
|
||||
// {
|
||||
// return os << id.value();
|
||||
// }
|
||||
|
||||
// template <class Istream, class Id>
|
||||
// typename enable_if< is_base_of< identifier< typename Id::value_type, Id >, Id >,
|
||||
// Istream & >::type operator>>( Istream & is, Id & id )
|
||||
// {
|
||||
// typename Id::value_type v;
|
||||
// is >> v;
|
||||
// id.value( v );
|
||||
// return is;
|
||||
// }
|
||||
//#endif
|
||||
|
||||
} // namespace detail
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_IDENTIFIER_HPP
|
487
library/PolyVoxCore/include/boost/detail/indirect_traits.hpp
Normal file
487
library/PolyVoxCore/include/boost/detail/indirect_traits.hpp
Normal file
@ -0,0 +1,487 @@
|
||||
// Copyright David Abrahams 2002.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
#ifndef INDIRECT_TRAITS_DWA2002131_HPP
|
||||
# define INDIRECT_TRAITS_DWA2002131_HPP
|
||||
# include <boost/type_traits/is_function.hpp>
|
||||
# include <boost/type_traits/is_reference.hpp>
|
||||
# include <boost/type_traits/is_pointer.hpp>
|
||||
# include <boost/type_traits/is_class.hpp>
|
||||
# include <boost/type_traits/is_const.hpp>
|
||||
# include <boost/type_traits/is_volatile.hpp>
|
||||
# include <boost/type_traits/is_member_function_pointer.hpp>
|
||||
# include <boost/type_traits/is_member_pointer.hpp>
|
||||
# include <boost/type_traits/remove_cv.hpp>
|
||||
# include <boost/type_traits/remove_reference.hpp>
|
||||
# include <boost/type_traits/remove_pointer.hpp>
|
||||
|
||||
# include <boost/type_traits/detail/ice_and.hpp>
|
||||
# include <boost/detail/workaround.hpp>
|
||||
|
||||
# include <boost/mpl/eval_if.hpp>
|
||||
# include <boost/mpl/if.hpp>
|
||||
# include <boost/mpl/bool.hpp>
|
||||
# include <boost/mpl/and.hpp>
|
||||
# include <boost/mpl/not.hpp>
|
||||
# include <boost/mpl/aux_/lambda_support.hpp>
|
||||
|
||||
# ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
# include <boost/detail/is_function_ref_tester.hpp>
|
||||
# endif
|
||||
|
||||
namespace boost { namespace detail {
|
||||
|
||||
namespace indirect_traits {
|
||||
|
||||
# ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
template <class T>
|
||||
struct is_reference_to_const : mpl::false_
|
||||
{
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct is_reference_to_const<T const&> : mpl::true_
|
||||
{
|
||||
};
|
||||
|
||||
# if defined(BOOST_MSVC) && _MSC_FULL_VER <= 13102140 // vc7.01 alpha workaround
|
||||
template<class T>
|
||||
struct is_reference_to_const<T const volatile&> : mpl::true_
|
||||
{
|
||||
};
|
||||
# endif
|
||||
|
||||
template <class T>
|
||||
struct is_reference_to_function : mpl::false_
|
||||
{
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct is_reference_to_function<T&> : is_function<T>
|
||||
{
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct is_pointer_to_function : mpl::false_
|
||||
{
|
||||
};
|
||||
|
||||
// There's no such thing as a pointer-to-cv-function, so we don't need
|
||||
// specializations for those
|
||||
template <class T>
|
||||
struct is_pointer_to_function<T*> : is_function<T>
|
||||
{
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct is_reference_to_member_function_pointer_impl : mpl::false_
|
||||
{
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct is_reference_to_member_function_pointer_impl<T&>
|
||||
: is_member_function_pointer<typename remove_cv<T>::type>
|
||||
{
|
||||
};
|
||||
|
||||
|
||||
template <class T>
|
||||
struct is_reference_to_member_function_pointer
|
||||
: is_reference_to_member_function_pointer_impl<T>
|
||||
{
|
||||
BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_member_function_pointer,(T))
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct is_reference_to_function_pointer_aux
|
||||
: mpl::and_<
|
||||
is_reference<T>
|
||||
, is_pointer_to_function<
|
||||
typename remove_cv<
|
||||
typename remove_reference<T>::type
|
||||
>::type
|
||||
>
|
||||
>
|
||||
{
|
||||
// There's no such thing as a pointer-to-cv-function, so we don't need specializations for those
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct is_reference_to_function_pointer
|
||||
: mpl::if_<
|
||||
is_reference_to_function<T>
|
||||
, mpl::false_
|
||||
, is_reference_to_function_pointer_aux<T>
|
||||
>::type
|
||||
{
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct is_reference_to_non_const
|
||||
: mpl::and_<
|
||||
is_reference<T>
|
||||
, mpl::not_<
|
||||
is_reference_to_const<T>
|
||||
>
|
||||
>
|
||||
{
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct is_reference_to_volatile : mpl::false_
|
||||
{
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct is_reference_to_volatile<T volatile&> : mpl::true_
|
||||
{
|
||||
};
|
||||
|
||||
# if defined(BOOST_MSVC) && _MSC_FULL_VER <= 13102140 // vc7.01 alpha workaround
|
||||
template <class T>
|
||||
struct is_reference_to_volatile<T const volatile&> : mpl::true_
|
||||
{
|
||||
};
|
||||
# endif
|
||||
|
||||
|
||||
template <class T>
|
||||
struct is_reference_to_pointer : mpl::false_
|
||||
{
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct is_reference_to_pointer<T*&> : mpl::true_
|
||||
{
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct is_reference_to_pointer<T* const&> : mpl::true_
|
||||
{
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct is_reference_to_pointer<T* volatile&> : mpl::true_
|
||||
{
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct is_reference_to_pointer<T* const volatile&> : mpl::true_
|
||||
{
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct is_reference_to_class
|
||||
: mpl::and_<
|
||||
is_reference<T>
|
||||
, is_class<
|
||||
typename remove_cv<
|
||||
typename remove_reference<T>::type
|
||||
>::type
|
||||
>
|
||||
>
|
||||
{
|
||||
BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_class,(T))
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct is_pointer_to_class
|
||||
: mpl::and_<
|
||||
is_pointer<T>
|
||||
, is_class<
|
||||
typename remove_cv<
|
||||
typename remove_pointer<T>::type
|
||||
>::type
|
||||
>
|
||||
>
|
||||
{
|
||||
BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_pointer_to_class,(T))
|
||||
};
|
||||
|
||||
# else
|
||||
|
||||
using namespace boost::detail::is_function_ref_tester_;
|
||||
|
||||
typedef char (&inner_yes_type)[3];
|
||||
typedef char (&inner_no_type)[2];
|
||||
typedef char (&outer_no_type)[1];
|
||||
|
||||
template <typename V>
|
||||
struct is_const_help
|
||||
{
|
||||
typedef typename mpl::if_<
|
||||
is_const<V>
|
||||
, inner_yes_type
|
||||
, inner_no_type
|
||||
>::type type;
|
||||
};
|
||||
|
||||
template <typename V>
|
||||
struct is_volatile_help
|
||||
{
|
||||
typedef typename mpl::if_<
|
||||
is_volatile<V>
|
||||
, inner_yes_type
|
||||
, inner_no_type
|
||||
>::type type;
|
||||
};
|
||||
|
||||
template <typename V>
|
||||
struct is_pointer_help
|
||||
{
|
||||
typedef typename mpl::if_<
|
||||
is_pointer<V>
|
||||
, inner_yes_type
|
||||
, inner_no_type
|
||||
>::type type;
|
||||
};
|
||||
|
||||
template <typename V>
|
||||
struct is_class_help
|
||||
{
|
||||
typedef typename mpl::if_<
|
||||
is_class<V>
|
||||
, inner_yes_type
|
||||
, inner_no_type
|
||||
>::type type;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct is_reference_to_function_aux
|
||||
{
|
||||
static T t;
|
||||
BOOST_STATIC_CONSTANT(
|
||||
bool, value = sizeof(detail::is_function_ref_tester(t,0)) == sizeof(::boost::type_traits::yes_type));
|
||||
typedef mpl::bool_<value> type;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct is_reference_to_function
|
||||
: mpl::if_<is_reference<T>, is_reference_to_function_aux<T>, mpl::bool_<false> >::type
|
||||
{
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct is_pointer_to_function_aux
|
||||
{
|
||||
static T t;
|
||||
BOOST_STATIC_CONSTANT(
|
||||
bool, value
|
||||
= sizeof(::boost::type_traits::is_function_ptr_tester(t)) == sizeof(::boost::type_traits::yes_type));
|
||||
typedef mpl::bool_<value> type;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct is_pointer_to_function
|
||||
: mpl::if_<is_pointer<T>, is_pointer_to_function_aux<T>, mpl::bool_<false> >::type
|
||||
{
|
||||
BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_pointer_to_function,(T))
|
||||
};
|
||||
|
||||
struct false_helper1
|
||||
{
|
||||
template <class T>
|
||||
struct apply : mpl::false_
|
||||
{
|
||||
};
|
||||
};
|
||||
|
||||
template <typename V>
|
||||
typename is_const_help<V>::type reference_to_const_helper(V&);
|
||||
outer_no_type
|
||||
reference_to_const_helper(...);
|
||||
|
||||
struct true_helper1
|
||||
{
|
||||
template <class T>
|
||||
struct apply
|
||||
{
|
||||
static T t;
|
||||
BOOST_STATIC_CONSTANT(
|
||||
bool, value
|
||||
= sizeof(reference_to_const_helper(t)) == sizeof(inner_yes_type));
|
||||
typedef mpl::bool_<value> type;
|
||||
};
|
||||
};
|
||||
|
||||
template <bool ref = true>
|
||||
struct is_reference_to_const_helper1 : true_helper1
|
||||
{
|
||||
};
|
||||
|
||||
template <>
|
||||
struct is_reference_to_const_helper1<false> : false_helper1
|
||||
{
|
||||
};
|
||||
|
||||
|
||||
template <class T>
|
||||
struct is_reference_to_const
|
||||
: is_reference_to_const_helper1<is_reference<T>::value>::template apply<T>
|
||||
{
|
||||
};
|
||||
|
||||
|
||||
template <bool ref = true>
|
||||
struct is_reference_to_non_const_helper1
|
||||
{
|
||||
template <class T>
|
||||
struct apply
|
||||
{
|
||||
static T t;
|
||||
BOOST_STATIC_CONSTANT(
|
||||
bool, value
|
||||
= sizeof(reference_to_const_helper(t)) == sizeof(inner_no_type));
|
||||
|
||||
typedef mpl::bool_<value> type;
|
||||
};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct is_reference_to_non_const_helper1<false> : false_helper1
|
||||
{
|
||||
};
|
||||
|
||||
|
||||
template <class T>
|
||||
struct is_reference_to_non_const
|
||||
: is_reference_to_non_const_helper1<is_reference<T>::value>::template apply<T>
|
||||
{
|
||||
BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_non_const,(T))
|
||||
};
|
||||
|
||||
|
||||
template <typename V>
|
||||
typename is_volatile_help<V>::type reference_to_volatile_helper(V&);
|
||||
outer_no_type
|
||||
reference_to_volatile_helper(...);
|
||||
|
||||
template <bool ref = true>
|
||||
struct is_reference_to_volatile_helper1
|
||||
{
|
||||
template <class T>
|
||||
struct apply
|
||||
{
|
||||
static T t;
|
||||
BOOST_STATIC_CONSTANT(
|
||||
bool, value
|
||||
= sizeof(reference_to_volatile_helper(t)) == sizeof(inner_yes_type));
|
||||
typedef mpl::bool_<value> type;
|
||||
};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct is_reference_to_volatile_helper1<false> : false_helper1
|
||||
{
|
||||
};
|
||||
|
||||
|
||||
template <class T>
|
||||
struct is_reference_to_volatile
|
||||
: is_reference_to_volatile_helper1<is_reference<T>::value>::template apply<T>
|
||||
{
|
||||
};
|
||||
|
||||
template <typename V>
|
||||
typename is_pointer_help<V>::type reference_to_pointer_helper(V&);
|
||||
outer_no_type reference_to_pointer_helper(...);
|
||||
|
||||
template <class T>
|
||||
struct reference_to_pointer_impl
|
||||
{
|
||||
static T t;
|
||||
BOOST_STATIC_CONSTANT(
|
||||
bool, value
|
||||
= (sizeof((reference_to_pointer_helper)(t)) == sizeof(inner_yes_type))
|
||||
);
|
||||
|
||||
typedef mpl::bool_<value> type;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct is_reference_to_pointer
|
||||
: mpl::eval_if<is_reference<T>, reference_to_pointer_impl<T>, mpl::false_>::type
|
||||
{
|
||||
BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_pointer,(T))
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct is_reference_to_function_pointer
|
||||
: mpl::eval_if<is_reference<T>, is_pointer_to_function_aux<T>, mpl::false_>::type
|
||||
{
|
||||
BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_function_pointer,(T))
|
||||
};
|
||||
|
||||
|
||||
template <class T>
|
||||
struct is_member_function_pointer_help
|
||||
: mpl::if_<is_member_function_pointer<T>, inner_yes_type, inner_no_type>
|
||||
{};
|
||||
|
||||
template <typename V>
|
||||
typename is_member_function_pointer_help<V>::type member_function_pointer_helper(V&);
|
||||
outer_no_type member_function_pointer_helper(...);
|
||||
|
||||
template <class T>
|
||||
struct is_pointer_to_member_function_aux
|
||||
{
|
||||
static T t;
|
||||
BOOST_STATIC_CONSTANT(
|
||||
bool, value
|
||||
= sizeof((member_function_pointer_helper)(t)) == sizeof(inner_yes_type));
|
||||
typedef mpl::bool_<value> type;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct is_reference_to_member_function_pointer
|
||||
: mpl::if_<
|
||||
is_reference<T>
|
||||
, is_pointer_to_member_function_aux<T>
|
||||
, mpl::bool_<false>
|
||||
>::type
|
||||
{
|
||||
BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_member_function_pointer,(T))
|
||||
};
|
||||
|
||||
template <typename V>
|
||||
typename is_class_help<V>::type reference_to_class_helper(V const volatile&);
|
||||
outer_no_type reference_to_class_helper(...);
|
||||
|
||||
template <class T>
|
||||
struct is_reference_to_class
|
||||
{
|
||||
static T t;
|
||||
BOOST_STATIC_CONSTANT(
|
||||
bool, value
|
||||
= (is_reference<T>::value
|
||||
& (sizeof(reference_to_class_helper(t)) == sizeof(inner_yes_type)))
|
||||
);
|
||||
typedef mpl::bool_<value> type;
|
||||
BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_reference_to_class,(T))
|
||||
};
|
||||
|
||||
template <typename V>
|
||||
typename is_class_help<V>::type pointer_to_class_helper(V const volatile*);
|
||||
outer_no_type pointer_to_class_helper(...);
|
||||
|
||||
template <class T>
|
||||
struct is_pointer_to_class
|
||||
{
|
||||
static T t;
|
||||
BOOST_STATIC_CONSTANT(
|
||||
bool, value
|
||||
= (is_pointer<T>::value
|
||||
&& sizeof(pointer_to_class_helper(t)) == sizeof(inner_yes_type))
|
||||
);
|
||||
typedef mpl::bool_<value> type;
|
||||
};
|
||||
# endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
|
||||
}
|
||||
|
||||
using namespace indirect_traits;
|
||||
|
||||
}} // namespace boost::python::detail
|
||||
|
||||
#endif // INDIRECT_TRAITS_DWA2002131_HPP
|
130
library/PolyVoxCore/include/boost/detail/interlocked.hpp
Normal file
130
library/PolyVoxCore/include/boost/detail/interlocked.hpp
Normal file
@ -0,0 +1,130 @@
|
||||
#ifndef BOOST_DETAIL_INTERLOCKED_HPP_INCLUDED
|
||||
#define BOOST_DETAIL_INTERLOCKED_HPP_INCLUDED
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
//
|
||||
// boost/detail/interlocked.hpp
|
||||
//
|
||||
// Copyright 2005 Peter Dimov
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#if defined( BOOST_USE_WINDOWS_H )
|
||||
|
||||
# include <windows.h>
|
||||
|
||||
# define BOOST_INTERLOCKED_INCREMENT InterlockedIncrement
|
||||
# define BOOST_INTERLOCKED_DECREMENT InterlockedDecrement
|
||||
# define BOOST_INTERLOCKED_COMPARE_EXCHANGE InterlockedCompareExchange
|
||||
# define BOOST_INTERLOCKED_EXCHANGE InterlockedExchange
|
||||
# define BOOST_INTERLOCKED_EXCHANGE_ADD InterlockedExchangeAdd
|
||||
# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER InterlockedCompareExchangePointer
|
||||
# define BOOST_INTERLOCKED_EXCHANGE_POINTER InterlockedExchangePointer
|
||||
|
||||
#elif defined(_WIN32_WCE)
|
||||
|
||||
// under Windows CE we still have old-style Interlocked* functions
|
||||
|
||||
extern "C" long __cdecl InterlockedIncrement( long* );
|
||||
extern "C" long __cdecl InterlockedDecrement( long* );
|
||||
extern "C" long __cdecl InterlockedCompareExchange( long*, long, long );
|
||||
extern "C" long __cdecl InterlockedExchange( long*, long );
|
||||
extern "C" long __cdecl InterlockedExchangeAdd( long*, long );
|
||||
|
||||
# define BOOST_INTERLOCKED_INCREMENT InterlockedIncrement
|
||||
# define BOOST_INTERLOCKED_DECREMENT InterlockedDecrement
|
||||
# define BOOST_INTERLOCKED_COMPARE_EXCHANGE InterlockedCompareExchange
|
||||
# define BOOST_INTERLOCKED_EXCHANGE InterlockedExchange
|
||||
# define BOOST_INTERLOCKED_EXCHANGE_ADD InterlockedExchangeAdd
|
||||
|
||||
# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest,exchange,compare) \
|
||||
((void*)BOOST_INTERLOCKED_COMPARE_EXCHANGE((long*)(dest),(long)(exchange),(long)(compare)))
|
||||
# define BOOST_INTERLOCKED_EXCHANGE_POINTER(dest,exchange) \
|
||||
((void*)BOOST_INTERLOCKED_EXCHANGE((long*)(dest),(long)(exchange)))
|
||||
|
||||
#elif defined( BOOST_MSVC ) || defined( BOOST_INTEL_WIN )
|
||||
|
||||
extern "C" long __cdecl _InterlockedIncrement( long volatile * );
|
||||
extern "C" long __cdecl _InterlockedDecrement( long volatile * );
|
||||
extern "C" long __cdecl _InterlockedCompareExchange( long volatile *, long, long );
|
||||
extern "C" long __cdecl _InterlockedExchange( long volatile *, long);
|
||||
extern "C" long __cdecl _InterlockedExchangeAdd( long volatile *, long);
|
||||
|
||||
# pragma intrinsic( _InterlockedIncrement )
|
||||
# pragma intrinsic( _InterlockedDecrement )
|
||||
# pragma intrinsic( _InterlockedCompareExchange )
|
||||
# pragma intrinsic( _InterlockedExchange )
|
||||
# pragma intrinsic( _InterlockedExchangeAdd )
|
||||
|
||||
# if defined(_M_IA64) || defined(_M_AMD64)
|
||||
|
||||
extern "C" void* __cdecl _InterlockedCompareExchangePointer( void* volatile *, void*, void* );
|
||||
extern "C" void* __cdecl _InterlockedExchangePointer( void* volatile *, void* );
|
||||
|
||||
# pragma intrinsic( _InterlockedCompareExchangePointer )
|
||||
# pragma intrinsic( _InterlockedExchangePointer )
|
||||
|
||||
# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER _InterlockedCompareExchangePointer
|
||||
# define BOOST_INTERLOCKED_EXCHANGE_POINTER _InterlockedExchangePointer
|
||||
|
||||
# else
|
||||
|
||||
# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest,exchange,compare) \
|
||||
((void*)BOOST_INTERLOCKED_COMPARE_EXCHANGE((long volatile*)(dest),(long)(exchange),(long)(compare)))
|
||||
# define BOOST_INTERLOCKED_EXCHANGE_POINTER(dest,exchange) \
|
||||
((void*)BOOST_INTERLOCKED_EXCHANGE((long volatile*)(dest),(long)(exchange)))
|
||||
|
||||
# endif
|
||||
|
||||
# define BOOST_INTERLOCKED_INCREMENT _InterlockedIncrement
|
||||
# define BOOST_INTERLOCKED_DECREMENT _InterlockedDecrement
|
||||
# define BOOST_INTERLOCKED_COMPARE_EXCHANGE _InterlockedCompareExchange
|
||||
# define BOOST_INTERLOCKED_EXCHANGE _InterlockedExchange
|
||||
# define BOOST_INTERLOCKED_EXCHANGE_ADD _InterlockedExchangeAdd
|
||||
|
||||
#elif defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || defined( __CYGWIN__ )
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
extern "C" __declspec(dllimport) long __stdcall InterlockedIncrement( long volatile * );
|
||||
extern "C" __declspec(dllimport) long __stdcall InterlockedDecrement( long volatile * );
|
||||
extern "C" __declspec(dllimport) long __stdcall InterlockedCompareExchange( long volatile *, long, long );
|
||||
extern "C" __declspec(dllimport) long __stdcall InterlockedExchange( long volatile *, long );
|
||||
extern "C" __declspec(dllimport) long __stdcall InterlockedExchangeAdd( long volatile *, long );
|
||||
|
||||
} // namespace detail
|
||||
|
||||
} // namespace boost
|
||||
|
||||
# define BOOST_INTERLOCKED_INCREMENT ::boost::detail::InterlockedIncrement
|
||||
# define BOOST_INTERLOCKED_DECREMENT ::boost::detail::InterlockedDecrement
|
||||
# define BOOST_INTERLOCKED_COMPARE_EXCHANGE ::boost::detail::InterlockedCompareExchange
|
||||
# define BOOST_INTERLOCKED_EXCHANGE ::boost::detail::InterlockedExchange
|
||||
# define BOOST_INTERLOCKED_EXCHANGE_ADD ::boost::detail::InterlockedExchangeAdd
|
||||
|
||||
# define BOOST_INTERLOCKED_COMPARE_EXCHANGE_POINTER(dest,exchange,compare) \
|
||||
((void*)BOOST_INTERLOCKED_COMPARE_EXCHANGE((long volatile*)(dest),(long)(exchange),(long)(compare)))
|
||||
# define BOOST_INTERLOCKED_EXCHANGE_POINTER(dest,exchange) \
|
||||
((void*)BOOST_INTERLOCKED_EXCHANGE((long volatile*)(dest),(long)(exchange)))
|
||||
|
||||
#else
|
||||
|
||||
# error "Interlocked intrinsics not available"
|
||||
|
||||
#endif
|
||||
|
||||
#endif // #ifndef BOOST_DETAIL_INTERLOCKED_HPP_INCLUDED
|
@ -0,0 +1,135 @@
|
||||
|
||||
// (C) Copyright Dave Abrahams, Steve Cleary, Beman Dawes,
|
||||
// Aleksey Gurtovoy, Howard Hinnant & John Maddock 2000.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#if !defined(BOOST_PP_IS_ITERATING)
|
||||
|
||||
///// header body
|
||||
|
||||
#ifndef BOOST_DETAIL_IS_FUNCTION_REF_TESTER_HPP_INCLUDED
|
||||
#define BOOST_DETAIL_IS_FUNCTION_REF_TESTER_HPP_INCLUDED
|
||||
|
||||
#include "boost/type_traits/detail/yes_no_type.hpp"
|
||||
#include "boost/type_traits/config.hpp"
|
||||
|
||||
#if defined(BOOST_TT_PREPROCESSING_MODE)
|
||||
# include "boost/preprocessor/iterate.hpp"
|
||||
# include "boost/preprocessor/enum_params.hpp"
|
||||
# include "boost/preprocessor/comma_if.hpp"
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace detail {
|
||||
namespace is_function_ref_tester_ {
|
||||
|
||||
template <class T>
|
||||
boost::type_traits::no_type BOOST_TT_DECL is_function_ref_tester(T& ...);
|
||||
|
||||
#if !defined(BOOST_TT_PREPROCESSING_MODE)
|
||||
// preprocessor-generated part, don't edit by hand!
|
||||
|
||||
template <class R>
|
||||
boost::type_traits::yes_type is_function_ref_tester(R (&)(), int);
|
||||
|
||||
template <class R,class T0 >
|
||||
boost::type_traits::yes_type is_function_ref_tester(R (&)(T0), int);
|
||||
|
||||
template <class R,class T0,class T1 >
|
||||
boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1), int);
|
||||
|
||||
template <class R,class T0,class T1,class T2 >
|
||||
boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2), int);
|
||||
|
||||
template <class R,class T0,class T1,class T2,class T3 >
|
||||
boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3), int);
|
||||
|
||||
template <class R,class T0,class T1,class T2,class T3,class T4 >
|
||||
boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4), int);
|
||||
|
||||
template <class R,class T0,class T1,class T2,class T3,class T4,class T5 >
|
||||
boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5), int);
|
||||
|
||||
template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6 >
|
||||
boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6), int);
|
||||
|
||||
template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7 >
|
||||
boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7), int);
|
||||
|
||||
template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8 >
|
||||
boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8), int);
|
||||
|
||||
template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9 >
|
||||
boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9), int);
|
||||
|
||||
template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10 >
|
||||
boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10), int);
|
||||
|
||||
template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11 >
|
||||
boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11), int);
|
||||
|
||||
template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12 >
|
||||
boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12), int);
|
||||
|
||||
template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13 >
|
||||
boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13), int);
|
||||
|
||||
template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13,class T14 >
|
||||
boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14), int);
|
||||
|
||||
template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13,class T14,class T15 >
|
||||
boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15), int);
|
||||
|
||||
template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13,class T14,class T15,class T16 >
|
||||
boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16), int);
|
||||
|
||||
template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13,class T14,class T15,class T16,class T17 >
|
||||
boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17), int);
|
||||
|
||||
template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13,class T14,class T15,class T16,class T17,class T18 >
|
||||
boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18), int);
|
||||
|
||||
template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13,class T14,class T15,class T16,class T17,class T18,class T19 >
|
||||
boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19), int);
|
||||
|
||||
template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13,class T14,class T15,class T16,class T17,class T18,class T19,class T20 >
|
||||
boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20), int);
|
||||
|
||||
template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13,class T14,class T15,class T16,class T17,class T18,class T19,class T20,class T21 >
|
||||
boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21), int);
|
||||
|
||||
template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13,class T14,class T15,class T16,class T17,class T18,class T19,class T20,class T21,class T22 >
|
||||
boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22), int);
|
||||
|
||||
template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13,class T14,class T15,class T16,class T17,class T18,class T19,class T20,class T21,class T22,class T23 >
|
||||
boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22,T23), int);
|
||||
|
||||
template <class R,class T0,class T1,class T2,class T3,class T4,class T5,class T6,class T7,class T8,class T9,class T10,class T11,class T12,class T13,class T14,class T15,class T16,class T17,class T18,class T19,class T20,class T21,class T22,class T23,class T24 >
|
||||
boost::type_traits::yes_type is_function_ref_tester(R (&)(T0,T1,T2,T3,T4,T5,T6,T7,T8,T9,T10,T11,T12,T13,T14,T15,T16,T17,T18,T19,T20,T21,T22,T23,T24), int);
|
||||
|
||||
#else
|
||||
|
||||
#define BOOST_PP_ITERATION_PARAMS_1 \
|
||||
(3, (0, 25, "boost/type_traits/detail/is_function_ref_tester.hpp"))
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
#endif // BOOST_TT_PREPROCESSING_MODE
|
||||
|
||||
} // namespace detail
|
||||
} // namespace python
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_DETAIL_IS_FUNCTION_REF_TESTER_HPP_INCLUDED
|
||||
|
||||
///// iteration
|
||||
|
||||
#else
|
||||
#define i BOOST_PP_FRAME_ITERATION(1)
|
||||
|
||||
template <class R BOOST_PP_COMMA_IF(i) BOOST_PP_ENUM_PARAMS(i,class T) >
|
||||
boost::type_traits::yes_type is_function_ref_tester(R (&)(BOOST_PP_ENUM_PARAMS(i,T)), int);
|
||||
|
||||
#undef i
|
||||
#endif // BOOST_PP_IS_ITERATING
|
124
library/PolyVoxCore/include/boost/detail/is_incrementable.hpp
Normal file
124
library/PolyVoxCore/include/boost/detail/is_incrementable.hpp
Normal file
@ -0,0 +1,124 @@
|
||||
// Copyright David Abrahams 2004. Use, modification and distribution is
|
||||
// subject to the Boost Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
#ifndef IS_INCREMENTABLE_DWA200415_HPP
|
||||
# define IS_INCREMENTABLE_DWA200415_HPP
|
||||
|
||||
# include <boost/type_traits/detail/template_arity_spec.hpp>
|
||||
# include <boost/type_traits/remove_cv.hpp>
|
||||
# include <boost/mpl/aux_/lambda_support.hpp>
|
||||
# include <boost/mpl/bool.hpp>
|
||||
# include <boost/detail/workaround.hpp>
|
||||
|
||||
// Must be the last include
|
||||
# include <boost/type_traits/detail/bool_trait_def.hpp>
|
||||
|
||||
namespace boost { namespace detail {
|
||||
|
||||
// is_incrementable<T> metafunction
|
||||
//
|
||||
// Requires: Given x of type T&, if the expression ++x is well-formed
|
||||
// it must have complete type; otherwise, it must neither be ambiguous
|
||||
// nor violate access.
|
||||
|
||||
// This namespace ensures that ADL doesn't mess things up.
|
||||
namespace is_incrementable_
|
||||
{
|
||||
// a type returned from operator++ when no increment is found in the
|
||||
// type's own namespace
|
||||
struct tag {};
|
||||
|
||||
// any soaks up implicit conversions and makes the following
|
||||
// operator++ less-preferred than any other such operator that
|
||||
// might be found via ADL.
|
||||
struct any { template <class T> any(T const&); };
|
||||
|
||||
// This is a last-resort operator++ for when none other is found
|
||||
# if BOOST_WORKAROUND(__GNUC__, == 4) && __GNUC_MINOR__ == 0 && __GNUC_PATCHLEVEL__ == 2
|
||||
|
||||
}
|
||||
|
||||
namespace is_incrementable_2
|
||||
{
|
||||
is_incrementable_::tag operator++(is_incrementable_::any const&);
|
||||
is_incrementable_::tag operator++(is_incrementable_::any const&,int);
|
||||
}
|
||||
using namespace is_incrementable_2;
|
||||
|
||||
namespace is_incrementable_
|
||||
{
|
||||
|
||||
# else
|
||||
|
||||
tag operator++(any const&);
|
||||
tag operator++(any const&,int);
|
||||
|
||||
# endif
|
||||
|
||||
# if BOOST_WORKAROUND(__MWERKS__, BOOST_TESTED_AT(0x3202)) \
|
||||
|| BOOST_WORKAROUND(BOOST_MSVC, <= 1300)
|
||||
# define BOOST_comma(a,b) (a)
|
||||
# else
|
||||
// In case an operator++ is found that returns void, we'll use ++x,0
|
||||
tag operator,(tag,int);
|
||||
# define BOOST_comma(a,b) (a,b)
|
||||
# endif
|
||||
|
||||
// two check overloads help us identify which operator++ was picked
|
||||
char (& check(tag) )[2];
|
||||
|
||||
template <class T>
|
||||
char check(T const&);
|
||||
|
||||
|
||||
template <class T>
|
||||
struct impl
|
||||
{
|
||||
static typename boost::remove_cv<T>::type& x;
|
||||
|
||||
BOOST_STATIC_CONSTANT(
|
||||
bool
|
||||
, value = sizeof(is_incrementable_::check(BOOST_comma(++x,0))) == 1
|
||||
);
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct postfix_impl
|
||||
{
|
||||
static typename boost::remove_cv<T>::type& x;
|
||||
|
||||
BOOST_STATIC_CONSTANT(
|
||||
bool
|
||||
, value = sizeof(is_incrementable_::check(BOOST_comma(x++,0))) == 1
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
# undef BOOST_comma
|
||||
|
||||
template<typename T>
|
||||
struct is_incrementable
|
||||
BOOST_TT_AUX_BOOL_C_BASE(::boost::detail::is_incrementable_::impl<T>::value)
|
||||
{
|
||||
BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(::boost::detail::is_incrementable_::impl<T>::value)
|
||||
BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_incrementable,(T))
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
struct is_postfix_incrementable
|
||||
BOOST_TT_AUX_BOOL_C_BASE(::boost::detail::is_incrementable_::impl<T>::value)
|
||||
{
|
||||
BOOST_TT_AUX_BOOL_TRAIT_VALUE_DECL(::boost::detail::is_incrementable_::postfix_impl<T>::value)
|
||||
BOOST_MPL_AUX_LAMBDA_SUPPORT(1,is_postfix_incrementable,(T))
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(1, ::boost::detail::is_incrementable)
|
||||
BOOST_TT_AUX_TEMPLATE_ARITY_SPEC(1, ::boost::detail::is_postfix_incrementable)
|
||||
|
||||
} // namespace boost
|
||||
|
||||
# include <boost/type_traits/detail/bool_trait_undef.hpp>
|
||||
|
||||
#endif // IS_INCREMENTABLE_DWA200415_HPP
|
61
library/PolyVoxCore/include/boost/detail/is_xxx.hpp
Normal file
61
library/PolyVoxCore/include/boost/detail/is_xxx.hpp
Normal file
@ -0,0 +1,61 @@
|
||||
// Copyright David Abrahams 2005. Distributed under the Boost
|
||||
// Software License, Version 1.0. (See accompanying
|
||||
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
#ifndef BOOST_DETAIL_IS_XXX_DWA20051011_HPP
|
||||
# define BOOST_DETAIL_IS_XXX_DWA20051011_HPP
|
||||
|
||||
# include <boost/config.hpp>
|
||||
# include <boost/mpl/bool.hpp>
|
||||
# include <boost/preprocessor/enum_params.hpp>
|
||||
|
||||
# if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
||||
# include <boost/type_traits/is_reference.hpp>
|
||||
# include <boost/type_traits/add_reference.hpp>
|
||||
|
||||
# define BOOST_DETAIL_IS_XXX_DEF(name, qualified_name, nargs) \
|
||||
template <class X_> \
|
||||
struct is_##name \
|
||||
{ \
|
||||
typedef char yes; \
|
||||
typedef char (&no)[2]; \
|
||||
\
|
||||
static typename add_reference<X_>::type dummy; \
|
||||
\
|
||||
struct helpers \
|
||||
{ \
|
||||
template < BOOST_PP_ENUM_PARAMS_Z(1, nargs, class U) > \
|
||||
static yes test( \
|
||||
qualified_name< BOOST_PP_ENUM_PARAMS_Z(1, nargs, U) >&, int \
|
||||
); \
|
||||
\
|
||||
template <class U> \
|
||||
static no test(U&, ...); \
|
||||
}; \
|
||||
\
|
||||
BOOST_STATIC_CONSTANT( \
|
||||
bool, value \
|
||||
= !is_reference<X_>::value \
|
||||
& (sizeof(helpers::test(dummy, 0)) == sizeof(yes))); \
|
||||
\
|
||||
typedef mpl::bool_<value> type; \
|
||||
};
|
||||
|
||||
# else
|
||||
|
||||
# define BOOST_DETAIL_IS_XXX_DEF(name, qualified_name, nargs) \
|
||||
template <class T> \
|
||||
struct is_##name : mpl::false_ \
|
||||
{ \
|
||||
}; \
|
||||
\
|
||||
template < BOOST_PP_ENUM_PARAMS_Z(1, nargs, class T) > \
|
||||
struct is_##name< \
|
||||
qualified_name< BOOST_PP_ENUM_PARAMS_Z(1, nargs, T) > \
|
||||
> \
|
||||
: mpl::true_ \
|
||||
{ \
|
||||
};
|
||||
|
||||
# endif
|
||||
|
||||
#endif // BOOST_DETAIL_IS_XXX_DWA20051011_HPP
|
494
library/PolyVoxCore/include/boost/detail/iterator.hpp
Normal file
494
library/PolyVoxCore/include/boost/detail/iterator.hpp
Normal file
@ -0,0 +1,494 @@
|
||||
// (C) Copyright David Abrahams 2002.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Boost versions of
|
||||
//
|
||||
// std::iterator_traits<>::iterator_category
|
||||
// std::iterator_traits<>::difference_type
|
||||
// std::distance()
|
||||
//
|
||||
// ...for all compilers and iterators
|
||||
//
|
||||
// Additionally, if X is a pointer
|
||||
// std::iterator_traits<X>::pointer
|
||||
|
||||
// Otherwise, if partial specialization is supported or X is not a pointer
|
||||
// std::iterator_traits<X>::value_type
|
||||
// std::iterator_traits<X>::pointer
|
||||
// std::iterator_traits<X>::reference
|
||||
//
|
||||
// See http://www.boost.org for most recent version including documentation.
|
||||
|
||||
// Revision History
|
||||
// 04 Mar 2001 - More attempted fixes for Intel C++ (David Abrahams)
|
||||
// 03 Mar 2001 - Put all implementation into namespace
|
||||
// boost::detail::iterator_traits_. Some progress made on fixes
|
||||
// for Intel compiler. (David Abrahams)
|
||||
// 02 Mar 2001 - Changed BOOST_MSVC to BOOST_MSVC_STD_ITERATOR in a few
|
||||
// places. (Jeremy Siek)
|
||||
// 19 Feb 2001 - Improved workarounds for stock MSVC6; use yes_type and
|
||||
// no_type from type_traits.hpp; stopped trying to remove_cv
|
||||
// before detecting is_pointer, in honor of the new type_traits
|
||||
// semantics. (David Abrahams)
|
||||
// 13 Feb 2001 - Make it work with nearly all standard-conforming iterators
|
||||
// under raw VC6. The one category remaining which will fail is
|
||||
// that of iterators derived from std::iterator but not
|
||||
// boost::iterator and which redefine difference_type.
|
||||
// 11 Feb 2001 - Clean away code which can never be used (David Abrahams)
|
||||
// 09 Feb 2001 - Always have a definition for each traits member, even if it
|
||||
// can't be properly deduced. These will be incomplete types in
|
||||
// some cases (undefined<void>), but it helps suppress MSVC errors
|
||||
// elsewhere (David Abrahams)
|
||||
// 07 Feb 2001 - Support for more of the traits members where possible, making
|
||||
// this useful as a replacement for std::iterator_traits<T> when
|
||||
// used as a default template parameter.
|
||||
// 06 Feb 2001 - Removed useless #includes of standard library headers
|
||||
// (David Abrahams)
|
||||
|
||||
#ifndef ITERATOR_DWA122600_HPP_
|
||||
# define ITERATOR_DWA122600_HPP_
|
||||
|
||||
# include <boost/config.hpp>
|
||||
# include <iterator>
|
||||
|
||||
// STLPort 4.0 and betas have a bug when debugging is enabled and there is no
|
||||
// partial specialization: instead of an iterator_category typedef, the standard
|
||||
// container iterators have _Iterator_category.
|
||||
//
|
||||
// Also, whether debugging is enabled or not, there is a broken specialization
|
||||
// of std::iterator<output_iterator_tag,void,void,void,void> which has no
|
||||
// typedefs but iterator_category.
|
||||
# if defined(__SGI_STL_PORT)
|
||||
|
||||
# if (__SGI_STL_PORT <= 0x410) && !defined(__STL_CLASS_PARTIAL_SPECIALIZATION) && defined(__STL_DEBUG)
|
||||
# define BOOST_BAD_CONTAINER_ITERATOR_CATEGORY_TYPEDEF
|
||||
# endif
|
||||
|
||||
# define BOOST_BAD_OUTPUT_ITERATOR_SPECIALIZATION
|
||||
|
||||
# endif // STLPort <= 4.1b4 && no partial specialization
|
||||
|
||||
# if !defined(BOOST_NO_STD_ITERATOR_TRAITS) \
|
||||
&& !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \
|
||||
&& !defined(BOOST_MSVC_STD_ITERATOR)
|
||||
|
||||
namespace boost { namespace detail {
|
||||
|
||||
// Define a new template so it can be specialized
|
||||
template <class Iterator>
|
||||
struct iterator_traits
|
||||
: std::iterator_traits<Iterator>
|
||||
{};
|
||||
using std::distance;
|
||||
|
||||
}} // namespace boost::detail
|
||||
|
||||
# else
|
||||
|
||||
# if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) \
|
||||
&& !defined(BOOST_MSVC_STD_ITERATOR)
|
||||
|
||||
// This is the case where everything conforms except BOOST_NO_STD_ITERATOR_TRAITS
|
||||
|
||||
namespace boost { namespace detail {
|
||||
|
||||
// Rogue Wave Standard Library fools itself into thinking partial
|
||||
// specialization is missing on some platforms (e.g. Sun), so fails to
|
||||
// supply iterator_traits!
|
||||
template <class Iterator>
|
||||
struct iterator_traits
|
||||
{
|
||||
typedef typename Iterator::value_type value_type;
|
||||
typedef typename Iterator::reference reference;
|
||||
typedef typename Iterator::pointer pointer;
|
||||
typedef typename Iterator::difference_type difference_type;
|
||||
typedef typename Iterator::iterator_category iterator_category;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct iterator_traits<T*>
|
||||
{
|
||||
typedef T value_type;
|
||||
typedef T& reference;
|
||||
typedef T* pointer;
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
typedef std::random_access_iterator_tag iterator_category;
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct iterator_traits<T const*>
|
||||
{
|
||||
typedef T value_type;
|
||||
typedef T const& reference;
|
||||
typedef T const* pointer;
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
typedef std::random_access_iterator_tag iterator_category;
|
||||
};
|
||||
|
||||
}} // namespace boost::detail
|
||||
|
||||
# else
|
||||
|
||||
# include <boost/type_traits/remove_const.hpp>
|
||||
# include <boost/type_traits/detail/yes_no_type.hpp>
|
||||
# include <boost/type_traits/is_pointer.hpp>
|
||||
|
||||
# ifdef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
# include <boost/type_traits/is_same.hpp>
|
||||
# include <boost/type_traits/remove_pointer.hpp>
|
||||
# endif
|
||||
# ifdef BOOST_BAD_OUTPUT_ITERATOR_SPECIALIZATION
|
||||
# include <boost/type_traits/is_base_and_derived.hpp>
|
||||
# endif
|
||||
|
||||
# include <boost/mpl/if.hpp>
|
||||
# include <boost/mpl/has_xxx.hpp>
|
||||
# include <cstddef>
|
||||
|
||||
// should be the last #include
|
||||
# include "boost/type_traits/detail/bool_trait_def.hpp"
|
||||
|
||||
namespace boost { namespace detail {
|
||||
|
||||
BOOST_MPL_HAS_XXX_TRAIT_DEF(value_type)
|
||||
BOOST_MPL_HAS_XXX_TRAIT_DEF(reference)
|
||||
BOOST_MPL_HAS_XXX_TRAIT_DEF(pointer)
|
||||
BOOST_MPL_HAS_XXX_TRAIT_DEF(difference_type)
|
||||
BOOST_MPL_HAS_XXX_TRAIT_DEF(iterator_category)
|
||||
|
||||
// is_mutable_iterator --
|
||||
//
|
||||
// A metafunction returning true iff T is a mutable iterator type
|
||||
// with a nested value_type. Will only work portably with iterators
|
||||
// whose operator* returns a reference, but that seems to be OK for
|
||||
// the iterators supplied by Dinkumware. Some input iterators may
|
||||
// compile-time if they arrive here, and if the compiler is strict
|
||||
// about not taking the address of an rvalue.
|
||||
|
||||
// This one detects ordinary mutable iterators - the result of
|
||||
// operator* is convertible to the value_type.
|
||||
template <class T>
|
||||
type_traits::yes_type is_mutable_iterator_helper(T const*, BOOST_DEDUCED_TYPENAME T::value_type*);
|
||||
|
||||
// Since you can't take the address of an rvalue, the guts of
|
||||
// is_mutable_iterator_impl will fail if we use &*t directly. This
|
||||
// makes sure we can still work with non-lvalue iterators.
|
||||
template <class T> T* mutable_iterator_lvalue_helper(T& x);
|
||||
int mutable_iterator_lvalue_helper(...);
|
||||
|
||||
|
||||
// This one detects output iterators such as ostream_iterator which
|
||||
// return references to themselves.
|
||||
template <class T>
|
||||
type_traits::yes_type is_mutable_iterator_helper(T const*, T const*);
|
||||
|
||||
type_traits::no_type is_mutable_iterator_helper(...);
|
||||
|
||||
template <class T>
|
||||
struct is_mutable_iterator_impl
|
||||
{
|
||||
static T t;
|
||||
|
||||
BOOST_STATIC_CONSTANT(
|
||||
bool, value = sizeof(
|
||||
detail::is_mutable_iterator_helper(
|
||||
(T*)0
|
||||
, mutable_iterator_lvalue_helper(*t) // like &*t
|
||||
))
|
||||
== sizeof(type_traits::yes_type)
|
||||
);
|
||||
};
|
||||
|
||||
BOOST_TT_AUX_BOOL_TRAIT_DEF1(
|
||||
is_mutable_iterator,T,::boost::detail::is_mutable_iterator_impl<T>::value)
|
||||
|
||||
|
||||
// is_full_iterator_traits --
|
||||
//
|
||||
// A metafunction returning true iff T has all the requisite nested
|
||||
// types to satisfy the requirements for a fully-conforming
|
||||
// iterator_traits implementation.
|
||||
template <class T>
|
||||
struct is_full_iterator_traits_impl
|
||||
{
|
||||
enum { value =
|
||||
has_value_type<T>::value
|
||||
& has_reference<T>::value
|
||||
& has_pointer<T>::value
|
||||
& has_difference_type<T>::value
|
||||
& has_iterator_category<T>::value
|
||||
};
|
||||
};
|
||||
|
||||
BOOST_TT_AUX_BOOL_TRAIT_DEF1(
|
||||
is_full_iterator_traits,T,::boost::detail::is_full_iterator_traits_impl<T>::value)
|
||||
|
||||
|
||||
# ifdef BOOST_BAD_CONTAINER_ITERATOR_CATEGORY_TYPEDEF
|
||||
BOOST_MPL_HAS_XXX_TRAIT_DEF(_Iterator_category)
|
||||
|
||||
// is_stlport_40_debug_iterator --
|
||||
//
|
||||
// A metafunction returning true iff T has all the requisite nested
|
||||
// types to satisfy the requirements of an STLPort 4.0 debug iterator
|
||||
// iterator_traits implementation.
|
||||
template <class T>
|
||||
struct is_stlport_40_debug_iterator_impl
|
||||
{
|
||||
enum { value =
|
||||
has_value_type<T>::value
|
||||
& has_reference<T>::value
|
||||
& has_pointer<T>::value
|
||||
& has_difference_type<T>::value
|
||||
& has__Iterator_category<T>::value
|
||||
};
|
||||
};
|
||||
|
||||
BOOST_TT_AUX_BOOL_TRAIT_DEF1(
|
||||
is_stlport_40_debug_iterator,T,::boost::detail::is_stlport_40_debug_iterator_impl<T>::value)
|
||||
|
||||
template <class T>
|
||||
struct stlport_40_debug_iterator_traits
|
||||
{
|
||||
typedef typename T::value_type value_type;
|
||||
typedef typename T::reference reference;
|
||||
typedef typename T::pointer pointer;
|
||||
typedef typename T::difference_type difference_type;
|
||||
typedef typename T::_Iterator_category iterator_category;
|
||||
};
|
||||
# endif // BOOST_BAD_CONTAINER_ITERATOR_CATEGORY_TYPEDEF
|
||||
|
||||
template <class T> struct pointer_iterator_traits;
|
||||
|
||||
# ifndef BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
template <class T>
|
||||
struct pointer_iterator_traits<T*>
|
||||
{
|
||||
typedef typename remove_const<T>::type value_type;
|
||||
typedef T* pointer;
|
||||
typedef T& reference;
|
||||
typedef std::random_access_iterator_tag iterator_category;
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
};
|
||||
# else
|
||||
|
||||
// In case of no template partial specialization, and if T is a
|
||||
// pointer, iterator_traits<T>::value_type can still be computed. For
|
||||
// some basic types, remove_pointer is manually defined in
|
||||
// type_traits/broken_compiler_spec.hpp. For others, do it yourself.
|
||||
|
||||
template<class P> class please_invoke_BOOST_TT_BROKEN_COMPILER_SPEC_on_cv_unqualified_pointee;
|
||||
|
||||
template<class P>
|
||||
struct pointer_value_type
|
||||
: mpl::if_<
|
||||
is_same<P, typename remove_pointer<P>::type>
|
||||
, please_invoke_BOOST_TT_BROKEN_COMPILER_SPEC_on_cv_unqualified_pointee<P>
|
||||
, typename remove_const<
|
||||
typename remove_pointer<P>::type
|
||||
>::type
|
||||
>
|
||||
{
|
||||
};
|
||||
|
||||
|
||||
template<class P>
|
||||
struct pointer_reference
|
||||
: mpl::if_<
|
||||
is_same<P, typename remove_pointer<P>::type>
|
||||
, please_invoke_BOOST_TT_BROKEN_COMPILER_SPEC_on_cv_unqualified_pointee<P>
|
||||
, typename remove_pointer<P>::type&
|
||||
>
|
||||
{
|
||||
};
|
||||
|
||||
template <class T>
|
||||
struct pointer_iterator_traits
|
||||
{
|
||||
typedef T pointer;
|
||||
typedef std::random_access_iterator_tag iterator_category;
|
||||
typedef std::ptrdiff_t difference_type;
|
||||
|
||||
typedef typename pointer_value_type<T>::type value_type;
|
||||
typedef typename pointer_reference<T>::type reference;
|
||||
};
|
||||
|
||||
# endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION
|
||||
|
||||
// We'll sort iterator types into one of these classifications, from which we
|
||||
// can determine the difference_type, pointer, reference, and value_type
|
||||
template <class Iterator>
|
||||
struct standard_iterator_traits
|
||||
{
|
||||
typedef typename Iterator::difference_type difference_type;
|
||||
typedef typename Iterator::value_type value_type;
|
||||
typedef typename Iterator::pointer pointer;
|
||||
typedef typename Iterator::reference reference;
|
||||
typedef typename Iterator::iterator_category iterator_category;
|
||||
};
|
||||
|
||||
template <class Iterator>
|
||||
struct msvc_stdlib_mutable_traits
|
||||
: std::iterator_traits<Iterator>
|
||||
{
|
||||
typedef typename std::iterator_traits<Iterator>::distance_type difference_type;
|
||||
typedef typename std::iterator_traits<Iterator>::value_type* pointer;
|
||||
typedef typename std::iterator_traits<Iterator>::value_type& reference;
|
||||
};
|
||||
|
||||
template <class Iterator>
|
||||
struct msvc_stdlib_const_traits
|
||||
: std::iterator_traits<Iterator>
|
||||
{
|
||||
typedef typename std::iterator_traits<Iterator>::distance_type difference_type;
|
||||
typedef const typename std::iterator_traits<Iterator>::value_type* pointer;
|
||||
typedef const typename std::iterator_traits<Iterator>::value_type& reference;
|
||||
};
|
||||
|
||||
# ifdef BOOST_BAD_OUTPUT_ITERATOR_SPECIALIZATION
|
||||
template <class Iterator>
|
||||
struct is_bad_output_iterator
|
||||
: is_base_and_derived<
|
||||
std::iterator<std::output_iterator_tag,void,void,void,void>
|
||||
, Iterator>
|
||||
{
|
||||
};
|
||||
|
||||
struct bad_output_iterator_traits
|
||||
{
|
||||
typedef void value_type;
|
||||
typedef void difference_type;
|
||||
typedef std::output_iterator_tag iterator_category;
|
||||
typedef void pointer;
|
||||
typedef void reference;
|
||||
};
|
||||
# endif
|
||||
|
||||
// If we're looking at an MSVC6 (old Dinkumware) ``standard''
|
||||
// iterator, this will generate an appropriate traits class.
|
||||
template <class Iterator>
|
||||
struct msvc_stdlib_iterator_traits
|
||||
: mpl::if_<
|
||||
is_mutable_iterator<Iterator>
|
||||
, msvc_stdlib_mutable_traits<Iterator>
|
||||
, msvc_stdlib_const_traits<Iterator>
|
||||
>::type
|
||||
{};
|
||||
|
||||
template <class Iterator>
|
||||
struct non_pointer_iterator_traits
|
||||
: mpl::if_<
|
||||
// if the iterator contains all the right nested types...
|
||||
is_full_iterator_traits<Iterator>
|
||||
// Use a standard iterator_traits implementation
|
||||
, standard_iterator_traits<Iterator>
|
||||
# ifdef BOOST_BAD_CONTAINER_ITERATOR_CATEGORY_TYPEDEF
|
||||
// Check for STLPort 4.0 broken _Iterator_category type
|
||||
, mpl::if_<
|
||||
is_stlport_40_debug_iterator<Iterator>
|
||||
, stlport_40_debug_iterator_traits<Iterator>
|
||||
# endif
|
||||
// Otherwise, assume it's a Dinkum iterator
|
||||
, msvc_stdlib_iterator_traits<Iterator>
|
||||
# ifdef BOOST_BAD_CONTAINER_ITERATOR_CATEGORY_TYPEDEF
|
||||
>::type
|
||||
# endif
|
||||
>::type
|
||||
{
|
||||
};
|
||||
|
||||
template <class Iterator>
|
||||
struct iterator_traits_aux
|
||||
: mpl::if_<
|
||||
is_pointer<Iterator>
|
||||
, pointer_iterator_traits<Iterator>
|
||||
, non_pointer_iterator_traits<Iterator>
|
||||
>::type
|
||||
{
|
||||
};
|
||||
|
||||
template <class Iterator>
|
||||
struct iterator_traits
|
||||
{
|
||||
// Explicit forwarding from base class needed to keep MSVC6 happy
|
||||
// under some circumstances.
|
||||
private:
|
||||
# ifdef BOOST_BAD_OUTPUT_ITERATOR_SPECIALIZATION
|
||||
typedef
|
||||
typename mpl::if_<
|
||||
is_bad_output_iterator<Iterator>
|
||||
, bad_output_iterator_traits
|
||||
, iterator_traits_aux<Iterator>
|
||||
>::type base;
|
||||
# else
|
||||
typedef iterator_traits_aux<Iterator> base;
|
||||
# endif
|
||||
public:
|
||||
typedef typename base::value_type value_type;
|
||||
typedef typename base::pointer pointer;
|
||||
typedef typename base::reference reference;
|
||||
typedef typename base::difference_type difference_type;
|
||||
typedef typename base::iterator_category iterator_category;
|
||||
};
|
||||
|
||||
// This specialization cuts off ETI (Early Template Instantiation) for MSVC.
|
||||
template <> struct iterator_traits<int>
|
||||
{
|
||||
typedef int value_type;
|
||||
typedef int pointer;
|
||||
typedef int reference;
|
||||
typedef int difference_type;
|
||||
typedef int iterator_category;
|
||||
};
|
||||
|
||||
}} // namespace boost::detail
|
||||
|
||||
# endif // workarounds
|
||||
|
||||
namespace boost { namespace detail {
|
||||
|
||||
namespace iterator_traits_
|
||||
{
|
||||
template <class Iterator, class Difference>
|
||||
struct distance_select
|
||||
{
|
||||
static Difference execute(Iterator i1, const Iterator i2, ...)
|
||||
{
|
||||
Difference result = 0;
|
||||
while (i1 != i2)
|
||||
{
|
||||
++i1;
|
||||
++result;
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
static Difference execute(Iterator i1, const Iterator i2, std::random_access_iterator_tag*)
|
||||
{
|
||||
return i2 - i1;
|
||||
}
|
||||
};
|
||||
} // namespace boost::detail::iterator_traits_
|
||||
|
||||
template <class Iterator>
|
||||
inline typename iterator_traits<Iterator>::difference_type
|
||||
distance(Iterator first, Iterator last)
|
||||
{
|
||||
typedef typename iterator_traits<Iterator>::difference_type diff_t;
|
||||
typedef typename ::boost::detail::iterator_traits<Iterator>::iterator_category iterator_category;
|
||||
|
||||
return iterator_traits_::distance_select<Iterator,diff_t>::execute(
|
||||
first, last, (iterator_category*)0);
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
# endif
|
||||
|
||||
|
||||
# undef BOOST_BAD_CONTAINER_ITERATOR_CATEGORY_TYPEDEF
|
||||
# undef BOOST_BAD_OUTPUT_ITERATOR_SPECIALIZATION
|
||||
|
||||
#endif // ITERATOR_DWA122600_HPP_
|
184
library/PolyVoxCore/include/boost/detail/lcast_precision.hpp
Normal file
184
library/PolyVoxCore/include/boost/detail/lcast_precision.hpp
Normal file
@ -0,0 +1,184 @@
|
||||
// Copyright Alexander Nasonov & Paul A. Bristow 2006.
|
||||
|
||||
// Use, modification and distribution are subject to the
|
||||
// Boost Software License, Version 1.0.
|
||||
// (See accompanying file LICENSE_1_0.txt
|
||||
// or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_DETAIL_LCAST_PRECISION_HPP_INCLUDED
|
||||
#define BOOST_DETAIL_LCAST_PRECISION_HPP_INCLUDED
|
||||
|
||||
#include <climits>
|
||||
#include <ios>
|
||||
#include <limits>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/integer_traits.hpp>
|
||||
|
||||
#ifndef BOOST_NO_IS_ABSTRACT
|
||||
// Fix for SF:1358600 - lexical_cast & pure virtual functions & VC 8 STL
|
||||
#include <boost/mpl/if.hpp>
|
||||
#include <boost/type_traits/is_abstract.hpp>
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS) || \
|
||||
(defined(BOOST_MSVC) && (BOOST_MSVC<1310))
|
||||
|
||||
#define BOOST_LCAST_NO_COMPILE_TIME_PRECISION
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_LCAST_NO_COMPILE_TIME_PRECISION
|
||||
#include <boost/assert.hpp>
|
||||
#else
|
||||
#include <boost/static_assert.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost { namespace detail {
|
||||
|
||||
class lcast_abstract_stub {};
|
||||
|
||||
#ifndef BOOST_LCAST_NO_COMPILE_TIME_PRECISION
|
||||
// Calculate an argument to pass to std::ios_base::precision from
|
||||
// lexical_cast. See alternative implementation for broken standard
|
||||
// libraries in lcast_get_precision below. Keep them in sync, please.
|
||||
template<class T>
|
||||
struct lcast_precision
|
||||
{
|
||||
#ifdef BOOST_NO_IS_ABSTRACT
|
||||
typedef std::numeric_limits<T> limits; // No fix for SF:1358600.
|
||||
#else
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::mpl::if_<
|
||||
boost::is_abstract<T>
|
||||
, std::numeric_limits<lcast_abstract_stub>
|
||||
, std::numeric_limits<T>
|
||||
>::type limits;
|
||||
#endif
|
||||
|
||||
BOOST_STATIC_CONSTANT(bool, use_default_precision =
|
||||
!limits::is_specialized || limits::is_exact
|
||||
);
|
||||
|
||||
BOOST_STATIC_CONSTANT(bool, is_specialized_bin =
|
||||
!use_default_precision &&
|
||||
limits::radix == 2 && limits::digits > 0
|
||||
);
|
||||
|
||||
BOOST_STATIC_CONSTANT(bool, is_specialized_dec =
|
||||
!use_default_precision &&
|
||||
limits::radix == 10 && limits::digits10 > 0
|
||||
);
|
||||
|
||||
BOOST_STATIC_CONSTANT(std::streamsize, streamsize_max =
|
||||
boost::integer_traits<std::streamsize>::const_max
|
||||
);
|
||||
|
||||
BOOST_STATIC_CONSTANT(unsigned int, precision_dec = limits::digits10 + 1U);
|
||||
|
||||
BOOST_STATIC_ASSERT(!is_specialized_dec ||
|
||||
precision_dec <= streamsize_max + 0UL
|
||||
);
|
||||
|
||||
BOOST_STATIC_CONSTANT(unsigned long, precision_bin =
|
||||
2UL + limits::digits * 30103UL / 100000UL
|
||||
);
|
||||
|
||||
BOOST_STATIC_ASSERT(!is_specialized_bin ||
|
||||
(limits::digits + 0UL < ULONG_MAX / 30103UL &&
|
||||
precision_bin > limits::digits10 + 0UL &&
|
||||
precision_bin <= streamsize_max + 0UL)
|
||||
);
|
||||
|
||||
BOOST_STATIC_CONSTANT(std::streamsize, value =
|
||||
is_specialized_bin ? precision_bin
|
||||
: is_specialized_dec ? precision_dec : 6
|
||||
);
|
||||
};
|
||||
#endif
|
||||
|
||||
template<class T>
|
||||
inline std::streamsize lcast_get_precision(T* = 0)
|
||||
{
|
||||
#ifndef BOOST_LCAST_NO_COMPILE_TIME_PRECISION
|
||||
return lcast_precision<T>::value;
|
||||
#else // Follow lcast_precision algorithm at run-time:
|
||||
|
||||
#ifdef BOOST_NO_IS_ABSTRACT
|
||||
typedef std::numeric_limits<T> limits; // No fix for SF:1358600.
|
||||
#else
|
||||
typedef BOOST_DEDUCED_TYPENAME boost::mpl::if_<
|
||||
boost::is_abstract<T>
|
||||
, std::numeric_limits<lcast_abstract_stub>
|
||||
, std::numeric_limits<T>
|
||||
>::type limits;
|
||||
#endif
|
||||
|
||||
bool const use_default_precision =
|
||||
!limits::is_specialized || limits::is_exact;
|
||||
|
||||
if(!use_default_precision)
|
||||
{ // Includes all built-in floating-point types, float, double ...
|
||||
// and UDT types for which digits (significand bits) is defined (not zero)
|
||||
|
||||
bool const is_specialized_bin =
|
||||
limits::radix == 2 && limits::digits > 0;
|
||||
bool const is_specialized_dec =
|
||||
limits::radix == 10 && limits::digits10 > 0;
|
||||
std::streamsize const streamsize_max =
|
||||
(boost::integer_traits<std::streamsize>::max)();
|
||||
|
||||
if(is_specialized_bin)
|
||||
{ // Floating-point types with
|
||||
// limits::digits defined by the specialization.
|
||||
|
||||
unsigned long const digits = limits::digits;
|
||||
unsigned long const precision = 2UL + digits * 30103UL / 100000UL;
|
||||
// unsigned long is selected because it is at least 32-bits
|
||||
// and thus ULONG_MAX / 30103UL is big enough for all types.
|
||||
BOOST_ASSERT(
|
||||
digits < ULONG_MAX / 30103UL &&
|
||||
precision > limits::digits10 + 0UL &&
|
||||
precision <= streamsize_max + 0UL
|
||||
);
|
||||
return precision;
|
||||
}
|
||||
else if(is_specialized_dec)
|
||||
{ // Decimal Floating-point type, most likely a User Defined Type
|
||||
// rather than a real floating-point hardware type.
|
||||
unsigned int const precision = limits::digits10 + 1U;
|
||||
BOOST_ASSERT(precision <= streamsize_max + 0UL);
|
||||
return precision;
|
||||
}
|
||||
}
|
||||
|
||||
// Integral type (for which precision has no effect)
|
||||
// or type T for which limits is NOT specialized,
|
||||
// so assume stream precision remains the default 6 decimal digits.
|
||||
// Warning: if your User-defined Floating-point type T is NOT specialized,
|
||||
// then you may lose accuracy by only using 6 decimal digits.
|
||||
// To avoid this, you need to specialize T with either
|
||||
// radix == 2 and digits == the number of significand bits,
|
||||
// OR
|
||||
// radix = 10 and digits10 == the number of decimal digits.
|
||||
|
||||
return 6;
|
||||
#endif
|
||||
}
|
||||
|
||||
template<class T>
|
||||
inline void lcast_set_precision(std::ios_base& stream, T*)
|
||||
{
|
||||
stream.precision(lcast_get_precision<T>());
|
||||
}
|
||||
|
||||
template<class Source, class Target>
|
||||
inline void lcast_set_precision(std::ios_base& stream, Source*, Target*)
|
||||
{
|
||||
std::streamsize const s = lcast_get_precision((Source*)0);
|
||||
std::streamsize const t = lcast_get_precision((Target*)0);
|
||||
stream.precision(s > t ? s : t);
|
||||
}
|
||||
|
||||
}}
|
||||
|
||||
#endif // BOOST_DETAIL_LCAST_PRECISION_HPP_INCLUDED
|
||||
|
@ -0,0 +1,42 @@
|
||||
#ifndef BOOST_DETAIL_LIGHTWEIGHT_MUTEX_HPP_INCLUDED
|
||||
#define BOOST_DETAIL_LIGHTWEIGHT_MUTEX_HPP_INCLUDED
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
//
|
||||
// boost/detail/lightweight_mutex.hpp - lightweight mutex
|
||||
//
|
||||
// Copyright (c) 2002, 2003 Peter Dimov and Multi Media Ltd.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// typedef <unspecified> boost::detail::lightweight_mutex;
|
||||
//
|
||||
// boost::detail::lightweight_mutex is a header-only implementation of
|
||||
// a subset of the Mutex concept requirements:
|
||||
//
|
||||
// http://www.boost.org/doc/html/threads/concepts.html#threads.concepts.Mutex
|
||||
//
|
||||
// It maps to a CRITICAL_SECTION on Windows or a pthread_mutex on POSIX.
|
||||
//
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#if !defined(BOOST_HAS_THREADS)
|
||||
# include <boost/detail/lwm_nop.hpp>
|
||||
#elif defined(BOOST_HAS_PTHREADS)
|
||||
# include <boost/detail/lwm_pthreads.hpp>
|
||||
#elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
|
||||
# include <boost/detail/lwm_win32_cs.hpp>
|
||||
#else
|
||||
// Use #define BOOST_DISABLE_THREADS to avoid the error
|
||||
# error Unrecognized threading platform
|
||||
#endif
|
||||
|
||||
#endif // #ifndef BOOST_DETAIL_LIGHTWEIGHT_MUTEX_HPP_INCLUDED
|
@ -0,0 +1,75 @@
|
||||
#ifndef BOOST_DETAIL_LIGHTWEIGHT_TEST_HPP_INCLUDED
|
||||
#define BOOST_DETAIL_LIGHTWEIGHT_TEST_HPP_INCLUDED
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
//
|
||||
// boost/detail/lightweight_test.hpp - lightweight test library
|
||||
//
|
||||
// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// BOOST_TEST(expression)
|
||||
// BOOST_ERROR(message)
|
||||
//
|
||||
// int boost::report_errors()
|
||||
//
|
||||
|
||||
#include <boost/current_function.hpp>
|
||||
#include <iostream>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
inline int & test_errors()
|
||||
{
|
||||
static int x = 0;
|
||||
return x;
|
||||
}
|
||||
|
||||
inline void test_failed_impl(char const * expr, char const * file, int line, char const * function)
|
||||
{
|
||||
std::cerr << file << "(" << line << "): test '" << expr << "' failed in function '" << function << "'" << std::endl;
|
||||
++test_errors();
|
||||
}
|
||||
|
||||
inline void error_impl(char const * msg, char const * file, int line, char const * function)
|
||||
{
|
||||
std::cerr << file << "(" << line << "): " << msg << " in function '" << function << "'" << std::endl;
|
||||
++test_errors();
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
inline int report_errors()
|
||||
{
|
||||
int errors = detail::test_errors();
|
||||
|
||||
if(errors == 0)
|
||||
{
|
||||
std::cerr << "No errors detected." << std::endl;
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
std::cerr << errors << " error" << (errors == 1? "": "s") << " detected." << std::endl;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#define BOOST_TEST(expr) ((expr)? (void)0: ::boost::detail::test_failed_impl(#expr, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION))
|
||||
#define BOOST_ERROR(msg) ::boost::detail::error_impl(msg, __FILE__, __LINE__, BOOST_CURRENT_FUNCTION)
|
||||
|
||||
#endif // #ifndef BOOST_DETAIL_LIGHTWEIGHT_TEST_HPP_INCLUDED
|
135
library/PolyVoxCore/include/boost/detail/lightweight_thread.hpp
Normal file
135
library/PolyVoxCore/include/boost/detail/lightweight_thread.hpp
Normal file
@ -0,0 +1,135 @@
|
||||
#ifndef BOOST_DETAIL_LIGHTWEIGHT_THREAD_HPP_INCLUDED
|
||||
#define BOOST_DETAIL_LIGHTWEIGHT_THREAD_HPP_INCLUDED
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
// boost/detail/lightweight_thread.hpp
|
||||
//
|
||||
// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
|
||||
// Copyright (c) 2008 Peter Dimov
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <memory>
|
||||
#include <cerrno>
|
||||
|
||||
// pthread_create, pthread_join
|
||||
|
||||
#if defined( BOOST_HAS_PTHREADS )
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
#else
|
||||
|
||||
#include <windows.h>
|
||||
#include <process.h>
|
||||
|
||||
typedef HANDLE pthread_t;
|
||||
|
||||
int pthread_create( pthread_t * thread, void const *, unsigned (__stdcall * start_routine) (void*), void* arg )
|
||||
{
|
||||
HANDLE h = (HANDLE)_beginthreadex( 0, 0, start_routine, arg, 0, 0 );
|
||||
|
||||
if( h != 0 )
|
||||
{
|
||||
*thread = h;
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
return EAGAIN;
|
||||
}
|
||||
}
|
||||
|
||||
int pthread_join( pthread_t thread, void ** /*value_ptr*/ )
|
||||
{
|
||||
::WaitForSingleObject( thread, INFINITE );
|
||||
::CloseHandle( thread );
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// template<class F> int lw_thread_create( pthread_t & pt, F f );
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
class lw_abstract_thread
|
||||
{
|
||||
public:
|
||||
|
||||
virtual ~lw_abstract_thread() {}
|
||||
virtual void run() = 0;
|
||||
};
|
||||
|
||||
#if defined( BOOST_HAS_PTHREADS )
|
||||
|
||||
extern "C" void * lw_thread_routine( void * pv )
|
||||
{
|
||||
std::auto_ptr<lw_abstract_thread> pt( static_cast<lw_abstract_thread *>( pv ) );
|
||||
|
||||
pt->run();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
unsigned __stdcall lw_thread_routine( void * pv )
|
||||
{
|
||||
std::auto_ptr<lw_abstract_thread> pt( static_cast<lw_abstract_thread *>( pv ) );
|
||||
|
||||
pt->run();
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
template<class F> class lw_thread_impl: public lw_abstract_thread
|
||||
{
|
||||
public:
|
||||
|
||||
explicit lw_thread_impl( F f ): f_( f )
|
||||
{
|
||||
}
|
||||
|
||||
void run()
|
||||
{
|
||||
f_();
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
F f_;
|
||||
};
|
||||
|
||||
template<class F> int lw_thread_create( pthread_t & pt, F f )
|
||||
{
|
||||
std::auto_ptr<lw_abstract_thread> p( new lw_thread_impl<F>( f ) );
|
||||
|
||||
int r = pthread_create( &pt, 0, lw_thread_routine, p.get() );
|
||||
|
||||
if( r == 0 )
|
||||
{
|
||||
p.release();
|
||||
}
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
} // namespace boost
|
||||
|
||||
#endif // #ifndef BOOST_DETAIL_LIGHTWEIGHT_THREAD_HPP_INCLUDED
|
449
library/PolyVoxCore/include/boost/detail/limits.hpp
Normal file
449
library/PolyVoxCore/include/boost/detail/limits.hpp
Normal file
@ -0,0 +1,449 @@
|
||||
// Copyright 2001 John Maddock
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompany-
|
||||
// ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
/*
|
||||
* Copyright (c) 1997
|
||||
* Silicon Graphics Computer Systems, Inc.
|
||||
*
|
||||
* Permission to use, copy, modify, distribute and sell this software
|
||||
* and its documentation for any purpose is hereby granted without fee,
|
||||
* provided that the above copyright notice appear in all copies and
|
||||
* that both that copyright notice and this permission notice appear
|
||||
* in supporting documentation. Silicon Graphics makes no
|
||||
* representations about the suitability of this software for any
|
||||
* purpose. It is provided "as is" without express or implied warranty.
|
||||
*/
|
||||
|
||||
/* NOTE: This is not portable code. Parts of numeric_limits<> are
|
||||
* inherently machine-dependent, and this file is written for the MIPS
|
||||
* architecture and the SGI MIPSpro C++ compiler. Parts of it (in
|
||||
* particular, some of the characteristics of floating-point types)
|
||||
* are almost certainly incorrect for any other platform.
|
||||
*/
|
||||
|
||||
/* The above comment is almost certainly out of date. This file works
|
||||
* on systems other than SGI MIPSpro C++ now.
|
||||
*/
|
||||
|
||||
/*
|
||||
* Revision history:
|
||||
* 21 Sep 2001:
|
||||
* Only include <cwchar> if BOOST_NO_CWCHAR is defined. (Darin Adler)
|
||||
* 10 Aug 2001:
|
||||
* Added MIPS (big endian) to the big endian family. (Jens Maurer)
|
||||
* 13 Apr 2001:
|
||||
* Added powerpc to the big endian family. (Jeremy Siek)
|
||||
* 5 Apr 2001:
|
||||
* Added sparc (big endian) processor support (John Maddock).
|
||||
* Initial sub:
|
||||
* Modified by Jens Maurer for gcc 2.95 on x86.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_SGI_CPP_LIMITS
|
||||
#define BOOST_SGI_CPP_LIMITS
|
||||
|
||||
#include <climits>
|
||||
#include <cfloat>
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/detail/endian.hpp>
|
||||
|
||||
#ifndef BOOST_NO_CWCHAR
|
||||
#include <cwchar> // for WCHAR_MIN and WCHAR_MAX
|
||||
#endif
|
||||
|
||||
namespace std {
|
||||
|
||||
enum float_round_style {
|
||||
round_indeterminate = -1,
|
||||
round_toward_zero = 0,
|
||||
round_to_nearest = 1,
|
||||
round_toward_infinity = 2,
|
||||
round_toward_neg_infinity = 3
|
||||
};
|
||||
|
||||
enum float_denorm_style {
|
||||
denorm_indeterminate = -1,
|
||||
denorm_absent = 0,
|
||||
denorm_present = 1
|
||||
};
|
||||
|
||||
// The C++ standard (section 18.2.1) requires that some of the members of
|
||||
// numeric_limits be static const data members that are given constant-
|
||||
// initializers within the class declaration. On compilers where the
|
||||
// BOOST_NO_INCLASS_MEMBER_INITIALIZATION macro is defined, it is impossible to write
|
||||
// a standard-conforming numeric_limits class.
|
||||
//
|
||||
// There are two possible workarounds: either initialize the data
|
||||
// members outside the class, or change them from data members to
|
||||
// enums. Neither workaround is satisfactory: the former makes it
|
||||
// impossible to use the data members in constant-expressions, and the
|
||||
// latter means they have the wrong type and that it is impossible to
|
||||
// take their addresses. We choose the former workaround.
|
||||
|
||||
#ifdef BOOST_NO_INCLASS_MEMBER_INITIALIZATION
|
||||
# define BOOST_STL_DECLARE_LIMITS_MEMBER(__mem_type, __mem_name, __mem_value) \
|
||||
enum { __mem_name = __mem_value }
|
||||
#else /* BOOST_NO_INCLASS_MEMBER_INITIALIZATION */
|
||||
# define BOOST_STL_DECLARE_LIMITS_MEMBER(__mem_type, __mem_name, __mem_value) \
|
||||
static const __mem_type __mem_name = __mem_value
|
||||
#endif /* BOOST_NO_INCLASS_MEMBER_INITIALIZATION */
|
||||
|
||||
// Base class for all specializations of numeric_limits.
|
||||
template <class __number>
|
||||
class _Numeric_limits_base {
|
||||
public:
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_specialized, false);
|
||||
|
||||
static __number min BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return __number(); }
|
||||
static __number max BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return __number(); }
|
||||
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(int, digits, 0);
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(int, digits10, 0);
|
||||
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_signed, false);
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_integer, false);
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_exact, false);
|
||||
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(int, radix, 0);
|
||||
|
||||
static __number epsilon() throw() { return __number(); }
|
||||
static __number round_error() throw() { return __number(); }
|
||||
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(int, min_exponent, 0);
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(int, min_exponent10, 0);
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(int, max_exponent, 0);
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(int, max_exponent10, 0);
|
||||
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(bool, has_infinity, false);
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(bool, has_quiet_NaN, false);
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(bool, has_signaling_NaN, false);
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(float_denorm_style,
|
||||
has_denorm,
|
||||
denorm_absent);
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(bool, has_denorm_loss, false);
|
||||
|
||||
static __number infinity() throw() { return __number(); }
|
||||
static __number quiet_NaN() throw() { return __number(); }
|
||||
static __number signaling_NaN() throw() { return __number(); }
|
||||
static __number denorm_min() throw() { return __number(); }
|
||||
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_iec559, false);
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_bounded, false);
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_modulo, false);
|
||||
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(bool, traps, false);
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(bool, tinyness_before, false);
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(float_round_style,
|
||||
round_style,
|
||||
round_toward_zero);
|
||||
};
|
||||
|
||||
// Base class for integers.
|
||||
|
||||
template <class _Int,
|
||||
_Int __imin,
|
||||
_Int __imax,
|
||||
int __idigits = -1>
|
||||
class _Integer_limits : public _Numeric_limits_base<_Int>
|
||||
{
|
||||
public:
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_specialized, true);
|
||||
|
||||
static _Int min BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return __imin; }
|
||||
static _Int max BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return __imax; }
|
||||
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(int,
|
||||
digits,
|
||||
(__idigits < 0) ? (int)(sizeof(_Int) * CHAR_BIT)
|
||||
- (__imin == 0 ? 0 : 1)
|
||||
: __idigits);
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(int, digits10, (digits * 301) / 1000);
|
||||
// log 2 = 0.301029995664...
|
||||
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_signed, __imin != 0);
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_integer, true);
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_exact, true);
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(int, radix, 2);
|
||||
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_bounded, true);
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_modulo, true);
|
||||
};
|
||||
|
||||
#if defined(BOOST_BIG_ENDIAN)
|
||||
|
||||
template<class Number, unsigned int Word>
|
||||
struct float_helper{
|
||||
static Number get_word() throw() {
|
||||
// sizeof(long double) == 16
|
||||
const unsigned int _S_word[4] = { Word, 0, 0, 0 };
|
||||
return *reinterpret_cast<const Number*>(&_S_word);
|
||||
}
|
||||
};
|
||||
|
||||
#else
|
||||
|
||||
template<class Number, unsigned int Word>
|
||||
struct float_helper{
|
||||
static Number get_word() throw() {
|
||||
// sizeof(long double) == 12, but only 10 bytes significant
|
||||
const unsigned int _S_word[4] = { 0, 0, 0, Word };
|
||||
return *reinterpret_cast<const Number*>(
|
||||
reinterpret_cast<const char *>(&_S_word)+16-
|
||||
(sizeof(Number) == 12 ? 10 : sizeof(Number)));
|
||||
}
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
// Base class for floating-point numbers.
|
||||
template <class __number,
|
||||
int __Digits, int __Digits10,
|
||||
int __MinExp, int __MaxExp,
|
||||
int __MinExp10, int __MaxExp10,
|
||||
unsigned int __InfinityWord,
|
||||
unsigned int __QNaNWord, unsigned int __SNaNWord,
|
||||
bool __IsIEC559,
|
||||
float_round_style __RoundStyle>
|
||||
class _Floating_limits : public _Numeric_limits_base<__number>
|
||||
{
|
||||
public:
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_specialized, true);
|
||||
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(int, digits, __Digits);
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(int, digits10, __Digits10);
|
||||
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_signed, true);
|
||||
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(int, radix, 2);
|
||||
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(int, min_exponent, __MinExp);
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(int, max_exponent, __MaxExp);
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(int, min_exponent10, __MinExp10);
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(int, max_exponent10, __MaxExp10);
|
||||
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(bool, has_infinity, true);
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(bool, has_quiet_NaN, true);
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(bool, has_signaling_NaN, true);
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(float_denorm_style,
|
||||
has_denorm,
|
||||
denorm_indeterminate);
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(bool, has_denorm_loss, false);
|
||||
|
||||
|
||||
static __number infinity() throw() {
|
||||
return float_helper<__number, __InfinityWord>::get_word();
|
||||
}
|
||||
static __number quiet_NaN() throw() {
|
||||
return float_helper<__number,__QNaNWord>::get_word();
|
||||
}
|
||||
static __number signaling_NaN() throw() {
|
||||
return float_helper<__number,__SNaNWord>::get_word();
|
||||
}
|
||||
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_iec559, __IsIEC559);
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_bounded, true);
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(bool, traps, false /* was: true */ );
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(bool, tinyness_before, false);
|
||||
|
||||
BOOST_STL_DECLARE_LIMITS_MEMBER(float_round_style, round_style, __RoundStyle);
|
||||
};
|
||||
|
||||
// Class numeric_limits
|
||||
|
||||
// The unspecialized class.
|
||||
|
||||
template<class T>
|
||||
class numeric_limits : public _Numeric_limits_base<T> {};
|
||||
|
||||
// Specializations for all built-in integral types.
|
||||
|
||||
template<>
|
||||
class numeric_limits<bool>
|
||||
: public _Integer_limits<bool, false, true, 0>
|
||||
{};
|
||||
|
||||
template<>
|
||||
class numeric_limits<char>
|
||||
: public _Integer_limits<char, CHAR_MIN, CHAR_MAX>
|
||||
{};
|
||||
|
||||
template<>
|
||||
class numeric_limits<signed char>
|
||||
: public _Integer_limits<signed char, SCHAR_MIN, SCHAR_MAX>
|
||||
{};
|
||||
|
||||
template<>
|
||||
class numeric_limits<unsigned char>
|
||||
: public _Integer_limits<unsigned char, 0, UCHAR_MAX>
|
||||
{};
|
||||
|
||||
#ifndef BOOST_NO_INTRINSIC_WCHAR_T
|
||||
template<>
|
||||
class numeric_limits<wchar_t>
|
||||
#if !defined(WCHAR_MAX) || !defined(WCHAR_MIN)
|
||||
#if defined(_WIN32) || defined(__CYGWIN__)
|
||||
: public _Integer_limits<wchar_t, 0, USHRT_MAX>
|
||||
#elif defined(__hppa)
|
||||
// wchar_t has "unsigned int" as the underlying type
|
||||
: public _Integer_limits<wchar_t, 0, UINT_MAX>
|
||||
#else
|
||||
// assume that wchar_t has "int" as the underlying type
|
||||
: public _Integer_limits<wchar_t, INT_MIN, INT_MAX>
|
||||
#endif
|
||||
#else
|
||||
// we have WCHAR_MIN and WCHAR_MAX defined, so use it
|
||||
: public _Integer_limits<wchar_t, WCHAR_MIN, WCHAR_MAX>
|
||||
#endif
|
||||
{};
|
||||
#endif
|
||||
|
||||
template<>
|
||||
class numeric_limits<short>
|
||||
: public _Integer_limits<short, SHRT_MIN, SHRT_MAX>
|
||||
{};
|
||||
|
||||
template<>
|
||||
class numeric_limits<unsigned short>
|
||||
: public _Integer_limits<unsigned short, 0, USHRT_MAX>
|
||||
{};
|
||||
|
||||
template<>
|
||||
class numeric_limits<int>
|
||||
: public _Integer_limits<int, INT_MIN, INT_MAX>
|
||||
{};
|
||||
|
||||
template<>
|
||||
class numeric_limits<unsigned int>
|
||||
: public _Integer_limits<unsigned int, 0, UINT_MAX>
|
||||
{};
|
||||
|
||||
template<>
|
||||
class numeric_limits<long>
|
||||
: public _Integer_limits<long, LONG_MIN, LONG_MAX>
|
||||
{};
|
||||
|
||||
template<>
|
||||
class numeric_limits<unsigned long>
|
||||
: public _Integer_limits<unsigned long, 0, ULONG_MAX>
|
||||
{};
|
||||
|
||||
#ifdef __GNUC__
|
||||
|
||||
// Some compilers have long long, but don't define the
|
||||
// LONGLONG_MIN and LONGLONG_MAX macros in limits.h. This
|
||||
// assumes that long long is 64 bits.
|
||||
#if !defined(LONGLONG_MAX) && !defined(ULONGLONG_MAX)
|
||||
|
||||
# define ULONGLONG_MAX 0xffffffffffffffffLLU
|
||||
# define LONGLONG_MAX 0x7fffffffffffffffLL
|
||||
|
||||
#endif
|
||||
|
||||
#if !defined(LONGLONG_MIN)
|
||||
# define LONGLONG_MIN (-LONGLONG_MAX - 1)
|
||||
#endif
|
||||
|
||||
|
||||
#if !defined(ULONGLONG_MIN)
|
||||
# define ULONGLONG_MIN 0
|
||||
#endif
|
||||
|
||||
#endif /* __GNUC__ */
|
||||
|
||||
// Specializations for all built-in floating-point type.
|
||||
|
||||
template<> class numeric_limits<float>
|
||||
: public _Floating_limits<float,
|
||||
FLT_MANT_DIG, // Binary digits of precision
|
||||
FLT_DIG, // Decimal digits of precision
|
||||
FLT_MIN_EXP, // Minimum exponent
|
||||
FLT_MAX_EXP, // Maximum exponent
|
||||
FLT_MIN_10_EXP, // Minimum base 10 exponent
|
||||
FLT_MAX_10_EXP, // Maximum base 10 exponent
|
||||
#if defined(BOOST_BIG_ENDIAN)
|
||||
0x7f80 << (sizeof(int)*CHAR_BIT-16), // Last word of +infinity
|
||||
0x7f81 << (sizeof(int)*CHAR_BIT-16), // Last word of quiet NaN
|
||||
0x7fc1 << (sizeof(int)*CHAR_BIT-16), // Last word of signaling NaN
|
||||
#else
|
||||
0x7f800000u, // Last word of +infinity
|
||||
0x7f810000u, // Last word of quiet NaN
|
||||
0x7fc10000u, // Last word of signaling NaN
|
||||
#endif
|
||||
true, // conforms to iec559
|
||||
round_to_nearest>
|
||||
{
|
||||
public:
|
||||
static float min BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return FLT_MIN; }
|
||||
static float denorm_min() throw() { return FLT_MIN; }
|
||||
static float max BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return FLT_MAX; }
|
||||
static float epsilon() throw() { return FLT_EPSILON; }
|
||||
static float round_error() throw() { return 0.5f; } // Units: ulps.
|
||||
};
|
||||
|
||||
template<> class numeric_limits<double>
|
||||
: public _Floating_limits<double,
|
||||
DBL_MANT_DIG, // Binary digits of precision
|
||||
DBL_DIG, // Decimal digits of precision
|
||||
DBL_MIN_EXP, // Minimum exponent
|
||||
DBL_MAX_EXP, // Maximum exponent
|
||||
DBL_MIN_10_EXP, // Minimum base 10 exponent
|
||||
DBL_MAX_10_EXP, // Maximum base 10 exponent
|
||||
#if defined(BOOST_BIG_ENDIAN)
|
||||
0x7ff0 << (sizeof(int)*CHAR_BIT-16), // Last word of +infinity
|
||||
0x7ff1 << (sizeof(int)*CHAR_BIT-16), // Last word of quiet NaN
|
||||
0x7ff9 << (sizeof(int)*CHAR_BIT-16), // Last word of signaling NaN
|
||||
#else
|
||||
0x7ff00000u, // Last word of +infinity
|
||||
0x7ff10000u, // Last word of quiet NaN
|
||||
0x7ff90000u, // Last word of signaling NaN
|
||||
#endif
|
||||
true, // conforms to iec559
|
||||
round_to_nearest>
|
||||
{
|
||||
public:
|
||||
static double min BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return DBL_MIN; }
|
||||
static double denorm_min() throw() { return DBL_MIN; }
|
||||
static double max BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return DBL_MAX; }
|
||||
static double epsilon() throw() { return DBL_EPSILON; }
|
||||
static double round_error() throw() { return 0.5; } // Units: ulps.
|
||||
};
|
||||
|
||||
template<> class numeric_limits<long double>
|
||||
: public _Floating_limits<long double,
|
||||
LDBL_MANT_DIG, // Binary digits of precision
|
||||
LDBL_DIG, // Decimal digits of precision
|
||||
LDBL_MIN_EXP, // Minimum exponent
|
||||
LDBL_MAX_EXP, // Maximum exponent
|
||||
LDBL_MIN_10_EXP,// Minimum base 10 exponent
|
||||
LDBL_MAX_10_EXP,// Maximum base 10 exponent
|
||||
#if defined(BOOST_BIG_ENDIAN)
|
||||
0x7ff0 << (sizeof(int)*CHAR_BIT-16), // Last word of +infinity
|
||||
0x7ff1 << (sizeof(int)*CHAR_BIT-16), // Last word of quiet NaN
|
||||
0x7ff9 << (sizeof(int)*CHAR_BIT-16), // Last word of signaling NaN
|
||||
#else
|
||||
0x7fff8000u, // Last word of +infinity
|
||||
0x7fffc000u, // Last word of quiet NaN
|
||||
0x7fff9000u, // Last word of signaling NaN
|
||||
#endif
|
||||
false, // Doesn't conform to iec559
|
||||
round_to_nearest>
|
||||
{
|
||||
public:
|
||||
static long double min BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return LDBL_MIN; }
|
||||
static long double denorm_min() throw() { return LDBL_MIN; }
|
||||
static long double max BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return LDBL_MAX; }
|
||||
static long double epsilon() throw() { return LDBL_EPSILON; }
|
||||
static long double round_error() throw() { return 4; } // Units: ulps.
|
||||
};
|
||||
|
||||
} // namespace std
|
||||
|
||||
#endif /* BOOST_SGI_CPP_LIMITS */
|
||||
|
||||
// Local Variables:
|
||||
// mode:C++
|
||||
// End:
|
||||
|
||||
|
||||
|
37
library/PolyVoxCore/include/boost/detail/lwm_nop.hpp
Normal file
37
library/PolyVoxCore/include/boost/detail/lwm_nop.hpp
Normal file
@ -0,0 +1,37 @@
|
||||
#ifndef BOOST_DETAIL_LWM_NOP_HPP_INCLUDED
|
||||
#define BOOST_DETAIL_LWM_NOP_HPP_INCLUDED
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
//
|
||||
// boost/detail/lwm_nop.hpp
|
||||
//
|
||||
// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
class lightweight_mutex
|
||||
{
|
||||
public:
|
||||
|
||||
typedef lightweight_mutex scoped_lock;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // #ifndef BOOST_DETAIL_LWM_NOP_HPP_INCLUDED
|
86
library/PolyVoxCore/include/boost/detail/lwm_pthreads.hpp
Normal file
86
library/PolyVoxCore/include/boost/detail/lwm_pthreads.hpp
Normal file
@ -0,0 +1,86 @@
|
||||
#ifndef BOOST_DETAIL_LWM_PTHREADS_HPP_INCLUDED
|
||||
#define BOOST_DETAIL_LWM_PTHREADS_HPP_INCLUDED
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
//
|
||||
// boost/detail/lwm_pthreads.hpp
|
||||
//
|
||||
// Copyright (c) 2002 Peter Dimov and Multi Media Ltd.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
class lightweight_mutex
|
||||
{
|
||||
private:
|
||||
|
||||
pthread_mutex_t m_;
|
||||
|
||||
lightweight_mutex(lightweight_mutex const &);
|
||||
lightweight_mutex & operator=(lightweight_mutex const &);
|
||||
|
||||
public:
|
||||
|
||||
lightweight_mutex()
|
||||
{
|
||||
|
||||
// HPUX 10.20 / DCE has a nonstandard pthread_mutex_init
|
||||
|
||||
#if defined(__hpux) && defined(_DECTHREADS_)
|
||||
pthread_mutex_init(&m_, pthread_mutexattr_default);
|
||||
#else
|
||||
pthread_mutex_init(&m_, 0);
|
||||
#endif
|
||||
}
|
||||
|
||||
~lightweight_mutex()
|
||||
{
|
||||
pthread_mutex_destroy(&m_);
|
||||
}
|
||||
|
||||
class scoped_lock;
|
||||
friend class scoped_lock;
|
||||
|
||||
class scoped_lock
|
||||
{
|
||||
private:
|
||||
|
||||
pthread_mutex_t & m_;
|
||||
|
||||
scoped_lock(scoped_lock const &);
|
||||
scoped_lock & operator=(scoped_lock const &);
|
||||
|
||||
public:
|
||||
|
||||
scoped_lock(lightweight_mutex & m): m_(m.m_)
|
||||
{
|
||||
pthread_mutex_lock(&m_);
|
||||
}
|
||||
|
||||
~scoped_lock()
|
||||
{
|
||||
pthread_mutex_unlock(&m_);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // #ifndef BOOST_DETAIL_LWM_PTHREADS_HPP_INCLUDED
|
108
library/PolyVoxCore/include/boost/detail/lwm_win32_cs.hpp
Normal file
108
library/PolyVoxCore/include/boost/detail/lwm_win32_cs.hpp
Normal file
@ -0,0 +1,108 @@
|
||||
#ifndef BOOST_DETAIL_LWM_WIN32_CS_HPP_INCLUDED
|
||||
#define BOOST_DETAIL_LWM_WIN32_CS_HPP_INCLUDED
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
//
|
||||
// boost/detail/lwm_win32_cs.hpp
|
||||
//
|
||||
// Copyright (c) 2002, 2003 Peter Dimov
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
#ifdef BOOST_USE_WINDOWS_H
|
||||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
#ifndef BOOST_USE_WINDOWS_H
|
||||
|
||||
struct critical_section
|
||||
{
|
||||
struct critical_section_debug * DebugInfo;
|
||||
long LockCount;
|
||||
long RecursionCount;
|
||||
void * OwningThread;
|
||||
void * LockSemaphore;
|
||||
#if defined(_WIN64)
|
||||
unsigned __int64 SpinCount;
|
||||
#else
|
||||
unsigned long SpinCount;
|
||||
#endif
|
||||
};
|
||||
|
||||
extern "C" __declspec(dllimport) void __stdcall InitializeCriticalSection(critical_section *);
|
||||
extern "C" __declspec(dllimport) void __stdcall EnterCriticalSection(critical_section *);
|
||||
extern "C" __declspec(dllimport) void __stdcall LeaveCriticalSection(critical_section *);
|
||||
extern "C" __declspec(dllimport) void __stdcall DeleteCriticalSection(critical_section *);
|
||||
|
||||
#else
|
||||
|
||||
typedef ::CRITICAL_SECTION critical_section;
|
||||
|
||||
#endif // #ifndef BOOST_USE_WINDOWS_H
|
||||
|
||||
class lightweight_mutex
|
||||
{
|
||||
private:
|
||||
|
||||
critical_section cs_;
|
||||
|
||||
lightweight_mutex(lightweight_mutex const &);
|
||||
lightweight_mutex & operator=(lightweight_mutex const &);
|
||||
|
||||
public:
|
||||
|
||||
lightweight_mutex()
|
||||
{
|
||||
InitializeCriticalSection(&cs_);
|
||||
}
|
||||
|
||||
~lightweight_mutex()
|
||||
{
|
||||
DeleteCriticalSection(&cs_);
|
||||
}
|
||||
|
||||
class scoped_lock;
|
||||
friend class scoped_lock;
|
||||
|
||||
class scoped_lock
|
||||
{
|
||||
private:
|
||||
|
||||
lightweight_mutex & m_;
|
||||
|
||||
scoped_lock(scoped_lock const &);
|
||||
scoped_lock & operator=(scoped_lock const &);
|
||||
|
||||
public:
|
||||
|
||||
explicit scoped_lock(lightweight_mutex & m): m_(m)
|
||||
{
|
||||
EnterCriticalSection(&m_.cs_);
|
||||
}
|
||||
|
||||
~scoped_lock()
|
||||
{
|
||||
LeaveCriticalSection(&m_.cs_);
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // #ifndef BOOST_DETAIL_LWM_WIN32_CS_HPP_INCLUDED
|
@ -0,0 +1,177 @@
|
||||
// (C) Copyright Jeremy Siek 2001.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
// Revision History:
|
||||
|
||||
// 04 Oct 2001 David Abrahams
|
||||
// Changed name of "bind" to "select" to avoid problems with MSVC.
|
||||
|
||||
#ifndef BOOST_DETAIL_NAMED_TEMPLATE_PARAMS_HPP
|
||||
#define BOOST_DETAIL_NAMED_TEMPLATE_PARAMS_HPP
|
||||
|
||||
#include <boost/type_traits/conversion_traits.hpp>
|
||||
#include <boost/type_traits/composite_traits.hpp> // for is_reference
|
||||
#if defined(__BORLANDC__)
|
||||
#include <boost/type_traits/ice.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost {
|
||||
namespace detail {
|
||||
|
||||
struct default_argument { };
|
||||
|
||||
struct dummy_default_gen {
|
||||
template <class Base, class Traits>
|
||||
struct select {
|
||||
typedef default_argument type;
|
||||
};
|
||||
};
|
||||
|
||||
// This class template is a workaround for MSVC.
|
||||
template <class Gen> struct default_generator {
|
||||
typedef detail::dummy_default_gen type;
|
||||
};
|
||||
|
||||
template <class T> struct is_default {
|
||||
enum { value = false };
|
||||
typedef type_traits::no_type type;
|
||||
};
|
||||
template <> struct is_default<default_argument> {
|
||||
enum { value = true };
|
||||
typedef type_traits::yes_type type;
|
||||
};
|
||||
|
||||
struct choose_default {
|
||||
template <class Arg, class DefaultGen, class Base, class Traits>
|
||||
struct select {
|
||||
typedef typename default_generator<DefaultGen>::type Gen;
|
||||
typedef typename Gen::template select<Base,Traits>::type type;
|
||||
};
|
||||
};
|
||||
struct choose_arg {
|
||||
template <class Arg, class DefaultGen, class Base, class Traits>
|
||||
struct select {
|
||||
typedef Arg type;
|
||||
};
|
||||
};
|
||||
|
||||
#if defined(__BORLANDC__)
|
||||
template <class UseDefault>
|
||||
struct choose_arg_or_default { typedef choose_arg type; };
|
||||
template <>
|
||||
struct choose_arg_or_default<type_traits::yes_type> {
|
||||
typedef choose_default type;
|
||||
};
|
||||
#else
|
||||
template <bool UseDefault>
|
||||
struct choose_arg_or_default { typedef choose_arg type; };
|
||||
template <>
|
||||
struct choose_arg_or_default<true> {
|
||||
typedef choose_default type;
|
||||
};
|
||||
#endif
|
||||
|
||||
template <class Arg, class DefaultGen, class Base, class Traits>
|
||||
class resolve_default {
|
||||
#if defined(__BORLANDC__)
|
||||
typedef typename choose_arg_or_default<typename is_default<Arg>::type>::type Selector;
|
||||
#else
|
||||
// This usually works for Borland, but I'm seeing weird errors in
|
||||
// iterator_adaptor_test.cpp when using this method.
|
||||
enum { is_def = is_default<Arg>::value };
|
||||
typedef typename choose_arg_or_default<is_def>::type Selector;
|
||||
#endif
|
||||
public:
|
||||
typedef typename Selector
|
||||
::template select<Arg, DefaultGen, Base, Traits>::type type;
|
||||
};
|
||||
|
||||
// To differentiate an unnamed parameter from a traits generator
|
||||
// we use is_convertible<X, iter_traits_gen_base>.
|
||||
struct named_template_param_base { };
|
||||
|
||||
template <class X>
|
||||
struct is_named_param_list {
|
||||
enum { value = is_convertible<X, named_template_param_base>::value };
|
||||
};
|
||||
|
||||
struct choose_named_params {
|
||||
template <class Prev> struct select { typedef Prev type; };
|
||||
};
|
||||
struct choose_default_arg {
|
||||
template <class Prev> struct select {
|
||||
typedef detail::default_argument type;
|
||||
};
|
||||
};
|
||||
|
||||
template <bool Named> struct choose_default_dispatch_;
|
||||
template <> struct choose_default_dispatch_<true> {
|
||||
typedef choose_named_params type;
|
||||
};
|
||||
template <> struct choose_default_dispatch_<false> {
|
||||
typedef choose_default_arg type;
|
||||
};
|
||||
// The use of inheritance here is a Solaris Forte 6 workaround.
|
||||
template <bool Named> struct choose_default_dispatch
|
||||
: public choose_default_dispatch_<Named> { };
|
||||
|
||||
template <class PreviousArg>
|
||||
struct choose_default_argument {
|
||||
enum { is_named = is_named_param_list<PreviousArg>::value };
|
||||
typedef typename choose_default_dispatch<is_named>::type Selector;
|
||||
typedef typename Selector::template select<PreviousArg>::type type;
|
||||
};
|
||||
|
||||
// This macro assumes that there is a class named default_##TYPE
|
||||
// defined before the application of the macro. This class should
|
||||
// have a single member class template named "select" with two
|
||||
// template parameters: the type of the class being created (e.g.,
|
||||
// the iterator_adaptor type when creating iterator adaptors) and
|
||||
// a traits class. The select class should have a single typedef
|
||||
// named "type" that produces the default for TYPE. See
|
||||
// boost/iterator_adaptors.hpp for an example usage. Also,
|
||||
// applications of this macro must be placed in namespace
|
||||
// boost::detail.
|
||||
|
||||
#define BOOST_NAMED_TEMPLATE_PARAM(TYPE) \
|
||||
struct get_##TYPE##_from_named { \
|
||||
template <class Base, class NamedParams, class Traits> \
|
||||
struct select { \
|
||||
typedef typename NamedParams::traits NamedTraits; \
|
||||
typedef typename NamedTraits::TYPE TYPE; \
|
||||
typedef typename resolve_default<TYPE, \
|
||||
default_##TYPE, Base, NamedTraits>::type type; \
|
||||
}; \
|
||||
}; \
|
||||
struct pass_thru_##TYPE { \
|
||||
template <class Base, class Arg, class Traits> struct select { \
|
||||
typedef typename resolve_default<Arg, \
|
||||
default_##TYPE, Base, Traits>::type type; \
|
||||
};\
|
||||
}; \
|
||||
template <int NamedParam> \
|
||||
struct get_##TYPE##_dispatch { }; \
|
||||
template <> struct get_##TYPE##_dispatch<1> { \
|
||||
typedef get_##TYPE##_from_named type; \
|
||||
}; \
|
||||
template <> struct get_##TYPE##_dispatch<0> { \
|
||||
typedef pass_thru_##TYPE type; \
|
||||
}; \
|
||||
template <class Base, class X, class Traits> \
|
||||
class get_##TYPE { \
|
||||
enum { is_named = is_named_param_list<X>::value }; \
|
||||
typedef typename get_##TYPE##_dispatch<is_named>::type Selector; \
|
||||
public: \
|
||||
typedef typename Selector::template select<Base, X, Traits>::type type; \
|
||||
}; \
|
||||
template <> struct default_generator<default_##TYPE> { \
|
||||
typedef default_##TYPE type; \
|
||||
}
|
||||
|
||||
|
||||
} // namespace detail
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_DETAIL_NAMED_TEMPLATE_PARAMS_HPP
|
@ -0,0 +1,87 @@
|
||||
#ifndef BOOST_DETAIL_NO_EXCEPTIONS_SUPPORT_HPP_
|
||||
#define BOOST_DETAIL_NO_EXCEPTIONS_SUPPORT_HPP_
|
||||
|
||||
#if (defined _MSC_VER) && (_MSC_VER >= 1200)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// (C) Copyright 2004 Pavel Vozenilek.
|
||||
// Use, modification and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt
|
||||
// or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
//
|
||||
// This file contains helper macros used when exception support may be
|
||||
// disabled (as indicated by macro BOOST_NO_EXCEPTIONS).
|
||||
//
|
||||
// Before picking up these macros you may consider using RAII techniques
|
||||
// to deal with exceptions - their syntax can be always the same with
|
||||
// or without exception support enabled.
|
||||
//
|
||||
|
||||
/* Example of use:
|
||||
|
||||
void foo() {
|
||||
BOOST_TRY {
|
||||
...
|
||||
} BOOST_CATCH(const std::bad_alloc&) {
|
||||
...
|
||||
BOOST_RETHROW
|
||||
} BOOST_CATCH(const std::exception& e) {
|
||||
...
|
||||
}
|
||||
BOOST_CATCH_END
|
||||
}
|
||||
|
||||
With exception support enabled it will expand into:
|
||||
|
||||
void foo() {
|
||||
{ try {
|
||||
...
|
||||
} catch (const std::bad_alloc&) {
|
||||
...
|
||||
throw;
|
||||
} catch (const std::exception& e) {
|
||||
...
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
With exception support disabled it will expand into:
|
||||
|
||||
void foo() {
|
||||
{ if(true) {
|
||||
...
|
||||
} else if (false) {
|
||||
...
|
||||
} else if (false) {
|
||||
...
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
#if !(defined BOOST_NO_EXCEPTIONS)
|
||||
# define BOOST_TRY { try
|
||||
# define BOOST_CATCH(x) catch(x)
|
||||
# define BOOST_RETHROW throw;
|
||||
# define BOOST_CATCH_END }
|
||||
#else
|
||||
# if BOOST_WORKAROUND(__BORLANDC__, BOOST_TESTED_AT(0x564))
|
||||
# define BOOST_TRY { if ("")
|
||||
# define BOOST_CATCH(x) else if (!"")
|
||||
# else
|
||||
# define BOOST_TRY { if (true)
|
||||
# define BOOST_CATCH(x) else if (false)
|
||||
# endif
|
||||
# define BOOST_RETHROW
|
||||
# define BOOST_CATCH_END }
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
28
library/PolyVoxCore/include/boost/detail/none_t.hpp
Normal file
28
library/PolyVoxCore/include/boost/detail/none_t.hpp
Normal file
@ -0,0 +1,28 @@
|
||||
// Copyright (C) 2003, Fernando Luis Cacciola Carballal.
|
||||
//
|
||||
// Use, modification, and distribution is subject to the Boost Software
|
||||
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/lib/optional for documentation.
|
||||
//
|
||||
// You are welcome to contact the author at:
|
||||
// fernando_cacciola@hotmail.com
|
||||
//
|
||||
#ifndef BOOST_DETAIL_NONE_T_17SEP2003_HPP
|
||||
#define BOOST_DETAIL_NONE_T_17SEP2003_HPP
|
||||
|
||||
namespace boost {
|
||||
|
||||
namespace detail {
|
||||
|
||||
struct none_helper{};
|
||||
|
||||
typedef int none_helper::*none_t ;
|
||||
|
||||
} // namespace detail
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
|
191
library/PolyVoxCore/include/boost/detail/numeric_traits.hpp
Normal file
191
library/PolyVoxCore/include/boost/detail/numeric_traits.hpp
Normal file
@ -0,0 +1,191 @@
|
||||
// (C) Copyright David Abrahams 2001, Howard Hinnant 2001.
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// Template class numeric_traits<Number> --
|
||||
//
|
||||
// Supplies:
|
||||
//
|
||||
// typedef difference_type -- a type used to represent the difference
|
||||
// between any two values of Number.
|
||||
//
|
||||
// Support:
|
||||
// 1. Not all specializations are supplied
|
||||
//
|
||||
// 2. Use of specializations that are not supplied will cause a
|
||||
// compile-time error
|
||||
//
|
||||
// 3. Users are free to specialize numeric_traits for any type.
|
||||
//
|
||||
// 4. Right now, specializations are only supplied for integer types.
|
||||
//
|
||||
// 5. On implementations which do not supply compile-time constants in
|
||||
// std::numeric_limits<>, only specializations for built-in integer types
|
||||
// are supplied.
|
||||
//
|
||||
// 6. Handling of numbers whose range of representation is at least as
|
||||
// great as boost::intmax_t can cause some differences to be
|
||||
// unrepresentable in difference_type:
|
||||
//
|
||||
// Number difference_type
|
||||
// ------ ---------------
|
||||
// signed Number
|
||||
// unsigned intmax_t
|
||||
//
|
||||
// template <class Number> typename numeric_traits<Number>::difference_type
|
||||
// numeric_distance(Number x, Number y)
|
||||
// computes (y - x), attempting to avoid overflows.
|
||||
//
|
||||
|
||||
// See http://www.boost.org for most recent version including documentation.
|
||||
|
||||
// Revision History
|
||||
// 11 Feb 2001 - Use BOOST_STATIC_CONSTANT (David Abrahams)
|
||||
// 11 Feb 2001 - Rolled back ineffective Borland-specific code
|
||||
// (David Abrahams)
|
||||
// 10 Feb 2001 - Rolled in supposed Borland fixes from John Maddock, but
|
||||
// not seeing any improvement yet (David Abrahams)
|
||||
// 06 Feb 2001 - Factored if_true out into boost/detail/select_type.hpp
|
||||
// (David Abrahams)
|
||||
// 23 Jan 2001 - Fixed logic of difference_type selection, which was
|
||||
// completely wack. In the process, added digit_traits<>
|
||||
// to compute the number of digits in intmax_t even when
|
||||
// not supplied by numeric_limits<>. (David Abrahams)
|
||||
// 21 Jan 2001 - Created (David Abrahams)
|
||||
|
||||
#ifndef BOOST_NUMERIC_TRAITS_HPP_DWA20001901
|
||||
# define BOOST_NUMERIC_TRAITS_HPP_DWA20001901
|
||||
|
||||
# include <boost/config.hpp>
|
||||
# include <boost/cstdint.hpp>
|
||||
# include <boost/static_assert.hpp>
|
||||
# include <boost/type_traits.hpp>
|
||||
# include <boost/detail/select_type.hpp>
|
||||
# include <boost/limits.hpp>
|
||||
|
||||
namespace boost { namespace detail {
|
||||
|
||||
// Template class is_signed -- determine whether a numeric type is signed
|
||||
// Requires that T is constructable from the literals -1 and 0. Compile-time
|
||||
// error results if that requirement is not met (and thus signedness is not
|
||||
// likely to have meaning for that type).
|
||||
template <class Number>
|
||||
struct is_signed
|
||||
{
|
||||
#if defined(BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS) || defined(BOOST_MSVC) && BOOST_MSVC <= 1300
|
||||
BOOST_STATIC_CONSTANT(bool, value = (Number(-1) < Number(0)));
|
||||
#else
|
||||
BOOST_STATIC_CONSTANT(bool, value = std::numeric_limits<Number>::is_signed);
|
||||
#endif
|
||||
};
|
||||
|
||||
# ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
|
||||
// digit_traits - compute the number of digits in a built-in integer
|
||||
// type. Needed for implementations on which numeric_limits is not specialized
|
||||
// for intmax_t (e.g. VC6).
|
||||
template <bool is_specialized> struct digit_traits_select;
|
||||
|
||||
// numeric_limits is specialized; just select that version of digits
|
||||
template <> struct digit_traits_select<true>
|
||||
{
|
||||
template <class T> struct traits
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(int, digits = std::numeric_limits<T>::digits);
|
||||
};
|
||||
};
|
||||
|
||||
// numeric_limits is not specialized; compute digits from sizeof(T)
|
||||
template <> struct digit_traits_select<false>
|
||||
{
|
||||
template <class T> struct traits
|
||||
{
|
||||
BOOST_STATIC_CONSTANT(int, digits = (
|
||||
sizeof(T) * std::numeric_limits<unsigned char>::digits
|
||||
- (is_signed<T>::value ? 1 : 0))
|
||||
);
|
||||
};
|
||||
};
|
||||
|
||||
// here's the "usable" template
|
||||
template <class T> struct digit_traits
|
||||
{
|
||||
typedef digit_traits_select<
|
||||
::std::numeric_limits<T>::is_specialized> selector;
|
||||
typedef typename selector::template traits<T> traits;
|
||||
BOOST_STATIC_CONSTANT(int, digits = traits::digits);
|
||||
};
|
||||
#endif
|
||||
|
||||
// Template class integer_traits<Integer> -- traits of various integer types
|
||||
// This should probably be rolled into boost::integer_traits one day, but I
|
||||
// need it to work without <limits>
|
||||
template <class Integer>
|
||||
struct integer_traits
|
||||
{
|
||||
# ifndef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
|
||||
private:
|
||||
typedef Integer integer_type;
|
||||
typedef std::numeric_limits<integer_type> x;
|
||||
# if defined(BOOST_MSVC) && BOOST_MSVC <= 1300
|
||||
// for some reason, MSVC asserts when it shouldn't unless we make these
|
||||
// local definitions
|
||||
BOOST_STATIC_CONSTANT(bool, is_integer = x::is_integer);
|
||||
BOOST_STATIC_CONSTANT(bool, is_specialized = x::is_specialized);
|
||||
|
||||
BOOST_STATIC_ASSERT(is_integer);
|
||||
BOOST_STATIC_ASSERT(is_specialized);
|
||||
# endif
|
||||
public:
|
||||
typedef typename
|
||||
if_true<(int(x::is_signed)
|
||||
&& (!int(x::is_bounded)
|
||||
// digits is the number of no-sign bits
|
||||
|| (int(x::digits) + 1 >= digit_traits<boost::intmax_t>::digits)))>::template then<
|
||||
Integer,
|
||||
|
||||
typename if_true<(int(x::digits) + 1 < digit_traits<signed int>::digits)>::template then<
|
||||
signed int,
|
||||
|
||||
typename if_true<(int(x::digits) + 1 < digit_traits<signed long>::digits)>::template then<
|
||||
signed long,
|
||||
|
||||
// else
|
||||
intmax_t
|
||||
>::type>::type>::type difference_type;
|
||||
#else
|
||||
BOOST_STATIC_ASSERT(boost::is_integral<Integer>::value);
|
||||
|
||||
typedef typename
|
||||
if_true<(sizeof(Integer) >= sizeof(intmax_t))>::template then<
|
||||
|
||||
typename if_true<(is_signed<Integer>::value)>::template then<
|
||||
Integer,
|
||||
intmax_t
|
||||
>::type,
|
||||
|
||||
typename if_true<(sizeof(Integer) < sizeof(std::ptrdiff_t))>::template then<
|
||||
std::ptrdiff_t,
|
||||
intmax_t
|
||||
>::type
|
||||
>::type difference_type;
|
||||
# endif
|
||||
};
|
||||
|
||||
// Right now, only supports integers, but should be expanded.
|
||||
template <class Number>
|
||||
struct numeric_traits
|
||||
{
|
||||
typedef typename integer_traits<Number>::difference_type difference_type;
|
||||
};
|
||||
|
||||
template <class Number>
|
||||
typename numeric_traits<Number>::difference_type numeric_distance(Number x, Number y)
|
||||
{
|
||||
typedef typename numeric_traits<Number>::difference_type difference_type;
|
||||
return difference_type(y) - difference_type(x);
|
||||
}
|
||||
}}
|
||||
|
||||
#endif // BOOST_NUMERIC_TRAITS_HPP_DWA20001901
|
168
library/PolyVoxCore/include/boost/detail/ob_call_traits.hpp
Normal file
168
library/PolyVoxCore/include/boost/detail/ob_call_traits.hpp
Normal file
@ -0,0 +1,168 @@
|
||||
// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000.
|
||||
// Use, modification and distribution are subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt).
|
||||
//
|
||||
// See http://www.boost.org/libs/utility for most recent version including documentation.
|
||||
//
|
||||
// Crippled version for crippled compilers:
|
||||
// see libs/utility/call_traits.htm
|
||||
//
|
||||
|
||||
/* Release notes:
|
||||
01st October 2000:
|
||||
Fixed call_traits on VC6, using "poor man's partial specialisation",
|
||||
using ideas taken from "Generative programming" by Krzysztof Czarnecki
|
||||
& Ulrich Eisenecker.
|
||||
*/
|
||||
|
||||
#ifndef BOOST_OB_CALL_TRAITS_HPP
|
||||
#define BOOST_OB_CALL_TRAITS_HPP
|
||||
|
||||
#ifndef BOOST_CONFIG_HPP
|
||||
#include <boost/config.hpp>
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_ARITHMETIC_TYPE_TRAITS_HPP
|
||||
#include <boost/type_traits/arithmetic_traits.hpp>
|
||||
#endif
|
||||
#ifndef BOOST_COMPOSITE_TYPE_TRAITS_HPP
|
||||
#include <boost/type_traits/composite_traits.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost{
|
||||
|
||||
#ifdef BOOST_MSVC6_MEMBER_TEMPLATES
|
||||
//
|
||||
// use member templates to emulate
|
||||
// partial specialisation:
|
||||
//
|
||||
namespace detail{
|
||||
|
||||
template <class T>
|
||||
struct standard_call_traits
|
||||
{
|
||||
typedef T value_type;
|
||||
typedef T& reference;
|
||||
typedef const T& const_reference;
|
||||
typedef const T& param_type;
|
||||
};
|
||||
template <class T>
|
||||
struct simple_call_traits
|
||||
{
|
||||
typedef T value_type;
|
||||
typedef T& reference;
|
||||
typedef const T& const_reference;
|
||||
typedef const T param_type;
|
||||
};
|
||||
template <class T>
|
||||
struct reference_call_traits
|
||||
{
|
||||
typedef T value_type;
|
||||
typedef T reference;
|
||||
typedef T const_reference;
|
||||
typedef T param_type;
|
||||
};
|
||||
|
||||
template <bool pointer, bool arithmetic, bool reference>
|
||||
struct call_traits_chooser
|
||||
{
|
||||
template <class T>
|
||||
struct rebind
|
||||
{
|
||||
typedef standard_call_traits<T> type;
|
||||
};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct call_traits_chooser<true, false, false>
|
||||
{
|
||||
template <class T>
|
||||
struct rebind
|
||||
{
|
||||
typedef simple_call_traits<T> type;
|
||||
};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct call_traits_chooser<false, false, true>
|
||||
{
|
||||
template <class T>
|
||||
struct rebind
|
||||
{
|
||||
typedef reference_call_traits<T> type;
|
||||
};
|
||||
};
|
||||
|
||||
template <bool size_is_small>
|
||||
struct call_traits_sizeof_chooser2
|
||||
{
|
||||
template <class T>
|
||||
struct small_rebind
|
||||
{
|
||||
typedef simple_call_traits<T> small_type;
|
||||
};
|
||||
};
|
||||
|
||||
template<>
|
||||
struct call_traits_sizeof_chooser2<false>
|
||||
{
|
||||
template <class T>
|
||||
struct small_rebind
|
||||
{
|
||||
typedef standard_call_traits<T> small_type;
|
||||
};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct call_traits_chooser<false, true, false>
|
||||
{
|
||||
template <class T>
|
||||
struct rebind
|
||||
{
|
||||
enum { sizeof_choice = (sizeof(T) <= sizeof(void*)) };
|
||||
typedef call_traits_sizeof_chooser2<(sizeof(T) <= sizeof(void*))> chooser;
|
||||
typedef typename chooser::template small_rebind<T> bound_type;
|
||||
typedef typename bound_type::small_type type;
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
template <typename T>
|
||||
struct call_traits
|
||||
{
|
||||
private:
|
||||
typedef detail::call_traits_chooser<
|
||||
::boost::is_pointer<T>::value,
|
||||
::boost::is_arithmetic<T>::value,
|
||||
::boost::is_reference<T>::value
|
||||
> chooser;
|
||||
typedef typename chooser::template rebind<T> bound_type;
|
||||
typedef typename bound_type::type call_traits_type;
|
||||
public:
|
||||
typedef typename call_traits_type::value_type value_type;
|
||||
typedef typename call_traits_type::reference reference;
|
||||
typedef typename call_traits_type::const_reference const_reference;
|
||||
typedef typename call_traits_type::param_type param_type;
|
||||
};
|
||||
|
||||
#else
|
||||
//
|
||||
// sorry call_traits is completely non-functional
|
||||
// blame your broken compiler:
|
||||
//
|
||||
|
||||
template <typename T>
|
||||
struct call_traits
|
||||
{
|
||||
typedef T value_type;
|
||||
typedef T& reference;
|
||||
typedef const T& const_reference;
|
||||
typedef const T& param_type;
|
||||
};
|
||||
|
||||
#endif // member templates
|
||||
|
||||
}
|
||||
|
||||
#endif // BOOST_OB_CALL_TRAITS_HPP
|
510
library/PolyVoxCore/include/boost/detail/ob_compressed_pair.hpp
Normal file
510
library/PolyVoxCore/include/boost/detail/ob_compressed_pair.hpp
Normal file
@ -0,0 +1,510 @@
|
||||
// (C) Copyright Steve Cleary, Beman Dawes, Howard Hinnant & John Maddock 2000.
|
||||
// Use, modification and distribution are subject to the Boost Software License,
|
||||
// Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt).
|
||||
//
|
||||
// See http://www.boost.org/libs/utility for most recent version including documentation.
|
||||
// see libs/utility/compressed_pair.hpp
|
||||
//
|
||||
/* Release notes:
|
||||
20 Jan 2001:
|
||||
Fixed obvious bugs (David Abrahams)
|
||||
07 Oct 2000:
|
||||
Added better single argument constructor support.
|
||||
03 Oct 2000:
|
||||
Added VC6 support (JM).
|
||||
23rd July 2000:
|
||||
Additional comments added. (JM)
|
||||
Jan 2000:
|
||||
Original version: this version crippled for use with crippled compilers
|
||||
- John Maddock Jan 2000.
|
||||
*/
|
||||
|
||||
|
||||
#ifndef BOOST_OB_COMPRESSED_PAIR_HPP
|
||||
#define BOOST_OB_COMPRESSED_PAIR_HPP
|
||||
|
||||
#include <algorithm>
|
||||
#ifndef BOOST_OBJECT_TYPE_TRAITS_HPP
|
||||
#include <boost/type_traits/object_traits.hpp>
|
||||
#endif
|
||||
#ifndef BOOST_SAME_TRAITS_HPP
|
||||
#include <boost/type_traits/same_traits.hpp>
|
||||
#endif
|
||||
#ifndef BOOST_CALL_TRAITS_HPP
|
||||
#include <boost/call_traits.hpp>
|
||||
#endif
|
||||
|
||||
namespace boost
|
||||
{
|
||||
#ifdef BOOST_MSVC6_MEMBER_TEMPLATES
|
||||
//
|
||||
// use member templates to emulate
|
||||
// partial specialisation. Note that due to
|
||||
// problems with overload resolution with VC6
|
||||
// each of the compressed_pair versions that follow
|
||||
// have one template single-argument constructor
|
||||
// in place of two specific constructors:
|
||||
//
|
||||
|
||||
template <class T1, class T2>
|
||||
class compressed_pair;
|
||||
|
||||
namespace detail{
|
||||
|
||||
template <class A, class T1, class T2>
|
||||
struct best_conversion_traits
|
||||
{
|
||||
typedef char one;
|
||||
typedef char (&two)[2];
|
||||
static A a;
|
||||
static one test(T1);
|
||||
static two test(T2);
|
||||
|
||||
enum { value = sizeof(test(a)) };
|
||||
};
|
||||
|
||||
template <int>
|
||||
struct init_one;
|
||||
|
||||
template <>
|
||||
struct init_one<1>
|
||||
{
|
||||
template <class A, class T1, class T2>
|
||||
static void init(const A& a, T1* p1, T2*)
|
||||
{
|
||||
*p1 = a;
|
||||
}
|
||||
};
|
||||
|
||||
template <>
|
||||
struct init_one<2>
|
||||
{
|
||||
template <class A, class T1, class T2>
|
||||
static void init(const A& a, T1*, T2* p2)
|
||||
{
|
||||
*p2 = a;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// T1 != T2, both non-empty
|
||||
template <class T1, class T2>
|
||||
class compressed_pair_0
|
||||
{
|
||||
private:
|
||||
T1 _first;
|
||||
T2 _second;
|
||||
public:
|
||||
typedef T1 first_type;
|
||||
typedef T2 second_type;
|
||||
typedef typename call_traits<first_type>::param_type first_param_type;
|
||||
typedef typename call_traits<second_type>::param_type second_param_type;
|
||||
typedef typename call_traits<first_type>::reference first_reference;
|
||||
typedef typename call_traits<second_type>::reference second_reference;
|
||||
typedef typename call_traits<first_type>::const_reference first_const_reference;
|
||||
typedef typename call_traits<second_type>::const_reference second_const_reference;
|
||||
|
||||
compressed_pair_0() : _first(), _second() {}
|
||||
compressed_pair_0(first_param_type x, second_param_type y) : _first(x), _second(y) {}
|
||||
template <class A>
|
||||
explicit compressed_pair_0(const A& val)
|
||||
{
|
||||
init_one<best_conversion_traits<A, T1, T2>::value>::init(val, &_first, &_second);
|
||||
}
|
||||
compressed_pair_0(const ::boost::compressed_pair<T1,T2>& x)
|
||||
: _first(x.first()), _second(x.second()) {}
|
||||
|
||||
#if 0
|
||||
compressed_pair_0& operator=(const compressed_pair_0& x) {
|
||||
cout << "assigning compressed pair 0" << endl;
|
||||
_first = x._first;
|
||||
_second = x._second;
|
||||
cout << "finished assigning compressed pair 0" << endl;
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
first_reference first() { return _first; }
|
||||
first_const_reference first() const { return _first; }
|
||||
|
||||
second_reference second() { return _second; }
|
||||
second_const_reference second() const { return _second; }
|
||||
|
||||
void swap(compressed_pair_0& y)
|
||||
{
|
||||
using std::swap;
|
||||
swap(_first, y._first);
|
||||
swap(_second, y._second);
|
||||
}
|
||||
};
|
||||
|
||||
// T1 != T2, T2 empty
|
||||
template <class T1, class T2>
|
||||
class compressed_pair_1 : T2
|
||||
{
|
||||
private:
|
||||
T1 _first;
|
||||
public:
|
||||
typedef T1 first_type;
|
||||
typedef T2 second_type;
|
||||
typedef typename call_traits<first_type>::param_type first_param_type;
|
||||
typedef typename call_traits<second_type>::param_type second_param_type;
|
||||
typedef typename call_traits<first_type>::reference first_reference;
|
||||
typedef typename call_traits<second_type>::reference second_reference;
|
||||
typedef typename call_traits<first_type>::const_reference first_const_reference;
|
||||
typedef typename call_traits<second_type>::const_reference second_const_reference;
|
||||
|
||||
compressed_pair_1() : T2(), _first() {}
|
||||
compressed_pair_1(first_param_type x, second_param_type y) : T2(y), _first(x) {}
|
||||
|
||||
template <class A>
|
||||
explicit compressed_pair_1(const A& val)
|
||||
{
|
||||
init_one<best_conversion_traits<A, T1, T2>::value>::init(val, &_first, static_cast<T2*>(this));
|
||||
}
|
||||
|
||||
compressed_pair_1(const ::boost::compressed_pair<T1,T2>& x)
|
||||
: T2(x.second()), _first(x.first()) {}
|
||||
|
||||
#if defined(BOOST_MSVC) && BOOST_MSVC <= 1300
|
||||
// Total weirdness. If the assignment to _first is moved after
|
||||
// the call to the inherited operator=, then this breaks graph/test/graph.cpp
|
||||
// by way of iterator_adaptor.
|
||||
compressed_pair_1& operator=(const compressed_pair_1& x) {
|
||||
_first = x._first;
|
||||
T2::operator=(x);
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
|
||||
first_reference first() { return _first; }
|
||||
first_const_reference first() const { return _first; }
|
||||
|
||||
second_reference second() { return *this; }
|
||||
second_const_reference second() const { return *this; }
|
||||
|
||||
void swap(compressed_pair_1& y)
|
||||
{
|
||||
// no need to swap empty base class:
|
||||
using std::swap;
|
||||
swap(_first, y._first);
|
||||
}
|
||||
};
|
||||
|
||||
// T1 != T2, T1 empty
|
||||
template <class T1, class T2>
|
||||
class compressed_pair_2 : T1
|
||||
{
|
||||
private:
|
||||
T2 _second;
|
||||
public:
|
||||
typedef T1 first_type;
|
||||
typedef T2 second_type;
|
||||
typedef typename call_traits<first_type>::param_type first_param_type;
|
||||
typedef typename call_traits<second_type>::param_type second_param_type;
|
||||
typedef typename call_traits<first_type>::reference first_reference;
|
||||
typedef typename call_traits<second_type>::reference second_reference;
|
||||
typedef typename call_traits<first_type>::const_reference first_const_reference;
|
||||
typedef typename call_traits<second_type>::const_reference second_const_reference;
|
||||
|
||||
compressed_pair_2() : T1(), _second() {}
|
||||
compressed_pair_2(first_param_type x, second_param_type y) : T1(x), _second(y) {}
|
||||
template <class A>
|
||||
explicit compressed_pair_2(const A& val)
|
||||
{
|
||||
init_one<best_conversion_traits<A, T1, T2>::value>::init(val, static_cast<T1*>(this), &_second);
|
||||
}
|
||||
compressed_pair_2(const ::boost::compressed_pair<T1,T2>& x)
|
||||
: T1(x.first()), _second(x.second()) {}
|
||||
|
||||
#if 0
|
||||
compressed_pair_2& operator=(const compressed_pair_2& x) {
|
||||
cout << "assigning compressed pair 2" << endl;
|
||||
T1::operator=(x);
|
||||
_second = x._second;
|
||||
cout << "finished assigning compressed pair 2" << endl;
|
||||
return *this;
|
||||
}
|
||||
#endif
|
||||
first_reference first() { return *this; }
|
||||
first_const_reference first() const { return *this; }
|
||||
|
||||
second_reference second() { return _second; }
|
||||
second_const_reference second() const { return _second; }
|
||||
|
||||
void swap(compressed_pair_2& y)
|
||||
{
|
||||
// no need to swap empty base class:
|
||||
using std::swap;
|
||||
swap(_second, y._second);
|
||||
}
|
||||
};
|
||||
|
||||
// T1 != T2, both empty
|
||||
template <class T1, class T2>
|
||||
class compressed_pair_3 : T1, T2
|
||||
{
|
||||
public:
|
||||
typedef T1 first_type;
|
||||
typedef T2 second_type;
|
||||
typedef typename call_traits<first_type>::param_type first_param_type;
|
||||
typedef typename call_traits<second_type>::param_type second_param_type;
|
||||
typedef typename call_traits<first_type>::reference first_reference;
|
||||
typedef typename call_traits<second_type>::reference second_reference;
|
||||
typedef typename call_traits<first_type>::const_reference first_const_reference;
|
||||
typedef typename call_traits<second_type>::const_reference second_const_reference;
|
||||
|
||||
compressed_pair_3() : T1(), T2() {}
|
||||
compressed_pair_3(first_param_type x, second_param_type y) : T1(x), T2(y) {}
|
||||
template <class A>
|
||||
explicit compressed_pair_3(const A& val)
|
||||
{
|
||||
init_one<best_conversion_traits<A, T1, T2>::value>::init(val, static_cast<T1*>(this), static_cast<T2*>(this));
|
||||
}
|
||||
compressed_pair_3(const ::boost::compressed_pair<T1,T2>& x)
|
||||
: T1(x.first()), T2(x.second()) {}
|
||||
|
||||
first_reference first() { return *this; }
|
||||
first_const_reference first() const { return *this; }
|
||||
|
||||
second_reference second() { return *this; }
|
||||
second_const_reference second() const { return *this; }
|
||||
|
||||
void swap(compressed_pair_3& y)
|
||||
{
|
||||
// no need to swap empty base classes:
|
||||
}
|
||||
};
|
||||
|
||||
// T1 == T2, and empty
|
||||
template <class T1, class T2>
|
||||
class compressed_pair_4 : T1
|
||||
{
|
||||
public:
|
||||
typedef T1 first_type;
|
||||
typedef T2 second_type;
|
||||
typedef typename call_traits<first_type>::param_type first_param_type;
|
||||
typedef typename call_traits<second_type>::param_type second_param_type;
|
||||
typedef typename call_traits<first_type>::reference first_reference;
|
||||
typedef typename call_traits<second_type>::reference second_reference;
|
||||
typedef typename call_traits<first_type>::const_reference first_const_reference;
|
||||
typedef typename call_traits<second_type>::const_reference second_const_reference;
|
||||
|
||||
compressed_pair_4() : T1() {}
|
||||
compressed_pair_4(first_param_type x, second_param_type y) : T1(x), m_second(y) {}
|
||||
// only one single argument constructor since T1 == T2
|
||||
explicit compressed_pair_4(first_param_type x) : T1(x), m_second(x) {}
|
||||
compressed_pair_4(const ::boost::compressed_pair<T1,T2>& x)
|
||||
: T1(x.first()), m_second(x.second()) {}
|
||||
|
||||
first_reference first() { return *this; }
|
||||
first_const_reference first() const { return *this; }
|
||||
|
||||
second_reference second() { return m_second; }
|
||||
second_const_reference second() const { return m_second; }
|
||||
|
||||
void swap(compressed_pair_4& y)
|
||||
{
|
||||
// no need to swap empty base classes:
|
||||
}
|
||||
private:
|
||||
T2 m_second;
|
||||
};
|
||||
|
||||
// T1 == T2, not empty
|
||||
template <class T1, class T2>
|
||||
class compressed_pair_5
|
||||
{
|
||||
private:
|
||||
T1 _first;
|
||||
T2 _second;
|
||||
public:
|
||||
typedef T1 first_type;
|
||||
typedef T2 second_type;
|
||||
typedef typename call_traits<first_type>::param_type first_param_type;
|
||||
typedef typename call_traits<second_type>::param_type second_param_type;
|
||||
typedef typename call_traits<first_type>::reference first_reference;
|
||||
typedef typename call_traits<second_type>::reference second_reference;
|
||||
typedef typename call_traits<first_type>::const_reference first_const_reference;
|
||||
typedef typename call_traits<second_type>::const_reference second_const_reference;
|
||||
|
||||
compressed_pair_5() : _first(), _second() {}
|
||||
compressed_pair_5(first_param_type x, second_param_type y) : _first(x), _second(y) {}
|
||||
// only one single argument constructor since T1 == T2
|
||||
explicit compressed_pair_5(first_param_type x) : _first(x), _second(x) {}
|
||||
compressed_pair_5(const ::boost::compressed_pair<T1,T2>& c)
|
||||
: _first(c.first()), _second(c.second()) {}
|
||||
|
||||
first_reference first() { return _first; }
|
||||
first_const_reference first() const { return _first; }
|
||||
|
||||
second_reference second() { return _second; }
|
||||
second_const_reference second() const { return _second; }
|
||||
|
||||
void swap(compressed_pair_5& y)
|
||||
{
|
||||
using std::swap;
|
||||
swap(_first, y._first);
|
||||
swap(_second, y._second);
|
||||
}
|
||||
};
|
||||
|
||||
template <bool e1, bool e2, bool same>
|
||||
struct compressed_pair_chooser
|
||||
{
|
||||
template <class T1, class T2>
|
||||
struct rebind
|
||||
{
|
||||
typedef compressed_pair_0<T1, T2> type;
|
||||
};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct compressed_pair_chooser<false, true, false>
|
||||
{
|
||||
template <class T1, class T2>
|
||||
struct rebind
|
||||
{
|
||||
typedef compressed_pair_1<T1, T2> type;
|
||||
};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct compressed_pair_chooser<true, false, false>
|
||||
{
|
||||
template <class T1, class T2>
|
||||
struct rebind
|
||||
{
|
||||
typedef compressed_pair_2<T1, T2> type;
|
||||
};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct compressed_pair_chooser<true, true, false>
|
||||
{
|
||||
template <class T1, class T2>
|
||||
struct rebind
|
||||
{
|
||||
typedef compressed_pair_3<T1, T2> type;
|
||||
};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct compressed_pair_chooser<true, true, true>
|
||||
{
|
||||
template <class T1, class T2>
|
||||
struct rebind
|
||||
{
|
||||
typedef compressed_pair_4<T1, T2> type;
|
||||
};
|
||||
};
|
||||
|
||||
template <>
|
||||
struct compressed_pair_chooser<false, false, true>
|
||||
{
|
||||
template <class T1, class T2>
|
||||
struct rebind
|
||||
{
|
||||
typedef compressed_pair_5<T1, T2> type;
|
||||
};
|
||||
};
|
||||
|
||||
template <class T1, class T2>
|
||||
struct compressed_pair_traits
|
||||
{
|
||||
private:
|
||||
typedef compressed_pair_chooser<is_empty<T1>::value, is_empty<T2>::value, is_same<T1,T2>::value> chooser;
|
||||
typedef typename chooser::template rebind<T1, T2> bound_type;
|
||||
public:
|
||||
typedef typename bound_type::type type;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template <class T1, class T2>
|
||||
class compressed_pair : public detail::compressed_pair_traits<T1, T2>::type
|
||||
{
|
||||
private:
|
||||
typedef typename detail::compressed_pair_traits<T1, T2>::type base_type;
|
||||
public:
|
||||
typedef T1 first_type;
|
||||
typedef T2 second_type;
|
||||
typedef typename call_traits<first_type>::param_type first_param_type;
|
||||
typedef typename call_traits<second_type>::param_type second_param_type;
|
||||
typedef typename call_traits<first_type>::reference first_reference;
|
||||
typedef typename call_traits<second_type>::reference second_reference;
|
||||
typedef typename call_traits<first_type>::const_reference first_const_reference;
|
||||
typedef typename call_traits<second_type>::const_reference second_const_reference;
|
||||
|
||||
compressed_pair() : base_type() {}
|
||||
compressed_pair(first_param_type x, second_param_type y) : base_type(x, y) {}
|
||||
template <class A>
|
||||
explicit compressed_pair(const A& x) : base_type(x){}
|
||||
|
||||
first_reference first() { return base_type::first(); }
|
||||
first_const_reference first() const { return base_type::first(); }
|
||||
|
||||
second_reference second() { return base_type::second(); }
|
||||
second_const_reference second() const { return base_type::second(); }
|
||||
};
|
||||
|
||||
template <class T1, class T2>
|
||||
inline void swap(compressed_pair<T1, T2>& x, compressed_pair<T1, T2>& y)
|
||||
{
|
||||
x.swap(y);
|
||||
}
|
||||
|
||||
#else
|
||||
// no partial specialisation, no member templates:
|
||||
|
||||
template <class T1, class T2>
|
||||
class compressed_pair
|
||||
{
|
||||
private:
|
||||
T1 _first;
|
||||
T2 _second;
|
||||
public:
|
||||
typedef T1 first_type;
|
||||
typedef T2 second_type;
|
||||
typedef typename call_traits<first_type>::param_type first_param_type;
|
||||
typedef typename call_traits<second_type>::param_type second_param_type;
|
||||
typedef typename call_traits<first_type>::reference first_reference;
|
||||
typedef typename call_traits<second_type>::reference second_reference;
|
||||
typedef typename call_traits<first_type>::const_reference first_const_reference;
|
||||
typedef typename call_traits<second_type>::const_reference second_const_reference;
|
||||
|
||||
compressed_pair() : _first(), _second() {}
|
||||
compressed_pair(first_param_type x, second_param_type y) : _first(x), _second(y) {}
|
||||
explicit compressed_pair(first_param_type x) : _first(x), _second() {}
|
||||
// can't define this in case T1 == T2:
|
||||
// explicit compressed_pair(second_param_type y) : _first(), _second(y) {}
|
||||
|
||||
first_reference first() { return _first; }
|
||||
first_const_reference first() const { return _first; }
|
||||
|
||||
second_reference second() { return _second; }
|
||||
second_const_reference second() const { return _second; }
|
||||
|
||||
void swap(compressed_pair& y)
|
||||
{
|
||||
using std::swap;
|
||||
swap(_first, y._first);
|
||||
swap(_second, y._second);
|
||||
}
|
||||
};
|
||||
|
||||
template <class T1, class T2>
|
||||
inline void swap(compressed_pair<T1, T2>& x, compressed_pair<T1, T2>& y)
|
||||
{
|
||||
x.swap(y);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
} // boost
|
||||
|
||||
#endif // BOOST_OB_COMPRESSED_PAIR_HPP
|
||||
|
||||
|
||||
|
198
library/PolyVoxCore/include/boost/detail/quick_allocator.hpp
Normal file
198
library/PolyVoxCore/include/boost/detail/quick_allocator.hpp
Normal file
@ -0,0 +1,198 @@
|
||||
#ifndef BOOST_DETAIL_QUICK_ALLOCATOR_HPP_INCLUDED
|
||||
#define BOOST_DETAIL_QUICK_ALLOCATOR_HPP_INCLUDED
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
//
|
||||
// detail/quick_allocator.hpp
|
||||
//
|
||||
// Copyright (c) 2003 David Abrahams
|
||||
// Copyright (c) 2003 Peter Dimov
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#include <boost/detail/lightweight_mutex.hpp>
|
||||
#include <boost/type_traits/type_with_alignment.hpp>
|
||||
#include <boost/type_traits/alignment_of.hpp>
|
||||
|
||||
#include <new> // ::operator new, ::operator delete
|
||||
#include <cstddef> // std::size_t
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template<unsigned size, unsigned align_> union freeblock
|
||||
{
|
||||
typedef typename boost::type_with_alignment<align_>::type aligner_type;
|
||||
aligner_type aligner;
|
||||
char bytes[size];
|
||||
freeblock * next;
|
||||
};
|
||||
|
||||
template<unsigned size, unsigned align_> struct allocator_impl
|
||||
{
|
||||
typedef freeblock<size, align_> block;
|
||||
|
||||
// It may seem odd to use such small pages.
|
||||
//
|
||||
// However, on a typical Windows implementation that uses
|
||||
// the OS allocator, "normal size" pages interact with the
|
||||
// "ordinary" operator new, slowing it down dramatically.
|
||||
//
|
||||
// 512 byte pages are handled by the small object allocator,
|
||||
// and don't interfere with ::new.
|
||||
//
|
||||
// The other alternative is to use much bigger pages (1M.)
|
||||
//
|
||||
// It is surprisingly easy to hit pathological behavior by
|
||||
// varying the page size. g++ 2.96 on Red Hat Linux 7.2,
|
||||
// for example, passionately dislikes 496. 512 seems OK.
|
||||
|
||||
#if defined(BOOST_QA_PAGE_SIZE)
|
||||
|
||||
enum { items_per_page = BOOST_QA_PAGE_SIZE / size };
|
||||
|
||||
#else
|
||||
|
||||
enum { items_per_page = 512 / size }; // 1048560 / size
|
||||
|
||||
#endif
|
||||
|
||||
#ifdef BOOST_HAS_THREADS
|
||||
|
||||
static lightweight_mutex & mutex()
|
||||
{
|
||||
static lightweight_mutex m;
|
||||
return m;
|
||||
}
|
||||
|
||||
static lightweight_mutex * mutex_init;
|
||||
|
||||
#endif
|
||||
|
||||
static block * free;
|
||||
static block * page;
|
||||
static unsigned last;
|
||||
|
||||
static inline void * alloc()
|
||||
{
|
||||
#ifdef BOOST_HAS_THREADS
|
||||
lightweight_mutex::scoped_lock lock( mutex() );
|
||||
#endif
|
||||
if(block * x = free)
|
||||
{
|
||||
free = x->next;
|
||||
return x;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(last == items_per_page)
|
||||
{
|
||||
// "Listen to me carefully: there is no memory leak"
|
||||
// -- Scott Meyers, Eff C++ 2nd Ed Item 10
|
||||
page = ::new block[items_per_page];
|
||||
last = 0;
|
||||
}
|
||||
|
||||
return &page[last++];
|
||||
}
|
||||
}
|
||||
|
||||
static inline void * alloc(std::size_t n)
|
||||
{
|
||||
if(n != size) // class-specific new called for a derived object
|
||||
{
|
||||
return ::operator new(n);
|
||||
}
|
||||
else
|
||||
{
|
||||
#ifdef BOOST_HAS_THREADS
|
||||
lightweight_mutex::scoped_lock lock( mutex() );
|
||||
#endif
|
||||
if(block * x = free)
|
||||
{
|
||||
free = x->next;
|
||||
return x;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(last == items_per_page)
|
||||
{
|
||||
page = ::new block[items_per_page];
|
||||
last = 0;
|
||||
}
|
||||
|
||||
return &page[last++];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static inline void dealloc(void * pv)
|
||||
{
|
||||
if(pv != 0) // 18.4.1.1/13
|
||||
{
|
||||
#ifdef BOOST_HAS_THREADS
|
||||
lightweight_mutex::scoped_lock lock( mutex() );
|
||||
#endif
|
||||
block * pb = static_cast<block *>(pv);
|
||||
pb->next = free;
|
||||
free = pb;
|
||||
}
|
||||
}
|
||||
|
||||
static inline void dealloc(void * pv, std::size_t n)
|
||||
{
|
||||
if(n != size) // class-specific delete called for a derived object
|
||||
{
|
||||
::operator delete(pv);
|
||||
}
|
||||
else if(pv != 0) // 18.4.1.1/13
|
||||
{
|
||||
#ifdef BOOST_HAS_THREADS
|
||||
lightweight_mutex::scoped_lock lock( mutex() );
|
||||
#endif
|
||||
block * pb = static_cast<block *>(pv);
|
||||
pb->next = free;
|
||||
free = pb;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
#ifdef BOOST_HAS_THREADS
|
||||
|
||||
template<unsigned size, unsigned align_>
|
||||
lightweight_mutex * allocator_impl<size, align_>::mutex_init = &allocator_impl<size, align_>::mutex();
|
||||
|
||||
#endif
|
||||
|
||||
template<unsigned size, unsigned align_>
|
||||
freeblock<size, align_> * allocator_impl<size, align_>::free = 0;
|
||||
|
||||
template<unsigned size, unsigned align_>
|
||||
freeblock<size, align_> * allocator_impl<size, align_>::page = 0;
|
||||
|
||||
template<unsigned size, unsigned align_>
|
||||
unsigned allocator_impl<size, align_>::last = allocator_impl<size, align_>::items_per_page;
|
||||
|
||||
template<class T>
|
||||
struct quick_allocator: public allocator_impl< sizeof(T), boost::alignment_of<T>::value >
|
||||
{
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // #ifndef BOOST_DETAIL_QUICK_ALLOCATOR_HPP_INCLUDED
|
141
library/PolyVoxCore/include/boost/detail/reference_content.hpp
Normal file
141
library/PolyVoxCore/include/boost/detail/reference_content.hpp
Normal file
@ -0,0 +1,141 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// boost detail/reference_content.hpp header file
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (c) 2003
|
||||
// Eric Friedman
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_DETAIL_REFERENCE_CONTENT_HPP
|
||||
#define BOOST_DETAIL_REFERENCE_CONTENT_HPP
|
||||
|
||||
#include "boost/config.hpp"
|
||||
|
||||
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
||||
# include "boost/mpl/bool.hpp"
|
||||
# include "boost/type_traits/has_nothrow_copy.hpp"
|
||||
#else
|
||||
# include "boost/mpl/if.hpp"
|
||||
# include "boost/type_traits/is_reference.hpp"
|
||||
#endif
|
||||
|
||||
#include "boost/mpl/void.hpp"
|
||||
|
||||
namespace boost {
|
||||
|
||||
namespace detail {
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// (detail) class template reference_content
|
||||
//
|
||||
// Non-Assignable wrapper for references.
|
||||
//
|
||||
template <typename RefT>
|
||||
class reference_content
|
||||
{
|
||||
private: // representation
|
||||
|
||||
RefT content_;
|
||||
|
||||
public: // structors
|
||||
|
||||
~reference_content()
|
||||
{
|
||||
}
|
||||
|
||||
reference_content(RefT r)
|
||||
: content_( r )
|
||||
{
|
||||
}
|
||||
|
||||
reference_content(const reference_content& operand)
|
||||
: content_( operand.content_ )
|
||||
{
|
||||
}
|
||||
|
||||
private: // non-Assignable
|
||||
|
||||
reference_content& operator=(const reference_content&);
|
||||
|
||||
public: // queries
|
||||
|
||||
RefT get() const
|
||||
{
|
||||
return content_;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// (detail) metafunction make_reference_content
|
||||
//
|
||||
// Wraps with reference_content if specified type is reference.
|
||||
//
|
||||
|
||||
template <typename T = mpl::void_> struct make_reference_content;
|
||||
|
||||
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
||||
|
||||
template <typename T>
|
||||
struct make_reference_content
|
||||
{
|
||||
typedef T type;
|
||||
};
|
||||
|
||||
template <typename T>
|
||||
struct make_reference_content< T& >
|
||||
{
|
||||
typedef reference_content<T&> type;
|
||||
};
|
||||
|
||||
#else // defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
||||
|
||||
template <typename T>
|
||||
struct make_reference_content
|
||||
: mpl::if_<
|
||||
is_reference<T>
|
||||
, reference_content<T>
|
||||
, T
|
||||
>
|
||||
{
|
||||
};
|
||||
|
||||
#endif // BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION workaround
|
||||
|
||||
template <>
|
||||
struct make_reference_content< mpl::void_ >
|
||||
{
|
||||
template <typename T>
|
||||
struct apply
|
||||
: make_reference_content<T>
|
||||
{
|
||||
};
|
||||
|
||||
typedef mpl::void_ type;
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// reference_content<T&> type traits specializations
|
||||
//
|
||||
|
||||
#if !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
||||
|
||||
template <typename T>
|
||||
struct has_nothrow_copy<
|
||||
::boost::detail::reference_content< T& >
|
||||
>
|
||||
: mpl::true_
|
||||
{
|
||||
};
|
||||
|
||||
#endif // !defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_DETAIL_REFERENCE_CONTENT_HPP
|
36
library/PolyVoxCore/include/boost/detail/select_type.hpp
Normal file
36
library/PolyVoxCore/include/boost/detail/select_type.hpp
Normal file
@ -0,0 +1,36 @@
|
||||
// (C) Copyright David Abrahams 2001.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org for most recent version including documentation.
|
||||
|
||||
// Revision History
|
||||
// 09 Feb 01 Applied John Maddock's Borland patch Moving <true>
|
||||
// specialization to unspecialized template (David Abrahams)
|
||||
// 06 Feb 01 Created (David Abrahams)
|
||||
|
||||
#ifndef SELECT_TYPE_DWA20010206_HPP
|
||||
# define SELECT_TYPE_DWA20010206_HPP
|
||||
|
||||
namespace boost { namespace detail {
|
||||
|
||||
// Template class if_true -- select among 2 types based on a bool constant expression
|
||||
// Usage:
|
||||
// typename if_true<(bool_const_expression)>::template then<true_type, false_type>::type
|
||||
|
||||
// HP aCC cannot deal with missing names for template value parameters
|
||||
template <bool b> struct if_true
|
||||
{
|
||||
template <class T, class F>
|
||||
struct then { typedef T type; };
|
||||
};
|
||||
|
||||
template <>
|
||||
struct if_true<false>
|
||||
{
|
||||
template <class T, class F>
|
||||
struct then { typedef F type; };
|
||||
};
|
||||
}}
|
||||
#endif // SELECT_TYPE_DWA20010206_HPP
|
151
library/PolyVoxCore/include/boost/detail/shared_array_nmt.hpp
Normal file
151
library/PolyVoxCore/include/boost/detail/shared_array_nmt.hpp
Normal file
@ -0,0 +1,151 @@
|
||||
#ifndef BOOST_DETAIL_SHARED_ARRAY_NMT_HPP_INCLUDED
|
||||
#define BOOST_DETAIL_SHARED_ARRAY_NMT_HPP_INCLUDED
|
||||
|
||||
//
|
||||
// detail/shared_array_nmt.hpp - shared_array.hpp without member templates
|
||||
//
|
||||
// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999.
|
||||
// Copyright (c) 2001, 2002 Peter Dimov
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/smart_ptr/shared_array.htm for documentation.
|
||||
//
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/checked_delete.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
#include <boost/detail/atomic_count.hpp>
|
||||
|
||||
#include <cstddef> // for std::ptrdiff_t
|
||||
#include <algorithm> // for std::swap
|
||||
#include <functional> // for std::less
|
||||
#include <new> // for std::bad_alloc
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
template<class T> class shared_array
|
||||
{
|
||||
private:
|
||||
|
||||
typedef detail::atomic_count count_type;
|
||||
|
||||
public:
|
||||
|
||||
typedef T element_type;
|
||||
|
||||
explicit shared_array(T * p = 0): px(p)
|
||||
{
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
|
||||
try // prevent leak if new throws
|
||||
{
|
||||
pn = new count_type(1);
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
boost::checked_array_delete(p);
|
||||
throw;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
pn = new count_type(1);
|
||||
|
||||
if(pn == 0)
|
||||
{
|
||||
boost::checked_array_delete(p);
|
||||
boost::throw_exception(std::bad_alloc());
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
~shared_array()
|
||||
{
|
||||
if(--*pn == 0)
|
||||
{
|
||||
boost::checked_array_delete(px);
|
||||
delete pn;
|
||||
}
|
||||
}
|
||||
|
||||
shared_array(shared_array const & r) : px(r.px) // never throws
|
||||
{
|
||||
pn = r.pn;
|
||||
++*pn;
|
||||
}
|
||||
|
||||
shared_array & operator=(shared_array const & r)
|
||||
{
|
||||
shared_array(r).swap(*this);
|
||||
return *this;
|
||||
}
|
||||
|
||||
void reset(T * p = 0)
|
||||
{
|
||||
BOOST_ASSERT(p == 0 || p != px);
|
||||
shared_array(p).swap(*this);
|
||||
}
|
||||
|
||||
T * get() const // never throws
|
||||
{
|
||||
return px;
|
||||
}
|
||||
|
||||
T & operator[](std::ptrdiff_t i) const // never throws
|
||||
{
|
||||
BOOST_ASSERT(px != 0);
|
||||
BOOST_ASSERT(i >= 0);
|
||||
return px[i];
|
||||
}
|
||||
|
||||
long use_count() const // never throws
|
||||
{
|
||||
return *pn;
|
||||
}
|
||||
|
||||
bool unique() const // never throws
|
||||
{
|
||||
return *pn == 1;
|
||||
}
|
||||
|
||||
void swap(shared_array<T> & other) // never throws
|
||||
{
|
||||
std::swap(px, other.px);
|
||||
std::swap(pn, other.pn);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
T * px; // contained pointer
|
||||
count_type * pn; // ptr to reference counter
|
||||
|
||||
}; // shared_array
|
||||
|
||||
template<class T, class U> inline bool operator==(shared_array<T> const & a, shared_array<U> const & b)
|
||||
{
|
||||
return a.get() == b.get();
|
||||
}
|
||||
|
||||
template<class T, class U> inline bool operator!=(shared_array<T> const & a, shared_array<U> const & b)
|
||||
{
|
||||
return a.get() != b.get();
|
||||
}
|
||||
|
||||
template<class T> inline bool operator<(shared_array<T> const & a, shared_array<T> const & b)
|
||||
{
|
||||
return std::less<T*>()(a.get(), b.get());
|
||||
}
|
||||
|
||||
template<class T> void swap(shared_array<T> & a, shared_array<T> & b)
|
||||
{
|
||||
a.swap(b);
|
||||
}
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // #ifndef BOOST_DETAIL_SHARED_ARRAY_NMT_HPP_INCLUDED
|
412
library/PolyVoxCore/include/boost/detail/shared_count.hpp
Normal file
412
library/PolyVoxCore/include/boost/detail/shared_count.hpp
Normal file
@ -0,0 +1,412 @@
|
||||
#ifndef BOOST_DETAIL_SHARED_COUNT_HPP_INCLUDED
|
||||
#define BOOST_DETAIL_SHARED_COUNT_HPP_INCLUDED
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
//
|
||||
// detail/shared_count.hpp
|
||||
//
|
||||
// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd.
|
||||
// Copyright 2004-2005 Peter Dimov
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
# pragma warn -8027 // Functions containing try are not expanded inline
|
||||
#endif
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/checked_delete.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
#include <boost/detail/bad_weak_ptr.hpp>
|
||||
#include <boost/detail/sp_counted_base.hpp>
|
||||
#include <boost/detail/sp_counted_impl.hpp>
|
||||
// In order to avoid circular dependencies with Boost.TR1
|
||||
// we make sure that our include of <memory> doesn't try to
|
||||
// pull in the TR1 headers: that's why we use this header
|
||||
// rather than including <memory> directly:
|
||||
#include <boost/config/no_tr1/memory.hpp> // std::auto_ptr
|
||||
#include <functional> // std::less
|
||||
#include <new> // std::bad_alloc
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
|
||||
|
||||
int const shared_count_id = 0x2C35F101;
|
||||
int const weak_count_id = 0x298C38A4;
|
||||
|
||||
#endif
|
||||
|
||||
struct sp_nothrow_tag {};
|
||||
|
||||
class weak_count;
|
||||
|
||||
class shared_count
|
||||
{
|
||||
private:
|
||||
|
||||
sp_counted_base * pi_;
|
||||
|
||||
#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
|
||||
int id_;
|
||||
#endif
|
||||
|
||||
friend class weak_count;
|
||||
|
||||
public:
|
||||
|
||||
shared_count(): pi_(0) // nothrow
|
||||
#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
|
||||
, id_(shared_count_id)
|
||||
#endif
|
||||
{
|
||||
}
|
||||
|
||||
template<class Y> explicit shared_count( Y * p ): pi_( 0 )
|
||||
#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
|
||||
, id_(shared_count_id)
|
||||
#endif
|
||||
{
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
|
||||
try
|
||||
{
|
||||
pi_ = new sp_counted_impl_p<Y>( p );
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
boost::checked_delete( p );
|
||||
throw;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
pi_ = new sp_counted_impl_p<Y>( p );
|
||||
|
||||
if( pi_ == 0 )
|
||||
{
|
||||
boost::checked_delete( p );
|
||||
boost::throw_exception( std::bad_alloc() );
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
#if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, <= 1200 )
|
||||
template<class Y, class D> shared_count( Y * p, D d ): pi_(0)
|
||||
#else
|
||||
template<class P, class D> shared_count( P p, D d ): pi_(0)
|
||||
#endif
|
||||
#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
|
||||
, id_(shared_count_id)
|
||||
#endif
|
||||
{
|
||||
#if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, <= 1200 )
|
||||
typedef Y* P;
|
||||
#endif
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
|
||||
try
|
||||
{
|
||||
pi_ = new sp_counted_impl_pd<P, D>(p, d);
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
d(p); // delete p
|
||||
throw;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
pi_ = new sp_counted_impl_pd<P, D>(p, d);
|
||||
|
||||
if(pi_ == 0)
|
||||
{
|
||||
d(p); // delete p
|
||||
boost::throw_exception(std::bad_alloc());
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
template<class P, class D, class A> shared_count( P p, D d, A a ): pi_( 0 )
|
||||
#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
|
||||
, id_(shared_count_id)
|
||||
#endif
|
||||
{
|
||||
typedef sp_counted_impl_pda<P, D, A> impl_type;
|
||||
typedef typename A::template rebind< impl_type >::other A2;
|
||||
|
||||
A2 a2( a );
|
||||
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
|
||||
try
|
||||
{
|
||||
pi_ = a2.allocate( 1, static_cast< impl_type* >( 0 ) );
|
||||
new( static_cast< void* >( pi_ ) ) impl_type( p, d, a );
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
d( p );
|
||||
|
||||
if( pi_ != 0 )
|
||||
{
|
||||
a2.deallocate( static_cast< impl_type* >( pi_ ), 1 );
|
||||
}
|
||||
|
||||
throw;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
pi_ = a2.allocate( 1, static_cast< impl_type* >( 0 ) );
|
||||
|
||||
if( pi_ != 0 )
|
||||
{
|
||||
new( static_cast< void* >( pi_ ) ) impl_type( p, d, a );
|
||||
}
|
||||
else
|
||||
{
|
||||
d( p );
|
||||
boost::throw_exception( std::bad_alloc() );
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_AUTO_PTR
|
||||
|
||||
// auto_ptr<Y> is special cased to provide the strong guarantee
|
||||
|
||||
template<class Y>
|
||||
explicit shared_count( std::auto_ptr<Y> & r ): pi_( new sp_counted_impl_p<Y>( r.get() ) )
|
||||
#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
|
||||
, id_(shared_count_id)
|
||||
#endif
|
||||
{
|
||||
#ifdef BOOST_NO_EXCEPTIONS
|
||||
|
||||
if( pi_ == 0 )
|
||||
{
|
||||
boost::throw_exception(std::bad_alloc());
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
r.release();
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
~shared_count() // nothrow
|
||||
{
|
||||
if( pi_ != 0 ) pi_->release();
|
||||
#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
|
||||
id_ = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
shared_count(shared_count const & r): pi_(r.pi_) // nothrow
|
||||
#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
|
||||
, id_(shared_count_id)
|
||||
#endif
|
||||
{
|
||||
if( pi_ != 0 ) pi_->add_ref_copy();
|
||||
}
|
||||
|
||||
explicit shared_count(weak_count const & r); // throws bad_weak_ptr when r.use_count() == 0
|
||||
shared_count( weak_count const & r, sp_nothrow_tag ); // constructs an empty *this when r.use_count() == 0
|
||||
|
||||
shared_count & operator= (shared_count const & r) // nothrow
|
||||
{
|
||||
sp_counted_base * tmp = r.pi_;
|
||||
|
||||
if( tmp != pi_ )
|
||||
{
|
||||
if( tmp != 0 ) tmp->add_ref_copy();
|
||||
if( pi_ != 0 ) pi_->release();
|
||||
pi_ = tmp;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
void swap(shared_count & r) // nothrow
|
||||
{
|
||||
sp_counted_base * tmp = r.pi_;
|
||||
r.pi_ = pi_;
|
||||
pi_ = tmp;
|
||||
}
|
||||
|
||||
long use_count() const // nothrow
|
||||
{
|
||||
return pi_ != 0? pi_->use_count(): 0;
|
||||
}
|
||||
|
||||
bool unique() const // nothrow
|
||||
{
|
||||
return use_count() == 1;
|
||||
}
|
||||
|
||||
bool empty() const // nothrow
|
||||
{
|
||||
return pi_ == 0;
|
||||
}
|
||||
|
||||
friend inline bool operator==(shared_count const & a, shared_count const & b)
|
||||
{
|
||||
return a.pi_ == b.pi_;
|
||||
}
|
||||
|
||||
friend inline bool operator<(shared_count const & a, shared_count const & b)
|
||||
{
|
||||
return std::less<sp_counted_base *>()( a.pi_, b.pi_ );
|
||||
}
|
||||
|
||||
void * get_deleter( sp_typeinfo const & ti ) const
|
||||
{
|
||||
return pi_? pi_->get_deleter( ti ): 0;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
class weak_count
|
||||
{
|
||||
private:
|
||||
|
||||
sp_counted_base * pi_;
|
||||
|
||||
#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
|
||||
int id_;
|
||||
#endif
|
||||
|
||||
friend class shared_count;
|
||||
|
||||
public:
|
||||
|
||||
weak_count(): pi_(0) // nothrow
|
||||
#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
|
||||
, id_(weak_count_id)
|
||||
#endif
|
||||
{
|
||||
}
|
||||
|
||||
weak_count(shared_count const & r): pi_(r.pi_) // nothrow
|
||||
#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
|
||||
, id_(shared_count_id)
|
||||
#endif
|
||||
{
|
||||
if(pi_ != 0) pi_->weak_add_ref();
|
||||
}
|
||||
|
||||
weak_count(weak_count const & r): pi_(r.pi_) // nothrow
|
||||
#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
|
||||
, id_(shared_count_id)
|
||||
#endif
|
||||
{
|
||||
if(pi_ != 0) pi_->weak_add_ref();
|
||||
}
|
||||
|
||||
~weak_count() // nothrow
|
||||
{
|
||||
if(pi_ != 0) pi_->weak_release();
|
||||
#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
|
||||
id_ = 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
weak_count & operator= (shared_count const & r) // nothrow
|
||||
{
|
||||
sp_counted_base * tmp = r.pi_;
|
||||
|
||||
if( tmp != pi_ )
|
||||
{
|
||||
if(tmp != 0) tmp->weak_add_ref();
|
||||
if(pi_ != 0) pi_->weak_release();
|
||||
pi_ = tmp;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
weak_count & operator= (weak_count const & r) // nothrow
|
||||
{
|
||||
sp_counted_base * tmp = r.pi_;
|
||||
|
||||
if( tmp != pi_ )
|
||||
{
|
||||
if(tmp != 0) tmp->weak_add_ref();
|
||||
if(pi_ != 0) pi_->weak_release();
|
||||
pi_ = tmp;
|
||||
}
|
||||
|
||||
return *this;
|
||||
}
|
||||
|
||||
void swap(weak_count & r) // nothrow
|
||||
{
|
||||
sp_counted_base * tmp = r.pi_;
|
||||
r.pi_ = pi_;
|
||||
pi_ = tmp;
|
||||
}
|
||||
|
||||
long use_count() const // nothrow
|
||||
{
|
||||
return pi_ != 0? pi_->use_count(): 0;
|
||||
}
|
||||
|
||||
friend inline bool operator==(weak_count const & a, weak_count const & b)
|
||||
{
|
||||
return a.pi_ == b.pi_;
|
||||
}
|
||||
|
||||
friend inline bool operator<(weak_count const & a, weak_count const & b)
|
||||
{
|
||||
return std::less<sp_counted_base *>()(a.pi_, b.pi_);
|
||||
}
|
||||
};
|
||||
|
||||
inline shared_count::shared_count( weak_count const & r ): pi_( r.pi_ )
|
||||
#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
|
||||
, id_(shared_count_id)
|
||||
#endif
|
||||
{
|
||||
if( pi_ == 0 || !pi_->add_ref_lock() )
|
||||
{
|
||||
boost::throw_exception( boost::bad_weak_ptr() );
|
||||
}
|
||||
}
|
||||
|
||||
inline shared_count::shared_count( weak_count const & r, sp_nothrow_tag ): pi_( r.pi_ )
|
||||
#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
|
||||
, id_(shared_count_id)
|
||||
#endif
|
||||
{
|
||||
if( pi_ != 0 && !pi_->add_ref_lock() )
|
||||
{
|
||||
pi_ = 0;
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#ifdef __BORLANDC__
|
||||
# pragma warn .8027 // Functions containing try are not expanded inline
|
||||
#endif
|
||||
|
||||
#endif // #ifndef BOOST_DETAIL_SHARED_COUNT_HPP_INCLUDED
|
182
library/PolyVoxCore/include/boost/detail/shared_ptr_nmt.hpp
Normal file
182
library/PolyVoxCore/include/boost/detail/shared_ptr_nmt.hpp
Normal file
@ -0,0 +1,182 @@
|
||||
#ifndef BOOST_DETAIL_SHARED_PTR_NMT_HPP_INCLUDED
|
||||
#define BOOST_DETAIL_SHARED_PTR_NMT_HPP_INCLUDED
|
||||
|
||||
//
|
||||
// detail/shared_ptr_nmt.hpp - shared_ptr.hpp without member templates
|
||||
//
|
||||
// (C) Copyright Greg Colvin and Beman Dawes 1998, 1999.
|
||||
// Copyright (c) 2001, 2002 Peter Dimov
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// See http://www.boost.org/libs/smart_ptr/shared_ptr.htm for documentation.
|
||||
//
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
#include <boost/checked_delete.hpp>
|
||||
#include <boost/throw_exception.hpp>
|
||||
#include <boost/detail/atomic_count.hpp>
|
||||
|
||||
#ifndef BOOST_NO_AUTO_PTR
|
||||
# include <memory> // for std::auto_ptr
|
||||
#endif
|
||||
|
||||
#include <algorithm> // for std::swap
|
||||
#include <functional> // for std::less
|
||||
#include <new> // for std::bad_alloc
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
template<class T> class shared_ptr
|
||||
{
|
||||
private:
|
||||
|
||||
typedef detail::atomic_count count_type;
|
||||
|
||||
public:
|
||||
|
||||
typedef T element_type;
|
||||
typedef T value_type;
|
||||
|
||||
explicit shared_ptr(T * p = 0): px(p)
|
||||
{
|
||||
#ifndef BOOST_NO_EXCEPTIONS
|
||||
|
||||
try // prevent leak if new throws
|
||||
{
|
||||
pn = new count_type(1);
|
||||
}
|
||||
catch(...)
|
||||
{
|
||||
boost::checked_delete(p);
|
||||
throw;
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
pn = new count_type(1);
|
||||
|
||||
if(pn == 0)
|
||||
{
|
||||
boost::checked_delete(p);
|
||||
boost::throw_exception(std::bad_alloc());
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
~shared_ptr()
|
||||
{
|
||||
if(--*pn == 0)
|
||||
{
|
||||
boost::checked_delete(px);
|
||||
delete pn;
|
||||
}
|
||||
}
|
||||
|
||||
shared_ptr(shared_ptr const & r): px(r.px) // never throws
|
||||
{
|
||||
pn = r.pn;
|
||||
++*pn;
|
||||
}
|
||||
|
||||
shared_ptr & operator=(shared_ptr const & r)
|
||||
{
|
||||
shared_ptr(r).swap(*this);
|
||||
return *this;
|
||||
}
|
||||
|
||||
#ifndef BOOST_NO_AUTO_PTR
|
||||
|
||||
explicit shared_ptr(std::auto_ptr<T> & r)
|
||||
{
|
||||
pn = new count_type(1); // may throw
|
||||
px = r.release(); // fix: moved here to stop leak if new throws
|
||||
}
|
||||
|
||||
shared_ptr & operator=(std::auto_ptr<T> & r)
|
||||
{
|
||||
shared_ptr(r).swap(*this);
|
||||
return *this;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void reset(T * p = 0)
|
||||
{
|
||||
BOOST_ASSERT(p == 0 || p != px);
|
||||
shared_ptr(p).swap(*this);
|
||||
}
|
||||
|
||||
T & operator*() const // never throws
|
||||
{
|
||||
BOOST_ASSERT(px != 0);
|
||||
return *px;
|
||||
}
|
||||
|
||||
T * operator->() const // never throws
|
||||
{
|
||||
BOOST_ASSERT(px != 0);
|
||||
return px;
|
||||
}
|
||||
|
||||
T * get() const // never throws
|
||||
{
|
||||
return px;
|
||||
}
|
||||
|
||||
long use_count() const // never throws
|
||||
{
|
||||
return *pn;
|
||||
}
|
||||
|
||||
bool unique() const // never throws
|
||||
{
|
||||
return *pn == 1;
|
||||
}
|
||||
|
||||
void swap(shared_ptr<T> & other) // never throws
|
||||
{
|
||||
std::swap(px, other.px);
|
||||
std::swap(pn, other.pn);
|
||||
}
|
||||
|
||||
private:
|
||||
|
||||
T * px; // contained pointer
|
||||
count_type * pn; // ptr to reference counter
|
||||
};
|
||||
|
||||
template<class T, class U> inline bool operator==(shared_ptr<T> const & a, shared_ptr<U> const & b)
|
||||
{
|
||||
return a.get() == b.get();
|
||||
}
|
||||
|
||||
template<class T, class U> inline bool operator!=(shared_ptr<T> const & a, shared_ptr<U> const & b)
|
||||
{
|
||||
return a.get() != b.get();
|
||||
}
|
||||
|
||||
template<class T> inline bool operator<(shared_ptr<T> const & a, shared_ptr<T> const & b)
|
||||
{
|
||||
return std::less<T*>()(a.get(), b.get());
|
||||
}
|
||||
|
||||
template<class T> void swap(shared_ptr<T> & a, shared_ptr<T> & b)
|
||||
{
|
||||
a.swap(b);
|
||||
}
|
||||
|
||||
// get_pointer() enables boost::mem_fn to recognize shared_ptr
|
||||
|
||||
template<class T> inline T * get_pointer(shared_ptr<T> const & p)
|
||||
{
|
||||
return p.get();
|
||||
}
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // #ifndef BOOST_DETAIL_SHARED_PTR_NMT_HPP_INCLUDED
|
76
library/PolyVoxCore/include/boost/detail/sp_convertible.hpp
Normal file
76
library/PolyVoxCore/include/boost/detail/sp_convertible.hpp
Normal file
@ -0,0 +1,76 @@
|
||||
#ifndef BOOST_DETAIL_SP_CONVERTIBLE_HPP_INCLUDED
|
||||
#define BOOST_DETAIL_SP_CONVERTIBLE_HPP_INCLUDED
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
// detail/sp_convertible.hpp
|
||||
//
|
||||
// Copyright 2008 Peter Dimov
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) && defined( BOOST_NO_SFINAE )
|
||||
# define BOOST_SP_NO_SP_CONVERTIBLE
|
||||
#endif
|
||||
|
||||
#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) && defined( __GNUC__ ) && ( __GNUC__ * 100 + __GNUC_MINOR__ < 303 )
|
||||
# define BOOST_SP_NO_SP_CONVERTIBLE
|
||||
#endif
|
||||
|
||||
#if !defined( BOOST_SP_NO_SP_CONVERTIBLE ) && defined( __BORLANDC__ ) && ( __BORLANDC__ <= 0x610 )
|
||||
# define BOOST_SP_NO_SP_CONVERTIBLE
|
||||
#endif
|
||||
|
||||
#if !defined( BOOST_SP_NO_SP_CONVERTIBLE )
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template< class Y, class T > struct sp_convertible
|
||||
{
|
||||
typedef char (&yes) [1];
|
||||
typedef char (&no) [2];
|
||||
|
||||
static yes f( T* );
|
||||
static no f( ... );
|
||||
|
||||
enum _vt { value = sizeof( f( (Y*)0 ) ) == sizeof(yes) };
|
||||
};
|
||||
|
||||
struct sp_empty
|
||||
{
|
||||
};
|
||||
|
||||
template< bool > struct sp_enable_if_convertible_impl;
|
||||
|
||||
template<> struct sp_enable_if_convertible_impl<true>
|
||||
{
|
||||
typedef sp_empty type;
|
||||
};
|
||||
|
||||
template<> struct sp_enable_if_convertible_impl<false>
|
||||
{
|
||||
};
|
||||
|
||||
template< class Y, class T > struct sp_enable_if_convertible: public sp_enable_if_convertible_impl< sp_convertible< Y, T >::value >
|
||||
{
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // !defined( BOOST_SP_NO_SP_CONVERTIBLE )
|
||||
|
||||
#endif // #ifndef BOOST_DETAIL_SP_TYPEINFO_HPP_INCLUDED
|
66
library/PolyVoxCore/include/boost/detail/sp_counted_base.hpp
Normal file
66
library/PolyVoxCore/include/boost/detail/sp_counted_base.hpp
Normal file
@ -0,0 +1,66 @@
|
||||
#ifndef BOOST_DETAIL_SP_COUNTED_BASE_HPP_INCLUDED
|
||||
#define BOOST_DETAIL_SP_COUNTED_BASE_HPP_INCLUDED
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
//
|
||||
// detail/sp_counted_base.hpp
|
||||
//
|
||||
// Copyright 2005, 2006 Peter Dimov
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#if defined( BOOST_SP_DISABLE_THREADS )
|
||||
# include <boost/detail/sp_counted_base_nt.hpp>
|
||||
|
||||
#elif defined( BOOST_SP_USE_SPINLOCK )
|
||||
# include <boost/detail/sp_counted_base_spin.hpp>
|
||||
|
||||
#elif defined( BOOST_SP_USE_PTHREADS )
|
||||
# include <boost/detail/sp_counted_base_pt.hpp>
|
||||
|
||||
#elif defined( BOOST_DISABLE_THREADS ) && !defined( BOOST_SP_ENABLE_THREADS ) && !defined( BOOST_DISABLE_WIN32 )
|
||||
# include <boost/detail/sp_counted_base_nt.hpp>
|
||||
|
||||
#elif defined( __GNUC__ ) && ( defined( __i386__ ) || defined( __x86_64__ ) )
|
||||
# include <boost/detail/sp_counted_base_gcc_x86.hpp>
|
||||
|
||||
#elif defined( __GNUC__ ) && defined( __ia64__ ) && !defined( __INTEL_COMPILER )
|
||||
# include <boost/detail/sp_counted_base_gcc_ia64.hpp>
|
||||
|
||||
#elif defined(__HP_aCC) && defined(__ia64)
|
||||
# include <boost/detail/sp_counted_base_acc_ia64.hpp>
|
||||
|
||||
#elif defined( __MWERKS__ ) && defined( __POWERPC__ )
|
||||
# include <boost/detail/sp_counted_base_cw_ppc.hpp>
|
||||
|
||||
#elif defined( __GNUC__ ) && ( defined( __powerpc__ ) || defined( __ppc__ ) || defined( __ppc ) )
|
||||
# include <boost/detail/sp_counted_base_gcc_ppc.hpp>
|
||||
|
||||
#elif defined(__GNUC__) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 401 ) && !defined( __arm__ ) && !defined( __hppa ) && ( !defined( __INTEL_COMPILER ) || defined( __ia64__ ) )
|
||||
# include <boost/detail/sp_counted_base_sync.hpp>
|
||||
|
||||
#elif defined(__GNUC__) && ( defined( __sparcv9 ) || ( defined( __sparcv8 ) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 402 ) ) )
|
||||
# include <boost/detail/sp_counted_base_gcc_sparc.hpp>
|
||||
|
||||
#elif defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ )
|
||||
# include <boost/detail/sp_counted_base_w32.hpp>
|
||||
|
||||
#elif !defined( BOOST_HAS_THREADS )
|
||||
# include <boost/detail/sp_counted_base_nt.hpp>
|
||||
|
||||
#else
|
||||
# include <boost/detail/sp_counted_base_spin.hpp>
|
||||
|
||||
#endif
|
||||
|
||||
#endif // #ifndef BOOST_DETAIL_SP_COUNTED_BASE_HPP_INCLUDED
|
@ -0,0 +1,150 @@
|
||||
#ifndef BOOST_DETAIL_SP_COUNTED_BASE_ACC_IA64_HPP_INCLUDED
|
||||
#define BOOST_DETAIL_SP_COUNTED_BASE_ACC_IA64_HPP_INCLUDED
|
||||
|
||||
//
|
||||
// detail/sp_counted_base_acc_ia64.hpp - aC++ on HP-UX IA64
|
||||
//
|
||||
// Copyright 2007 Baruch Zilber
|
||||
// Copyright 2007 Boris Gubenko
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
//
|
||||
// Lock-free algorithm by Alexander Terekhov
|
||||
//
|
||||
|
||||
#include <boost/detail/sp_typeinfo.hpp>
|
||||
#include <machine/sys/inline.h>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
inline void atomic_increment( int * pw )
|
||||
{
|
||||
// ++*pw;
|
||||
|
||||
_Asm_fetchadd(_FASZ_W, _SEM_REL, pw, +1, _LDHINT_NONE);
|
||||
}
|
||||
|
||||
inline int atomic_decrement( int * pw )
|
||||
{
|
||||
// return --*pw;
|
||||
|
||||
int r = static_cast<int>(_Asm_fetchadd(_FASZ_W, _SEM_REL, pw, -1, _LDHINT_NONE));
|
||||
if (1 == r)
|
||||
{
|
||||
_Asm_mf();
|
||||
}
|
||||
|
||||
return r - 1;
|
||||
}
|
||||
|
||||
inline int atomic_conditional_increment( int * pw )
|
||||
{
|
||||
// if( *pw != 0 ) ++*pw;
|
||||
// return *pw;
|
||||
|
||||
int v = *pw;
|
||||
|
||||
for (;;)
|
||||
{
|
||||
if (0 == v)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
_Asm_mov_to_ar(_AREG_CCV,
|
||||
v,
|
||||
(_UP_CALL_FENCE | _UP_SYS_FENCE | _DOWN_CALL_FENCE | _DOWN_SYS_FENCE));
|
||||
int r = static_cast<int>(_Asm_cmpxchg(_SZ_W, _SEM_ACQ, pw, v + 1, _LDHINT_NONE));
|
||||
if (r == v)
|
||||
{
|
||||
return r + 1;
|
||||
}
|
||||
|
||||
v = r;
|
||||
}
|
||||
}
|
||||
|
||||
class sp_counted_base
|
||||
{
|
||||
private:
|
||||
|
||||
sp_counted_base( sp_counted_base const & );
|
||||
sp_counted_base & operator= ( sp_counted_base const & );
|
||||
|
||||
int use_count_; // #shared
|
||||
int weak_count_; // #weak + (#shared != 0)
|
||||
|
||||
public:
|
||||
|
||||
sp_counted_base(): use_count_( 1 ), weak_count_( 1 )
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~sp_counted_base() // nothrow
|
||||
{
|
||||
}
|
||||
|
||||
// dispose() is called when use_count_ drops to zero, to release
|
||||
// the resources managed by *this.
|
||||
|
||||
virtual void dispose() = 0; // nothrow
|
||||
|
||||
// destroy() is called when weak_count_ drops to zero.
|
||||
|
||||
virtual void destroy() // nothrow
|
||||
{
|
||||
delete this;
|
||||
}
|
||||
|
||||
virtual void * get_deleter( sp_typeinfo const & ti ) = 0;
|
||||
|
||||
void add_ref_copy()
|
||||
{
|
||||
atomic_increment( &use_count_ );
|
||||
}
|
||||
|
||||
bool add_ref_lock() // true on success
|
||||
{
|
||||
return atomic_conditional_increment( &use_count_ ) != 0;
|
||||
}
|
||||
|
||||
void release() // nothrow
|
||||
{
|
||||
if( atomic_decrement( &use_count_ ) == 0 )
|
||||
{
|
||||
dispose();
|
||||
weak_release();
|
||||
}
|
||||
}
|
||||
|
||||
void weak_add_ref() // nothrow
|
||||
{
|
||||
atomic_increment( &weak_count_ );
|
||||
}
|
||||
|
||||
void weak_release() // nothrow
|
||||
{
|
||||
if( atomic_decrement( &weak_count_ ) == 0 )
|
||||
{
|
||||
destroy();
|
||||
}
|
||||
}
|
||||
|
||||
long use_count() const // nothrow
|
||||
{
|
||||
return static_cast<int const volatile &>( use_count_ ); // TODO use ld.acq here
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // #ifndef BOOST_DETAIL_SP_COUNTED_BASE_ACC_IA64_HPP_INCLUDED
|
@ -0,0 +1,170 @@
|
||||
#ifndef BOOST_DETAIL_SP_COUNTED_BASE_CW_PPC_HPP_INCLUDED
|
||||
#define BOOST_DETAIL_SP_COUNTED_BASE_CW_PPC_HPP_INCLUDED
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
//
|
||||
// detail/sp_counted_base_cw_ppc.hpp - CodeWarrior on PowerPC
|
||||
//
|
||||
// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd.
|
||||
// Copyright 2004-2005 Peter Dimov
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
//
|
||||
// Lock-free algorithm by Alexander Terekhov
|
||||
//
|
||||
// Thanks to Ben Hitchings for the #weak + (#shared != 0)
|
||||
// formulation
|
||||
//
|
||||
|
||||
#include <boost/detail/sp_typeinfo.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
inline void atomic_increment( register long * pw )
|
||||
{
|
||||
register int a;
|
||||
|
||||
asm
|
||||
{
|
||||
loop:
|
||||
|
||||
lwarx a, 0, pw
|
||||
addi a, a, 1
|
||||
stwcx. a, 0, pw
|
||||
bne- loop
|
||||
}
|
||||
}
|
||||
|
||||
inline long atomic_decrement( register long * pw )
|
||||
{
|
||||
register int a;
|
||||
|
||||
asm
|
||||
{
|
||||
sync
|
||||
|
||||
loop:
|
||||
|
||||
lwarx a, 0, pw
|
||||
addi a, a, -1
|
||||
stwcx. a, 0, pw
|
||||
bne- loop
|
||||
|
||||
isync
|
||||
}
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
inline long atomic_conditional_increment( register long * pw )
|
||||
{
|
||||
register int a;
|
||||
|
||||
asm
|
||||
{
|
||||
loop:
|
||||
|
||||
lwarx a, 0, pw
|
||||
cmpwi a, 0
|
||||
beq store
|
||||
|
||||
addi a, a, 1
|
||||
|
||||
store:
|
||||
|
||||
stwcx. a, 0, pw
|
||||
bne- loop
|
||||
}
|
||||
|
||||
return a;
|
||||
}
|
||||
|
||||
class sp_counted_base
|
||||
{
|
||||
private:
|
||||
|
||||
sp_counted_base( sp_counted_base const & );
|
||||
sp_counted_base & operator= ( sp_counted_base const & );
|
||||
|
||||
long use_count_; // #shared
|
||||
long weak_count_; // #weak + (#shared != 0)
|
||||
|
||||
public:
|
||||
|
||||
sp_counted_base(): use_count_( 1 ), weak_count_( 1 )
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~sp_counted_base() // nothrow
|
||||
{
|
||||
}
|
||||
|
||||
// dispose() is called when use_count_ drops to zero, to release
|
||||
// the resources managed by *this.
|
||||
|
||||
virtual void dispose() = 0; // nothrow
|
||||
|
||||
// destroy() is called when weak_count_ drops to zero.
|
||||
|
||||
virtual void destroy() // nothrow
|
||||
{
|
||||
delete this;
|
||||
}
|
||||
|
||||
virtual void * get_deleter( sp_typeinfo const & ti ) = 0;
|
||||
|
||||
void add_ref_copy()
|
||||
{
|
||||
atomic_increment( &use_count_ );
|
||||
}
|
||||
|
||||
bool add_ref_lock() // true on success
|
||||
{
|
||||
return atomic_conditional_increment( &use_count_ ) != 0;
|
||||
}
|
||||
|
||||
void release() // nothrow
|
||||
{
|
||||
if( atomic_decrement( &use_count_ ) == 0 )
|
||||
{
|
||||
dispose();
|
||||
weak_release();
|
||||
}
|
||||
}
|
||||
|
||||
void weak_add_ref() // nothrow
|
||||
{
|
||||
atomic_increment( &weak_count_ );
|
||||
}
|
||||
|
||||
void weak_release() // nothrow
|
||||
{
|
||||
if( atomic_decrement( &weak_count_ ) == 0 )
|
||||
{
|
||||
destroy();
|
||||
}
|
||||
}
|
||||
|
||||
long use_count() const // nothrow
|
||||
{
|
||||
return static_cast<long const volatile &>( use_count_ );
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // #ifndef BOOST_DETAIL_SP_COUNTED_BASE_CW_PPC_HPP_INCLUDED
|
@ -0,0 +1,158 @@
|
||||
#ifndef BOOST_DETAIL_SP_COUNTED_BASE_CW_X86_HPP_INCLUDED
|
||||
#define BOOST_DETAIL_SP_COUNTED_BASE_CW_X86_HPP_INCLUDED
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
//
|
||||
// detail/sp_counted_base_cw_x86.hpp - CodeWarrion on 486+
|
||||
//
|
||||
// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd.
|
||||
// Copyright 2004-2005 Peter Dimov
|
||||
// Copyright 2005 Rene Rivera
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
//
|
||||
// Lock-free algorithm by Alexander Terekhov
|
||||
//
|
||||
// Thanks to Ben Hitchings for the #weak + (#shared != 0)
|
||||
// formulation
|
||||
//
|
||||
|
||||
#include <boost/detail/sp_typeinfo.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
inline int atomic_exchange_and_add( int * pw, int dv )
|
||||
{
|
||||
// int r = *pw;
|
||||
// *pw += dv;
|
||||
// return r;
|
||||
|
||||
asm
|
||||
{
|
||||
mov esi, [pw]
|
||||
mov eax, dv
|
||||
lock xadd dword ptr [esi], eax
|
||||
}
|
||||
}
|
||||
|
||||
inline void atomic_increment( int * pw )
|
||||
{
|
||||
//atomic_exchange_and_add( pw, 1 );
|
||||
|
||||
asm
|
||||
{
|
||||
mov esi, [pw]
|
||||
lock inc dword ptr [esi]
|
||||
}
|
||||
}
|
||||
|
||||
inline int atomic_conditional_increment( int * pw )
|
||||
{
|
||||
// int rv = *pw;
|
||||
// if( rv != 0 ) ++*pw;
|
||||
// return rv;
|
||||
|
||||
asm
|
||||
{
|
||||
mov esi, [pw]
|
||||
mov eax, dword ptr [esi]
|
||||
L0:
|
||||
test eax, eax
|
||||
je L1
|
||||
mov ebx, eax
|
||||
inc ebx
|
||||
lock cmpxchg dword ptr [esi], ebx
|
||||
jne L0
|
||||
L1:
|
||||
}
|
||||
}
|
||||
|
||||
class sp_counted_base
|
||||
{
|
||||
private:
|
||||
|
||||
sp_counted_base( sp_counted_base const & );
|
||||
sp_counted_base & operator= ( sp_counted_base const & );
|
||||
|
||||
int use_count_; // #shared
|
||||
int weak_count_; // #weak + (#shared != 0)
|
||||
|
||||
public:
|
||||
|
||||
sp_counted_base(): use_count_( 1 ), weak_count_( 1 )
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~sp_counted_base() // nothrow
|
||||
{
|
||||
}
|
||||
|
||||
// dispose() is called when use_count_ drops to zero, to release
|
||||
// the resources managed by *this.
|
||||
|
||||
virtual void dispose() = 0; // nothrow
|
||||
|
||||
// destroy() is called when weak_count_ drops to zero.
|
||||
|
||||
virtual void destroy() // nothrow
|
||||
{
|
||||
delete this;
|
||||
}
|
||||
|
||||
virtual void * get_deleter( sp_typeinfo const & ti ) = 0;
|
||||
|
||||
void add_ref_copy()
|
||||
{
|
||||
atomic_increment( &use_count_ );
|
||||
}
|
||||
|
||||
bool add_ref_lock() // true on success
|
||||
{
|
||||
return atomic_conditional_increment( &use_count_ ) != 0;
|
||||
}
|
||||
|
||||
void release() // nothrow
|
||||
{
|
||||
if( atomic_exchange_and_add( &use_count_, -1 ) == 1 )
|
||||
{
|
||||
dispose();
|
||||
weak_release();
|
||||
}
|
||||
}
|
||||
|
||||
void weak_add_ref() // nothrow
|
||||
{
|
||||
atomic_increment( &weak_count_ );
|
||||
}
|
||||
|
||||
void weak_release() // nothrow
|
||||
{
|
||||
if( atomic_exchange_and_add( &weak_count_, -1 ) == 1 )
|
||||
{
|
||||
destroy();
|
||||
}
|
||||
}
|
||||
|
||||
long use_count() const // nothrow
|
||||
{
|
||||
return static_cast<int const volatile &>( use_count_ );
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // #ifndef BOOST_DETAIL_SP_COUNTED_BASE_GCC_X86_HPP_INCLUDED
|
@ -0,0 +1,157 @@
|
||||
#ifndef BOOST_DETAIL_SP_COUNTED_BASE_GCC_IA64_HPP_INCLUDED
|
||||
#define BOOST_DETAIL_SP_COUNTED_BASE_GCC_IA64_HPP_INCLUDED
|
||||
|
||||
//
|
||||
// detail/sp_counted_base_gcc_ia64.hpp - g++ on IA64
|
||||
//
|
||||
// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd.
|
||||
// Copyright 2004-2006 Peter Dimov
|
||||
// Copyright 2005 Ben Hutchings
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
//
|
||||
// Lock-free algorithm by Alexander Terekhov
|
||||
//
|
||||
|
||||
#include <boost/detail/sp_typeinfo.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
inline void atomic_increment( int * pw )
|
||||
{
|
||||
// ++*pw;
|
||||
|
||||
int tmp;
|
||||
|
||||
// No barrier is required here but fetchadd always has an acquire or
|
||||
// release barrier associated with it. We choose release as it should be
|
||||
// cheaper.
|
||||
__asm__ ("fetchadd4.rel %0=%1,1" :
|
||||
"=r"(tmp), "=m"(*pw) :
|
||||
"m"( *pw ));
|
||||
}
|
||||
|
||||
inline int atomic_decrement( int * pw )
|
||||
{
|
||||
// return --*pw;
|
||||
|
||||
int rv;
|
||||
|
||||
__asm__ (" fetchadd4.rel %0=%1,-1 ;; \n"
|
||||
" cmp.eq p7,p0=1,%0 ;; \n"
|
||||
"(p7) ld4.acq %0=%1 " :
|
||||
"=&r"(rv), "=m"(*pw) :
|
||||
"m"( *pw ) :
|
||||
"p7");
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
inline int atomic_conditional_increment( int * pw )
|
||||
{
|
||||
// if( *pw != 0 ) ++*pw;
|
||||
// return *pw;
|
||||
|
||||
int rv, tmp, tmp2;
|
||||
|
||||
__asm__ ("0: ld4 %0=%3 ;; \n"
|
||||
" cmp.eq p7,p0=0,%0 ;; \n"
|
||||
"(p7) br.cond.spnt 1f \n"
|
||||
" mov ar.ccv=%0 \n"
|
||||
" add %1=1,%0 ;; \n"
|
||||
" cmpxchg4.acq %2=%3,%1,ar.ccv ;; \n"
|
||||
" cmp.ne p7,p0=%0,%2 ;; \n"
|
||||
"(p7) br.cond.spnt 0b \n"
|
||||
" mov %0=%1 ;; \n"
|
||||
"1:" :
|
||||
"=&r"(rv), "=&r"(tmp), "=&r"(tmp2), "=m"(*pw) :
|
||||
"m"( *pw ) :
|
||||
"ar.ccv", "p7");
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
class sp_counted_base
|
||||
{
|
||||
private:
|
||||
|
||||
sp_counted_base( sp_counted_base const & );
|
||||
sp_counted_base & operator= ( sp_counted_base const & );
|
||||
|
||||
int use_count_; // #shared
|
||||
int weak_count_; // #weak + (#shared != 0)
|
||||
|
||||
public:
|
||||
|
||||
sp_counted_base(): use_count_( 1 ), weak_count_( 1 )
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~sp_counted_base() // nothrow
|
||||
{
|
||||
}
|
||||
|
||||
// dispose() is called when use_count_ drops to zero, to release
|
||||
// the resources managed by *this.
|
||||
|
||||
virtual void dispose() = 0; // nothrow
|
||||
|
||||
// destroy() is called when weak_count_ drops to zero.
|
||||
|
||||
virtual void destroy() // nothrow
|
||||
{
|
||||
delete this;
|
||||
}
|
||||
|
||||
virtual void * get_deleter( sp_typeinfo const & ti ) = 0;
|
||||
|
||||
void add_ref_copy()
|
||||
{
|
||||
atomic_increment( &use_count_ );
|
||||
}
|
||||
|
||||
bool add_ref_lock() // true on success
|
||||
{
|
||||
return atomic_conditional_increment( &use_count_ ) != 0;
|
||||
}
|
||||
|
||||
void release() // nothrow
|
||||
{
|
||||
if( atomic_decrement( &use_count_ ) == 0 )
|
||||
{
|
||||
dispose();
|
||||
weak_release();
|
||||
}
|
||||
}
|
||||
|
||||
void weak_add_ref() // nothrow
|
||||
{
|
||||
atomic_increment( &weak_count_ );
|
||||
}
|
||||
|
||||
void weak_release() // nothrow
|
||||
{
|
||||
if( atomic_decrement( &weak_count_ ) == 0 )
|
||||
{
|
||||
destroy();
|
||||
}
|
||||
}
|
||||
|
||||
long use_count() const // nothrow
|
||||
{
|
||||
return static_cast<int const volatile &>( use_count_ ); // TODO use ld.acq here
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // #ifndef BOOST_DETAIL_SP_COUNTED_BASE_GCC_IA64_HPP_INCLUDED
|
@ -0,0 +1,181 @@
|
||||
#ifndef BOOST_DETAIL_SP_COUNTED_BASE_GCC_PPC_HPP_INCLUDED
|
||||
#define BOOST_DETAIL_SP_COUNTED_BASE_GCC_PPC_HPP_INCLUDED
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
//
|
||||
// detail/sp_counted_base_gcc_ppc.hpp - g++ on PowerPC
|
||||
//
|
||||
// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd.
|
||||
// Copyright 2004-2005 Peter Dimov
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
//
|
||||
// Lock-free algorithm by Alexander Terekhov
|
||||
//
|
||||
// Thanks to Ben Hitchings for the #weak + (#shared != 0)
|
||||
// formulation
|
||||
//
|
||||
|
||||
#include <boost/detail/sp_typeinfo.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
inline void atomic_increment( int * pw )
|
||||
{
|
||||
// ++*pw;
|
||||
|
||||
int tmp;
|
||||
|
||||
__asm__
|
||||
(
|
||||
"0:\n\t"
|
||||
"lwarx %1, 0, %2\n\t"
|
||||
"addi %1, %1, 1\n\t"
|
||||
"stwcx. %1, 0, %2\n\t"
|
||||
"bne- 0b":
|
||||
|
||||
"=m"( *pw ), "=&b"( tmp ):
|
||||
"r"( pw ), "m"( *pw ):
|
||||
"cc"
|
||||
);
|
||||
}
|
||||
|
||||
inline int atomic_decrement( int * pw )
|
||||
{
|
||||
// return --*pw;
|
||||
|
||||
int rv;
|
||||
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"sync\n\t"
|
||||
"0:\n\t"
|
||||
"lwarx %1, 0, %2\n\t"
|
||||
"addi %1, %1, -1\n\t"
|
||||
"stwcx. %1, 0, %2\n\t"
|
||||
"bne- 0b\n\t"
|
||||
"isync":
|
||||
|
||||
"=m"( *pw ), "=&b"( rv ):
|
||||
"r"( pw ), "m"( *pw ):
|
||||
"memory", "cc"
|
||||
);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
inline int atomic_conditional_increment( int * pw )
|
||||
{
|
||||
// if( *pw != 0 ) ++*pw;
|
||||
// return *pw;
|
||||
|
||||
int rv;
|
||||
|
||||
__asm__
|
||||
(
|
||||
"0:\n\t"
|
||||
"lwarx %1, 0, %2\n\t"
|
||||
"cmpwi %1, 0\n\t"
|
||||
"beq 1f\n\t"
|
||||
"addi %1, %1, 1\n\t"
|
||||
"1:\n\t"
|
||||
"stwcx. %1, 0, %2\n\t"
|
||||
"bne- 0b":
|
||||
|
||||
"=m"( *pw ), "=&b"( rv ):
|
||||
"r"( pw ), "m"( *pw ):
|
||||
"cc"
|
||||
);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
class sp_counted_base
|
||||
{
|
||||
private:
|
||||
|
||||
sp_counted_base( sp_counted_base const & );
|
||||
sp_counted_base & operator= ( sp_counted_base const & );
|
||||
|
||||
int use_count_; // #shared
|
||||
int weak_count_; // #weak + (#shared != 0)
|
||||
|
||||
public:
|
||||
|
||||
sp_counted_base(): use_count_( 1 ), weak_count_( 1 )
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~sp_counted_base() // nothrow
|
||||
{
|
||||
}
|
||||
|
||||
// dispose() is called when use_count_ drops to zero, to release
|
||||
// the resources managed by *this.
|
||||
|
||||
virtual void dispose() = 0; // nothrow
|
||||
|
||||
// destroy() is called when weak_count_ drops to zero.
|
||||
|
||||
virtual void destroy() // nothrow
|
||||
{
|
||||
delete this;
|
||||
}
|
||||
|
||||
virtual void * get_deleter( sp_typeinfo const & ti ) = 0;
|
||||
|
||||
void add_ref_copy()
|
||||
{
|
||||
atomic_increment( &use_count_ );
|
||||
}
|
||||
|
||||
bool add_ref_lock() // true on success
|
||||
{
|
||||
return atomic_conditional_increment( &use_count_ ) != 0;
|
||||
}
|
||||
|
||||
void release() // nothrow
|
||||
{
|
||||
if( atomic_decrement( &use_count_ ) == 0 )
|
||||
{
|
||||
dispose();
|
||||
weak_release();
|
||||
}
|
||||
}
|
||||
|
||||
void weak_add_ref() // nothrow
|
||||
{
|
||||
atomic_increment( &weak_count_ );
|
||||
}
|
||||
|
||||
void weak_release() // nothrow
|
||||
{
|
||||
if( atomic_decrement( &weak_count_ ) == 0 )
|
||||
{
|
||||
destroy();
|
||||
}
|
||||
}
|
||||
|
||||
long use_count() const // nothrow
|
||||
{
|
||||
return static_cast<int const volatile &>( use_count_ );
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // #ifndef BOOST_DETAIL_SP_COUNTED_BASE_GCC_PPC_HPP_INCLUDED
|
@ -0,0 +1,166 @@
|
||||
#ifndef BOOST_DETAIL_SP_COUNTED_BASE_GCC_SPARC_HPP_INCLUDED
|
||||
#define BOOST_DETAIL_SP_COUNTED_BASE_GCC_SPARC_HPP_INCLUDED
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
// detail/sp_counted_base_gcc_sparc.hpp - g++ on Sparc V8+
|
||||
//
|
||||
// Copyright (c) 2006 Piotr Wyderski
|
||||
// Copyright (c) 2006 Tomas Puverle
|
||||
// Copyright (c) 2006 Peter Dimov
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt
|
||||
//
|
||||
// Thanks to Michael van der Westhuizen
|
||||
|
||||
#include <boost/detail/sp_typeinfo.hpp>
|
||||
#include <inttypes.h> // int32_t
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
inline int32_t compare_and_swap( int32_t * dest_, int32_t compare_, int32_t swap_ )
|
||||
{
|
||||
__asm__ __volatile__( "cas %0, %2, %1"
|
||||
: "+m" (*dest_), "+r" (swap_)
|
||||
: "r" (compare_)
|
||||
: "memory" );
|
||||
|
||||
return swap_;
|
||||
}
|
||||
|
||||
inline int32_t atomic_fetch_and_add( int32_t * pw, int32_t dv )
|
||||
{
|
||||
// long r = *pw;
|
||||
// *pw += dv;
|
||||
// return r;
|
||||
|
||||
for( ;; )
|
||||
{
|
||||
int32_t r = *pw;
|
||||
|
||||
if( __builtin_expect((compare_and_swap(pw, r, r + dv) == r), 1) )
|
||||
{
|
||||
return r;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline void atomic_increment( int32_t * pw )
|
||||
{
|
||||
atomic_fetch_and_add( pw, 1 );
|
||||
}
|
||||
|
||||
inline int32_t atomic_decrement( int32_t * pw )
|
||||
{
|
||||
return atomic_fetch_and_add( pw, -1 );
|
||||
}
|
||||
|
||||
inline int32_t atomic_conditional_increment( int32_t * pw )
|
||||
{
|
||||
// long r = *pw;
|
||||
// if( r != 0 ) ++*pw;
|
||||
// return r;
|
||||
|
||||
for( ;; )
|
||||
{
|
||||
int32_t r = *pw;
|
||||
|
||||
if( r == 0 )
|
||||
{
|
||||
return r;
|
||||
}
|
||||
|
||||
if( __builtin_expect( ( compare_and_swap( pw, r, r + 1 ) == r ), 1 ) )
|
||||
{
|
||||
return r;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class sp_counted_base
|
||||
{
|
||||
private:
|
||||
|
||||
sp_counted_base( sp_counted_base const & );
|
||||
sp_counted_base & operator= ( sp_counted_base const & );
|
||||
|
||||
int32_t use_count_; // #shared
|
||||
int32_t weak_count_; // #weak + (#shared != 0)
|
||||
|
||||
public:
|
||||
|
||||
sp_counted_base(): use_count_( 1 ), weak_count_( 1 )
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~sp_counted_base() // nothrow
|
||||
{
|
||||
}
|
||||
|
||||
// dispose() is called when use_count_ drops to zero, to release
|
||||
// the resources managed by *this.
|
||||
|
||||
virtual void dispose() = 0; // nothrow
|
||||
|
||||
// destroy() is called when weak_count_ drops to zero.
|
||||
|
||||
virtual void destroy() // nothrow
|
||||
{
|
||||
delete this;
|
||||
}
|
||||
|
||||
virtual void * get_deleter( sp_typeinfo const & ti ) = 0;
|
||||
|
||||
void add_ref_copy()
|
||||
{
|
||||
atomic_increment( &use_count_ );
|
||||
}
|
||||
|
||||
bool add_ref_lock() // true on success
|
||||
{
|
||||
return atomic_conditional_increment( &use_count_ ) != 0;
|
||||
}
|
||||
|
||||
void release() // nothrow
|
||||
{
|
||||
if( atomic_decrement( &use_count_ ) == 1 )
|
||||
{
|
||||
dispose();
|
||||
weak_release();
|
||||
}
|
||||
}
|
||||
|
||||
void weak_add_ref() // nothrow
|
||||
{
|
||||
atomic_increment( &weak_count_ );
|
||||
}
|
||||
|
||||
void weak_release() // nothrow
|
||||
{
|
||||
if( atomic_decrement( &weak_count_ ) == 1 )
|
||||
{
|
||||
destroy();
|
||||
}
|
||||
}
|
||||
|
||||
long use_count() const // nothrow
|
||||
{
|
||||
return const_cast< int32_t const volatile & >( use_count_ );
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // #ifndef BOOST_DETAIL_SP_COUNTED_BASE_GCC_SPARC_HPP_INCLUDED
|
@ -0,0 +1,173 @@
|
||||
#ifndef BOOST_DETAIL_SP_COUNTED_BASE_GCC_X86_HPP_INCLUDED
|
||||
#define BOOST_DETAIL_SP_COUNTED_BASE_GCC_X86_HPP_INCLUDED
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
//
|
||||
// detail/sp_counted_base_gcc_x86.hpp - g++ on 486+ or AMD64
|
||||
//
|
||||
// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd.
|
||||
// Copyright 2004-2005 Peter Dimov
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
//
|
||||
// Lock-free algorithm by Alexander Terekhov
|
||||
//
|
||||
// Thanks to Ben Hitchings for the #weak + (#shared != 0)
|
||||
// formulation
|
||||
//
|
||||
|
||||
#include <boost/detail/sp_typeinfo.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
inline int atomic_exchange_and_add( int * pw, int dv )
|
||||
{
|
||||
// int r = *pw;
|
||||
// *pw += dv;
|
||||
// return r;
|
||||
|
||||
int r;
|
||||
|
||||
__asm__ __volatile__
|
||||
(
|
||||
"lock\n\t"
|
||||
"xadd %1, %0":
|
||||
"=m"( *pw ), "=r"( r ): // outputs (%0, %1)
|
||||
"m"( *pw ), "1"( dv ): // inputs (%2, %3 == %1)
|
||||
"memory", "cc" // clobbers
|
||||
);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
||||
inline void atomic_increment( int * pw )
|
||||
{
|
||||
//atomic_exchange_and_add( pw, 1 );
|
||||
|
||||
__asm__
|
||||
(
|
||||
"lock\n\t"
|
||||
"incl %0":
|
||||
"=m"( *pw ): // output (%0)
|
||||
"m"( *pw ): // input (%1)
|
||||
"cc" // clobbers
|
||||
);
|
||||
}
|
||||
|
||||
inline int atomic_conditional_increment( int * pw )
|
||||
{
|
||||
// int rv = *pw;
|
||||
// if( rv != 0 ) ++*pw;
|
||||
// return rv;
|
||||
|
||||
int rv, tmp;
|
||||
|
||||
__asm__
|
||||
(
|
||||
"movl %0, %%eax\n\t"
|
||||
"0:\n\t"
|
||||
"test %%eax, %%eax\n\t"
|
||||
"je 1f\n\t"
|
||||
"movl %%eax, %2\n\t"
|
||||
"incl %2\n\t"
|
||||
"lock\n\t"
|
||||
"cmpxchgl %2, %0\n\t"
|
||||
"jne 0b\n\t"
|
||||
"1:":
|
||||
"=m"( *pw ), "=&a"( rv ), "=&r"( tmp ): // outputs (%0, %1, %2)
|
||||
"m"( *pw ): // input (%3)
|
||||
"cc" // clobbers
|
||||
);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
class sp_counted_base
|
||||
{
|
||||
private:
|
||||
|
||||
sp_counted_base( sp_counted_base const & );
|
||||
sp_counted_base & operator= ( sp_counted_base const & );
|
||||
|
||||
int use_count_; // #shared
|
||||
int weak_count_; // #weak + (#shared != 0)
|
||||
|
||||
public:
|
||||
|
||||
sp_counted_base(): use_count_( 1 ), weak_count_( 1 )
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~sp_counted_base() // nothrow
|
||||
{
|
||||
}
|
||||
|
||||
// dispose() is called when use_count_ drops to zero, to release
|
||||
// the resources managed by *this.
|
||||
|
||||
virtual void dispose() = 0; // nothrow
|
||||
|
||||
// destroy() is called when weak_count_ drops to zero.
|
||||
|
||||
virtual void destroy() // nothrow
|
||||
{
|
||||
delete this;
|
||||
}
|
||||
|
||||
virtual void * get_deleter( sp_typeinfo const & ti ) = 0;
|
||||
|
||||
void add_ref_copy()
|
||||
{
|
||||
atomic_increment( &use_count_ );
|
||||
}
|
||||
|
||||
bool add_ref_lock() // true on success
|
||||
{
|
||||
return atomic_conditional_increment( &use_count_ ) != 0;
|
||||
}
|
||||
|
||||
void release() // nothrow
|
||||
{
|
||||
if( atomic_exchange_and_add( &use_count_, -1 ) == 1 )
|
||||
{
|
||||
dispose();
|
||||
weak_release();
|
||||
}
|
||||
}
|
||||
|
||||
void weak_add_ref() // nothrow
|
||||
{
|
||||
atomic_increment( &weak_count_ );
|
||||
}
|
||||
|
||||
void weak_release() // nothrow
|
||||
{
|
||||
if( atomic_exchange_and_add( &weak_count_, -1 ) == 1 )
|
||||
{
|
||||
destroy();
|
||||
}
|
||||
}
|
||||
|
||||
long use_count() const // nothrow
|
||||
{
|
||||
return static_cast<int const volatile &>( use_count_ );
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // #ifndef BOOST_DETAIL_SP_COUNTED_BASE_GCC_X86_HPP_INCLUDED
|
107
library/PolyVoxCore/include/boost/detail/sp_counted_base_nt.hpp
Normal file
107
library/PolyVoxCore/include/boost/detail/sp_counted_base_nt.hpp
Normal file
@ -0,0 +1,107 @@
|
||||
#ifndef BOOST_DETAIL_SP_COUNTED_BASE_NT_HPP_INCLUDED
|
||||
#define BOOST_DETAIL_SP_COUNTED_BASE_NT_HPP_INCLUDED
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
//
|
||||
// detail/sp_counted_base_nt.hpp
|
||||
//
|
||||
// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd.
|
||||
// Copyright 2004-2005 Peter Dimov
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
#include <boost/detail/sp_typeinfo.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
class sp_counted_base
|
||||
{
|
||||
private:
|
||||
|
||||
sp_counted_base( sp_counted_base const & );
|
||||
sp_counted_base & operator= ( sp_counted_base const & );
|
||||
|
||||
long use_count_; // #shared
|
||||
long weak_count_; // #weak + (#shared != 0)
|
||||
|
||||
public:
|
||||
|
||||
sp_counted_base(): use_count_( 1 ), weak_count_( 1 )
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~sp_counted_base() // nothrow
|
||||
{
|
||||
}
|
||||
|
||||
// dispose() is called when use_count_ drops to zero, to release
|
||||
// the resources managed by *this.
|
||||
|
||||
virtual void dispose() = 0; // nothrow
|
||||
|
||||
// destroy() is called when weak_count_ drops to zero.
|
||||
|
||||
virtual void destroy() // nothrow
|
||||
{
|
||||
delete this;
|
||||
}
|
||||
|
||||
virtual void * get_deleter( sp_typeinfo const & ti ) = 0;
|
||||
|
||||
void add_ref_copy()
|
||||
{
|
||||
++use_count_;
|
||||
}
|
||||
|
||||
bool add_ref_lock() // true on success
|
||||
{
|
||||
if( use_count_ == 0 ) return false;
|
||||
++use_count_;
|
||||
return true;
|
||||
}
|
||||
|
||||
void release() // nothrow
|
||||
{
|
||||
if( --use_count_ == 0 )
|
||||
{
|
||||
dispose();
|
||||
weak_release();
|
||||
}
|
||||
}
|
||||
|
||||
void weak_add_ref() // nothrow
|
||||
{
|
||||
++weak_count_;
|
||||
}
|
||||
|
||||
void weak_release() // nothrow
|
||||
{
|
||||
if( --weak_count_ == 0 )
|
||||
{
|
||||
destroy();
|
||||
}
|
||||
}
|
||||
|
||||
long use_count() const // nothrow
|
||||
{
|
||||
return use_count_;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // #ifndef BOOST_DETAIL_SP_COUNTED_BASE_NT_HPP_INCLUDED
|
135
library/PolyVoxCore/include/boost/detail/sp_counted_base_pt.hpp
Normal file
135
library/PolyVoxCore/include/boost/detail/sp_counted_base_pt.hpp
Normal file
@ -0,0 +1,135 @@
|
||||
#ifndef BOOST_DETAIL_SP_COUNTED_BASE_PT_HPP_INCLUDED
|
||||
#define BOOST_DETAIL_SP_COUNTED_BASE_PT_HPP_INCLUDED
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
//
|
||||
// detail/sp_counted_base_pt.hpp
|
||||
//
|
||||
// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd.
|
||||
// Copyright 2004-2005 Peter Dimov
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
#include <boost/detail/sp_typeinfo.hpp>
|
||||
#include <pthread.h>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
class sp_counted_base
|
||||
{
|
||||
private:
|
||||
|
||||
sp_counted_base( sp_counted_base const & );
|
||||
sp_counted_base & operator= ( sp_counted_base const & );
|
||||
|
||||
long use_count_; // #shared
|
||||
long weak_count_; // #weak + (#shared != 0)
|
||||
|
||||
mutable pthread_mutex_t m_;
|
||||
|
||||
public:
|
||||
|
||||
sp_counted_base(): use_count_( 1 ), weak_count_( 1 )
|
||||
{
|
||||
// HPUX 10.20 / DCE has a nonstandard pthread_mutex_init
|
||||
|
||||
#if defined(__hpux) && defined(_DECTHREADS_)
|
||||
pthread_mutex_init( &m_, pthread_mutexattr_default );
|
||||
#else
|
||||
pthread_mutex_init( &m_, 0 );
|
||||
#endif
|
||||
}
|
||||
|
||||
virtual ~sp_counted_base() // nothrow
|
||||
{
|
||||
pthread_mutex_destroy( &m_ );
|
||||
}
|
||||
|
||||
// dispose() is called when use_count_ drops to zero, to release
|
||||
// the resources managed by *this.
|
||||
|
||||
virtual void dispose() = 0; // nothrow
|
||||
|
||||
// destroy() is called when weak_count_ drops to zero.
|
||||
|
||||
virtual void destroy() // nothrow
|
||||
{
|
||||
delete this;
|
||||
}
|
||||
|
||||
virtual void * get_deleter( sp_typeinfo const & ti ) = 0;
|
||||
|
||||
void add_ref_copy()
|
||||
{
|
||||
pthread_mutex_lock( &m_ );
|
||||
++use_count_;
|
||||
pthread_mutex_unlock( &m_ );
|
||||
}
|
||||
|
||||
bool add_ref_lock() // true on success
|
||||
{
|
||||
pthread_mutex_lock( &m_ );
|
||||
bool r = use_count_ == 0? false: ( ++use_count_, true );
|
||||
pthread_mutex_unlock( &m_ );
|
||||
return r;
|
||||
}
|
||||
|
||||
void release() // nothrow
|
||||
{
|
||||
pthread_mutex_lock( &m_ );
|
||||
long new_use_count = --use_count_;
|
||||
pthread_mutex_unlock( &m_ );
|
||||
|
||||
if( new_use_count == 0 )
|
||||
{
|
||||
dispose();
|
||||
weak_release();
|
||||
}
|
||||
}
|
||||
|
||||
void weak_add_ref() // nothrow
|
||||
{
|
||||
pthread_mutex_lock( &m_ );
|
||||
++weak_count_;
|
||||
pthread_mutex_unlock( &m_ );
|
||||
}
|
||||
|
||||
void weak_release() // nothrow
|
||||
{
|
||||
pthread_mutex_lock( &m_ );
|
||||
long new_weak_count = --weak_count_;
|
||||
pthread_mutex_unlock( &m_ );
|
||||
|
||||
if( new_weak_count == 0 )
|
||||
{
|
||||
destroy();
|
||||
}
|
||||
}
|
||||
|
||||
long use_count() const // nothrow
|
||||
{
|
||||
pthread_mutex_lock( &m_ );
|
||||
long r = use_count_;
|
||||
pthread_mutex_unlock( &m_ );
|
||||
|
||||
return r;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // #ifndef BOOST_DETAIL_SP_COUNTED_BASE_PT_HPP_INCLUDED
|
@ -0,0 +1,113 @@
|
||||
#ifndef BOOST_DETAIL_SP_COUNTED_BASE_SOLARIS_HPP_INCLUDED
|
||||
#define BOOST_DETAIL_SP_COUNTED_BASE_SOLARIS_HPP_INCLUDED
|
||||
|
||||
//
|
||||
// detail/sp_counted_base_solaris.hpp
|
||||
// based on: detail/sp_counted_base_w32.hpp
|
||||
//
|
||||
// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd.
|
||||
// Copyright 2004-2005 Peter Dimov
|
||||
// Copyright 2006 Michael van der Westhuizen
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
//
|
||||
// Lock-free algorithm by Alexander Terekhov
|
||||
//
|
||||
// Thanks to Ben Hitchings for the #weak + (#shared != 0)
|
||||
// formulation
|
||||
//
|
||||
|
||||
#include <boost/detail/sp_typeinfo.hpp>
|
||||
#include <atomic.h>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
class sp_counted_base
|
||||
{
|
||||
private:
|
||||
|
||||
sp_counted_base( sp_counted_base const & );
|
||||
sp_counted_base & operator= ( sp_counted_base const & );
|
||||
|
||||
uint32_t use_count_; // #shared
|
||||
uint32_t weak_count_; // #weak + (#shared != 0)
|
||||
|
||||
public:
|
||||
|
||||
sp_counted_base(): use_count_( 1 ), weak_count_( 1 )
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~sp_counted_base() // nothrow
|
||||
{
|
||||
}
|
||||
|
||||
// dispose() is called when use_count_ drops to zero, to release
|
||||
// the resources managed by *this.
|
||||
|
||||
virtual void dispose() = 0; // nothrow
|
||||
|
||||
// destroy() is called when weak_count_ drops to zero.
|
||||
|
||||
virtual void destroy() // nothrow
|
||||
{
|
||||
delete this;
|
||||
}
|
||||
|
||||
virtual void * get_deleter( sp_typeinfo const & ti ) = 0;
|
||||
|
||||
void add_ref_copy()
|
||||
{
|
||||
atomic_inc_32( &use_count_ );
|
||||
}
|
||||
|
||||
bool add_ref_lock() // true on success
|
||||
{
|
||||
for( ;; )
|
||||
{
|
||||
uint32_t tmp = static_cast< uint32_t const volatile& >( use_count_ );
|
||||
if( tmp == 0 ) return false;
|
||||
if( atomic_cas_32( &use_count_, tmp, tmp + 1 ) == tmp ) return true;
|
||||
}
|
||||
}
|
||||
|
||||
void release() // nothrow
|
||||
{
|
||||
if( atomic_dec_32_nv( &use_count_ ) == 0 )
|
||||
{
|
||||
dispose();
|
||||
weak_release();
|
||||
}
|
||||
}
|
||||
|
||||
void weak_add_ref() // nothrow
|
||||
{
|
||||
atomic_inc_32( &weak_count_ );
|
||||
}
|
||||
|
||||
void weak_release() // nothrow
|
||||
{
|
||||
if( atomic_dec_32_nv( &weak_count_ ) == 0 )
|
||||
{
|
||||
destroy();
|
||||
}
|
||||
}
|
||||
|
||||
long use_count() const // nothrow
|
||||
{
|
||||
return static_cast<long const volatile &>( use_count_ );
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // #ifndef BOOST_DETAIL_SP_COUNTED_BASE_SOLARIS_HPP_INCLUDED
|
@ -0,0 +1,131 @@
|
||||
#ifndef BOOST_DETAIL_SP_COUNTED_BASE_SPIN_HPP_INCLUDED
|
||||
#define BOOST_DETAIL_SP_COUNTED_BASE_SPIN_HPP_INCLUDED
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
//
|
||||
// detail/sp_counted_base_spin.hpp - spinlock pool atomic emulation
|
||||
//
|
||||
// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd.
|
||||
// Copyright 2004-2008 Peter Dimov
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
#include <boost/detail/sp_typeinfo.hpp>
|
||||
#include <boost/detail/spinlock_pool.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
inline int atomic_exchange_and_add( int * pw, int dv )
|
||||
{
|
||||
spinlock_pool<1>::scoped_lock lock( pw );
|
||||
|
||||
int r = *pw;
|
||||
*pw += dv;
|
||||
return r;
|
||||
}
|
||||
|
||||
inline void atomic_increment( int * pw )
|
||||
{
|
||||
spinlock_pool<1>::scoped_lock lock( pw );
|
||||
++*pw;
|
||||
}
|
||||
|
||||
inline int atomic_conditional_increment( int * pw )
|
||||
{
|
||||
spinlock_pool<1>::scoped_lock lock( pw );
|
||||
|
||||
int rv = *pw;
|
||||
if( rv != 0 ) ++*pw;
|
||||
return rv;
|
||||
}
|
||||
|
||||
class sp_counted_base
|
||||
{
|
||||
private:
|
||||
|
||||
sp_counted_base( sp_counted_base const & );
|
||||
sp_counted_base & operator= ( sp_counted_base const & );
|
||||
|
||||
int use_count_; // #shared
|
||||
int weak_count_; // #weak + (#shared != 0)
|
||||
|
||||
public:
|
||||
|
||||
sp_counted_base(): use_count_( 1 ), weak_count_( 1 )
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~sp_counted_base() // nothrow
|
||||
{
|
||||
}
|
||||
|
||||
// dispose() is called when use_count_ drops to zero, to release
|
||||
// the resources managed by *this.
|
||||
|
||||
virtual void dispose() = 0; // nothrow
|
||||
|
||||
// destroy() is called when weak_count_ drops to zero.
|
||||
|
||||
virtual void destroy() // nothrow
|
||||
{
|
||||
delete this;
|
||||
}
|
||||
|
||||
virtual void * get_deleter( sp_typeinfo const & ti ) = 0;
|
||||
|
||||
void add_ref_copy()
|
||||
{
|
||||
atomic_increment( &use_count_ );
|
||||
}
|
||||
|
||||
bool add_ref_lock() // true on success
|
||||
{
|
||||
return atomic_conditional_increment( &use_count_ ) != 0;
|
||||
}
|
||||
|
||||
void release() // nothrow
|
||||
{
|
||||
if( atomic_exchange_and_add( &use_count_, -1 ) == 1 )
|
||||
{
|
||||
dispose();
|
||||
weak_release();
|
||||
}
|
||||
}
|
||||
|
||||
void weak_add_ref() // nothrow
|
||||
{
|
||||
atomic_increment( &weak_count_ );
|
||||
}
|
||||
|
||||
void weak_release() // nothrow
|
||||
{
|
||||
if( atomic_exchange_and_add( &weak_count_, -1 ) == 1 )
|
||||
{
|
||||
destroy();
|
||||
}
|
||||
}
|
||||
|
||||
long use_count() const // nothrow
|
||||
{
|
||||
spinlock_pool<1>::scoped_lock lock( &use_count_ );
|
||||
return use_count_;
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // #ifndef BOOST_DETAIL_SP_COUNTED_BASE_SPIN_HPP_INCLUDED
|
@ -0,0 +1,155 @@
|
||||
#ifndef BOOST_DETAIL_SP_COUNTED_BASE_SYNC_HPP_INCLUDED
|
||||
#define BOOST_DETAIL_SP_COUNTED_BASE_SYNC_HPP_INCLUDED
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
// detail/sp_counted_base_sync.hpp - g++ 4.1+ __sync intrinsics
|
||||
//
|
||||
// Copyright (c) 2007 Peter Dimov
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt
|
||||
|
||||
#include <boost/detail/sp_typeinfo.hpp>
|
||||
#include <limits.h>
|
||||
|
||||
#if defined( __ia64__ ) && defined( __INTEL_COMPILER )
|
||||
# include <ia64intrin.h>
|
||||
#endif
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
#if INT_MAX >= 2147483647
|
||||
|
||||
typedef int sp_int32_t;
|
||||
|
||||
#else
|
||||
|
||||
typedef long sp_int32_t;
|
||||
|
||||
#endif
|
||||
|
||||
inline void atomic_increment( sp_int32_t * pw )
|
||||
{
|
||||
__sync_fetch_and_add( pw, 1 );
|
||||
}
|
||||
|
||||
inline sp_int32_t atomic_decrement( sp_int32_t * pw )
|
||||
{
|
||||
return __sync_fetch_and_add( pw, -1 );
|
||||
}
|
||||
|
||||
inline sp_int32_t atomic_conditional_increment( sp_int32_t * pw )
|
||||
{
|
||||
// long r = *pw;
|
||||
// if( r != 0 ) ++*pw;
|
||||
// return r;
|
||||
|
||||
sp_int32_t r = *pw;
|
||||
|
||||
for( ;; )
|
||||
{
|
||||
if( r == 0 )
|
||||
{
|
||||
return r;
|
||||
}
|
||||
|
||||
sp_int32_t r2 = __sync_val_compare_and_swap( pw, r, r + 1 );
|
||||
|
||||
if( r2 == r )
|
||||
{
|
||||
return r;
|
||||
}
|
||||
else
|
||||
{
|
||||
r = r2;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class sp_counted_base
|
||||
{
|
||||
private:
|
||||
|
||||
sp_counted_base( sp_counted_base const & );
|
||||
sp_counted_base & operator= ( sp_counted_base const & );
|
||||
|
||||
sp_int32_t use_count_; // #shared
|
||||
sp_int32_t weak_count_; // #weak + (#shared != 0)
|
||||
|
||||
public:
|
||||
|
||||
sp_counted_base(): use_count_( 1 ), weak_count_( 1 )
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~sp_counted_base() // nothrow
|
||||
{
|
||||
}
|
||||
|
||||
// dispose() is called when use_count_ drops to zero, to release
|
||||
// the resources managed by *this.
|
||||
|
||||
virtual void dispose() = 0; // nothrow
|
||||
|
||||
// destroy() is called when weak_count_ drops to zero.
|
||||
|
||||
virtual void destroy() // nothrow
|
||||
{
|
||||
delete this;
|
||||
}
|
||||
|
||||
virtual void * get_deleter( sp_typeinfo const & ti ) = 0;
|
||||
|
||||
void add_ref_copy()
|
||||
{
|
||||
atomic_increment( &use_count_ );
|
||||
}
|
||||
|
||||
bool add_ref_lock() // true on success
|
||||
{
|
||||
return atomic_conditional_increment( &use_count_ ) != 0;
|
||||
}
|
||||
|
||||
void release() // nothrow
|
||||
{
|
||||
if( atomic_decrement( &use_count_ ) == 1 )
|
||||
{
|
||||
dispose();
|
||||
weak_release();
|
||||
}
|
||||
}
|
||||
|
||||
void weak_add_ref() // nothrow
|
||||
{
|
||||
atomic_increment( &weak_count_ );
|
||||
}
|
||||
|
||||
void weak_release() // nothrow
|
||||
{
|
||||
if( atomic_decrement( &weak_count_ ) == 1 )
|
||||
{
|
||||
destroy();
|
||||
}
|
||||
}
|
||||
|
||||
long use_count() const // nothrow
|
||||
{
|
||||
return const_cast< sp_int32_t const volatile & >( use_count_ );
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // #ifndef BOOST_DETAIL_SP_COUNTED_BASE_SYNC_HPP_INCLUDED
|
130
library/PolyVoxCore/include/boost/detail/sp_counted_base_w32.hpp
Normal file
130
library/PolyVoxCore/include/boost/detail/sp_counted_base_w32.hpp
Normal file
@ -0,0 +1,130 @@
|
||||
#ifndef BOOST_DETAIL_SP_COUNTED_BASE_W32_HPP_INCLUDED
|
||||
#define BOOST_DETAIL_SP_COUNTED_BASE_W32_HPP_INCLUDED
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
//
|
||||
// detail/sp_counted_base_w32.hpp
|
||||
//
|
||||
// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd.
|
||||
// Copyright 2004-2005 Peter Dimov
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
//
|
||||
// Lock-free algorithm by Alexander Terekhov
|
||||
//
|
||||
// Thanks to Ben Hitchings for the #weak + (#shared != 0)
|
||||
// formulation
|
||||
//
|
||||
|
||||
#include <boost/detail/interlocked.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
#include <boost/detail/sp_typeinfo.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
class sp_counted_base
|
||||
{
|
||||
private:
|
||||
|
||||
sp_counted_base( sp_counted_base const & );
|
||||
sp_counted_base & operator= ( sp_counted_base const & );
|
||||
|
||||
long use_count_; // #shared
|
||||
long weak_count_; // #weak + (#shared != 0)
|
||||
|
||||
public:
|
||||
|
||||
sp_counted_base(): use_count_( 1 ), weak_count_( 1 )
|
||||
{
|
||||
}
|
||||
|
||||
virtual ~sp_counted_base() // nothrow
|
||||
{
|
||||
}
|
||||
|
||||
// dispose() is called when use_count_ drops to zero, to release
|
||||
// the resources managed by *this.
|
||||
|
||||
virtual void dispose() = 0; // nothrow
|
||||
|
||||
// destroy() is called when weak_count_ drops to zero.
|
||||
|
||||
virtual void destroy() // nothrow
|
||||
{
|
||||
delete this;
|
||||
}
|
||||
|
||||
virtual void * get_deleter( sp_typeinfo const & ti ) = 0;
|
||||
|
||||
void add_ref_copy()
|
||||
{
|
||||
BOOST_INTERLOCKED_INCREMENT( &use_count_ );
|
||||
}
|
||||
|
||||
bool add_ref_lock() // true on success
|
||||
{
|
||||
for( ;; )
|
||||
{
|
||||
long tmp = static_cast< long const volatile& >( use_count_ );
|
||||
if( tmp == 0 ) return false;
|
||||
|
||||
#if defined( BOOST_MSVC ) && BOOST_WORKAROUND( BOOST_MSVC, == 1200 )
|
||||
|
||||
// work around a code generation bug
|
||||
|
||||
long tmp2 = tmp + 1;
|
||||
if( BOOST_INTERLOCKED_COMPARE_EXCHANGE( &use_count_, tmp2, tmp ) == tmp2 - 1 ) return true;
|
||||
|
||||
#else
|
||||
|
||||
if( BOOST_INTERLOCKED_COMPARE_EXCHANGE( &use_count_, tmp + 1, tmp ) == tmp ) return true;
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void release() // nothrow
|
||||
{
|
||||
if( BOOST_INTERLOCKED_DECREMENT( &use_count_ ) == 0 )
|
||||
{
|
||||
dispose();
|
||||
weak_release();
|
||||
}
|
||||
}
|
||||
|
||||
void weak_add_ref() // nothrow
|
||||
{
|
||||
BOOST_INTERLOCKED_INCREMENT( &weak_count_ );
|
||||
}
|
||||
|
||||
void weak_release() // nothrow
|
||||
{
|
||||
if( BOOST_INTERLOCKED_DECREMENT( &weak_count_ ) == 0 )
|
||||
{
|
||||
destroy();
|
||||
}
|
||||
}
|
||||
|
||||
long use_count() const // nothrow
|
||||
{
|
||||
return static_cast<long const volatile &>( use_count_ );
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // #ifndef BOOST_DETAIL_SP_COUNTED_BASE_W32_HPP_INCLUDED
|
231
library/PolyVoxCore/include/boost/detail/sp_counted_impl.hpp
Normal file
231
library/PolyVoxCore/include/boost/detail/sp_counted_impl.hpp
Normal file
@ -0,0 +1,231 @@
|
||||
#ifndef BOOST_DETAIL_SP_COUNTED_IMPL_HPP_INCLUDED
|
||||
#define BOOST_DETAIL_SP_COUNTED_IMPL_HPP_INCLUDED
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
//
|
||||
// detail/sp_counted_impl.hpp
|
||||
//
|
||||
// Copyright (c) 2001, 2002, 2003 Peter Dimov and Multi Media Ltd.
|
||||
// Copyright 2004-2005 Peter Dimov
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#if defined(BOOST_SP_USE_STD_ALLOCATOR) && defined(BOOST_SP_USE_QUICK_ALLOCATOR)
|
||||
# error BOOST_SP_USE_STD_ALLOCATOR and BOOST_SP_USE_QUICK_ALLOCATOR are incompatible.
|
||||
#endif
|
||||
|
||||
#include <boost/checked_delete.hpp>
|
||||
#include <boost/detail/sp_counted_base.hpp>
|
||||
|
||||
#if defined(BOOST_SP_USE_QUICK_ALLOCATOR)
|
||||
#include <boost/detail/quick_allocator.hpp>
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_SP_USE_STD_ALLOCATOR)
|
||||
#include <memory> // std::allocator
|
||||
#endif
|
||||
|
||||
#include <cstddef> // std::size_t
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
|
||||
|
||||
void sp_scalar_constructor_hook( void * px, std::size_t size, void * pn );
|
||||
void sp_scalar_destructor_hook( void * px, std::size_t size, void * pn );
|
||||
|
||||
#endif
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template<class X> class sp_counted_impl_p: public sp_counted_base
|
||||
{
|
||||
private:
|
||||
|
||||
X * px_;
|
||||
|
||||
sp_counted_impl_p( sp_counted_impl_p const & );
|
||||
sp_counted_impl_p & operator= ( sp_counted_impl_p const & );
|
||||
|
||||
typedef sp_counted_impl_p<X> this_type;
|
||||
|
||||
public:
|
||||
|
||||
explicit sp_counted_impl_p( X * px ): px_( px )
|
||||
{
|
||||
#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
|
||||
boost::sp_scalar_constructor_hook( px, sizeof(X), this );
|
||||
#endif
|
||||
}
|
||||
|
||||
virtual void dispose() // nothrow
|
||||
{
|
||||
#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
|
||||
boost::sp_scalar_destructor_hook( px_, sizeof(X), this );
|
||||
#endif
|
||||
boost::checked_delete( px_ );
|
||||
}
|
||||
|
||||
virtual void * get_deleter( detail::sp_typeinfo const & )
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
#if defined(BOOST_SP_USE_STD_ALLOCATOR)
|
||||
|
||||
void * operator new( std::size_t )
|
||||
{
|
||||
return std::allocator<this_type>().allocate( 1, static_cast<this_type *>(0) );
|
||||
}
|
||||
|
||||
void operator delete( void * p )
|
||||
{
|
||||
std::allocator<this_type>().deallocate( static_cast<this_type *>(p), 1 );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_SP_USE_QUICK_ALLOCATOR)
|
||||
|
||||
void * operator new( std::size_t )
|
||||
{
|
||||
return quick_allocator<this_type>::alloc();
|
||||
}
|
||||
|
||||
void operator delete( void * p )
|
||||
{
|
||||
quick_allocator<this_type>::dealloc( p );
|
||||
}
|
||||
|
||||
#endif
|
||||
};
|
||||
|
||||
//
|
||||
// Borland's Codeguard trips up over the -Vx- option here:
|
||||
//
|
||||
#ifdef __CODEGUARD__
|
||||
# pragma option push -Vx-
|
||||
#endif
|
||||
|
||||
template<class P, class D> class sp_counted_impl_pd: public sp_counted_base
|
||||
{
|
||||
private:
|
||||
|
||||
P ptr; // copy constructor must not throw
|
||||
D del; // copy constructor must not throw
|
||||
|
||||
sp_counted_impl_pd( sp_counted_impl_pd const & );
|
||||
sp_counted_impl_pd & operator= ( sp_counted_impl_pd const & );
|
||||
|
||||
typedef sp_counted_impl_pd<P, D> this_type;
|
||||
|
||||
public:
|
||||
|
||||
// pre: d(p) must not throw
|
||||
|
||||
sp_counted_impl_pd( P p, D d ): ptr(p), del(d)
|
||||
{
|
||||
}
|
||||
|
||||
virtual void dispose() // nothrow
|
||||
{
|
||||
del( ptr );
|
||||
}
|
||||
|
||||
virtual void * get_deleter( detail::sp_typeinfo const & ti )
|
||||
{
|
||||
return ti == BOOST_SP_TYPEID(D)? &reinterpret_cast<char&>( del ): 0;
|
||||
}
|
||||
|
||||
#if defined(BOOST_SP_USE_STD_ALLOCATOR)
|
||||
|
||||
void * operator new( std::size_t )
|
||||
{
|
||||
return std::allocator<this_type>().allocate( 1, static_cast<this_type *>(0) );
|
||||
}
|
||||
|
||||
void operator delete( void * p )
|
||||
{
|
||||
std::allocator<this_type>().deallocate( static_cast<this_type *>(p), 1 );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if defined(BOOST_SP_USE_QUICK_ALLOCATOR)
|
||||
|
||||
void * operator new( std::size_t )
|
||||
{
|
||||
return quick_allocator<this_type>::alloc();
|
||||
}
|
||||
|
||||
void operator delete( void * p )
|
||||
{
|
||||
quick_allocator<this_type>::dealloc( p );
|
||||
}
|
||||
|
||||
#endif
|
||||
};
|
||||
|
||||
template<class P, class D, class A> class sp_counted_impl_pda: public sp_counted_base
|
||||
{
|
||||
private:
|
||||
|
||||
P p_; // copy constructor must not throw
|
||||
D d_; // copy constructor must not throw
|
||||
A a_; // copy constructor must not throw
|
||||
|
||||
sp_counted_impl_pda( sp_counted_impl_pda const & );
|
||||
sp_counted_impl_pda & operator= ( sp_counted_impl_pda const & );
|
||||
|
||||
typedef sp_counted_impl_pda<P, D, A> this_type;
|
||||
|
||||
public:
|
||||
|
||||
// pre: d( p ) must not throw
|
||||
|
||||
sp_counted_impl_pda( P p, D d, A a ): p_( p ), d_( d ), a_( a )
|
||||
{
|
||||
}
|
||||
|
||||
virtual void dispose() // nothrow
|
||||
{
|
||||
d_( p_ );
|
||||
}
|
||||
|
||||
virtual void destroy() // nothrow
|
||||
{
|
||||
typedef typename A::template rebind< this_type >::other A2;
|
||||
|
||||
A2 a2( a_ );
|
||||
|
||||
this->~this_type();
|
||||
a2.deallocate( this, 1 );
|
||||
}
|
||||
|
||||
virtual void * get_deleter( detail::sp_typeinfo const & ti )
|
||||
{
|
||||
return ti == BOOST_SP_TYPEID( D )? &reinterpret_cast<char&>( d_ ): 0;
|
||||
}
|
||||
};
|
||||
|
||||
#ifdef __CODEGUARD__
|
||||
# pragma option pop
|
||||
#endif
|
||||
|
||||
} // namespace detail
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // #ifndef BOOST_DETAIL_SP_COUNTED_IMPL_HPP_INCLUDED
|
83
library/PolyVoxCore/include/boost/detail/sp_typeinfo.hpp
Normal file
83
library/PolyVoxCore/include/boost/detail/sp_typeinfo.hpp
Normal file
@ -0,0 +1,83 @@
|
||||
#ifndef BOOST_DETAIL_SP_TYPEINFO_HPP_INCLUDED
|
||||
#define BOOST_DETAIL_SP_TYPEINFO_HPP_INCLUDED
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
// detail/sp_typeinfo.hpp
|
||||
//
|
||||
// Copyright 2007 Peter Dimov
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#if defined( BOOST_NO_TYPEID )
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
typedef void* sp_typeinfo;
|
||||
|
||||
template<class T> struct sp_typeid_
|
||||
{
|
||||
static char v_;
|
||||
};
|
||||
|
||||
template<class T> char sp_typeid_< T >::v_;
|
||||
|
||||
template<class T> struct sp_typeid_< T const >: sp_typeid_< T >
|
||||
{
|
||||
};
|
||||
|
||||
template<class T> struct sp_typeid_< T volatile >: sp_typeid_< T >
|
||||
{
|
||||
};
|
||||
|
||||
template<class T> struct sp_typeid_< T const volatile >: sp_typeid_< T >
|
||||
{
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#define BOOST_SP_TYPEID(T) (&boost::detail::sp_typeid_<T>::v_)
|
||||
|
||||
#else
|
||||
|
||||
#include <typeinfo>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
#if defined( BOOST_NO_STD_TYPEINFO )
|
||||
|
||||
typedef ::type_info sp_typeinfo;
|
||||
|
||||
#else
|
||||
|
||||
typedef std::type_info sp_typeinfo;
|
||||
|
||||
#endif
|
||||
|
||||
} // namespace detail
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#define BOOST_SP_TYPEID(T) typeid(T)
|
||||
|
||||
#endif
|
||||
|
||||
#endif // #ifndef BOOST_DETAIL_SP_TYPEINFO_HPP_INCLUDED
|
47
library/PolyVoxCore/include/boost/detail/spinlock.hpp
Normal file
47
library/PolyVoxCore/include/boost/detail/spinlock.hpp
Normal file
@ -0,0 +1,47 @@
|
||||
#ifndef BOOST_DETAIL_SPINLOCK_HPP_INCLUDED
|
||||
#define BOOST_DETAIL_SPINLOCK_HPP_INCLUDED
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
//
|
||||
// boost/detail/spinlock.hpp
|
||||
//
|
||||
// Copyright (c) 2008 Peter Dimov
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// struct spinlock
|
||||
// {
|
||||
// void lock();
|
||||
// bool try_lock();
|
||||
// void unlock();
|
||||
//
|
||||
// class scoped_lock;
|
||||
// };
|
||||
//
|
||||
// #define BOOST_DETAIL_SPINLOCK_INIT <unspecified>
|
||||
//
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#if defined(__GNUC__) && defined( __arm__ ) && !defined( __thumb__ )
|
||||
# include <boost/detail/spinlock_gcc_arm.hpp>
|
||||
#elif defined(__GNUC__) && ( __GNUC__ * 100 + __GNUC_MINOR__ >= 401 ) && !defined( __arm__ ) && !defined( __hppa ) && ( !defined( __INTEL_COMPILER ) || defined( __ia64__ ) )
|
||||
# include <boost/detail/spinlock_sync.hpp>
|
||||
#elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
|
||||
# include <boost/detail/spinlock_w32.hpp>
|
||||
#elif defined(BOOST_HAS_PTHREADS)
|
||||
# include <boost/detail/spinlock_pt.hpp>
|
||||
#elif !defined(BOOST_HAS_THREADS)
|
||||
# include <boost/detail/spinlock_nt.hpp>
|
||||
#else
|
||||
# error Unrecognized threading platform
|
||||
#endif
|
||||
|
||||
#endif // #ifndef BOOST_DETAIL_SPINLOCK_HPP_INCLUDED
|
@ -0,0 +1,85 @@
|
||||
#ifndef BOOST_DETAIL_SPINLOCK_GCC_ARM_HPP_INCLUDED
|
||||
#define BOOST_DETAIL_SPINLOCK_GCC_ARM_HPP_INCLUDED
|
||||
|
||||
//
|
||||
// Copyright (c) 2008 Peter Dimov
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
#include <boost/detail/yield_k.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
class spinlock
|
||||
{
|
||||
public:
|
||||
|
||||
int v_;
|
||||
|
||||
public:
|
||||
|
||||
bool try_lock()
|
||||
{
|
||||
int r;
|
||||
|
||||
__asm__ __volatile__(
|
||||
"swp %0, %1, [%2]":
|
||||
"=&r"( r ): // outputs
|
||||
"r"( 1 ), "r"( &v_ ): // inputs
|
||||
"memory", "cc" );
|
||||
|
||||
return r == 0;
|
||||
}
|
||||
|
||||
void lock()
|
||||
{
|
||||
for( unsigned k = 0; !try_lock(); ++k )
|
||||
{
|
||||
boost::detail::yield( k );
|
||||
}
|
||||
}
|
||||
|
||||
void unlock()
|
||||
{
|
||||
__asm__ __volatile__( "" ::: "memory" );
|
||||
*const_cast< int volatile* >( &v_ ) = 0;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
class scoped_lock
|
||||
{
|
||||
private:
|
||||
|
||||
spinlock & sp_;
|
||||
|
||||
scoped_lock( scoped_lock const & );
|
||||
scoped_lock & operator=( scoped_lock const & );
|
||||
|
||||
public:
|
||||
|
||||
explicit scoped_lock( spinlock & sp ): sp_( sp )
|
||||
{
|
||||
sp.lock();
|
||||
}
|
||||
|
||||
~scoped_lock()
|
||||
{
|
||||
sp_.unlock();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace boost
|
||||
|
||||
#define BOOST_DETAIL_SPINLOCK_INIT {0}
|
||||
|
||||
#endif // #ifndef BOOST_DETAIL_SPINLOCK_GCC_ARM_HPP_INCLUDED
|
89
library/PolyVoxCore/include/boost/detail/spinlock_nt.hpp
Normal file
89
library/PolyVoxCore/include/boost/detail/spinlock_nt.hpp
Normal file
@ -0,0 +1,89 @@
|
||||
#ifndef BOOST_DETAIL_SPINLOCK_NT_HPP_INCLUDED
|
||||
#define BOOST_DETAIL_SPINLOCK_NT_HPP_INCLUDED
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
//
|
||||
// Copyright (c) 2008 Peter Dimov
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
#include <boost/assert.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
class spinlock
|
||||
{
|
||||
public:
|
||||
|
||||
bool locked_;
|
||||
|
||||
public:
|
||||
|
||||
inline bool try_lock()
|
||||
{
|
||||
if( locked_ )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
locked_ = true;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
inline void lock()
|
||||
{
|
||||
BOOST_ASSERT( !locked_ );
|
||||
locked_ = true;
|
||||
}
|
||||
|
||||
inline void unlock()
|
||||
{
|
||||
BOOST_ASSERT( locked_ );
|
||||
locked_ = false;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
class scoped_lock
|
||||
{
|
||||
private:
|
||||
|
||||
spinlock & sp_;
|
||||
|
||||
scoped_lock( scoped_lock const & );
|
||||
scoped_lock & operator=( scoped_lock const & );
|
||||
|
||||
public:
|
||||
|
||||
explicit scoped_lock( spinlock & sp ): sp_( sp )
|
||||
{
|
||||
sp.lock();
|
||||
}
|
||||
|
||||
~scoped_lock()
|
||||
{
|
||||
sp_.unlock();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace boost
|
||||
|
||||
#define BOOST_DETAIL_SPINLOCK_INIT { false }
|
||||
|
||||
#endif // #ifndef BOOST_DETAIL_SPINLOCK_NT_HPP_INCLUDED
|
87
library/PolyVoxCore/include/boost/detail/spinlock_pool.hpp
Normal file
87
library/PolyVoxCore/include/boost/detail/spinlock_pool.hpp
Normal file
@ -0,0 +1,87 @@
|
||||
#ifndef BOOST_DETAIL_SPINLOCK_POOL_HPP_INCLUDED
|
||||
#define BOOST_DETAIL_SPINLOCK_POOL_HPP_INCLUDED
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
//
|
||||
// boost/detail/spinlock_pool.hpp
|
||||
//
|
||||
// Copyright (c) 2008 Peter Dimov
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
// spinlock_pool<0> is reserved for atomic<>, when/if it arrives
|
||||
// spinlock_pool<1> is reserved for shared_ptr reference counts
|
||||
// spinlock_pool<2> is reserved for shared_ptr atomic access
|
||||
//
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/detail/spinlock.hpp>
|
||||
#include <cstddef>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
template< int I > class spinlock_pool
|
||||
{
|
||||
private:
|
||||
|
||||
static spinlock pool_[ 41 ];
|
||||
|
||||
public:
|
||||
|
||||
static spinlock & spinlock_for( void const * pv )
|
||||
{
|
||||
std::size_t i = reinterpret_cast< std::size_t >( pv ) % 41;
|
||||
return pool_[ i ];
|
||||
}
|
||||
|
||||
class scoped_lock
|
||||
{
|
||||
private:
|
||||
|
||||
spinlock & sp_;
|
||||
|
||||
scoped_lock( scoped_lock const & );
|
||||
scoped_lock & operator=( scoped_lock const & );
|
||||
|
||||
public:
|
||||
|
||||
explicit scoped_lock( void const * pv ): sp_( spinlock_for( pv ) )
|
||||
{
|
||||
sp_.lock();
|
||||
}
|
||||
|
||||
~scoped_lock()
|
||||
{
|
||||
sp_.unlock();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
template< int I > spinlock spinlock_pool< I >::pool_[ 41 ] =
|
||||
{
|
||||
BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT,
|
||||
BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT,
|
||||
BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT,
|
||||
BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT,
|
||||
BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT,
|
||||
BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT,
|
||||
BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT,
|
||||
BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT, BOOST_DETAIL_SPINLOCK_INIT,
|
||||
BOOST_DETAIL_SPINLOCK_INIT
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace boost
|
||||
|
||||
#endif // #ifndef BOOST_DETAIL_SPINLOCK_POOL_HPP_INCLUDED
|
79
library/PolyVoxCore/include/boost/detail/spinlock_pt.hpp
Normal file
79
library/PolyVoxCore/include/boost/detail/spinlock_pt.hpp
Normal file
@ -0,0 +1,79 @@
|
||||
#ifndef BOOST_DETAIL_SPINLOCK_PT_HPP_INCLUDED
|
||||
#define BOOST_DETAIL_SPINLOCK_PT_HPP_INCLUDED
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
//
|
||||
// Copyright (c) 2008 Peter Dimov
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
#include <pthread.h>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
class spinlock
|
||||
{
|
||||
public:
|
||||
|
||||
pthread_mutex_t v_;
|
||||
|
||||
public:
|
||||
|
||||
bool try_lock()
|
||||
{
|
||||
return pthread_mutex_trylock( &v_ ) == 0;
|
||||
}
|
||||
|
||||
void lock()
|
||||
{
|
||||
pthread_mutex_lock( &v_ );
|
||||
}
|
||||
|
||||
void unlock()
|
||||
{
|
||||
pthread_mutex_unlock( &v_ );
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
class scoped_lock
|
||||
{
|
||||
private:
|
||||
|
||||
spinlock & sp_;
|
||||
|
||||
scoped_lock( scoped_lock const & );
|
||||
scoped_lock & operator=( scoped_lock const & );
|
||||
|
||||
public:
|
||||
|
||||
explicit scoped_lock( spinlock & sp ): sp_( sp )
|
||||
{
|
||||
sp.lock();
|
||||
}
|
||||
|
||||
~scoped_lock()
|
||||
{
|
||||
sp_.unlock();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace boost
|
||||
|
||||
#define BOOST_DETAIL_SPINLOCK_INIT { PTHREAD_MUTEX_INITIALIZER }
|
||||
|
||||
#endif // #ifndef BOOST_DETAIL_SPINLOCK_PT_HPP_INCLUDED
|
87
library/PolyVoxCore/include/boost/detail/spinlock_sync.hpp
Normal file
87
library/PolyVoxCore/include/boost/detail/spinlock_sync.hpp
Normal file
@ -0,0 +1,87 @@
|
||||
#ifndef BOOST_DETAIL_SPINLOCK_SYNC_HPP_INCLUDED
|
||||
#define BOOST_DETAIL_SPINLOCK_SYNC_HPP_INCLUDED
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
//
|
||||
// Copyright (c) 2008 Peter Dimov
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
#include <boost/detail/yield_k.hpp>
|
||||
|
||||
#if defined( __ia64__ ) && defined( __INTEL_COMPILER )
|
||||
# include <ia64intrin.h>
|
||||
#endif
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
class spinlock
|
||||
{
|
||||
public:
|
||||
|
||||
int v_;
|
||||
|
||||
public:
|
||||
|
||||
bool try_lock()
|
||||
{
|
||||
int r = __sync_lock_test_and_set( &v_, 1 );
|
||||
return r == 0;
|
||||
}
|
||||
|
||||
void lock()
|
||||
{
|
||||
for( unsigned k = 0; !try_lock(); ++k )
|
||||
{
|
||||
boost::detail::yield( k );
|
||||
}
|
||||
}
|
||||
|
||||
void unlock()
|
||||
{
|
||||
__sync_lock_release( &v_ );
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
class scoped_lock
|
||||
{
|
||||
private:
|
||||
|
||||
spinlock & sp_;
|
||||
|
||||
scoped_lock( scoped_lock const & );
|
||||
scoped_lock & operator=( scoped_lock const & );
|
||||
|
||||
public:
|
||||
|
||||
explicit scoped_lock( spinlock & sp ): sp_( sp )
|
||||
{
|
||||
sp.lock();
|
||||
}
|
||||
|
||||
~scoped_lock()
|
||||
{
|
||||
sp_.unlock();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace boost
|
||||
|
||||
#define BOOST_DETAIL_SPINLOCK_INIT {0}
|
||||
|
||||
#endif // #ifndef BOOST_DETAIL_SPINLOCK_SYNC_HPP_INCLUDED
|
113
library/PolyVoxCore/include/boost/detail/spinlock_w32.hpp
Normal file
113
library/PolyVoxCore/include/boost/detail/spinlock_w32.hpp
Normal file
@ -0,0 +1,113 @@
|
||||
#ifndef BOOST_DETAIL_SPINLOCK_W32_HPP_INCLUDED
|
||||
#define BOOST_DETAIL_SPINLOCK_W32_HPP_INCLUDED
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
//
|
||||
// Copyright (c) 2008 Peter Dimov
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0.
|
||||
// See accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
//
|
||||
|
||||
#include <boost/detail/interlocked.hpp>
|
||||
#include <boost/detail/yield_k.hpp>
|
||||
|
||||
// BOOST_COMPILER_FENCE
|
||||
|
||||
#if defined(__INTEL_COMPILER)
|
||||
|
||||
#define BOOST_COMPILER_FENCE __memory_barrier();
|
||||
|
||||
#elif defined( _MSC_VER ) && _MSC_VER >= 1310
|
||||
|
||||
extern "C" void _ReadWriteBarrier();
|
||||
#pragma intrinsic( _ReadWriteBarrier )
|
||||
|
||||
#define BOOST_COMPILER_FENCE _ReadWriteBarrier();
|
||||
|
||||
#elif defined(__GNUC__)
|
||||
|
||||
#define BOOST_COMPILER_FENCE __asm__ __volatile__( "" : : : "memory" );
|
||||
|
||||
#else
|
||||
|
||||
#define BOOST_COMPILER_FENCE
|
||||
|
||||
#endif
|
||||
|
||||
//
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
class spinlock
|
||||
{
|
||||
public:
|
||||
|
||||
long v_;
|
||||
|
||||
public:
|
||||
|
||||
bool try_lock()
|
||||
{
|
||||
long r = BOOST_INTERLOCKED_EXCHANGE( &v_, 1 );
|
||||
|
||||
BOOST_COMPILER_FENCE
|
||||
|
||||
return r == 0;
|
||||
}
|
||||
|
||||
void lock()
|
||||
{
|
||||
for( unsigned k = 0; !try_lock(); ++k )
|
||||
{
|
||||
boost::detail::yield( k );
|
||||
}
|
||||
}
|
||||
|
||||
void unlock()
|
||||
{
|
||||
BOOST_COMPILER_FENCE
|
||||
*const_cast< long volatile* >( &v_ ) = 0;
|
||||
}
|
||||
|
||||
public:
|
||||
|
||||
class scoped_lock
|
||||
{
|
||||
private:
|
||||
|
||||
spinlock & sp_;
|
||||
|
||||
scoped_lock( scoped_lock const & );
|
||||
scoped_lock & operator=( scoped_lock const & );
|
||||
|
||||
public:
|
||||
|
||||
explicit scoped_lock( spinlock & sp ): sp_( sp )
|
||||
{
|
||||
sp.lock();
|
||||
}
|
||||
|
||||
~scoped_lock()
|
||||
{
|
||||
sp_.unlock();
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
} // namespace boost
|
||||
|
||||
#define BOOST_DETAIL_SPINLOCK_INIT {0}
|
||||
|
||||
#endif // #ifndef BOOST_DETAIL_SPINLOCK_W32_HPP_INCLUDED
|
@ -0,0 +1,74 @@
|
||||
//-----------------------------------------------------------------------------
|
||||
// boost detail/templated_streams.hpp header file
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
//-----------------------------------------------------------------------------
|
||||
//
|
||||
// Copyright (c) 2003
|
||||
// Eric Friedman
|
||||
//
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_DETAIL_TEMPLATED_STREAMS_HPP
|
||||
#define BOOST_DETAIL_TEMPLATED_STREAMS_HPP
|
||||
|
||||
#include "boost/config.hpp"
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// (detail) BOOST_TEMPLATED_STREAM_* macros
|
||||
//
|
||||
// Provides workaround platforms without stream class templates.
|
||||
//
|
||||
|
||||
#if !defined(BOOST_NO_STD_LOCALE)
|
||||
|
||||
#define BOOST_TEMPLATED_STREAM_TEMPLATE(E,T) \
|
||||
template < typename E , typename T >
|
||||
|
||||
#define BOOST_TEMPLATED_STREAM_TEMPLATE_ALLOC(E,T,A) \
|
||||
template < typename E , typename T , typename A >
|
||||
|
||||
#define BOOST_TEMPLATED_STREAM_ARGS(E,T) \
|
||||
typename E , typename T
|
||||
|
||||
#define BOOST_TEMPLATED_STREAM_ARGS_ALLOC(E,T,A) \
|
||||
typename E , typename T , typename A
|
||||
|
||||
#define BOOST_TEMPLATED_STREAM_COMMA ,
|
||||
|
||||
#define BOOST_TEMPLATED_STREAM_ELEM(E) E
|
||||
#define BOOST_TEMPLATED_STREAM_TRAITS(T) T
|
||||
#define BOOST_TEMPLATED_STREAM_ALLOC(A) A
|
||||
|
||||
#define BOOST_TEMPLATED_STREAM(X,E,T) \
|
||||
BOOST_JOIN(std::basic_,X)< E , T >
|
||||
|
||||
#define BOOST_TEMPLATED_STREAM_WITH_ALLOC(X,E,T,A) \
|
||||
BOOST_JOIN(std::basic_,X)< E , T , A >
|
||||
|
||||
#else // defined(BOOST_NO_STD_LOCALE)
|
||||
|
||||
#define BOOST_TEMPLATED_STREAM_TEMPLATE(E,T) /**/
|
||||
|
||||
#define BOOST_TEMPLATED_STREAM_TEMPLATE_ALLOC(E,T,A) /**/
|
||||
|
||||
#define BOOST_TEMPLATED_STREAM_ARGS(E,T) /**/
|
||||
|
||||
#define BOOST_TEMPLATED_STREAM_ARGS_ALLOC(E,T,A) /**/
|
||||
|
||||
#define BOOST_TEMPLATED_STREAM_COMMA /**/
|
||||
|
||||
#define BOOST_TEMPLATED_STREAM_ELEM(E) char
|
||||
#define BOOST_TEMPLATED_STREAM_TRAITS(T) std::char_traits<char>
|
||||
#define BOOST_TEMPLATED_STREAM_ALLOC(A) std::allocator<char>
|
||||
|
||||
#define BOOST_TEMPLATED_STREAM(X,E,T) \
|
||||
std::X
|
||||
|
||||
#define BOOST_TEMPLATED_STREAM_WITH_ALLOC(X,E,T,A) \
|
||||
std::X
|
||||
|
||||
#endif // BOOST_NO_STD_LOCALE
|
||||
|
||||
#endif // BOOST_DETAIL_TEMPLATED_STREAMS_HPP
|
197
library/PolyVoxCore/include/boost/detail/utf8_codecvt_facet.hpp
Normal file
197
library/PolyVoxCore/include/boost/detail/utf8_codecvt_facet.hpp
Normal file
@ -0,0 +1,197 @@
|
||||
// Copyright (c) 2001 Ronald Garcia, Indiana University (garcia@osl.iu.edu)
|
||||
// Andrew Lumsdaine, Indiana University (lums@osl.iu.edu).
|
||||
// Distributed under the Boost Software License, Version 1.0. (See accompany-
|
||||
// ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
|
||||
|
||||
#ifndef BOOST_UTF8_CODECVT_FACET_HPP
|
||||
#define BOOST_UTF8_CODECVT_FACET_HPP
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
/////////1/////////2/////////3/////////4/////////5/////////6/////////7/////////8
|
||||
// utf8_codecvt_facet.hpp
|
||||
|
||||
// This header defines class utf8_codecvt_facet, derived fro
|
||||
// std::codecvt<wchar_t, char>, which can be used to convert utf8 data in
|
||||
// files into wchar_t strings in the application.
|
||||
//
|
||||
// The header is NOT STANDALONE, and is not to be included by the USER.
|
||||
// There are at least two libraries which want to use this functionality, and
|
||||
// we want to avoid code duplication. It would be possible to create utf8
|
||||
// library, but:
|
||||
// - this requires review process first
|
||||
// - in the case, when linking the a library which uses utf8
|
||||
// (say 'program_options'), user should also link to the utf8 library.
|
||||
// This seems inconvenient, and asking a user to link to an unrevieved
|
||||
// library is strange.
|
||||
// Until the above points are fixed, a library which wants to use utf8 must:
|
||||
// - include this header from one of it's headers or sources
|
||||
// - include the corresponding .cpp file from one of the sources
|
||||
// - before including either file, the library must define
|
||||
// - BOOST_UTF8_BEGIN_NAMESPACE to the namespace declaration that must be used
|
||||
// - BOOST_UTF8_END_NAMESPACE to the code to close the previous namespace
|
||||
// - declaration.
|
||||
// - BOOST_UTF8_DECL -- to the code which must be used for all 'exportable'
|
||||
// symbols.
|
||||
//
|
||||
// For example, program_options library might contain:
|
||||
// #define BOOST_UTF8_BEGIN_NAMESPACE <backslash character>
|
||||
// namespace boost { namespace program_options {
|
||||
// #define BOOST_UTF8_END_NAMESPACE }}
|
||||
// #define BOOST_UTF8_DECL BOOST_PROGRAM_OPTIONS_DECL
|
||||
// #include "../../detail/utf8/utf8_codecvt.cpp"
|
||||
//
|
||||
// Essentially, each library will have its own copy of utf8 code, in
|
||||
// different namespaces.
|
||||
|
||||
// Note:(Robert Ramey). I have made the following alterations in the original
|
||||
// code.
|
||||
// a) Rendered utf8_codecvt<wchar_t, char> with using templates
|
||||
// b) Move longer functions outside class definition to prevent inlining
|
||||
// and make code smaller
|
||||
// c) added on a derived class to permit translation to/from current
|
||||
// locale to utf8
|
||||
|
||||
// See http://www.boost.org for updates, documentation, and revision history.
|
||||
|
||||
// archives stored as text - note these ar templated on the basic
|
||||
// stream templates to accommodate wide (and other?) kind of characters
|
||||
//
|
||||
// note the fact that on libraries without wide characters, ostream is
|
||||
// is not a specialization of basic_ostream which in fact is not defined
|
||||
// in such cases. So we can't use basic_ostream<OStream::char_type> but rather
|
||||
// use two template parameters
|
||||
//
|
||||
// utf8_codecvt_facet
|
||||
// This is an implementation of a std::codecvt facet for translating
|
||||
// from UTF-8 externally to UCS-4. Note that this is not tied to
|
||||
// any specific types in order to allow customization on platforms
|
||||
// where wchar_t is not big enough.
|
||||
//
|
||||
// NOTES: The current implementation jumps through some unpleasant hoops in
|
||||
// order to deal with signed character types. As a std::codecvt_base::result,
|
||||
// it is necessary for the ExternType to be convertible to unsigned char.
|
||||
// I chose not to tie the extern_type explicitly to char. But if any combination
|
||||
// of types other than <wchar_t,char_t> is used, then std::codecvt must be
|
||||
// specialized on those types for this to work.
|
||||
|
||||
#include <locale>
|
||||
// for mbstate_t
|
||||
#include <wchar.h>
|
||||
// for std::size_t
|
||||
#include <cstddef>
|
||||
|
||||
#include <boost/config.hpp>
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
namespace std {
|
||||
#if defined(__LIBCOMO__)
|
||||
using ::mbstate_t;
|
||||
#elif defined(BOOST_DINKUMWARE_STDLIB) && !defined(__BORLANDC__)
|
||||
using ::mbstate_t;
|
||||
#elif defined(__SGI_STL_PORT)
|
||||
#elif defined(BOOST_NO_STDC_NAMESPACE)
|
||||
using ::mbstate_t;
|
||||
using ::codecvt;
|
||||
#endif
|
||||
} // namespace std
|
||||
|
||||
#if !defined(__MSL_CPP__) && !defined(__LIBCOMO__)
|
||||
#define BOOST_CODECVT_DO_LENGTH_CONST const
|
||||
#else
|
||||
#define BOOST_CODECVT_DO_LENGTH_CONST
|
||||
#endif
|
||||
|
||||
// maximum lenght of a multibyte string
|
||||
#define MB_LENGTH_MAX 8
|
||||
|
||||
BOOST_UTF8_BEGIN_NAMESPACE
|
||||
|
||||
struct BOOST_UTF8_DECL utf8_codecvt_facet :
|
||||
public std::codecvt<wchar_t, char, std::mbstate_t>
|
||||
{
|
||||
public:
|
||||
explicit utf8_codecvt_facet(std::size_t no_locale_manage=0)
|
||||
: std::codecvt<wchar_t, char, std::mbstate_t>(no_locale_manage)
|
||||
{}
|
||||
protected:
|
||||
virtual std::codecvt_base::result do_in(
|
||||
std::mbstate_t& state,
|
||||
const char * from,
|
||||
const char * from_end,
|
||||
const char * & from_next,
|
||||
wchar_t * to,
|
||||
wchar_t * to_end,
|
||||
wchar_t*& to_next
|
||||
) const;
|
||||
|
||||
virtual std::codecvt_base::result do_out(
|
||||
std::mbstate_t & state, const wchar_t * from,
|
||||
const wchar_t * from_end, const wchar_t* & from_next,
|
||||
char * to, char * to_end, char * & to_next
|
||||
) const;
|
||||
|
||||
bool invalid_continuing_octet(unsigned char octet_1) const {
|
||||
return (octet_1 < 0x80|| 0xbf< octet_1);
|
||||
}
|
||||
|
||||
bool invalid_leading_octet(unsigned char octet_1) const {
|
||||
return (0x7f < octet_1 && octet_1 < 0xc0) ||
|
||||
(octet_1 > 0xfd);
|
||||
}
|
||||
|
||||
// continuing octets = octets except for the leading octet
|
||||
static unsigned int get_cont_octet_count(unsigned char lead_octet) {
|
||||
return get_octet_count(lead_octet) - 1;
|
||||
}
|
||||
|
||||
static unsigned int get_octet_count(unsigned char lead_octet);
|
||||
|
||||
// How many "continuing octets" will be needed for this word
|
||||
// == total octets - 1.
|
||||
int get_cont_octet_out_count(wchar_t word) const ;
|
||||
|
||||
virtual bool do_always_noconv() const throw() { return false; }
|
||||
|
||||
// UTF-8 isn't really stateful since we rewind on partial conversions
|
||||
virtual std::codecvt_base::result do_unshift(
|
||||
std::mbstate_t&,
|
||||
char * from,
|
||||
char * /*to*/,
|
||||
char * & next
|
||||
) const
|
||||
{
|
||||
next = from;
|
||||
return ok;
|
||||
}
|
||||
|
||||
virtual int do_encoding() const throw() {
|
||||
const int variable_byte_external_encoding=0;
|
||||
return variable_byte_external_encoding;
|
||||
}
|
||||
|
||||
// How many char objects can I process to get <= max_limit
|
||||
// wchar_t objects?
|
||||
virtual int do_length(
|
||||
BOOST_CODECVT_DO_LENGTH_CONST std::mbstate_t &,
|
||||
const char * from,
|
||||
const char * from_end,
|
||||
std::size_t max_limit
|
||||
#if BOOST_WORKAROUND(__IBMCPP__, BOOST_TESTED_AT(600))
|
||||
) const throw();
|
||||
#else
|
||||
) const;
|
||||
#endif
|
||||
|
||||
// Largest possible value do_length(state,from,from_end,1) could return.
|
||||
virtual int do_max_length() const throw () {
|
||||
return 6; // largest UTF-8 encoding of a UCS-4 character
|
||||
}
|
||||
};
|
||||
|
||||
BOOST_UTF8_END_NAMESPACE
|
||||
|
||||
#endif // BOOST_UTF8_CODECVT_FACET_HPP
|
262
library/PolyVoxCore/include/boost/detail/workaround.hpp
Normal file
262
library/PolyVoxCore/include/boost/detail/workaround.hpp
Normal file
@ -0,0 +1,262 @@
|
||||
// Copyright David Abrahams 2002.
|
||||
// Distributed under the Boost Software License, Version 1.0. (See
|
||||
// accompanying file LICENSE_1_0.txt or copy at
|
||||
// http://www.boost.org/LICENSE_1_0.txt)
|
||||
#ifndef WORKAROUND_DWA2002126_HPP
|
||||
# define WORKAROUND_DWA2002126_HPP
|
||||
|
||||
// Compiler/library version workaround macro
|
||||
//
|
||||
// Usage:
|
||||
//
|
||||
// #if BOOST_WORKAROUND(BOOST_MSVC, < 1300)
|
||||
// // workaround for eVC4 and VC6
|
||||
// ... // workaround code here
|
||||
// #endif
|
||||
//
|
||||
// When BOOST_STRICT_CONFIG is defined, expands to 0. Otherwise, the
|
||||
// first argument must be undefined or expand to a numeric
|
||||
// value. The above expands to:
|
||||
//
|
||||
// (BOOST_MSVC) != 0 && (BOOST_MSVC) < 1300
|
||||
//
|
||||
// When used for workarounds that apply to the latest known version
|
||||
// and all earlier versions of a compiler, the following convention
|
||||
// should be observed:
|
||||
//
|
||||
// #if BOOST_WORKAROUND(BOOST_MSVC, BOOST_TESTED_AT(1301))
|
||||
//
|
||||
// The version number in this case corresponds to the last version in
|
||||
// which the workaround was known to have been required. When
|
||||
// BOOST_DETECT_OUTDATED_WORKAROUNDS is not the defined, the macro
|
||||
// BOOST_TESTED_AT(x) expands to "!= 0", which effectively activates
|
||||
// the workaround for any version of the compiler. When
|
||||
// BOOST_DETECT_OUTDATED_WORKAROUNDS is defined, a compiler warning or
|
||||
// error will be issued if the compiler version exceeds the argument
|
||||
// to BOOST_TESTED_AT(). This can be used to locate workarounds which
|
||||
// may be obsoleted by newer versions.
|
||||
|
||||
# ifndef BOOST_STRICT_CONFIG
|
||||
|
||||
#include <boost/config.hpp>
|
||||
|
||||
#ifndef __BORLANDC__
|
||||
#define __BORLANDC___WORKAROUND_GUARD 1
|
||||
#else
|
||||
#define __BORLANDC___WORKAROUND_GUARD 0
|
||||
#endif
|
||||
#ifndef __CODEGEARC__
|
||||
#define __CODEGEARC___WORKAROUND_GUARD 1
|
||||
#else
|
||||
#define __CODEGEARC___WORKAROUND_GUARD 0
|
||||
#endif
|
||||
#ifndef _MSC_VER
|
||||
#define _MSC_VER_WORKAROUND_GUARD 1
|
||||
#else
|
||||
#define _MSC_VER_WORKAROUND_GUARD 0
|
||||
#endif
|
||||
#ifndef _MSC_FULL_VER
|
||||
#define _MSC_FULL_VER_WORKAROUND_GUARD 1
|
||||
#else
|
||||
#define _MSC_FULL_VER_WORKAROUND_GUARD 0
|
||||
#endif
|
||||
#ifndef BOOST_MSVC
|
||||
#define BOOST_MSVC_WORKAROUND_GUARD 1
|
||||
#else
|
||||
#define BOOST_MSVC_WORKAROUND_GUARD 0
|
||||
#endif
|
||||
#ifndef __GNUC__
|
||||
#define __GNUC___WORKAROUND_GUARD 1
|
||||
#else
|
||||
#define __GNUC___WORKAROUND_GUARD 0
|
||||
#endif
|
||||
#ifndef __GNUC_MINOR__
|
||||
#define __GNUC_MINOR___WORKAROUND_GUARD 1
|
||||
#else
|
||||
#define __GNUC_MINOR___WORKAROUND_GUARD 0
|
||||
#endif
|
||||
#ifndef __GNUC_PATCHLEVEL__
|
||||
#define __GNUC_PATCHLEVEL___WORKAROUND_GUARD 1
|
||||
#else
|
||||
#define __GNUC_PATCHLEVEL___WORKAROUND_GUARD 0
|
||||
#endif
|
||||
#ifndef __IBMCPP__
|
||||
#define __IBMCPP___WORKAROUND_GUARD 1
|
||||
#else
|
||||
#define __IBMCPP___WORKAROUND_GUARD 0
|
||||
#endif
|
||||
#ifndef __SUNPRO_CC
|
||||
#define __SUNPRO_CC_WORKAROUND_GUARD 1
|
||||
#else
|
||||
#define __SUNPRO_CC_WORKAROUND_GUARD 0
|
||||
#endif
|
||||
#ifndef __DECCXX_VER
|
||||
#define __DECCXX_VER_WORKAROUND_GUARD 1
|
||||
#else
|
||||
#define __DECCXX_VER_WORKAROUND_GUARD 0
|
||||
#endif
|
||||
#ifndef __MWERKS__
|
||||
#define __MWERKS___WORKAROUND_GUARD 1
|
||||
#else
|
||||
#define __MWERKS___WORKAROUND_GUARD 0
|
||||
#endif
|
||||
#ifndef __EDG__
|
||||
#define __EDG___WORKAROUND_GUARD 1
|
||||
#else
|
||||
#define __EDG___WORKAROUND_GUARD 0
|
||||
#endif
|
||||
#ifndef __EDG_VERSION__
|
||||
#define __EDG_VERSION___WORKAROUND_GUARD 1
|
||||
#else
|
||||
#define __EDG_VERSION___WORKAROUND_GUARD 0
|
||||
#endif
|
||||
#ifndef __HP_aCC
|
||||
#define __HP_aCC_WORKAROUND_GUARD 1
|
||||
#else
|
||||
#define __HP_aCC_WORKAROUND_GUARD 0
|
||||
#endif
|
||||
#ifndef __hpxstd98
|
||||
#define __hpxstd98_WORKAROUND_GUARD 1
|
||||
#else
|
||||
#define __hpxstd98_WORKAROUND_GUARD 0
|
||||
#endif
|
||||
#ifndef _CRAYC
|
||||
#define _CRAYC_WORKAROUND_GUARD 1
|
||||
#else
|
||||
#define _CRAYC_WORKAROUND_GUARD 0
|
||||
#endif
|
||||
#ifndef __DMC__
|
||||
#define __DMC___WORKAROUND_GUARD 1
|
||||
#else
|
||||
#define __DMC___WORKAROUND_GUARD 0
|
||||
#endif
|
||||
#ifndef MPW_CPLUS
|
||||
#define MPW_CPLUS_WORKAROUND_GUARD 1
|
||||
#else
|
||||
#define MPW_CPLUS_WORKAROUND_GUARD 0
|
||||
#endif
|
||||
#ifndef __COMO__
|
||||
#define __COMO___WORKAROUND_GUARD 1
|
||||
#else
|
||||
#define __COMO___WORKAROUND_GUARD 0
|
||||
#endif
|
||||
#ifndef __COMO_VERSION__
|
||||
#define __COMO_VERSION___WORKAROUND_GUARD 1
|
||||
#else
|
||||
#define __COMO_VERSION___WORKAROUND_GUARD 0
|
||||
#endif
|
||||
#ifndef __INTEL_COMPILER
|
||||
#define __INTEL_COMPILER_WORKAROUND_GUARD 1
|
||||
#else
|
||||
#define __INTEL_COMPILER_WORKAROUND_GUARD 0
|
||||
#endif
|
||||
#ifndef __ICL
|
||||
#define __ICL_WORKAROUND_GUARD 1
|
||||
#else
|
||||
#define __ICL_WORKAROUND_GUARD 0
|
||||
#endif
|
||||
#ifndef _COMPILER_VERSION
|
||||
#define _COMPILER_VERSION_WORKAROUND_GUARD 1
|
||||
#else
|
||||
#define _COMPILER_VERSION_WORKAROUND_GUARD 0
|
||||
#endif
|
||||
|
||||
#ifndef _RWSTD_VER
|
||||
#define _RWSTD_VER_WORKAROUND_GUARD 1
|
||||
#else
|
||||
#define _RWSTD_VER_WORKAROUND_GUARD 0
|
||||
#endif
|
||||
#ifndef BOOST_RWSTD_VER
|
||||
#define BOOST_RWSTD_VER_WORKAROUND_GUARD 1
|
||||
#else
|
||||
#define BOOST_RWSTD_VER_WORKAROUND_GUARD 0
|
||||
#endif
|
||||
#ifndef __GLIBCPP__
|
||||
#define __GLIBCPP___WORKAROUND_GUARD 1
|
||||
#else
|
||||
#define __GLIBCPP___WORKAROUND_GUARD 0
|
||||
#endif
|
||||
#ifndef _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC
|
||||
#define _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC_WORKAROUND_GUARD 1
|
||||
#else
|
||||
#define _GLIBCXX_USE_C99_FP_MACROS_DYNAMIC_WORKAROUND_GUARD 0
|
||||
#endif
|
||||
#ifndef __SGI_STL_PORT
|
||||
#define __SGI_STL_PORT_WORKAROUND_GUARD 1
|
||||
#else
|
||||
#define __SGI_STL_PORT_WORKAROUND_GUARD 0
|
||||
#endif
|
||||
#ifndef _STLPORT_VERSION
|
||||
#define _STLPORT_VERSION_WORKAROUND_GUARD 1
|
||||
#else
|
||||
#define _STLPORT_VERSION_WORKAROUND_GUARD 0
|
||||
#endif
|
||||
#ifndef __LIBCOMO_VERSION__
|
||||
#define __LIBCOMO_VERSION___WORKAROUND_GUARD 1
|
||||
#else
|
||||
#define __LIBCOMO_VERSION___WORKAROUND_GUARD 0
|
||||
#endif
|
||||
#ifndef _CPPLIB_VER
|
||||
#define _CPPLIB_VER_WORKAROUND_GUARD 1
|
||||
#else
|
||||
#define _CPPLIB_VER_WORKAROUND_GUARD 0
|
||||
#endif
|
||||
|
||||
#ifndef BOOST_INTEL_CXX_VERSION
|
||||
#define BOOST_INTEL_CXX_VERSION_WORKAROUND_GUARD 1
|
||||
#else
|
||||
#define BOOST_INTEL_CXX_VERSION_WORKAROUND_GUARD 0
|
||||
#endif
|
||||
#ifndef BOOST_INTEL_WIN
|
||||
#define BOOST_INTEL_WIN_WORKAROUND_GUARD 1
|
||||
#else
|
||||
#define BOOST_INTEL_WIN_WORKAROUND_GUARD 0
|
||||
#endif
|
||||
#ifndef BOOST_DINKUMWARE_STDLIB
|
||||
#define BOOST_DINKUMWARE_STDLIB_WORKAROUND_GUARD 1
|
||||
#else
|
||||
#define BOOST_DINKUMWARE_STDLIB_WORKAROUND_GUARD 0
|
||||
#endif
|
||||
#ifndef BOOST_INTEL
|
||||
#define BOOST_INTEL_WORKAROUND_GUARD 1
|
||||
#else
|
||||
#define BOOST_INTEL_WORKAROUND_GUARD 0
|
||||
#endif
|
||||
// Always define to zero, if it's used it'll be defined my MPL:
|
||||
#define BOOST_MPL_CFG_GCC_WORKAROUND_GUARD 0
|
||||
|
||||
# define BOOST_WORKAROUND(symbol, test) \
|
||||
((symbol ## _WORKAROUND_GUARD + 0 == 0) && \
|
||||
(symbol != 0) && (1 % (( (symbol test) ) + 1)))
|
||||
// ^ ^ ^ ^
|
||||
// The extra level of parenthesis nesting above, along with the
|
||||
// BOOST_OPEN_PAREN indirection below, is required to satisfy the
|
||||
// broken preprocessor in MWCW 8.3 and earlier.
|
||||
//
|
||||
// The basic mechanism works as follows:
|
||||
// (symbol test) + 1 => if (symbol test) then 2 else 1
|
||||
// 1 % ((symbol test) + 1) => if (symbol test) then 1 else 0
|
||||
//
|
||||
// The complication with % is for cooperation with BOOST_TESTED_AT().
|
||||
// When "test" is BOOST_TESTED_AT(x) and
|
||||
// BOOST_DETECT_OUTDATED_WORKAROUNDS is #defined,
|
||||
//
|
||||
// symbol test => if (symbol <= x) then 1 else -1
|
||||
// (symbol test) + 1 => if (symbol <= x) then 2 else 0
|
||||
// 1 % ((symbol test) + 1) => if (symbol <= x) then 1 else divide-by-zero
|
||||
//
|
||||
|
||||
# ifdef BOOST_DETECT_OUTDATED_WORKAROUNDS
|
||||
# define BOOST_OPEN_PAREN (
|
||||
# define BOOST_TESTED_AT(value) > value) ?(-1): BOOST_OPEN_PAREN 1
|
||||
# else
|
||||
# define BOOST_TESTED_AT(value) != ((value)-(value))
|
||||
# endif
|
||||
|
||||
# else
|
||||
|
||||
# define BOOST_WORKAROUND(symbol, test) 0
|
||||
|
||||
# endif
|
||||
|
||||
#endif // WORKAROUND_DWA2002126_HPP
|
149
library/PolyVoxCore/include/boost/detail/yield_k.hpp
Normal file
149
library/PolyVoxCore/include/boost/detail/yield_k.hpp
Normal file
@ -0,0 +1,149 @@
|
||||
#ifndef BOOST_DETAIL_YIELD_K_HPP_INCLUDED
|
||||
#define BOOST_DETAIL_YIELD_K_HPP_INCLUDED
|
||||
|
||||
// MS compatible compilers support #pragma once
|
||||
|
||||
#if defined(_MSC_VER) && (_MSC_VER >= 1020)
|
||||
# pragma once
|
||||
#endif
|
||||
|
||||
//
|
||||
// boost/detail/yield_k.hpp
|
||||
//
|
||||
// Copyright (c) 2008 Peter Dimov
|
||||
//
|
||||
// void yield( unsigned k );
|
||||
//
|
||||
// Typical use:
|
||||
//
|
||||
// for( unsigned k = 0; !try_lock(); ++k ) yield( k );
|
||||
//
|
||||
// Distributed under the 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>
|
||||
|
||||
// BOOST_SMT_PAUSE
|
||||
|
||||
#if defined(_MSC_VER) && _MSC_VER >= 1310 && ( defined(_M_IX86) || defined(_M_X64) )
|
||||
|
||||
extern "C" void _mm_pause();
|
||||
#pragma intrinsic( _mm_pause )
|
||||
|
||||
#define BOOST_SMT_PAUSE _mm_pause();
|
||||
|
||||
#elif defined(__GNUC__) && ( defined(__i386__) || defined(__x86_64__) )
|
||||
|
||||
#define BOOST_SMT_PAUSE __asm__ __volatile__( "rep; nop" : : : "memory" );
|
||||
|
||||
#endif
|
||||
|
||||
//
|
||||
|
||||
#if defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || defined( __CYGWIN__ )
|
||||
|
||||
#if defined( BOOST_USE_WINDOWS_H )
|
||||
# include <windows.h>
|
||||
#endif
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
#if !defined( BOOST_USE_WINDOWS_H )
|
||||
extern "C" void __stdcall Sleep( unsigned ms );
|
||||
#endif
|
||||
|
||||
inline void yield( unsigned k )
|
||||
{
|
||||
if( k < 4 )
|
||||
{
|
||||
}
|
||||
#if defined( BOOST_SMT_PAUSE )
|
||||
else if( k < 16 )
|
||||
{
|
||||
BOOST_SMT_PAUSE
|
||||
}
|
||||
#endif
|
||||
else if( k < 32 )
|
||||
{
|
||||
Sleep( 0 );
|
||||
}
|
||||
else
|
||||
{
|
||||
Sleep( 1 );
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#elif defined( BOOST_HAS_PTHREADS )
|
||||
|
||||
#include <sched.h>
|
||||
#include <time.h>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
inline void yield( unsigned k )
|
||||
{
|
||||
if( k < 4 )
|
||||
{
|
||||
}
|
||||
#if defined( BOOST_SMT_PAUSE )
|
||||
else if( k < 16 )
|
||||
{
|
||||
BOOST_SMT_PAUSE
|
||||
}
|
||||
#endif
|
||||
else if( k < 32 || k & 1 )
|
||||
{
|
||||
sched_yield();
|
||||
}
|
||||
else
|
||||
{
|
||||
// g++ -Wextra warns on {} or {0}
|
||||
struct timespec rqtp = { 0, 0 };
|
||||
|
||||
// POSIX says that timespec has tv_sec and tv_nsec
|
||||
// But it doesn't guarantee order or placement
|
||||
|
||||
rqtp.tv_sec = 0;
|
||||
rqtp.tv_nsec = 1000;
|
||||
|
||||
nanosleep( &rqtp, 0 );
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#else
|
||||
|
||||
namespace boost
|
||||
{
|
||||
|
||||
namespace detail
|
||||
{
|
||||
|
||||
inline void yield( unsigned )
|
||||
{
|
||||
}
|
||||
|
||||
} // namespace detail
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
|
||||
#endif // #ifndef BOOST_DETAIL_YIELD_K_HPP_INCLUDED
|
Reference in New Issue
Block a user