Updating to Boost 1.53

This commit is contained in:
Strahinja Val Markovic 2013-02-13 20:03:52 -08:00
parent 5fad9564d1
commit 0a46a6ec12
213 changed files with 13029 additions and 7683 deletions

View File

@ -84,7 +84,7 @@ endif()
# that prevents this from happening. Also present in cpp/ycm/CMakeLists.txt. # that prevents this from happening. Also present in cpp/ycm/CMakeLists.txt.
# See here for more details: https://svn.boost.org/trac/boost/ticket/7671 # See here for more details: https://svn.boost.org/trac/boost/ticket/7671
# TODO: remove this when it's fixed upstream (probably boost 1.53). # TODO: remove this when it's fixed upstream (probably boost 1.53).
add_definitions( -DBOOST_THREAD_DONT_USE_CHRONO ) #add_definitions( -DBOOST_THREAD_DONT_USE_CHRONO )
if( MSVC ) if( MSVC )
# BOOST_PYTHON_SOURCE makes boost use the correct __declspec and # BOOST_PYTHON_SOURCE makes boost use the correct __declspec and

View File

@ -56,7 +56,7 @@ namespace boost {
// Copy the beginning of the sequence // Copy the beginning of the sequence
Output = std::copy( ::boost::begin(Input), ::boost::begin(M), Output ); Output = std::copy( ::boost::begin(Input), ::boost::begin(M), Output );
// Format find result // Format find result
// Copy formated result // Copy formatted result
Output = std::copy( ::boost::begin(M.format_result()), ::boost::end(M.format_result()), Output ); Output = std::copy( ::boost::begin(M.format_result()), ::boost::end(M.format_result()), Output );
// Copy the rest of the sequence // Copy the rest of the sequence
Output = std::copy( M.end(), ::boost::end(Input), Output ); Output = std::copy( M.end(), ::boost::end(Input), Output );
@ -118,11 +118,11 @@ namespace boost {
InputT Output; InputT Output;
// Copy the beginning of the sequence // Copy the beginning of the sequence
insert( Output, ::boost::end(Output), ::boost::begin(Input), M.begin() ); boost::algorithm::detail::insert( Output, ::boost::end(Output), ::boost::begin(Input), M.begin() );
// Copy formated result // Copy formatted result
insert( Output, ::boost::end(Output), M.format_result() ); boost::algorithm::detail::insert( Output, ::boost::end(Output), M.format_result() );
// Copy the rest of the sequence // Copy the rest of the sequence
insert( Output, ::boost::end(Output), M.end(), ::boost::end(Input) ); boost::algorithm::detail::insert( Output, ::boost::end(Output), M.end(), ::boost::end(Input) );
return Output; return Output;
} }

View File

@ -58,7 +58,7 @@ namespace boost {
{ {
// Copy the beginning of the sequence // Copy the beginning of the sequence
Output = std::copy( LastMatch, M.begin(), Output ); Output = std::copy( LastMatch, M.begin(), Output );
// Copy formated result // Copy formatted result
Output = std::copy( ::boost::begin(M.format_result()), ::boost::end(M.format_result()), Output ); Output = std::copy( ::boost::begin(M.format_result()), ::boost::end(M.format_result()), Output );
// Proceed to the next match // Proceed to the next match
@ -134,9 +134,9 @@ namespace boost {
while( M ) while( M )
{ {
// Copy the beginning of the sequence // Copy the beginning of the sequence
insert( Output, ::boost::end(Output), LastMatch, M.begin() ); boost::algorithm::detail::insert( Output, ::boost::end(Output), LastMatch, M.begin() );
// Copy formated result // Copy formatted result
insert( Output, ::boost::end(Output), M.format_result() ); boost::algorithm::detail::insert( Output, ::boost::end(Output), M.format_result() );
// Proceed to the next match // Proceed to the next match
LastMatch=M.end(); LastMatch=M.end();
@ -218,7 +218,7 @@ namespace boost {
// Adjust search iterator // Adjust search iterator
SearchIt=M.end(); SearchIt=M.end();
// Copy formated replace to the storage // Copy formatted replace to the storage
::boost::algorithm::detail::copy_to_storage( Storage, M.format_result() ); ::boost::algorithm::detail::copy_to_storage( Storage, M.format_result() );
// Find range for a next match // Find range for a next match

View File

@ -92,7 +92,7 @@ namespace boost {
// find last functor -----------------------------------------------// // find last functor -----------------------------------------------//
// find the last match a subseqeunce in the sequence ( functor ) // find the last match a subsequence in the sequence ( functor )
/* /*
Returns a pair <begin,end> marking the subsequence in the sequence. Returns a pair <begin,end> marking the subsequence in the sequence.
If the find fails, returns <End,End> If the find fails, returns <End,End>

View File

@ -60,14 +60,14 @@ namespace boost {
return *this; return *this;
} }
// Match result retrival // Match result retrieval
const match_results_type& match_results() const const match_results_type& match_results() const
{ {
return m_MatchResults; return m_MatchResults;
} }
private: private:
// Saved matchresult // Saved match result
match_results_type m_MatchResults; match_results_type m_MatchResults;
}; };

View File

@ -86,7 +86,7 @@ namespace boost {
//! Find first algorithm ( case insensitive ) //! Find first algorithm ( case insensitive )
/*! /*!
Search for the first occurence of the substring in the input. Search for the first occurrence of the substring in the input.
Searching is case insensitive. Searching is case insensitive.
\param Input A string which will be searched. \param Input A string which will be searched.
@ -293,7 +293,7 @@ namespace boost {
If the "token compress mode" is enabled, adjacent tokens are considered to be one match. If the "token compress mode" is enabled, adjacent tokens are considered to be one match.
\param Input A input string. \param Input A input string.
\param Pred An unary predicate to identify a token \param Pred A unary predicate to identify a token
\param eCompress Enable/Disable compressing of adjacent tokens \param eCompress Enable/Disable compressing of adjacent tokens
\return \return
An \c iterator_range delimiting the match. An \c iterator_range delimiting the match.

View File

@ -132,7 +132,10 @@ namespace boost {
// increment // increment
void increment() void increment()
{ {
m_Match=this->do_find(m_Match.end(),m_End); if(m_Match.begin() == m_Match.end())
m_Match=this->do_find(m_Match.end(),m_End);
else
m_Match=this->do_find(m_Match.begin()+1,m_End);
} }
// comparison // comparison

View File

@ -39,7 +39,7 @@ namespace boost {
Constructs a \c const_formatter. Const formatter always returns Constructs a \c const_formatter. Const formatter always returns
the same value, regardless of the parameter. the same value, regardless of the parameter.
\param Format A predefined value used as a result for formating \param Format A predefined value used as a result for formatting
\return An instance of the \c const_formatter object. \return An instance of the \c const_formatter object.
*/ */
template<typename RangeT> template<typename RangeT>
@ -95,7 +95,7 @@ namespace boost {
to extract a portion of the formatted sequence. The first finder's match is returned to extract a portion of the formatted sequence. The first finder's match is returned
as a result as a result
\param Finder a finder used to select a portion of the formated sequence \param Finder a finder used to select a portion of the formatted sequence
\return An instance of the \c dissect_formatter object. \return An instance of the \c dissect_formatter object.
*/ */
template<typename FinderT> template<typename FinderT>

View File

@ -15,7 +15,7 @@
/* /*
\file boost/algorith/string/predicate_facade.hpp \file boost/algorith/string/predicate_facade.hpp
This file containes predicate_facade definition. This template class is used This file contains predicate_facade definition. This template class is used
to identify classification predicates, so they can be combined using to identify classification predicates, so they can be combined using
composition operators. composition operators.
*/ */

View File

@ -32,7 +32,7 @@ namespace boost {
Construct the \c regex_finder. Finder uses the regex engine to search Construct the \c regex_finder. Finder uses the regex engine to search
for a match. for a match.
Result is given in \c regex_search_result. This is an extension Result is given in \c regex_search_result. This is an extension
of the iterator_range. In addition it containes match results of the iterator_range. In addition it contains match results
from the \c regex_search algorithm. from the \c regex_search algorithm.
\param Rx A regular expression \param Rx A regular expression

View File

@ -50,7 +50,7 @@ namespace boost {
\param Output An output iterator to which the result will be copied \param Output An output iterator to which the result will be copied
\param Input An input range \param Input An input range
\param IsSpace An unary predicate identifying spaces \param IsSpace A unary predicate identifying spaces
\return \return
An output iterator pointing just after the last inserted character or An output iterator pointing just after the last inserted character or
a copy of the input a copy of the input
@ -118,7 +118,7 @@ namespace boost {
The input sequence is modified in-place. The input sequence is modified in-place.
\param Input An input sequence \param Input An input sequence
\param IsSpace An unary predicate identifying spaces \param IsSpace A unary predicate identifying spaces
*/ */
template<typename SequenceT, typename PredicateT> template<typename SequenceT, typename PredicateT>
inline void trim_left_if(SequenceT& Input, PredicateT IsSpace) inline void trim_left_if(SequenceT& Input, PredicateT IsSpace)
@ -158,7 +158,7 @@ namespace boost {
\param Output An output iterator to which the result will be copied \param Output An output iterator to which the result will be copied
\param Input An input range \param Input An input range
\param IsSpace An unary predicate identifying spaces \param IsSpace A unary predicate identifying spaces
\return \return
An output iterator pointing just after the last inserted character or An output iterator pointing just after the last inserted character or
a copy of the input a copy of the input
@ -228,7 +228,7 @@ namespace boost {
The input sequence is modified in-place. The input sequence is modified in-place.
\param Input An input sequence \param Input An input sequence
\param IsSpace An unary predicate identifying spaces \param IsSpace A unary predicate identifying spaces
*/ */
template<typename SequenceT, typename PredicateT> template<typename SequenceT, typename PredicateT>
inline void trim_right_if(SequenceT& Input, PredicateT IsSpace) inline void trim_right_if(SequenceT& Input, PredicateT IsSpace)
@ -270,7 +270,7 @@ namespace boost {
\param Output An output iterator to which the result will be copied \param Output An output iterator to which the result will be copied
\param Input An input range \param Input An input range
\param IsSpace An unary predicate identifying spaces \param IsSpace A unary predicate identifying spaces
\return \return
An output iterator pointing just after the last inserted character or An output iterator pointing just after the last inserted character or
a copy of the input a copy of the input
@ -352,7 +352,7 @@ namespace boost {
The input sequence is modified in-place. The input sequence is modified in-place.
\param Input An input sequence \param Input An input sequence
\param IsSpace An unary predicate identifying spaces \param IsSpace A unary predicate identifying spaces
*/ */
template<typename SequenceT, typename PredicateT> template<typename SequenceT, typename PredicateT>
inline void trim_if(SequenceT& Input, PredicateT IsSpace) inline void trim_if(SequenceT& Input, PredicateT IsSpace)

View File

@ -13,7 +13,7 @@
/*! \file /*! \file
Cumulative include for string_algo library. Cumulative include for string_algo library.
In addtion to string.hpp contains also regex-related stuff. In addition to string.hpp contains also regex-related stuff.
*/ */
#include <boost/regex.hpp> #include <boost/regex.hpp>

View File

@ -43,6 +43,8 @@ namespace archive {
class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) archive_exception : class BOOST_ARCHIVE_DECL(BOOST_PP_EMPTY()) archive_exception :
public virtual std::exception public virtual std::exception
{ {
protected:
char m_buffer[128];
public: public:
typedef enum { typedef enum {
no_exception, // initialized without code no_exception, // initialized without code
@ -74,8 +76,6 @@ public:
// type has been instantiated in more than one module. // type has been instantiated in more than one module.
output_stream_error // error on input stream output_stream_error // error on input stream
} exception_code; } exception_code;
protected:
std::string m_msg;
public: public:
exception_code code; exception_code code;
archive_exception( archive_exception(
@ -83,9 +83,11 @@ public:
const char * e1 = NULL, const char * e1 = NULL,
const char * e2 = NULL const char * e2 = NULL
); );
~archive_exception() throw (); virtual ~archive_exception() throw();
virtual const char *what( ) const throw(); virtual const char *what() const throw();
protected: protected:
unsigned int
append(unsigned int l, const char * a);
archive_exception(); archive_exception();
}; };

View File

@ -87,7 +87,7 @@ basic_text_iprimitive<IStream>::load_binary(
> >
binary; binary;
binary ti_begin = binary( binary i = binary(
BOOST_MAKE_PFTO_WRAPPER( BOOST_MAKE_PFTO_WRAPPER(
iterators::istream_iterator<CharType>(is) iterators::istream_iterator<CharType>(is)
) )
@ -96,13 +96,11 @@ basic_text_iprimitive<IStream>::load_binary(
char * caddr = static_cast<char *>(address); char * caddr = static_cast<char *>(address);
// take care that we don't increment anymore than necessary // take care that we don't increment anymore than necessary
while(--count > 0){ while(count-- > 0){
*caddr++ = static_cast<char>(*ti_begin); *caddr++ = static_cast<char>(*i++);
++ti_begin;
} }
*caddr++ = static_cast<char>(*ti_begin);
iterators::istream_iterator<CharType> i; // skip over any excess input
for(;;){ for(;;){
BOOST_DEDUCED_TYPENAME IStream::int_type r; BOOST_DEDUCED_TYPENAME IStream::int_type r;
r = is.get(); r = is.get();

View File

@ -51,7 +51,7 @@ basic_text_oprimitive<OStream>::save_binary(
8 8
> >
> >
,72 ,76
,const char // cwpro8 needs this ,const char // cwpro8 needs this
> >
base64_text; base64_text;

View File

@ -43,7 +43,7 @@ struct to_6_bit {
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,-1,-1,-1,63, -1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,62,-1,-1,-1,63,
52,53,54,55,56,57,58,59,60,61,-1,-1,-1,-1,-1,-1, 52,53,54,55,56,57,58,59,60,61,-1,-1,-1, 0,-1,-1, // render '=' as 0
-1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14, -1, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9,10,11,12,13,14,
15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1, 15,16,17,18,19,20,21,22,23,24,25,-1,-1,-1,-1,-1,
-1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40, -1,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,

View File

@ -49,16 +49,17 @@ class istream_iterator :
> super_t; > super_t;
typedef BOOST_DEDUCED_TYPENAME std::basic_istream<Elem> istream_type; typedef BOOST_DEDUCED_TYPENAME std::basic_istream<Elem> istream_type;
//Access the value referred to
Elem dereference() const {
return m_current_value;
}
bool equal(const this_t & rhs) const { bool equal(const this_t & rhs) const {
// note: only works for comparison against end of stream // note: only works for comparison against end of stream
return m_istream == rhs.m_istream; return m_istream == rhs.m_istream;
} }
/*
//Access the value referred to
Elem dereference() const {
return m_current_value;
}
void increment(){ void increment(){
if(NULL != m_istream){ if(NULL != m_istream){
m_current_value = static_cast<Elem>(m_istream->get()); m_current_value = static_cast<Elem>(m_istream->get());
@ -67,6 +68,17 @@ class istream_iterator :
} }
} }
} }
*/
//Access the value referred to
Elem dereference() const {
return m_istream->peek();
}
void increment(){
if(NULL != m_istream){
m_istream->ignore(1);
}
}
istream_type *m_istream; istream_type *m_istream;
Elem m_current_value; Elem m_current_value;
@ -74,7 +86,7 @@ public:
istream_iterator(istream_type & is) : istream_iterator(istream_type & is) :
m_istream(& is) m_istream(& is)
{ {
increment(); //increment();
} }
istream_iterator() : istream_iterator() :

View File

@ -24,8 +24,6 @@
// character and 8 bit bytes. Lowest common multiple is 24 => 4 6 bit characters // character and 8 bit bytes. Lowest common multiple is 24 => 4 6 bit characters
// or 3 8 bit characters // or 3 8 bit characters
#include <algorithm>
#include <boost/config.hpp> // for BOOST_DEDUCED_TYPENAME & PTFO #include <boost/config.hpp> // for BOOST_DEDUCED_TYPENAME & PTFO
#include <boost/serialization/pfto.hpp> #include <boost/serialization/pfto.hpp>
@ -66,101 +64,105 @@ class transform_width :
typedef transform_width<Base, BitsOut, BitsIn, CharType> this_t; typedef transform_width<Base, BitsOut, BitsIn, CharType> this_t;
typedef BOOST_DEDUCED_TYPENAME iterator_value<Base>::type base_value_type; typedef BOOST_DEDUCED_TYPENAME iterator_value<Base>::type base_value_type;
CharType fill(); void fill();
CharType dereference_impl(){
if(! m_full){
m_current_value = fill();
m_full = true;
}
return m_current_value;
}
CharType dereference() const { CharType dereference() const {
return const_cast<this_t *>(this)->dereference_impl(); if(!m_buffer_out_full)
const_cast<this_t *>(this)->fill();
return m_buffer_out;
} }
// test for iterator equality bool equal_impl(const this_t & rhs){
if(BitsIn < BitsOut) // discard any left over bits
return this->base_reference() == rhs.base_reference();
else{
// BitsIn > BitsOut // zero fill
if(this->base_reference() == rhs.base_reference()){
m_end_of_sequence = true;
return 0 == m_remaining_bits;
}
return false;
}
}
// standard iterator interface
bool equal(const this_t & rhs) const { bool equal(const this_t & rhs) const {
return return const_cast<this_t *>(this)->equal_impl(rhs);
this->base_reference() == rhs.base_reference();
;
} }
void increment(){ void increment(){
m_displacement += BitsOut; m_buffer_out_full = false;
while(m_displacement >= BitsIn){
m_displacement -= BitsIn;
if(0 == m_displacement)
m_bufferfull = false;
if(! m_bufferfull){
// note: suspect that this is not invoked for borland
++(this->base_reference());
}
}
m_full = false;
} }
CharType m_current_value; bool m_buffer_out_full;
// number of bits left in current input character buffer CharType m_buffer_out;
unsigned int m_displacement;
base_value_type m_buffer; // last read element from input
// flag to current output character is ready - just used to save time base_value_type m_buffer_in;
bool m_full;
// flag to indicate that m_buffer has data // number of bits to left in the input buffer.
bool m_bufferfull; unsigned int m_remaining_bits;
// flag to indicate we've reached end of data.
bool m_end_of_sequence;
public: public:
// make composible buy using templated constructor // make composible buy using templated constructor
template<class T> template<class T>
transform_width(BOOST_PFTO_WRAPPER(T) start) : transform_width(BOOST_PFTO_WRAPPER(T) start) :
super_t(Base(BOOST_MAKE_PFTO_WRAPPER(static_cast< T >(start)))), super_t(Base(BOOST_MAKE_PFTO_WRAPPER(static_cast< T >(start)))),
m_displacement(0), m_buffer_out_full(false),
m_full(false), m_remaining_bits(0),
m_bufferfull(false) m_end_of_sequence(false)
{} {}
// intel 7.1 doesn't like default copy constructor // intel 7.1 doesn't like default copy constructor
transform_width(const transform_width & rhs) : transform_width(const transform_width & rhs) :
super_t(rhs.base_reference()), super_t(rhs.base_reference()),
m_current_value(rhs.m_current_value), m_buffer_out_full(rhs.m_buffer_out_full),
m_displacement(rhs.m_displacement), m_remaining_bits(rhs.m_remaining_bits),
m_buffer(rhs.m_buffer), m_buffer_in(rhs.m_buffer_in),
m_full(rhs.m_full), m_end_of_sequence(false)
m_bufferfull(rhs.m_bufferfull)
{} {}
}; };
template<class Base, int BitsOut, int BitsIn, class CharType> template<
CharType transform_width<Base, BitsOut, BitsIn, CharType>::fill(){ class Base,
CharType retval = 0; int BitsOut,
int BitsIn,
class CharType
>
void transform_width<Base, BitsOut, BitsIn, CharType>::fill() {
unsigned int missing_bits = BitsOut; unsigned int missing_bits = BitsOut;
for(;;){ m_buffer_out = 0;
unsigned int bcount; do{
if(! m_bufferfull){ if(0 == m_remaining_bits){
m_buffer = * this->base_reference(); if(m_end_of_sequence){
m_bufferfull = true; m_buffer_in = 0;
bcount = BitsIn; m_remaining_bits = missing_bits;
}
else{
m_buffer_in = * this->base_reference()++;
m_remaining_bits = BitsIn;
}
} }
else
bcount = BitsIn - m_displacement; // append these bits to the next output
unsigned int i = (std::min)(bcount, missing_bits); // up to the size of the output
unsigned int i = std::min(missing_bits, m_remaining_bits);
// shift interesting bits to least significant position // shift interesting bits to least significant position
unsigned int j = m_buffer >> (bcount - i); base_value_type j = m_buffer_in >> (m_remaining_bits - i);
// strip off uninteresting bits // and mask off the un interesting higher bits
// (note presumption of two's complement arithmetic) // note presumption of twos complement notation
j &= ~(-(1 << i)); j &= (1 << i) - 1;
// append then interesting bits to the output value // append then interesting bits to the output value
retval <<= i; m_buffer_out <<= i;
retval |= j; m_buffer_out |= j;
// and update counters
missing_bits -= i; missing_bits -= i;
if(0 == missing_bits) m_remaining_bits -= i;
break; }while(0 < missing_bits);
// note: suspect that this is not invoked for borland 5.51 m_buffer_out_full = true;
++(this->base_reference());
m_bufferfull = false;
}
return retval;
} }
} // namespace iterators } // namespace iterators

View File

@ -28,7 +28,7 @@
#if ! defined BOOST_CHRONO_PROVIDES_DATE_IO_FOR_SYSTEM_CLOCK_TIME_POINT \ #if ! defined BOOST_CHRONO_PROVIDES_DATE_IO_FOR_SYSTEM_CLOCK_TIME_POINT \
&& ! defined BOOST_CHRONO_DONT_PROVIDE_DATE_IO_FOR_SYSTEM_CLOCK_TIME_POINT && ! defined BOOST_CHRONO_DONT_PROVIDE_DATE_IO_FOR_SYSTEM_CLOCK_TIME_POINT
# define BOOST_CHRONO_DONT_PROVIDE_DATE_IO_FOR_SYSTEM_CLOCK_TIME_POINT # define BOOST_CHRONO_PROVIDES_DATE_IO_FOR_SYSTEM_CLOCK_TIME_POINT
#endif #endif
@ -96,6 +96,9 @@
# undef BOOST_CHRONO_HAS_THREAD_CLOCK # undef BOOST_CHRONO_HAS_THREAD_CLOCK
# undef BOOST_CHRONO_THREAD_CLOCK_IS_STEADY # undef BOOST_CHRONO_THREAD_CLOCK_IS_STEADY
# endif # endif
# if defined(__VXWORKS__)
# undef BOOST_CHRONO_HAS_PROCESS_CLOCKS
# endif
# endif # endif
#if defined(BOOST_CHRONO_THREAD_DISABLED) && defined(BOOST_CHRONO_HAS_THREAD_CLOCK) #if defined(BOOST_CHRONO_THREAD_DISABLED) && defined(BOOST_CHRONO_HAS_THREAD_CLOCK)
@ -130,7 +133,7 @@
#if defined( BOOST_NO_CXX11_NUMERIC_LIMITS ) #if defined( BOOST_NO_CXX11_NUMERIC_LIMITS )
# define BOOST_CHRONO_LIB_NOEXCEPT_OR_THROW throw() # define BOOST_CHRONO_LIB_NOEXCEPT_OR_THROW throw()
#else #else
#ifdef BOOST_NO_NOEXCEPT #ifdef BOOST_NO_CXX11_NOEXCEPT
# define BOOST_CHRONO_LIB_NOEXCEPT_OR_THROW throw() # define BOOST_CHRONO_LIB_NOEXCEPT_OR_THROW throw()
#else #else
# define BOOST_CHRONO_LIB_NOEXCEPT_OR_THROW noexcept # define BOOST_CHRONO_LIB_NOEXCEPT_OR_THROW noexcept

View File

@ -98,8 +98,12 @@ namespace chrono_detail
#else #else
boost::detail::win32::GetSystemTimeAsFileTime( &ft ); // never fails boost::detail::win32::GetSystemTimeAsFileTime( &ft ); // never fails
#endif #endif
return system_clock::time_point(system_clock::duration( return system_clock::time_point(
(static_cast<__int64>( ft.dwHighDateTime ) << 32) | ft.dwLowDateTime)); system_clock::duration(
((static_cast<__int64>( ft.dwHighDateTime ) << 32) | ft.dwLowDateTime)
-116444736000000000LL
)
);
} }
#if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING #if !defined BOOST_CHRONO_DONT_PROVIDE_HYBRID_ERROR_HANDLING
@ -129,12 +133,6 @@ namespace chrono_detail
{ {
__int64 temp = t.time_since_epoch().count(); __int64 temp = t.time_since_epoch().count();
# if (!defined( BOOST_MSVC )) || (BOOST_MSVC > 1300) // > VC++ 7.0
temp -= 116444736000000000LL; // delta from epoch in microseconds
# else
temp -= 116444736000000000;
# endif
temp /= 10000000; temp /= 10000000;
return static_cast<std::time_t>( temp ); return static_cast<std::time_t>( temp );
} }
@ -145,12 +143,6 @@ namespace chrono_detail
__int64 temp = t; __int64 temp = t;
temp *= 10000000; temp *= 10000000;
# if (!defined( BOOST_MSVC )) || (BOOST_MSVC > 1300) // > VC++ 7.0
temp += 116444736000000000LL;
# else
temp += 116444736000000000;
# endif
return time_point(duration(temp)); return time_point(duration(temp));
} }

View File

@ -417,7 +417,7 @@ struct common_type<chrono::duration<Rep1, Period1>,
namespace chrono { namespace chrono {
template <class Rep, class Period> template <class Rep, class Period>
class duration class BOOST_SYMBOL_VISIBLE duration
{ {
//BOOST_CHRONO_STATIC_ASSERT(boost::is_integral<Rep>::value, BOOST_CHRONO_A_DURATION_REPRESENTATION_MUST_BE_INTEGRAL, ()); //BOOST_CHRONO_STATIC_ASSERT(boost::is_integral<Rep>::value, BOOST_CHRONO_A_DURATION_REPRESENTATION_MUST_BE_INTEGRAL, ());
BOOST_CHRONO_STATIC_ASSERT(!boost::chrono::detail::is_duration<Rep>::value, BOOST_CHRONO_STATIC_ASSERT(!boost::chrono::detail::is_duration<Rep>::value,
@ -436,7 +436,7 @@ namespace chrono {
BOOST_CONSTEXPR BOOST_CONSTEXPR
duration() : rep_(duration_values<rep>::zero()) { } duration() : rep_(duration_values<rep>::zero()) { }
template <class Rep2> template <class Rep2>
BOOST_CONSTEXPR BOOST_SYMBOL_VISIBLE inline BOOST_CONSTEXPR
explicit duration(const Rep2& r explicit duration(const Rep2& r
, typename boost::enable_if < , typename boost::enable_if <
mpl::and_ < mpl::and_ <
@ -452,8 +452,7 @@ namespace chrono {
>::type* = 0 >::type* = 0
) : rep_(r) { } ) : rep_(r) { }
//~duration() {} //= default; //~duration() {} //= default;
//BOOST_CONSTEXPR // BOOST_CONSTEXPR duration(const duration& rhs) : rep_(rhs.rep_) {} // = default;
//duration(const duration& rhs) : rep_(rhs.rep_) {} // = default;
duration& operator=(const duration& rhs) // = default; duration& operator=(const duration& rhs) // = default;
{ {
if (&rhs != this) rep_= rhs.rep_; if (&rhs != this) rep_= rhs.rep_;

View File

@ -60,14 +60,14 @@ BOOST_LIB_THREAD_OPT: "-mt" for multithread builds, otherwise nothing.
BOOST_LIB_RT_OPT: A suffix that indicates the runtime library used, BOOST_LIB_RT_OPT: A suffix that indicates the runtime library used,
contains one or more of the following letters after contains one or more of the following letters after
a hiphen: a hyphen:
s static runtime (dynamic if not present). s static runtime (dynamic if not present).
g debug/diagnostic runtime (release if not present). g debug/diagnostic runtime (release if not present).
y Python debug/diagnostic runtime (release if not present). y Python debug/diagnostic runtime (release if not present).
d debug build (release if not present). d debug build (release if not present).
g debug/diagnostic runtime (release if not present). p STLport build.
p STLPort Build. n STLport build without its IOStreams.
BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y. BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y.
@ -114,68 +114,69 @@ BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y.
// select toolset if not defined already: // select toolset if not defined already:
// //
#ifndef BOOST_LIB_TOOLSET #ifndef BOOST_LIB_TOOLSET
// Note: no compilers before 1200 are supported # if defined(BOOST_MSVC) && (BOOST_MSVC < 1200)
#if defined(BOOST_MSVC) && (BOOST_MSVC < 1300) // Note: no compilers before 1200 are supported
# elif defined(BOOST_MSVC) && (BOOST_MSVC < 1300)
# ifdef UNDER_CE
// eVC4:
# define BOOST_LIB_TOOLSET "evc4"
# else
// vc6:
# define BOOST_LIB_TOOLSET "vc6"
# endif
# elif defined(BOOST_MSVC) && (BOOST_MSVC < 1310)
// vc7:
# define BOOST_LIB_TOOLSET "vc7"
# elif defined(BOOST_MSVC) && (BOOST_MSVC < 1400)
// vc71:
# define BOOST_LIB_TOOLSET "vc71"
# elif defined(BOOST_MSVC) && (BOOST_MSVC < 1500)
// vc80:
# define BOOST_LIB_TOOLSET "vc80"
# elif defined(BOOST_MSVC) && (BOOST_MSVC < 1600)
// vc90:
# define BOOST_LIB_TOOLSET "vc90"
# elif defined(BOOST_MSVC) && (BOOST_MSVC < 1700)
// vc10:
# define BOOST_LIB_TOOLSET "vc100"
# elif defined(BOOST_MSVC)
// vc11:
# define BOOST_LIB_TOOLSET "vc110"
# elif defined(__BORLANDC__)
// CBuilder 6:
# define BOOST_LIB_TOOLSET "bcb"
# elif defined(__ICL)
// Intel C++, no version number:
# define BOOST_LIB_TOOLSET "iw"
# elif defined(__MWERKS__) && (__MWERKS__ <= 0x31FF )
// Metrowerks CodeWarrior 8.x
# define BOOST_LIB_TOOLSET "cw8"
# elif defined(__MWERKS__) && (__MWERKS__ <= 0x32FF )
// Metrowerks CodeWarrior 9.x
# define BOOST_LIB_TOOLSET "cw9"
# ifdef UNDER_CE
// vc6:
# define BOOST_LIB_TOOLSET "evc4"
# else
// vc6:
# define BOOST_LIB_TOOLSET "vc6"
# endif # endif
#elif defined(BOOST_MSVC) && (BOOST_MSVC == 1300)
// vc7:
# define BOOST_LIB_TOOLSET "vc7"
#elif defined(BOOST_MSVC) && (BOOST_MSVC == 1310)
// vc71:
# define BOOST_LIB_TOOLSET "vc71"
#elif defined(BOOST_MSVC) && (BOOST_MSVC == 1400)
// vc80:
# define BOOST_LIB_TOOLSET "vc80"
#elif defined(BOOST_MSVC) && (BOOST_MSVC == 1500)
// vc90:
# define BOOST_LIB_TOOLSET "vc90"
#elif defined(BOOST_MSVC) && (BOOST_MSVC == 1600)
// vc10:
# define BOOST_LIB_TOOLSET "vc100"
#elif defined(BOOST_MSVC) && (BOOST_MSVC >= 1700)
// vc11:
# define BOOST_LIB_TOOLSET "vc110"
#elif defined(__BORLANDC__)
// CBuilder 6:
# define BOOST_LIB_TOOLSET "bcb"
#elif defined(__ICL)
// Intel C++, no version number:
# define BOOST_LIB_TOOLSET "iw"
#elif defined(__MWERKS__) && (__MWERKS__ <= 0x31FF )
// Metrowerks CodeWarrior 8.x
# define BOOST_LIB_TOOLSET "cw8"
#elif defined(__MWERKS__) && (__MWERKS__ <= 0x32FF )
// Metrowerks CodeWarrior 9.x
# define BOOST_LIB_TOOLSET "cw9"
#endif
#endif // BOOST_LIB_TOOLSET #endif // BOOST_LIB_TOOLSET
// //
@ -201,11 +202,11 @@ BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y.
# elif defined(_DEBUG)\ # elif defined(_DEBUG)\
&& defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON) && defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON)
# define BOOST_LIB_RT_OPT "-gydp" # define BOOST_LIB_RT_OPT "-gydp"
# pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1") # pragma message("warning: STLport debug versions are built with /D_STLP_DEBUG=1")
# error "Build options aren't compatible with pre-built libraries" # error "Build options aren't compatible with pre-built libraries"
# elif defined(_DEBUG) # elif defined(_DEBUG)
# define BOOST_LIB_RT_OPT "-gdp" # define BOOST_LIB_RT_OPT "-gdp"
# pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1") # pragma message("warning: STLport debug versions are built with /D_STLP_DEBUG=1")
# error "Build options aren't compatible with pre-built libraries" # error "Build options aren't compatible with pre-built libraries"
# else # else
# define BOOST_LIB_RT_OPT "-p" # define BOOST_LIB_RT_OPT "-p"
@ -221,11 +222,11 @@ BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y.
# elif defined(_DEBUG)\ # elif defined(_DEBUG)\
&& defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON) && defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON)
# define BOOST_LIB_RT_OPT "-gydpn" # define BOOST_LIB_RT_OPT "-gydpn"
# pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1") # pragma message("warning: STLport debug versions are built with /D_STLP_DEBUG=1")
# error "Build options aren't compatible with pre-built libraries" # error "Build options aren't compatible with pre-built libraries"
# elif defined(_DEBUG) # elif defined(_DEBUG)
# define BOOST_LIB_RT_OPT "-gdpn" # define BOOST_LIB_RT_OPT "-gdpn"
# pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1") # pragma message("warning: STLport debug versions are built with /D_STLP_DEBUG=1")
# error "Build options aren't compatible with pre-built libraries" # error "Build options aren't compatible with pre-built libraries"
# else # else
# define BOOST_LIB_RT_OPT "-pn" # define BOOST_LIB_RT_OPT "-pn"
@ -255,11 +256,11 @@ BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y.
# elif defined(_DEBUG)\ # elif defined(_DEBUG)\
&& defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON) && defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON)
# define BOOST_LIB_RT_OPT "-sgydp" # define BOOST_LIB_RT_OPT "-sgydp"
# pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1") # pragma message("warning: STLport debug versions are built with /D_STLP_DEBUG=1")
# error "Build options aren't compatible with pre-built libraries" # error "Build options aren't compatible with pre-built libraries"
# elif defined(_DEBUG) # elif defined(_DEBUG)
# define BOOST_LIB_RT_OPT "-sgdp" # define BOOST_LIB_RT_OPT "-sgdp"
# pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1") # pragma message("warning: STLport debug versions are built with /D_STLP_DEBUG=1")
# error "Build options aren't compatible with pre-built libraries" # error "Build options aren't compatible with pre-built libraries"
# else # else
# define BOOST_LIB_RT_OPT "-sp" # define BOOST_LIB_RT_OPT "-sp"
@ -275,11 +276,11 @@ BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y.
# elif defined(_DEBUG)\ # elif defined(_DEBUG)\
&& defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON) && defined(BOOST_DEBUG_PYTHON) && defined(BOOST_LINKING_PYTHON)
# define BOOST_LIB_RT_OPT "-sgydpn" # define BOOST_LIB_RT_OPT "-sgydpn"
# pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1") # pragma message("warning: STLport debug versions are built with /D_STLP_DEBUG=1")
# error "Build options aren't compatible with pre-built libraries" # error "Build options aren't compatible with pre-built libraries"
# elif defined(_DEBUG) # elif defined(_DEBUG)
# define BOOST_LIB_RT_OPT "-sgdpn" # define BOOST_LIB_RT_OPT "-sgdpn"
# pragma message("warning: STLPort debug versions are built with /D_STLP_DEBUG=1") # pragma message("warning: STLport debug versions are built with /D_STLP_DEBUG=1")
# error "Build options aren't compatible with pre-built libraries" # error "Build options aren't compatible with pre-built libraries"
# else # else
# define BOOST_LIB_RT_OPT "-spn" # define BOOST_LIB_RT_OPT "-spn"
@ -312,7 +313,7 @@ BOOST_LIB_VERSION: The Boost version, in the form x_y, for Boost version x.y.
// sanity check: // sanity check:
// //
#if defined(__STL_DEBUG) || defined(_STLP_DEBUG) #if defined(__STL_DEBUG) || defined(_STLP_DEBUG)
#error "Pre-built versions of the Boost libraries are not provided in STLPort-debug form" #error "Pre-built versions of the Boost libraries are not provided in STLport-debug form"
#endif #endif
# ifdef _RTLDLL # ifdef _RTLDLL

View File

@ -29,6 +29,15 @@
// Clang supports "long long" in all compilation modes. // Clang supports "long long" in all compilation modes.
#define BOOST_HAS_LONG_LONG #define BOOST_HAS_LONG_LONG
//
// Dynamic shared object (DSO) and dynamic-link library (DLL) support
//
#if !defined(_WIN32) && !defined(__WIN32__) && !defined(WIN32)
# define BOOST_SYMBOL_EXPORT __attribute__((__visibility__("default")))
# define BOOST_SYMBOL_IMPORT
# define BOOST_SYMBOL_VISIBLE __attribute__((__visibility__("default")))
#endif
#if !__has_feature(cxx_auto_type) #if !__has_feature(cxx_auto_type)
# define BOOST_NO_CXX11_AUTO_DECLARATIONS # define BOOST_NO_CXX11_AUTO_DECLARATIONS
# define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS # define BOOST_NO_CXX11_AUTO_MULTIDECLARATIONS

View File

@ -146,6 +146,12 @@
# endif # endif
#endif #endif
//
// Recent GCC versions have __int128 when in 64-bit mode:
//
#if defined(__SIZEOF_INT128__)
# define BOOST_HAS_INT128
#endif
// C++0x features in 4.3.n and later // C++0x features in 4.3.n and later
// //

View File

@ -183,6 +183,16 @@
# define BOOST_NO_RTTI # define BOOST_NO_RTTI
#endif #endif
//
// TR1 features:
//
#if _MSC_VER >= 1700
// # define BOOST_HAS_TR1_HASH // don't know if this is true yet.
// # define BOOST_HAS_TR1_TYPE_TRAITS // don't know if this is true yet.
# define BOOST_HAS_TR1_UNORDERED_MAP
# define BOOST_HAS_TR1_UNORDERED_SET
#endif
// //
// C++0x features // C++0x features
// //

View File

@ -113,9 +113,10 @@
#if (!defined(_HAS_TR1_IMPORTS) || (_HAS_TR1_IMPORTS+0 == 0)) && !defined(BOOST_NO_CXX11_HDR_TUPLE) #if (!defined(_HAS_TR1_IMPORTS) || (_HAS_TR1_IMPORTS+0 == 0)) && !defined(BOOST_NO_CXX11_HDR_TUPLE)
# define BOOST_NO_CXX11_HDR_TUPLE # define BOOST_NO_CXX11_HDR_TUPLE
#endif #endif
// C++0x headers implemented in 540 (as shipped by Microsoft)
// //
// C++0x headers not yet (fully) implemented: #if !defined(_CPPLIB_VER) || _CPPLIB_VER < 540
//
# define BOOST_NO_CXX11_HDR_TYPE_TRAITS # define BOOST_NO_CXX11_HDR_TYPE_TRAITS
# define BOOST_NO_CXX11_HDR_CHRONO # define BOOST_NO_CXX11_HDR_CHRONO
# define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE # define BOOST_NO_CXX11_HDR_CONDITION_VARIABLE
@ -125,6 +126,12 @@
# define BOOST_NO_CXX11_HDR_THREAD # define BOOST_NO_CXX11_HDR_THREAD
# define BOOST_NO_CXX11_ALLOCATOR # define BOOST_NO_CXX11_ALLOCATOR
# define BOOST_NO_CXX11_ATOMIC_SMART_PTR # define BOOST_NO_CXX11_ATOMIC_SMART_PTR
#endif
//
// C++0x headers not yet (fully) implemented:
//
# define BOOST_NO_CXX11_HDR_INITIALIZER_LIST
#ifdef _CPPLIB_VER #ifdef _CPPLIB_VER
# define BOOST_DINKUMWARE_STDLIB _CPPLIB_VER # define BOOST_DINKUMWARE_STDLIB _CPPLIB_VER

View File

@ -1,4 +1,5 @@
// Boost config.hpp configuration header file ------------------------------// // Boost config.hpp configuration header file ------------------------------//
// boostinspect:ndprecated_macros -- tell the inspect tool to ignore this file
// Copyright (c) 2001-2003 John Maddock // Copyright (c) 2001-2003 John Maddock
// Copyright (c) 2001 Darin Adler // Copyright (c) 2001 Darin Adler
@ -488,6 +489,18 @@ namespace boost{
# endif # endif
} }
#endif #endif
// same again for __int128:
#if defined(BOOST_HAS_INT128) && defined(__cplusplus)
namespace boost{
# ifdef __GNUC__
__extension__ typedef __int128 int128_type;
__extension__ typedef unsigned __int128 uint128_type;
# else
typedef __int128 int128_type;
typedef unsigned __int128 uint128_type;
# endif
}
#endif
// BOOST_[APPEND_]EXPLICIT_TEMPLATE_[NON_]TYPE macros --------------------------// // BOOST_[APPEND_]EXPLICIT_TEMPLATE_[NON_]TYPE macros --------------------------//
// //
@ -647,8 +660,8 @@ namespace std{ using ::type_info; }
// Use BOOST_NO_CXX11_HDR_UNORDERED_SET or BOOST_NO_CXX11_HDR_UNORDERED_MAP // Use BOOST_NO_CXX11_HDR_UNORDERED_SET or BOOST_NO_CXX11_HDR_UNORDERED_MAP
// instead of BOOST_NO_STD_UNORDERED // instead of BOOST_NO_STD_UNORDERED
#if defined(BOOST_NO_CXX11_HDR_UNORDERED_MAP) || defined (BOOST_NO_CXX11_HDR_UNORDERED_SET) #if defined(BOOST_NO_CXX11_HDR_UNORDERED_MAP) || defined (BOOST_NO_CXX11_HDR_UNORDERED_SET)
# ifndef BOOST_NO_STD_UNORDERED # ifndef BOOST_NO_CXX11_STD_UNORDERED
# define BOOST_NO_STD_UNORDERED # define BOOST_NO_CXX11_STD_UNORDERED
# endif # endif
#endif #endif
@ -827,9 +840,9 @@ namespace std{ using ::type_info; }
#if defined(BOOST_NO_CXX11_STATIC_ASSERT) && !defined(BOOST_NO_STATIC_ASSERT) #if defined(BOOST_NO_CXX11_STATIC_ASSERT) && !defined(BOOST_NO_STATIC_ASSERT)
# define BOOST_NO_STATIC_ASSERT # define BOOST_NO_STATIC_ASSERT
#endif #endif
// Use BOOST_NO_CXX11_STD_UNORDERD instead of BOOST_NO_STD_UNORDERD // Use BOOST_NO_CXX11_STD_UNORDERED instead of BOOST_NO_STD_UNORDERED
#if defined(BOOST_NO_CXX11_STD_UNORDERD) && !defined(BOOST_NO_STD_UNORDERD) #if defined(BOOST_NO_CXX11_STD_UNORDERED) && !defined(BOOST_NO_STD_UNORDERED)
# define BOOST_NO_STD_UNORDERD # define BOOST_NO_STD_UNORDERED
#endif #endif
// Use BOOST_NO_CXX11_UNICODE_LITERALS instead of BOOST_NO_UNICODE_LITERALS // Use BOOST_NO_CXX11_UNICODE_LITERALS instead of BOOST_NO_UNICODE_LITERALS
#if defined(BOOST_NO_CXX11_UNICODE_LITERALS) && !defined(BOOST_NO_UNICODE_LITERALS) #if defined(BOOST_NO_CXX11_UNICODE_LITERALS) && !defined(BOOST_NO_UNICODE_LITERALS)
@ -859,7 +872,7 @@ namespace std{ using ::type_info; }
// Helper macros BOOST_NOEXCEPT, BOOST_NOEXCEPT_IF, BOOST_NOEXCEPT_EXPR // Helper macros BOOST_NOEXCEPT, BOOST_NOEXCEPT_IF, BOOST_NOEXCEPT_EXPR
// These aid the transition to C++11 while still supporting C++03 compilers // These aid the transition to C++11 while still supporting C++03 compilers
// //
#ifdef BOOST_NO_NOEXCEPT #ifdef BOOST_NO_CXX11_NOEXCEPT
# define BOOST_NOEXCEPT # define BOOST_NOEXCEPT
# define BOOST_NOEXCEPT_IF(Predicate) # define BOOST_NOEXCEPT_IF(Predicate)
# define BOOST_NOEXCEPT_EXPR(Expression) false # define BOOST_NOEXCEPT_EXPR(Expression) false
@ -869,17 +882,10 @@ namespace std{ using ::type_info; }
# define BOOST_NOEXCEPT_EXPR(Expression) noexcept((Expression)) # define BOOST_NOEXCEPT_EXPR(Expression) noexcept((Expression))
#endif #endif
//
// Normalize BOOST_NO_STATIC_ASSERT and (depricated) BOOST_HAS_STATIC_ASSERT:
//
#if !defined(BOOST_NO_STATIC_ASSERT) && !defined(BOOST_HAS_STATIC_ASSERT)
# define BOOST_HAS_STATIC_ASSERT
#endif
// //
// constexpr workarounds // constexpr workarounds
// //
#if defined(BOOST_NO_CONSTEXPR) #if defined(BOOST_NO_CXX11_CONSTEXPR)
#define BOOST_CONSTEXPR #define BOOST_CONSTEXPR
#define BOOST_CONSTEXPR_OR_CONST const #define BOOST_CONSTEXPR_OR_CONST const
#else #else
@ -890,16 +896,23 @@ namespace std{ using ::type_info; }
#define BOOST_STATIC_CONSTEXPR static BOOST_CONSTEXPR_OR_CONST #define BOOST_STATIC_CONSTEXPR static BOOST_CONSTEXPR_OR_CONST
// //
// Set BOOST_HAS_RVALUE_REFS when BOOST_NO_RVALUE_REFERENCES is not defined // Set BOOST_HAS_STATIC_ASSERT when BOOST_NO_CXX11_STATIC_ASSERT is not defined
// //
#if !defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_HAS_RVALUE_REFS) #if !defined(BOOST_NO_CXX11_STATIC_ASSERT) && !defined(BOOST_HAS_STATIC_ASSERT)
# define BOOST_HAS_STATIC_ASSERT
#endif
//
// Set BOOST_HAS_RVALUE_REFS when BOOST_NO_CXX11_RVALUE_REFERENCES is not defined
//
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_HAS_RVALUE_REFS)
#define BOOST_HAS_RVALUE_REFS #define BOOST_HAS_RVALUE_REFS
#endif #endif
// //
// Set BOOST_HAS_VARIADIC_TMPL when BOOST_NO_VARIADIC_TEMPLATES is not defined // Set BOOST_HAS_VARIADIC_TMPL when BOOST_NO_CXX11_VARIADIC_TEMPLATES is not defined
// //
#if !defined(BOOST_NO_VARIADIC_TEMPLATES) && !defined(BOOST_HAS_VARIADIC_TMPL) #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_HAS_VARIADIC_TMPL)
#define BOOST_HAS_VARIADIC_TMPL #define BOOST_HAS_VARIADIC_TMPL
#endif #endif

View File

@ -28,7 +28,7 @@
#include <boost/container/detail/memory_util.hpp> #include <boost/container/detail/memory_util.hpp>
#include <boost/type_traits/integral_constant.hpp> #include <boost/type_traits/integral_constant.hpp>
#include <boost/container/detail/mpl.hpp> #include <boost/container/detail/mpl.hpp>
#include <boost/move/move.hpp> #include <boost/move/utility.hpp>
#include <limits> //numeric_limits<>::max() #include <limits> //numeric_limits<>::max()
#include <new> //placement new #include <new> //placement new
#include <memory> //std::allocator #include <memory> //std::allocator
@ -165,22 +165,22 @@ struct allocator_traits
propagate_on_container_swap, boost::false_type) propagate_on_container_swap, boost::false_type)
propagate_on_container_swap; propagate_on_container_swap;
#if !defined(BOOST_NO_TEMPLATE_ALIASES) #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
//C++11 //C++11
template <typename T> using rebind_alloc = typename boost::intrusive::detail::type_rebinder<Alloc, T>::type; template <typename T> using rebind_alloc = typename boost::intrusive::detail::type_rebinder<Alloc, T>::type;
template <typename T> using rebind_traits = allocator_traits< rebind_alloc<T> >; template <typename T> using rebind_traits = allocator_traits< rebind_alloc<T> >;
#else // #if !defined(BOOST_NO_TEMPLATE_ALIASES) #else // #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
//Some workaround for C++03 or C++11 compilers with no template aliases //Some workaround for C++03 or C++11 compilers with no template aliases
template <typename T> template <typename T>
struct rebind_alloc : boost::intrusive::detail::type_rebinder<Alloc,T>::type struct rebind_alloc : boost::intrusive::detail::type_rebinder<Alloc,T>::type
{ {
typedef typename boost::intrusive::detail::type_rebinder<Alloc,T>::type Base; typedef typename boost::intrusive::detail::type_rebinder<Alloc,T>::type Base;
#if !defined(BOOST_NO_VARIADIC_TEMPLATES) #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
template <typename... Args> template <typename... Args>
rebind_alloc(BOOST_FWD_REF(Args)... args) rebind_alloc(BOOST_FWD_REF(Args)... args)
: Base(boost::forward<Args>(args)...) : Base(boost::forward<Args>(args)...)
{} {}
#else // #if !defined(BOOST_NO_VARIADIC_TEMPLATES) #else // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
#define BOOST_PP_LOCAL_MACRO(n) \ #define BOOST_PP_LOCAL_MACRO(n) \
BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \ BOOST_PP_EXPR_IF(n, template<) BOOST_PP_ENUM_PARAMS(n, class P) BOOST_PP_EXPR_IF(n, >) \
rebind_alloc(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \ rebind_alloc(BOOST_PP_ENUM(n, BOOST_CONTAINER_PP_PARAM_LIST, _)) \
@ -189,14 +189,14 @@ struct allocator_traits
// //
#define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS) #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
#include BOOST_PP_LOCAL_ITERATE() #include BOOST_PP_LOCAL_ITERATE()
#endif // #if !defined(BOOST_NO_VARIADIC_TEMPLATES) #endif // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
}; };
template <typename T> template <typename T>
struct rebind_traits struct rebind_traits
: allocator_traits<typename boost::intrusive::detail::type_rebinder<Alloc, T>::type> : allocator_traits<typename boost::intrusive::detail::type_rebinder<Alloc, T>::type>
{}; {};
#endif // #if !defined(BOOST_NO_TEMPLATE_ALIASES) #endif // #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
template <class T> template <class T>
struct portable_rebind_alloc struct portable_rebind_alloc
{ typedef typename boost::intrusive::detail::type_rebinder<Alloc, T>::type type; }; { typedef typename boost::intrusive::detail::type_rebinder<Alloc, T>::type type; };
@ -259,7 +259,7 @@ struct allocator_traits
return allocator_traits::priv_select_on_container_copy_construction(flag, a); return allocator_traits::priv_select_on_container_copy_construction(flag, a);
} }
#if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
//! <b>Effects</b>: calls `a.construct(p, std::forward<Args>(args)...)` if that call is well-formed; //! <b>Effects</b>: calls `a.construct(p, std::forward<Args>(args)...)` if that call is well-formed;
//! otherwise, invokes `::new (static_cast<void*>(p)) T(std::forward<Args>(args)...)` //! otherwise, invokes `::new (static_cast<void*>(p)) T(std::forward<Args>(args)...)`
template <class T, class ...Args> template <class T, class ...Args>
@ -298,7 +298,7 @@ struct allocator_traits
static Alloc priv_select_on_container_copy_construction(boost::false_type, const Alloc &a) static Alloc priv_select_on_container_copy_construction(boost::false_type, const Alloc &a)
{ return a; } { return a; }
#if !defined(BOOST_NO_VARIADIC_TEMPLATES) #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
template<class T, class ...Args> template<class T, class ...Args>
static void priv_construct(boost::false_type, Alloc &a, T *p, BOOST_FWD_REF(Args) ...args) static void priv_construct(boost::false_type, Alloc &a, T *p, BOOST_FWD_REF(Args) ...args)
{ {
@ -322,7 +322,7 @@ struct allocator_traits
template<class T, class ...Args> template<class T, class ...Args>
static void priv_construct_dispatch2(boost::false_type, Alloc &, T *p, BOOST_FWD_REF(Args) ...args) static void priv_construct_dispatch2(boost::false_type, Alloc &, T *p, BOOST_FWD_REF(Args) ...args)
{ ::new((void*)p) T(::boost::forward<Args>(args)...); } { ::new((void*)p) T(::boost::forward<Args>(args)...); }
#else // #if !defined(BOOST_NO_VARIADIC_TEMPLATES) #else // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
public: public:
#define BOOST_PP_LOCAL_MACRO(n) \ #define BOOST_PP_LOCAL_MACRO(n) \
template<class T BOOST_PP_ENUM_TRAILING_PARAMS(n, class P) > \ template<class T BOOST_PP_ENUM_TRAILING_PARAMS(n, class P) > \
@ -371,7 +371,7 @@ struct allocator_traits
// //
#define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS) #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
#include BOOST_PP_LOCAL_ITERATE() #include BOOST_PP_LOCAL_ITERATE()
#endif // #if !defined(BOOST_NO_VARIADIC_TEMPLATES) #endif // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
#endif //#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED) #endif //#if defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
///@endcond ///@endcond

View File

@ -26,8 +26,9 @@
#include <boost/container/detail/type_traits.hpp> #include <boost/container/detail/type_traits.hpp>
#include <utility> //std::pair #include <utility> //std::pair
#include <algorithm> //std::swap
#include <boost/move/move.hpp> #include <boost/move/utility.hpp>
#include <boost/type_traits/is_class.hpp> #include <boost/type_traits/is_class.hpp>
#ifndef BOOST_CONTAINER_PERFECT_FORWARDING #ifndef BOOST_CONTAINER_PERFECT_FORWARDING
@ -336,7 +337,7 @@ struct is_class< ::boost::container::container_detail::pair<T1, T2> >
: public ::boost::true_type : public ::boost::true_type
{}; {};
#ifdef BOOST_NO_RVALUE_REFERENCES #ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
template<class T1, class T2> template<class T1, class T2>
struct has_move_emulation_enabled< ::boost::container::container_detail::pair<T1, T2> > struct has_move_emulation_enabled< ::boost::container::container_detail::pair<T1, T2> >

View File

@ -17,6 +17,7 @@
#include <boost/container/detail/config_begin.hpp> #include <boost/container/detail/config_begin.hpp>
#include <boost/container/detail/workaround.hpp> #include <boost/container/detail/workaround.hpp>
#include <boost/move/utility.hpp>
#ifdef BOOST_CONTAINER_PERFECT_FORWARDING #ifdef BOOST_CONTAINER_PERFECT_FORWARDING
//#error "This file is not needed when perfect forwarding is available" //#error "This file is not needed when perfect forwarding is available"
@ -38,6 +39,7 @@
#include <boost/preprocessor/arithmetic/sub.hpp> #include <boost/preprocessor/arithmetic/sub.hpp>
#include <boost/preprocessor/arithmetic/add.hpp> #include <boost/preprocessor/arithmetic/add.hpp>
#include <boost/preprocessor/iteration/iterate.hpp> #include <boost/preprocessor/iteration/iterate.hpp>
#include <boost/move/utility.hpp>
#define BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS 10 #define BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS 10
@ -47,7 +49,7 @@
//This cast is ugly but it is necessary until "perfect forwarding" //This cast is ugly but it is necessary until "perfect forwarding"
//is achieved in C++0x. Meanwhile, if we want to be able to //is achieved in C++0x. Meanwhile, if we want to be able to
//bind rvalues with non-const references, we have to be ugly //bind rvalues with non-const references, we have to be ugly
#ifndef BOOST_NO_RVALUE_REFERENCES #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
#define BOOST_CONTAINER_PP_PARAM_LIST(z, n, data) \ #define BOOST_CONTAINER_PP_PARAM_LIST(z, n, data) \
BOOST_PP_CAT(P, n) && BOOST_PP_CAT(p, n) \ BOOST_PP_CAT(P, n) && BOOST_PP_CAT(p, n) \
//! //!
@ -55,13 +57,13 @@
#define BOOST_CONTAINER_PP_PARAM_LIST(z, n, data) \ #define BOOST_CONTAINER_PP_PARAM_LIST(z, n, data) \
const BOOST_PP_CAT(P, n) & BOOST_PP_CAT(p, n) \ const BOOST_PP_CAT(P, n) & BOOST_PP_CAT(p, n) \
//! //!
#endif //#ifndef BOOST_NO_RVALUE_REFERENCES #endif //#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
#define BOOST_CONTAINER_PP_CONST_REF_PARAM_LIST_Q(z, n, Data) \ #define BOOST_CONTAINER_PP_CONST_REF_PARAM_LIST_Q(z, n, Data) \
const BOOST_PP_CAT(Q, n) & BOOST_PP_CAT(q, n) \ const BOOST_PP_CAT(Q, n) & BOOST_PP_CAT(q, n) \
//! //!
#ifndef BOOST_NO_RVALUE_REFERENCES #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
#define BOOST_CONTAINER_PP_PARAM(U, u) \ #define BOOST_CONTAINER_PP_PARAM(U, u) \
U && u \ U && u \
//! //!
@ -69,22 +71,22 @@ const BOOST_PP_CAT(Q, n) & BOOST_PP_CAT(q, n) \
#define BOOST_CONTAINER_PP_PARAM(U, u) \ #define BOOST_CONTAINER_PP_PARAM(U, u) \
const U & u \ const U & u \
//! //!
#endif //#ifndef BOOST_NO_RVALUE_REFERENCES #endif //#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
#ifndef BOOST_NO_RVALUE_REFERENCES #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
#define BOOST_CONTAINER_PP_PARAM_INIT(z, n, data) \ #define BOOST_CONTAINER_PP_PARAM_INIT(z, n, data) \
BOOST_PP_CAT(m_p, n) (::boost::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(p, n) )) \ BOOST_PP_CAT(m_p, n) (::boost::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(p, n) )) \
//! //!
#else //BOOST_NO_RVALUE_REFERENCES #else //BOOST_NO_CXX11_RVALUE_REFERENCES
#define BOOST_CONTAINER_PP_PARAM_INIT(z, n, data) \ #define BOOST_CONTAINER_PP_PARAM_INIT(z, n, data) \
BOOST_PP_CAT(m_p, n) (const_cast<BOOST_PP_CAT(P, n) &>(BOOST_PP_CAT(p, n))) \ BOOST_PP_CAT(m_p, n) (const_cast<BOOST_PP_CAT(P, n) &>(BOOST_PP_CAT(p, n))) \
//! //!
#endif //#ifndef BOOST_NO_RVALUE_REFERENCES #endif //#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
#ifndef BOOST_NO_RVALUE_REFERENCES #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
#if defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG) #if defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG)
@ -97,7 +99,7 @@ const BOOST_PP_CAT(Q, n) & BOOST_PP_CAT(q, n) \
template<class T> template<class T>
struct ref_holder<T &> struct ref_holder<T &>
{ {
ref_holder(T &t) explicit ref_holder(T &t)
: t_(t) : t_(t)
{} {}
T &t_; T &t_;
@ -107,7 +109,7 @@ const BOOST_PP_CAT(Q, n) & BOOST_PP_CAT(q, n) \
template<class T> template<class T>
struct ref_holder<const T> struct ref_holder<const T>
{ {
ref_holder(const T &t) explicit ref_holder(const T &t)
: t_(t) : t_(t)
{} {}
const T &t_; const T &t_;
@ -117,7 +119,7 @@ const BOOST_PP_CAT(Q, n) & BOOST_PP_CAT(q, n) \
template<class T> template<class T>
struct ref_holder<const T &&> struct ref_holder<const T &&>
{ {
ref_holder(const T &t) explicit ref_holder(const T &t)
: t_(t) : t_(t)
{} {}
const T &t_; const T &t_;
@ -127,7 +129,7 @@ const BOOST_PP_CAT(Q, n) & BOOST_PP_CAT(q, n) \
template<class T> template<class T>
struct ref_holder struct ref_holder
{ {
ref_holder(T &&t) explicit ref_holder(T &&t)
: t_(t) : t_(t)
{} {}
T &t_; T &t_;
@ -137,10 +139,10 @@ const BOOST_PP_CAT(Q, n) & BOOST_PP_CAT(q, n) \
template<class T> template<class T>
struct ref_holder<T &&> struct ref_holder<T &&>
{ {
ref_holder(T &&t) explicit ref_holder(T &&t)
: t(t) : t_(t)
{} {}
T &t; T &t_;
T && get() { return ::boost::move(t_); } T && get() { return ::boost::move(t_); }
}; };
@ -160,25 +162,25 @@ const BOOST_PP_CAT(Q, n) & BOOST_PP_CAT(q, n) \
#endif //defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG) #endif //defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG)
#else //BOOST_NO_RVALUE_REFERENCES #else //BOOST_NO_CXX11_RVALUE_REFERENCES
#define BOOST_CONTAINER_PP_PARAM_DEFINE(z, n, data) \ #define BOOST_CONTAINER_PP_PARAM_DEFINE(z, n, data) \
BOOST_PP_CAT(P, n) & BOOST_PP_CAT(m_p, n); \ BOOST_PP_CAT(P, n) & BOOST_PP_CAT(m_p, n); \
//! //!
#endif //#ifndef BOOST_NO_RVALUE_REFERENCES #endif //#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
#if !defined(BOOST_NO_RVALUE_REFERENCES) && defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG) #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG)
#define BOOST_CONTAINER_PP_MEMBER_FORWARD(z, n, data) BOOST_PP_CAT(this->m_p, n).get() \ #define BOOST_CONTAINER_PP_MEMBER_FORWARD(z, n, data) BOOST_PP_CAT(this->m_p, n).get() \
//! //!
#else //!defined(BOOST_NO_RVALUE_REFERENCES) && defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG) #else //!defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG)
#define BOOST_CONTAINER_PP_MEMBER_FORWARD(z, n, data) \ #define BOOST_CONTAINER_PP_MEMBER_FORWARD(z, n, data) \
::boost::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(this->m_p, n) ) \ ::boost::forward< BOOST_PP_CAT(P, n) >( BOOST_PP_CAT(this->m_p, n) ) \
//! //!
#endif //!defined(BOOST_NO_RVALUE_REFERENCES) && defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG) #endif //!defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && defined(BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG)
#define BOOST_CONTAINER_PP_PARAM_INC(z, n, data) \ #define BOOST_CONTAINER_PP_PARAM_INC(z, n, data) \
BOOST_PP_CAT(++this->m_p, n) \ BOOST_PP_CAT(++this->m_p, n) \

View File

@ -21,7 +21,7 @@
#include "config_begin.hpp" #include "config_begin.hpp"
#include <boost/move/move.hpp> #include <boost/move/utility.hpp>
namespace boost { namespace boost {
namespace container { namespace container {
@ -90,7 +90,7 @@ struct remove_reference<T&>
typedef T type; typedef T type;
}; };
#ifndef BOOST_NO_RVALUE_REFERENCES #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
template<class T> template<class T>
struct remove_reference<T&&> struct remove_reference<T&&>

View File

@ -18,11 +18,14 @@
#include <boost/type_traits/is_enum.hpp> #include <boost/type_traits/is_enum.hpp>
#include <boost/type_traits/is_member_pointer.hpp> #include <boost/type_traits/is_member_pointer.hpp>
#include <boost/type_traits/is_class.hpp> #include <boost/type_traits/is_class.hpp>
#include <boost/move/move.hpp> #include <boost/move/utility.hpp>
#include <boost/move/iterator.hpp>
#include <boost/container/detail/mpl.hpp> #include <boost/container/detail/mpl.hpp>
#include <boost/container/detail/type_traits.hpp> #include <boost/container/detail/type_traits.hpp>
#include <boost/container/allocator_traits.hpp> #include <boost/container/allocator_traits.hpp>
#include <boost/detail/no_exceptions_support.hpp>
#include <algorithm> #include <algorithm>
#include <iterator>
namespace boost { namespace boost {
namespace container { namespace container {
@ -123,16 +126,6 @@ struct ct_rounded_size
enum { value = ((OrigSize-1)/RoundTo+1)*RoundTo }; enum { value = ((OrigSize-1)/RoundTo+1)*RoundTo };
}; };
template<class T>
struct move_const_ref_type
: if_c
// < ::boost::is_fundamental<T>::value || ::boost::is_pointer<T>::value || ::boost::is_member_pointer<T>::value || ::boost::is_enum<T>::value
< !::boost::is_class<T>::value
,const T &
,BOOST_CATCH_CONST_RLVALUE(T)
>
{};
} //namespace container_detail { } //namespace container_detail {
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
@ -154,13 +147,95 @@ template
typename F> // F models ForwardIterator typename F> // F models ForwardIterator
F uninitialized_move_alloc(A &a, I f, I l, F r) F uninitialized_move_alloc(A &a, I f, I l, F r)
{ {
while (f != l) { F back = r;
allocator_traits<A>::construct(a, container_detail::to_raw_pointer(&*r), boost::move(*f)); BOOST_TRY{
++f; ++r; while (f != l) {
allocator_traits<A>::construct(a, container_detail::to_raw_pointer(&*r), boost::move(*f));
++f; ++r;
}
} }
BOOST_CATCH(...){
for (; back != r; ++back){
allocator_traits<A>::destroy(a, container_detail::to_raw_pointer(&*back));
}
BOOST_RETHROW;
}
BOOST_CATCH_END
return r; return r;
} }
//////////////////////////////////////////////////////////////////////////////
//
// uninitialized_move_alloc_n
//
//////////////////////////////////////////////////////////////////////////////
//! <b>Effects</b>:
//! \code
//! for (; n--; ++result, ++first)
//! allocator_traits::construct(a, &*result, boost::move(*first));
//! \endcode
//!
//! <b>Returns</b>: result
template
<typename A,
typename I, // I models InputIterator
typename F> // F models ForwardIterator
F uninitialized_move_alloc_n(A &a, I f, typename std::iterator_traits<I>::difference_type n, F r)
{
F back = r;
BOOST_TRY{
while (n--) {
allocator_traits<A>::construct(a, container_detail::to_raw_pointer(&*r), boost::move(*f));
++f; ++r;
}
}
BOOST_CATCH(...){
for (; back != r; ++back){
allocator_traits<A>::destroy(a, container_detail::to_raw_pointer(&*back));
}
BOOST_RETHROW;
}
BOOST_CATCH_END
return r;
}
//////////////////////////////////////////////////////////////////////////////
//
// uninitialized_move_alloc_n_source
//
//////////////////////////////////////////////////////////////////////////////
//! <b>Effects</b>:
//! \code
//! for (; n--; ++result, ++first)
//! allocator_traits::construct(a, &*result, boost::move(*first));
//! \endcode
//!
//! <b>Returns</b>: first (after incremented)
template
<typename A,
typename I, // I models InputIterator
typename F> // F models ForwardIterator
I uninitialized_move_alloc_n_source(A &a, I f, typename std::iterator_traits<I>::difference_type n, F r)
{
F back = r;
BOOST_TRY{
while (n--) {
allocator_traits<A>::construct(a, container_detail::to_raw_pointer(&*r), boost::move(*f));
++f; ++r;
}
}
BOOST_CATCH(...){
for (; back != r; ++back){
allocator_traits<A>::destroy(a, container_detail::to_raw_pointer(&*back));
}
BOOST_RETHROW;
}
BOOST_CATCH_END
return f;
}
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// uninitialized_copy_alloc // uninitialized_copy_alloc
@ -180,13 +255,95 @@ template
typename F> // F models ForwardIterator typename F> // F models ForwardIterator
F uninitialized_copy_alloc(A &a, I f, I l, F r) F uninitialized_copy_alloc(A &a, I f, I l, F r)
{ {
while (f != l) { F back = r;
allocator_traits<A>::construct(a, container_detail::to_raw_pointer(&*r), *f); BOOST_TRY{
++f; ++r; while (f != l) {
allocator_traits<A>::construct(a, container_detail::to_raw_pointer(&*r), *f);
++f; ++r;
}
} }
BOOST_CATCH(...){
for (; back != r; ++back){
allocator_traits<A>::destroy(a, container_detail::to_raw_pointer(&*back));
}
BOOST_RETHROW;
}
BOOST_CATCH_END
return r; return r;
} }
//////////////////////////////////////////////////////////////////////////////
//
// uninitialized_copy_alloc_n
//
//////////////////////////////////////////////////////////////////////////////
//! <b>Effects</b>:
//! \code
//! for (; n--; ++result, ++first)
//! allocator_traits::construct(a, &*result, *first);
//! \endcode
//!
//! <b>Returns</b>: result
template
<typename A,
typename I, // I models InputIterator
typename F> // F models ForwardIterator
F uninitialized_copy_alloc_n(A &a, I f, typename std::iterator_traits<I>::difference_type n, F r)
{
F back = r;
BOOST_TRY{
while (n--) {
allocator_traits<A>::construct(a, container_detail::to_raw_pointer(&*r), *f);
++f; ++r;
}
}
BOOST_CATCH(...){
for (; back != r; ++back){
allocator_traits<A>::destroy(a, container_detail::to_raw_pointer(&*back));
}
BOOST_RETHROW;
}
BOOST_CATCH_END
return r;
}
//////////////////////////////////////////////////////////////////////////////
//
// uninitialized_copy_alloc_n_source
//
//////////////////////////////////////////////////////////////////////////////
//! <b>Effects</b>:
//! \code
//! for (; n--; ++result, ++first)
//! allocator_traits::construct(a, &*result, *first);
//! \endcode
//!
//! <b>Returns</b>: first (after incremented)
template
<typename A,
typename I, // I models InputIterator
typename F> // F models ForwardIterator
I uninitialized_copy_alloc_n_source(A &a, I f, typename std::iterator_traits<I>::difference_type n, F r)
{
F back = r;
BOOST_TRY{
while (n--) {
allocator_traits<A>::construct(a, container_detail::to_raw_pointer(&*r), *f);
++f; ++r;
}
}
BOOST_CATCH(...){
for (; back != r; ++back){
allocator_traits<A>::destroy(a, container_detail::to_raw_pointer(&*back));
}
BOOST_RETHROW;
}
BOOST_CATCH_END
return f;
}
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
// //
// uninitialized_copy_alloc // uninitialized_copy_alloc
@ -206,10 +363,20 @@ template
typename T> typename T>
void uninitialized_fill_alloc(A &a, F f, F l, const T &t) void uninitialized_fill_alloc(A &a, F f, F l, const T &t)
{ {
while (f != l) { F back = f;
allocator_traits<A>::construct(a, container_detail::to_raw_pointer(&*f), t); BOOST_TRY{
++f; while (f != l) {
allocator_traits<A>::construct(a, container_detail::to_raw_pointer(&*f), t);
++f;
}
} }
BOOST_CATCH(...){
for (; back != l; ++back){
allocator_traits<A>::destroy(a, container_detail::to_raw_pointer(&*back));
}
BOOST_RETHROW;
}
BOOST_CATCH_END
} }
////////////////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////////////////
@ -242,6 +409,168 @@ F uninitialized_copy_or_move_alloc
return ::boost::container::uninitialized_copy_alloc(a, f, l, r); return ::boost::container::uninitialized_copy_alloc(a, f, l, r);
} }
//////////////////////////////////////////////////////////////////////////////
//
// uninitialized_copy_or_move_alloc_n
//
//////////////////////////////////////////////////////////////////////////////
template
<typename A
,typename I // I models InputIterator
,typename F> // F models ForwardIterator
F uninitialized_copy_or_move_alloc_n
(A &a, I f, typename std::iterator_traits<I>::difference_type n, F r
,typename boost::container::container_detail::enable_if
< boost::move_detail::is_move_iterator<I> >::type* = 0)
{
return ::boost::container::uninitialized_move_alloc_n(a, f, n, r);
}
template
<typename A
,typename I // I models InputIterator
,typename F> // F models ForwardIterator
F uninitialized_copy_or_move_alloc_n
(A &a, I f, typename std::iterator_traits<I>::difference_type n, F r
,typename boost::container::container_detail::disable_if
< boost::move_detail::is_move_iterator<I> >::type* = 0)
{
return ::boost::container::uninitialized_copy_alloc_n(a, f, n, r);
}
//////////////////////////////////////////////////////////////////////////////
//
// uninitialized_copy_or_move_alloc_n_source
//
//////////////////////////////////////////////////////////////////////////////
template
<typename A
,typename I // I models InputIterator
,typename F> // F models ForwardIterator
I uninitialized_copy_or_move_alloc_n_source
(A &a, I f, typename std::iterator_traits<I>::difference_type n, F r
,typename boost::container::container_detail::enable_if
< boost::move_detail::is_move_iterator<I> >::type* = 0)
{
return ::boost::container::uninitialized_move_alloc_n_source(a, f, n, r);
}
template
<typename A
,typename I // I models InputIterator
,typename F> // F models ForwardIterator
I uninitialized_copy_or_move_alloc_n_source
(A &a, I f, typename std::iterator_traits<I>::difference_type n, F r
,typename boost::container::container_detail::disable_if
< boost::move_detail::is_move_iterator<I> >::type* = 0)
{
return ::boost::container::uninitialized_copy_alloc_n_source(a, f, n, r);
}
//////////////////////////////////////////////////////////////////////////////
//
// copy_or_move
//
//////////////////////////////////////////////////////////////////////////////
template
<typename I, // I models InputIterator
typename F> // F models ForwardIterator
inline F copy_or_move(I f, I l, F r
,typename boost::container::container_detail::enable_if
< boost::move_detail::is_move_iterator<I> >::type* = 0)
{
while (f != l) {
*r = ::boost::move(*f);
++f; ++r;
}
return r;
}
template
<typename I, // I models InputIterator
typename F> // F models ForwardIterator
inline F copy_or_move(I f, I l, F r
,typename boost::container::container_detail::disable_if
< boost::move_detail::is_move_iterator<I> >::type* = 0)
{
while (f != l) {
*r = *f;
++f; ++r;
}
return r;
}
//////////////////////////////////////////////////////////////////////////////
//
// copy_or_move_n
//
//////////////////////////////////////////////////////////////////////////////
template
<typename I, // I models InputIterator
typename F> // F models ForwardIterator
inline F copy_or_move_n(I f, typename std::iterator_traits<I>::difference_type n, F r
,typename boost::container::container_detail::enable_if
< boost::move_detail::is_move_iterator<I> >::type* = 0)
{
while (n--) {
*r = ::boost::move(*f);
++f; ++r;
}
return r;
}
template
<typename I, // I models InputIterator
typename F> // F models ForwardIterator
inline F copy_or_move_n(I f, typename std::iterator_traits<I>::difference_type n, F r
,typename boost::container::container_detail::disable_if
< boost::move_detail::is_move_iterator<I> >::type* = 0)
{
while (n--) {
*r = *f;
++f; ++r;
}
return r;
}
//////////////////////////////////////////////////////////////////////////////
//
// copy_or_move_n_source
//
//////////////////////////////////////////////////////////////////////////////
template
<typename I, // I models InputIterator
typename F> // F models ForwardIterator
inline I copy_or_move_n_source(I f, typename std::iterator_traits<I>::difference_type n, F r
,typename boost::container::container_detail::enable_if
< boost::move_detail::is_move_iterator<I> >::type* = 0)
{
while (n--) {
*r = ::boost::move(*f);
++f; ++r;
}
return f;
}
template
<typename I, // I models InputIterator
typename F> // F models ForwardIterator
inline I copy_or_move_n_source(I f, typename std::iterator_traits<I>::difference_type n, F r
,typename boost::container::container_detail::disable_if
< boost::move_detail::is_move_iterator<I> >::type* = 0)
{
while (n--) {
*r = *f;
++f; ++r;
}
return f;
}
} //namespace container { } //namespace container {
} //namespace boost { } //namespace boost {

View File

@ -13,20 +13,24 @@
#include <boost/container/detail/config_begin.hpp> #include <boost/container/detail/config_begin.hpp>
#if !defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_NO_VARIADIC_TEMPLATES)\ #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)\
&& !defined(BOOST_INTERPROCESS_DISABLE_VARIADIC_TMPL) && !defined(BOOST_INTERPROCESS_DISABLE_VARIADIC_TMPL)
#define BOOST_CONTAINER_PERFECT_FORWARDING #define BOOST_CONTAINER_PERFECT_FORWARDING
#endif #endif
#if defined(BOOST_NO_NOEXCEPT) #if defined(BOOST_NO_CXX11_NOEXCEPT)
#define BOOST_CONTAINER_NOEXCEPT #if defined(BOOST_MSVC)
#define BOOST_CONTAINER_NOEXCEPT throw()
#else
#define BOOST_CONTAINER_NOEXCEPT
#endif
#define BOOST_CONTAINER_NOEXCEPT_IF(x) #define BOOST_CONTAINER_NOEXCEPT_IF(x)
#else #else
#define BOOST_CONTAINER_NOEXCEPT noexcept #define BOOST_CONTAINER_NOEXCEPT noexcept
#define BOOST_CONTAINER_NOEXCEPT_IF(x) noexcept(x) #define BOOST_CONTAINER_NOEXCEPT_IF(x) noexcept(x)
#endif #endif
#if !defined(BOOST_NO_VARIADIC_TEMPLATES) && defined(__GXX_EXPERIMENTAL_CXX0X__)\ #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && defined(__GXX_EXPERIMENTAL_CXX0X__)\
&& (__GNUC__*10000 + __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__ < 40700) && (__GNUC__*10000 + __GNUC_MINOR__*100 + __GNUC_PATCHLEVEL__ < 40700)
#define BOOST_CONTAINER_UNIMPLEMENTED_PACK_EXPANSION_TO_FIXED_LIST #define BOOST_CONTAINER_UNIMPLEMENTED_PACK_EXPANSION_TO_FIXED_LIST
#endif #endif

View File

@ -30,8 +30,8 @@
#include <boost/container/detail/utilities.hpp> #include <boost/container/detail/utilities.hpp>
#include <utility> #include <utility>
#include <boost/container/detail/pair.hpp> #include <boost/container/detail/pair.hpp>
#include <boost/move/move.hpp> #include <boost/move/utility.hpp>
#include <boost/detail/no_exceptions_support.hpp>
namespace boost { namespace container { namespace boost { namespace container {
@ -259,7 +259,7 @@ namespace container_detail {
//! Thanks Mathias! //! Thanks Mathias!
//With variadic templates, we need a single class to implement the trait //With variadic templates, we need a single class to implement the trait
#if !defined(BOOST_NO_VARIADIC_TEMPLATES) #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
template<class T, class ...Args> template<class T, class ...Args>
struct is_constructible_impl struct is_constructible_impl
@ -290,7 +290,7 @@ namespace container_detail {
: is_constructible<T, allocator_arg_t, InnerAlloc, Args...> : is_constructible<T, allocator_arg_t, InnerAlloc, Args...>
{}; {};
#else // #if !defined(BOOST_NO_VARIADIC_TEMPLATES) #else // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
//Without variadic templates, we need to use de preprocessor to generate //Without variadic templates, we need to use de preprocessor to generate
//some specializations. //some specializations.
@ -382,14 +382,14 @@ namespace container_detail {
> >
{};*/ {};*/
#endif // #if !defined(BOOST_NO_VARIADIC_TEMPLATES) #endif // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
#else // #if !defined(BOOST_NO_SFINAE_EXPR) #else // #if !defined(BOOST_NO_SFINAE_EXPR)
//Without advanced SFINAE expressions, we can't use is_constructible //Without advanced SFINAE expressions, we can't use is_constructible
//so backup to constructible_with_allocator_xxx //so backup to constructible_with_allocator_xxx
#if !defined(BOOST_NO_VARIADIC_TEMPLATES) #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
template < class T, class InnerAlloc, class ...Args> template < class T, class InnerAlloc, class ...Args>
struct is_constructible_with_allocator_prefix struct is_constructible_with_allocator_prefix
@ -401,7 +401,7 @@ namespace container_detail {
: constructible_with_allocator_suffix<T> : constructible_with_allocator_suffix<T>
{};*/ {};*/
#else // #if !defined(BOOST_NO_VARIADIC_TEMPLATES) #else // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
template < class T template < class T
, class InnerAlloc , class InnerAlloc
@ -423,11 +423,11 @@ namespace container_detail {
: constructible_with_allocator_suffix<T> : constructible_with_allocator_suffix<T>
{};*/ {};*/
#endif // #if !defined(BOOST_NO_VARIADIC_TEMPLATES) #endif // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
#endif // #if !defined(BOOST_NO_SFINAE_EXPR) #endif // #if !defined(BOOST_NO_SFINAE_EXPR)
#if !defined(BOOST_NO_VARIADIC_TEMPLATES) #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
template < typename OutermostAlloc template < typename OutermostAlloc
, typename InnerAlloc , typename InnerAlloc
@ -489,7 +489,7 @@ inline void dispatch_uses_allocator
(outermost_alloc, p, ::boost::forward<Args>(args)...); (outermost_alloc, p, ::boost::forward<Args>(args)...);
} }
#else //#if !defined(BOOST_NO_VARIADIC_TEMPLATES) #else //#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
#define BOOST_PP_LOCAL_MACRO(n) \ #define BOOST_PP_LOCAL_MACRO(n) \
template < typename OutermostAlloc \ template < typename OutermostAlloc \
@ -564,9 +564,9 @@ inline void dispatch_uses_allocator(boost::false_type uses_allocator
#define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS) #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
#include BOOST_PP_LOCAL_ITERATE() #include BOOST_PP_LOCAL_ITERATE()
#endif //#if !defined(BOOST_NO_VARIADIC_TEMPLATES) #endif //#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
#if !defined(BOOST_NO_VARIADIC_TEMPLATES) #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
template <typename OuterAlloc, class ...InnerAllocs> template <typename OuterAlloc, class ...InnerAllocs>
class scoped_allocator_adaptor_base class scoped_allocator_adaptor_base
@ -679,7 +679,7 @@ class scoped_allocator_adaptor_base
inner_allocator_type m_inner; inner_allocator_type m_inner;
}; };
#else //#if !defined(BOOST_NO_VARIADIC_TEMPLATES) #else //#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
//Let's add a dummy first template parameter to allow creating //Let's add a dummy first template parameter to allow creating
//specializations up to maximum InnerAlloc count //specializations up to maximum InnerAlloc count
@ -829,13 +829,13 @@ class scoped_allocator_adaptor_base<OuterAlloc, true
#define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS) #define BOOST_PP_LOCAL_LIMITS (1, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
#include BOOST_PP_LOCAL_ITERATE() #include BOOST_PP_LOCAL_ITERATE()
#endif //#if !defined(BOOST_NO_VARIADIC_TEMPLATES) #endif //#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
//Specialization for adaptor without any InnerAlloc //Specialization for adaptor without any InnerAlloc
template <typename OuterAlloc> template <typename OuterAlloc>
class scoped_allocator_adaptor_base class scoped_allocator_adaptor_base
< OuterAlloc < OuterAlloc
#if defined(BOOST_NO_VARIADIC_TEMPLATES) #if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
, true , true
BOOST_PP_ENUM_TRAILING(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, BOOST_CONTAINER_PP_IDENTITY, nat) BOOST_PP_ENUM_TRAILING(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, BOOST_CONTAINER_PP_IDENTITY, nat)
#endif #endif
@ -850,7 +850,7 @@ class scoped_allocator_adaptor_base
{ {
typedef scoped_allocator_adaptor_base typedef scoped_allocator_adaptor_base
<typename allocator_traits<OuterAlloc>::template portable_rebind_alloc<U>::type <typename allocator_traits<OuterAlloc>::template portable_rebind_alloc<U>::type
#if defined(BOOST_NO_VARIADIC_TEMPLATES) #if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
, true , true
BOOST_PP_ENUM_TRAILING(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, BOOST_CONTAINER_PP_IDENTITY, container_detail::nat) BOOST_PP_ENUM_TRAILING(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, BOOST_CONTAINER_PP_IDENTITY, container_detail::nat)
#endif #endif
@ -887,7 +887,7 @@ class scoped_allocator_adaptor_base
scoped_allocator_adaptor_base scoped_allocator_adaptor_base
(const scoped_allocator_adaptor_base< (const scoped_allocator_adaptor_base<
OuterA2 OuterA2
#if defined(BOOST_NO_VARIADIC_TEMPLATES) #if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
, true , true
BOOST_PP_ENUM_TRAILING(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, BOOST_CONTAINER_PP_IDENTITY, container_detail::nat) BOOST_PP_ENUM_TRAILING(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, BOOST_CONTAINER_PP_IDENTITY, container_detail::nat)
#endif #endif
@ -899,7 +899,7 @@ class scoped_allocator_adaptor_base
scoped_allocator_adaptor_base scoped_allocator_adaptor_base
(BOOST_RV_REF_BEG scoped_allocator_adaptor_base< (BOOST_RV_REF_BEG scoped_allocator_adaptor_base<
OuterA2 OuterA2
#if defined(BOOST_NO_VARIADIC_TEMPLATES) #if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
, true , true
BOOST_PP_ENUM_TRAILING(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, BOOST_CONTAINER_PP_IDENTITY, container_detail::nat) BOOST_PP_ENUM_TRAILING(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, BOOST_CONTAINER_PP_IDENTITY, container_detail::nat)
#endif #endif
@ -946,7 +946,7 @@ class scoped_allocator_adaptor_base
///@endcond ///@endcond
//Scoped allocator //Scoped allocator
#if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
#if !defined(BOOST_CONTAINER_UNIMPLEMENTED_PACK_EXPANSION_TO_FIXED_LIST) #if !defined(BOOST_CONTAINER_UNIMPLEMENTED_PACK_EXPANSION_TO_FIXED_LIST)
@ -992,7 +992,7 @@ class scoped_allocator_adaptor_base
#endif // #if !defined(BOOST_CONTAINER_UNIMPLEMENTED_PACK_EXPANSION_TO_FIXED_LIST) #endif // #if !defined(BOOST_CONTAINER_UNIMPLEMENTED_PACK_EXPANSION_TO_FIXED_LIST)
#else // #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) #else // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
template <typename OuterAlloc template <typename OuterAlloc
BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, class Q) BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, class Q)
@ -1001,7 +1001,7 @@ class scoped_allocator_adaptor
#endif #endif
: public container_detail::scoped_allocator_adaptor_base : public container_detail::scoped_allocator_adaptor_base
<OuterAlloc <OuterAlloc
#if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
, InnerAllocs... , InnerAllocs...
#else #else
, true BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, Q) , true BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, Q)
@ -1014,7 +1014,7 @@ class scoped_allocator_adaptor
/// @cond /// @cond
typedef container_detail::scoped_allocator_adaptor_base typedef container_detail::scoped_allocator_adaptor_base
<OuterAlloc <OuterAlloc
#if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
, InnerAllocs... , InnerAllocs...
#else #else
, true BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, Q) , true BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, Q)
@ -1058,7 +1058,7 @@ class scoped_allocator_adaptor
{ {
typedef scoped_allocator_adaptor typedef scoped_allocator_adaptor
< typename outer_traits_type::template portable_rebind_alloc<U>::type < typename outer_traits_type::template portable_rebind_alloc<U>::type
#if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
, InnerAllocs... , InnerAllocs...
#else #else
BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, Q) BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, Q)
@ -1086,7 +1086,7 @@ class scoped_allocator_adaptor
: base_type(::boost::move(other.base())) : base_type(::boost::move(other.base()))
{} {}
#if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
//! <b>Requires</b>: OuterAlloc shall be constructible from OuterA2. //! <b>Requires</b>: OuterAlloc shall be constructible from OuterA2.
//! //!
@ -1097,7 +1097,7 @@ class scoped_allocator_adaptor
scoped_allocator_adaptor(BOOST_FWD_REF(OuterA2) outerAlloc, const InnerAllocs & ...innerAllocs) scoped_allocator_adaptor(BOOST_FWD_REF(OuterA2) outerAlloc, const InnerAllocs & ...innerAllocs)
: base_type(::boost::forward<OuterA2>(outerAlloc), innerAllocs...) : base_type(::boost::forward<OuterA2>(outerAlloc), innerAllocs...)
{} {}
#else // #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) #else // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
#define BOOST_PP_LOCAL_MACRO(n) \ #define BOOST_PP_LOCAL_MACRO(n) \
template <class OuterA2> \ template <class OuterA2> \
@ -1111,14 +1111,14 @@ class scoped_allocator_adaptor
#define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS) #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
#include BOOST_PP_LOCAL_ITERATE() #include BOOST_PP_LOCAL_ITERATE()
#endif // #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) #endif // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
//! <b>Requires</b>: OuterAlloc shall be constructible from OuterA2. //! <b>Requires</b>: OuterAlloc shall be constructible from OuterA2.
//! //!
//! <b>Effects</b>: initializes each allocator within the adaptor with the corresponding allocator from other. //! <b>Effects</b>: initializes each allocator within the adaptor with the corresponding allocator from other.
template <class OuterA2> template <class OuterA2>
scoped_allocator_adaptor(const scoped_allocator_adaptor<OuterA2 scoped_allocator_adaptor(const scoped_allocator_adaptor<OuterA2
#if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
, InnerAllocs... , InnerAllocs...
#else #else
BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, Q) BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, Q)
@ -1133,7 +1133,7 @@ class scoped_allocator_adaptor
//! rvalue from other. //! rvalue from other.
template <class OuterA2> template <class OuterA2>
scoped_allocator_adaptor(BOOST_RV_REF_BEG scoped_allocator_adaptor<OuterA2 scoped_allocator_adaptor(BOOST_RV_REF_BEG scoped_allocator_adaptor<OuterA2
#if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
, InnerAllocs... , InnerAllocs...
#else #else
BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, Q) BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, Q)
@ -1229,7 +1229,7 @@ class scoped_allocator_adaptor
const base_type &base() const { return *this; } const base_type &base() const { return *this; }
/// @endcond /// @endcond
#if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
//! <b>Effects</b>: //! <b>Effects</b>:
//! 1) If `uses_allocator<T, inner_allocator_type>::value` is false calls //! 1) If `uses_allocator<T, inner_allocator_type>::value` is false calls
@ -1274,7 +1274,7 @@ class scoped_allocator_adaptor
, p, ::boost::forward<Args>(args)...); , p, ::boost::forward<Args>(args)...);
} }
#else // #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) #else // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
//Disable this overload if the first argument is pair as some compilers have //Disable this overload if the first argument is pair as some compilers have
//overload selection problems when the first parameter is a pair. //overload selection problems when the first parameter is a pair.
@ -1295,7 +1295,7 @@ class scoped_allocator_adaptor
#define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS) #define BOOST_PP_LOCAL_LIMITS (0, BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS)
#include BOOST_PP_LOCAL_ITERATE() #include BOOST_PP_LOCAL_ITERATE()
#endif // #if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) #endif // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
template <class T1, class T2> template <class T1, class T2>
void construct(std::pair<T1,T2>* p) void construct(std::pair<T1,T2>* p)
@ -1338,52 +1338,56 @@ class scoped_allocator_adaptor
void construct_pair(Pair* p) void construct_pair(Pair* p)
{ {
this->construct(container_detail::addressof(p->first)); this->construct(container_detail::addressof(p->first));
try { BOOST_TRY{
this->construct(container_detail::addressof(p->second)); this->construct(container_detail::addressof(p->second));
} }
catch (...) { BOOST_CATCH(...){
this->destroy(container_detail::addressof(p->first)); this->destroy(container_detail::addressof(p->first));
throw; BOOST_RETHROW
} }
BOOST_CATCH_END
} }
template <class Pair, class U, class V> template <class Pair, class U, class V>
void construct_pair(Pair* p, BOOST_FWD_REF(U) x, BOOST_FWD_REF(V) y) void construct_pair(Pair* p, BOOST_FWD_REF(U) x, BOOST_FWD_REF(V) y)
{ {
this->construct(container_detail::addressof(p->first), ::boost::forward<U>(x)); this->construct(container_detail::addressof(p->first), ::boost::forward<U>(x));
try { BOOST_TRY{
this->construct(container_detail::addressof(p->second), ::boost::forward<V>(y)); this->construct(container_detail::addressof(p->second), ::boost::forward<V>(y));
} }
catch (...) { BOOST_CATCH(...){
this->destroy(container_detail::addressof(p->first)); this->destroy(container_detail::addressof(p->first));
throw; BOOST_RETHROW
} }
BOOST_CATCH_END
} }
template <class Pair, class Pair2> template <class Pair, class Pair2>
void construct_pair(Pair* p, const Pair2& pr) void construct_pair(Pair* p, const Pair2& pr)
{ {
this->construct(container_detail::addressof(p->first), pr.first); this->construct(container_detail::addressof(p->first), pr.first);
try { BOOST_TRY{
this->construct(container_detail::addressof(p->second), pr.second); this->construct(container_detail::addressof(p->second), pr.second);
} }
catch (...) { BOOST_CATCH(...){
this->destroy(container_detail::addressof(p->first)); this->destroy(container_detail::addressof(p->first));
throw; BOOST_RETHROW
} }
BOOST_CATCH_END
} }
template <class Pair, class Pair2> template <class Pair, class Pair2>
void construct_pair(Pair* p, BOOST_RV_REF(Pair2) pr) void construct_pair(Pair* p, BOOST_RV_REF(Pair2) pr)
{ {
this->construct(container_detail::addressof(p->first), ::boost::move(pr.first)); this->construct(container_detail::addressof(p->first), ::boost::move(pr.first));
try { BOOST_TRY{
this->construct(container_detail::addressof(p->second), ::boost::move(pr.second)); this->construct(container_detail::addressof(p->second), ::boost::move(pr.second));
} }
catch (...) { BOOST_CATCH(...){
this->destroy(container_detail::addressof(p->first)); this->destroy(container_detail::addressof(p->first));
throw; BOOST_RETHROW
} }
BOOST_CATCH_END
} }
//template <class T1, class T2, class... Args1, class... Args2> //template <class T1, class T2, class... Args1, class... Args2>
@ -1399,7 +1403,7 @@ class scoped_allocator_adaptor
}; };
template <typename OuterA1, typename OuterA2 template <typename OuterA1, typename OuterA2
#if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
, typename... InnerAllocs , typename... InnerAllocs
#else #else
BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, class Q) BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, class Q)
@ -1407,21 +1411,21 @@ template <typename OuterA1, typename OuterA2
> >
inline bool operator==( inline bool operator==(
const scoped_allocator_adaptor<OuterA1 const scoped_allocator_adaptor<OuterA1
#if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
,InnerAllocs... ,InnerAllocs...
#else #else
BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, Q) BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, Q)
#endif #endif
>& a, >& a,
const scoped_allocator_adaptor<OuterA2 const scoped_allocator_adaptor<OuterA2
#if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
,InnerAllocs... ,InnerAllocs...
#else #else
BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, Q) BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, Q)
#endif #endif
>& b) >& b)
{ {
#if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
const bool has_zero_inner = sizeof...(InnerAllocs) == 0u; const bool has_zero_inner = sizeof...(InnerAllocs) == 0u;
#else #else
const bool has_zero_inner = const bool has_zero_inner =
@ -1434,7 +1438,7 @@ inline bool operator==(
} }
template <typename OuterA1, typename OuterA2 template <typename OuterA1, typename OuterA2
#if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
, typename... InnerAllocs , typename... InnerAllocs
#else #else
BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, class Q) BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, class Q)
@ -1442,14 +1446,14 @@ template <typename OuterA1, typename OuterA2
> >
inline bool operator!=( inline bool operator!=(
const scoped_allocator_adaptor<OuterA1 const scoped_allocator_adaptor<OuterA1
#if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
,InnerAllocs... ,InnerAllocs...
#else #else
BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, Q) BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, Q)
#endif #endif
>& a, >& a,
const scoped_allocator_adaptor<OuterA2 const scoped_allocator_adaptor<OuterA2
#if !defined(BOOST_NO_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED) #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) || defined(BOOST_CONTAINER_DOXYGEN_INVOKED)
,InnerAllocs... ,InnerAllocs...
#else #else
BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, Q) BOOST_PP_ENUM_TRAILING_PARAMS(BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS, Q)

View File

@ -18,7 +18,7 @@
#include <boost/container/detail/config_begin.hpp> #include <boost/container/detail/config_begin.hpp>
#include <boost/container/detail/workaround.hpp> #include <boost/container/detail/workaround.hpp>
#if defined(BOOST_NO_VARIADIC_TEMPLATES) #if defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
#include <boost/container/detail/preprocessor.hpp> #include <boost/container/detail/preprocessor.hpp>
#include <boost/container/detail/type_traits.hpp> #include <boost/container/detail/type_traits.hpp>
#endif #endif
@ -27,7 +27,7 @@ namespace boost { namespace container {
///@cond ///@cond
#if !defined(BOOST_NO_VARIADIC_TEMPLATES) #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
#if !defined(BOOST_CONTAINER_UNIMPLEMENTED_PACK_EXPANSION_TO_FIXED_LIST) #if !defined(BOOST_CONTAINER_UNIMPLEMENTED_PACK_EXPANSION_TO_FIXED_LIST)
@ -45,7 +45,7 @@ namespace boost { namespace container {
#endif // #if !defined(BOOST_CONTAINER_UNIMPLEMENTED_PACK_EXPANSION_TO_FIXED_LIST) #endif // #if !defined(BOOST_CONTAINER_UNIMPLEMENTED_PACK_EXPANSION_TO_FIXED_LIST)
#else // #if !defined(BOOST_NO_VARIADIC_TEMPLATES) #else // #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
template <typename OuterAlloc template <typename OuterAlloc
BOOST_PP_ENUM_TRAILING( BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS BOOST_PP_ENUM_TRAILING( BOOST_CONTAINER_MAX_CONSTRUCTOR_PARAMETERS

View File

@ -11,7 +11,7 @@
[section:scoped_enums Scoped Enums] [section:scoped_enums Scoped Enums]
Generates C++0x scoped enums if the feature is present, otherwise emulates C++0x Generates C++0x scoped enums if the feature is present, otherwise emulates C++0x
scoped enums with C++03 namespaces and enums. The Boost.Config BOOST_NO_SCOPED_ENUMS scoped enums with C++03 namespaces and enums. The Boost.Config BOOST_NO_CXX11_SCOPED_ENUMS
macro is used to detect feature support. macro is used to detect feature support.
See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2347.pdf for a See http://www.open-std.org/jtc1/sc22/wg21/docs/papers/2007/n2347.pdf for a
@ -71,14 +71,14 @@ use
And instead of And instead of
#ifdef BOOST_NO_SCOPED_ENUMS #ifdef BOOST_NO_CXX11_SCOPED_ENUMS
template <> template <>
struct BOOST_SYMBOL_VISIBLE is_error_code_enum<future_errc> : public true_type { }; struct BOOST_SYMBOL_VISIBLE is_error_code_enum<future_errc> : public true_type { };
#endif #endif
use use
#ifdef BOOST_NO_SCOPED_ENUMS #ifdef BOOST_NO_CXX11_SCOPED_ENUMS
template <> template <>
struct BOOST_SYMBOL_VISIBLE is_error_code_enum<future_errc::enum_type > : public true_type { }; struct BOOST_SYMBOL_VISIBLE is_error_code_enum<future_errc::enum_type > : public true_type { };
#endif #endif
@ -130,7 +130,7 @@ Sample usage:
namespace boost namespace boost
{ {
#ifdef BOOST_NO_SCOPED_ENUMS #ifdef BOOST_NO_CXX11_SCOPED_ENUMS
/** /**
* Meta-function to get the underlying type of a scoped enum. * Meta-function to get the underlying type of a scoped enum.
* *
@ -193,7 +193,7 @@ namespace boost
return e.native_value_(); return e.native_value_();
} }
#else // BOOST_NO_SCOPED_ENUMS #else // BOOST_NO_CXX11_SCOPED_ENUMS
template <typename EnumType> template <typename EnumType>
struct underlying_type struct underlying_type
@ -224,9 +224,9 @@ namespace boost
} }
#ifdef BOOST_NO_SCOPED_ENUMS #ifdef BOOST_NO_CXX11_SCOPED_ENUMS
#ifndef BOOST_NO_EXPLICIT_CONVERSION_OPERATORS #ifndef BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS
#define BOOST_SCOPED_ENUM_UT_DECLARE_CONVERSION_OPERATOR \ #define BOOST_SCOPED_ENUM_UT_DECLARE_CONVERSION_OPERATOR \
explicit operator underlying_type() const { return get_underlying_value_(); } explicit operator underlying_type() const { return get_underlying_value_(); }
@ -305,7 +305,7 @@ namespace boost
*/ */
#define BOOST_SCOPED_ENUM_FORWARD_DECLARE(EnumType) struct EnumType #define BOOST_SCOPED_ENUM_FORWARD_DECLARE(EnumType) struct EnumType
#else // BOOST_NO_SCOPED_ENUMS #else // BOOST_NO_CXX11_SCOPED_ENUMS
#define BOOST_SCOPED_ENUM_UT_DECLARE_BEGIN(EnumType,UnderlyingType) enum class EnumType:UnderlyingType #define BOOST_SCOPED_ENUM_UT_DECLARE_BEGIN(EnumType,UnderlyingType) enum class EnumType:UnderlyingType
#define BOOST_SCOPED_ENUM_DECLARE_BEGIN(EnumType) enum class EnumType #define BOOST_SCOPED_ENUM_DECLARE_BEGIN(EnumType) enum class EnumType
@ -315,13 +315,13 @@ namespace boost
#define BOOST_SCOPED_ENUM_NATIVE(EnumType) EnumType #define BOOST_SCOPED_ENUM_NATIVE(EnumType) EnumType
#define BOOST_SCOPED_ENUM_FORWARD_DECLARE(EnumType) enum class EnumType #define BOOST_SCOPED_ENUM_FORWARD_DECLARE(EnumType) enum class EnumType
#endif // BOOST_NO_SCOPED_ENUMS #endif // BOOST_NO_CXX11_SCOPED_ENUMS
#define BOOST_SCOPED_ENUM_START(name) BOOST_SCOPED_ENUM_DECLARE_BEGIN(name) #define BOOST_SCOPED_ENUM_START(name) BOOST_SCOPED_ENUM_DECLARE_BEGIN(name)
#define BOOST_SCOPED_ENUM_END BOOST_SCOPED_ENUM_DECLARE_END2() #define BOOST_SCOPED_ENUM_END BOOST_SCOPED_ENUM_DECLARE_END2()
#define BOOST_SCOPED_ENUM(name) BOOST_SCOPED_ENUM_NATIVE(name) #define BOOST_SCOPED_ENUM(name) BOOST_SCOPED_ENUM_NATIVE(name)
//#ifdef BOOST_NO_SCOPED_ENUMS //#ifdef BOOST_NO_CXX11_SCOPED_ENUMS
// //
//# define BOOST_SCOPED_ENUM_START(name) struct name { enum enum_type //# define BOOST_SCOPED_ENUM_START(name) struct name { enum enum_type
//# define BOOST_SCOPED_ENUM_END }; //# define BOOST_SCOPED_ENUM_END };

View File

@ -31,7 +31,7 @@
#include <boost/detail/workaround.hpp> #include <boost/detail/workaround.hpp>
// Some compilers let us detect even const-qualified rvalues at compile-time // Some compilers let us detect even const-qualified rvalues at compile-time
#if !defined(BOOST_NO_RVALUE_REFERENCES) \ #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) \
|| BOOST_WORKAROUND(BOOST_MSVC, >= 1310) && !defined(_PREFAST_) \ || BOOST_WORKAROUND(BOOST_MSVC, >= 1310) && !defined(_PREFAST_) \
|| (BOOST_WORKAROUND(__GNUC__, == 4) && (__GNUC_MINOR__ <= 5) && !defined(BOOST_INTEL) && \ || (BOOST_WORKAROUND(__GNUC__, == 4) && (__GNUC_MINOR__ <= 5) && !defined(BOOST_INTEL) && \
!defined(BOOST_CLANG)) \ !defined(BOOST_CLANG)) \
@ -228,7 +228,7 @@ template<typename T>
inline boost::mpl::true_ *is_const_(T const &) { return 0; } inline boost::mpl::true_ *is_const_(T const &) { return 0; }
#endif #endif
#ifdef BOOST_NO_RVALUE_REFERENCES #ifdef BOOST_NO_CXX11_RVALUE_REFERENCES
template<typename T> template<typename T>
inline boost::mpl::false_ *is_rvalue_(T &, int) { return 0; } inline boost::mpl::false_ *is_rvalue_(T &, int) { return 0; }
@ -459,7 +459,7 @@ inline T &derefof(T *t)
#endif #endif
#if defined(BOOST_FOREACH_COMPILE_TIME_CONST_RVALUE_DETECTION) \ #if defined(BOOST_FOREACH_COMPILE_TIME_CONST_RVALUE_DETECTION) \
&& !defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// Rvalue references makes it drop-dead simple to detect at compile time // Rvalue references makes it drop-dead simple to detect at compile time
// whether an expression is an rvalue. // whether an expression is an rvalue.
@ -469,7 +469,7 @@ inline T &derefof(T *t)
boost::foreach_detail_::is_rvalue_((COL), 0) boost::foreach_detail_::is_rvalue_((COL), 0)
#elif defined(BOOST_FOREACH_COMPILE_TIME_CONST_RVALUE_DETECTION) \ #elif defined(BOOST_FOREACH_COMPILE_TIME_CONST_RVALUE_DETECTION) \
&& defined(BOOST_NO_RVALUE_REFERENCES) && defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
// Detect at compile-time whether an expression yields an rvalue or // Detect at compile-time whether an expression yields an rvalue or
// an lvalue. This is rather non-standard, but some popular compilers // an lvalue. This is rather non-standard, but some popular compilers
@ -959,7 +959,7 @@ rderef(auto_any_t cur, type2type<T, C> *)
(true ? boost::foreach_detail_::make_probe((COL), BOOST_FOREACH_ID(_foreach_is_rvalue)) : (COL)) (true ? boost::foreach_detail_::make_probe((COL), BOOST_FOREACH_ID(_foreach_is_rvalue)) : (COL))
// The rvalue/lvalue-ness of the collection expression is determined dynamically, unless // The rvalue/lvalue-ness of the collection expression is determined dynamically, unless
// type type is an array or is noncopyable or is non-const, in which case we know it's an lvalue. // the type is an array or is noncopyable or is non-const, in which case we know it's an lvalue.
// If the type happens to be a lightweight proxy, always make a copy. // If the type happens to be a lightweight proxy, always make a copy.
# define BOOST_FOREACH_SHOULD_COPY(COL) \ # define BOOST_FOREACH_SHOULD_COPY(COL) \
(boost::foreach_detail_::should_copy_impl( \ (boost::foreach_detail_::should_copy_impl( \

View File

@ -677,7 +677,7 @@ namespace boost {
vtable_type* get_vtable() const { vtable_type* get_vtable() const {
return reinterpret_cast<vtable_type*>( return reinterpret_cast<vtable_type*>(
reinterpret_cast<std::size_t>(vtable) & ~static_cast<size_t>(0x01)); reinterpret_cast<std::size_t>(vtable) & ~static_cast<std::size_t>(0x01));
} }
struct clear_type {}; struct clear_type {};
@ -749,7 +749,7 @@ namespace boost {
this->assign_to_own(f); this->assign_to_own(f);
} }
#ifndef BOOST_NO_RVALUE_REFERENCES #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
BOOST_FUNCTION_FUNCTION(BOOST_FUNCTION_FUNCTION&& f) : function_base() BOOST_FUNCTION_FUNCTION(BOOST_FUNCTION_FUNCTION&& f) : function_base()
{ {
this->move_assign(f); this->move_assign(f);
@ -838,7 +838,7 @@ namespace boost {
return *this; return *this;
} }
#ifndef BOOST_NO_RVALUE_REFERENCES #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
// Move assignment from another BOOST_FUNCTION_FUNCTION // Move assignment from another BOOST_FUNCTION_FUNCTION
BOOST_FUNCTION_FUNCTION& operator=(BOOST_FUNCTION_FUNCTION&& f) BOOST_FUNCTION_FUNCTION& operator=(BOOST_FUNCTION_FUNCTION&& f)
{ {
@ -1090,7 +1090,7 @@ public:
function(const base_type& f) : base_type(static_cast<const base_type&>(f)){} function(const base_type& f) : base_type(static_cast<const base_type&>(f)){}
#ifndef BOOST_NO_RVALUE_REFERENCES #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
// Move constructors // Move constructors
function(self_type&& f): base_type(static_cast<base_type&&>(f)){} function(self_type&& f): base_type(static_cast<base_type&&>(f)){}
function(base_type&& f): base_type(static_cast<base_type&&>(f)){} function(base_type&& f): base_type(static_cast<base_type&&>(f)){}
@ -1102,7 +1102,7 @@ public:
return *this; return *this;
} }
#ifndef BOOST_NO_RVALUE_REFERENCES #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
self_type& operator=(self_type&& f) self_type& operator=(self_type&& f)
{ {
self_type(static_cast<self_type&&>(f)).swap(*this); self_type(static_cast<self_type&&>(f)).swap(*this);
@ -1139,7 +1139,7 @@ public:
return *this; return *this;
} }
#ifndef BOOST_NO_RVALUE_REFERENCES #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
self_type& operator=(base_type&& f) self_type& operator=(base_type&& f)
{ {
self_type(static_cast<base_type&&>(f)).swap(*this); self_type(static_cast<base_type&&>(f)).swap(*this);

View File

@ -1,29 +0,0 @@
// Copyright 2012 Daniel James.
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
#if !defined(BOOST_DETAIL_CONTAINER_FWD_0X_HPP)
#define BOOST_DETAIL_CONTAINER_FWD_0X_HPP
#include <boost/detail/container_fwd.hpp>
// std::array
#if !defined(BOOST_NO_CXX11_HDR_ARRAY)
# include <array>
#endif
// std::tuple
#if !defined(BOOST_NO_CXX11_HDR_TUPLE)
# include <tuple>
#endif
// std::shared_ptr/std::unique_ptr
#if !defined(BOOST_NO_CXX11_HDR_MEMORY)
# include <memory>
#endif
#endif

View File

@ -13,6 +13,94 @@
# pragma once # pragma once
#endif #endif
// Set BOOST_HASH_CONFORMANT_FLOATS to 1 for libraries known to have
// sufficiently good floating point support to not require any
// workarounds.
//
// When set to 0, the library tries to automatically
// use the best available implementation. This normally works well, but
// breaks when ambiguities are created by odd namespacing of the functions.
//
// Note that if this is set to 0, the library should still take full
// advantage of the platform's floating point support.
#if defined(__SGI_STL_PORT) || defined(_STLPORT_VERSION)
# define BOOST_HASH_CONFORMANT_FLOATS 0
#elif defined(__LIBCOMO__)
# define BOOST_HASH_CONFORMANT_FLOATS 0
#elif defined(__STD_RWCOMPILER_H__) || defined(_RWSTD_VER)
// Rogue Wave library:
# define BOOST_HASH_CONFORMANT_FLOATS 0
#elif defined(_LIBCPP_VERSION)
// libc++
# define BOOST_HASH_CONFORMANT_FLOATS 1
#elif defined(__GLIBCPP__) || defined(__GLIBCXX__)
// GNU libstdc++ 3
# if defined(__GNUC__) && __GNUC__ >= 4
# define BOOST_HASH_CONFORMANT_FLOATS 1
# else
# define BOOST_HASH_CONFORMANT_FLOATS 0
# endif
#elif defined(__STL_CONFIG_H)
// generic SGI STL
# define BOOST_HASH_CONFORMANT_FLOATS 0
#elif defined(__MSL_CPP__)
// MSL standard lib:
# define BOOST_HASH_CONFORMANT_FLOATS 0
#elif defined(__IBMCPP__)
// VACPP std lib (probably conformant for much earlier version).
# if __IBMCPP__ >= 1210
# define BOOST_HASH_CONFORMANT_FLOATS 1
# else
# define BOOST_HASH_CONFORMANT_FLOATS 0
# endif
#elif defined(MSIPL_COMPILE_H)
// Modena C++ standard library
# define BOOST_HASH_CONFORMANT_FLOATS 0
#elif (defined(_YVALS) && !defined(__IBMCPP__)) || defined(_CPPLIB_VER)
// Dinkumware Library (this has to appear after any possible replacement libraries):
# if _CPPLIB_VER >= 405
# define BOOST_HASH_CONFORMANT_FLOATS 1
# else
# define BOOST_HASH_CONFORMANT_FLOATS 0
# endif
#else
# define BOOST_HASH_CONFORMANT_FLOATS 0
#endif
#if BOOST_HASH_CONFORMANT_FLOATS
// The standard library is known to be compliant, so don't use the
// configuration mechanism.
namespace boost {
namespace hash_detail {
template <typename Float>
struct call_ldexp {
typedef Float float_type;
inline Float operator()(Float x, int y) const {
return std::ldexp(x, y);
}
};
template <typename Float>
struct call_frexp {
typedef Float float_type;
inline Float operator()(Float x, int* y) const {
return std::frexp(x, y);
}
};
template <typename Float>
struct select_hash_type
{
typedef Float type;
};
}
}
#else // BOOST_HASH_CONFORMANT_FLOATS == 0
// The C++ standard requires that the C float functions are overloarded // The C++ standard requires that the C float functions are overloarded
// for float, double and long double in the std namespace, but some of the older // for float, double and long double in the std namespace, but some of the older
// library implementations don't support this. On some that don't, the C99 // library implementations don't support this. On some that don't, the C99
@ -243,4 +331,6 @@ namespace boost
} }
} }
#endif // BOOST_HASH_CONFORMANT_FLOATS
#endif #endif

View File

@ -73,7 +73,9 @@ namespace boost
ptr += sizeof(std::size_t); ptr += sizeof(std::size_t);
while(length >= sizeof(std::size_t)) { while(length >= sizeof(std::size_t)) {
hash_float_combine(seed, *(std::size_t*) ptr); std::size_t buffer = 0;
std::memcpy(&buffer, ptr, sizeof(std::size_t));
hash_float_combine(seed, buffer);
length -= sizeof(std::size_t); length -= sizeof(std::size_t);
ptr += sizeof(std::size_t); ptr += sizeof(std::size_t);
} }
@ -210,8 +212,15 @@ namespace boost
template <class T> template <class T>
inline std::size_t float_hash_value(T v) inline std::size_t float_hash_value(T v)
{ {
#if defined(fpclassify)
switch (fpclassify(v))
#elif BOOST_HASH_CONFORMANT_FLOATS
switch (std::fpclassify(v))
#else
using namespace std; using namespace std;
switch (fpclassify(v)) { switch (fpclassify(v))
#endif
{
case FP_ZERO: case FP_ZERO:
return 0; return 0;
case FP_INFINITE: case FP_INFINITE:

View File

@ -14,12 +14,24 @@
#define BOOST_FUNCTIONAL_HASH_EXTENSIONS_HPP #define BOOST_FUNCTIONAL_HASH_EXTENSIONS_HPP
#include <boost/functional/hash/hash.hpp> #include <boost/functional/hash/hash.hpp>
#include <boost/functional/hash/detail/container_fwd_0x.hpp> #include <boost/detail/container_fwd.hpp>
#include <boost/utility/enable_if.hpp> #include <boost/utility/enable_if.hpp>
#include <boost/static_assert.hpp> #include <boost/static_assert.hpp>
#include <boost/preprocessor/repetition/repeat_from_to.hpp> #include <boost/preprocessor/repetition/repeat_from_to.hpp>
#include <boost/preprocessor/repetition/enum_params.hpp> #include <boost/preprocessor/repetition/enum_params.hpp>
#if !defined(BOOST_NO_CXX11_HDR_ARRAY)
# include <array>
#endif
#if !defined(BOOST_NO_CXX11_HDR_TUPLE)
# include <tuple>
#endif
#if !defined(BOOST_NO_CXX11_HDR_MEMORY)
# include <memory>
#endif
#if defined(_MSC_VER) && (_MSC_VER >= 1020) #if defined(_MSC_VER) && (_MSC_VER >= 1020)
# pragma once # pragma once
#endif #endif
@ -149,7 +161,7 @@ namespace boost
} }
} }
#if !defined(BOOST_NO_VARIADIC_TEMPLATES) #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
template <typename... T> template <typename... T>
inline std::size_t hash_value(std::tuple<T...> const& v) inline std::size_t hash_value(std::tuple<T...> const& v)
{ {

View File

@ -16,6 +16,7 @@
#include <string> #include <string>
#include <boost/limits.hpp> #include <boost/limits.hpp>
#include <boost/type_traits/is_enum.hpp> #include <boost/type_traits/is_enum.hpp>
#include <boost/type_traits/is_integral.hpp>
#include <boost/utility/enable_if.hpp> #include <boost/utility/enable_if.hpp>
#if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION) #if defined(BOOST_NO_TEMPLATE_PARTIAL_SPECIALIZATION)
@ -40,8 +41,8 @@ namespace boost
struct enable_hash_value { typedef std::size_t type; }; struct enable_hash_value { typedef std::size_t type; };
template <typename T> struct basic_numbers {}; template <typename T> struct basic_numbers {};
template <typename T> struct long_numbers {}; template <typename T> struct long_numbers;
template <typename T> struct ulong_numbers {}; template <typename T> struct ulong_numbers;
template <typename T> struct float_numbers {}; template <typename T> struct float_numbers {};
template <> struct basic_numbers<bool> : template <> struct basic_numbers<bool> :
@ -70,6 +71,14 @@ namespace boost
boost::hash_detail::enable_hash_value {}; boost::hash_detail::enable_hash_value {};
#endif #endif
// long_numbers is defined like this to allow for separate
// specialization for long_long and int128_type, in case
// they conflict.
template <typename T> struct long_numbers2 {};
template <typename T> struct ulong_numbers2 {};
template <typename T> struct long_numbers : long_numbers2<T> {};
template <typename T> struct ulong_numbers : ulong_numbers2<T> {};
#if !defined(BOOST_NO_LONG_LONG) #if !defined(BOOST_NO_LONG_LONG)
template <> struct long_numbers<boost::long_long_type> : template <> struct long_numbers<boost::long_long_type> :
boost::hash_detail::enable_hash_value {}; boost::hash_detail::enable_hash_value {};
@ -77,6 +86,13 @@ namespace boost
boost::hash_detail::enable_hash_value {}; boost::hash_detail::enable_hash_value {};
#endif #endif
#if defined(BOOST_HAS_INT128)
template <> struct long_numbers2<boost::int128_type> :
boost::hash_detail::enable_hash_value {};
template <> struct ulong_numbers2<boost::uint128_type> :
boost::hash_detail::enable_hash_value {};
#endif
template <> struct float_numbers<float> : template <> struct float_numbers<float> :
boost::hash_detail::enable_hash_value {}; boost::hash_detail::enable_hash_value {};
template <> struct float_numbers<double> : template <> struct float_numbers<double> :
@ -94,7 +110,7 @@ namespace boost
template <typename T> template <typename T>
typename boost::enable_if<boost::is_enum<T>, std::size_t>::type typename boost::enable_if<boost::is_enum<T>, std::size_t>::type
hash_value(T); hash_value(T);
#if !BOOST_WORKAROUND(__DMC__, <= 0x848) #if !BOOST_WORKAROUND(__DMC__, <= 0x848)
template <class T> std::size_t hash_value(T* const&); template <class T> std::size_t hash_value(T* const&);
@ -187,9 +203,9 @@ namespace boost
template <typename T> template <typename T>
typename boost::enable_if<boost::is_enum<T>, std::size_t>::type typename boost::enable_if<boost::is_enum<T>, std::size_t>::type
hash_value(T v) hash_value(T v)
{ {
return static_cast<std::size_t>(v); return static_cast<std::size_t>(v);
} }
// Implementation by Alberto Barbati and Dave Harris. // Implementation by Alberto Barbati and Dave Harris.
@ -423,6 +439,11 @@ namespace boost
BOOST_HASH_SPECIALIZE(boost::ulong_long_type) BOOST_HASH_SPECIALIZE(boost::ulong_long_type)
#endif #endif
#if defined(BOOST_HAS_INT128)
BOOST_HASH_SPECIALIZE(boost::int128_type)
BOOST_HASH_SPECIALIZE(boost::uint128_type)
#endif
#if !defined(BOOST_NO_CXX11_HDR_TYPEINDEX) #if !defined(BOOST_NO_CXX11_HDR_TYPEINDEX)
BOOST_HASH_SPECIALIZE(std::type_index) BOOST_HASH_SPECIALIZE(std::type_index)
#endif #endif

View File

@ -3,13 +3,15 @@
// accompanying file LICENSE_1_0.txt or copy at // accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt) // http://www.boost.org/LICENSE_1_0.txt)
#ifndef GET_POINTER_DWA20021219_HPP #ifndef GET_POINTER_DWA20021219_HPP
# define GET_POINTER_DWA20021219_HPP #define GET_POINTER_DWA20021219_HPP
#include <boost/config.hpp>
// In order to avoid circular dependencies with Boost.TR1 // In order to avoid circular dependencies with Boost.TR1
// we make sure that our include of <memory> doesn't try to // we make sure that our include of <memory> doesn't try to
// pull in the TR1 headers: that's why we use this header // pull in the TR1 headers: that's why we use this header
// rather than including <memory> directly: // rather than including <memory> directly:
# include <boost/config/no_tr1/memory.hpp> // std::auto_ptr #include <boost/config/no_tr1/memory.hpp> // std::auto_ptr
namespace boost { namespace boost {
@ -27,6 +29,19 @@ template<class T> T * get_pointer(std::auto_ptr<T> const& p)
return p.get(); return p.get();
} }
#if !defined( BOOST_NO_CXX11_SMART_PTR )
template<class T> T * get_pointer( std::unique_ptr<T> const& p )
{
return p.get();
}
template<class T> T * get_pointer( std::shared_ptr<T> const& p )
{
return p.get();
}
#endif
} // namespace boost } // namespace boost

View File

@ -188,6 +188,7 @@ namespace boost {
} // namespace detail } // namespace detail
template <typename Selector> struct is_distributed_selector: mpl::false_ {};
//=========================================================================== //===========================================================================

View File

@ -309,14 +309,16 @@ namespace boost {
public: public:
typedef Property property_type; typedef Property property_type;
inline stored_ra_edge_iter() { } inline stored_ra_edge_iter() { }
inline stored_ra_edge_iter(Vertex v, Iter i = Iter(), inline explicit stored_ra_edge_iter(Vertex v) // Only used for comparisons
EdgeVec* edge_vec = 0) : stored_edge<Vertex>(v), m_i(0), m_vec(0){ }
inline stored_ra_edge_iter(Vertex v, Iter i, EdgeVec* edge_vec)
: stored_edge<Vertex>(v), m_i(i - edge_vec->begin()), m_vec(edge_vec){ } : stored_edge<Vertex>(v), m_i(i - edge_vec->begin()), m_vec(edge_vec){ }
inline Property& get_property() { return (*m_vec)[m_i].get_property(); } inline Property& get_property() { BOOST_ASSERT ((m_vec != 0)); return (*m_vec)[m_i].get_property(); }
inline const Property& get_property() const { inline const Property& get_property() const {
BOOST_ASSERT ((m_vec != 0));
return (*m_vec)[m_i].get_property(); return (*m_vec)[m_i].get_property();
} }
inline Iter get_iter() const { return m_vec->begin() + m_i; } inline Iter get_iter() const { BOOST_ASSERT ((m_vec != 0)); return m_vec->begin() + m_i; }
protected: protected:
std::size_t m_i; std::size_t m_i;
EdgeVec* m_vec; EdgeVec* m_vec;

View File

@ -126,18 +126,21 @@ namespace boost {
} }
Value& top() { Value& top() {
BOOST_ASSERT (!this->empty());
return data[0]; return data[0];
} }
const Value& top() const { const Value& top() const {
BOOST_ASSERT (!this->empty());
return data[0]; return data[0];
} }
void pop() { void pop() {
BOOST_ASSERT (!this->empty());
put(index_in_heap, data[0], (size_type)(-1)); put(index_in_heap, data[0], (size_type)(-1));
if (data.size() != 1) { if (data.size() != 1) {
data[0] = data.back(); data[0] = data.back();
put(index_in_heap, data[0], 0); put(index_in_heap, data[0], (size_type)(0));
data.pop_back(); data.pop_back();
preserve_heap_property_down(); preserve_heap_property_down();
verify_heap(); verify_heap();

View File

@ -20,6 +20,9 @@
#include <boost/graph/numeric_values.hpp> #include <boost/graph/numeric_values.hpp>
#include <boost/graph/buffer_concepts.hpp> #include <boost/graph/buffer_concepts.hpp>
#include <boost/concept_check.hpp> #include <boost/concept_check.hpp>
#include <boost/type_traits/is_same.hpp>
#include <boost/mpl/not.hpp>
#include <boost/static_assert.hpp>
#include <boost/detail/workaround.hpp> #include <boost/detail/workaround.hpp>
#include <boost/concept/assert.hpp> #include <boost/concept/assert.hpp>
@ -55,12 +58,10 @@ typename T::ThereReallyIsNoMemberByThisNameInT vertices(T const&);
BOOST_concept(Graph,(G)) BOOST_concept(Graph,(G))
{ {
typedef typename graph_traits<G>::vertex_descriptor vertex_descriptor; typedef typename graph_traits<G>::vertex_descriptor vertex_descriptor;
typedef typename graph_traits<G>::edge_descriptor edge_descriptor;
typedef typename graph_traits<G>::directed_category directed_category; typedef typename graph_traits<G>::directed_category directed_category;
typedef typename graph_traits<G>::edge_parallel_category typedef typename graph_traits<G>::edge_parallel_category edge_parallel_category;
edge_parallel_category; typedef typename graph_traits<G>::traversal_category traversal_category;
typedef typename graph_traits<G>::traversal_category
traversal_category;
BOOST_CONCEPT_USAGE(Graph) BOOST_CONCEPT_USAGE(Graph)
{ {
@ -75,11 +76,12 @@ typename T::ThereReallyIsNoMemberByThisNameInT vertices(T const&);
: Graph<G> : Graph<G>
{ {
typedef typename graph_traits<G>::edge_descriptor edge_descriptor; typedef typename graph_traits<G>::edge_descriptor edge_descriptor;
typedef typename graph_traits<G>::out_edge_iterator typedef typename graph_traits<G>::out_edge_iterator out_edge_iterator;
out_edge_iterator; typedef typename graph_traits<G>::degree_size_type degree_size_type;
typedef typename graph_traits<G>::traversal_category traversal_category;
typedef typename graph_traits<G>::traversal_category BOOST_STATIC_ASSERT((boost::mpl::not_<boost::is_same<out_edge_iterator, void> >::value));
traversal_category; BOOST_STATIC_ASSERT((boost::mpl::not_<boost::is_same<degree_size_type, void> >::value));
BOOST_CONCEPT_USAGE(IncidenceGraph) { BOOST_CONCEPT_USAGE(IncidenceGraph) {
BOOST_CONCEPT_ASSERT((MultiPassInputIterator<out_edge_iterator>)); BOOST_CONCEPT_ASSERT((MultiPassInputIterator<out_edge_iterator>));
@ -123,6 +125,8 @@ typename T::ThereReallyIsNoMemberByThisNameInT vertices(T const&);
BOOST_CONCEPT_ASSERT((Convertible<traversal_category, BOOST_CONCEPT_ASSERT((Convertible<traversal_category,
bidirectional_graph_tag>)); bidirectional_graph_tag>));
BOOST_STATIC_ASSERT((boost::mpl::not_<boost::is_same<in_edge_iterator, void> >::value));
p = in_edges(v, g); p = in_edges(v, g);
n = in_degree(v, g); n = in_degree(v, g);
e = *p.first; e = *p.first;
@ -153,6 +157,8 @@ typename T::ThereReallyIsNoMemberByThisNameInT vertices(T const&);
BOOST_CONCEPT_ASSERT((Convertible<traversal_category, BOOST_CONCEPT_ASSERT((Convertible<traversal_category,
adjacency_graph_tag>)); adjacency_graph_tag>));
BOOST_STATIC_ASSERT((boost::mpl::not_<boost::is_same<adjacency_iterator, void> >::value));
p = adjacent_vertices(v, g); p = adjacent_vertices(v, g);
v = *p.first; v = *p.first;
const_constraints(g); const_constraints(g);
@ -178,6 +184,9 @@ typename T::ThereReallyIsNoMemberByThisNameInT vertices(T const&);
BOOST_CONCEPT_ASSERT((Convertible<traversal_category, BOOST_CONCEPT_ASSERT((Convertible<traversal_category,
vertex_list_graph_tag>)); vertex_list_graph_tag>));
BOOST_STATIC_ASSERT((boost::mpl::not_<boost::is_same<vertex_iterator, void> >::value));
BOOST_STATIC_ASSERT((boost::mpl::not_<boost::is_same<vertices_size_type, void> >::value));
#ifdef BOOST_VECTOR_AS_GRAPH_GRAPH_ADL_HACK #ifdef BOOST_VECTOR_AS_GRAPH_GRAPH_ADL_HACK
// dwa 2003/7/11 -- This clearly shouldn't be necessary, but if // dwa 2003/7/11 -- This clearly shouldn't be necessary, but if
// you want to use vector_as_graph, it is! I'm sure the graph // you want to use vector_as_graph, it is! I'm sure the graph
@ -227,6 +236,9 @@ typename T::ThereReallyIsNoMemberByThisNameInT vertices(T const&);
BOOST_CONCEPT_ASSERT((Convertible<traversal_category, BOOST_CONCEPT_ASSERT((Convertible<traversal_category,
edge_list_graph_tag>)); edge_list_graph_tag>));
BOOST_STATIC_ASSERT((boost::mpl::not_<boost::is_same<edge_iterator, void> >::value));
BOOST_STATIC_ASSERT((boost::mpl::not_<boost::is_same<edges_size_type, void> >::value));
p = edges(g); p = edges(g);
e = *p.first; e = *p.first;
u = source(e, g); u = source(e, g);

View File

@ -20,6 +20,7 @@
#include <boost/mpl/not.hpp> #include <boost/mpl/not.hpp>
#include <boost/mpl/has_xxx.hpp> #include <boost/mpl/has_xxx.hpp>
#include <boost/mpl/void.hpp> #include <boost/mpl/void.hpp>
#include <boost/mpl/identity.hpp>
#include <boost/type_traits/is_same.hpp> #include <boost/type_traits/is_same.hpp>
#include <boost/iterator/iterator_categories.hpp> #include <boost/iterator/iterator_categories.hpp>
#include <boost/iterator/iterator_adaptor.hpp> #include <boost/iterator/iterator_adaptor.hpp>
@ -28,23 +29,47 @@
namespace boost { namespace boost {
namespace detail {
#define BOOST_GRAPH_MEMBER_OR_VOID(name) \
BOOST_MPL_HAS_XXX_TRAIT_DEF(name) \
template <typename T> struct BOOST_JOIN(get_member_, name) {typedef typename T::name type;}; \
template <typename T> struct BOOST_JOIN(get_opt_member_, name): \
boost::mpl::eval_if_c< \
BOOST_JOIN(has_, name)<T>::value, \
BOOST_JOIN(get_member_, name)<T>, \
boost::mpl::identity<void> > \
{};
BOOST_GRAPH_MEMBER_OR_VOID(adjacency_iterator)
BOOST_GRAPH_MEMBER_OR_VOID(out_edge_iterator)
BOOST_GRAPH_MEMBER_OR_VOID(in_edge_iterator)
BOOST_GRAPH_MEMBER_OR_VOID(vertex_iterator)
BOOST_GRAPH_MEMBER_OR_VOID(edge_iterator)
BOOST_GRAPH_MEMBER_OR_VOID(vertices_size_type)
BOOST_GRAPH_MEMBER_OR_VOID(edges_size_type)
BOOST_GRAPH_MEMBER_OR_VOID(degree_size_type)
}
template <typename G> template <typename G>
struct graph_traits { struct graph_traits {
#define BOOST_GRAPH_PULL_OPT_MEMBER(name) \
typedef typename detail::BOOST_JOIN(get_opt_member_, name)<G>::type name;
typedef typename G::vertex_descriptor vertex_descriptor; typedef typename G::vertex_descriptor vertex_descriptor;
typedef typename G::edge_descriptor edge_descriptor; typedef typename G::edge_descriptor edge_descriptor;
typedef typename G::adjacency_iterator adjacency_iterator; BOOST_GRAPH_PULL_OPT_MEMBER(adjacency_iterator)
typedef typename G::out_edge_iterator out_edge_iterator; BOOST_GRAPH_PULL_OPT_MEMBER(out_edge_iterator)
typedef typename G::in_edge_iterator in_edge_iterator; BOOST_GRAPH_PULL_OPT_MEMBER(in_edge_iterator)
typedef typename G::vertex_iterator vertex_iterator; BOOST_GRAPH_PULL_OPT_MEMBER(vertex_iterator)
typedef typename G::edge_iterator edge_iterator; BOOST_GRAPH_PULL_OPT_MEMBER(edge_iterator)
typedef typename G::directed_category directed_category; typedef typename G::directed_category directed_category;
typedef typename G::edge_parallel_category edge_parallel_category; typedef typename G::edge_parallel_category edge_parallel_category;
typedef typename G::traversal_category traversal_category; typedef typename G::traversal_category traversal_category;
typedef typename G::vertices_size_type vertices_size_type; BOOST_GRAPH_PULL_OPT_MEMBER(vertices_size_type)
typedef typename G::edges_size_type edges_size_type; BOOST_GRAPH_PULL_OPT_MEMBER(edges_size_type)
typedef typename G::degree_size_type degree_size_type; BOOST_GRAPH_PULL_OPT_MEMBER(degree_size_type)
#undef BOOST_GRAPH_PULL_OPT_MEMBER
static inline vertex_descriptor null_vertex(); static inline vertex_descriptor null_vertex();
}; };

View File

@ -11,14 +11,23 @@
#define BOOST_GRAPH_NAMED_GRAPH_HPP #define BOOST_GRAPH_NAMED_GRAPH_HPP
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/type_traits/remove_cv.hpp> #include <boost/functional/hash.hpp>
#include <boost/type_traits/remove_reference.hpp> #include <boost/graph/graph_traits.hpp>
#include <boost/multi_index_container.hpp> #include <boost/graph/properties.hpp>
#include <boost/multi_index/hashed_index.hpp> #include <boost/multi_index/hashed_index.hpp>
#include <boost/multi_index/member.hpp> #include <boost/multi_index/member.hpp>
#include <boost/multi_index_container.hpp>
#include <boost/optional.hpp> #include <boost/optional.hpp>
#include <boost/pending/property.hpp> // for boost::lookup_one_property
#include <boost/throw_exception.hpp> #include <boost/throw_exception.hpp>
#include <boost/tuple/tuple.hpp> // for boost::make_tuple
#include <boost/type_traits/is_same.hpp>
#include <boost/type_traits/remove_cv.hpp>
#include <boost/type_traits/remove_reference.hpp>
#include <boost/utility/enable_if.hpp>
#include <functional> // for std::equal_to
#include <stdexcept> // for std::runtime_error #include <stdexcept> // for std::runtime_error
#include <utility> // for std::pair
namespace boost { namespace graph { namespace boost { namespace graph {
@ -352,8 +361,15 @@ find_vertex(typename BGL_NAMED_GRAPH::vertex_name_type const& name,
/// Retrieve the vertex associated with the given name, or add a new /// Retrieve the vertex associated with the given name, or add a new
/// vertex with that name if no such vertex is available. /// vertex with that name if no such vertex is available.
/// Note: This is enabled only when the vertex property type is different
/// from the vertex name to avoid ambiguous overload problems with
/// the add_vertex() function that takes a vertex property.
template<BGL_NAMED_GRAPH_PARAMS> template<BGL_NAMED_GRAPH_PARAMS>
Vertex typename disable_if<is_same<
typename BGL_NAMED_GRAPH::vertex_name_type,
VertexProperty
>,
Vertex>::type
add_vertex(typename BGL_NAMED_GRAPH::vertex_name_type const& name, add_vertex(typename BGL_NAMED_GRAPH::vertex_name_type const& name,
BGL_NAMED_GRAPH& g) BGL_NAMED_GRAPH& g)
{ {
@ -401,6 +417,35 @@ add_edge(typename BGL_NAMED_GRAPH::vertex_name_type const& u_name,
g.derived()); g.derived());
} }
// Overloads to support EdgeMutablePropertyGraph graphs
template <BGL_NAMED_GRAPH_PARAMS>
std::pair<typename graph_traits<Graph>::edge_descriptor, bool>
add_edge(typename BGL_NAMED_GRAPH::vertex_descriptor const& u,
typename BGL_NAMED_GRAPH::vertex_name_type const& v_name,
typename edge_property_type<Graph>::type const& p,
BGL_NAMED_GRAPH& g) {
return add_edge(u, add_vertex(v_name, g.derived()), p, g.derived());
}
template <BGL_NAMED_GRAPH_PARAMS>
std::pair<typename graph_traits<Graph>::edge_descriptor, bool>
add_edge(typename BGL_NAMED_GRAPH::vertex_name_type const& u_name,
typename BGL_NAMED_GRAPH::vertex_descriptor const& v,
typename edge_property_type<Graph>::type const& p,
BGL_NAMED_GRAPH& g) {
return add_edge(add_vertex(u_name, g.derived()), v, p, g.derived());
}
template <BGL_NAMED_GRAPH_PARAMS>
std::pair<typename graph_traits<Graph>::edge_descriptor, bool>
add_edge(typename BGL_NAMED_GRAPH::vertex_name_type const& u_name,
typename BGL_NAMED_GRAPH::vertex_name_type const& v_name,
typename edge_property_type<Graph>::type const& p,
BGL_NAMED_GRAPH& g) {
return add_edge(add_vertex(u_name, g.derived()),
add_vertex(v_name, g.derived()), p, g.derived());
}
#undef BGL_NAMED_GRAPH #undef BGL_NAMED_GRAPH
#undef BGL_NAMED_GRAPH_PARAMS #undef BGL_NAMED_GRAPH_PARAMS

View File

@ -224,7 +224,7 @@ namespace boost {
{}; {};
} // namespace detail } // namespace detail
template <class Graph, class Property> template <class Graph, class Property, class Enable = void>
struct property_map: struct property_map:
mpl::if_< mpl::if_<
is_same<typename detail::property_kind_from_graph<Graph, Property>::type, edge_property_tag>, is_same<typename detail::property_kind_from_graph<Graph, Property>::type, edge_property_tag>,
@ -248,8 +248,8 @@ namespace boost {
>::type type; >::type type;
}; };
template <class Graph> class vertex_property: vertex_property_type<Graph> {}; template <typename Graph> struct vertex_property: vertex_property_type<Graph> {};
template <class Graph> class edge_property: edge_property_type<Graph> {}; template <typename Graph> struct edge_property: edge_property_type<Graph> {};
template <typename Graph> template <typename Graph>
class degree_property_map class degree_property_map

View File

@ -54,6 +54,39 @@ inline constant_property_map<Key, Value>
make_constant_property(const Value& value) make_constant_property(const Value& value)
{ return constant_property_map<Key, Value>(value); } { return constant_property_map<Key, Value>(value); }
/**
* Same as above, but pretends to be writable as well.
*/
template <typename Key, typename Value>
struct constant_writable_property_map {
typedef Key key_type;
typedef Value value_type;
typedef Value& reference;
typedef boost::read_write_property_map_tag category;
constant_writable_property_map()
: m_value()
{ }
constant_writable_property_map(const value_type &value)
: m_value(value)
{ }
constant_writable_property_map(const constant_writable_property_map& copy)
: m_value(copy.m_value)
{ }
friend Value get(const constant_writable_property_map& me, Key) {return me.m_value;}
friend void put(const constant_writable_property_map&, Key, Value) {}
value_type m_value;
};
template <typename Key, typename Value>
inline constant_writable_property_map<Key, Value>
make_constant_writable_property(const Value& value)
{ return constant_writable_property_map<Key, Value>(value); }
} /* namespace boost */ } /* namespace boost */
#endif #endif

View File

@ -433,7 +433,7 @@ namespace detail {
{ {
return m[k]; return m[k];
} }
}; }
template <class E> template <class E>
struct property_traits<detail::underlying_edge_desc_map_type<E> > { struct property_traits<detail::underlying_edge_desc_map_type<E> > {

View File

@ -5,7 +5,7 @@
* accompanying file LICENSE_1_0.txt or copy at * accompanying file LICENSE_1_0.txt or copy at
* http://www.boost.org/LICENSE_1_0.txt) * http://www.boost.org/LICENSE_1_0.txt)
* *
* $Id: integer_traits.hpp 80740 2012-09-28 18:34:12Z jewillco $ * $Id: integer_traits.hpp 81851 2012-12-11 14:42:26Z marshall $
* *
* Idea by Beman Dawes, Ed Brey, Steve Cleary, and Nathan Myers * Idea by Beman Dawes, Ed Brey, Steve Cleary, and Nathan Myers
*/ */

View File

@ -18,6 +18,7 @@
#include <boost/intrusive/detail/config_begin.hpp> #include <boost/intrusive/detail/config_begin.hpp>
#include <boost/intrusive/detail/workaround.hpp> #include <boost/intrusive/detail/workaround.hpp>
#include <boost/intrusive/detail/preprocessor.hpp> #include <boost/intrusive/detail/preprocessor.hpp>
#include <boost/intrusive/detail/mpl.hpp>
#include <boost/static_assert.hpp> #include <boost/static_assert.hpp>
#include <boost/move/move.hpp> #include <boost/move/move.hpp>
@ -85,7 +86,7 @@
void BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME(); void BOOST_INTRUSIVE_HAS_MEMBER_FUNCTION_CALLABLE_WITH_FUNCNAME();
}; };
struct Base : public Type, public BaseMixin { Base(); }; struct Base : public ::boost::intrusive::detail::remove_cv<Type>::type, public BaseMixin { Base(); };
template <typename T, T t> class Helper{}; template <typename T, T t> class Helper{};
template <typename U> template <typename U>

View File

@ -149,7 +149,7 @@ BOOST_INTRUSIVE_INSTANTIATE_DEFAULT_TYPE_TMPLT(difference_type)
template <typename T> struct first_param template <typename T> struct first_param
{ typedef void type; }; { typedef void type; };
#if !defined(BOOST_NO_VARIADIC_TEMPLATES) #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
template <template <typename, typename...> class TemplateClass, typename T, typename... Args> template <template <typename, typename...> class TemplateClass, typename T, typename... Args>
struct first_param< TemplateClass<T, Args...> > struct first_param< TemplateClass<T, Args...> >
@ -173,7 +173,7 @@ template <typename T> struct first_param
#define BOOST_PP_LOCAL_LIMITS (0, BOOST_INTRUSIVE_MAX_CONSTRUCTOR_PARAMETERS) #define BOOST_PP_LOCAL_LIMITS (0, BOOST_INTRUSIVE_MAX_CONSTRUCTOR_PARAMETERS)
#include BOOST_PP_LOCAL_ITERATE() #include BOOST_PP_LOCAL_ITERATE()
#endif //!defined(BOOST_NO_VARIADIC_TEMPLATES) #endif //!defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
/////////////////////////// ///////////////////////////
//struct type_rebind_mode //struct type_rebind_mode
@ -245,7 +245,7 @@ struct type_rebinder< Ptr, U, 1u >
// OtherArgs>, where OtherArgs comprises zero or more type parameters. // OtherArgs>, where OtherArgs comprises zero or more type parameters.
// Many pointers fit this form, hence many pointers will get a // Many pointers fit this form, hence many pointers will get a
// reasonable default for rebind. // reasonable default for rebind.
#if !defined(BOOST_NO_VARIADIC_TEMPLATES) #if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
template <template <class, class...> class Ptr, typename T, class... Tn, class U> template <template <class, class...> class Ptr, typename T, class... Tn, class U>
struct type_rebinder<Ptr<T, Tn...>, U, 0u > struct type_rebinder<Ptr<T, Tn...>, U, 0u >
@ -277,7 +277,7 @@ struct type_rebinder
#define BOOST_PP_LOCAL_LIMITS (0, BOOST_INTRUSIVE_MAX_CONSTRUCTOR_PARAMETERS) #define BOOST_PP_LOCAL_LIMITS (0, BOOST_INTRUSIVE_MAX_CONSTRUCTOR_PARAMETERS)
#include BOOST_PP_LOCAL_ITERATE() #include BOOST_PP_LOCAL_ITERATE()
#endif //!defined(BOOST_NO_VARIADIC_TEMPLATES) #endif //!defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
} //namespace detail { } //namespace detail {
} //namespace intrusive { } //namespace intrusive {

View File

@ -311,6 +311,22 @@ template<typename T>
struct remove_const<const T> struct remove_const<const T>
{ typedef T type; }; { typedef T type; };
template<typename T>
struct remove_cv
{ typedef T type; };
template<typename T>
struct remove_cv<const T>
{ typedef T type; };
template<typename T>
struct remove_cv<const volatile T>
{ typedef T type; };
template<typename T>
struct remove_cv<volatile T>
{ typedef T type; };
template<class T> template<class T>
struct remove_reference struct remove_reference
{ {

View File

@ -13,7 +13,7 @@
#include <boost/intrusive/detail/config_begin.hpp> #include <boost/intrusive/detail/config_begin.hpp>
#if !defined(BOOST_NO_RVALUE_REFERENCES) && !defined(BOOST_NO_VARIADIC_TEMPLATES) #if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
#define BOOST_INTRUSIVE_PERFECT_FORWARDING #define BOOST_INTRUSIVE_PERFECT_FORWARDING
#endif #endif

View File

@ -81,10 +81,10 @@ struct pointer_traits
typedef typename boost::intrusive::detail::type_rebinder<Ptr, U>::type type; typedef typename boost::intrusive::detail::type_rebinder<Ptr, U>::type type;
}; };
#if !defined(BOOST_NO_TEMPLATE_ALIASES) #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
template <class U> using rebind = typename boost::intrusive::detail::type_rebinder<Ptr, U>::type; template <class U> using rebind = typename boost::intrusive::detail::type_rebinder<Ptr, U>::type;
#endif #endif
#endif //#if !defined(BOOST_NO_TEMPLATE_ALIASES) #endif //#if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
//! <b>Remark</b>: If element_type is (possibly cv-qualified) void, r type is unspecified; otherwise, //! <b>Remark</b>: If element_type is (possibly cv-qualified) void, r type is unspecified; otherwise,
//! it is element_type &. //! it is element_type &.
@ -225,7 +225,7 @@ struct pointer_traits<T*>
template <class U> using rebind = U*; template <class U> using rebind = U*;
#else #else
typedef typename boost::intrusive::detail::unvoid<element_type>::type& reference; typedef typename boost::intrusive::detail::unvoid<element_type>::type& reference;
#if !defined(BOOST_NO_TEMPLATE_ALIASES) #if !defined(BOOST_NO_CXX11_TEMPLATE_ALIASES)
template <class U> using rebind = U*; template <class U> using rebind = U*;
#endif #endif
#endif #endif

File diff suppressed because it is too large Load Diff

View File

@ -234,9 +234,8 @@ int fpclassify_imp BOOST_NO_MACRO_EXPAND(T x, ieee_copy_leading_bits_tag)
return FP_NAN; return FP_NAN;
} }
#if defined(BOOST_MATH_USE_STD_FPCLASSIFY) && defined(BOOST_MATH_NO_NATIVE_LONG_DOUBLE_FP_CLASSIFY) #if defined(BOOST_MATH_USE_STD_FPCLASSIFY) && (defined(BOOST_MATH_NO_NATIVE_LONG_DOUBLE_FP_CLASSIFY) || defined(BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS))
template <> inline int fpclassify_imp BOOST_NO_MACRO_EXPAND(long double t, const native_tag&)
inline int fpclassify_imp<long double> BOOST_NO_MACRO_EXPAND(long double t, const native_tag&)
{ {
return boost::math::detail::fpclassify_imp(t, generic_tag<true>()); return boost::math::detail::fpclassify_imp(t, generic_tag<true>());
} }
@ -259,6 +258,23 @@ inline int fpclassify BOOST_NO_MACRO_EXPAND(T t)
#endif #endif
} }
#ifdef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
template <>
inline int fpclassify<long double> BOOST_NO_MACRO_EXPAND(long double t)
{
typedef detail::fp_traits<long double>::type traits;
typedef traits::method method;
typedef long double value_type;
#ifdef BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
if(std::numeric_limits<long double>::is_specialized && detail::is_generic_tag_false(static_cast<method*>(0)))
return detail::fpclassify_imp(static_cast<value_type>(t), detail::generic_tag<true>());
return detail::fpclassify_imp(static_cast<value_type>(t), method());
#else
return detail::fpclassify_imp(static_cast<value_type>(t), method());
#endif
}
#endif
namespace detail { namespace detail {
#ifdef BOOST_MATH_USE_STD_FPCLASSIFY #ifdef BOOST_MATH_USE_STD_FPCLASSIFY
@ -298,8 +314,7 @@ namespace detail {
} }
#if defined(BOOST_MATH_USE_STD_FPCLASSIFY) && defined(BOOST_MATH_NO_NATIVE_LONG_DOUBLE_FP_CLASSIFY) #if defined(BOOST_MATH_USE_STD_FPCLASSIFY) && defined(BOOST_MATH_NO_NATIVE_LONG_DOUBLE_FP_CLASSIFY)
template <> inline bool isfinite_impl BOOST_NO_MACRO_EXPAND(long double t, const native_tag&)
inline bool isfinite_impl<long double> BOOST_NO_MACRO_EXPAND(long double t, const native_tag&)
{ {
return boost::math::detail::isfinite_impl(t, generic_tag<true>()); return boost::math::detail::isfinite_impl(t, generic_tag<true>());
} }
@ -317,6 +332,18 @@ inline bool (isfinite)(T x)
return detail::isfinite_impl(static_cast<value_type>(x), method()); return detail::isfinite_impl(static_cast<value_type>(x), method());
} }
#ifdef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
template<>
inline bool (isfinite)(long double x)
{ //!< \brief return true if floating-point type t is finite.
typedef detail::fp_traits<long double>::type traits;
typedef traits::method method;
typedef boost::is_floating_point<long double>::type fp_tag;
typedef long double value_type;
return detail::isfinite_impl(static_cast<value_type>(x), method());
}
#endif
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
namespace detail { namespace detail {
@ -358,8 +385,7 @@ namespace detail {
} }
#if defined(BOOST_MATH_USE_STD_FPCLASSIFY) && defined(BOOST_MATH_NO_NATIVE_LONG_DOUBLE_FP_CLASSIFY) #if defined(BOOST_MATH_USE_STD_FPCLASSIFY) && defined(BOOST_MATH_NO_NATIVE_LONG_DOUBLE_FP_CLASSIFY)
template <> inline bool isnormal_impl BOOST_NO_MACRO_EXPAND(long double t, const native_tag&)
inline bool isnormal_impl<long double> BOOST_NO_MACRO_EXPAND(long double t, const native_tag&)
{ {
return boost::math::detail::isnormal_impl(t, generic_tag<true>()); return boost::math::detail::isnormal_impl(t, generic_tag<true>());
} }
@ -377,6 +403,18 @@ inline bool (isnormal)(T x)
return detail::isnormal_impl(static_cast<value_type>(x), method()); return detail::isnormal_impl(static_cast<value_type>(x), method());
} }
#ifdef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
template<>
inline bool (isnormal)(long double x)
{
typedef detail::fp_traits<long double>::type traits;
typedef traits::method method;
typedef boost::is_floating_point<long double>::type fp_tag;
typedef long double value_type;
return detail::isnormal_impl(static_cast<value_type>(x), method());
}
#endif
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
namespace detail { namespace detail {
@ -436,8 +474,7 @@ namespace detail {
} }
#if defined(BOOST_MATH_USE_STD_FPCLASSIFY) && defined(BOOST_MATH_NO_NATIVE_LONG_DOUBLE_FP_CLASSIFY) #if defined(BOOST_MATH_USE_STD_FPCLASSIFY) && defined(BOOST_MATH_NO_NATIVE_LONG_DOUBLE_FP_CLASSIFY)
template <> inline bool isinf_impl BOOST_NO_MACRO_EXPAND(long double t, const native_tag&)
inline bool isinf_impl<long double> BOOST_NO_MACRO_EXPAND(long double t, const native_tag&)
{ {
return boost::math::detail::isinf_impl(t, generic_tag<true>()); return boost::math::detail::isinf_impl(t, generic_tag<true>());
} }
@ -455,6 +492,18 @@ inline bool (isinf)(T x)
return detail::isinf_impl(static_cast<value_type>(x), method()); return detail::isinf_impl(static_cast<value_type>(x), method());
} }
#ifdef BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS
template<>
inline bool (isinf)(long double x)
{
typedef detail::fp_traits<long double>::type traits;
typedef traits::method method;
typedef boost::is_floating_point<long double>::type fp_tag;
typedef long double value_type;
return detail::isinf_impl(static_cast<value_type>(x), method());
}
#endif
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
namespace detail { namespace detail {
@ -516,7 +565,8 @@ namespace detail {
} // namespace detail } // namespace detail
template<class T> bool (isnan)(T x) template<class T>
inline bool (isnan)(T x)
{ //!< \brief return true if floating-point type t is NaN (Not A Number). { //!< \brief return true if floating-point type t is NaN (Not A Number).
typedef typename detail::fp_traits<T>::type traits; typedef typename detail::fp_traits<T>::type traits;
typedef typename traits::method method; typedef typename traits::method method;
@ -528,6 +578,15 @@ template<class T> bool (isnan)(T x)
template <> inline bool isnan BOOST_NO_MACRO_EXPAND<float>(float t){ return ::boost::math_detail::is_nan_helper(t, boost::true_type()); } template <> inline bool isnan BOOST_NO_MACRO_EXPAND<float>(float t){ return ::boost::math_detail::is_nan_helper(t, boost::true_type()); }
template <> inline bool isnan BOOST_NO_MACRO_EXPAND<double>(double t){ return ::boost::math_detail::is_nan_helper(t, boost::true_type()); } template <> inline bool isnan BOOST_NO_MACRO_EXPAND<double>(double t){ return ::boost::math_detail::is_nan_helper(t, boost::true_type()); }
template <> inline bool isnan BOOST_NO_MACRO_EXPAND<long double>(long double t){ return ::boost::math_detail::is_nan_helper(t, boost::true_type()); } template <> inline bool isnan BOOST_NO_MACRO_EXPAND<long double>(long double t){ return ::boost::math_detail::is_nan_helper(t, boost::true_type()); }
#elif defined(BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS)
template<>
inline bool (isnan)(long double x)
{ //!< \brief return true if floating-point type t is NaN (Not A Number).
typedef detail::fp_traits<long double>::type traits;
typedef traits::method method;
typedef boost::is_floating_point<long double>::type fp_tag;
return detail::isnan_impl(x, method());
}
#endif #endif
} // namespace math } // namespace math

View File

@ -99,9 +99,14 @@
# define BOOST_MATH_USE_C99 # define BOOST_MATH_USE_C99
#endif #endif
#if defined(_LIBCPP_VERSION) && !defined(_MSC_VER)
# define BOOST_MATH_USE_C99
#endif
#if defined(__CYGWIN__) || defined(__HP_aCC) || defined(BOOST_INTEL) \ #if defined(__CYGWIN__) || defined(__HP_aCC) || defined(BOOST_INTEL) \
|| defined(BOOST_NO_NATIVE_LONG_DOUBLE_FP_CLASSIFY) \ || defined(BOOST_NO_NATIVE_LONG_DOUBLE_FP_CLASSIFY) \
|| (defined(__GNUC__) && !defined(BOOST_MATH_USE_C99)) || (defined(__GNUC__) && !defined(BOOST_MATH_USE_C99))\
|| defined(BOOST_MATH_NO_LONG_DOUBLE_MATH_FUNCTIONS)
# define BOOST_MATH_NO_NATIVE_LONG_DOUBLE_FP_CLASSIFY # define BOOST_MATH_NO_NATIVE_LONG_DOUBLE_FP_CLASSIFY
#endif #endif

View File

@ -0,0 +1,275 @@
//////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Ion Gaztanaga 2012-2012.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/move for documentation.
//
//////////////////////////////////////////////////////////////////////////////
//! \file
#ifndef BOOST_MOVE_ALGORITHM_HPP
#define BOOST_MOVE_ALGORITHM_HPP
#include <boost/move/detail/config_begin.hpp>
#include <boost/move/utility.hpp>
#include <boost/move/iterator.hpp>
#include <boost/move/algorithm.hpp>
#include <boost/detail/no_exceptions_support.hpp>
#include <algorithm> //copy, copy_backward
#include <memory> //uninitialized_copy
namespace boost {
//////////////////////////////////////////////////////////////////////////////
//
// move
//
//////////////////////////////////////////////////////////////////////////////
#if !defined(BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE)
//! <b>Effects</b>: Moves elements in the range [first,last) into the range [result,result + (last -
//! first)) starting from first and proceeding to last. For each non-negative integer n < (last-first),
//! performs *(result + n) = ::boost::move (*(first + n)).
//!
//! <b>Effects</b>: result + (last - first).
//!
//! <b>Requires</b>: result shall not be in the range [first,last).
//!
//! <b>Complexity</b>: Exactly last - first move assignments.
template <typename I, // I models InputIterator
typename O> // O models OutputIterator
O move(I f, I l, O result)
{
while (f != l) {
*result = ::boost::move(*f);
++f; ++result;
}
return result;
}
//////////////////////////////////////////////////////////////////////////////
//
// move_backward
//
//////////////////////////////////////////////////////////////////////////////
//! <b>Effects</b>: Moves elements in the range [first,last) into the range
//! [result - (last-first),result) starting from last - 1 and proceeding to
//! first. For each positive integer n <= (last - first),
//! performs *(result - n) = ::boost::move(*(last - n)).
//!
//! <b>Requires</b>: result shall not be in the range [first,last).
//!
//! <b>Returns</b>: result - (last - first).
//!
//! <b>Complexity</b>: Exactly last - first assignments.
template <typename I, // I models BidirectionalIterator
typename O> // O models BidirectionalIterator
O move_backward(I f, I l, O result)
{
while (f != l) {
--l; --result;
*result = ::boost::move(*l);
}
return result;
}
#else
using ::std::move_backward;
#endif //!defined(BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE)
//////////////////////////////////////////////////////////////////////////////
//
// uninitialized_move
//
//////////////////////////////////////////////////////////////////////////////
//! <b>Effects</b>:
//! \code
//! for (; first != last; ++result, ++first)
//! new (static_cast<void*>(&*result))
//! typename iterator_traits<ForwardIterator>::value_type(boost::move(*first));
//! \endcode
//!
//! <b>Returns</b>: result
template
<typename I, // I models InputIterator
typename F> // F models ForwardIterator
F uninitialized_move(I f, I l, F r
/// @cond
// ,typename ::boost::move_detail::enable_if<has_move_emulation_enabled<typename std::iterator_traits<I>::value_type> >::type* = 0
/// @endcond
)
{
typedef typename std::iterator_traits<I>::value_type input_value_type;
F back = r;
BOOST_TRY{
while (f != l) {
void * const addr = static_cast<void*>(::boost::move_detail::addressof(*r));
::new(addr) input_value_type(::boost::move(*f));
++f; ++r;
}
}
BOOST_CATCH(...){
for (; back != r; ++back){
back->~input_value_type();
}
BOOST_RETHROW;
}
BOOST_CATCH_END
return r;
}
/// @cond
/*
template
<typename I, // I models InputIterator
typename F> // F models ForwardIterator
F uninitialized_move(I f, I l, F r,
typename ::boost::move_detail::disable_if<has_move_emulation_enabled<typename std::iterator_traits<I>::value_type> >::type* = 0)
{
return std::uninitialized_copy(f, l, r);
}
*/
//////////////////////////////////////////////////////////////////////////////
//
// uninitialized_copy_or_move
//
//////////////////////////////////////////////////////////////////////////////
namespace move_detail {
template
<typename I, // I models InputIterator
typename F> // F models ForwardIterator
inline F uninitialized_move_move_iterator(I f, I l, F r
// ,typename ::boost::move_detail::enable_if< has_move_emulation_enabled<typename I::value_type> >::type* = 0
)
{
return ::boost::uninitialized_move(f, l, r);
}
/*
template
<typename I, // I models InputIterator
typename F> // F models ForwardIterator
F uninitialized_move_move_iterator(I f, I l, F r,
typename ::boost::move_detail::disable_if< has_move_emulation_enabled<typename I::value_type> >::type* = 0)
{
return std::uninitialized_copy(f.base(), l.base(), r);
}
*/
} //namespace move_detail {
template
<typename I, // I models InputIterator
typename F> // F models ForwardIterator
inline F uninitialized_copy_or_move(I f, I l, F r,
typename ::boost::move_detail::enable_if< move_detail::is_move_iterator<I> >::type* = 0)
{
return ::boost::move_detail::uninitialized_move_move_iterator(f, l, r);
}
//////////////////////////////////////////////////////////////////////////////
//
// copy_or_move
//
//////////////////////////////////////////////////////////////////////////////
namespace move_detail {
template
<typename I, // I models InputIterator
typename F> // F models ForwardIterator
inline F move_move_iterator(I f, I l, F r
// ,typename ::boost::move_detail::enable_if< has_move_emulation_enabled<typename I::value_type> >::type* = 0
)
{
return ::boost::move(f, l, r);
}
/*
template
<typename I, // I models InputIterator
typename F> // F models ForwardIterator
F move_move_iterator(I f, I l, F r,
typename ::boost::move_detail::disable_if< has_move_emulation_enabled<typename I::value_type> >::type* = 0)
{
return std::copy(f.base(), l.base(), r);
}
*/
} //namespace move_detail {
template
<typename I, // I models InputIterator
typename F> // F models ForwardIterator
inline F copy_or_move(I f, I l, F r,
typename ::boost::move_detail::enable_if< move_detail::is_move_iterator<I> >::type* = 0)
{
return ::boost::move_detail::move_move_iterator(f, l, r);
}
/// @endcond
//! <b>Effects</b>:
//! \code
//! for (; first != last; ++result, ++first)
//! new (static_cast<void*>(&*result))
//! typename iterator_traits<ForwardIterator>::value_type(*first);
//! \endcode
//!
//! <b>Returns</b>: result
//!
//! <b>Note</b>: This function is provided because
//! <i>std::uninitialized_copy</i> from some STL implementations
//! is not compatible with <i>move_iterator</i>
template
<typename I, // I models InputIterator
typename F> // F models ForwardIterator
inline F uninitialized_copy_or_move(I f, I l, F r
/// @cond
,typename ::boost::move_detail::disable_if< move_detail::is_move_iterator<I> >::type* = 0
/// @endcond
)
{
return std::uninitialized_copy(f, l, r);
}
//! <b>Effects</b>:
//! \code
//! for (; first != last; ++result, ++first)
//! *result = *first;
//! \endcode
//!
//! <b>Returns</b>: result
//!
//! <b>Note</b>: This function is provided because
//! <i>std::uninitialized_copy</i> from some STL implementations
//! is not compatible with <i>move_iterator</i>
template
<typename I, // I models InputIterator
typename F> // F models ForwardIterator
inline F copy_or_move(I f, I l, F r
/// @cond
,typename ::boost::move_detail::disable_if< move_detail::is_move_iterator<I> >::type* = 0
/// @endcond
)
{
return std::copy(f, l, r);
}
} //namespace boost {
#include <boost/move/detail/config_end.hpp>
#endif //#ifndef BOOST_MOVE_MOVE_HPP

View File

@ -0,0 +1,317 @@
//////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Ion Gaztanaga 2012-2012.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/move for documentation.
//
//////////////////////////////////////////////////////////////////////////////
//! \file core.hpp
//! This header implements macros to define movable classes and
//! move-aware functions
#ifndef BOOST_MOVE_CORE_HPP
#define BOOST_MOVE_CORE_HPP
#include <boost/move/detail/config_begin.hpp>
#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_MOVE_DOXYGEN_INVOKED)
#include <boost/move/detail/meta_utils.hpp>
//Move emulation rv breaks standard aliasing rules so add workarounds for some compilers
#if defined(__GNUC__) && (__GNUC__ >= 4)
#define BOOST_MOVE_ATTRIBUTE_MAY_ALIAS __attribute__((__may_alias__))
#else
#define BOOST_MOVE_ATTRIBUTE_MAY_ALIAS
#endif
namespace boost {
//////////////////////////////////////////////////////////////////////////////
//
// struct rv
//
//////////////////////////////////////////////////////////////////////////////
template <class T>
class rv
: public ::boost::move_detail::if_c
< ::boost::move_detail::is_class_or_union<T>::value
, T
, ::boost::move_detail::empty
>::type
{
rv();
~rv();
rv(rv const&);
void operator=(rv const&);
} BOOST_MOVE_ATTRIBUTE_MAY_ALIAS;
//////////////////////////////////////////////////////////////////////////////
//
// move_detail::is_rv
//
//////////////////////////////////////////////////////////////////////////////
namespace move_detail {
template <class T>
struct is_rv
: ::boost::move_detail::integral_constant<bool, false>
{};
template <class T>
struct is_rv< rv<T> >
: ::boost::move_detail::integral_constant<bool, true>
{};
template <class T>
struct is_rv< const rv<T> >
: ::boost::move_detail::integral_constant<bool, true>
{};
} //namespace move_detail {
//////////////////////////////////////////////////////////////////////////////
//
// has_move_emulation_enabled
//
//////////////////////////////////////////////////////////////////////////////
template<class T>
struct has_move_emulation_enabled
: ::boost::move_detail::is_convertible< T, ::boost::rv<T>& >
{};
template<class T>
struct has_move_emulation_enabled<T&>
: ::boost::move_detail::integral_constant<bool, false>
{};
template<class T>
struct has_move_emulation_enabled< ::boost::rv<T> >
: ::boost::move_detail::integral_constant<bool, false>
{};
} //namespace boost {
#define BOOST_RV_REF(TYPE)\
::boost::rv< TYPE >& \
//
#define BOOST_RV_REF_2_TEMPL_ARGS(TYPE, ARG1, ARG2)\
::boost::rv< TYPE<ARG1, ARG2> >& \
//
#define BOOST_RV_REF_3_TEMPL_ARGS(TYPE, ARG1, ARG2, ARG3)\
::boost::rv< TYPE<ARG1, ARG2, ARG3> >& \
//
#define BOOST_RV_REF_BEG\
::boost::rv< \
//
#define BOOST_RV_REF_END\
>& \
//
#define BOOST_FWD_REF(TYPE)\
const TYPE & \
//
#define BOOST_COPY_ASSIGN_REF(TYPE)\
const ::boost::rv< TYPE >& \
//
#define BOOST_COPY_ASSIGN_REF_BEG \
const ::boost::rv< \
//
#define BOOST_COPY_ASSIGN_REF_END \
>& \
//
#define BOOST_COPY_ASSIGN_REF_2_TEMPL_ARGS(TYPE, ARG1, ARG2)\
const ::boost::rv< TYPE<ARG1, ARG2> >& \
//
#define BOOST_COPY_ASSIGN_REF_3_TEMPL_ARGS(TYPE, ARG1, ARG2, ARG3)\
const ::boost::rv< TYPE<ARG1, ARG2, ARG3> >& \
//
#define BOOST_CATCH_CONST_RLVALUE(TYPE)\
const ::boost::rv< TYPE >& \
//
//////////////////////////////////////////////////////////////////////////////
//
// BOOST_MOVABLE_BUT_NOT_COPYABLE
//
//////////////////////////////////////////////////////////////////////////////
#define BOOST_MOVABLE_BUT_NOT_COPYABLE(TYPE)\
private:\
TYPE(TYPE &);\
TYPE& operator=(TYPE &);\
public:\
operator ::boost::rv<TYPE>&() \
{ return *static_cast< ::boost::rv<TYPE>* >(this); }\
operator const ::boost::rv<TYPE>&() const \
{ return *static_cast<const ::boost::rv<TYPE>* >(this); }\
private:\
//
//////////////////////////////////////////////////////////////////////////////
//
// BOOST_COPYABLE_AND_MOVABLE
//
//////////////////////////////////////////////////////////////////////////////
#define BOOST_COPYABLE_AND_MOVABLE(TYPE)\
public:\
TYPE& operator=(TYPE &t)\
{ this->operator=(static_cast<const ::boost::rv<TYPE> &>(const_cast<const TYPE &>(t))); return *this;}\
public:\
operator ::boost::rv<TYPE>&() \
{ return *static_cast< ::boost::rv<TYPE>* >(this); }\
operator const ::boost::rv<TYPE>&() const \
{ return *static_cast<const ::boost::rv<TYPE>* >(this); }\
private:\
//
#define BOOST_COPYABLE_AND_MOVABLE_ALT(TYPE)\
public:\
operator ::boost::rv<TYPE>&() \
{ return *static_cast< ::boost::rv<TYPE>* >(this); }\
operator const ::boost::rv<TYPE>&() const \
{ return *static_cast<const ::boost::rv<TYPE>* >(this); }\
private:\
//
#else //BOOST_NO_CXX11_RVALUE_REFERENCES
//Compiler workaround detection
#if !defined(BOOST_MOVE_DOXYGEN_INVOKED)
#if defined(__GNUC__) && (__GNUC__ == 4) && (__GNUC_MINOR__ < 5) && !defined(__clang__)
//Pre-standard rvalue binding rules
#define BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES
#elif defined(_MSC_VER) && (_MSC_VER == 1600)
//Standard rvalue binding rules but with some bugs
#define BOOST_MOVE_MSVC_10_MEMBER_RVALUE_REF_BUG
//Use standard library for MSVC to avoid namespace issues as
//some move calls in the STL are not fully qualified.
//#define BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE
#endif
#endif
//! This macro marks a type as movable but not copyable, disabling copy construction
//! and assignment. The user will need to write a move constructor/assignment as explained
//! in the documentation to fully write a movable but not copyable class.
#define BOOST_MOVABLE_BUT_NOT_COPYABLE(TYPE)\
public:\
typedef int boost_move_emulation_t;\
private:\
TYPE(const TYPE &);\
TYPE& operator=(const TYPE &);\
//
//! This macro marks a type as copyable and movable.
//! The user will need to write a move constructor/assignment and a copy assignment
//! as explained in the documentation to fully write a copyable and movable class.
#define BOOST_COPYABLE_AND_MOVABLE(TYPE)\
//
#if !defined(BOOST_MOVE_DOXYGEN_INVOKED)
#define BOOST_COPYABLE_AND_MOVABLE_ALT(TYPE)\
//
#endif //#if !defined(BOOST_MOVE_DOXYGEN_INVOKED)
//!This trait yields to a compile-time true boolean if T was marked as
//!BOOST_MOVABLE_BUT_NOT_COPYABLE or BOOST_COPYABLE_AND_MOVABLE and
//!rvalue references are not available on the platform. False otherwise.
template<class T>
struct has_move_emulation_enabled
{
static const bool value = false;
};
//!This macro is used to achieve portable syntax in move
//!constructors and assignments for classes marked as
//!BOOST_COPYABLE_AND_MOVABLE or BOOST_MOVABLE_BUT_NOT_COPYABLE
#define BOOST_RV_REF(TYPE)\
TYPE && \
//
//!This macro is used to achieve portable syntax in move
//!constructors and assignments for template classes marked as
//!BOOST_COPYABLE_AND_MOVABLE or BOOST_MOVABLE_BUT_NOT_COPYABLE.
//!As macros have problems with comma-separatd template arguments,
//!the template argument must be preceded with BOOST_RV_REF_START
//!and ended with BOOST_RV_REF_END
#define BOOST_RV_REF_BEG\
\
//
//!This macro is used to achieve portable syntax in move
//!constructors and assignments for template classes marked as
//!BOOST_COPYABLE_AND_MOVABLE or BOOST_MOVABLE_BUT_NOT_COPYABLE.
//!As macros have problems with comma-separatd template arguments,
//!the template argument must be preceded with BOOST_RV_REF_START
//!and ended with BOOST_RV_REF_END
#define BOOST_RV_REF_END\
&& \
//!This macro is used to achieve portable syntax in copy
//!assignment for classes marked as BOOST_COPYABLE_AND_MOVABLE.
#define BOOST_COPY_ASSIGN_REF(TYPE)\
const TYPE & \
//
//! This macro is used to implement portable perfect forwarding
//! as explained in the documentation.
#define BOOST_FWD_REF(TYPE)\
TYPE && \
//
#if !defined(BOOST_MOVE_DOXYGEN_INVOKED)
/// @cond
#define BOOST_RV_REF_2_TEMPL_ARGS(TYPE, ARG1, ARG2)\
TYPE<ARG1, ARG2> && \
//
#define BOOST_RV_REF_3_TEMPL_ARGS(TYPE, ARG1, ARG2, ARG3)\
TYPE<ARG1, ARG2, ARG3> && \
//
#define BOOST_COPY_ASSIGN_REF_BEG \
const \
//
#define BOOST_COPY_ASSIGN_REF_END \
& \
//
#define BOOST_COPY_ASSIGN_REF_2_TEMPL_ARGS(TYPE, ARG1, ARG2)\
const TYPE<ARG1, ARG2> & \
//
#define BOOST_COPY_ASSIGN_REF_3_TEMPL_ARGS(TYPE, ARG1, ARG2, ARG3)\
TYPE<ARG1, ARG2, ARG3>& \
//
#define BOOST_CATCH_CONST_RLVALUE(TYPE)\
const TYPE & \
//
/// @endcond
#endif //#if !defined(BOOST_MOVE_DOXYGEN_INVOKED)
#endif //BOOST_NO_CXX11_RVALUE_REFERENCES
#include <boost/move/detail/config_end.hpp>
#endif //#ifndef BOOST_MOVE_CORE_HPP

View File

@ -0,0 +1,23 @@
//////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Ion Gaztanaga 2012-2012. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/move for documentation.
//
//////////////////////////////////////////////////////////////////////////////
#include <boost/config.hpp>
#ifdef BOOST_MSVC
#ifndef _CRT_SECURE_NO_DEPRECATE
#define BOOST_MOVE_CRT_SECURE_NO_DEPRECATE
#define _CRT_SECURE_NO_DEPRECATE
#endif
#ifndef _SCL_SECURE_NO_WARNINGS
#define BOOST_MOVE_SCL_SECURE_NO_WARNINGS
#define _SCL_SECURE_NO_WARNINGS
#endif
#pragma warning (push)
#pragma warning (disable : 4996) // "function": was declared deprecated
#endif

View File

@ -0,0 +1,20 @@
//////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Ion Gaztanaga 2012-2012. Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/container for documentation.
//
//////////////////////////////////////////////////////////////////////////////
#if defined BOOST_MSVC
#pragma warning (pop)
#ifdef BOOST_MOVE_DETAIL_CRT_SECURE_NO_DEPRECATE
#undef BOOST_MOVE_DETAIL_CRT_SECURE_NO_DEPRECATE
#undef _CRT_SECURE_NO_DEPRECATE
#endif
#ifndef BOOST_MOVE_SCL_SECURE_NO_WARNINGS
#undef BOOST_MOVE_SCL_SECURE_NO_WARNINGS
#undef _SCL_SECURE_NO_WARNINGS
#endif
#endif

View File

@ -0,0 +1,158 @@
//////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Ion Gaztanaga 2012-2012.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/move for documentation.
//
//////////////////////////////////////////////////////////////////////////////
//! \file
#ifndef BOOST_MOVE_DETAIL_META_UTILS_HPP
#define BOOST_MOVE_DETAIL_META_UTILS_HPP
#include <boost/move/detail/config_begin.hpp>
//Small meta-typetraits to support move
namespace boost {
namespace move_detail {
//if_
template<bool C, typename T1, typename T2>
struct if_c
{
typedef T1 type;
};
template<typename T1, typename T2>
struct if_c<false,T1,T2>
{
typedef T2 type;
};
template<typename T1, typename T2, typename T3>
struct if_
{
typedef typename if_c<0 != T1::value, T2, T3>::type type;
};
//enable_if_
template <bool B, class T = void>
struct enable_if_c
{
typedef T type;
};
template <class T>
struct enable_if_c<false, T> {};
template <class Cond, class T = void>
struct enable_if : public enable_if_c<Cond::value, T> {};
template <class Cond, class T = void>
struct disable_if : public enable_if_c<!Cond::value, T> {};
//integral_constant
template<class T, T v>
struct integral_constant
{
static const T value = v;
typedef T value_type;
typedef integral_constant<T, v> type;
};
//identity
template <class T>
struct identity
{
typedef T type;
};
//is_convertible
template <class T, class U>
class is_convertible
{
typedef char true_t;
class false_t { char dummy[2]; };
static true_t dispatch(U);
static false_t dispatch(...);
static T &trigger();
public:
enum { value = sizeof(dispatch(trigger())) == sizeof(true_t) };
};
//and_ not_
template <typename Condition1, typename Condition2, typename Condition3 = integral_constant<bool, true> >
struct and_
: public integral_constant<bool, Condition1::value && Condition2::value && Condition3::value>
{};
template <typename Boolean>
struct not_
: public integral_constant<bool, !Boolean::value>
{};
//is_lvalue_reference
template<class T>
struct is_lvalue_reference
: public integral_constant<bool, false>
{};
template<class T>
struct is_lvalue_reference<T&>
: public integral_constant<bool, true>
{};
template<class T>
struct is_class_or_union
{
struct twochar { char _[2]; };
template <class U>
static char is_class_or_union_tester(void(U::*)(void));
template <class U>
static twochar is_class_or_union_tester(...);
static const bool value = sizeof(is_class_or_union_tester<T>(0)) == sizeof(char);
};
struct empty{};
//addressof
template<class T> struct addr_impl_ref
{
T & v_;
inline addr_impl_ref( T & v ): v_( v ) {}
inline operator T& () const { return v_; }
private:
addr_impl_ref & operator=(const addr_impl_ref &);
};
template<class T> struct addressof_impl
{
static inline T * f( T & v, long )
{
return reinterpret_cast<T*>(
&const_cast<char&>(reinterpret_cast<const volatile char &>(v)));
}
static inline T * f( T * v, int )
{ return v; }
};
template<class T>
inline T * addressof( T & v )
{
return ::boost::move_detail::addressof_impl<T>::f
( ::boost::move_detail::addr_impl_ref<T>( v ), 0 );
}
} //namespace move_detail {
} //namespace boost {
#include <boost/move/detail/config_end.hpp>
#endif //#ifndef BOOST_MOVE_DETAIL_META_UTILS_HPP

View File

@ -0,0 +1,298 @@
//////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Ion Gaztanaga 2012-2012.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/move for documentation.
//
//////////////////////////////////////////////////////////////////////////////
//! \file
#ifndef BOOST_MOVE_ITERATOR_HPP
#define BOOST_MOVE_ITERATOR_HPP
#include <boost/move/detail/config_begin.hpp>
#include <boost/move/utility.hpp>
#include <iterator> //std::iterator
namespace boost {
//////////////////////////////////////////////////////////////////////////////
//
// move_iterator
//
//////////////////////////////////////////////////////////////////////////////
//! Class template move_iterator is an iterator adaptor with the same behavior
//! as the underlying iterator except that its dereference operator implicitly
//! converts the value returned by the underlying iterator's dereference operator
//! to an rvalue reference. Some generic algorithms can be called with move
//! iterators to replace copying with moving.
template <class It>
class move_iterator
{
public:
typedef It iterator_type;
typedef typename std::iterator_traits<iterator_type>::value_type value_type;
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES) || defined(BOOST_MOVE_DOXYGEN_INVOKED)
typedef value_type && reference;
#else
typedef typename ::boost::move_detail::if_
< ::boost::has_move_emulation_enabled<value_type>
, ::boost::rv<value_type>&
, value_type & >::type reference;
#endif
typedef It pointer;
typedef typename std::iterator_traits<iterator_type>::difference_type difference_type;
typedef typename std::iterator_traits<iterator_type>::iterator_category iterator_category;
move_iterator()
{}
explicit move_iterator(It i)
: m_it(i)
{}
template <class U>
move_iterator(const move_iterator<U>& u)
: m_it(u.base())
{}
iterator_type base() const
{ return m_it; }
reference operator*() const
{
#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) || defined(BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES)
return *m_it;
#else
return ::boost::move(*m_it);
#endif
}
pointer operator->() const
{ return m_it; }
move_iterator& operator++()
{ ++m_it; return *this; }
move_iterator<iterator_type> operator++(int)
{ move_iterator<iterator_type> tmp(*this); ++(*this); return tmp; }
move_iterator& operator--()
{ --m_it; return *this; }
move_iterator<iterator_type> operator--(int)
{ move_iterator<iterator_type> tmp(*this); --(*this); return tmp; }
move_iterator<iterator_type> operator+ (difference_type n) const
{ return move_iterator<iterator_type>(m_it + n); }
move_iterator& operator+=(difference_type n)
{ m_it += n; return *this; }
move_iterator<iterator_type> operator- (difference_type n) const
{ return move_iterator<iterator_type>(m_it - n); }
move_iterator& operator-=(difference_type n)
{ m_it -= n; return *this; }
reference operator[](difference_type n) const
{
#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) || defined(BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES)
return m_it[n];
#else
return ::boost::move(m_it[n]);
#endif
}
friend bool operator==(const move_iterator& x, const move_iterator& y)
{ return x.base() == y.base(); }
friend bool operator!=(const move_iterator& x, const move_iterator& y)
{ return x.base() != y.base(); }
friend bool operator< (const move_iterator& x, const move_iterator& y)
{ return x.base() < y.base(); }
friend bool operator<=(const move_iterator& x, const move_iterator& y)
{ return x.base() <= y.base(); }
friend bool operator> (const move_iterator& x, const move_iterator& y)
{ return x.base() > y.base(); }
friend bool operator>=(const move_iterator& x, const move_iterator& y)
{ return x.base() >= y.base(); }
friend difference_type operator-(const move_iterator& x, const move_iterator& y)
{ return x.base() - y.base(); }
friend move_iterator operator+(difference_type n, const move_iterator& x)
{ return move_iterator(x.base() + n); }
private:
It m_it;
};
//is_move_iterator
namespace move_detail {
template <class I>
struct is_move_iterator
: public ::boost::move_detail::integral_constant<bool, false>
{
};
template <class I>
struct is_move_iterator< ::boost::move_iterator<I> >
: public ::boost::move_detail::integral_constant<bool, true>
{
};
} //namespace move_detail {
//////////////////////////////////////////////////////////////////////////////
//
// move_iterator
//
//////////////////////////////////////////////////////////////////////////////
//!
//! <b>Returns</b>: move_iterator<It>(i).
template<class It>
inline move_iterator<It> make_move_iterator(const It &it)
{ return move_iterator<It>(it); }
//////////////////////////////////////////////////////////////////////////////
//
// back_move_insert_iterator
//
//////////////////////////////////////////////////////////////////////////////
//! A move insert iterator that move constructs elements at the
//! back of a container
template <typename C> // C models Container
class back_move_insert_iterator
: public std::iterator<std::output_iterator_tag, void, void, void, void>
{
C* container_m;
public:
typedef C container_type;
typedef typename C::value_type value_type;
typedef typename C::reference reference;
explicit back_move_insert_iterator(C& x) : container_m(&x) { }
back_move_insert_iterator& operator=(reference x)
{ container_m->push_back(boost::move(x)); return *this; }
back_move_insert_iterator& operator=(BOOST_RV_REF(value_type) x)
{ reference rx = x; return this->operator=(rx); }
back_move_insert_iterator& operator*() { return *this; }
back_move_insert_iterator& operator++() { return *this; }
back_move_insert_iterator& operator++(int) { return *this; }
};
//!
//! <b>Returns</b>: back_move_insert_iterator<C>(x).
template <typename C> // C models Container
inline back_move_insert_iterator<C> back_move_inserter(C& x)
{
return back_move_insert_iterator<C>(x);
}
//////////////////////////////////////////////////////////////////////////////
//
// front_move_insert_iterator
//
//////////////////////////////////////////////////////////////////////////////
//! A move insert iterator that move constructs elements int the
//! front of a container
template <typename C> // C models Container
class front_move_insert_iterator
: public std::iterator<std::output_iterator_tag, void, void, void, void>
{
C* container_m;
public:
typedef C container_type;
typedef typename C::value_type value_type;
typedef typename C::reference reference;
explicit front_move_insert_iterator(C& x) : container_m(&x) { }
front_move_insert_iterator& operator=(reference x)
{ container_m->push_front(boost::move(x)); return *this; }
front_move_insert_iterator& operator=(BOOST_RV_REF(value_type) x)
{ reference rx = x; return this->operator=(rx); }
front_move_insert_iterator& operator*() { return *this; }
front_move_insert_iterator& operator++() { return *this; }
front_move_insert_iterator& operator++(int) { return *this; }
};
//!
//! <b>Returns</b>: front_move_insert_iterator<C>(x).
template <typename C> // C models Container
inline front_move_insert_iterator<C> front_move_inserter(C& x)
{
return front_move_insert_iterator<C>(x);
}
//////////////////////////////////////////////////////////////////////////////
//
// insert_move_iterator
//
//////////////////////////////////////////////////////////////////////////////
template <typename C> // C models Container
class move_insert_iterator
: public std::iterator<std::output_iterator_tag, void, void, void, void>
{
C* container_m;
typename C::iterator pos_;
public:
typedef C container_type;
typedef typename C::value_type value_type;
typedef typename C::reference reference;
explicit move_insert_iterator(C& x, typename C::iterator pos)
: container_m(&x), pos_(pos)
{}
move_insert_iterator& operator=(reference x)
{
pos_ = container_m->insert(pos_, ::boost::move(x));
++pos_;
return *this;
}
move_insert_iterator& operator=(BOOST_RV_REF(value_type) x)
{ reference rx = x; return this->operator=(rx); }
move_insert_iterator& operator*() { return *this; }
move_insert_iterator& operator++() { return *this; }
move_insert_iterator& operator++(int) { return *this; }
};
//!
//! <b>Returns</b>: move_insert_iterator<C>(x, it).
template <typename C> // C models Container
inline move_insert_iterator<C> move_inserter(C& x, typename C::iterator it)
{
return move_insert_iterator<C>(x, it);
}
} //namespace boost {
#include <boost/move/detail/config_end.hpp>
#endif //#ifndef BOOST_MOVE_ITERATOR_HPP

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,142 @@
//////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Ion Gaztanaga 2009-2012.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/move for documentation.
//
//////////////////////////////////////////////////////////////////////////////
//! \file
#ifndef BOOST_MOVE_MOVE_TRAITS_HPP
#define BOOST_MOVE_MOVE_TRAITS_HPP
#include <boost/move/detail/config_begin.hpp>
#include <boost/type_traits/has_trivial_destructor.hpp>
#include <boost/move/detail/meta_utils.hpp>
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
#include <boost/move/core.hpp>
#endif
namespace boost {
//! If this trait yields to true
//! (<i>has_trivial_destructor_after_move &lt;T&gt;::value == true</i>)
//! means that if T is used as argument of a move construction/assignment,
//! there is no need to call T's destructor.
//! This optimization tipically is used to improve containers' performance.
//!
//! By default this trait is true if the type has trivial destructor,
//! every class should specialize this trait if it wants to improve performance
//! when inserted in containers.
template <class T>
struct has_trivial_destructor_after_move
: ::boost::has_trivial_destructor<T>
{};
//! By default this traits returns false. Classes with non-throwing move constructor
//! and assignment can specialize this trait to obtain some performance improvements.
template <class T>
struct has_nothrow_move
: public ::boost::move_detail::integral_constant<bool, false>
{};
namespace move_detail {
// Code from Jeffrey Lee Hellrung, many thanks
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
template< class T> struct forward_type { typedef T type; };
#else // #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
template< class T>
struct forward_type
{ typedef const T &type; };
template< class T>
struct forward_type< boost::rv<T> >
{ typedef T type; };
#endif // #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
template< class T > struct is_rvalue_reference : ::boost::move_detail::integral_constant<bool, false> { };
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
template< class T > struct is_rvalue_reference< T&& > : ::boost::move_detail::integral_constant<bool, true> { };
#else // #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
template< class T > struct is_rvalue_reference< boost::rv<T>& >
: ::boost::move_detail::integral_constant<bool, true>
{};
template< class T > struct is_rvalue_reference< const boost::rv<T>& >
: ::boost::move_detail::integral_constant<bool, true>
{};
#endif // #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
template< class T > struct add_rvalue_reference { typedef T&& type; };
#else // #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
namespace detail_add_rvalue_reference
{
template< class T
, bool emulation = ::boost::has_move_emulation_enabled<T>::value
, bool rv = ::boost::move_detail::is_rv<T>::value >
struct add_rvalue_reference_impl { typedef T type; };
template< class T, bool emulation>
struct add_rvalue_reference_impl< T, emulation, true > { typedef T & type; };
template< class T, bool rv >
struct add_rvalue_reference_impl< T, true, rv > { typedef ::boost::rv<T>& type; };
} // namespace detail_add_rvalue_reference
template< class T >
struct add_rvalue_reference
: detail_add_rvalue_reference::add_rvalue_reference_impl<T>
{ };
template< class T >
struct add_rvalue_reference<T &>
{ typedef T & type; };
#endif // #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
template< class T > struct remove_rvalue_reference { typedef T type; };
#ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
template< class T > struct remove_rvalue_reference< T&& > { typedef T type; };
#else // #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
template< class T > struct remove_rvalue_reference< rv<T> > { typedef T type; };
template< class T > struct remove_rvalue_reference< const rv<T> > { typedef T type; };
template< class T > struct remove_rvalue_reference< volatile rv<T> > { typedef T type; };
template< class T > struct remove_rvalue_reference< const volatile rv<T> > { typedef T type; };
template< class T > struct remove_rvalue_reference< rv<T>& > { typedef T type; };
template< class T > struct remove_rvalue_reference< const rv<T>& > { typedef T type; };
template< class T > struct remove_rvalue_reference< volatile rv<T>& > { typedef T type; };
template< class T > struct remove_rvalue_reference< const volatile rv<T>& >{ typedef T type; };
#endif // #ifndef BOOST_NO_CXX11_RVALUE_REFERENCES
template <typename T>
typename boost::move_detail::add_rvalue_reference<T>::type declval();
} //move_detail {
// Ideas from Boost.Move review, Jeffrey Lee Hellrung:
//
//- TypeTraits metafunctions is_lvalue_reference, add_lvalue_reference, and remove_lvalue_reference ?
// Perhaps add_reference and remove_reference can be modified so that they behave wrt emulated rvalue
// references the same as wrt real rvalue references, i.e., add_reference< rv<T>& > -> T& rather than
// rv<T>& (since T&& & -> T&).
//
//- Add'l TypeTraits has_[trivial_]move_{constructor,assign}...?
//
//- An as_lvalue(T& x) function, which amounts to an identity operation in C++0x, but strips emulated
// rvalue references in C++03. This may be necessary to prevent "accidental moves".
} //namespace boost {
#include <boost/move/detail/config_end.hpp>
#endif //#ifndef BOOST_MOVE_MOVE_TRAITS_HPP

View File

@ -0,0 +1,194 @@
//////////////////////////////////////////////////////////////////////////////
//
// (C) Copyright Ion Gaztanaga 2012-2012.
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)
//
// See http://www.boost.org/libs/move for documentation.
//
//////////////////////////////////////////////////////////////////////////////
//! \file
#ifndef BOOST_MOVE_MOVE_UTILITY_HPP
#define BOOST_MOVE_MOVE_UTILITY_HPP
#include <boost/move/detail/config_begin.hpp>
#include <boost/move/core.hpp>
#include <boost/move/detail/meta_utils.hpp>
#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_MOVE_DOXYGEN_INVOKED)
namespace boost {
template<class T>
struct enable_move_utility_emulation
{
static const bool value = true;
};
//////////////////////////////////////////////////////////////////////////////
//
// move()
//
//////////////////////////////////////////////////////////////////////////////
template <class T>
inline typename ::boost::move_detail::enable_if_c
< enable_move_utility_emulation<T>::value && !has_move_emulation_enabled<T>::value, T&>::type
move(T& x)
{
return x;
}
template <class T>
inline typename ::boost::move_detail::enable_if_c
< enable_move_utility_emulation<T>::value && has_move_emulation_enabled<T>::value, rv<T>&>::type
move(T& x)
{
return *static_cast<rv<T>* >(::boost::move_detail::addressof(x));
}
template <class T>
inline typename ::boost::move_detail::enable_if_c
< enable_move_utility_emulation<T>::value && has_move_emulation_enabled<T>::value, rv<T>&>::type
move(rv<T>& x)
{
return x;
}
//////////////////////////////////////////////////////////////////////////////
//
// forward()
//
//////////////////////////////////////////////////////////////////////////////
template <class T>
inline typename ::boost::move_detail::enable_if_c
< enable_move_utility_emulation<T>::value && ::boost::move_detail::is_rv<T>::value, T &>::type
forward(const typename ::boost::move_detail::identity<T>::type &x)
{
return const_cast<T&>(x);
}
template <class T>
inline typename ::boost::move_detail::enable_if_c
< enable_move_utility_emulation<T>::value && !::boost::move_detail::is_rv<T>::value, const T &>::type
forward(const typename ::boost::move_detail::identity<T>::type &x)
{
return x;
}
} //namespace boost
#else //#if defined(BOOST_NO_CXX11_RVALUE_REFERENCES) && !defined(BOOST_MOVE_DOXYGEN_INVOKED)
#if defined(BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE)
#include <utility>
namespace boost{
using ::std::move;
using ::std::forward;
} //namespace boost
#else //!BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE
#include <boost/type_traits/remove_reference.hpp>
namespace boost {
//! This trait's internal boolean `value` is false in compilers with rvalue references
//! and true in compilers without rvalue references.
//!
//! A user can specialize this trait for a type T to false to SFINAE out `move` and `forward`
//! so that the user can define a different move emulation for that type in namespace boost
//! (e.g. another Boost library for its types) and avoid any overload ambiguity.
template<class T>
struct enable_move_utility_emulation
{
static const bool value = false;
};
//////////////////////////////////////////////////////////////////////////////
//
// move
//
//////////////////////////////////////////////////////////////////////////////
#if defined(BOOST_MOVE_DOXYGEN_INVOKED)
//! This function provides a way to convert a reference into a rvalue reference
//! in compilers with rvalue references. For other compilers converts T & into
//! <i>::boost::rv<T> &</i> so that move emulation is activated.
template <class T>
rvalue_reference move (input_reference);
#elif defined(BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES)
//Old move approach, lvalues could bind to rvalue references
template <class T>
inline typename remove_reference<T>::type && move(T&& t)
{ return t; }
#else //BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES
template <class T>
inline typename remove_reference<T>::type && move(T&& t)
{ return static_cast<typename remove_reference<T>::type &&>(t); }
#endif //BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES
//////////////////////////////////////////////////////////////////////////////
//
// forward
//
//////////////////////////////////////////////////////////////////////////////
#if defined(BOOST_MOVE_DOXYGEN_INVOKED)
//! This function provides limited form of forwarding that is usually enough for
//! in-place construction and avoids the exponential overloading for
//! achieve the limited forwarding in C++03.
//!
//! For compilers with rvalue references this function provides perfect forwarding.
//!
//! Otherwise:
//! * If input_reference binds to const ::boost::rv<T> & then it output_reference is
//! ::boost::rv<T> &
//!
//! * Else, output_reference is equal to input_reference.
template <class T> output_reference forward(input_reference);
#elif defined(BOOST_MOVE_OLD_RVALUE_REF_BINDING_RULES)
//Old move approach, lvalues could bind to rvalue references
template <class T>
inline T&& forward (typename ::boost::move_detail::identity<T>::type&& t)
{ return t; }
#else //Old move
//Implementation #5 from N2951, thanks to Howard Hinnant
template <class T, class U>
inline T&& forward(U&& t
, typename ::boost::move_detail::enable_if_c<
move_detail::is_lvalue_reference<T>::value ? move_detail::is_lvalue_reference<U>::value : true>::type * = 0/*
, typename ::boost::move_detail::enable_if_c<
move_detail::is_convertible
<typename remove_reference<U>::type*, typename remove_reference<T>::type*>::value>::type * = 0*/)
{ return static_cast<T&&>(t); }
#endif //BOOST_MOVE_DOXYGEN_INVOKED
} //namespace boost {
#endif //#if defined(BOOST_MOVE_USE_STANDARD_LIBRARY_MOVE)
#endif //BOOST_NO_CXX11_RVALUE_REFERENCES
#include <boost/move/detail/config_end.hpp>
#endif //#ifndef BOOST_MOVE_MOVE_UTILITY_HPP

View File

@ -244,6 +244,27 @@ namespace boost {
} // namespace detail } // namespace detail
namespace detail {
// Stuff for directed_graph and undirected_graph to skip over their first
// vertex_index and edge_index properties when providing vertex_all and
// edge_all; make sure you know the exact structure of your properties if you
// use there.
struct remove_first_property {
template <typename F>
struct result {
typedef typename boost::function_traits<F>::arg1_type a1;
typedef typename boost::remove_reference<a1>::type non_ref;
typedef typename non_ref::next_type nx;
typedef typename boost::mpl::if_<boost::is_const<non_ref>, boost::add_const<nx>, nx>::type with_const;
typedef typename boost::add_reference<with_const>::type type;
};
template <typename Prop>
typename Prop::next_type& operator()(Prop& p) const {return p.m_base;}
template <typename Prop>
const typename Prop::next_type& operator()(const Prop& p) const {return p.m_base;}
};
}
} // namesapce boost } // namesapce boost
#endif /* BOOST_PROPERTY_HPP */ #endif /* BOOST_PROPERTY_HPP */

View File

@ -28,7 +28,7 @@ namespace boost
return boost::begin( r ) == boost::end( r ); return boost::begin( r ) == boost::end( r );
} }
} // namepace 'boost' } // namespace 'boost'
#endif #endif

View File

@ -100,7 +100,7 @@ namespace boost
// While this design is less performant than some less // While this design is less performant than some less
// safe alternatives, the use of ranges and iterators to // safe alternatives, the use of ranges and iterators to
// perform counting will never be optimal anyhow, hence // perform counting will never be optimal anyhow, hence
// if optimal performance is desired a handcoded loop // if optimal performance is desired a hand-coded loop
// is the solution. // is the solution.
template<typename Integer> template<typename Integer>
class integer_iterator_with_step class integer_iterator_with_step

View File

@ -48,7 +48,7 @@ namespace boost
//! iterator_range output operator //! iterator_range output operator
/*! /*!
Output the range to an ostream. Elements are outputed Output the range to an ostream. Elements are outputted
in a sequence without separators. in a sequence without separators.
*/ */
template< typename IteratorT, typename Elem, typename Traits > template< typename IteratorT, typename Elem, typename Traits >
@ -67,7 +67,7 @@ namespace boost
//! iterator_range output operator //! iterator_range output operator
/*! /*!
Output the range to an ostream. Elements are outputed Output the range to an ostream. Elements are outputted
in a sequence without separators. in a sequence without separators.
*/ */
template< typename IteratorT > template< typename IteratorT >

View File

@ -49,6 +49,12 @@
#define BOOST_RATIO_INTMAX_C(a) a##LL #define BOOST_RATIO_INTMAX_C(a) a##LL
#endif #endif
#ifdef UINTMAX_C
#define BOOST_RATIO_UINTMAX_C(a) UINTMAX_C(a)
#else
#define BOOST_RATIO_UINTMAX_C(a) a##ULL
#endif
#define BOOST_RATIO_INTMAX_T_MAX (0x7FFFFFFFFFFFFFFELL) #define BOOST_RATIO_INTMAX_T_MAX (0x7FFFFFFFFFFFFFFELL)

View File

@ -133,7 +133,7 @@ namespace ratio_detail
class br_mul class br_mul
{ {
static const boost::intmax_t nan = static const boost::intmax_t nan =
(BOOST_RATIO_INTMAX_C(1) << (sizeof(boost::intmax_t) * CHAR_BIT - 1)); boost::intmax_t(BOOST_RATIO_UINTMAX_C(1) << (sizeof(boost::intmax_t) * CHAR_BIT - 1));
static const boost::intmax_t min = boost::integer_traits<boost::intmax_t>::const_min; static const boost::intmax_t min = boost::integer_traits<boost::intmax_t>::const_min;
static const boost::intmax_t max = boost::integer_traits<boost::intmax_t>::const_max; static const boost::intmax_t max = boost::integer_traits<boost::intmax_t>::const_max;
@ -172,7 +172,7 @@ namespace ratio_detail
template <boost::intmax_t X, boost::intmax_t Y> template <boost::intmax_t X, boost::intmax_t Y>
class br_div class br_div
{ {
static const boost::intmax_t nan = (1LL << (sizeof(boost::intmax_t) * CHAR_BIT - 1)); static const boost::intmax_t nan = boost::intmax_t(BOOST_RATIO_UINTMAX_C(1) << (sizeof(boost::intmax_t) * CHAR_BIT - 1));
static const boost::intmax_t min = boost::integer_traits<boost::intmax_t>::const_min; static const boost::intmax_t min = boost::integer_traits<boost::intmax_t>::const_min;
static const boost::intmax_t max = boost::integer_traits<boost::intmax_t>::const_max; static const boost::intmax_t max = boost::integer_traits<boost::intmax_t>::const_max;

View File

@ -520,9 +520,26 @@ public:
} }
void increment() void increment()
{ {
// We must not start with a continuation character:
if((static_cast<boost::uint8_t>(*m_position) & 0xC0) == 0x80)
invalid_sequence();
// skip high surrogate first if there is one: // skip high surrogate first if there is one:
unsigned c = detail::utf8_byte_count(*m_position); unsigned c = detail::utf8_byte_count(*m_position);
std::advance(m_position, c); if(m_value == pending_read)
{
// Since we haven't read in a value, we need to validate the code points:
for(unsigned i = 0; i < c; ++i)
{
++m_position;
// We must have a continuation byte:
if((i != c - 1) && ((static_cast<boost::uint8_t>(*m_position) & 0xC0) != 0x80))
invalid_sequence();
}
}
else
{
std::advance(m_position, c);
}
m_value = pending_read; m_value = pending_read;
} }
void decrement() void decrement()
@ -589,7 +606,7 @@ private:
// we must not have a continuation character: // we must not have a continuation character:
if((m_value & 0xC0u) == 0x80u) if((m_value & 0xC0u) == 0x80u)
invalid_sequence(); invalid_sequence();
// see how many extra byts we have: // see how many extra bytes we have:
unsigned extra = detail::utf8_trailing_byte_count(*m_position); unsigned extra = detail::utf8_trailing_byte_count(*m_position);
// extract the extra bits, 6 from each extra byte: // extract the extra bits, 6 from each extra byte:
BaseIterator next(m_position); BaseIterator next(m_position);
@ -597,6 +614,9 @@ private:
{ {
++next; ++next;
m_value <<= 6; m_value <<= 6;
// We must have a continuation byte:
if((static_cast<boost::uint8_t>(*next) & 0xC0) != 0x80)
invalid_sequence();
m_value += static_cast<boost::uint8_t>(*next) & 0x3Fu; m_value += static_cast<boost::uint8_t>(*next) & 0x3Fu;
} }
// we now need to remove a few of the leftmost bits, but how many depends // we now need to remove a few of the leftmost bits, but how many depends

View File

@ -20,6 +20,7 @@
#define BOOST_CPP_REGEX_TRAITS_HPP_INCLUDED #define BOOST_CPP_REGEX_TRAITS_HPP_INCLUDED
#include <boost/config.hpp> #include <boost/config.hpp>
#include <boost/integer.hpp>
#ifndef BOOST_NO_STD_LOCALE #ifndef BOOST_NO_STD_LOCALE
@ -107,12 +108,14 @@ template<class charT, class traits>
typename parser_buf<charT, traits>::pos_type typename parser_buf<charT, traits>::pos_type
parser_buf<charT, traits>::seekoff(off_type off, ::std::ios_base::seekdir way, ::std::ios_base::openmode which) parser_buf<charT, traits>::seekoff(off_type off, ::std::ios_base::seekdir way, ::std::ios_base::openmode which)
{ {
typedef typename boost::int_t<sizeof(way) * CHAR_BIT>::least cast_type;
if(which & ::std::ios_base::out) if(which & ::std::ios_base::out)
return pos_type(off_type(-1)); return pos_type(off_type(-1));
std::ptrdiff_t size = this->egptr() - this->eback(); std::ptrdiff_t size = this->egptr() - this->eback();
std::ptrdiff_t pos = this->gptr() - this->eback(); std::ptrdiff_t pos = this->gptr() - this->eback();
charT* g = this->eback(); charT* g = this->eback();
switch(way) switch(static_cast<cast_type>(way))
{ {
case ::std::ios_base::beg: case ::std::ios_base::beg:
if((off < 0) || (off > size)) if((off < 0) || (off > size))

View File

@ -121,7 +121,7 @@ template class BOOST_REGEX_TEMPLATE_DECL ::boost::re_detail::perl_matcher< std::
#undef BOOST_REGEX_TEMPLATE_DECL #undef BOOST_REGEX_TEMPLATE_DECL
#elif (defined(__GNUC__) && (__GNUC__ >= 3)) || !defined(BOOST_NO_EXTERN_TEMPLATE) #elif (defined(__GNUC__) && (__GNUC__ >= 3)) || !defined(BOOST_NO_CXX11_EXTERN_TEMPLATE)
# ifndef BOOST_REGEX_INSTANTIATE # ifndef BOOST_REGEX_INSTANTIATE
# ifdef __GNUC__ # ifdef __GNUC__

View File

@ -1268,6 +1268,9 @@ bool perl_matcher<BidiIterator, Allocator, traits>::unwind_fast_dot_repeat(bool
}while((count < rep->max) && (position != last) && !can_start(*position, rep->_map, mask_skip)); }while((count < rep->max) && (position != last) && !can_start(*position, rep->_map, mask_skip));
} }
// remember where we got to if this is a leading repeat:
if((rep->leading) && (count < rep->max))
restart = position;
if(position == last) if(position == last)
{ {
// can't repeat any more, remove the pushed state: // can't repeat any more, remove the pushed state:

View File

@ -56,6 +56,8 @@
#include <boost/mpl/not.hpp> #include <boost/mpl/not.hpp>
#include <boost/mpl/identity.hpp> #include <boost/mpl/identity.hpp>
#include <boost/serialization/throw_exception.hpp>
namespace boost { namespace boost {
namespace serialization { namespace serialization {
namespace smart_cast_impl { namespace smart_cast_impl {
@ -159,7 +161,7 @@ namespace smart_cast_impl {
static T cast(U * u){ static T cast(U * u){
T tmp = dynamic_cast< T >(u); T tmp = dynamic_cast< T >(u);
#ifndef NDEBUG #ifndef NDEBUG
if ( tmp == 0 ) throw std::bad_cast(); if ( tmp == 0 ) throw_exception(std::bad_cast());
#endif #endif
return tmp; return tmp;
} }
@ -201,7 +203,7 @@ namespace smart_cast_impl {
static T cast(U * u){ static T cast(U * u){
T tmp = dynamic_cast< T >(u); T tmp = dynamic_cast< T >(u);
#ifndef NDEBUG #ifndef NDEBUG
if ( tmp == 0 ) throw std::bad_cast(); if ( tmp == 0 ) throw_exception(std::bad_cast());
#endif #endif
return tmp; return tmp;
} }

View File

@ -0,0 +1,250 @@
/*
* Copyright (c) 2012 Glen Joseph Fernandes
* glenfe at live dot com
*
* Distributed under the Boost Software License,
* Version 1.0. (See accompanying file LICENSE_1_0.txt
* or copy at http://boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_SMART_PTR_ALLOCATE_SHARED_ARRAY_HPP
#define BOOST_SMART_PTR_ALLOCATE_SHARED_ARRAY_HPP
#include <boost/smart_ptr/shared_ptr.hpp>
#include <boost/smart_ptr/detail/allocate_array_helper.hpp>
#include <boost/smart_ptr/detail/array_deleter.hpp>
#include <boost/smart_ptr/detail/array_traits.hpp>
#include <boost/smart_ptr/detail/sp_if_array.hpp>
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
#include <initializer_list>
#endif
namespace boost {
template<typename T, typename A>
inline typename boost::detail::sp_if_array<T>::type
allocate_shared(const A& allocator, std::size_t size) {
typedef typename boost::detail::array_inner<T>::type T1;
typedef typename boost::detail::array_base<T1>::type T2;
T1* p1 = 0;
T2* p2 = 0;
std::size_t n1 = size * boost::detail::array_total<T1>::size;
boost::detail::allocate_array_helper<A, T2[]> a1(allocator, n1, &p2);
boost::detail::array_deleter<T2[]> d1(n1);
boost::shared_ptr<T> s1(p1, d1, a1);
typedef boost::detail::array_deleter<T2[]>* D2;
p1 = reinterpret_cast<T1*>(p2);
D2 d2 = static_cast<D2>(s1._internal_get_untyped_deleter());
d2->init(p2);
return boost::shared_ptr<T>(s1, p1);
}
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES) && !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
template<typename T, typename A, typename... Args>
inline typename boost::detail::sp_if_array<T>::type
allocate_shared(const A& allocator, std::size_t size, Args&&... args) {
typedef typename boost::detail::array_inner<T>::type T1;
typedef typename boost::detail::array_base<T1>::type T2;
T1* p1 = 0;
T2* p2 = 0;
std::size_t n1 = size * boost::detail::array_total<T1>::size;
boost::detail::allocate_array_helper<A, T2[]> a1(allocator, n1, &p2);
boost::detail::array_deleter<T2[]> d1(n1);
boost::shared_ptr<T> s1(p1, d1, a1);
typedef boost::detail::array_deleter<T2[]>* D2;
p1 = reinterpret_cast<T1*>(p2);
D2 d2 = static_cast<D2>(s1._internal_get_untyped_deleter());
d2->init(p2, boost::detail::sp_forward<Args>(args)...);
return boost::shared_ptr<T>(s1, p1);
}
template<typename T, typename A, typename... Args>
inline typename boost::detail::sp_if_size_array<T>::type
allocate_shared(const A& allocator, Args&&... args) {
typedef typename boost::detail::array_inner<T>::type T1;
typedef typename boost::detail::array_base<T1>::type T2;
enum {
N = boost::detail::array_total<T>::size
};
T1* p1 = 0;
T2* p2 = 0;
boost::detail::allocate_array_helper<A, T2[N]> a1(allocator, &p2);
boost::detail::array_deleter<T2[N]> d1;
boost::shared_ptr<T> s1(p1, d1, a1);
typedef boost::detail::array_deleter<T2[N]>* D2;
p1 = reinterpret_cast<T1*>(p2);
D2 d2 = static_cast<D2>(s1._internal_get_untyped_deleter());
d2->init(p2, boost::detail::sp_forward<Args>(args)...);
return boost::shared_ptr<T>(s1, p1);
}
#endif
#if !defined(BOOST_NO_CXX11_UNIFIED_INITIALIZATION_SYNTAX)
template<typename T, typename A>
inline typename boost::detail::sp_if_size_array<T>::type
allocate_shared(const A& allocator, const T& list) {
typedef typename boost::detail::array_inner<T>::type T1;
typedef typename boost::detail::array_base<T1>::type T2;
typedef const T2 T3;
enum {
N = boost::detail::array_total<T>::size
};
T1* p1 = 0;
T2* p2 = 0;
T3* p3 = 0;
boost::detail::allocate_array_helper<A, T2[N]> a1(allocator, &p2);
boost::detail::array_deleter<T2[N]> d1;
boost::shared_ptr<T> s1(p1, d1, a1);
typedef boost::detail::array_deleter<T2[N]>* D2;
p3 = reinterpret_cast<T3*>(list);
p1 = reinterpret_cast<T1*>(p2);
D2 d2 = static_cast<D2>(s1._internal_get_untyped_deleter());
d2->init_list(p2, p3);
return boost::shared_ptr<T>(s1, p1);
}
template<typename T, typename A>
inline typename boost::detail::sp_if_array<T>::type
allocate_shared(const A& allocator, std::size_t size,
const typename boost::detail::array_inner<T>::type& list) {
typedef typename boost::detail::array_inner<T>::type T1;
typedef typename boost::detail::array_base<T1>::type T2;
typedef const T2 T3;
enum {
M = boost::detail::array_total<T1>::size
};
T1* p1 = 0;
T2* p2 = 0;
T3* p3 = 0;
std::size_t n1 = M * size;
boost::detail::allocate_array_helper<A, T2[]> a1(allocator, n1, &p2);
boost::detail::array_deleter<T2[]> d1(n1);
boost::shared_ptr<T> s1(p1, d1, a1);
typedef boost::detail::array_deleter<T2[]>* D2;
p3 = reinterpret_cast<T3*>(list);
p1 = reinterpret_cast<T1*>(p2);
D2 d2 = static_cast<D2>(s1._internal_get_untyped_deleter());
d2->template init_list<M>(p2, p3);
return boost::shared_ptr<T>(s1, p1);
}
template<typename T, typename A>
inline typename boost::detail::sp_if_size_array<T>::type
allocate_shared(const A& allocator,
const typename boost::detail::array_inner<T>::type& list) {
typedef typename boost::detail::array_inner<T>::type T1;
typedef typename boost::detail::array_base<T1>::type T2;
typedef const T2 T3;
enum {
M = boost::detail::array_total<T1>::size,
N = boost::detail::array_total<T>::size
};
T1* p1 = 0;
T2* p2 = 0;
T3* p3 = 0;
boost::detail::allocate_array_helper<A, T2[N]> a1(allocator, &p2);
boost::detail::array_deleter<T2[N]> d1;
boost::shared_ptr<T> s1(p1, d1, a1);
typedef boost::detail::array_deleter<T2[N]>* D2;
p3 = reinterpret_cast<T3*>(list);
p1 = reinterpret_cast<T1*>(p2);
D2 d2 = static_cast<D2>(s1._internal_get_untyped_deleter());
d2->template init_list<M>(p2, p3);
return boost::shared_ptr<T>(s1, p1);
}
#if !defined(BOOST_NO_CXX11_HDR_INITIALIZER_LIST)
template<typename T, typename A>
inline typename boost::detail::sp_if_array<T>::type
allocate_shared(const A& allocator,
std::initializer_list<typename boost::detail::array_inner<T>::type> list) {
typedef typename boost::detail::array_inner<T>::type T1;
typedef typename boost::detail::array_base<T1>::type T2;
typedef const T2 T3;
T1* p1 = 0;
T2* p2 = 0;
T3* p3 = 0;
std::size_t n1 = list.size() * boost::detail::array_total<T1>::size;
boost::detail::allocate_array_helper<A, T2[]> a1(allocator, n1, &p2);
boost::detail::array_deleter<T2[]> d1(n1);
boost::shared_ptr<T> s1(p1, d1, a1);
typedef boost::detail::array_deleter<T2[]>* D2;
p3 = reinterpret_cast<T3*>(list.begin());
p1 = reinterpret_cast<T1*>(p2);
D2 d2 = static_cast<D2>(s1._internal_get_untyped_deleter());
d2->init_list(p2, p3);
return boost::shared_ptr<T>(s1, p1);
}
#endif
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
template<typename T, typename A>
inline typename boost::detail::sp_if_array<T>::type
allocate_shared(const A& allocator, std::size_t size,
typename boost::detail::array_base<T>::type&& value) {
typedef typename boost::detail::array_inner<T>::type T1;
typedef typename boost::detail::array_base<T1>::type T2;
T1* p1 = 0;
T2* p2 = 0;
std::size_t n1 = size * boost::detail::array_total<T1>::size;
boost::detail::allocate_array_helper<A, T2[]> a1(allocator, n1, &p2);
boost::detail::array_deleter<T2[]> d1(n1);
boost::shared_ptr<T> s1(p1, d1, a1);
typedef boost::detail::array_deleter<T2[]>* D2;
p1 = reinterpret_cast<T1*>(p2);
D2 d2 = static_cast<D2>(s1._internal_get_untyped_deleter());
d2->init(p2, boost::detail::sp_forward<T2>(value));
return boost::shared_ptr<T>(s1, p1);
}
template<typename T, typename A>
inline typename boost::detail::sp_if_size_array<T>::type
allocate_shared(const A& allocator,
typename boost::detail::array_base<T>::type&& value) {
typedef typename boost::detail::array_inner<T>::type T1;
typedef typename boost::detail::array_base<T1>::type T2;
enum {
N = boost::detail::array_total<T>::size
};
T1* p1 = 0;
T2* p2 = 0;
boost::detail::allocate_array_helper<A, T2[N]> a1(allocator, &p2);
boost::detail::array_deleter<T2[N]> d1;
boost::shared_ptr<T> s1(p1, d1, a1);
typedef boost::detail::array_deleter<T2[N]>* D2;
p1 = reinterpret_cast<T1*>(p2);
D2 d2 = static_cast<D2>(s1._internal_get_untyped_deleter());
d2->init(p2, boost::detail::sp_forward<T2>(value));
return boost::shared_ptr<T>(s1, p1);
}
#endif
#endif
template<typename T, typename A>
inline typename boost::detail::sp_if_array<T>::type
allocate_shared_noinit(const A& allocator, std::size_t size) {
typedef typename boost::detail::array_inner<T>::type T1;
typedef typename boost::detail::array_base<T1>::type T2;
T1* p1 = 0;
T2* p2 = 0;
std::size_t n1 = size * boost::detail::array_total<T1>::size;
boost::detail::allocate_array_helper<A, T2[]> a1(allocator, n1, &p2);
boost::detail::array_deleter<T2[]> d1(n1);
boost::shared_ptr<T> s1(p1, d1, a1);
typedef boost::detail::array_deleter<T2[]>* D2;
p1 = reinterpret_cast<T1*>(p2);
D2 d2 = static_cast<D2>(s1._internal_get_untyped_deleter());
d2->noinit(p2);
return boost::shared_ptr<T>(s1, p1);
}
template<typename T, typename A>
inline typename boost::detail::sp_if_size_array<T>::type
allocate_shared_noinit(const A& allocator) {
typedef typename boost::detail::array_inner<T>::type T1;
typedef typename boost::detail::array_base<T1>::type T2;
enum {
N = boost::detail::array_total<T>::size
};
T1* p1 = 0;
T2* p2 = 0;
boost::detail::allocate_array_helper<A, T2[N]> a1(allocator, &p2);
boost::detail::array_deleter<T2[N]> d1;
boost::shared_ptr<T> s1(p1, d1, a1);
typedef boost::detail::array_deleter<T2[N]>* D2;
p1 = reinterpret_cast<T1*>(p2);
D2 d2 = static_cast<D2>(s1._internal_get_untyped_deleter());
d2->noinit(p2);
return boost::shared_ptr<T>(s1, p1);
}
}
#endif

View File

@ -0,0 +1,169 @@
/*
* Copyright (c) 2012 Glen Joseph Fernandes
* glenfe at live dot com
*
* Distributed under the Boost Software License,
* Version 1.0. (See accompanying file LICENSE_1_0.txt
* or copy at http://boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_SMART_PTR_DETAIL_ALLOCATE_ARRAY_HELPER_HPP
#define BOOST_SMART_PTR_DETAIL_ALLOCATE_ARRAY_HELPER_HPP
#include <boost/type_traits/alignment_of.hpp>
namespace boost {
namespace detail {
template<typename A, typename T, typename Y = char>
class allocate_array_helper;
template<typename A, typename T, typename Y>
class allocate_array_helper<A, T[], Y> {
template<typename A9, typename T9, typename Y9>
friend class allocate_array_helper;
typedef typename A::template rebind<Y> ::other A2;
typedef typename A::template rebind<char>::other A3;
public:
typedef typename A2::value_type value_type;
typedef typename A2::pointer pointer;
typedef typename A2::const_pointer const_pointer;
typedef typename A2::reference reference;
typedef typename A2::const_reference const_reference;
typedef typename A2::size_type size_type;
typedef typename A2::difference_type difference_type;
template<typename U>
struct rebind {
typedef allocate_array_helper<A, T[], U> other;
};
allocate_array_helper(const A& allocator, std::size_t size, T** data)
: allocator(allocator),
size(sizeof(T) * size),
data(data) {
}
template<class U>
allocate_array_helper(const allocate_array_helper<A, T[], U>& other)
: allocator(other.allocator),
size(other.size),
data(other.data) {
}
pointer address(reference value) const {
return allocator.address(value);
}
const_pointer address(const_reference value) const {
return allocator.address(value);
}
size_type max_size() const {
return allocator.max_size();
}
pointer allocate(size_type count, const void* value = 0) {
std::size_t a1 = boost::alignment_of<T>::value;
std::size_t n1 = count * sizeof(Y) + a1 - 1;
char* p1 = A3(allocator).allocate(n1 + size, value);
char* p2 = p1 + n1;
while (std::size_t(p2) % a1 != 0) {
p2--;
}
*data = reinterpret_cast<T*>(p2);
return reinterpret_cast<Y*>(p1);
}
void deallocate(pointer memory, size_type count) {
std::size_t a1 = boost::alignment_of<T>::value;
std::size_t n1 = count * sizeof(Y) + a1 - 1;
char* p1 = reinterpret_cast<char*>(memory);
A3(allocator).deallocate(p1, n1 + size);
}
void construct(pointer memory, const Y& value) {
allocator.construct(memory, value);
}
void destroy(pointer memory) {
allocator.destroy(memory);
}
template<typename U>
bool operator==(const allocate_array_helper<A, T[], U>& other) const {
return allocator == other.allocator;
}
template<typename U>
bool operator!=(const allocate_array_helper<A, T[], U>& other) const {
return !(*this == other);
}
private:
A2 allocator;
std::size_t size;
T** data;
};
template<typename A, typename T, std::size_t N, typename Y>
class allocate_array_helper<A, T[N], Y> {
template<typename A9, typename T9, typename Y9>
friend class allocate_array_helper;
typedef typename A::template rebind<Y> ::other A2;
typedef typename A::template rebind<char>::other A3;
public:
typedef typename A2::value_type value_type;
typedef typename A2::pointer pointer;
typedef typename A2::const_pointer const_pointer;
typedef typename A2::reference reference;
typedef typename A2::const_reference const_reference;
typedef typename A2::size_type size_type;
typedef typename A2::difference_type difference_type;
template<typename U>
struct rebind {
typedef allocate_array_helper<A, T[N], U> other;
};
allocate_array_helper(const A& allocator, T** data)
: allocator(allocator),
data(data) {
}
template<class U>
allocate_array_helper(const allocate_array_helper<A, T[N], U>& other)
: allocator(other.allocator),
data(other.data) {
}
pointer address(reference value) const {
return allocator.address(value);
}
const_pointer address(const_reference value) const {
return allocator.address(value);
}
size_type max_size() const {
return allocator.max_size();
}
pointer allocate(size_type count, const void* value = 0) {
std::size_t a1 = boost::alignment_of<T>::value;
std::size_t n1 = count * sizeof(Y) + a1 - 1;
char* p1 = A3(allocator).allocate(n1 + N1, value);
char* p2 = p1 + n1;
while (std::size_t(p2) % a1 != 0) {
p2--;
}
*data = reinterpret_cast<T*>(p2);
return reinterpret_cast<Y*>(p1);
}
void deallocate(pointer memory, size_type count) {
std::size_t a1 = boost::alignment_of<T>::value;
std::size_t n1 = count * sizeof(Y) + a1 - 1;
char* p1 = reinterpret_cast<char*>(memory);
A3(allocator).deallocate(p1, n1 + N1);
}
void construct(pointer memory, const Y& value) {
allocator.construct(memory, value);
}
void destroy(pointer memory) {
allocator.destroy(memory);
}
template<typename U>
bool operator==(const allocate_array_helper<A, T[N], U>& other) const {
return allocator == other.allocator;
}
template<typename U>
bool operator!=(const allocate_array_helper<A, T[N], U>& other) const {
return !(*this == other);
}
private:
enum {
N1 = N * sizeof(T)
};
A2 allocator;
T** data;
};
}
}
#endif

View File

@ -0,0 +1,124 @@
/*
* Copyright (c) 2012 Glen Joseph Fernandes
* glenfe at live dot com
*
* Distributed under the Boost Software License,
* Version 1.0. (See accompanying file LICENSE_1_0.txt
* or copy at http://boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_SMART_PTR_DETAIL_ARRAY_DELETER_HPP
#define BOOST_SMART_PTR_DETAIL_ARRAY_DELETER_HPP
#include <boost/smart_ptr/detail/array_utility.hpp>
#include <boost/smart_ptr/detail/sp_forward.hpp>
namespace boost {
namespace detail {
template<typename T>
class array_deleter;
template<typename T>
class array_deleter<T[]> {
public:
array_deleter(std::size_t size)
: size(size),
object(0) {
}
~array_deleter() {
if (object) {
array_destroy(object, size);
}
}
void init(T* memory) {
array_init(memory, size);
object = memory;
}
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
void init(T* memory, T&& value) {
array_init_value(memory, size, sp_forward<T>(value));
object = memory;
}
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
template<typename... Args>
void init(T* memory, Args&&... args) {
array_init_args(memory, size, sp_forward<Args>(args)...);
object = memory;
}
#endif
#endif
void init_list(T* memory, const T* list) {
array_init_list(memory, size, list);
object = memory;
}
template<std::size_t M>
void init_list(T* memory, const T* list) {
array_init_list<T, M>(memory, size, list);
object = memory;
}
void noinit(T* memory) {
array_noinit(memory, size);
object = memory;
}
void operator()(const void*) {
if (object) {
array_destroy(object, size);
object = 0;
}
}
private:
std::size_t size;
T* object;
};
template<typename T, std::size_t N>
class array_deleter<T[N]> {
public:
array_deleter()
: object(0) {
}
~array_deleter() {
if (object) {
array_destroy(object, N);
}
}
void init(T* memory) {
array_init(memory, N);
object = memory;
}
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
void init(T* memory, T&& value) {
array_init_value(memory, N, sp_forward<T>(value));
object = memory;
}
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
template<typename... Args>
void init(T* memory, Args&&... args) {
array_init_args(memory, N, sp_forward<Args>(args)...);
object = memory;
}
#endif
#endif
void init_list(T* memory, const T* list) {
array_init_list(memory, N, list);
object = memory;
}
template<std::size_t M>
void init_list(T* memory, const T* list) {
array_init_list<T, M>(memory, N, list);
object = memory;
}
void noinit(T* memory) {
array_noinit(memory, N);
object = memory;
}
void operator()(const void*) {
if (object) {
array_destroy(object, N);
object = 0;
}
}
private:
T* object;
};
}
}
#endif

View File

@ -0,0 +1,53 @@
/*
* Copyright (c) 2012 Glen Joseph Fernandes
* glenfe at live dot com
*
* Distributed under the Boost Software License,
* Version 1.0. (See accompanying file LICENSE_1_0.txt
* or copy at http://boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_SMART_PTR_DETAIL_ARRAY_TRAITS_HPP
#define BOOST_SMART_PTR_DETAIL_ARRAY_TRAITS_HPP
#include <boost/type_traits/remove_cv.hpp>
namespace boost {
namespace detail {
template<typename T>
struct array_base {
typedef typename boost::remove_cv<T>::type type;
};
template<typename T>
struct array_base<T[]> {
typedef typename array_base<T>::type type;
};
template<typename T, std::size_t N>
struct array_base<T[N]> {
typedef typename array_base<T>::type type;
};
template<typename T>
struct array_total {
enum {
size = 1
};
};
template<typename T, std::size_t N>
struct array_total<T[N]> {
enum {
size = N * array_total<T>::size
};
};
template<typename T>
struct array_inner;
template<typename T>
struct array_inner<T[]> {
typedef T type;
};
template<typename T, std::size_t N>
struct array_inner<T[N]> {
typedef T type;
};
}
}
#endif

View File

@ -0,0 +1,178 @@
/*
* Copyright (c) 2012 Glen Joseph Fernandes
* glenfe at live dot com
*
* Distributed under the Boost Software License,
* Version 1.0. (See accompanying file LICENSE_1_0.txt
* or copy at http://boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_SMART_PTR_DETAIL_ARRAY_UTILITY_HPP
#define BOOST_SMART_PTR_DETAIL_ARRAY_UTILITY_HPP
#include <boost/config.hpp>
#include <boost/type_traits/has_trivial_constructor.hpp>
#include <boost/type_traits/has_trivial_destructor.hpp>
namespace boost {
namespace detail {
template<typename T>
inline void array_destroy(T*, std::size_t, boost::true_type) {
}
template<typename T>
inline void array_destroy(T* memory, std::size_t size, boost::false_type) {
for (std::size_t i = size; i > 0; ) {
memory[--i].~T();
}
}
template<typename T>
inline void array_destroy(T* memory, std::size_t size) {
boost::has_trivial_destructor<T> type;
array_destroy(memory, size, type);
}
template<typename T>
inline void array_init(T* memory, std::size_t size, boost::true_type) {
for (std::size_t i = 0; i < size; i++) {
memory[i] = T();
}
}
template<typename T>
inline void array_init(T* memory, std::size_t size, boost::false_type) {
#if !defined(BOOST_NO_EXCEPTIONS)
std::size_t i = 0;
try {
for (; i < size; i++) {
void* p1 = memory + i;
::new(p1) T();
}
} catch (...) {
array_destroy(memory, i);
throw;
}
#else
for (std::size_t i = 0; i < size; i++) {
void* p1 = memory + i;
::new(p1) T();
}
#endif
}
template<typename T>
inline void array_init(T* memory, std::size_t size) {
boost::has_trivial_default_constructor<T> type;
array_init(memory, size, type);
}
#if !defined(BOOST_NO_CXX11_RVALUE_REFERENCES)
template<typename T>
inline void array_init_value(T* memory, std::size_t size, T&& value) {
#if !defined(BOOST_NO_EXCEPTIONS)
std::size_t i = 0;
try {
for (; i < size; i++) {
void* p1 = memory + i;
::new(p1) T(value);
}
} catch (...) {
array_destroy(memory, i);
throw;
}
#else
for (std::size_t i = 0; i < size; i++) {
void* p1 = memory + i;
::new(p1) T(value);
}
#endif
}
#if !defined(BOOST_NO_CXX11_VARIADIC_TEMPLATES)
template<typename T, typename... Args>
inline void array_init_args(T* memory, std::size_t size, Args&&... args) {
#if !defined(BOOST_NO_EXCEPTIONS)
std::size_t i = 0;
try {
for (; i < size; i++) {
void* p1 = memory + i;
::new(p1) T(args...);
}
} catch (...) {
array_destroy(memory, i);
throw;
}
#else
for (std::size_t i = 0; i < size; i++) {
void* p1 = memory + i;
::new(p1) T(args...);
}
#endif
}
#endif
#endif
template<typename T>
inline void array_init_list(T* memory, std::size_t size, const T* list) {
#if !defined(BOOST_NO_EXCEPTIONS)
std::size_t i = 0;
try {
for (; i < size; i++) {
void* p1 = memory + i;
::new(p1) T(list[i]);
}
} catch (...) {
array_destroy(memory, i);
throw;
}
#else
for (std::size_t i = 0; i < size; i++) {
void* p1 = memory + i;
::new(p1) T(list[i]);
}
#endif
}
template<typename T, std::size_t N>
inline void array_init_list(T* memory, std::size_t size, const T* list) {
#if !defined(BOOST_NO_EXCEPTIONS)
std::size_t i = 0;
try {
for (; i < size; i++) {
void* p1 = memory + i;
::new(p1) T(list[i % N]);
}
} catch (...) {
array_destroy(memory, i);
throw;
}
#else
for (std::size_t i = 0; i < size; i++) {
void* p1 = memory + i;
::new(p1) T(list[i % N]);
}
#endif
}
template<typename T>
inline void array_noinit(T*, std::size_t, boost::true_type) {
}
template<typename T>
inline void array_noinit(T* memory, std::size_t size, boost::false_type) {
#if !defined(BOOST_NO_EXCEPTIONS)
std::size_t i = 0;
try {
for (; i < size; i++) {
void* p1 = memory + i;
::new(p1) T;
}
} catch (...) {
array_destroy(memory, i);
throw;
}
#else
for (std::size_t i = 0; i < size; i++) {
void* p1 = memory + i;
::new(p1) T;
}
#endif
}
template<typename T>
inline void array_noinit(T* memory, std::size_t size) {
boost::has_trivial_default_constructor<T> type;
array_noinit(memory, size, type);
}
}
}
#endif

View File

@ -0,0 +1,157 @@
/*
* Copyright (c) 2012 Glen Joseph Fernandes
* glenfe at live dot com
*
* Distributed under the Boost Software License,
* Version 1.0. (See accompanying file LICENSE_1_0.txt
* or copy at http://boost.org/LICENSE_1_0.txt)
*/
#ifndef BOOST_SMART_PTR_DETAIL_MAKE_ARRAY_HELPER_HPP
#define BOOST_SMART_PTR_DETAIL_MAKE_ARRAY_HELPER_HPP
#include <boost/type_traits/alignment_of.hpp>
namespace boost {
namespace detail {
template<typename T, typename Y = char>
class make_array_helper;
template<typename T, typename Y>
class make_array_helper<T[], Y> {
template<typename T2, typename Y2>
friend class make_array_helper;
public:
typedef Y value_type;
typedef Y* pointer;
typedef const Y* const_pointer;
typedef Y& reference;
typedef const Y& const_reference;
typedef std::size_t size_type;
typedef ptrdiff_t difference_type;
template<typename U>
struct rebind {
typedef make_array_helper<T[], U> other;
};
make_array_helper(std::size_t size, T** data)
: size(sizeof(T) * size),
data(data) {
}
template<class U>
make_array_helper(const make_array_helper<T[], U>& other)
: size(other.size),
data(other.data) {
}
pointer address(reference value) const {
return &value;
}
const_pointer address(const_reference value) const {
return &value;
}
size_type max_size() const {
return static_cast<std::size_t>(-1) / sizeof(Y);
}
pointer allocate(size_type count, const void* = 0) {
std::size_t a1 = boost::alignment_of<T>::value;
std::size_t n1 = count * sizeof(Y) + a1 - 1;
void* p1 = ::operator new(n1 + size);
char* p2 = static_cast<char*>(p1) + n1;
while (std::size_t(p2) % a1 != 0) {
p2--;
}
*data = reinterpret_cast<T*>(p2);
return reinterpret_cast<Y*>(p1);
}
void deallocate(pointer memory, size_type) {
void* p1 = memory;
::operator delete(p1);
}
void construct(pointer memory, const Y& value) {
void* p1 = memory;
::new(p1) Y(value);
}
void destroy(pointer memory) {
memory->~Y();
}
template<typename U>
bool operator==(const make_array_helper<T[], U>& other) const {
return true;
}
template<typename U>
bool operator!=(const make_array_helper<T[], U>& other) const {
return !(*this == other);
}
private:
std::size_t size;
T** data;
};
template<typename T, std::size_t N, typename Y>
class make_array_helper<T[N], Y> {
template<typename T2, typename Y2>
friend class make_array_helper;
public:
typedef Y value_type;
typedef Y* pointer;
typedef const Y* const_pointer;
typedef Y& reference;
typedef const Y& const_reference;
typedef std::size_t size_type;
typedef ptrdiff_t difference_type;
template<typename U>
struct rebind {
typedef make_array_helper<T[N], U> other;
};
make_array_helper(T** data)
: data(data) {
}
template<class U>
make_array_helper(const make_array_helper<T[N], U>& other)
: data(other.data) {
}
pointer address(reference value) const {
return &value;
}
const_pointer address(const_reference value) const {
return &value;
}
size_type max_size() const {
return static_cast<std::size_t>(-1) / sizeof(Y);
}
pointer allocate(size_type count, const void* = 0) {
std::size_t a1 = boost::alignment_of<T>::value;
std::size_t n1 = count * sizeof(Y) + a1 - 1;
void* p1 = ::operator new(n1 + N1);
char* p2 = static_cast<char*>(p1) + n1;
while (std::size_t(p2) % a1 != 0) {
p2--;
}
*data = reinterpret_cast<T*>(p2);
return reinterpret_cast<Y*>(p1);
}
void deallocate(pointer memory, size_type) {
void* p1 = memory;
::operator delete(p1);
}
void construct(pointer memory, const Y& value) {
void* p1 = memory;
::new(p1) Y(value);
}
void destroy(pointer memory) {
memory->~Y();
}
template<typename U>
bool operator==(const make_array_helper<T[N], U>& other) const {
return true;
}
template<typename U>
bool operator!=(const make_array_helper<T[N], U>& other) const {
return !(*this == other);
}
private:
enum {
N1 = N * sizeof(T)
};
T** data;
};
}
}
#endif

View File

@ -1,14 +1,21 @@
// This header intentionally has no include guards. // This header intentionally has no include guards.
// //
// Copyright (c) 2001-2009 Peter Dimov // Copyright (c) 2001-2009, 2012 Peter Dimov
// //
// Distributed under the Boost Software License, Version 1.0. // Distributed under the Boost Software License, Version 1.0.
// See accompanying file LICENSE_1_0.txt or copy at // See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt // http://www.boost.org/LICENSE_1_0.txt
#if ( defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, < 0x570) ) || defined(__CINT__) #if !defined( BOOST_NO_CXX11_EXPLICIT_CONVERSION_OPERATORS ) && !defined( BOOST_NO_CXX11_NULLPTR )
operator bool () const explicit operator bool () const BOOST_NOEXCEPT
{
return px != 0;
}
#elif ( defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, < 0x570) ) || defined(__CINT__)
operator bool () const BOOST_NOEXCEPT
{ {
return px != 0; return px != 0;
} }
@ -21,7 +28,7 @@
typedef void (*unspecified_bool_type)( this_type*** ); typedef void (*unspecified_bool_type)( this_type*** );
operator unspecified_bool_type() const // never throws operator unspecified_bool_type() const BOOST_NOEXCEPT
{ {
return px == 0? 0: unspecified_bool; return px == 0? 0: unspecified_bool;
} }
@ -31,18 +38,18 @@
( defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ < 304) ) || \ ( defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ < 304) ) || \
( defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, <= 0x590) ) ( defined(__SUNPRO_CC) && BOOST_WORKAROUND(__SUNPRO_CC, <= 0x590) )
typedef T * (this_type::*unspecified_bool_type)() const; typedef element_type * (this_type::*unspecified_bool_type)() const;
operator unspecified_bool_type() const // never throws operator unspecified_bool_type() const BOOST_NOEXCEPT
{ {
return px == 0? 0: &this_type::get; return px == 0? 0: &this_type::get;
} }
#else #else
typedef T * this_type::*unspecified_bool_type; typedef element_type * this_type::*unspecified_bool_type;
operator unspecified_bool_type() const // never throws operator unspecified_bool_type() const BOOST_NOEXCEPT
{ {
return px == 0? 0: &this_type::px; return px == 0? 0: &this_type::px;
} }
@ -50,7 +57,7 @@
#endif #endif
// operator! is redundant, but some compilers need it // operator! is redundant, but some compilers need it
bool operator! () const // never throws bool operator! () const BOOST_NOEXCEPT
{ {
return px == 0; return px == 0;
} }

View File

@ -35,7 +35,14 @@
// rather than including <memory> directly: // rather than including <memory> directly:
#include <boost/config/no_tr1/memory.hpp> // std::auto_ptr #include <boost/config/no_tr1/memory.hpp> // std::auto_ptr
#include <functional> // std::less #include <functional> // std::less
#include <new> // std::bad_alloc
#ifdef BOOST_NO_EXCEPTIONS
# include <new> // std::bad_alloc
#endif
#if !defined( BOOST_NO_CXX11_SMART_PTR )
# include <boost/utility/addressof.hpp>
#endif
namespace boost namespace boost
{ {
@ -56,6 +63,38 @@ template< class D > struct sp_inplace_tag
{ {
}; };
#if !defined( BOOST_NO_CXX11_SMART_PTR )
template< class T > class sp_reference_wrapper
{
public:
explicit sp_reference_wrapper( T & t): t_( boost::addressof( t ) )
{
}
template< class Y > void operator()( Y * p ) const
{
(*t_)( p );
}
private:
T * t_;
};
template< class D > struct sp_convert_reference
{
typedef D type;
};
template< class D > struct sp_convert_reference< D& >
{
typedef sp_reference_wrapper< D > type;
};
#endif
class weak_count; class weak_count;
class shared_count class shared_count
@ -298,6 +337,33 @@ public:
r.release(); r.release();
} }
#endif
#if !defined( BOOST_NO_CXX11_SMART_PTR )
template<class Y, class D>
explicit shared_count( std::unique_ptr<Y, D> & r ): pi_( 0 )
#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
, id_(shared_count_id)
#endif
{
typedef typename sp_convert_reference<D>::type D2;
D2 d2( r.get_deleter() );
pi_ = new sp_counted_impl_pd< typename std::unique_ptr<Y, D>::pointer, D2 >( r.get(), d2 );
#ifdef BOOST_NO_EXCEPTIONS
if( pi_ == 0 )
{
boost::throw_exception( std::bad_alloc() );
}
#endif
r.release();
}
#endif #endif
~shared_count() // nothrow ~shared_count() // nothrow
@ -316,7 +382,7 @@ public:
if( pi_ != 0 ) pi_->add_ref_copy(); if( pi_ != 0 ) pi_->add_ref_copy();
} }
#if defined( BOOST_HAS_RVALUE_REFS ) #if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
shared_count(shared_count && r): pi_(r.pi_) // nothrow shared_count(shared_count && r): pi_(r.pi_) // nothrow
#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)
@ -381,6 +447,11 @@ public:
{ {
return pi_? pi_->get_deleter( ti ): 0; return pi_? pi_->get_deleter( ti ): 0;
} }
void * get_untyped_deleter() const
{
return pi_? pi_->get_untyped_deleter(): 0;
}
}; };
@ -423,7 +494,7 @@ public:
// Move support // Move support
#if defined( BOOST_HAS_RVALUE_REFS ) #if !defined( BOOST_NO_CXX11_RVALUE_REFERENCES )
weak_count(weak_count && r): pi_(r.pi_) // nothrow weak_count(weak_count && r): pi_(r.pi_) // nothrow
#if defined(BOOST_SP_ENABLE_DEBUG_HOOKS) #if defined(BOOST_SP_ENABLE_DEBUG_HOOKS)

View File

@ -48,6 +48,21 @@ template< class Y, class T > struct sp_convertible
enum _vt { value = sizeof( (f)( static_cast<Y*>(0) ) ) == sizeof(yes) }; enum _vt { value = sizeof( (f)( static_cast<Y*>(0) ) ) == sizeof(yes) };
}; };
template< class Y, class T > struct sp_convertible< Y, T[] >
{
enum _vt { value = false };
};
template< class Y, class T > struct sp_convertible< Y[], T[] >
{
enum _vt { value = sp_convertible< Y[1], T[1] >::value };
};
template< class Y, std::size_t N, class T > struct sp_convertible< Y[N], T[] >
{
enum _vt { value = sp_convertible< Y[1], T[1] >::value };
};
struct sp_empty struct sp_empty
{ {
}; };

View File

@ -32,25 +32,28 @@
#elif defined( BOOST_DISABLE_THREADS ) && !defined( BOOST_SP_ENABLE_THREADS ) && !defined( BOOST_DISABLE_WIN32 ) #elif defined( BOOST_DISABLE_THREADS ) && !defined( BOOST_SP_ENABLE_THREADS ) && !defined( BOOST_DISABLE_WIN32 )
# include <boost/smart_ptr/detail/sp_counted_base_nt.hpp> # include <boost/smart_ptr/detail/sp_counted_base_nt.hpp>
#elif defined( __GNUC__ ) && ( defined( __i386__ ) || defined( __x86_64__ ) ) #elif defined( __SNC__ )
# include <boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp> # include <boost/smart_ptr/detail/sp_counted_base_snc_ps3.hpp>
#elif defined( __GNUC__ ) && defined( __ia64__ ) && !defined( __INTEL_COMPILER ) #elif defined( __GNUC__ ) && ( defined( __i386__ ) || defined( __x86_64__ ) ) && !defined(__PATHSCALE__)
# include <boost/smart_ptr/detail/sp_counted_base_gcc_ia64.hpp> # include <boost/smart_ptr/detail/sp_counted_base_gcc_x86.hpp>
#elif defined(__HP_aCC) && defined(__ia64) #elif defined(__HP_aCC) && defined(__ia64)
# include <boost/smart_ptr/detail/sp_counted_base_acc_ia64.hpp> # include <boost/smart_ptr/detail/sp_counted_base_acc_ia64.hpp>
#elif defined( __GNUC__ ) && defined( __ia64__ ) && !defined( __INTEL_COMPILER ) && !defined(__PATHSCALE__)
# include <boost/smart_ptr/detail/sp_counted_base_gcc_ia64.hpp>
#elif defined( __IBMCPP__ ) && defined( __powerpc ) #elif defined( __IBMCPP__ ) && defined( __powerpc )
# include <boost/smart_ptr/detail/sp_counted_base_vacpp_ppc.hpp> # include <boost/smart_ptr/detail/sp_counted_base_vacpp_ppc.hpp>
#elif defined( __MWERKS__ ) && defined( __POWERPC__ ) #elif defined( __MWERKS__ ) && defined( __POWERPC__ )
# include <boost/smart_ptr/detail/sp_counted_base_cw_ppc.hpp> # include <boost/smart_ptr/detail/sp_counted_base_cw_ppc.hpp>
#elif defined( __GNUC__ ) && ( defined( __powerpc__ ) || defined( __ppc__ ) || defined( __ppc ) ) #elif defined( __GNUC__ ) && ( defined( __powerpc__ ) || defined( __ppc__ ) || defined( __ppc ) ) && !defined(__PATHSCALE__) && !defined( _AIX )
# include <boost/smart_ptr/detail/sp_counted_base_gcc_ppc.hpp> # include <boost/smart_ptr/detail/sp_counted_base_gcc_ppc.hpp>
#elif defined( __GNUC__ ) && ( defined( __mips__ ) || defined( _mips ) ) #elif defined( __GNUC__ ) && ( defined( __mips__ ) || defined( _mips ) ) && !defined(__PATHSCALE__)
# include <boost/smart_ptr/detail/sp_counted_base_gcc_mips.hpp> # include <boost/smart_ptr/detail/sp_counted_base_gcc_mips.hpp>
#elif defined( BOOST_SP_HAS_SYNC ) #elif defined( BOOST_SP_HAS_SYNC )
@ -62,6 +65,9 @@
#elif defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || defined(__CYGWIN__) #elif defined( WIN32 ) || defined( _WIN32 ) || defined( __WIN32__ ) || defined(__CYGWIN__)
# include <boost/smart_ptr/detail/sp_counted_base_w32.hpp> # include <boost/smart_ptr/detail/sp_counted_base_w32.hpp>
#elif defined( _AIX )
# include <boost/smart_ptr/detail/sp_counted_base_aix.hpp>
#elif !defined( BOOST_HAS_THREADS ) #elif !defined( BOOST_HAS_THREADS )
# include <boost/smart_ptr/detail/sp_counted_base_nt.hpp> # include <boost/smart_ptr/detail/sp_counted_base_nt.hpp>

View File

@ -104,6 +104,7 @@ public:
} }
virtual void * get_deleter( sp_typeinfo const & ti ) = 0; virtual void * get_deleter( sp_typeinfo const & ti ) = 0;
virtual void * get_untyped_deleter() = 0;
void add_ref_copy() void add_ref_copy()
{ {

View File

@ -0,0 +1,143 @@
#ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_AIX_HPP_INCLUDED
#define BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_AIX_HPP_INCLUDED
//
// detail/sp_counted_base_aix.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 <builtins.h>
#include <sys/atomic_op.h>
namespace boost
{
namespace detail
{
inline void atomic_increment( int32_t* pw )
{
// ++*pw;
fetch_and_add( pw, 1 );
}
inline int32_t atomic_decrement( int32_t * pw )
{
// return --*pw;
int32_t originalValue;
__lwsync();
originalValue = fetch_and_add( pw, -1 );
__isync();
return (originalValue - 1);
}
inline int32_t atomic_conditional_increment( int32_t * pw )
{
// if( *pw != 0 ) ++*pw;
// return *pw;
int32_t tmp = fetch_and_add( pw, 0 );
for( ;; )
{
if( tmp == 0 ) return 0;
if( compare_and_swap( pw, &tmp, tmp + 1 ) ) return (tmp + 1);
}
}
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;
virtual void * get_untyped_deleter() = 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 fetch_and_add( const_cast<int32_t*>(&use_count_), 0 );
}
};
} // namespace detail
} // namespace boost
#endif // #ifndef BOOST_SMART_PTR_DETAIL_SP_COUNTED_BASE_AIX_HPP_INCLUDED

View File

@ -124,6 +124,7 @@ public:
} }
virtual void * get_deleter( sp_typeinfo const & ti ) = 0; virtual void * get_deleter( sp_typeinfo const & ti ) = 0;
virtual void * get_untyped_deleter() = 0;
void add_ref_copy() void add_ref_copy()
{ {

View File

@ -111,6 +111,7 @@ public:
} }
virtual void * get_deleter( sp_typeinfo const & ti ) = 0; virtual void * get_deleter( sp_typeinfo const & ti ) = 0;
virtual void * get_untyped_deleter() = 0;
void add_ref_copy() void add_ref_copy()
{ {

View File

@ -135,6 +135,7 @@ public:
} }
virtual void * get_deleter( sp_typeinfo const & ti ) = 0; virtual void * get_deleter( sp_typeinfo const & ti ) = 0;
virtual void * get_untyped_deleter() = 0;
void add_ref_copy() void add_ref_copy()
{ {

View File

@ -135,6 +135,7 @@ public:
} }
virtual void * get_deleter( sp_typeinfo const & ti ) = 0; virtual void * get_deleter( sp_typeinfo const & ti ) = 0;
virtual void * get_untyped_deleter() = 0;
void add_ref_copy() void add_ref_copy()
{ {

View File

@ -120,6 +120,7 @@ public:
} }
virtual void * get_deleter( sp_typeinfo const & ti ) = 0; virtual void * get_deleter( sp_typeinfo const & ti ) = 0;
virtual void * get_untyped_deleter() = 0;
void add_ref_copy() void add_ref_copy()
{ {

View File

@ -127,6 +127,7 @@ public:
} }
virtual void * get_deleter( sp_typeinfo const & ti ) = 0; virtual void * get_deleter( sp_typeinfo const & ti ) = 0;
virtual void * get_untyped_deleter() = 0;
void add_ref_copy() void add_ref_copy()
{ {

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